/* ============================================================================
   SYSTEM.CSS — Blueprint design system
   Tartendu Kumar / portfolio
   Sheet 1 of 2: tokens, base, layout primitives, header, footer, home page.
   ------------------------------------------------------------------------
   The whole site is drawn as a technical document: a gridded sheet, figures
   with reference numbers, dimension lines, corner registration marks, and a
   title block at the foot. Green is reserved for *signal* — live things,
   active states, data. Never for decoration.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

/* ===== 1. TOKENS ========================================================= */

:root {
    /* Ground */
    --ink:        #05070a;
    --ink-2:      #090c10;
    --ink-3:      #0e1318;
    --ink-4:      #141a20;

    /* Drawing lines */
    --grid:       rgba(126, 168, 146, 0.055);
    --grid-major: rgba(126, 168, 146, 0.10);
    --rule:       rgba(233, 240, 236, 0.13);
    --rule-soft:  rgba(233, 240, 236, 0.07);

    /* Type */
    --fg:         #e9efec;
    --fg-2:       #939c96;
    --fg-3:       #626b65;

    /* Signal */
    --signal:      #54e346;
    --signal-hi:   #7cf370;
    --signal-dim:  rgba(84, 227, 70, 0.13);
    --signal-line: rgba(84, 227, 70, 0.35);

    /* Secondary channels */
    --wire:       #3f9a86;
    --warn:       #e6b84c;

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;
    --font-body:    'Inter', system-ui, sans-serif;

    --gutter: clamp(1.25rem, 4vw, 3.5rem);
    --sheet:  1280px;

    --ease: cubic-bezier(0.22, 0.75, 0.25, 1);
    --t:    0.35s var(--ease);
}

body.light-mode {
    --ink:        #f2f3f0;
    --ink-2:      #ffffff;
    --ink-3:      #fafbf9;
    --ink-4:      #eceee9;

    --grid:       rgba(18, 46, 34, 0.055);
    --grid-major: rgba(18, 46, 34, 0.10);
    --rule:       rgba(8, 20, 14, 0.16);
    --rule-soft:  rgba(8, 20, 14, 0.08);

    --fg:         #0b1210;
    --fg-2:       #5a635d;
    --fg-3:       #838c86;

    --signal:      #17922c;
    --signal-hi:   #0f7a23;
    --signal-dim:  rgba(23, 146, 44, 0.11);
    --signal-line: rgba(23, 146, 44, 0.34);

    --wire:       #2c7a68;
    --warn:       #a97a09;
}

/* ===== 2. RESET / BASE =================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background-color: var(--ink);
    color: var(--fg);
    line-height: 1.65;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--t), color var(--t);
}

main { flex: 1; position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--signal); color: var(--ink); }

/* The category filter and the form spinner toggle `hidden`, and several of
   those elements carry a display rule that would otherwise out-specify the
   UA's [hidden] { display: none }. */
[hidden] { display: none !important; }

/* --- Focus. Keyboard users get a visible marker everywhere; the ring is
       drawn outside the box so it never shifts layout. --- */
:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -120%);
    z-index: 1000;
    background: var(--signal);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.7rem 1.2rem;
    transition: transform 0.25s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* Sheet grid — the paper everything is drawn on. Fixed so it reads as a
   surface the content slides over, not a texture bolted to each section. */
.sheet-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right,  var(--grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid) 1px, transparent 1px),
        linear-gradient(to right,  var(--grid-major) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-major) 1px, transparent 1px);
    background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px;
    mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 20%, transparent 88%);
    -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 20%, transparent 88%);
}

/* ===== 3. LAYOUT PRIMITIVES ============================================== */

.sheet {
    width: 100%;
    max-width: var(--sheet);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

section { position: relative; }

.band { padding-block: clamp(4.5rem, 10vw, 8rem); }
.band + .band { border-top: 1px solid var(--rule-soft); }

/* --- Figure header: the drawing callout used above every section --- */
.fig-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}

.fig-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--signal);
    padding: 0.22rem 0.5rem;
    border: 1px solid var(--signal-line);
    background: var(--signal-dim);
    white-space: nowrap;
}

