/*
    zdanowicz.dev — ops console
    0 frameworks, 1 easter egg. Caught something? konrad@zdanowicz.dev
*/

:root {
    --bg: #050807;
    --bg-panel: #0a0f0d;
    --bg-raise: #0d1411;
    --line: #1c2a23;
    --line-bright: #2c4537;
    --text: #c3d4c9;
    --dim: #6b7f73;
    --accent: #3df58c;
    --warn: #ffb000;
    --accent-dim: color-mix(in srgb, var(--accent) 14%, transparent);
    --accent-ghost: color-mix(in srgb, var(--accent) 7%, transparent);
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-display: "Space Grotesk", "Helvetica Neue", sans-serif;
    --font-hero: "Space Grotesk", "Helvetica Neue", sans-serif;
    --notch: 16px;
    --dread: 0;
}

/* hero name face: grotesk (default) / rajdhani / michroma — switch via ⌘K `hero …` */
[data-hero="grotesk"]  { --font-hero: "Space Grotesk", "Helvetica Neue", sans-serif; }
[data-hero="rajdhani"] { --font-hero: "Rajdhani", "Helvetica Neue", sans-serif; }
[data-hero="michroma"] { --font-hero: "Michroma", "Helvetica Neue", sans-serif; }

[data-theme="amber"]  { --accent: #ffb000; --warn: #3df58c; --bg: #060503; --bg-panel: #0d0a05; --bg-raise: #14100a; --line: #2a2113; --line-bright: #46371d; --text: #d6c8a8; --dim: #82765c; }
[data-theme="cyan"]   { --accent: #4ec9ff; --line: #1a2730; --line-bright: #2a4150; --bg-panel: #0a0e12; }
[data-theme="violet"] { --accent: #8d7aff; --bg: #060409; --bg-panel: #0b0812; --bg-raise: #110d1a; --line: #221c33; --line-bright: #383053; --text: #c6bdd6; --dim: #6f6584; }

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .5s ease, color .5s ease, filter .15s ease;
}

::selection { background: var(--accent); color: var(--bg); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-bright); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- atmosphere ------------------------------------------------------ */

#worldMap {
    position: fixed; inset: 0; z-index: -3; pointer-events: none;
    width: 100vw; height: 100vh;
    opacity: var(--map-fade, 1);    /* neural.js crossfades map -> network on scroll */
}

/* ---- cyan: deep field — the map gives way to space ----------------------- */

#cosmos {
    display: none; position: fixed; inset: 0; z-index: -3; pointer-events: none;
    width: 100vw; height: 100vh;
}
[data-theme="cyan"] #cosmos { display: block; }
[data-theme="cyan"] #worldMap,
[data-theme="cyan"] .neural-bg,
[data-theme="cyan"] .neural-hud { display: none; }

/* ---- neural background: the visitor model, drawn live ------------------ */

.neural-bg {
    position: fixed; inset: 0; z-index: -3; pointer-events: none;
    width: 100vw; height: 100vh;
    opacity: calc(var(--nn-mix, 0) * .68);
    transition: opacity .3s linear;
}
.neural-bg .nn-edge { stroke: var(--accent); fill: none; stroke-linecap: round; }
.neural-bg .nn-node { fill: var(--accent); }
.neural-bg .nn-spark { fill: #ff5e10; }
.neural-bg .nn-pulse { fill: var(--accent); }
.neural-bg .nn-lab {
    fill: var(--dim); font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em;
    opacity: .7;
}
.neural-bg .nn-out { font-size: 10px; }
.neural-bg .nn-out.on { fill: var(--accent); opacity: 1; }

.neural-hud {
    position: fixed; right: 16px; bottom: 14px; z-index: 40;
    display: flex; flex-direction: column; gap: 4px;
    min-width: 215px; padding: 9px 12px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(6px);
    font-size: 10px; letter-spacing: .14em; color: var(--dim);
}
.neural-hud:hover { text-decoration: none; border-color: var(--line-bright); background: color-mix(in srgb, var(--bg) 92%, transparent); }
.neural-hud .nh-title { display: flex; justify-content: space-between; align-items: center; color: var(--text); font-weight: 600; }
.neural-hud .nh-dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; animation: pulse 1.4s ease infinite; }
.neural-hud .nh-row { display: flex; justify-content: space-between; gap: 16px; }
.neural-hud .nh-row b { color: var(--accent); font-weight: 600; }
.neural-hud .nh-meta { font-size: 8.5px; letter-spacing: .1em; opacity: .75; }
html.nn-off .neural-bg, html.nn-off .neural-hud { display: none; }
html.crt-on .neural-bg, html.crt-on .neural-hud { visibility: hidden; }

/* ---- KZ·MIND chat ------------------------------------------------------- */

