:root {
    --ink: #0A0E14;
    --ink-2: #0C121A;
    --surface: #111A24;
    --surface-2: #16202C;
    --line: rgba(180, 200, 225, 0.09);
    --line-strong: rgba(180, 200, 225, 0.18);
    --grid: rgba(150, 180, 220, 0.045);
    --fg: #E6ECF3;
    --fg-dim: #A5B1C0;
    --muted: #5F6E7E;
    --signal: #F5A524;
    --signal-bright: #FFC15E;
    --signal-soft: rgba(245, 165, 36, 0.12);
    --signal-line: rgba(245, 165, 36, 0.30);
    --maxw: 70%;
    --display: 'Space Grotesk', system-ui, sans-serif;
    --body: 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* tablets and phones: use the full width instead of 70% */
@media (max-width: 900px) {
    :root { --maxw: 100%; }
}
@media (max-width: 520px) {
    .wrap, .nav-inner { padding-left: 16px; padding-right: 16px; }
}

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

html {
    scroll-behavior: smooth
}

@media (prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto
    }
}

body {
    background: var(--ink);
    color: var(--fg);
    font-family: var(--body);
    font-weight: 300;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}

/* schematic grid backdrop */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 30%, transparent 90%);
    mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 30%, transparent 90%);
    pointer-events: none;
    z-index: 0;
}

::selection {
    background: var(--signal);
    color: #0A0E14
}

a {
    color: inherit;
    text-decoration: none
}

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 3px;
    border-radius: 2px
}

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 28px;
    position: relative;
    z-index: 1
}

.mono {
    font-family: var(--mono);
    font-weight: 400
}

.sig {
    color: var(--signal)
}

/* ---------- NAV ---------- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: linear-gradient(to bottom, rgba(10, 14, 20, 0.85), rgba(10, 14, 20, 0.55));
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    white-space: nowrap;
    flex-shrink: 0;
}

.brand .tag {
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    padding: 2px 6px;
    font-weight: 600;
    color: var(--signal);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
    font-family: var(--mono);
    font-size: 12.5px
}

.nav-links a {
    color: var(--fg-dim);
    padding: 6px 11px;
    border-radius: 4px;
    transition: color .18s ease, background .18s ease;
}

.nav-links a:hover {
    color: var(--signal);
    background: var(--signal-soft)
}

.nav-links .ext {
    color: var(--muted)
}

.nav-links .ext:hover {
    color: var(--fg)
}

.nav-sep {
    width: 1px;
    height: 16px;
    background: var(--line-strong);
    margin: 0 4px
}

@media(max-width:720px) {
    .nav-links a:not(.ext) {
        display: none
    }
}

/* ---------- HERO ---------- */
header {
    padding: 150px 0 90px;
    position: relative
}

.eyebrow {
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-dim);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 0 var(--signal-line);
    animation: pulse 2.4s ease-out infinite;
    flex: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 165, 36, 0.5)
    }

    70% {
        box-shadow: 0 0 0 9px rgba(245, 165, 36, 0)
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245, 165, 36, 0)
    }
}

h1 {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.75rem, 4.4vw, 3.6rem);
    line-height: 1.06;
    letter-spacing: -0.02em;
    max-width: none;
    margin-bottom: 28px;
}

h1 em {
    font-style: normal;
    color: var(--signal)
}

/* desktop headline lockup: two lines, the first scaled up to match the second's width (sized in script.js) */
@media (min-width: 900px) {
    #top h1 .h1-a,
    #top h1 .h1-b {
        display: block;
        white-space: nowrap;
        width: max-content;
    }
    #top h1 .h1-a {
        line-height: 1;
        letter-spacing: -0.03em;
        margin-bottom: 0.12em;
    }
}

.lede {
    font-size: clamp(1.02rem, 1.6vw, 1.22rem);
    color: var(--fg-dim);
    font-weight: 300;
    margin-bottom: 26px;
}

.stackline {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.02em;
    margin-bottom: 26px;
}

.stackline b {
    color: var(--fg-dim);
    font-weight: 500
}

