/* ============================================================
   ronde-contact.css: the new ("Ronde") contact page, contact-ronde.html
   ------------------------------------------------------------
   Only that page loads this file (header rules: ronde-header.css).
   Rules: docs/rondeDesignRules.md and docs/halftoneInkElement.md.
   A light heading with the halftone trefoil beside it (drawn by
   js/rondeContact.js), then one white card per way to get in touch.
   Each card owns one circle of the trefoil (data-lobe). Follows the
   system light or dark appearance, like the projects page.
   ============================================================ */

/* Tokens: the same values as the other Ronde pages. */
:root {
    --rh-bg: #fff;
    --rh-card: #fff;
    --rh-ink: #111214;
    --rh-text-2: rgba(17, 18, 20, .62);
    --rh-muted: rgba(17, 18, 20, .42);
    --rh-line: rgba(17, 18, 20, .1);
    --rh-line-strong: rgba(17, 18, 20, .22);
    --rh-fill: rgba(17, 18, 20, .07);
    --rh-fill-hover: rgba(17, 18, 20, .04);
    --rh-primary-hover: #34363b;
    /* On the dark tile (ink background): secondary text and hairlines. */
    --rh-on-ink-2: rgba(255, 255, 255, .64);
    --rh-on-ink-line: rgba(255, 255, 255, .26);
    --rh-green: #3DA73C;
    --rh-ultramarine: #3B2E9E;
    --rh-panel-shadow: 0 4px 10px rgba(17, 18, 20, .025), 0 12px 28px rgba(17, 18, 20, .055);
    --rh-lift-shadow: 0 6px 14px rgba(17, 18, 20, .04), 0 18px 36px rgba(17, 18, 20, .08);
    --rh-ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.rh {
    min-height: 100vh;
    background: var(--rh-bg);
    color: var(--rh-ink);
    font-family: 'Urbanist', system-ui, sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

body.rh a { color: inherit; text-decoration: none; }
body.rh button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--rh-ink); outline-offset: 3px; }

.ct-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px 64px;
}

/* ── Shared bits (same as the home page) ── */
.rh-lab {
    color: var(--rh-text-2);
    font-size: 14px;
}

.rh-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px;
    border: 1px solid var(--rh-line-strong);
    border-radius: 999px;
    font-size: 14px;
}

.rh-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--rh-green);
}

.rh-pulse { position: relative; }

.rh-pulse::after {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--rh-green);
    content: '';
    animation: rh-pulse 2s ease-out infinite;
}

@keyframes rh-pulse {
    from { opacity: .6; transform: scale(.8); }
    to   { opacity: 0;  transform: scale(2.6); }
}

.rh-hub {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--rh-ink);
    color: var(--rh-bg);
    font-size: 14px;
}

.ct-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ── Layout: heading and trefoil side by side, the cards across below ── */
.ct-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    grid-template-areas:
        "hero art"
        "cards cards";
    column-gap: 32px;
    align-items: center;
    margin-top: 12px;
}

.ct-hero { grid-area: hero; }
.ct-art { grid-area: art; }
.ct-cards { grid-area: cards; }

.ct-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.ct-title {
    margin-top: 12px;
    font-size: clamp(46px, 5.6vw, 68px);
    font-weight: 400;
    line-height: 1.04;
}

/* The page's one accent, as on the home page's name. */
.ct-title b { font-weight: 400; color: var(--rh-ultramarine); }

.ct-sub {
    max-width: 460px;
    margin-top: 16px;
    color: var(--rh-text-2);
    font-size: 17px;
    line-height: 1.6;
}

/* The canvas fades in when rondeContact.js starts drawing it. */
.ct-art {
    position: relative;
    height: 380px;
}

.ct-art canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ── Cards (RDL widget: icon circle top left, action circle top right,
   label and value at the bottom). The link's ::after covers the whole
   card, so a click anywhere on it opens the link; the copy button sits
   above that layer. The link comes first in the HTML, so Tab and screen
   readers reach it before the copy button; order puts the icon row on top. ── */
.ct-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 44px;
    list-style: none;
}

.ct-card {
    --ct-radius: 28px;
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 184px;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 20px 22px 22px;
    border: 1px solid var(--rh-line);
    border-radius: var(--ct-radius);
    background: var(--rh-card);
    box-shadow: var(--rh-panel-shadow);
    transition: transform .25s var(--rh-ease), box-shadow .25s var(--rh-ease);
    /* Keeps .ct-card__art (z-index -1) above the card's white, under its text. */
    isolation: isolate;
}

