/* =========================================================================
   Edgar Pineda — AI Automation Portfolio
   css/styles.css
   Palette: warm charcoal + ember (amber ~33° hue). Deliberately NOT the
   navy-black + cyan "AI-SaaS" signature — the warm ember reads as an
   intentional, editorial choice and keeps the particle glow rich.
   60-30-10:  ~60% charcoal canvas · ~30% raised surfaces · ~10% ember accent
   Golden ratio (1.618): spacing scale steps + section rhythm + about split.
   WCAG AA (verified pairs):
     body  #b7b0a6 on #121110 ≈ 9.4:1
     hi    #f3efe9 on #121110 ≈ 15.6:1
     accent #f0a04b on #121110 ≈ 7.1:1  (large text + UI only)
   ========================================================================= */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */
:root {
    /* Color — warm charcoal scale (60/30/10) */
    --bg-0:        #121110;   /* base canvas (60%) */
    --bg-1:        #191713;   /* raised surface (30%) */
    --bg-2:        #221f19;   /* elevated / hover (30%) */
    --line:        #322d25;   /* hairline borders */
    --line-soft:   #26221c;
    --text-hi:     #f3efe9;   /* headings */
    --text-mid:    #b7b0a6;   /* body */
    --text-low:    #7d766c;   /* muted / labels */
    --accent:      #f0a04b;   /* ember (10%) */
    --accent-2:    #d97b34;   /* deeper ember */
    --accent-glow: rgba(240, 160, 75, 0.35);

    /* Type — webfonts loaded in index.html (Inter + Space Grotesk).
       Mono accent uses the system monospace stack (offline-safe). */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, sans-serif;
    --font-mono:    ui-monospace, 'Cascadia Code', 'Consolas', monospace;

    /* Spacing — 8px base grown by golden-ratio-ish steps */
    --s-1: 8px;
    --s-2: 13px;
    --s-3: 21px;
    --s-4: 34px;
    --s-5: 55px;

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-pill: 999px;

    /* Motion */
    --ease: cubic-bezier(.22, 1, .36, 1);
    --t-fast: 180ms;
    --t-med:  340ms;
    --t-slow: 620ms;

    /* Layout */
    --wrap: 1120px;
    --nav-h: 68px;
}

/* ---------------------------------------------------------------------
   2. RESET / BASE
   --------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Reserves the vertical scrollbar's width permanently, so toggling it off
   (body.modal-open below) can't change the content box width and cause a
   horizontal shift. Support: Chrome/Edge 94+, Firefox 97+ — unsupported
   browsers just get the old behavior back, no breakage. */
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
    background: var(--bg-0);
    color: var(--text-mid);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* Prevent long words breaking layout on narrow screens */
    overflow-wrap: break-word;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #14100a; }

/* ---------------------------------------------------------------------
   3. PARTICLE CANVAS + VIGNETTE  (fixed, behind everything)
   --------------------------------------------------------------------- */
#field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;   /* clicks pass through to the UI */
    opacity: .9;
}

/* Warm vignette over the canvas: ember wash top-right, depth at edges */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 70% 8%, rgba(240,160,75,.06), transparent 46%),
        radial-gradient(90% 80% at 15% 95%, rgba(217,123,52,.05), transparent 50%),
        linear-gradient(180deg, rgba(18,17,16,.2), rgba(18,17,16,.55));
}

/* ---------------------------------------------------------------------
   4. CUSTOM CURSOR RING  (fine pointers only; JS controls position)
   --------------------------------------------------------------------- */
.cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(240,160,75,.55);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition:
        width var(--t-med) var(--ease),
        height var(--t-med) var(--ease),
        border-color var(--t-med) var(--ease),
        background var(--t-med) var(--ease),
        opacity .3s linear;
}
.cursor-ring.is-on { opacity: 1; }
/* Enlarged state when over interactive targets (a, .btn, [data-hover]) */
.cursor-ring.is-hover {
    width: 58px; height: 58px;
    border-color: var(--accent);
    background: rgba(240,160,75,.07);
}

/* ---------------------------------------------------------------------
   5. LAYOUT PRIMITIVES
   --------------------------------------------------------------------- */