.hero-cta {
    display: flex;
    gap: 13px;
    flex-wrap: wrap;
    margin-bottom: 52px
}

/* pipeline signature */
.pipe {
    position: relative;
    margin: 0 0 54px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--ink-2), rgba(17, 26, 36, 0.4));
    padding: 22px 24px 20px;
    overflow: hidden;
    transition: border-color .3s ease, box-shadow .3s ease;
}

.pipe:hover {
    border-color: var(--line-strong);
    box-shadow: 0 0 20px rgba(245, 165, 36, 0.06)
}

.pipe-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
}

.pipe-track {
    position: relative;
    height: 48px
}

.pipe-track svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible
}

.pipe-nodes {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.node {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.03em;
    background: var(--ink);
    border: 1px solid var(--line-strong);
    color: var(--fg-dim);
    padding: 7px 12px;
    border-radius: 6px;
    position: relative;
    z-index: 2;
    white-space: nowrap;
    transition: border-color .3s ease, color .3s ease;
}

.node.lit {
    border-color: var(--signal-line);
    color: var(--fg)
}

.track-line {
    stroke: var(--line-strong);
    stroke-width: 1.5;
    fill: none;
}

.track-flow {
    stroke: var(--signal);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 14 220;
    filter: drop-shadow(0 0 5px var(--signal));
    animation: flow 3.4s linear infinite;
}

@keyframes flow {
    from {
        stroke-dashoffset: 234
    }

    to {
        stroke-dashoffset: 0
    }
}

@media(prefers-reduced-motion:reduce) {
    .track-flow {
        animation: none;
        stroke-dasharray: none;
        opacity: .35
    }

    .pulse {
        animation: none
    }
}

@media(max-width:640px) {
    .pipe-nodes {
        display: none
    }

    .pipe-track {
        height: 20px
    }
}

/* telemetry stats */
.telemetry {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.stat {
    padding: 22px 22px;
    border-right: 1px solid var(--line);
    position: relative;
    transition: background .25s ease;
}

.stat:last-child {
    border-right: none
}

.stat:hover {
    background: var(--surface)
}

.stat .num {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    line-height: 1;
    color: var(--fg);
    letter-spacing: -0.01em;
}

.stat .num i {
    font-style: normal;
    color: var(--signal);
    font-size: 0.6em;
    vertical-align: top;
    margin-left: 1px
}

.stat .cap {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 9px;
}

@media(max-width:640px) {
    .telemetry {
        grid-template-columns: repeat(2, 1fr)
    }

    .stat:nth-child(2) {
        border-right: none
    }

    .stat:nth-child(1),
    .stat:nth-child(2) {
        border-bottom: 1px solid var(--line)
    }
}

/* ---------- SYSTEMS / CASE STUDIES ---------- */
.case {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--ink-2);
    transition: border-color .25s ease;
}

.case:hover {
    border-color: var(--line-strong)
}

.case-inner {
    display: grid;
    grid-template-columns: 0.92fr 1.55fr
}

.case-side {
    padding: 30px 28px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), rgba(17, 26, 36, 0.2));
}

.case-signal {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 1.12rem;
    color: var(--signal-bright);
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 22px;
    line-height: 1.2;
}

.case-signal .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal);
    flex: none
}

.case-co {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--fg)
}

.case-role {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    margin: 5px 0 20px
}

.case-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 7px
}

.chip {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--fg-dim);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 4px 10px;
    transition: border-color .2s ease, color .2s ease;
}

.chip:hover {
    border-color: var(--signal-line);
    color: var(--fg)
}

.case-body {
    padding: 30px
}

.case-body h3 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--fg);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.case-block {
    margin-bottom: 18px
}

.case-block:last-child {
    margin-bottom: 0
}

.case-block .lab {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--signal);
    display: block;
    margin-bottom: 8px;
}

.case-block p {
    font-size: 0.95rem;
    color: var(--fg-dim);
    line-height: 1.55
}

.case-block ul {
    list-style: none;
    display: grid;
    gap: 8px
}