/* The card's logo in small ink dots behind its content, drawn by
   rondeContact.js larger than the card, so the card's edge cuts it off.
   Quiet at rest, a step darker while the card is hovered or focused.
   .ct-card__near is the same dots larger and solid, shown only in a soft circle
   around the pointer: rondeContact.js sets --mx and --my (the pointer
   against this box, even outside it) and --near (0 to 1, how present it
   is), so the dark patch follows the pointer and reaches into the card
   before the pointer does. */
.ct-card__art {
    --mx: -999px;
    --my: -999px;
    --near: 0;
    position: absolute;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    border-radius: calc(var(--ct-radius) - 1px);
    color: var(--rh-ink);
    pointer-events: none;
}

.ct-card__art canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .24;
    transition: opacity .3s var(--rh-ease);
}

.ct-card:is(:hover, :focus-within) .ct-card__art canvas { opacity: .32; }

.ct-card__art .ct-card__near,
.ct-card:is(:hover, :focus-within) .ct-card__art .ct-card__near {
    opacity: 1;
    -webkit-mask-image: radial-gradient(circle 240px at var(--mx) var(--my),
        rgba(0, 0, 0, var(--near)) 30%, rgba(0, 0, 0, calc(var(--near) * .6)) 60%, transparent);
    mask-image: radial-gradient(circle 240px at var(--mx) var(--my),
        rgba(0, 0, 0, var(--near)) 30%, rgba(0, 0, 0, calc(var(--near) * .6)) 60%, transparent);
    transition: none;
}

.ct-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rh-lift-shadow);
}

.ct-card__top {
    display: flex;
    order: -1;
    align-items: center;
    gap: 8px;
}

.ct-card__icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-right: auto;
    border: 1px solid var(--rh-line-strong);
    border-radius: 50%;
    font-size: 18px;
}

.ct-card__link {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.ct-card__link::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    border-radius: var(--ct-radius);
    content: '';
}

.ct-card__link:focus-visible { outline: none; }

.ct-card__link:focus-visible::after {
    outline: 2px solid var(--rh-ink);
    outline-offset: 3px;
}

.ct-card__label {
    color: var(--rh-text-2);
    font-size: 14px;
}

.ct-card__value {
    font-size: clamp(17px, 1.65vw, 20px);
    font-weight: 500;
    letter-spacing: -.01em;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ct-card__value small {
    margin-left: 2px;
    color: var(--rh-muted);
    font-size: .7em;
    font-weight: 400;
    letter-spacing: 0;
}

/* Action circles: Email is the page's one primary action (solid); the
   others are outline circles that fill on hover. */
body.rh .ct-card__go {
    width: 40px;
    height: 40px;
    font-size: 15px;
    transition: background .2s, color .2s, border-color .2s;
}

body.rh .ct-card__go .icon { transition: transform .3s var(--rh-ease); }
.ct-card:hover .ct-card__go .icon { transform: translateX(2px); }
.ct-card:hover .icon--arrow-up-right { transform: translate(1px, -1px); }

body.rh .ct-card--email .ct-card__go { color: var(--rh-bg); }
body.rh .ct-card--email:hover .ct-card__go { background: var(--rh-primary-hover); }

body.rh :is(.ct-card--github, .ct-card--linkedin) .ct-card__go {
    border: 1px solid var(--rh-line-strong);
    background: var(--rh-card);
    color: var(--rh-ink);
}

body.rh :is(.ct-card--github, .ct-card--linkedin):hover .ct-card__go {
    border-color: var(--rh-ink);
    background: var(--rh-ink);
    color: var(--rh-bg);
}

/* GitHub, the middle card, is inverted: ink background, paper text, and its
   logo dots in paper (rondeContact.js reads the art's colour). Turns light
   in dark mode, like the current tab. */
.ct-card--github {
    border-color: var(--rh-ink);
    background: var(--rh-ink);
    color: var(--rh-bg);
}

.ct-card--github .ct-card__art { color: var(--rh-bg); }
.ct-card--github .ct-card__art canvas { opacity: .36; }
.ct-card--github:is(:hover, :focus-within) .ct-card__art canvas { opacity: .46; }
.ct-card--github .ct-card__label { color: var(--rh-on-ink-2); }
.ct-card--github .ct-card__icon { border-color: var(--rh-on-ink-line); }
.ct-card--github .ct-card__link:focus-visible::after { outline-color: var(--rh-bg); }

body.rh .ct-card--github .ct-card__go {
    border-color: var(--rh-on-ink-line);
    background: transparent;
    color: var(--rh-bg);
}

body.rh .ct-card--github:hover .ct-card__go {
    border-color: var(--rh-bg);
    background: var(--rh-bg);
    color: var(--rh-ink);
}

/* The small circle beside the action circle: copy the email. */
.ct-copy {
    position: relative;
    z-index: 2;
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rh-line-strong);
    border-radius: 50%;
    background: var(--rh-card);
    font-size: 15px;
    transition: background .2s, color .2s, border-color .2s, transform .15s;
}