.wrap {
    width: min(var(--wrap), 92vw);
    margin-inline: auto;
    position: relative;
    z-index: 2;
}

main, .footer { position: relative; z-index: 2; }

/* Every section's content (headings, grids, cards) shares this one cap
   so left edges line up sitewide — without it, elements with their own
   max-width (.section-head at 640px) stay narrow while uncapped ones
   (.work-grid, .about-grid, .contact-inner) stretch to the full browser
   width, misaligning everything and, on wide screens, blowing up card
   sizes. Matches the width nav/hero/footer already use via .wrap. */
.section { padding: var(--s-5) 0; max-width: var(--wrap); margin-inline: auto; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-3);
}

.section-head { max-width: 640px; margin-bottom: var(--s-4); }
.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.4vw, 46px);
    font-weight: 650;
    line-height: 1.08;
    color: var(--text-hi);
    letter-spacing: -.01em;
    margin-bottom: var(--s-2);
}
.section-head p { color: var(--text-mid); max-width: 56ch; }

/* ---------------------------------------------------------------------
   6. NAV
   --------------------------------------------------------------------- */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 50;
    border-bottom: 1px solid transparent;
    transition: background var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
/* Frosted state after scrolling (toggled by JS) */
.nav.scrolled {
    background: rgba(18,17,16,.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--line-soft);
}
.nav-inner {
    width: min(var(--wrap), 92vw);
    height: 100%;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand {
    display: inline-flex; align-items: baseline;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 17px;
    color: var(--text-hi);
    letter-spacing: .01em;
}
.brand-dot { color: var(--accent); }
.brand-dot::after {
    content: "";
    display: inline-block;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow), 0 0 22px var(--accent-glow);
    margin-left: 4px;
    vertical-align: super;
    animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }

.nav-links {
    display: flex; align-items: center; gap: 4px;
    list-style: none;
}
.nav-link {
    position: relative;
    display: inline-block;
    padding: 9px 14px;
    font-size: 14.5px;
    color: var(--text-mid);
    border-radius: var(--r-sm);
    transition: color var(--t-fast) var(--ease);
}
/* Hover effect: underline sweeps in from the left */
.nav-link::after {
    content: "";
    position: absolute;
    left: 14px; right: 14px; bottom: 6px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--t-med) var(--ease);
}
.nav-link:hover { color: var(--text-hi); }
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); transform-origin: left; }
.nav-link.active { color: var(--text-hi); }

/* ---------------------------------------------------------------------
   7. BUTTONS  (lift + glow + ripple; ripple span injected by JS)
   --------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    overflow: hidden;              /* clips the ripple */
    transition:
        transform var(--t-fast) var(--ease),
        box-shadow var(--t-med) var(--ease),
        background var(--t-med) var(--ease),
        border-color var(--t-med) var(--ease),
        color var(--t-med) var(--ease);
    will-change: transform;
}
.btn svg { flex: none; transition: transform var(--t-med) var(--ease); }

/* Primary — ember fill */
.btn-primary {
    background: var(--accent);
    color: #171009;
    box-shadow: 0 6px 22px -8px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    background: #f7b061;
    box-shadow: 0 14px 34px -10px var(--accent-glow), inset 0 0 0 1px rgba(240,160,75,.4);
}

/* Ghost — transparent, ember border on hover */
.btn-ghost {
    background: transparent;
    color: var(--text-hi);
    border-color: var(--line);
}
.btn-ghost:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(240,160,75,.06);
}

/* Small variant (nav CTA) */
.btn-sm { padding: 10px 18px; font-size: 14px; }

/* Ripple element (JS creates one per click at the pointer position) */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: currentColor;
    opacity: .3;
    transform: scale(0);
    animation: ripple var(--t-slow) var(--ease) forwards;
    pointer-events: none;
    mix-blend-mode: overlay;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---------------------------------------------------------------------
   8. HERO
   --------------------------------------------------------------------- */