.case-block li {
    position: relative;
    padding-left: 19px;
    font-size: 0.93rem;
    color: var(--fg-dim);
    line-height: 1.5
}

.case-block li::before {
    content: "\203A";
    position: absolute;
    left: 2px;
    color: var(--signal);
    font-family: var(--mono);
    font-weight: 600
}

@media(max-width:760px) {
    .case-inner {
        grid-template-columns: 1fr
    }

    .case-side {
        border-right: none;
        border-bottom: 1px solid var(--line)
    }
}

/* ---------- CASE: team line + diagram ---------- */
.case-team {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--fg-dim);
    margin: -8px 0 20px;
    line-height: 1.5
}

.case-team .lab {
    color: var(--signal);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 10.5px;
    margin-right: 8px
}

.case-block li b {
    color: var(--fg);
    font-weight: 500
}

.case-diagram {
    border-top: 1px solid var(--line);
    padding: 22px 20px 24px;
    background: linear-gradient(180deg, var(--surface), var(--ink-2));
}

.case-diagram figcaption {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px
}

.dg {
    display: block;
    width: 100%;
    height: auto
}

.dg-tall {
    display: none;
    max-width: 380px;
    margin: 0 auto
}

/* the wide diagram needs room to stay legible; narrower screens get the vertical one */
@media (max-width: 1239px) {
    .dg-wide { display: none }
    .dg-tall { display: block }
}

@media (max-width: 640px) {
    .case-diagram { padding: 18px 16px 20px }
}

.dg text {
    font-family: var(--mono);
    font-size: 12.5px;
    fill: var(--fg);
    text-anchor: middle
}

.dg .dg-sub {
    font-size: 10.5px;
    fill: var(--muted)
}

.dg .dg-s {
    font-size: 11px;
    fill: var(--muted);
    text-anchor: start;
    letter-spacing: 0.04em
}

.dg .dg-mid {
    text-anchor: middle
}

.dg-wide text {
    font-size: 16px
}

.dg-wide .dg-sub {
    font-size: 12.5px
}

.dg-wide .dg-s {
    font-size: 13px
}

.dg-node rect {
    fill: var(--ink-2);
    stroke: var(--line-strong);
    stroke-width: 1.2
}

.dg-hot rect {
    fill: var(--signal-soft);
    stroke: var(--signal)
}

.dg-loop {
    fill: none;
    stroke: var(--signal-line);
    stroke-width: 1.2;
    stroke-dasharray: 5 5
}

.dg-lines path {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.2
}

.dg-head {
    fill: var(--muted)
}

/* ---------- SYSTEMS: summary cards on the homepage ---------- */
.sys-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px
}

@media (max-width: 760px) {
    .sys-grid { grid-template-columns: 1fr }
}

.sys-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 24px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--ink-2);
    color: inherit;
    text-decoration: none;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.sys-card:hover,
.sys-card:focus-visible {
    border-color: var(--signal-line);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(245, 165, 36, 0.06)
}

.sc-signal {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--signal-bright);
    display: flex;
    align-items: center;
    gap: 8px
}

.sc-signal .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal)
}

.sys-card h3 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.2rem;
    line-height: 1.2;
    color: var(--fg);
    letter-spacing: -0.01em
}

.sys-card p {
    font-size: 0.93rem;
    color: var(--fg-dim);
    line-height: 1.5;
    flex: 1
}

.sc-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.sc-metric {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--signal-bright);
    background: var(--signal-soft);
    border-radius: 6px;
    padding: 3px 8px
}

.sc-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 2px
}

.sc-go {
    color: var(--signal)
}

/* ---------- CASE STUDY PAGES (/systems/<slug>/) ---------- */
.cs-main {
    padding: 110px 0 60px;
    position: relative;
    z-index: 1
}

.cs-wrap {
    max-width: min(860px, 100%)
}

.cs-back {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--signal);
    text-decoration: none
}

.cs-back:hover { text-decoration: underline }

.cs-head {
    margin: 26px 0 34px;
    padding: 0 0 28px;
    border-bottom: 1px solid var(--line)
}