.ct-copy:hover {
    border-color: var(--rh-ink);
    background: var(--rh-ink);
    color: var(--rh-bg);
}

.ct-copy:active { transform: scale(.94); }
.ct-copy[hidden] { display: none; }
.ct-copy.is-done .icon { --icon: var(--icon-check); }

/* ── Static text (rondeContactGlitch.js): when the pointer moves onto a
   different panel, each piece of its text gets a canvas that rebuilds it
   from flickering dots, as on the projects page's filter. The real text is
   hidden meanwhile; text-fill doesn't touch the colour transitions, so it
   hides and comes back at once. The heading does the same in bigger dots
   while its word turns into the panel's name. ── */
.ct-card__label,
.ct-card__value,
.ct-title { position: relative; }

.ct-glitch { position: absolute; pointer-events: none; }

.is-glitching { -webkit-text-fill-color: transparent; }

/* ── Load-in: a short rise, in reading order ── */
.ct-fx { animation: ct-rise .5s var(--rh-ease) both; animation-delay: calc(var(--d, 0) * 60ms); }

@keyframes ct-rise {
    from { opacity: 0; transform: translateY(8px); }
}

/* ── Mid widths: Email takes the full row, GitHub and LinkedIn share the next ── */
@media (max-width: 1020px) and (min-width: 761px) {
    .ct-main { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); }
    .ct-art { height: 330px; }
    .ct-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ct-card--email { grid-column: 1 / 3; }
    .ct-card { min-height: 168px; }
}

/* ── Phones: heading, cards, the second row, then the trefoil ── */
@media (max-width: 760px) {
    .ct-page { padding: 0 16px 40px; }
    .ct-main {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "hero"
            "cards"
            "art";
        margin-top: 28px;
    }
    .ct-sub { font-size: 16px; }
    .ct-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 28px; }
    .ct-card { --ct-radius: 24px; min-height: 152px; gap: 22px; padding: 18px 18px 20px; }
    .ct-card__value { font-size: 18px; }
    .ct-art { height: 300px; margin-top: 16px; }
}

/* ── Dark: the same rules inverted (rondeDesignRules.md). The trefoil reads
   --rh-ink, so its dots turn light. ── */
@media (prefers-color-scheme: dark) {
    :root {
        --rh-bg: #0e0f11;
        --rh-card: #17181b;
        --rh-ink: #f7f7f7;
        --rh-text-2: rgba(255, 255, 255, .7);
        --rh-muted: rgba(255, 255, 255, .45);
        --rh-line: rgba(255, 255, 255, .1);
        --rh-line-strong: rgba(255, 255, 255, .24);
        --rh-fill: rgba(255, 255, 255, .1);
        --rh-fill-hover: rgba(255, 255, 255, .07);
        --rh-primary-hover: #d9d9dc;
        --rh-on-ink-2: rgba(17, 18, 20, .62);
        --rh-on-ink-line: rgba(17, 18, 20, .24);
        --rh-ultramarine: #8f86e8;
        --rh-panel-shadow: 0 4px 12px rgba(0, 0, 0, .25);
        --rh-lift-shadow: 0 8px 22px rgba(0, 0, 0, .4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .rh-pulse::after { animation: none; }
    .ct-fx { animation: none; }
    .ct-card,
    .ct-card__art canvas,
    .ct-copy,
    body.rh .ct-card__go,
    body.rh .ct-card__go .icon { transition: none; }
    .ct-card:hover { transform: none; }
}