.hero {
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h) + 4vh) 0 8vh;
}
.hero-content {
    width: min(var(--wrap), 92vw);
    margin-inline: auto;
    position: relative;
    z-index: 2;
    text-align: center;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(40px, 7vw, 80px);
    line-height: 1.04;
    font-weight: 650;
    letter-spacing: -.02em;
    color: var(--text-hi);
    margin-bottom: var(--s-3);
}
/* Accent word: ember, with a soft underglow */
.accent-word {
    color: var(--accent);
    text-shadow: 0 0 34px var(--accent-glow);
}
.lede {
    font-size: clamp(17px, 1.9vw, 20px);
    max-width: 56ch;
    margin-inline: auto;
    color: var(--text-mid);
    margin-bottom: var(--s-4);
}

.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: var(--s-5); }

/* Stat row — figures verifiable from the CV */
.hero-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-4) var(--s-5);
    padding-top: var(--s-4);
    border-top: 1px solid var(--line-soft);
    max-width: 640px;
    margin-inline: auto;
}
.hero-stats li { display: flex; flex-direction: column; align-items: center; }
.hero-stats strong {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 650;
    color: var(--text-hi);
    line-height: 1.2;
}
.hero-stats span {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-low);
    margin-top: 2px;
}

/* ---------------------------------------------------------------------
   9. WORK — project grid; cursor-tracked spotlight + lift on hover
   --------------------------------------------------------------------- */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-4);
}
.project-card {
    position: relative;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    overflow: hidden;              /* contains the spotlight */
    transition:
        transform var(--t-med) var(--ease),
        border-color var(--t-med) var(--ease),
        box-shadow var(--t-med) var(--ease);
}
/* Spotlight layer: radial glow follows cursor via --mx/--my set by JS */
.card-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
                rgba(240,160,75,.13), transparent 62%);
    opacity: 0;
    transition: opacity var(--t-med) var(--ease);
}
.project-card:hover {
    transform: translateY(-5px);
    border-color: #4a4238;
    box-shadow: 0 30px 60px -34px rgba(0,0,0,.8);
}
.project-card:hover .card-glow { opacity: 1; }

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: var(--s-3);
}
.card-title {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 650;
    color: var(--text-hi);
    transition: color var(--t-med) var(--ease);
}
.project-card:hover .card-title { color: var(--accent); }
.card-arrow {
    flex: none;
    color: var(--text-low);
    transition: color var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.project-card:hover .card-arrow {
    color: var(--accent);
    transform: translate(4px, -4px);
}
.card-tag {
    color: var(--text-hi);
    font-size: 16px;
    margin-bottom: var(--s-2);
}
.card-desc {
    color: var(--text-mid);
    font-size: 15.5px;
    max-width: 62ch;
}

/* Tech chips */
.chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--s-3);
}
.chips li {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-mid);
    padding: 5px 11px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    border: 1px solid var(--line-soft);
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
/* Chips brighten together with the card on hover */
.project-card:hover .chips li { border-color: #3c352b; }

/* ---------------------------------------------------------------------
   10. APPROACH — numbered steps + stack strip
   --------------------------------------------------------------------- */
.steps {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;   /* full-width vertical process list — a deliberate contrast to the 2-col work grid above; no dead right-hand band */
    gap: var(--s-3);
}
.step {
    position: relative;
    overflow: hidden;              /* contains the spotlight, same as .project-card */
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: var(--s-3);
    align-items: start;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    transition:
        transform var(--t-med) var(--ease),
        border-color var(--t-med) var(--ease),
        background var(--t-med) var(--ease);
}
.step:hover .card-glow { opacity: 1; }
.step:hover {
    transform: translateX(6px);
    border-color: #4a4238;
    background: var(--bg-2);
}
.step-num {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 650;
    color: var(--accent);
    opacity: .85;
    line-height: 1.1;
}
.step-body h3 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 650;
    color: var(--text-hi);
    margin-bottom: 6px;
}
.step-body p { font-size: 15.5px; color: var(--text-mid); max-width: 64ch; }

.approach-grid {
    display: grid;
    grid-template-columns: minmax(0, 480px) 1fr;
    gap: var(--s-5);
    align-items: stretch;
}