.cs-head .case-signal {
    margin-bottom: 14px
}

.cs-head h1 {
    font-size: clamp(1.9rem, 4.2vw, 2.8rem);
    max-width: none;
    margin-bottom: 22px
}

.cs-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin-bottom: 18px
}

.cs-fact {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--fg-dim)
}

.cs-fact .lab {
    color: var(--signal);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 10.5px;
    margin-right: 8px
}

.cs-body .case-block {
    margin-bottom: 30px
}

.cs-body .case-block .lab {
    font-size: 12px;
    margin-bottom: 12px
}

.cs-body .case-block p,
.cs-body .case-block li {
    font-size: 1rem;
    line-height: 1.65
}

.cs-body .case-block ul {
    gap: 12px
}

.cs-body .case-diagram {
    border: 1px solid var(--line);
    border-radius: 14px;
    margin: 6px 0 30px
}

/* on case pages the column is narrower, so the wide diagram works from 900px */
@media (min-width: 900px) {
    .cs-page .dg-wide { display: block }
    .cs-page .dg-tall { display: none }
}

.cs-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 40px 0 26px
}

@media (max-width: 600px) {
    .cs-prevnext { grid-template-columns: 1fr }
}

.cs-pn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--fg);
    font-family: var(--display);
    font-weight: 500;
    transition: border-color .2s ease
}

.cs-pn span {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.08em
}

.cs-pn-next { text-align: right }

.cs-pn:hover { border-color: var(--signal-line) }

.cs-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    font-family: var(--display);
    font-size: 1.05rem
}

.cs-est {
    display: block;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5
}

/* ---------- FIX WRITE-UPS: related link + chart ---------- */
.cs-related {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 10px 0 0;
    padding: 16px 18px;
    border: 1px solid var(--signal-line);
    border-radius: 12px;
    background: var(--signal-soft);
    color: var(--fg);
    text-decoration: none;
    font-family: var(--display);
    font-weight: 500
}

.cs-related span {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--signal);
    letter-spacing: 0.08em
}

:root {
    --chart-before: #7F93B8;
}

html.light {
    --chart-before: #5B6F95;
}

.fx-chart {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px 20px 16px;
    margin: 0 0 30px;
    background: var(--ink-2)
}

.fx-chart figcaption {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-family: var(--display);
    font-weight: 500;
    color: var(--fg);
    margin-bottom: 12px
}

.fx-legend {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--fg-dim);
    display: flex;
    align-items: center;
    gap: 6px
}

.fx-key {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-left: 8px
}

.fx-key-before { background: var(--chart-before) }
.fx-key-after { background: var(--signal) }

.fx-bars { display: block; width: 100%; height: auto }
.fx-bars text { font-family: var(--mono); font-size: 12px; fill: var(--fg-dim); text-anchor: middle }
.fx-bars .fx-grid line { stroke: var(--line); stroke-width: 1 }
.fx-bars .fx-grid text { text-anchor: end; fill: var(--muted); font-size: 11px }
.fx-bars .fx-base { stroke: var(--line-strong); stroke-width: 1 }
.fx-bars .fx-before { fill: var(--chart-before) }
.fx-bars .fx-after { fill: var(--signal) }
.fx-bars .fx-before:hover, .fx-bars .fx-after:hover { opacity: .8 }
.fx-bars .fx-val { fill: var(--fg); font-size: 12.5px }
.fx-bars .fx-cat { fill: var(--fg); font-size: 12.5px }
.fx-bars .fx-sub { fill: var(--muted); font-size: 11px }

.fx-hbars { display: none }

@media (max-width: 600px) {
    .fx-bars { display: none }
    .fx-hbars { display: grid; gap: 14px; margin: 4px 0 6px }
}

.fx-hrow { display: grid; gap: 4px }
.fx-hcat { font-family: var(--mono); font-size: 12.5px; color: var(--fg) }
.fx-hcat i { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 6px }
.fx-hbar { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--fg) }
.fx-hbar b { font-weight: 500; white-space: nowrap }
.fx-hfill { display: block; height: 10px; border-radius: 0 3px 3px 0; flex: none; min-width: 2px }
.fx-hfill-before { background: var(--chart-before); max-width: calc(100% - 52px) }
.fx-hfill-after { background: var(--signal) }