.chatwin[hidden] { display: none; } /* author display:flex would otherwise beat the hidden attr */
.chatwin {
    position: fixed; right: 16px; bottom: 14px; z-index: 60;
    display: flex; flex-direction: column;
    width: min(400px, calc(100vw - 28px)); height: min(480px, calc(100vh - 90px));
    border: 1px solid var(--line-bright);
    background: color-mix(in srgb, var(--bg) 93%, transparent);
    backdrop-filter: blur(10px);
}
html.chat-open .neural-hud { display: none; }
.chat-head {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-bottom: 1px solid var(--line);
    font-size: 10px; letter-spacing: .16em; color: var(--text); font-weight: 600;
}
.chat-stat { margin-left: auto; color: var(--accent); font-weight: 400; font-size: 9px; }
.chat-x {
    background: transparent; border: 0; color: var(--dim); cursor: pointer;
    font-family: var(--font-mono); font-size: 12px; padding: 2px 4px;
}
.chat-x:hover { color: var(--accent); }
.chat-log {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    font-size: 12.5px; line-height: 1.55;
}
.chat-msg.user { color: var(--accent); }
.chat-msg.bot { color: var(--text); }
.chat-msg.dream { color: var(--dim); font-style: italic; font-size: 11.5px; }
.chat-form {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-top: 1px solid var(--line);
}
.chat-prompt { color: var(--accent); font-weight: 700; }
#chatIn {
    flex: 1; background: transparent; border: 0; outline: 0;
    color: var(--text); font-family: var(--font-mono); letter-spacing: .02em;
    font-size: 16px; /* <16px triggers iOS focus zoom */
}
#chatIn::placeholder { color: var(--dim); }
html.crt-on .chatwin { visibility: hidden; }

/* ---- ghost cursor -------------------------------------------------------- */

.ghost-cursor {
    position: fixed; left: 0; top: 0; z-index: 46; pointer-events: none;
    color: color-mix(in srgb, var(--accent) 65%, transparent);
    transition: opacity .4s ease;
    filter: drop-shadow(0 0 4px var(--accent-dim));
}
.ghost-cursor .ghost-tag {
    position: absolute; left: 14px; top: 14px;
    font-size: 8px; letter-spacing: .14em; white-space: nowrap;
    color: color-mix(in srgb, var(--accent) 50%, transparent);
}
html.crt-on .ghost-cursor { visibility: hidden; }

.grid-bg {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image:
        linear-gradient(var(--accent-ghost) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent-ghost) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 0%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 0%, transparent 100%);
}

/* drifting tinted gradients, barely-there */
.fx-aurora { position: fixed; inset: -20%; z-index: -1; pointer-events: none; overflow: hidden; }
.fx-aurora::before, .fx-aurora::after {
    content: ""; position: absolute; width: 55vw; height: 55vw; border-radius: 50%;
    background: radial-gradient(circle, var(--accent-ghost), transparent 65%);
    animation: drift 46s ease-in-out infinite alternate;
}
.fx-aurora::before { top: -10%; left: 4%; }
.fx-aurora::after { bottom: -12%; right: 0%; animation-duration: 61s; animation-delay: -20s; }
@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); opacity: .8; }
    50%  { transform: translate(9vw, 6vh) scale(1.25); opacity: 1; }
    100% { transform: translate(-7vw, -5vh) scale(.9); opacity: .65; }
}

html.glitch main, html.glitch .statusbar, html.glitch .bottombar { filter: hue-rotate(140deg) saturate(2.2) contrast(1.1); }
/* green/phosphor theme: no glitch filter */
html[data-theme="green"].glitch main,
html[data-theme="green"].glitch .statusbar,
html[data-theme="green"].glitch .bottombar { filter: none; }

.legacy-flash {
    position: fixed; inset: 0; z-index: 90; pointer-events: none;
    background: linear-gradient(#DA4BF2, #F86989);
    opacity: 0; transition: opacity .9s ease;
}
.legacy-flash.on { opacity: .28; transition: opacity .05s ease; }

/* ---- amber: cathode-ray tube ----------------------------------------- */

.fx-crt { display: none; }
[data-theme="amber"] .fx-crt {
    display: block; position: fixed; inset: 0; z-index: 70; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
    border-radius: 24px;
    box-shadow: inset 0 0 140px rgba(0,0,0,.85), inset 0 0 18px rgba(0,0,0,.6);
    animation: crt-flicker 4.2s steps(12) infinite;
}
[data-theme="amber"] .fx-crt::before {
    /* rolling retrace band */
    content: ""; position: absolute; left: 0; right: 0; height: 110px; top: -130px;
    background: linear-gradient(transparent, rgba(255,176,0,.05) 45%, rgba(255,255,255,.04) 50%, transparent);
    animation: crt-roll 8s linear infinite;
}
[data-theme="amber"] .fx-crt::after {
    /* tube corner shading suggests curvature */
    content: ""; position: absolute; inset: 0; border-radius: 24px;
    background: radial-gradient(ellipse 105% 100% at 50% 50%, transparent 76%, rgba(0,0,0,.6) 100%);
}
@keyframes crt-roll { to { top: 110%; } }
@keyframes crt-flicker {
    0%, 100% { opacity: 1; } 8% { opacity: .92; } 9% { opacity: 1; }
    44% { opacity: .96; } 71% { opacity: .9; } 72% { opacity: 1; }
}
[data-theme="amber"] .name,
[data-theme="amber"] h3,
[data-theme="amber"] .prompt,
[data-theme="amber"] .seclabel b {
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 55%, transparent),
                 0 0 26px color-mix(in srgb, var(--accent) 28%, transparent),
                 2px 0 0 color-mix(in srgb, var(--accent) 18%, transparent); /* burn-in ghost */
}
[data-theme="amber"] .statusbar, [data-theme="amber"] .bottombar { text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 40%, transparent); }
/* filter must NOT land on body — a filtered body becomes the containing block
   for position:fixed children and the tube/statusbar would scroll with the page */