.fig-name {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-2);
    white-space: nowrap;
}

.fig-rule {
    flex: 1;
    height: 1px;
    background: repeating-linear-gradient(to right, var(--rule) 0 4px, transparent 4px 8px);
}

/* --- Sheet titles --- */
.sheet-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5.2vw, 3.6rem);
    line-height: 1.04;
    letter-spacing: -0.032em;
}

.sheet-lede {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    color: var(--fg-2);
    max-width: 62ch;
    margin-top: 1.15rem;
}

.signal-text { color: var(--signal); }

/* Hand-annotated underline, drawn slightly off-axis like a marker stroke */
.annotated {
    position: relative;
    display: inline-block;
    /* Confine the z-index:-1 stroke to this element, otherwise it escapes to
       the nearest stacking context and paints behind unrelated content. */
    isolation: isolate;
}
.annotated::after {
    content: "";
    position: absolute;
    left: -2%;
    right: -2%;
    bottom: -0.12em;
    height: 0.5em;
    background: var(--signal-dim);
    border-bottom: 2px solid var(--signal);
    transform: rotate(-0.6deg);
    z-index: -1;
}

/* --- Panel: hard-cornered card with registration ticks --- */
.panel {
    position: relative;
    background: var(--ink-2);
    border: 1px solid var(--rule);
    transition: border-color var(--t), background-color var(--t), transform var(--t);
}

.panel::before {
    content: "";
    position: absolute;
    inset: -1px;
    pointer-events: none;
    background:
        linear-gradient(var(--signal), var(--signal)) left  top    / 1px 11px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  top    / 11px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right top    / 1px 11px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right top    / 11px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  bottom / 1px 11px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  bottom / 11px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right bottom / 1px 11px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right bottom / 11px 1px no-repeat;
    opacity: 0;
    transition: opacity var(--t);
}

.panel:hover::before,
.panel.is-lit::before { opacity: 0.75; }

/* --- Mono metadata --- */
.mono {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--fg-3);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    padding: 0.5rem 0;
    border-top: 1px solid var(--rule-soft);
}
.spec-row dt { color: var(--fg-3); text-transform: uppercase; }
.spec-row dd { color: var(--fg-2); text-align: right; }

/* --- Tag / chip --- */
.chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-2);
    border: 1px solid var(--rule);
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
}
.chip-signal {
    color: var(--signal);
    border-color: var(--signal-line);
    background: var(--signal-dim);
}

/* --- Live status dot --- */
.led {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--signal);
    border-radius: 50%;
    box-shadow: 0 0 0 0 var(--signal-line);
    animation: pulse 2.4s var(--ease) infinite;
    flex: none;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 var(--signal-line); }
    70%  { box-shadow: 0 0 0 7px rgba(84, 227, 70, 0); }
    100% { box-shadow: 0 0 0 0 rgba(84, 227, 70, 0); }
}

/* ===== 4. BUTTONS ======================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    padding: 0.8rem 1.35rem;
    border: 1px solid var(--signal);
    background: transparent;
    color: var(--signal);
    position: relative;
    /* Own stacking context so the ::before fill sits above the button's own
       background but below its label, instead of escaping to an ancestor. */
    isolation: isolate;
    transition: color var(--t), background-color var(--t), border-color var(--t);
    white-space: nowrap;
}

/* The fill sweeps in from the left like a progress bar reaching 100%. */
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--signal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease);
    z-index: -1;
}
.btn:hover::before { transform: scaleX(1); }
.btn:hover { color: var(--ink); }
.btn > * { position: relative; }

.btn-solid {
    background: var(--signal);
    color: var(--ink);
}
.btn-solid::before { background: var(--signal-hi); }
.btn-solid:hover { color: var(--ink); }

.btn-quiet {
    border-color: var(--rule);
    color: var(--fg-2);
}
.btn-quiet::before { background: var(--fg); }
.btn-quiet:hover { color: var(--ink); border-color: var(--fg); }

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