.fx-table { margin-top: 10px; font-size: 0.85rem; color: var(--fg-dim) }
.fx-table summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--signal) }
.fx-table table { width: 100%; border-collapse: collapse; margin-top: 10px; font-family: var(--mono); font-size: 12px }
.fx-table th, .fx-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line) }
.fx-table th:first-child, .fx-table td:first-child { text-align: left }
.fx-table th { color: var(--muted); font-weight: 500 }

.fx-note { font-size: 0.85rem; color: var(--muted); margin-top: 10px; line-height: 1.5 }

.cs-body code, .case-block code {
    font-family: var(--mono);
    font-size: 0.88em;
    color: var(--fg);
    background: var(--surface);
    border-radius: 4px;
    padding: 1px 5px
}

.cal-line {
    text-align: center;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--fg-dim);
    margin: 18px 0 4px
}

.cal-line a {
    color: var(--signal);
    text-decoration: none;
    font-weight: 500
}

.cal-line a:hover { text-decoration: underline }

@media (max-width: 520px) {
    .bg-card .row { flex-direction: column; gap: 4px }
    .bg-card .s { text-align: left }
}

/* ---------- STACK: proof links, sub-heading, single education card ---------- */
.cap-proof {
    display: block;
    margin-top: 14px;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted)
}

.cap-proof a {
    color: var(--signal);
    text-decoration: none
}

.cap-proof a:hover { text-decoration: underline }

.stack-sub {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--signal);
    font-weight: 500;
    margin: 34px 0 14px
}

.bg-band.bg-band-single {
    grid-template-columns: 1fr
}

/* toolkit as one compact list instead of a card grid */
#stack .stack-grid {
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
}

#stack .stack-row {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    padding: 13px 20px
}

#stack .stack-row:last-child {
    border-bottom: none
}

#stack .stack-row .k {
    width: 150px
}

@media (max-width: 600px) {
    #stack .stack-row { flex-direction: column; gap: 4px }
}

/* ---------- BACKGROUND (edu + certs) ---------- */
.bg-band {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 26px
}

.bg-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
    background: var(--ink-2);
    transition: border-color .25s ease;
}

.bg-card:hover {
    border-color: var(--line-strong)
}

.bg-card .lab {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--signal);
    margin-bottom: 8px;
}

.bg-card .row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.bg-card .row:first-of-type {
    border-top: none
}

.bg-card .t {
    color: var(--fg);
    font-size: 0.96rem
}

.bg-card .s {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    text-align: right;
    flex: none;
    line-height: 1.5
}

@media(max-width:640px) {
    .bg-band {
        grid-template-columns: 1fr
    }
}

/* ---------- FIXES / PATCH LOG ---------- */
.fixlog {
    display: grid;
    gap: 14px
}

.fix {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--ink-2);
    display: grid;
    grid-template-columns: 154px 1fr;
    transition: border-color .25s ease;
}

.fix:hover {
    border-color: var(--line-strong)
}

.fix-side {
    padding: 26px 22px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), rgba(17, 26, 36, 0.2));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fix-kind {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--signal);
    border: 1px solid var(--signal-line);
    border-radius: 20px;
    padding: 4px 11px;
    align-self: flex-start;
}

.fix-stat {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.85rem;
    color: var(--fg);
    line-height: 1;
    letter-spacing: -0.01em;
}

.fix-stat span {
    display: block;
    font-family: var(--mono);
    font-weight: 400;
    font-size: 10.5px;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-top: 8px;
    text-transform: uppercase;
}

.fix-body {
    padding: 26px 28px
}

.fix-body h3 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.16rem;
    color: var(--fg);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.fix-note {
    font-size: 0.94rem;
    color: var(--fg-dim);
    line-height: 1.55;
    margin-bottom: 12px
}

.fix-note .fx {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--signal);
    margin-right: 9px;
}