[data-theme="amber"] main { animation: crt-breathe 9s ease-in-out infinite; }
@keyframes crt-breathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.045) contrast(1.01); } }

/* WebGL tube: the page itself is rasterized and re-rendered on curved glass.
   While crt-on, the live DOM hides (visibility keeps layout + scroll height);
   statusbar/palette stay live above the tube. .fx-crt CSS remains the fallback. */
#crtGL { display: none; position: fixed; inset: 0; z-index: 60; width: 100vw; height: 100vh; background: #000; }
html.crt-tuning #crtGL, html.crt-on #crtGL { display: block; }
html.crt-on #crtGL { pointer-events: auto; cursor: crosshair; }
/* the DOM stays LIVE under the opaque glass — hit-testable and re-photographable;
   only decorative fixed layers that fight the tube get hidden */
html.crt-on .grid-bg, html.crt-on .fx-aurora, html.crt-on .crosshair { visibility: hidden; }
html.crt-on .statusbar, html.crt-on .bottombar { z-index: 80; }
html.crt-on .fx-crt, html.crt-tuning .fx-crt { display: none !important; }
/* .fake-hover twins: real :hover can't be triggered synthetically, so patch
   re-shoots photograph the element wearing this class instead */
a:hover, a.fake-hover { text-decoration: underline; text-underline-offset: 3px; }
.btn.fake-hover { border-color: #8f6f24; color: var(--accent); background: rgba(255, 176, 0, .07); }
.btn-primary.fake-hover { background: transparent; color: var(--accent); }
.career li.fake-hover .c-org { color: var(--accent); }
.career li.fake-hover .c-desc { color: var(--text); }
.op.fake-hover .panel-inner { background: var(--bg-raise); }
/* freeze entrance transitions while photographing the page */
html.crt-cap .reveal, html.crt-cap .s-bar i, html.crt-cap .signal .trace { transition: none !important; }
/* the rasterizer can't parse color-mix()/color(srgb) — during capture (always amber)
   substitute every color-mix with concrete amber values */
html.crt-cap {
    --accent-dim: rgba(255, 176, 0, .14);
    --accent-ghost: rgba(255, 176, 0, .07);
}
/* keep the snapshot transparent: bg, grid and live map are composited in-shader */
html.crt-cap body { background: transparent !important; }
html.crt-cap .name, html.crt-cap h3, html.crt-cap .prompt, html.crt-cap .seclabel b {
    text-shadow: 0 0 8px rgba(255, 176, 0, .55), 0 0 26px rgba(255, 176, 0, .28), 2px 0 0 rgba(255, 176, 0, .18) !important;
}
html.crt-cap .btn:hover { border-color: #8f6f24; }
html.crt-cap .readouts { background: rgba(13, 10, 5, .72); }
html.crt-cap .lit::after { background: none !important; }
html.crt-cap .career::before { background: linear-gradient(90deg, rgba(255, 176, 0, .14), rgba(255, 176, 0, .07) 55%, transparent); }
html.crt-cap .s-bar { background: rgba(255, 176, 0, .07); }
html.crt-cap .grid-bg { background-image: linear-gradient(rgba(255, 176, 0, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 176, 0, .07) 1px, transparent 1px); }

/* ---- violet: post-apo / dread ----------------------------------------- */

.fx-noise, .fx-dread { display: none; }
[data-theme="violet"] .fx-noise {
    display: block; position: fixed; inset: 0; z-index: 69; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    opacity: calc(.05 + var(--dread) * .12);
    mix-blend-mode: overlay;
    animation: noise-jump .45s steps(3) infinite;
}
@keyframes noise-jump {
    0% { transform: translate(0, 0); } 33% { transform: translate(-60px, 30px); }
    66% { transform: translate(40px, -50px); } 100% { transform: translate(0, 0); }
}
[data-theme="violet"] .fx-dread {
    /* red closes in from the edges as you descend */
    display: block; position: fixed; inset: 0; z-index: 68; pointer-events: none;
    background: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 45%, rgba(170, 16, 28, .55) 100%);
    opacity: var(--dread);
    transition: opacity .3s linear;
}
[data-theme="violet"] .name, [data-theme="violet"] h3 {
    text-shadow: calc(var(--dread) * -3px) 0 0 rgba(255, 40, 60, .55),
                 calc(var(--dread) * 3px) 0 0 rgba(80, 180, 255, .35);
}
[data-theme="violet"] .dot, [data-theme="violet"] .live-dot { animation-duration: .9s; }
#dirt { display: none; position: fixed; inset: 0; z-index: 66; pointer-events: none; width: 100vw; height: 100vh; }
[data-theme="violet"] #dirt { display: block; }
[data-theme="violet"] main { animation: vsway 17s ease-in-out infinite alternate; }
@keyframes vsway {
    0%   { transform: translate(0, 0) rotate(0deg); }
    45%  { transform: translate(-3px, 2px) rotate(-.07deg); }
    100% { transform: translate(3px, -2px) rotate(.06deg); }
}
[data-theme="violet"] .panel-inner { box-shadow: inset 0 0 44px rgba(0, 0, 0, .55); }
[data-theme="violet"] .statusbar { box-shadow: 0 6px 30px rgba(0, 0, 0, .6); }
/* whispers: stackoverflow #1732454 surfaces through the page */
.whisper {
    position: fixed; z-index: 67; pointer-events: none;
    max-width: 360px;
    font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em;
    color: color-mix(in srgb, var(--accent) 70%, #ff2030);
    text-shadow: -2px 0 0 rgba(255, 40, 60, .6), 2px 0 0 rgba(80, 180, 255, .4),
                 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent);
    transform: rotate(var(--wrot, 0deg));
    opacity: 0;
    animation: whisper-pop 2.4s steps(7) forwards;
}
@keyframes whisper-pop {
    0%   { opacity: 0; clip-path: inset(0 80% 0 0); transform: rotate(var(--wrot)) translateX(-6px); }
    12%  { opacity: .9; clip-path: inset(0 30% 0 0) }
    22%  { opacity: .4; clip-path: inset(40% 0 10% 0); }
    34%  { opacity: .95; clip-path: inset(0); transform: rotate(var(--wrot)) translateX(3px); }
    70%  { opacity: .8; clip-path: inset(0); transform: rotate(var(--wrot)); }
    84%  { opacity: .25; clip-path: inset(20% 0 35% 0); transform: rotate(var(--wrot)) translateX(-4px); }
    100% { opacity: 0; clip-path: inset(0 0 0 85%); }
}

/* vines: glitched tendrils creeping around text */
.vines {
    position: absolute; z-index: 67; pointer-events: none; overflow: visible;
    opacity: .8; transition: opacity 1.4s steps(5);
    animation: vine-twitch .9s steps(2) infinite;
}
.vines path {
    fill: none; stroke-width: 1;
    stroke: color-mix(in srgb, var(--accent) 55%, #ff2030);
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 70%, transparent));
}
.vines.wither { opacity: 0; }
@keyframes vine-twitch {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(.7px, -.5px); }
}