/* ---------------------------------------------------------------------
   10b. AGENT SYSTEM MAP — ported from epsystems.ludex-gg.com's
   work/automation-agents.html, re-oriented top-to-bottom for this narrow
   column (source diagram flows left-to-right, wide). Node/edge geometry
   and interaction JS live in js/agent-map.js; these are just the shell,
   theming (site tokens, not the source page's navy/cyan set) and the
   .node/.edge/.dim states the script toggles classes on.
   --------------------------------------------------------------------- */
:root {
    --map-agent: var(--accent);
    --map-mcp:   #6a93b8;
    --map-skill: #7fa66a;
    --map-hub:   #a78bfa;
}

.agent-map {
    position: relative;
    overflow: hidden;              /* contains the spotlight, same as .project-card */
    border: 1px solid var(--line);
    background: var(--bg-1);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    /* gap is a floor, not the only spacing — align-items:stretch on the
       parent .approach-grid matches this card's height to the (taller)
       steps column, and any leftover room is spread across all three
       gaps (space-between) rather than dumped as one big jump before
       the panel. */
    gap: var(--s-3);
    justify-content: space-between;
}
.agent-map:hover .card-glow { opacity: 1; }
.agent-map:fullscreen {
    width: 100vw;
    height: 100vh;
    justify-content: center;
    background: var(--bg-0);
    overflow-y: auto;             /* scrolls instead of clipping on short screens, rather than nothing */
}
/* A flat 86vh only accounted for the SVG — the kicker/legend/panel/gaps/
   padding around it need room too, and the panel is NOT fixed-height:
   it starts at ~120px (the default unfocused "Me + Claude" overview) but
   grows to 280-330px once a node with a longer description and a
   "Connected to" chip list is selected — clicking through nodes before
   or during fullscreen is the normal way to use this thing. Budgeting
   only for the default state (this rule's first, 280px version) still
   overflowed 35-110px as soon as any real agent node was selected and
   measured in testing. Capping the panel itself (below) is the actual
   fix; this deduction just needs to cover the capped panel + everything
   else, not guess at the panel's unbounded worst case. */
.agent-map:fullscreen #agent-map-svg { max-height: min(74vh, calc(100vh - 380px)); }
.agent-map:fullscreen .map-panel { max-height: 200px; overflow-y: auto; }

.map-kicker {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-low);
}

.map-enlarge-btn {
    position: absolute;
    top: var(--s-3);
    right: var(--s-3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .05em;
    background: var(--bg-0);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text-low);
    padding: 6px 10px;
    cursor: pointer;
    z-index: 2;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.map-enlarge-btn:hover { color: var(--accent); border-color: var(--accent); }
.map-enlarge-btn svg { width: 12px; height: 12px; }

#agent-map-svg { width: 100%; height: auto; overflow: visible; }

.map-row-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    fill: var(--text-low);
}

.map-edge { fill: none; stroke-linecap: round; transition: opacity .35s ease, stroke-width .35s ease; }
.map-edge-hub   { stroke: var(--map-agent); stroke-opacity: .3;  stroke-width: 1.4; }
.map-edge-mcp   { stroke: var(--map-mcp);   stroke-opacity: .26; stroke-width: 1.2; }
.map-edge-skill { stroke: var(--map-skill); stroke-opacity: .26; stroke-width: 1.2; }

.map-node { cursor: pointer; }
.map-node circle.core { transition: filter .3s ease; }
.map-node:hover circle.core { filter: brightness(1.2); }
.map-node text { font-family: var(--font-body); font-size: 12px; fill: var(--text-hi); transition: opacity .35s ease; pointer-events: none; }
.map-node .map-sublabel { font-size: 8.5px; fill: var(--text-low); letter-spacing: .05em; text-transform: uppercase; font-family: var(--font-mono); }

.dim .map-edge { opacity: .05; }
.dim .map-particle { opacity: 0; }
.dim .map-node { opacity: .2; }
.dim .map-node.active, .dim .map-node.neighbor { opacity: 1; }
.dim .map-edge.active { opacity: .9; stroke-width: 2; }