.fix-result {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px
}

.fix-intro {
    max-width: 64ch;
    color: var(--fg-dim);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 34px
}

.fix-intro b {
    color: var(--fg);
    font-weight: 500
}

.ba {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--fg-dim);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 11px;
    background: var(--ink);
    transition: border-color .2s ease, color .2s ease;
}

.ba:hover {
    border-color: var(--signal-line);
    color: var(--fg)
}

.ba b {
    color: var(--signal);
    font-weight: 600;
    margin: 0 3px
}

@media(max-width:640px) {
    .fix {
        grid-template-columns: 1fr
    }

    .fix-side {
        border-right: none;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px
    }
}

/* ---------- SECTION SCAFFOLD ---------- */
section {
    padding: 78px 0;
    position: relative
}

.sec-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 44px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
}

.route {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--signal);
    letter-spacing: 0.02em;
    flex: none;
}

.sec-head h2 {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.01em;
    color: var(--fg);
}

.sec-head .meta {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    align-self: center;
}

@media(max-width:600px) {
    .sec-head .meta {
        display: none
    }
}

/* reveal */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s ease, transform .7s ease
}

.reveal.in {
    opacity: 1;
    transform: none
}

@media(prefers-reduced-motion:reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none
    }
}

/* ---------- WORK ---------- */
.job {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(17, 26, 36, 0.55), rgba(12, 18, 26, 0.3));
    padding: 30px 30px 26px;
    margin-bottom: 22px;
    transition: border-color .25s ease;
}

.job:hover {
    border-color: var(--line-strong)
}

.job-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    margin-bottom: 6px;
}

.job-co {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.32rem;
    color: var(--fg)
}

.job-loc {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted)
}

.job-when {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--signal);
    letter-spacing: 0.02em;
}

.job-roles {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--fg-dim);
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.job ul {
    list-style: none;
    display: grid;
    gap: 12px
}

.job li {
    position: relative;
    padding-left: 22px;
    font-size: 0.97rem;
    color: var(--fg-dim);
    line-height: 1.55;
}

.job li::before {
    content: "›";
    position: absolute;
    left: 2px;
    top: -1px;
    color: var(--signal);
    font-family: var(--mono);
    font-weight: 600;
}

.job li b {
    color: var(--fg);
    font-weight: 500
}

.cs-link {
    font-family: var(--mono);
    font-size: 0.82em;
    color: var(--signal);
    text-decoration: none;
    white-space: nowrap;
    margin-left: 4px;
}

.cs-link:hover {
    text-decoration: underline
}

.m {
    font-family: var(--mono);
    color: var(--signal-bright);
    font-size: 0.9em;
    font-weight: 500
}

/* ---------- CAPABILITIES ---------- */
.caps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
}

.cap-cell {
    background: var(--ink);
    padding: 26px 24px;
    transition: background .25s ease
}

.cap-cell:hover {
    background: var(--surface)
}

.cap-cell .idx {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--signal);
    letter-spacing: 0.1em
}

.cap-cell h3 {
    font-family: var(--display);
    font-weight: 500;
    font-size: 1.08rem;
    color: var(--fg);
    margin: 14px 0 8px;
}

.cap-cell p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5
}

@media(max-width:820px) {
    .caps {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:520px) {
    .caps {
        grid-template-columns: 1fr
    }
}

/* ---------- STACK ---------- */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px
}

.stack-row {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px 22px;
    display: flex;
    gap: 20px;
    align-items: baseline;
    background: var(--ink-2);
    transition: border-color .25s ease, background .25s ease;
}

.stack-row:hover {
    border-color: var(--line-strong);
    background: var(--surface)
}

.stack-row .k {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--signal);
    flex: none;
    width: 112px;
    padding-top: 2px;
}

.stack-row .v {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--fg-dim);
    line-height: 1.9
}

@media(max-width:720px) {
    .stack-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:420px) {
    .stack-row {
        flex-direction: column;
        gap: 8px
    }

    .stack-row .k {
        width: auto
    }
}