main.tear { animation: tear .16s steps(2) 1; }
@keyframes tear {
    0%   { transform: translateX(0); clip-path: inset(0); }
    25%  { transform: translateX(-7px) skewX(.6deg); clip-path: inset(12% 0 64% 0); }
    50%  { transform: translateX(9px); clip-path: inset(58% 0 8% 0); }
    75%  { transform: translateX(-4px) skewX(-.4deg); clip-path: inset(0); }
    100% { transform: translateX(0); }
}

/* crosshair cursor accent (fine pointers only) */
.crosshair { display: none; }
@media (pointer: fine) {
    .crosshair { display: block; position: fixed; inset: 0; z-index: 80; pointer-events: none; opacity: 0; transition: opacity .4s ease; }
    .crosshair.live { opacity: 1; }
    .crosshair .ch-x, .crosshair .ch-y { position: absolute; background: color-mix(in srgb, var(--accent) 9%, transparent); }
    .crosshair .ch-x { top: 0; bottom: 0; width: 1px; }
    .crosshair .ch-y { left: 0; right: 0; height: 1px; }
    .crosshair .ch-read {
        position: absolute; padding: 1px 6px; font-size: 10px; letter-spacing: .08em;
        color: color-mix(in srgb, var(--accent) 45%, transparent);
        transform: translate(10px, 10px); white-space: nowrap;
    }
}

