/* =========================================================
   Zahir Zairli — site styles
   Type: Bricolage Grotesque (display) · Inter (body) · JetBrains Mono (data)
   Scale: 1.25 · Space: 8px base · Accent: "settled" green, reserved for actions & live state
   ========================================================= */

:root {
    --bg: #f5f4ef;
    --bg-alt: #ecebe4;
    --surface: #ffffff;
    --ink: #15171a;
    --ink-2: #3b4047;
    --muted: #646a72;
    --line: #dcd9cf;
    --accent: #0f7a43;
    --accent-ink: #ffffff;
    --accent-soft: #dcefe3;
    --warn: #a35a00;
    --console-bg: #121417;
    --deep: #131518;
    --hud: #0e7490;
    --grad: linear-gradient(100deg, var(--hud), var(--accent));
    --fx: .55;
    --nebula: #7c3aed;
    --star: 20, 40, 60;
    --stars: .45;
    --deep-ink: #ecebe6;
    --console-ink: #d7dad4;
    --console-dim: #6f767d;
    --console-ok: #34d17b;
    --console-warn: #f2b24c;
    --shadow: 0 1px 2px rgb(20 22 25 / .06), 0 12px 32px -12px rgb(20 22 25 / .18);

    --f-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
    --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

    --s-1: .5rem; --s-2: 1rem; --s-3: 1.5rem; --s-4: 2rem; --s-5: 3rem; --s-6: 4rem; --s-7: 6rem; --s-8: 8rem;
    --t-xs: .8rem; --t-sm: .9rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.563rem; --t-2xl: 1.953rem; --t-3xl: 2.441rem;
    --t-hero: clamp(2.4rem, 1.4rem + 4.2vw, 4.4rem);
    --radius: 14px;
    --wrap: 1160px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d0f11; --bg-alt: #121518; --surface: #171a1e; --ink: #ecebe6; --ink-2: #c4c7c2; --muted: #969ca2;
        --line: #272b30; --accent: #34d17b; --accent-ink: #06200f; --accent-soft: #143322; --warn: #f2b24c;
        --console-bg: #08090b; --deep: #08090b; --hud: #22d3ee; --fx: 1; --nebula: #8b5cf6; --star: 220, 240, 255; --stars: 1; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .7);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0d0f11; --bg-alt: #121518; --surface: #171a1e; --ink: #ecebe6; --ink-2: #c4c7c2; --muted: #969ca2;
    --line: #272b30; --accent: #34d17b; --accent-ink: #06200f; --accent-soft: #143322; --warn: #f2b24c;
    --console-bg: #08090b; --deep: #08090b; --hud: #22d3ee; --fx: 1; --nebula: #8b5cf6; --star: 220, 240, 255; --stars: 1; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .7);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 400 var(--t-md)/1.65 var(--f-body);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
    --h: 48px;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: var(--h); padding: 0 1.4rem; border-radius: 999px; border: 1px solid transparent;
    font: 600 var(--t-md)/1 var(--f-body); text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn--sm { --h: 40px; padding: 0 1rem; font-size: var(--t-sm); }
.btn--block { width: 100%; }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn__hint { font: 500 .7rem/1 var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: .2rem .3rem; }

.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
    border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { border-color: var(--ink); }
.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .i-sun { display: none; }
    :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__inner { display: flex; align-items: center; gap: var(--s-3); height: 72px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; font-weight: 600; }
.brand__mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    background: var(--ink); color: var(--bg); font: 700 .78rem/1 var(--f-mono); letter-spacing: .02em;
}
.nav { display: flex; gap: var(--s-3); margin-left: auto; }
.nav a { position: relative; text-decoration: none; color: var(--muted); font-size: var(--t-sm); font-weight: 500; padding: .5rem 0; transition: color .15s; }
.nav a:hover, .nav a.is-active { color: var(--ink); }
.nav a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent); }
.topbar__actions { display: flex; align-items: center; gap: .6rem; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
    .nav {
        position: fixed; inset: 72px 0 auto 0; flex-direction: column; gap: 0; margin: 0;
        background: var(--bg); border-bottom: 1px solid var(--line); padding: .5rem clamp(1rem, 4vw, 2rem) 1rem;
        transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s, visibility .18s;
    }
    .nav.is-open { transform: none; opacity: 1; visibility: visible; }
    .nav a { padding: .9rem 0; font-size: var(--t-lg); color: var(--ink); border-bottom: 1px solid var(--line); }
    .nav a:last-child { border-bottom: 0; }
    .nav a.is-active::after { display: none; }
    .topbar__actions { margin-left: auto; }
    .nav-toggle { display: inline-grid; }
}
@media (max-width: 480px) {
    .brand__name { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 var(--s-6); }
.hero__grid > * { min-width: 0; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.eyebrow { display: block; font: 500 var(--t-xs)/1.4 var(--f-mono); color: var(--muted); letter-spacing: .02em; margin-bottom: var(--s-3); }
.dot { display: inline-block; vertical-align: .05em; margin-right: .55rem; position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent); opacity: 0; animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.hero__title { font-size: var(--t-hero); letter-spacing: -.035em; line-height: 1.02; }
.hero__title em { font-style: normal; color: var(--accent); }
.hero__lede { margin-top: var(--s-3); max-width: 34em; font-size: var(--t-lg); line-height: 1.55; color: var(--ink-2); }
.hero__lede strong { color: var(--ink); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: var(--s-4); }
.hero__social { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-top: var(--s-4); font-size: var(--t-sm); color: var(--muted); }
.hero__social a { text-decoration: none; }
.hero__social a:hover { color: var(--ink); text-decoration: underline; }

/* Signature: the batch log */
.console {
    border: 1px solid color-mix(in srgb, var(--console-ok) 14%, transparent);
    margin: 0; background: var(--console-bg); color: var(--console-ink); border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 0 0 1px rgb(255 255 255 / .06); overflow: hidden;
    font: 400 .8rem/1.75 var(--f-mono); transform: rotate(.6deg);
}
.console__bar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid rgb(255 255 255 / .07); }
.console__lights { display: flex; gap: 6px; }
.console__lights i { width: 10px; height: 10px; border-radius: 50%; background: #2c3035; }
.console__title { color: var(--console-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.console__badge { margin-left: auto; font-size: .68rem; color: var(--console-dim); border: 1px solid #2c3035; border-radius: 4px; padding: 0 .35rem; }
.console__body { padding: 1rem 1.1rem 1.2rem; min-height: 15.5em; }
.console__body li { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console__body b { color: #fff; font-weight: 500; }
.c-dim { color: var(--console-dim); margin-right: .35rem; }
.c-cmd { color: var(--console-ok); }
.c-ok { color: var(--console-ok); }
.c-warn { color: var(--console-warn); }
.c-fill::before { content: "········"; color: #3a3f45; }
.c-final { margin-top: .35rem; padding-top: .45rem; border-top: 1px dashed #2c3035; }
.console.is-typing li { visibility: hidden; }
.console.is-typing li.is-shown { visibility: visible; animation: line-in .25s ease-out; }
.console.is-typing li.is-shown:last-of-type.is-cursor::after,
.console li.is-cursor::after { content: "▍"; color: var(--console-ok); margin-left: .25rem; animation: blink 1s steps(1) infinite; }
@keyframes line-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: clamp(3rem, 7vw, 5rem) 0 0; border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: .35rem; padding: var(--s-3) var(--s-3) 0 0; }
.stat + .stat { padding-left: var(--s-3); border-left: 1px solid var(--line); }
.stat dd { order: -1; margin: 0; font: 700 var(--t-3xl)/1 var(--f-display); letter-spacing: -.03em; }
.stat dt { font-size: var(--t-sm); color: var(--muted); max-width: 18em; line-height: 1.45; }

@media (max-width: 960px) {
    .hero__grid { grid-template-columns: 1fr; }
    .console { transform: none; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-left: 0; padding-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: var(--s-3); }
}
@media (max-width: 420px) {
    .console { font-size: .72rem; }
    .stat dd { font-size: var(--t-2xl); }
}

/* ---------- Hero: scroll-driven portrait (hero-fx.js) ---------- */
/* Without WebGL (no .fx-on) it falls back to the plain text hero. */
.hero--fx { padding-top: 0; }
.hero--fx:not(.fx-on) { padding-top: clamp(3rem, 8vw, 6.5rem); }
.hero--fx:not(.fx-on) .fx-canvas,
.hero--fx:not(.fx-on) .fx-hint,
.hero--fx:not(.fx-on) .fx-panel + .fx-panel { display: none; }
.fx-stage { position: relative; }
.fx-canvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; }
.fx-panels { position: relative; z-index: 2; display: grid; }
.fx-panel { grid-area: 1 / 1; max-width: 36rem; }
.fx-panel__title { font: 700 var(--t-hero)/1.02 var(--f-display); letter-spacing: -.035em; text-wrap: balance; }
.fx-panel__title em { font-style: normal; color: var(--accent); }

.fx-on .fx-track { height: 420vh; }
.fx-on .fx-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: grid; align-items: center; }
.fx-on .fx-stage::before {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 55%, transparent) 34%, transparent 58%);
}
.fx-on .fx-panel { will-change: opacity, transform; }
.fx-on.fx-static .fx-track { height: auto; }
.fx-on.fx-static .fx-stage { position: relative; }

.fx-hint {
    position: absolute; left: 50%; bottom: 1.6rem; z-index: 2; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
    font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
    opacity: var(--fx-hint, 1); pointer-events: none;
}
.fx-hint::after { content: ""; width: 1px; height: 2.2rem; background: linear-gradient(var(--muted), transparent); animation: fx-hint 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes fx-hint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
.fx-static .fx-hint { display: none; }

/* HUD rings + labels framing the head; hero-fx.js sets --hx/--hy/--hs and fades it with --fx-hud. */
.fx-hud { display: none; }
.fx-on .fx-hud {
    display: block; position: absolute; z-index: 1; padding: 0; pointer-events: none;
    left: var(--hx, 70%); top: var(--hy, 50%); width: var(--hs, 420px); height: var(--hs, 420px);
    transform: translate(-50%, -50%); opacity: var(--fx-hud, 1);
}
.fx-hud .hud__rings { width: 100%; }
.fx-hud::after { inset: 0; }

@media (max-width: 700px), (max-aspect-ratio: 9/10) {
    .fx-on .fx-stage { align-items: end; }
    .fx-on .fx-panels { padding-bottom: max(4.5rem, 9svh); }
    .fx-on .fx-stage::before {
        background: linear-gradient(0deg, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 70%, transparent) 38%, transparent 62%);
    }
    .fx-on .hero__lede { font-size: var(--t-md); }
    .fx-hint { bottom: 1rem; }
}

/* ---------- Background facts strip ---------- */
.facts { padding: var(--s-5) 0; border-block: 1px solid var(--line); background: color-mix(in srgb, var(--bg-alt) 70%, transparent); }
.facts__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.facts h3 { font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hud); margin-bottom: .9rem; }
.facts li { padding: .2rem 0; font-size: var(--t-sm); line-height: 1.5; color: var(--ink-2); }
.facts li strong { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) { .facts__grid { grid-template-columns: 1fr; gap: var(--s-3); } }

/* ---------- Sections ---------- */
.section { padding: clamp(4rem, 10vw, var(--s-8)) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 46rem; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.kicker { font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--s-2); }
.section__head h2 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); letter-spacing: -.03em; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { font: 500 .74rem/1 var(--f-mono); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .4rem .55rem; }
.section--alt .tags li { background: var(--bg); }
.pill { display: inline-flex; align-items: center; gap: .35rem; vertical-align: middle; margin-left: .5rem; font: 600 .68rem/1 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: .35rem .55rem; }
.pill--live { background: var(--accent-soft); color: var(--accent); }
.pill--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Experience timeline ---------- */
.timeline { position: relative; }
.job { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-5) 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job__when { display: flex; flex-direction: column; gap: .2rem; font: 400 var(--t-sm)/1.5 var(--f-mono); color: var(--muted); }
.job__period { color: var(--ink); font-weight: 500; }
.job__title { font-size: var(--t-xl); }
.job__at { font-family: var(--f-body); font-weight: 400; color: var(--muted); font-size: .8em; }
.job__context { margin-top: .4rem; font-weight: 500; color: var(--accent); font-size: var(--t-sm); }
.job__summary { margin-top: var(--s-2); max-width: 40em; font-size: 1.08rem; color: var(--ink); }
.job--current .job__period { color: var(--accent); }

@media (max-width: 720px) {
    .job { grid-template-columns: 1fr; gap: var(--s-2); padding: var(--s-4) 0; }
    .job__when { flex-direction: row; gap: .75rem; }
    .job__when .job__place::before { content: "·"; margin-right: .75rem; }
}

/* ---------- Projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.project {
    display: flex; flex-direction: column; gap: var(--s-3); padding: clamp(1.5rem, 3vw, 2.25rem);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.project:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); box-shadow: var(--shadow); }
.project__kind { font: 500 var(--t-xs)/1 var(--f-mono); color: var(--muted); letter-spacing: .03em; margin-bottom: .75rem; }
.project__name { font-size: var(--t-2xl); }
.project__summary { margin-top: .75rem; color: var(--ink-2); max-width: 36em; }
.project__points { margin: var(--s-2) 0; color: var(--ink-2); font-size: var(--t-sm); }
.project__points li { padding: .5rem 0; border-top: 1px dashed var(--line); }
.project__points li:last-child { border-bottom: 1px dashed var(--line); }
.project__main .tags { margin-top: var(--s-2); }
.project__links { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: auto; padding-top: var(--s-1); }
.link-arrow { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; font-weight: 500; text-decoration: none; color: var(--ink-2); }
.link-arrow:hover { color: var(--ink); text-decoration: underline; }
.link-arrow--strong { color: var(--accent); font-weight: 600; }
.link-arrow--strong:hover { color: var(--accent); }

.project--featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: clamp(2rem, 5vw, 4rem); }
.project--featured .project__main { grid-column: 1; }
.project--featured .project__links { grid-column: 1; }
.project--featured .project__visual { grid-column: 2; grid-row: 1 / span 2; }
.project--featured .project__name { font-size: var(--t-3xl); }

/* Abstract product shots — skeletons, not fake screenshots */
.project__visual { position: relative; min-height: 320px; border-radius: 10px; background:
    radial-gradient(120% 90% at 80% 10%, var(--accent-soft), transparent 60%), var(--bg-alt); overflow: hidden; }
.device { position: absolute; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.device--web { left: 8%; top: 14%; width: 74%; border-radius: 10px; }
.device__bar { display: flex; align-items: center; gap: 5px; padding: .5rem .7rem; border-bottom: 1px solid var(--line); font: 400 .68rem/1 var(--f-mono); color: var(--muted); }
.device__bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.device__bar span { margin-left: .5rem; }
.device__screen { padding: 1rem; display: grid; gap: .6rem; }
.device--phone { right: 7%; bottom: -6%; width: 30%; min-width: 120px; aspect-ratio: 9 / 17; border-radius: 22px; padding: 1.6rem .7rem .7rem; display: flex; flex-direction: column; gap: .45rem; }
.device__notch { position: absolute; top: .55rem; left: 50%; width: 34%; height: 6px; transform: translateX(-50%); border-radius: 6px; background: var(--line); }
.sk { background: var(--bg-alt); border-radius: 6px; }
.sk--title { height: 14px; width: 55%; background: var(--ink); opacity: .85; }
.sk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.sk--card { height: 64px; }
.sk--card:first-child { background: var(--accent-soft); }
.sk--line { height: 8px; }
.sk--short { width: 60%; }
.sk--chip { height: 10px; width: 50%; background: var(--accent); opacity: .8; border-radius: 999px; }
.sk--bubble { height: 26px; width: 80%; border-radius: 10px 10px 10px 3px; }
.sk--me { align-self: flex-end; width: 65%; background: var(--accent-soft); border-radius: 10px 10px 3px 10px; }

.more-work { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; margin-top: var(--s-4); font-size: var(--t-sm); color: var(--muted); }
.more-work a { color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; }
.more-work a:hover { color: var(--ink); }

@media (max-width: 860px) {
    .projects { grid-template-columns: 1fr; }
    .project--featured { display: flex; }
    .project__visual { min-height: 240px; order: -1; }
}

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.skill-group { padding: var(--s-4) var(--s-3); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skill-group h3 { font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2); }
.skill-group ul { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.skill-group li { font-size: 1.05rem; font-weight: 500; }
.skill-group:first-child li:nth-child(-n+3) { color: var(--accent); }
@media (max-width: 860px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .skills { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { background: var(--deep); color: var(--deep-ink); }
.contact .kicker { color: var(--console-ok); }
.contact__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5rem); align-items: start; }
.contact h2 { font-size: clamp(2rem, 1.3rem + 2.8vw, 3.3rem); letter-spacing: -.03em; }
.contact__lede { margin-top: var(--s-3); max-width: 30em; font-size: var(--t-lg); color: color-mix(in srgb, var(--deep-ink) 72%, var(--deep)); }
.email-card { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-4); padding: .9rem .9rem .9rem 1.2rem; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--deep-ink) 18%, var(--deep)); }
.email-card__addr { font: 500 clamp(1rem, .8rem + 1vw, 1.35rem)/1.3 var(--f-mono); text-decoration: none; overflow-wrap: anywhere; }
.email-card__addr:hover { color: var(--console-ok); }
.contact .btn--ghost { color: var(--deep-ink); border-color: color-mix(in srgb, var(--deep-ink) 25%, var(--deep)); }
.contact .btn--ghost:hover { border-color: var(--deep-ink); }
.contact__links { margin-top: var(--s-4); }
.contact__links li { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; min-height: 48px; border-bottom: 1px solid color-mix(in srgb, var(--deep-ink) 12%, var(--deep)); }
.contact__links span { font: 400 var(--t-xs)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: color-mix(in srgb, var(--deep-ink) 50%, var(--deep)); }
.contact__links a { text-decoration: none; }
.contact__links a:hover { text-decoration: underline; color: var(--console-ok); }

.form { background: var(--surface); color: var(--ink); border-radius: calc(var(--radius) + 4px); padding: clamp(1.5rem, 3vw, 2.25rem); box-shadow: 0 30px 60px -30px rgb(0 0 0 / .6); }
.form__title { font-size: var(--t-xl); margin-bottom: var(--s-3); }
.field { margin-bottom: var(--s-2); }
.field label { display: block; font-size: var(--t-sm); font-weight: 600; margin-bottom: .4rem; }
.field input, .field textarea {
    width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    padding: .75rem .9rem; min-height: 48px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field.has-error input, .field.has-error textarea { border-color: #c2412d; }
.field__error { min-height: 0; font-size: var(--t-xs); color: #c2412d; margin-top: .35rem; }
.field__error:empty { display: none; }
[data-theme="dark"] .field__error { color: #ff8a73; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { margin-top: var(--s-1); }
.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.form__status { margin-top: var(--s-2); font-size: var(--t-sm); }
.form__status:empty { display: none; }
.form__status.is-ok { padding: .8rem 1rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.form__status.is-error { padding: .8rem 1rem; border-radius: 10px; background: color-mix(in srgb, #c2412d 12%, var(--surface)); color: #c2412d; }
@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { background: var(--deep); color: color-mix(in srgb, var(--deep-ink) 55%, var(--deep)); border-top: 1px solid color-mix(in srgb, var(--deep-ink) 10%, var(--deep)); font-size: var(--t-sm); }
.footer__inner { display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: center; padding-block: var(--s-4); }
.footer__inner > p:first-child { flex: 1; }
.footer__top { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.footer__top:hover { color: var(--deep-ink); }

/* ---------- Simple pages (404, admin) ---------- */
.page { padding: clamp(4rem, 12vw, 9rem) 0; min-height: 60vh; }
.page h1 { font-size: clamp(2.2rem, 1.4rem + 3.6vw, 4rem); letter-spacing: -.035em; }
.page p { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-lg); max-width: 34em; }
.page .hero__actions { margin-top: var(--s-4); }
.code-404 { font: 500 var(--t-sm)/1 var(--f-mono); color: var(--accent); margin-bottom: var(--s-2); }

.admin-table { width: 100%; border-collapse: collapse; margin-top: var(--s-4); font-size: var(--t-sm); }
.admin-table th { text-align: left; font: 500 var(--t-xs)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .75rem; border-bottom: 1px solid var(--line); }
.admin-table td { padding: .9rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table td.msg { white-space: pre-wrap; max-width: 40em; }
.admin-table .btn { --h: 36px; }
.empty { margin-top: var(--s-4); padding: var(--s-5); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.login { max-width: 420px; }
.alert { margin-top: var(--s-3); padding: .8rem 1rem; border-radius: 10px; background: color-mix(in srgb, #c2412d 12%, var(--surface)); color: #c2412d; }
@media (max-width: 720px) {
    .admin-table thead { display: none; }
    .admin-table tr { display: block; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
    .admin-table td { display: block; border: 0; padding: .2rem 0; }
}

/* =========================================================
   Jarvis layer — HUD, gradients, ambient background
   ========================================================= */

/* Ambient background: HUD grid, drifting glows, cursor light, scan sweep */
.bg-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
main, .footer { position: relative; z-index: 1; }
.bg-fx__grid {
    position: absolute; inset: -80px;
    background-image:
        linear-gradient(color-mix(in srgb, var(--hud) 14%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--hud) 14%, transparent) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 55% at 60% 18%, #000 10%, transparent 75%);
            mask-image: radial-gradient(ellipse 70% 55% at 60% 18%, #000 10%, transparent 75%);
    opacity: var(--fx);
    animation: grid-drift 30s linear infinite;
}
@keyframes grid-drift { to { transform: translate3d(64px, 64px, 0); } }
.bg-fx__orb { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; opacity: calc(var(--fx) * .9); will-change: transform; }
.bg-fx__orb--a { top: -30vmax; right: -18vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--hud) 22%, transparent), transparent); animation: orb-a 26s ease-in-out infinite alternate; }
.bg-fx__orb--b { bottom: -34vmax; left: -22vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent); animation: orb-b 32s ease-in-out infinite alternate; }
@keyframes orb-a { to { transform: translate3d(-14vmax, 18vmax, 0) scale(1.15); } }
@keyframes orb-b { to { transform: translate3d(18vmax, -12vmax, 0) scale(.9); } }
.bg-fx__spot {
    position: absolute; inset: 0; opacity: 0; transition: opacity .4s;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), color-mix(in srgb, var(--hud) 12%, transparent), transparent 70%);
}
.has-pointer .bg-fx__spot { opacity: var(--fx); }
.bg-fx__scan {
    position: absolute; left: 0; right: 0; top: 0; height: 140px; opacity: calc(var(--fx) * .7);
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--hud) 9%, transparent) 85%, color-mix(in srgb, var(--hud) 35%, transparent) 100%);
    transform: translateY(-160px); animation: scan 9s cubic-bezier(.5, 0, .5, 1) infinite;
}
@keyframes scan { 0%, 55% { transform: translateY(-160px); } 100% { transform: translateY(110vh); } }

/* Space: starfield canvas + slow-breathing nebula */
.bg-fx__stars { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--stars, .35); }
.bg-fx__nebula {
    position: absolute; inset: -10%; opacity: calc(var(--fx) * .8);
    background:
        radial-gradient(40% 30% at 78% 22%, color-mix(in srgb, var(--nebula) 28%, transparent), transparent 70%),
        radial-gradient(35% 28% at 18% 70%, color-mix(in srgb, var(--hud) 14%, transparent), transparent 70%),
        radial-gradient(25% 20% at 55% 95%, color-mix(in srgb, var(--nebula) 18%, transparent), transparent 70%);
    animation: nebula 40s ease-in-out infinite alternate;
}
@keyframes nebula { to { transform: translate3d(-3%, 2%, 0) rotate(4deg) scale(1.06); } }

/* More HUD circles: scattered rotating rings + radar pulses */
.bg-fx__defs { position: absolute; width: 0; height: 0; }
.bg-fx__rings { position: absolute; inset: 0; opacity: calc(var(--fx) * .55); }
.bg-ring {
    position: absolute; fill: none; stroke: var(--hud); overflow: visible;
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--hud) 50%, transparent));
    animation: spin var(--d, 60s) linear infinite var(--dir, normal);
}
.bg-ring--1 { width: 340px; height: 340px; top: 58%; left: -110px; --d: 70s; }
.bg-ring--2 { width: 220px; height: 220px; top: 12%; left: 38%; --d: 45s; --dir: reverse; opacity: .7; }
.bg-ring--3 { width: 520px; height: 520px; bottom: -220px; right: -140px; --d: 120s; --dir: reverse; opacity: .8; }
.bg-ring--4 { width: 150px; height: 150px; top: 70%; left: 46%; --d: 30s; opacity: .6; stroke: var(--accent); }
.bg-ring--5 { width: 120px; height: 120px; top: 8%; left: 6%; --d: 26s; --dir: reverse; opacity: .55; }
.bg-ring--6 { width: 260px; height: 260px; top: 34%; right: -70px; --d: 55s; opacity: .6; }

.bg-pulse { position: absolute; width: 1px; height: 1px; }
.bg-pulse i {
    position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; border-radius: 50%;
    border: 1px solid var(--hud); opacity: 0; transform: scale(.1);
    animation: radar 7.5s cubic-bezier(.2, .6, .3, 1) infinite;
}
.bg-pulse i:nth-child(2) { animation-delay: 2.5s; }
.bg-pulse i:nth-child(3) { animation-delay: 5s; }
.bg-pulse--1 { top: 72%; left: 12%; }
.bg-pulse--2 { top: 26%; right: 18%; }
.bg-pulse--2 i { border-color: var(--accent); width: 280px; height: 280px; margin: -140px 0 0 -140px; animation-duration: 9s; }
.bg-pulse--2 i:nth-child(2) { animation-delay: 3s; }
.bg-pulse--2 i:nth-child(3) { animation-delay: 6s; }
@keyframes radar { 0% { transform: scale(.1); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }

@media (max-width: 720px) {
    .bg-ring--2, .bg-ring--4, .bg-pulse--2 { display: none; }
    .bg-ring--1 { width: 220px; height: 220px; left: -90px; }
    .bg-ring--3 { width: 320px; height: 320px; }
}

/* Let the ambient layer show through the alternating bands */
.section--alt { background: color-mix(in srgb, var(--bg-alt) 72%, transparent); }
.contact { position: relative; overflow: hidden; }
.contact::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(rgb(34 211 238 / .09) 1px, transparent 1px),
        linear-gradient(90deg, rgb(34 211 238 / .09) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 60% 70% at 15% 30%, #000, transparent 70%);
            mask-image: radial-gradient(ellipse 60% 70% at 15% 30%, #000, transparent 70%);
}
.contact::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, #22d3ee, #34d17b, transparent); }
.contact > .wrap { position: relative; }

/* Gradient text & accents */
.hero__title em {
    background: linear-gradient(100deg, var(--hud), var(--accent), var(--hud));
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.kicker { display: flex; align-items: center; gap: .7rem; }
.kicker { color: var(--hud); }
.kicker::before { content: ""; width: 32px; height: 1px; background: var(--grad); flex: none; box-shadow: 0 0 8px var(--hud); }
.contact .kicker { color: #22d3ee; }
.contact .kicker::before { background: linear-gradient(100deg, #22d3ee, #34d17b); }
.stat dd { background: linear-gradient(180deg, var(--ink) 40%, color-mix(in srgb, var(--ink) 50%, var(--hud))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { border-top: 1px solid transparent; border-image: linear-gradient(90deg, var(--hud), var(--accent) 40%, var(--line) 75%) 1; }

/* Buttons: gradient fill with a light sweep on hover */
.btn--primary {
    position: relative; overflow: hidden; isolation: isolate;
    background: linear-gradient(100deg, var(--hud), var(--accent)); color: var(--accent-ink);
    box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--hud) 80%, transparent), 0 0 0 1px color-mix(in srgb, var(--hud) 30%, transparent);
}
.btn--primary::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .35) 50%, transparent 70%);
    transform: translateX(-120%); transition: transform .6s ease;
}
.btn--primary:hover { background: linear-gradient(100deg, var(--hud), var(--accent)); box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--hud) 90%, transparent), 0 0 0 1px color-mix(in srgb, var(--hud) 50%, transparent); }
.btn--primary:hover::after { transform: translateX(120%); }
.btn--ghost:hover { border-color: var(--hud); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hud) 15%, transparent); }