/* ---------- CONTACT ---------- */
.contact {
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    padding: 52px 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(120% 140% at 50% -20%, rgba(245, 165, 36, 0.08), transparent 60%), var(--ink-2);
}

.contact .avail {
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: 0.06em;
    color: var(--fg-dim);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.contact h2 {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    max-width: 20ch;
    margin-inline: auto;
    line-height: 1.1;
}

.contact p {
    color: var(--fg-dim);
    max-width: 52ch;
    margin: 0 auto 34px;
    font-weight: 300
}

.cta-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap
}

.btn {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.02em;
    padding: 13px 22px;
    border-radius: 8px;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.btn-primary {
    background: var(--signal);
    color: #0A0E14;
    font-weight: 600
}

.btn-primary:hover {
    background: var(--signal-bright);
    transform: translateY(-2px)
}

.btn-ghost {
    border: 1px solid var(--line-strong);
    color: var(--fg-dim)
}

.btn-ghost:hover {
    border-color: var(--signal-line);
    color: var(--fg)
}

/* ---------- CONTACT FORM ---------- */
.cform {
    max-width: 520px;
    margin: 8px auto 30px;
    text-align: left;
    display: grid;
    gap: 15px
}

.cfield {
    display: grid;
    gap: 7px
}

.cfield label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.cform input,
.cform textarea {
    width: 100%;
    background: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--fg);
    font-family: var(--body);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.cform textarea {
    resize: vertical;
    min-height: 118px
}

.cform input:focus,
.cform textarea:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px var(--signal-soft);
}

.cform-send {
    width: 100%;
    justify-content: center;
    cursor: pointer;
    border: none;
    font-size: 13px
}

.cform-status {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--signal);
    min-height: 1.1em;
    margin: 2px 0 0;
    text-align: center;
}

.cform-status.err {
    color: #ff8a6b
}

.cdivider {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 520px;
    margin: 0 auto 24px;
    color: var(--muted);
}

.cdivider::before,
.cdivider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line)
}

.cdivider span {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: none;
}

/* ---------- STICKY SIDEBAR ---------- */
.sidebar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-left: none;
    color: var(--fg-dim);
    transition: background .2s ease, color .2s ease;
}

.sidebar a:first-child {
    border-radius: 0 8px 0 0
}

.sidebar a:last-child {
    border-radius: 0 0 8px 0
}

.sidebar a:hover {
    background: var(--signal);
    color: #0A0E14
}

.sidebar svg {
    width: 18px;
    height: 18px;
    fill: currentColor
}

@media(max-width:520px) {
    .sidebar {
        display: none
    }
}

/* ---------- THEME TOGGLE ---------- */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 40;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--fg-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover {
    background: var(--signal);
    color: #0A0E14;
    border-color: var(--signal)
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.theme-toggle .icon-moon {
    display: block
}

.theme-toggle .icon-sun {
    display: none
}

/* ---------- LIGHT THEME ---------- */
html.light {
    --ink: #F7F4EF;
    --ink-2: #FFFFFF;
    --surface: #EDE9E1;
    --surface-2: #E2DDD5;
    --line: rgba(60, 50, 35, 0.10);
    --line-strong: rgba(60, 50, 35, 0.18);
    --grid: rgba(80, 65, 40, 0.055);
    --fg: #1C2333;
    --fg-dim: #3A4255;
    --muted: #7A7D8A;
    --signal: #B06E00;
    --signal-bright: #8F5800;
    --signal-soft: rgba(176, 110, 0, 0.09);
    --signal-line: rgba(176, 110, 0, 0.25);
}

/* warmer grid tint */
html.light body {
    background: var(--ink);
}

html.light body::before {
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 130% 100% at 50% 0%, #000 25%, transparent 85%);
    mask-image: radial-gradient(ellipse 130% 100% at 50% 0%, #000 25%, transparent 85%);
}

html.light ::selection {
    background: var(--signal);
    color: #fff;
}

/* nav: warm frosted glass */
html.light nav {
    background: linear-gradient(to bottom, rgba(247, 244, 239, 0.92), rgba(247, 244, 239, 0.65));
    border-bottom-color: rgba(60, 50, 35, 0.10);
}

/* hero pipeline */
html.light .pipe {
    background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.5));
    border-color: rgba(60, 50, 35, 0.12);
}