/* boot overlay */
.boot {
    position: fixed; inset: 0; z-index: 100; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: opacity .35s ease; opacity: 1;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot pre { color: var(--accent); font-family: var(--font-mono); font-size: 13px; line-height: 1.9; letter-spacing: .04em; }
.boot[hidden] { display: none; }

/* ---- status bar ------------------------------------------------------ */

.statusbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    display: flex; align-items: center; gap: 26px;
    height: 52px; padding: 0 22px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    font-size: 12px; letter-spacing: .1em;
}

.brand { color: var(--text); font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.caret { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.topnav { display: flex; gap: 18px; }
.topnav a { color: var(--dim); transition: color .15s; white-space: nowrap; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--accent); }

.sysmeta { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--dim); white-space: nowrap; }

/* odometer clock: each digit is a masked column of 0-9 that slides vertically */
.clock { display: inline-flex; align-items: center; }
.clock .cl-d { display: block; height: 1.5em; overflow: hidden; }
.clock .cl-col { display: block; transition: transform .42s cubic-bezier(.3, .8, .25, 1); will-change: transform; }
.clock .cl-col span { display: block; height: 1.5em; line-height: 1.5em; text-align: center; }
.clock .cl-sep { line-height: 1.5em; padding: 0 1px; }
.clock .cl-tz { margin-left: 7px; color: var(--dim); font-size: 10px; letter-spacing: .12em; }
.online { color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: pulse 2s ease infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.kbtn, .bottombar button {
    font-family: var(--font-mono); font-size: 12px; letter-spacing: .05em;
    background: transparent; color: var(--accent);
    border: 1px solid var(--line-bright); padding: 3px 9px; cursor: pointer;
    transition: background .15s, color .15s;
}
.kbtn:hover, .bottombar button:hover { background: var(--accent); color: var(--bg); }
.kbtn.on { background: var(--accent); color: var(--bg); }

/* ---- layout ---------------------------------------------------------- */

main { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

.section { padding: 110px 0 30px; }
.section.hero { padding-top: 150px; min-height: min(88vh, 900px); }

.seclabel {
    display: flex; align-items: center; gap: 14px;
    color: var(--dim); font-size: 12px; letter-spacing: .28em; margin-bottom: 42px;
}
.seclabel b { color: var(--accent); font-weight: 600; }
.rule { flex: 1; height: 1px; background: var(--line); display: block; }

/* ---- corner-cut panels ----------------------------------------------- */

.panel {
    position: relative;
    background: var(--line-bright);
    clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
    padding: 1px;
    transition: background .5s ease;
}
.panel-inner {
    background: var(--bg-panel);
    clip-path: polygon(0 0, calc(100% - var(--notch) + 1px) 0, 100% calc(var(--notch) - 1px), 100% 100%, 0 100%);
    height: 100%;
    transition: background .3s ease;
}

/* feint light: border segment that chases the cursor (JS sets --mx/--my) */
.lit { position: relative; }
.lit::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    clip-path: inherit;
    padding: 1px;
    background: radial-gradient(150px circle at var(--mx, 50%) var(--my, 50%),
        var(--accent), color-mix(in srgb, var(--accent) 35%, transparent) 40%, transparent 72%);
    -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, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0; transition: opacity .25s ease;
}
.lit:hover::after { opacity: 1; }

/* ---- hero ------------------------------------------------------------ */

.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: start; }

.kicker { color: var(--dim); font-size: 12px; letter-spacing: .2em; margin-bottom: 18px; }

.name {
    font-family: var(--font-hero);
    font-size: clamp(42px, 7vw, 84px);
    font-weight: 400; line-height: 1.0; letter-spacing: -.025em;
    color: var(--text); margin-bottom: 22px;
    text-shadow: 0 0 32px var(--accent-dim);
}
[data-hero="rajdhani"] .name { font-weight: 700; font-size: clamp(46px, 7.6vw, 92px); letter-spacing: .01em; }
[data-hero="michroma"] .name { font-weight: 400; font-size: clamp(24px, 3.8vw, 50px); letter-spacing: 0; line-height: 1.15; }

.role { font-size: clamp(16px, 2.2vw, 21px); letter-spacing: .06em; color: var(--accent); margin-bottom: 10px; }
.role a { border-bottom: 1px solid var(--line-bright); }
.tags { color: var(--dim); font-size: 13px; letter-spacing: .18em; margin-bottom: 30px; }

.lede { max-width: 56ch; color: var(--text); margin-bottom: 38px; }

.hero-actions, .contact-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
    display: inline-block; padding: 11px 22px;
    font-size: 12px; letter-spacing: .14em; font-weight: 600;
    color: var(--text); border: 1px solid var(--line-bright);
    transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--line-bright)); color: var(--accent); background: var(--accent-ghost); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: transparent; color: var(--accent); }