.map-legend {
    display: flex;
    gap: var(--s-3);
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-low);
    letter-spacing: .03em;
}
.map-legend-item { display: flex; align-items: center; gap: 6px; }
.map-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.map-panel {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    border-top: 1px solid var(--line);
    padding-top: var(--s-3);
}
.map-panel-type {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text-low);
}
.map-panel-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--map-hub); }
.map-panel-title { font-family: var(--font-display); font-size: 17px; font-weight: 650; color: var(--text-hi); }
.map-panel-desc { font-size: 14px; line-height: 1.55; color: var(--text-mid); }
.map-panel-links { margin-top: var(--s-1); padding-top: var(--s-2); border-top: 1px dashed var(--line); }
.map-panel-links-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-low); margin-bottom: 6px; }
.map-link-chip { display: block; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-mid); padding: 4px 0; border-bottom: 1px dashed var(--line-soft); }
.map-link-chip:last-child { border-bottom: none; }
.map-reset-btn {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em;
    background: none; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-low);
    padding: 6px 10px; cursor: pointer; align-self: flex-start;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.map-reset-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Plain-text tooling strip */
.stack-strip {
    margin-top: var(--s-4);
    padding: var(--s-3) var(--s-4);
    border: 1px dashed var(--line);
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--text-mid);
    line-height: 2;
}
.stack-sep { color: var(--accent); opacity: .7; }

/* ---------------------------------------------------------------------
   11. ABOUT — copy + fact panel
   --------------------------------------------------------------------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.4fr .9fr;  /* golden-ratio-ish split */
    gap: var(--s-5);
    align-items: start;
}
.about-copy h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 650;
    color: var(--text-hi);
    letter-spacing: -.01em;
    margin-bottom: var(--s-3);
}
.about-copy p { max-width: 58ch; margin-bottom: var(--s-3); }
.about-copy p:last-child { margin-bottom: 0; }

.about-facts {
    position: relative;
    overflow: hidden;              /* contains the spotlight */
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    box-shadow: 0 24px 60px -30px rgba(0,0,0,.7);
}
/* Cursor spotlight (same --mx/--my mechanism as project cards / contact card) */
.about-facts::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
                rgba(240,160,75,.13), transparent 62%);
    opacity: 0;
    transition: opacity var(--t-med) var(--ease);
}
.about-facts:hover::before { opacity: 1; }
.fact + .fact { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--line-soft); }
.fact dt {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}
.fact dd { font-size: 15.5px; color: var(--text-mid); }

/* ---------------------------------------------------------------------
   12. CONTACT — centered band with cursor spotlight
   --------------------------------------------------------------------- */
.contact { padding-bottom: var(--s-5); }
.contact-inner {
    text-align: center;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: clamp(44px, 7vw, 84px) var(--s-4);
    position: relative;
    overflow: hidden;
}
/* Cursor spotlight (same --mx/--my mechanism as project cards) */
.contact-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(560px circle at var(--mx, 50%) var(--my, 50%),
                rgba(240,160,75,.10), transparent 60%);
    opacity: 0;
    transition: opacity var(--t-med) var(--ease);
}
.contact-inner:hover::before { opacity: 1; }
.contact-inner h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.6vw, 50px);
    font-weight: 650;
    color: var(--text-hi);
    letter-spacing: -.015em;
    line-height: 1.1;
    max-width: 22ch;
    margin: 0 auto var(--s-2);
}
.contact-inner > p {
    color: var(--text-mid);
    max-width: 54ch;
    margin: 0 auto var(--s-4);
}
.contact-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
}

/* EMAIL ROW — the address itself is the click-to-copy target now (was a
   visible span + a separate adjacent copy-chip button; merged into one
   control so there's a single obvious click target instead of two). */
.email-row {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

.email-addr {
    /* Boxed to match .btn-ghost (the phone link right next to it) — plain
       text with no border read as inconsistent sitting beside a bordered
       button of equal visual weight. */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 22px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-hi);
    cursor: pointer;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.email-addr:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(240,160,75,.06);
}
.email-addr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.email-addr__icon { flex-shrink: 0; opacity: .55; transition: opacity var(--t-fast) var(--ease); }
.email-addr:hover .email-addr__icon { opacity: 1; }
/* Success/failure state — the address itself IS the feedback, same as the
   old chip's behavior, just applied to the merged control. */