/* Inline "go to" link with a travelling arrow */
.link-out {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--signal);
    border-bottom: 1px solid transparent;
    transition: border-color var(--t);
}
.link-out:hover { border-color: var(--signal); }
.link-out .arw { transition: transform var(--t); }
.link-out:hover .arw { transform: translate(3px, -3px); }

/* ===== 5. HEADER ========================================================= */

.masthead {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--ink); /* fallback where color-mix is unsupported */
    background: color-mix(in srgb, var(--ink) 82%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--rule-soft);
}

.masthead-inner {
    max-width: var(--sheet);
    margin-inline: auto;
    padding: 0.7rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.mark {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex: none;
}
.mark img { height: 30px; width: auto; }

.mark-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    border-left: 1px solid var(--rule);
    padding-left: 0.7rem;
}
.mark-meta b {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.mark-meta span {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fg-3);
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: auto;
}

.nav a {
    position: relative;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-2);
    padding: 0.5rem 0.7rem;
    transition: color var(--t);
}

/* Nav items are numbered like sheet references */
.nav a::before {
    content: attr(data-ref);
    font-size: 0.55rem;
    color: var(--fg-3);
    margin-right: 0.35rem;
    transition: color var(--t);
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.28rem;
    height: 1px;
    background: var(--signal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--t);
}
.nav a:hover, .nav a.is-current { color: var(--fg); }
.nav a:hover::before, .nav a.is-current::before { color: var(--signal); }
.nav a:hover::after, .nav a.is-current::after { transform: scaleX(1); }

.masthead-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: none;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--rule);
    color: var(--fg-2);
    transition: color var(--t), border-color var(--t);
}
.icon-btn:hover { color: var(--signal); border-color: var(--signal-line); }

body:not(.light-mode) .icon-sun { display: none; }
body.light-mode .icon-moon { display: none; }

.burger {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--rule);
    position: relative;
}
.burger span {
    position: absolute;
    left: 9px;
    width: 16px;
    height: 1px;
    background: var(--fg);
    transition: transform var(--t), opacity var(--t);
}
.burger span:nth-child(1) { top: 12px; }
.burger span:nth-child(2) { top: 16.5px; }
.burger span:nth-child(3) { top: 21px; }
.burger.open span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

/* Mobile drawer */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 890;
    background: var(--ink);
    padding: 6rem var(--gutter) 2rem;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.45s var(--ease);
    overflow-y: auto;
}
.drawer.open { transform: translateY(0); }

.drawer a {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--rule-soft);
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.drawer a span {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--signal);
    letter-spacing: 0.1em;
}

/* ===== 6. HERO =========================================================== */

.hero {
    padding-top: clamp(3rem, 7vw, 5.5rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
    overflow: hidden;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg-2);
    border: 1px solid var(--rule);
    padding: 0.35rem 0.7rem;
    margin-bottom: 1.6rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 6.4vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

/* The role sits under the name as a spec line, not a tagline */
.hero-role {
    font-family: var(--font-mono);
    font-size: clamp(0.72rem, 1.5vw, 0.86rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--signal);
    margin-top: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}
.hero-role::after {
    content: "";
    flex: 1;
    min-width: 2rem;
    height: 1px;
    background: repeating-linear-gradient(to right, var(--signal-line) 0 3px, transparent 3px 7px);
}

.hero-body {
    color: var(--fg-2);
    font-size: clamp(0.98rem, 1.4vw, 1.08rem);
    max-width: 46ch;
    margin-top: 1.4rem;
}

.hero-actions { margin-top: 2rem; }

/* --- Dimension strip: stats drawn as measured spans --- */
.dims {
    margin-top: clamp(3rem, 6vw, 4.5rem);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--rule);
    border-bottom: none;
}

.dim {
    padding: 1.1rem 1.2rem 1.3rem;
    border-bottom: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
    position: relative;
}
.dim:last-child { border-right: none; }

.dim-val {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.4vw, 2.3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    display: block;
}

.dim-key {
    font-family: var(--font-mono);
    font-size: 0.63rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--fg-3);
    margin-top: 0.55rem;
    display: block;
}