/* hero side */
.hero-side { display: flex; flex-direction: column; gap: 22px; align-items: stretch; }

.avatar { max-width: 100%; }
.avatar .panel-inner { padding: 12px 14px; display: flex; align-items: center; gap: 14px; }
.avatar-frame {
    position: relative; overflow: hidden;
    width: 76px; height: 76px; flex: 0 0 76px; border: 1px solid var(--line);
}
.avatar img {
    display: block; width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(1) contrast(1.05) brightness(.92);
}
.avatar figcaption {
    display: flex; flex-direction: column; gap: 5px;
    font-size: 10px; letter-spacing: .22em; color: var(--dim);
}
.avatar figcaption b {
    font-size: 12px; letter-spacing: .14em; color: var(--text); font-weight: 600;
}

.readouts { list-style: none; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-panel) 72%, transparent); }
.readouts li {
    display: flex; justify-content: space-between; padding: 9px 14px;
    font-size: 12px; letter-spacing: .08em;
}
.readouts li + li { border-top: 1px solid var(--line); }
.readouts span { color: var(--dim); }
.readouts b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.readouts .ok { color: var(--accent); }

/* ---- telemetry -------------------------------------------------------- */

.signal-panel { margin-bottom: 56px; }
.signal-panel .panel-inner { padding: 26px 22px 14px; }

.signal { display: block; width: 100%; height: 170px; }
.signal .axis { stroke: var(--line); stroke-width: 1; }
.signal .axis.faint { stroke-dasharray: 2 6; opacity: .6; }
.signal .trace {
    fill: none; stroke: var(--accent); stroke-width: 2;
    filter: drop-shadow(0 0 6px var(--accent-dim));
}
.signal .nodes circle { fill: var(--bg); stroke: var(--accent); stroke-width: 2; opacity: 0; transition: opacity .4s ease; }
.signal.drawn .nodes circle { opacity: 1; }
.signal .nodes .live { fill: var(--accent); animation: pulse 2s ease infinite; }
.signal text {
    fill: var(--dim); font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
    text-anchor: middle;
}
.signal-eq {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
    padding: 10px 14px 4px; border-top: 1px solid var(--line);
    font-size: 11px; letter-spacing: .08em; color: var(--dim);
}
.signal-eq .eq { color: var(--accent); }

.career { list-style: none; position: relative; }
.career::before {
    /* roaming row highlight — JS drives --glow-y / --glow-h / --glow-o */
    content: ""; position: absolute; left: -14px; right: -14px;
    top: 0; height: 10px;
    transform: translateY(var(--glow-y, 0px));
    height: var(--glow-h, 0px);
    background: linear-gradient(90deg, var(--accent-dim), var(--accent-ghost) 55%, transparent);
    border-left: 2px solid var(--accent);
    opacity: var(--glow-o, 0);
    transition: transform .35s cubic-bezier(.3,.8,.3,1), height .35s cubic-bezier(.3,.8,.3,1), opacity .3s ease;
    pointer-events: none;
}
.career li {
    display: grid; grid-template-columns: 130px 150px 1fr; gap: 6px 28px;
    padding: 26px 4px; border-top: 1px solid var(--line);
    align-items: baseline;
    position: relative;
    transition: color .25s ease;
}
.career li:last-child { border-bottom: 1px solid var(--line); }
.career li:hover .c-org { color: var(--accent); }
.career li:hover .c-desc { color: var(--text); }
.career .c-year { color: var(--dim); font-size: 12px; letter-spacing: .12em; }
.career .c-org { font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; transition: color .25s ease; display: flex; align-items: center; gap: 10px; }
.career .c-logo { flex: 0 0 auto; width: 20px; height: 20px; color: var(--dim); transition: color .25s ease; }
.career .c-logo svg { display: block; width: 100%; height: 100%; }
.career .c-logo text { font-family: var(--font-display); font-weight: 700; }
.career li:hover .c-logo { color: var(--accent); }
.career .c-role { color: var(--accent); font-size: 13px; letter-spacing: .1em; grid-column: 3; }
.career .c-desc { grid-column: 3; color: var(--dim); font-size: 14px; max-width: 62ch; transition: color .25s ease; }
.live-dot { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-left: 6px; animation: pulse 2s ease infinite; }

/* ---- operations -------------------------------------------------------- */