html.light .node {
    background: var(--ink);
    border-color: rgba(60, 50, 35, 0.15);
}

html.light .node.lit {
    background: #fff;
    border-color: var(--signal-line);
}

html.light .track-line {
    stroke: rgba(60, 50, 35, 0.12);
}

html.light .track-flow {
    stroke: var(--signal);
    filter: drop-shadow(0 0 5px rgba(176, 110, 0, 0.30));
}

html.light .pipe:hover {
    border-color: rgba(60, 50, 35, 0.20);
    box-shadow: 0 0 20px rgba(176, 110, 0, 0.05);
}

/* telemetry */
html.light .telemetry {
    background: #fff;
    border-color: rgba(60, 50, 35, 0.10);
}

html.light .stat {
    border-right-color: rgba(60, 50, 35, 0.10);
}

html.light .stat:hover {
    background: var(--ink);
}

/* job cards */
html.light .job {
    background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.6));
}

/* case studies */
html.light .case {
    background: #fff;
}

html.light .case-side {
    background: linear-gradient(180deg, var(--ink), rgba(247, 244, 239, 0.3));
    border-right-color: rgba(60, 50, 35, 0.10);
}

/* fixes */
html.light .fix {
    background: #fff;
}

html.light .fix-side {
    background: linear-gradient(180deg, var(--ink), rgba(247, 244, 239, 0.3));
    border-right-color: rgba(60, 50, 35, 0.10);
}

html.light .ba {
    background: var(--ink);
}

/* capabilities grid */
html.light .caps {
    background: rgba(60, 50, 35, 0.08);
}

html.light .cap-cell {
    background: #fff;
}

html.light .cap-cell:hover {
    background: var(--ink);
}

/* stack */
html.light .stack-row {
    background: #fff;
}

html.light .stack-row:hover {
    background: var(--ink);
}

/* bg cards */
html.light .bg-card {
    background: #fff;
}

/* contact */
html.light .contact {
    background: radial-gradient(120% 140% at 50% -20%, rgba(176, 110, 0, 0.07), transparent 60%), #fff;
    border-color: rgba(60, 50, 35, 0.12);
}

/* form inputs */
html.light .cform input,
html.light .cform textarea {
    background: var(--ink);
    border-color: rgba(60, 50, 35, 0.15);
    color: var(--fg);
}

html.light .cform input:focus,
html.light .cform textarea:focus {
    border-color: var(--signal);
    box-shadow: 0 0 0 3px var(--signal-soft);
}

/* sidebar */
html.light .sidebar a {
    background: #fff;
    border-color: rgba(60, 50, 35, 0.14);
}

html.light .sidebar a:hover {
    background: var(--signal);
    color: #fff;
}

/* buttons */
html.light .btn-primary {
    color: #fff;
}

html.light .btn-primary:hover {
    color: #fff;
}

html.light .btn-ghost {
    border-color: rgba(60, 50, 35, 0.18);
}

/* theme toggle */
html.light .theme-toggle {
    background: #fff;
    border-color: rgba(60, 50, 35, 0.14);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

html.light .theme-toggle:hover {
    background: var(--signal);
    color: #fff;
    border-color: var(--signal);
}

html.light .theme-toggle .icon-moon {
    display: none;
}

html.light .theme-toggle .icon-sun {
    display: block;
}

/* footer */
html.light footer {
    background: var(--surface);
    border-top-color: rgba(60, 50, 35, 0.10);
}

/* ---------- FOOTER ---------- */
footer {
    border-top: 1px solid var(--line);
    padding: 34px 0 46px;
    margin-top: 40px;
}

.foot-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.foot-inner a {
    color: var(--fg-dim);
    transition: color .18s ease
}

.foot-inner a:hover {
    color: var(--signal)
}

.foot-links {
    display: flex;
    gap: 18px
}