/* Nav: glowing gradient underline */
.nav a.is-active::after { background: var(--grad); box-shadow: 0 0 10px color-mix(in srgb, var(--hud) 60%, transparent); }
.dot { background: var(--hud); box-shadow: 0 0 10px var(--hud); }
.dot::after { border-color: var(--hud); }

/* HUD around the batch log */
.hud { position: relative; padding: 2.2rem .4rem; }
.hud__rings {
    position: absolute; left: 50%; top: 50%; width: min(118%, 560px); height: auto; aspect-ratio: 1;
    transform: translate(-50%, -50%); z-index: 0; overflow: visible; pointer-events: none;
    fill: none; stroke: var(--hud); opacity: calc(var(--fx) * .9);
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hud) 55%, transparent));
}
.hud__rings .ring { transform-origin: 200px 200px; transform-box: view-box; }
.ring--ticks circle { stroke-width: 6; stroke-dasharray: 1 7.4; opacity: .45; }
.ring--arcs circle { stroke-width: 1.5; stroke-dasharray: 150 40 30 40 90 60 60 70; opacity: .8; }
.ring--dash circle { stroke-width: 1; stroke-dasharray: 4 6; opacity: .4; }
.ring--core circle { stroke-width: 3; stroke-dasharray: 60 130 30 160 90 120; opacity: .55; stroke: var(--accent); }
.ring--cross path { stroke-width: 1; opacity: .5; }
.ring--ticks { animation: spin 90s linear infinite; }
.ring--arcs { animation: spin 40s linear infinite reverse; }
.ring--dash { animation: spin 60s linear infinite; }
.ring--core { animation: spin 22s linear infinite reverse; }
.hud .console { position: relative; z-index: 1; }
.hud::after {
    content: ""; position: absolute; inset: .9rem -.6rem; pointer-events: none; z-index: 2;
    --c: var(--hud); --l: 22px;
    background:
        linear-gradient(var(--c), var(--c)) top left / var(--l) 2px, linear-gradient(var(--c), var(--c)) top left / 2px var(--l),
        linear-gradient(var(--c), var(--c)) top right / var(--l) 2px, linear-gradient(var(--c), var(--c)) top right / 2px var(--l),
        linear-gradient(var(--c), var(--c)) bottom left / var(--l) 2px, linear-gradient(var(--c), var(--c)) bottom left / 2px var(--l),
        linear-gradient(var(--c), var(--c)) bottom right / var(--l) 2px, linear-gradient(var(--c), var(--c)) bottom right / 2px var(--l);
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 4px var(--hud));
    animation: bracket-pulse 3.2s ease-in-out infinite;
}
@keyframes bracket-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.hud__label {
    position: absolute; z-index: 2; font: 500 .66rem/1 var(--f-mono); letter-spacing: .12em; color: var(--hud);
    text-shadow: 0 0 8px color-mix(in srgb, var(--hud) 60%, transparent); white-space: nowrap;
    background: var(--bg); padding: .3rem .5rem; border: 1px solid color-mix(in srgb, var(--hud) 30%, transparent); border-radius: 3px;
}
.hud__label--tl { top: 0; left: 1.6rem; }
.hud__label--tr { top: 0; right: 1.6rem; }
.hud__label--bl { bottom: 0; left: 1.6rem; }
.hud__label--br { bottom: 0; right: 1.6rem; }