/* Extension + arrow marks, exactly like a dimension line on a drawing */
.dim::after {
    content: "";
    position: absolute;
    left: 1.2rem;
    right: 1.2rem;
    top: 0.75rem;
    height: 5px;
    border-left: 1px solid var(--signal-line);
    border-right: 1px solid var(--signal-line);
    border-bottom: 1px solid var(--signal-line);
    opacity: 0.6;
}

/* ===== 7. SYSTEM DIAGRAM ================================================= */
/* The hero's right half: an actual signal-flow schematic of the stack the
   site is about. Packets animate along the wires so it reads as running. */

.schematic {
    position: relative;
    border: 1px solid var(--rule);
    background:
        linear-gradient(var(--ink-2), var(--ink-2)) padding-box;
    padding: 0.85rem 0.9rem;
}

.schematic-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg-3);
    padding-bottom: 0.6rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid var(--rule-soft);
}
.schematic-bar .on {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--signal);
}

/* Height-driven rather than width-driven: at full width the 400x320 viewBox
   renders ~480px tall and overshoots the copy beside it. Capping the height
   and letting the width derive keeps the diagram proportional. */
.schematic svg {
    display: block;
    height: clamp(270px, 26vw, 340px);
    width: auto;
    max-width: 100%;
    margin-inline: auto;
}

.node-box {
    fill: var(--ink-3);
    stroke: var(--rule);
    stroke-width: 1;
}
.node-box-hot {
    fill: var(--signal-dim);
    stroke: var(--signal-line);
}
.node-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.09em;
    fill: var(--fg);
    text-transform: uppercase;
}
.node-sub {
    font-family: var(--font-mono);
    font-size: 6.5px;
    letter-spacing: 0.07em;
    fill: var(--fg-3);
}
.wire {
    fill: none;
    stroke: var(--rule);
    stroke-width: 1;
}
.wire-live {
    stroke: var(--signal-line);
    stroke-dasharray: 3 3;
    animation: flow 1.4s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -12; } }

.packet { fill: var(--signal); }

.tick-text {
    font-family: var(--font-mono);
    font-size: 6px;
    letter-spacing: 0.1em;
    fill: var(--fg-3);
}

/* --- Interactive nodes --- */

.node { cursor: pointer; outline: none; }
.node .node-box,
.node .node-label,
.node .node-sub { transition: fill 0.18s var(--ease), stroke 0.18s var(--ease); }

/* Everything else recedes while a stage is being inspected, so the active
   path is the only thing at full strength. */
.schematic.is-probing .node:not(.is-active) { opacity: 0.4; }
.node { transition: opacity 0.18s var(--ease); }

.node.is-active .node-box,
.node:focus-visible .node-box {
    fill: var(--signal-dim);
    stroke: var(--signal);
}
.node.is-active .node-label { fill: var(--signal); }
.node.is-active .node-sub { fill: var(--fg-2); }
.node:focus-visible .node-box { stroke-width: 2; }

.wire { transition: stroke 0.18s var(--ease), opacity 0.18s var(--ease); }
.schematic.is-probing .wire { opacity: 0.28; }
.schematic.is-probing .wire.is-hot { opacity: 1; stroke: var(--signal); }

/* --- Detail panel --- */

.sd {
    margin-top: 0.35rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--rule-soft);
    min-height: 88px; /* holds the tallest stage so the hero never reflows */
}

.sd-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.sd-id {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--signal);
    border: 1px solid var(--signal-line);
    background: var(--signal-dim);
    padding: 0.14rem 0.4rem;
}
.sd-name {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-2);
}

.sd-specs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.85rem;
}
.sd-specs li {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    color: var(--fg-3);
    padding-left: 0.7rem;
    position: relative;
}
.sd-specs li::before {
    content: "\203A";
    position: absolute;
    left: 0;
    color: var(--signal);
}

.sd-hint {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-3);
    opacity: 0.65;
    margin-top: 0.5rem;
}
.schematic.is-probing .sd-hint { visibility: hidden; }

/* Content swap: a quick wipe, not a fade-through-blank */
.sd-swap { animation: sdIn 0.22s var(--ease); }
@keyframes sdIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* ===== 7b. SCROLL-DRAWN FIGURES ========================================= */
/* Wires are inked in by JS (it measures each path); nodes and packets fade
   up behind them, then the flow animation takes over. */