.email-addr.copied { color: var(--accent); border-color: var(--accent); }
.email-addr.failed { color: #c98a8a; border-color: #c98a8a; }
.email-addr__status {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .05em;
}

.contact-note {
    margin-top: var(--s-4);
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: .08em;
    color: var(--text-low);
}

/* ---------------------------------------------------------------------
   13. FOOTER
   --------------------------------------------------------------------- */
.footer {
    padding: var(--s-4) 0 var(--s-5);
    border-top: 1px solid var(--line-soft);
}
.footer .wrap,
footer.footer {
    width: min(var(--wrap), 92vw);
    margin-inline: auto;
}
.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: var(--text-low);
    text-align: center;
}
.footer-mid { opacity: .5; }

/* ---------------------------------------------------------------------
   14. SCROLL REVEAL  (JS adds .is-visible when elements enter viewport)
   --------------------------------------------------------------------- */
/* Uses the `translate` physical property (not `transform`) so the reveal
   animation never fights interactive :hover transforms (.project-card,
   .step, etc.) for the cascade — same-specificity `transform` rules on
   .reveal.is-visible were silently cancelling every hover-lift/shift
   effect on already-revealed elements, since translate/transform compose
   independently instead of overriding each other. */
.reveal {
    opacity: 0;
    translate: 0 26px;
    transition:
        opacity var(--t-slow) var(--ease),
        translate var(--t-slow) var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible {
    opacity: 1;
    translate: 0;
}

/* ---------------------------------------------------------------------
   15. REDUCED MOTION — disable all motion, keep everything visible
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; translate: 0; transition: none; }
    #field { display: none; }
    .cursor-ring { display: none; }
}

/* ---------------------------------------------------------------------
   16. RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
    .nav-cta { display: none; }          /* keep nav clean on small screens */
    .about-grid { grid-template-columns: 1fr; gap: var(--s-4); }
    .work-grid { grid-template-columns: 1fr; }
    .approach-grid { grid-template-columns: 1fr; }
    .steps { grid-template-columns: 1fr; }
    .step { grid-template-columns: 1fr; gap: var(--s-1); }
    .step-num { font-size: 24px; }
    .hero-stats { gap: var(--s-3) var(--s-4); }
}

/* ---------------------------------------------------------------------
   17. INTERACTIONS — filter chips, project modal, contact form,
       back-to-top, toast, mobile nav toggle.
       All styled from the same :root tokens (17.1–17.6).
   --------------------------------------------------------------------- */

/* 17.1 — Filter chips (row of pill buttons above the work grid) */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: var(--s-4);
}
.chip {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: .06em;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-mid);
    cursor: pointer;
    transition:
        color var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease),
        background var(--t-fast) var(--ease),
        transform var(--t-fast) var(--ease);
}
.chip:hover {
    color: var(--text-hi);
    border-color: var(--text-low);
    transform: translateY(-1px);
}
.chip.is-active {
    color: #171009;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 6px 22px -10px var(--accent-glow);
}
.chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Card hidden by an active filter (display:none keeps the grid tidy) */
.project-card.is-hidden { display: none; }