/* Console: cyan edge glow + scanning beam */
.console {
    border-color: color-mix(in srgb, var(--hud) 35%, transparent);
    box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--hud) 18%, transparent), 0 0 40px -8px color-mix(in srgb, var(--hud) 45%, transparent);
}
.console::after {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 46px; pointer-events: none;
    background: linear-gradient(180deg, transparent, rgb(34 211 238 / .10) 80%, rgb(34 211 238 / .45));
    animation: console-scan 4.5s linear infinite;
}
@keyframes console-scan { from { transform: translateY(-50px); } to { transform: translateY(330px); } }
.console__bar { background: linear-gradient(90deg, rgb(34 211 238 / .08), transparent 60%); }
.c-cmd { color: #22d3ee; }

/* Cards: gradient border on the featured project, HUD corners on hover */
.project { position: relative; }
.project--featured {
    border: 1px solid transparent;
    background: linear-gradient(var(--surface), var(--surface)) padding-box,
                linear-gradient(120deg, var(--hud), var(--accent) 35%, var(--line) 70%) border-box;
}
.project::after {
    content: ""; position: absolute; inset: -7px; pointer-events: none; opacity: 0; transform: scale(1.02);
    transition: opacity .25s, transform .25s; --c: var(--hud); --l: 16px;
    background:
        linear-gradient(var(--c), var(--c)) top left / var(--l) 2px, linear-gradient(var(--c), var(--c)) top left / 2px var(--l),
        linear-gradient(var(--c), var(--c)) top right / var(--l) 2px, linear-gradient(var(--c), var(--c)) top right / 2px var(--l),
        linear-gradient(var(--c), var(--c)) bottom left / var(--l) 2px, linear-gradient(var(--c), var(--c)) bottom left / 2px var(--l),
        linear-gradient(var(--c), var(--c)) bottom right / var(--l) 2px, linear-gradient(var(--c), var(--c)) bottom right / 2px var(--l);
    background-repeat: no-repeat;
}
.project:hover::after { opacity: 1; transform: none; }
.project:hover { box-shadow: var(--shadow), 0 0 32px -12px color-mix(in srgb, var(--hud) 60%, transparent); }
.project__visual { background: radial-gradient(120% 90% at 80% 10%, color-mix(in srgb, var(--hud) 22%, transparent), transparent 60%), var(--bg-alt); }

/* Timeline: gradient rule and period on the current role */
.job--current { border-top: 1px solid transparent; border-image: linear-gradient(90deg, var(--hud), var(--accent) 30%, var(--line) 60%) 1; }
.job--current .job__period { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill--live { background: color-mix(in srgb, var(--hud) 14%, transparent); color: var(--hud); box-shadow: 0 0 12px -2px color-mix(in srgb, var(--hud) 50%, transparent); }

/* Skills grid: HUD-style highlight on hover */
.skill-group { transition: background-color .2s; }
.skill-group:hover { background: color-mix(in srgb, var(--hud) 6%, transparent); }
.skill-group:hover h3 { color: var(--hud); }
.skill-group:first-child li:nth-child(-n+3) { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 960px) {
    .hud { padding: 2.2rem .6rem; }
    .hud__rings { width: min(130%, 520px); }
}
@media (max-width: 480px) {
    .hud__label--tr, .hud__label--br { display: none; }
}

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}

@media print {
    .topbar, .form, .footer, .console, .project__visual { display: none !important; }
    .contact, .section--alt { background: none; color: #000; }
}

/* =========================================================
   Glass cards — gradient, see-through surfaces so the space
   background stays visible behind them
   ========================================================= */
:root { --glass-hi: color-mix(in srgb, var(--surface) 62%, transparent); --glass-lo: color-mix(in srgb, var(--surface) 18%, transparent); --glass-edge: color-mix(in srgb, var(--hud) 28%, var(--line)); }

.project,
.form {
    background: linear-gradient(140deg, var(--glass-hi), var(--glass-lo) 70%);
    border: 1px solid var(--glass-edge);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.project--featured {
    border-color: transparent;
    background: linear-gradient(140deg, var(--glass-hi), var(--glass-lo) 70%);
}
/* Gradient outline drawn with a mask so the card's inside stays transparent */
.project--featured::before {
    content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(120deg, var(--hud), var(--accent) 35%, color-mix(in srgb, var(--line) 40%, transparent) 75%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.project:hover { border-color: color-mix(in srgb, var(--hud) 55%, transparent); }
.project__visual { background: linear-gradient(160deg, color-mix(in srgb, var(--hud) 16%, transparent), transparent 70%); border: 1px solid color-mix(in srgb, var(--hud) 15%, transparent); }
.device { background: color-mix(in srgb, var(--surface) 70%, transparent); }

/* Console stays readable but lets the rings show at the edges */
.console { background: linear-gradient(160deg, color-mix(in srgb, var(--console-bg) 92%, transparent), color-mix(in srgb, var(--console-bg) 72%, transparent)); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* Form fields: glass instead of solid */
.field input, .field textarea { background: color-mix(in srgb, var(--bg) 45%, transparent); }

/* Tags and chips */
.tags li, .section--alt .tags li { background: color-mix(in srgb, var(--surface) 35%, transparent); border-color: color-mix(in srgb, var(--hud) 20%, var(--line)); }

/* Bands and contact: let the starfield through */
.section--alt { background: linear-gradient(180deg, color-mix(in srgb, var(--bg-alt) 45%, transparent), color-mix(in srgb, var(--bg-alt) 20%, transparent)); }
.contact { background: linear-gradient(180deg, color-mix(in srgb, var(--deep) 66%, transparent), color-mix(in srgb, var(--deep) 88%, transparent)); }
.email-card { background: linear-gradient(140deg, rgb(255 255 255 / .06), rgb(255 255 255 / .01)); }

/* Light theme: a translucent dark band over the light page turns muddy grey, so the
   contact band is solid there, and the form inside uses the dark-theme colours. */
:root:not([data-theme="dark"]) .contact {
    --surface: #171a1e; --bg: #0d0f11; --ink: #ecebe6; --ink-2: #c4c7c2; --muted: #969ca2; --line: #272b30;
    --accent: #34d17b; --accent-ink: #06200f; --accent-soft: #143322; --hud: #22d3ee;
    --glass-hi: color-mix(in srgb, var(--surface) 62%, transparent); --glass-lo: color-mix(in srgb, var(--surface) 18%, transparent);
    --glass-edge: color-mix(in srgb, var(--hud) 28%, var(--line));
    color-scheme: dark;
    background: var(--deep);
}
:root:not([data-theme="dark"]) .contact .field__error,
:root:not([data-theme="dark"]) .contact .form__status.is-error { color: #ff8a73; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .contact { background: linear-gradient(180deg, color-mix(in srgb, var(--deep) 66%, transparent), color-mix(in srgb, var(--deep) 88%, transparent)); }
}
.skill-group { background: linear-gradient(140deg, color-mix(in srgb, var(--surface) 22%, transparent), transparent); }

/* =========================================================
   Interactive terminal (hero console)
   ========================================================= */
.console__body { max-height: 19em; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2c3035 transparent; }
.console__body li.c-out { white-space: pre-wrap; overflow: visible; text-overflow: clip; color: var(--console-ink); }
.console__body li.c-in { color: #fff; }
.console__body li.c-err { color: var(--console-warn); white-space: pre-wrap; }
.console__body a { color: #22d3ee; }
.console__prompt { display: flex; align-items: center; gap: .5rem; padding: .55rem 1.1rem .8rem; border-top: 1px dashed #2c3035; }
.console__prompt[hidden] { display: none; }
.console__prompt label { white-space: nowrap; }
.console__prompt input {
    flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; caret-color: var(--console-ok);
    font: inherit; padding: .25rem 0; min-height: 32px;
}
.console__prompt input::placeholder { color: var(--console-dim); }
.console:focus-within { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--hud) 55%, transparent), 0 0 50px -6px color-mix(in srgb, var(--hud) 60%, transparent); }

/* =========================================================
   Mini-game: Bug Squash
   ========================================================= */
.section__lede { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-lg); max-width: 38em; }
.game {
    position: relative; max-width: 760px; border-radius: calc(var(--radius) + 4px); overflow: hidden;
    background: linear-gradient(140deg, var(--glass-hi), var(--glass-lo) 70%);
    border: 1px solid var(--glass-edge);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    box-shadow: 0 0 60px -30px color-mix(in srgb, var(--hud) 70%, transparent);
}
.game__hud { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--glass-edge); }
.game__stat { padding: .9rem 1.2rem 1.1rem; }
.game__stat + .game__stat { border-left: 1px solid var(--glass-edge); }
.game__stat span { display: block; font: 500 .68rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.game__stat b { font: 700 var(--t-xl)/1 var(--f-display); font-variant-numeric: tabular-nums; }
.game__stat b[data-g="streak"] { color: var(--hud); }
.game__timer { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: color-mix(in srgb, var(--line) 50%, transparent); }
.game__timer i { display: block; transition: transform .1s linear; height: 100%; width: 100%; transform-origin: left; background: var(--grad); box-shadow: 0 0 10px var(--hud); }
.game[data-state="play"] .game__timer i.is-low { background: linear-gradient(90deg, #f2b24c, #ef4444); box-shadow: 0 0 10px #ef4444; }

.game__stage { position: relative; min-height: 330px; display: grid; }
.game__screen { grid-area: 1 / 1; padding: clamp(1.5rem, 4vw, 2.5rem); display: none; flex-direction: column; justify-content: center; }
.game[data-state="idle"] .game__screen--idle,
.game[data-state="play"] .game__screen--play,
.game[data-state="over"] .game__screen--over { display: flex; animation: line-in .3s ease-out; }
.game__badge { font: 500 .7rem/1 var(--f-mono); letter-spacing: .14em; color: var(--hud); margin-bottom: .8rem; }
.game__screen h3 { font-size: var(--t-2xl); margin-bottom: var(--s-2); }
.game__rules { margin-bottom: var(--s-3); color: var(--ink-2); }
.game__rules li { padding: .35rem 0; }
kbd { display: inline-block; min-width: 1.7em; text-align: center; font: 500 .75rem/1 var(--f-mono); padding: .3rem .4rem; border-radius: 5px; border: 1px solid var(--line); border-bottom-width: 2px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.game__screen .btn { align-self: flex-start; }
.game__summary { color: var(--ink-2); font-size: var(--t-lg); max-width: 32em; margin-bottom: var(--s-3); }
.game__end-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.game__screen--play { padding: 0; }
.arena {
    position: relative; height: 330px; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none;
    background: color-mix(in srgb, var(--console-bg) 94%, transparent); color: var(--console-ink);
}
.arena.is-shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.arena__code {
    position: absolute; inset: 0; margin: 0; padding: 1rem 1.2rem; pointer-events: none;
    font: 400 .78rem/1.9 var(--f-mono); color: var(--console-dim); opacity: .45; white-space: pre; overflow: hidden;
}
.arena__prod {
    position: absolute; top: 0; right: 0; bottom: 0; width: 56px; display: grid; place-items: center;
    border-left: 1px dashed rgb(239 68 68 / .6); background: linear-gradient(90deg, transparent, rgb(239 68 68 / .16));
}
.arena__prod span { writing-mode: vertical-rl; font: 600 .7rem/1 var(--f-mono); letter-spacing: .35em; color: #ff8a73; }
.arena__toast {
    position: absolute; left: calc(50% - 28px); bottom: 1rem; z-index: 3; margin: 0; padding: .45rem .8rem; border-radius: 8px;
    max-width: calc(100% - 96px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
    background: rgb(0 0 0 / .72); border: 1px solid color-mix(in srgb, var(--hud) 40%, transparent); color: #fff;
    font: 500 .78rem/1.3 var(--f-mono); opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s;
}
.arena__toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.bug {
    position: absolute; left: 0; top: 0; z-index: 2; display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .7rem .35rem .45rem; border-radius: 999px; white-space: nowrap; cursor: crosshair; will-change: transform;
    border: 1px solid color-mix(in srgb, var(--hud) 40%, transparent); background: rgb(10 12 14 / .88); color: var(--console-ink);
    font: 500 .74rem/1 var(--f-mono);
}
.bug:hover { border-color: #ef4444; }
.bug:focus-visible { outline-color: var(--hud); }
.bug__icon { display: inline-block; font-size: 1.15rem; animation: wiggle .35s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.bug--legacy { border-color: rgb(242 178 76 / .7); }
.bug--heisen .bug__label { font-style: italic; }
.bug--feature { border-color: color-mix(in srgb, var(--console-ok) 60%, transparent); color: var(--console-ok); }
.bug.is-hit .bug__icon { animation: hit .2s; }
@keyframes hit { 50% { transform: scale(1.5); filter: brightness(2); } }
.bug.is-squashed { border-color: var(--console-ok); }
.bug.is-squashed .bug__icon { animation: squash .35s forwards; }
.bug.is-squashed, .bug.is-escaped, .bug.is-oops { pointer-events: none; animation: fade-out .45s forwards; }
.bug.is-oops { border-color: #ef4444; }
@keyframes squash { to { transform: scale(1.7, .2); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.bug-pop {
    position: absolute; z-index: 3; pointer-events: none; font: 700 .9rem/1 var(--f-mono); color: var(--console-ok);
    text-shadow: 0 0 10px currentColor; animation: pop-up .8s ease-out forwards;
}
.bug-pop--bad { color: #ff8a73; }
@keyframes pop-up { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-28px); } }

@media (max-width: 560px) {
    .game__hud { grid-template-columns: repeat(2, 1fr); }
    .game__stat:nth-child(3) { border-left: 0; }
    .game__stat:nth-child(n+3) { border-top: 1px solid var(--glass-edge); }
    .arena { height: 360px; }
    .arena__code { font-size: .62rem; }
}
.btn--primary .btn__hint { color: inherit; border-color: currentColor; opacity: .65; }