.js .schematic .node { opacity: 0; }
.schematic.is-drawn .node {
    opacity: 1;
    transition: opacity 0.4s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms + 220ms);
}
.schematic.is-probing .node:not(.is-active) { opacity: 0.4; }

.js .packet { opacity: 0; }
.schematic.is-flowing .packet { opacity: 1; transition: opacity 0.4s var(--ease); }

/* Section rules draw left to right as the header comes into view */
.js .fig-rule {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.65s var(--ease) 0.08s;
}
.fig-head.in .fig-rule { transform: scaleX(1); }

/* Dimension extension lines measure out, one after the next */
.js .dim::after {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease);
}
.dims.in .dim::after { transform: scaleX(1); }
.dims.in .dim:nth-child(1)::after { transition-delay: 0.05s; }
.dims.in .dim:nth-child(2)::after { transition-delay: 0.15s; }
.dims.in .dim:nth-child(3)::after { transition-delay: 0.25s; }
.dims.in .dim:nth-child(4)::after { transition-delay: 0.35s; }

/* ===== 7c. CAD WORKSTATION CHROME ======================================= */

.gauge {
    position: fixed;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 700;
    display: none; /* enabled by JS on fine pointers only */
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    pointer-events: none;
}
.gauge.on { display: flex; }

.gauge-track {
    position: relative;
    width: 9px;
    height: 190px;
    /* tick marks every 10px, a longer one every 50px */
    background:
        repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px 10px) left / 5px 100% no-repeat,
        repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px 50px) left / 9px 100% no-repeat;
}

.gauge-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 9px;
    height: 2px;
    background: var(--signal);
    box-shadow: 0 0 8px var(--signal-line);
    will-change: transform;
}

.gauge-fig {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fg-3);
    writing-mode: vertical-rl;
    max-height: 210px;
    overflow: hidden;
    white-space: nowrap;
}
.gauge-fig b { color: var(--signal); font-weight: 500; }

/* --- Cursor crosshair --- */

.crosshair {
    position: fixed;
    inset: 0;
    z-index: 690;
    pointer-events: none;
    display: none;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}
.crosshair.on { display: block; }
.crosshair.live { opacity: 1; }

.ch-x, .ch-y {
    position: absolute;
    background: var(--signal);
    opacity: 0.14;
}
.ch-x { left: 0; width: 100%; height: 1px; will-change: transform; }
.ch-y { top: 0; height: 100%; width: 1px; will-change: transform; }

.ch-read {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    color: var(--signal);
    opacity: 0.55;
    padding-left: 6px;
    padding-top: 3px;
    white-space: nowrap;
    will-change: transform;
}

/* ===== 7d. AXONOMETRIC CARD LIFT ======================================== */
/* A small perspective tilt that tracks the pointer, capped low so the cards
   read as paper shifting on a drafting table rather than as glossy 3D. */

.tilt {
    position: relative; /* .live-card and .press-card aren't positioned otherwise */
    transform-style: preserve-3d;
    transition: transform 0.35s var(--ease), border-color var(--t);
}
.tilt.is-tilting { transition: transform 0.12s linear, border-color var(--t); }

/* Registration marks strike in at the corners as a card lifts */
.tilt::after {
    content: "";
    position: absolute;
    inset: -1px;
    pointer-events: none;
    background:
        linear-gradient(var(--signal), var(--signal)) left  top    / 1px 10px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  top    / 10px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right top    / 1px 10px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right top    / 10px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  bottom / 1px 10px no-repeat,
        linear-gradient(var(--signal), var(--signal)) left  bottom / 10px 1px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right bottom / 1px 10px no-repeat,
        linear-gradient(var(--signal), var(--signal)) right bottom / 10px 1px no-repeat;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
    z-index: 2;
}
.tilt:hover::after { opacity: 0.8; }

/* ===== 8. ABOUT ========================================================== */

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}