.ops-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.op .panel-inner { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.op header { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .2em; }
.op .op-id { color: var(--dim); }
.op .op-status { color: var(--accent); }
.op h3 { font-family: var(--font-display); font-size: 18px; letter-spacing: .08em; }
.op p { color: var(--dim); font-size: 13.5px; }
.op code { color: var(--accent); font-size: 12.5px; }
.op { transition: transform .2s ease, background .5s ease; }
.op:hover { transform: translateY(-3px); }
.op:hover .panel-inner { background: var(--bg-raise); }

.transmissions {
    display: flex; align-items: center; gap: 14px; margin-top: 42px;
    color: var(--dim); font-size: 11px; letter-spacing: .22em;
}

/* ---- stack -------------------------------------------------------------- */

.stack { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.stack li {
    display: grid; grid-template-columns: 240px 1fr 130px; gap: 22px; align-items: center;
    padding: 13px 4px; border-bottom: 1px solid var(--line);
    font-size: 12.5px; letter-spacing: .1em;
}
.stack li:first-child { border-top: 1px solid var(--line); }
.s-bar { display: block; height: 8px; background: var(--accent-ghost); position: relative; overflow: hidden; }
.s-bar i {
    position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent);
    background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(0,0,0,.35) 6px 8px);
    transition: width 1.1s cubic-bezier(.2,.7,.2,1);
}
.s-tag { color: var(--dim); text-align: right; font-size: 11px; }

/* ---- contact ------------------------------------------------------------- */

.contact-panel .panel-inner { padding: 44px 36px; display: flex; flex-direction: column; gap: 28px; }
.prompt { font-size: clamp(16px, 3vw, 24px); letter-spacing: .02em; }
.prompt .mail { font-weight: 300; }
.contact-hint { color: var(--dim); font-size: 11px; letter-spacing: .2em; }

/* ---- footer ---------------------------------------------------------------- */

.footer {
    max-width: 1100px; margin: 60px auto 0; padding: 26px 24px 110px;
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: 10px 32px;
    color: var(--dim); font-size: 11px; letter-spacing: .14em;
}
.footer kbd { color: var(--accent); }
.foot-hint { margin-left: auto; }

/* ---- mobile bottom bar -------------------------------------------------------- */

.bottombar { display: none; }

/* ---- command palette ----------------------------------------------------------- */

.palette { position: fixed; inset: 0; z-index: 95; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.palette-box {
    position: absolute; top: 16vh; left: 50%; transform: translateX(-50%);
    width: min(560px, calc(100vw - 32px));
}
.palette-box .panel-inner { padding: 0; }
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-prompt { color: var(--accent); font-weight: 700; }
#paletteInput {
    flex: 1; background: transparent; border: 0; outline: 0;
    color: var(--text); font-family: var(--font-mono); letter-spacing: .03em;
    font-size: 16px; /* <16px makes iOS Safari auto-zoom on focus, which scrolls the page */
}
#paletteInput::placeholder { color: var(--dim); }
#paletteList { list-style: none; max-height: 320px; overflow-y: auto; }
#paletteList li {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 11px 18px; font-size: 13px; cursor: pointer; letter-spacing: .05em;
}
#paletteList li .d { color: var(--dim); font-size: 11.5px; letter-spacing: .1em; }
#paletteList li.sel { background: var(--accent-dim); }
#paletteList li.sel::before { content: "▸ "; color: var(--accent); }
.palette-foot {
    display: flex; gap: 22px; padding: 10px 18px; border-top: 1px solid var(--line);
    color: var(--dim); font-size: 10px; letter-spacing: .18em;
}

/* ---- tube control knobs (amber CRT) --------------------------------------------- */

.crt-knobs {
    position: fixed; right: 18px; bottom: 58px; z-index: 85;
    width: 256px;
    background: color-mix(in srgb, var(--bg) 86%, #000);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .55), inset 0 0 30px rgba(0, 0, 0, .35);
}
.crt-knobs .ck-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-bottom: 1px solid var(--line);
    color: var(--accent); font-size: 10px; letter-spacing: .22em;
}
.crt-knobs .ck-close { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 11px; }
.crt-knobs .ck-close:hover { color: var(--accent); }
.crt-knobs .ck-row { display: flex; justify-content: space-around; padding: 18px 10px 12px; }
.crt-knobs .ck-knob { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.crt-knobs .ck-dial {
    position: relative; width: 52px; height: 52px; border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--accent) 14%, #1a130a), #0b0805 72%);
    border: 1px solid var(--line);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 255, 255, .05),
        0 0 12px color-mix(in srgb, var(--accent) 10%, transparent);
    cursor: ns-resize; touch-action: none;
}
.crt-knobs .ck-dial::before {  /* tick ring */
    content: ""; position: absolute; inset: -8px; border-radius: 50%;
    background: repeating-conic-gradient(var(--dim) 0 1.4deg, transparent 1.4deg 30deg);
    -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
    mask: radial-gradient(circle, transparent 62%, #000 63%);
    opacity: .45; pointer-events: none;
}
.crt-knobs .ck-dial:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.crt-knobs .ck-ind {
    position: absolute; left: 50%; top: 5px; width: 2px; height: 13px; margin-left: -1px;
    background: var(--accent); border-radius: 1px;
    transform-origin: 1px 21px;  /* dial center */
    box-shadow: 0 0 7px var(--accent);
}
.crt-knobs .ck-knob label { color: var(--text); font-size: 9.5px; letter-spacing: .2em; }
.crt-knobs .ck-val { color: var(--dim); font-size: 10px; }
.crt-knobs .ck-foot {
    padding: 7px 12px; border-top: 1px solid var(--line);
    color: var(--dim); font-size: 9px; letter-spacing: .18em; text-align: center;
}

/* ---- reveal animations -------------------------------------------------------------- */

.reveal {
    opacity: 0; transform: translateY(16px);
    clip-path: inset(0 0 60% 0);
    transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1), clip-path .7s cubic-bezier(.2,.7,.2,1);
}
.reveal.in { opacity: 1; transform: none; clip-path: inset(0 0 -10% 0); }