/* Project cards are now buttons — show a clear keyboard focus ring */
.project-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* 17.2 — Project detail modal.
   Smoothness rule: ONLY opacity + transform are animated. backdrop-filter
   stays static — animating the blur radius re-rasterizes on the main thread
   every frame and visibly lags the compositor-driven opacity fade (the
   "opacity first, then blur" jank). Fading a static-blur layer keeps every
   animated property on the GPU, on one shared clock. */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* visibility is discrete: hidden while closed, but the close transition
       holds it visible for the full fade-out duration (delays the flip),
       and .is-open flips it to visible instantly. */
    visibility: hidden;
    transition: visibility var(--t-med) linear;
}
.modal.is-open { visibility: visible; transition: visibility 0s; }
/* Dark backdrop — static blur, only opacity animates (composited). */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 9, 8, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity var(--t-med) var(--ease);
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal-panel {
    position: relative;
    z-index: 2;
    width: min(680px, 92vw);
    max-height: 86vh;
    overflow-y: auto;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-4) var(--s-4) var(--s-4);
    box-shadow: 0 40px 90px -40px rgba(0,0,0,.9);
    /* Panel fades + slides up as it opens (both composited) */
    opacity: 0;
    transform: translateY(18px);
    transition: transform var(--t-med) var(--ease),
                opacity var(--t-med) var(--ease);
}
.modal.is-open .modal-panel { transform: none; opacity: 1; }
.modal-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-1);
}
.modal-title {
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 650;
    color: var(--text-hi);
    line-height: 1.1;
    margin-bottom: 6px;
}
.modal-desc {
    color: var(--text-hi);
    font-size: 15.5px;
    margin-bottom: var(--s-3);
}
.modal-long {
    color: var(--text-mid);
    font-size: 15.5px;
    line-height: 1.7;
    max-width: 60ch;
    margin-bottom: var(--s-3);
}
.modal-points {
    list-style: none;
    margin: 0 0 var(--s-3);
    padding: 0;
    display: grid;
    gap: 10px;
}
.modal-points li {
    position: relative;
    padding-left: 22px;
    color: var(--text-mid);
    font-size: 15px;
    line-height: 1.6;
}
/* Ember bullet marker */
.modal-points li::before {
    content: "";
    position: absolute;
    left: 0; top: 8px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}
.modal-status {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
}
.modal-status__label {
    color: var(--text-low);
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: 11px;
}
.modal-role {
    font-size: 14px;
    color: var(--text-low);
    margin-bottom: var(--s-3);
}
.modal-chips { margin-top: 0; }
/* Close button pinned top-right of the panel */
.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text-mid);
    cursor: pointer;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
        transform var(--t-fast) var(--ease);
}
.modal-close:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(90deg);
}
.modal-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Stop background scroll while the modal is open */
body.modal-open { overflow: hidden; }

/* 17.3 — Contact form (sits above the existing CTA row) */
.contact-form {
    max-width: 480px;
    margin: 0 auto var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    text-align: left;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
}
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-label {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-low);
}
.form-field input,
.form-field textarea {
    font: inherit;
    font-size: 15px;
    color: var(--text-hi);
    background: var(--bg-0);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.form-field textarea { resize: vertical; min-height: 84px; }
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-low); }
.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Invalid state (set by JS validation) */
.form-field input.is-invalid,
.form-field textarea.is-invalid {
    border-color: #c98a8a;
    box-shadow: 0 0 0 3px rgba(201,138,138,.18);
}
.form-foot {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
}
/* Status line under the form — swaps color for ok/error */
.form-status {
    min-height: 18px;
    font-size: 13.5px;
    color: var(--text-low);
    transition: color var(--t-fast) var(--ease);
}
.form-status.is-ok { color: var(--accent); }
.form-status.is-error { color: #c98a8a; }

/* 17.4 — Back-to-top */
.to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(25,23,19,.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-mid);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease),
        color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.to-top.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.to-top:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.to-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 17.5 — Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 120;
    transform: translate(-50%, 12px);
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--text-hi);
    font-size: 14px;
    padding: 11px 20px;
    border-radius: var(--r-pill);
    box-shadow: 0 20px 50px -24px rgba(0,0,0,.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 17.6 — Mobile nav toggle (burger). Hidden on desktop, shown ≤860px. */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-mid);
    cursor: pointer;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Three bars morph into an X via the spans */
.nav-toggle .bar {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    margin: 4px 0;
    border-radius: 2px;
    transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}
.nav-toggle.is-open .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open .bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    /* Links collapse into a slide-down panel, hidden until .nav-open */
    .nav-links {
        position: absolute;
        top: var(--nav-h);
        left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 10px 4vw 18px;
        background: rgba(18,17,16,.97);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line-soft);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease),
            visibility var(--t-med) var(--ease);
    }
    header.nav.nav-open .nav-links {
        transform: none;
        opacity: 1;
        visibility: visible;
    }
    .nav-link { padding: 12px 14px; font-size: 15.5px; }
    /* Contact form stacks on small screens */
    .form-row { grid-template-columns: 1fr; }
}