.portrait {
    position: relative;
    border: 1px solid var(--rule);
    padding: 0.6rem;
}
/* <picture> is inline by default, which leaves the img's percentage width with
   no solid containing block to resolve against. */
.portrait picture { display: block; }

/* Height is set explicitly, not derived from an aspect ratio, so the portrait
   stays level with the (short) copy beside it instead of running past it.
   object-position sits high because the face is in the upper third. */
.portrait img {
    display: block;
    width: 100%;
    height: 380px;
    object-fit: cover;
    object-position: center 18%;
    filter: grayscale(1) contrast(1.08);
    transition: filter 0.5s var(--ease);
}
.portrait:hover img { filter: grayscale(0) contrast(1); }

/* Callout leader line pointing at the portrait, mimicking a part label */
.portrait-tag {
    position: absolute;
    right: -1px;
    bottom: 1.4rem;
    background: var(--ink);
    border: 1px solid var(--signal-line);
    color: var(--signal);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
}

.about-copy p {
    color: var(--fg-2);
    margin-top: 1.15rem;
    max-width: 60ch;
}
.about-copy strong { color: var(--fg); font-weight: 600; }

.about-specs {
    margin-top: 2rem;
    border-bottom: 1px solid var(--rule-soft);
}

/* ===== 9. FOOTER / TITLE BLOCK =========================================== */
/* Drawn as the title block of an engineering sheet — the strongest single
   signal that this whole page is a technical document. */

.title-block {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--rule);
    background: var(--ink);
    margin-top: 4rem;
}

.tb-grid {
    max-width: var(--sheet);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
}

.tb-cell {
    padding: 1.5rem 1.4rem;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.tb-cell:first-child { padding-left: 0; }
.tb-cell:last-child { border-right: none; }

.tb-key {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-3);
    display: block;
    margin-bottom: 0.6rem;
}

.tb-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.tb-sub {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--fg-2);
    letter-spacing: 0.06em;
    margin-top: 0.2rem;
}

.tb-list { display: flex; flex-direction: column; gap: 0.45rem; }
.tb-list a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--fg-2);
    transition: color var(--t), padding-left var(--t);
}
.tb-list a:hover { color: var(--signal); padding-left: 0.3rem; }

.tb-foot {
    max-width: var(--sheet);
    margin-inline: auto;
    padding: 1rem var(--gutter);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-3);
}

/* ===== 11. BACK TO TOP =================================================== */

.to-top {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    z-index: 800;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--rule);
    background: var(--ink-2);
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity var(--t), transform var(--t), color var(--t), border-color var(--t);
}
.to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { color: var(--signal); border-color: var(--signal-line); }

/* ===== 12. REVEAL ======================================================== */

.js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }

/* ===== 13. RESPONSIVE ==================================================== */

@media (max-width: 1000px) {
    .hero-inner { grid-template-columns: 1fr; }
    .about-grid { grid-template-columns: 1fr; }
    .portrait { max-width: 340px; }
    .portrait img { height: 320px; }
    .tb-grid { grid-template-columns: 1fr 1fr; }
    .tb-cell:first-child { grid-column: 1 / -1; padding-left: 0; }
}

@media (max-width: 860px) {
    .nav { display: none; }
    .burger { display: block; }
    .dims { grid-template-columns: repeat(2, 1fr); }
    .dim:nth-child(2) { border-right: none; }
}

@media (max-width: 560px) {
    .mark-meta { display: none; }
    .tb-grid { grid-template-columns: 1fr; }
    .tb-cell { padding-left: 0; border-right: none; }
    .drawer a { font-size: 1.35rem; }
}

/* ===== 14. MOTION PREFERENCE ============================================= */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    /* These must out-specify the .js-gated hiding rules above, so they carry
       the same .js prefix. Without it they are dead declarations. */
    .js [data-reveal] { opacity: 1; transform: none; }
    .js .schematic .node,
    .js .packet { opacity: 1; }
    .js .fig-rule,
    .js .dim::after { transform: scaleX(1); }

    /* Decorative chrome is not built at all under reduced motion, but belt
       and braces in case the media query flips after load. */
    .gauge, .crosshair { display: none !important; }
}