/* ---- apps page ------------------------------------------------------------------------ */

.apps-list { list-style: none; border-top: 1px solid var(--line); }
.apps-list li { border-bottom: 1px solid var(--line); }
.apps-list a {
    display: grid; grid-template-columns: 64px 1fr 64px 1.4fr 24px; gap: 20px; align-items: baseline;
    padding: 18px 6px; color: var(--text); font-size: 13.5px; letter-spacing: .05em;
    transition: background .2s ease, color .2s ease;
}
.apps-list a:hover { background: var(--accent-ghost); text-decoration: none; color: var(--accent); }
.apps-list .a-type { color: var(--dim); font-size: 11px; letter-spacing: .2em; }
.apps-list .a-type.int { color: var(--accent); }
.apps-list .a-name { font-family: var(--font-display); font-weight: 700; }
.apps-list .a-year { color: var(--dim); font-size: 12px; }
.apps-list .a-desc { color: var(--dim); font-size: 13px; }
.apps-list .a-arrow { color: var(--accent); text-align: right; }
.apps-head { color: var(--dim); font-size: 13px; margin-bottom: 28px; }
.apps-head b { color: var(--accent); font-weight: 600; }

/* ---- responsive ----------------------------------------------------------------------- */

@media (max-width: 900px) {
    .topnav, .loc, .online { display: none; }
    .statusbar { gap: 12px; height: 48px; padding: 0 14px; }
    .sysmeta { gap: 10px; }
    html { scroll-padding-top: 60px; }

    .section { padding: 76px 0 20px; }
    .section.hero { padding-top: 96px; min-height: unset; }

    .hero-grid { grid-template-columns: 1fr; gap: 36px; }
    .hero-side { flex-direction: column; align-items: stretch; gap: 18px; }
    .avatar { width: 100%; max-width: 100%; }
    .readouts { width: 100%; }
    .readouts li { padding: 10px 14px; gap: 14px; }
    .readouts span { flex-shrink: 0; }

    .career li { grid-template-columns: 1fr; gap: 4px; padding: 20px 2px; }
    .career .c-role, .career .c-desc { grid-column: 1; }

    .ops-grid { grid-template-columns: 1fr; }

    .stack li { grid-template-columns: 1fr; gap: 8px; padding: 14px 2px; }
    .s-tag { text-align: left; }

    .contact-panel .panel-inner { padding: 28px 20px; }
    .footer { padding-bottom: 130px; }
    .foot-hint { margin-left: 0; }

    .apps-list a { grid-template-columns: 52px 1fr 24px; }
    .apps-list .a-year, .apps-list .a-desc { display: none; }

    #worldMap { opacity: calc(var(--map-fade, 1) * .45); }
    .neural-bg .nn-lab { display: none; }
    .neural-bg .nn-out { display: block; font-size: 9px; }
    .neural-hud {
        right: 10px; bottom: calc(64px + env(safe-area-inset-bottom));
        min-width: 0; padding: 7px 10px; gap: 3px; font-size: 9px;
    }
    .neural-hud .nh-meta { display: none; }

    .bottombar {
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
        display: flex; height: 56px;
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .bottombar a, .bottombar button {
        flex: 1; display: flex; align-items: center; justify-content: center;
        color: var(--dim); font-size: 13px; letter-spacing: .1em;
        border: 0; border-left: 1px solid var(--line); background: transparent;
    }
    .bottombar a:first-child { border-left: 0; }
    .bottombar a.active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); text-decoration: none; }
    .bottombar button { color: var(--accent); }
}

@media (max-width: 480px) {
    .signal-eq { font-size: 10px; }
    #sndBtn, #chatBtn { display: none; } /* both stay reachable via ⌘K */
    .chatwin {
        right: 8px; left: 8px; width: auto;
        bottom: calc(64px + env(safe-area-inset-bottom));
        height: min(420px, 58vh);
    }
}

/* ---- reduced motion --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; clip-path: none; }
    .signal .trace { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
    .signal .nodes circle { opacity: 1; }
    .fx-aurora, .fx-noise { display: none; }
}
