/* =================================================================
   Amar Akram — Portfolio · "GRID//OPS — Live System Telemetry"
   Dark-default telemetry console with a light (warm-academic) toggle.
   Single shared stylesheet. Vanilla, no build.
   ================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* DARK (default / signature) */
  --bg:           #0A0E14;
  --bg-2:         #0F1622;
  --surface:      #121823;
  --surface-2:    #0F141D;
  --ink:          #E8EDF2;
  --muted:        #9AA7B4;
  --faint:        #828D9D;
  --line:         rgba(120,140,170,.12);
  --line-strong:  #1E2735;
  --accent:       #2FB7C9;   /* live teal — large text/icons/borders, NOT small body */
  --accent-ink:   #6FD0DE;   /* lighter teal for links / text-on-dark */
  --accent-deep:  #1E5F74;   /* brand teal, resting edges/gradients */
  --accent-soft:  rgba(47,183,201,.13);
  --accent-2:     #E0915A;   /* warm copper — "best" + one KPI only */
  --success:      #36E29A;
  --amber:        #F2B544;
  --on-accent:    #06141A;   /* dark text on bright teal fills */
  --glow:         rgba(47,183,201,.32);
  --band:         rgba(47,183,201,.13);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow-md: 0 12px 34px -14px rgba(0,0,0,.7);
  --shadow-lg: 0 26px 64px -26px rgba(0,0,0,.78);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.05);

  /* Type */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Space + shape */
  --maxw: 1080px;
  --maxw-narrow: 760px;
  --r-sm: 9px;
  --r:    14px;
  --r-lg: 20px;

  --canvas-trace: var(--accent);
  --canvas-band:  var(--band);
  --canvas-grid:  rgba(120,140,170,.10);
  --canvas-glow:  1;        /* multiplier read by JS: 1 in dark, 0 in light */
}

/* LIGHT — the exact warm-academic theme, restored */
:root[data-theme="light"] {
  --bg:           #FBFAF7;
  --bg-2:         #F4F2EC;
  --surface:      #FFFFFF;
  --surface-2:    #F4F2EC;
  --ink:          #19191C;
  --muted:        #565A61;
  --faint:        #8A8F98;
  --line:         #E8E3D9;
  --line-strong:  #D9D3C6;
  --accent:       #1E5F74;
  --accent-ink:   #154B5C;
  --accent-deep:  #154B5C;
  --accent-soft:  #E9F1F3;
  --accent-2:     #B8763B;
  --success:      #2E9E6B;
  --amber:        #B9820F;
  --on-accent:    #FFFFFF;
  --glow:         rgba(30,95,116,.16);
  --band:         rgba(30,95,116,.14);

  --shadow-sm: 0 1px 2px rgba(20,20,20,.05);
  --shadow-md: 0 10px 30px -12px rgba(20,35,45,.18);
  --shadow-lg: 0 24px 60px -24px rgba(20,35,45,.28);

  --canvas-trace: #1E5F74;
  --canvas-band:  rgba(30,95,116,.14);
  --canvas-grid:  #E8E3D9;
  --canvas-glow:  0;
}

/* No-JS first paint: respect OS light preference */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:#FBFAF7; --bg-2:#F4F2EC; --surface:#FFFFFF; --surface-2:#F4F2EC;
    --ink:#19191C; --muted:#565A61; --faint:#8A8F98; --line:#E8E3D9; --line-strong:#D9D3C6;
    --accent:#1E5F74; --accent-ink:#154B5C; --accent-deep:#154B5C; --accent-soft:#E9F1F3;
    --accent-2:#B8763B; --success:#2E9E6B; --amber:#B9820F; --on-accent:#FFFFFF;
    --glow:rgba(30,95,116,.16); --band:rgba(30,95,116,.14);
    --canvas-trace:#1E5F74; --canvas-band:rgba(30,95,116,.14); --canvas-grid:#E8E3D9; --canvas-glow:0;
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
  box-shadow: 0 0 0 5px var(--accent-soft);
}
/* main is only a programmatic focus target for the skip link */
main:focus, main:focus-visible { outline: none; box-shadow: none; }

/* Keyboard bypass block — offscreen until focused */
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 200;
  padding: 11px 17px;
  transform: translateY(-160%);
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-sm);
  font: 600 13px/1 var(--font-sans);
  box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .skip-link { transition: transform .18s ease; }
}

/* Polish: themed text selection */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--ink); }

/* Polish: slim themed scrollbar */
html { scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

/* Polish: anchored sections clear the sticky nav; balanced headings */
section[id] { scroll-margin-top: 84px; }
h1, h2, h3 { text-wrap: balance; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(20px, 5vw, 40px); }
.narrow { max-width: var(--maxw-narrow); }
section { padding-block: clamp(56px, 9vw, 104px); position: relative; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line); }

/* ---------- Mono telemetry helpers ---------- */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.tnum { font-variant-numeric: tabular-nums; }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
:root[data-theme="dark"] .kicker { text-shadow: 0 0 10px var(--glow); }

/* Status LED — colour always paired with a text label elsewhere */
.led {
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  flex: none;
}
.led::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: inherit;
  animation: led-ring 2.6s ease-in-out infinite;
}
.led--idle { background: var(--faint); }
.led--idle::after { display: none; }
.led--accent { background: var(--accent); }
@keyframes led-ring {
  0%        { transform: scale(1);   opacity: .5; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Section heads ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
:root[data-theme="dark"] .eyebrow { text-shadow: 0 0 10px var(--glow); }

/* Leading accent dash on all mono labels — quiet editorial rhythm */
.eyebrow, .block__label, .detail-hero__cat {
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before, .block__label::before, .detail-hero__cat::before {
  content: ""; width: 24px; height: 1.5px; border-radius: 1px; flex: none;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 25%, transparent));
}

.section-head { margin-bottom: clamp(32px, 5vw, 52px); }
.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}
/* "Charged" underline — energizes left→right when section reveals */
.section-head h2::after {
  content: "";
  position: absolute; left: 0; bottom: -10px;
  height: 2px; width: 56px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s cubic-bezier(.2,.7,.2,1) .1s;
}
.section-head.in h2::after { transform: scaleX(1); }
.section-head p { color: var(--muted); margin-top: 22px; max-width: 56ch; }
.section-head .eyebrow { color: var(--accent); margin-top: 0; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 8px var(--glow);
  z-index: 100; pointer-events: none;
  transition: width .1s linear;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(170%) blur(13px);
  -webkit-backdrop-filter: saturate(170%) blur(13px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.scrolled { border-bottom-color: var(--line-strong); box-shadow: 0 12px 32px -24px rgba(0,0,0,.5); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 600; letter-spacing: -0.02em; }
.brand__mark {
  position: relative;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 0 16px var(--glow);
}
.brand__mark::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: brand-pulse 2.6s ease-in-out infinite;
}
@keyframes brand-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.brand__name { font-size: 15.5px; }
.nav__links { display: flex; align-items: center; gap: 26px; }
.nav__links a {
  font-family: var(--font-mono);
  font-size: 13px; letter-spacing: 0.02em;
  color: var(--muted); position: relative; transition: color .18s ease;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 1.5px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .22s ease;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after,
.nav__links a.active::after { transform: scaleX(1); }
.nav__links a.active { color: var(--accent-ink); }
.nav__cta {
  font-size: 13px; font-weight: 600;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink) !important;
  transition: border-color .18s ease, background .18s ease, box-shadow .2s ease;
}
.nav__cta::after { display: none; }
.nav__cta:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 16px var(--glow); }

/* Theme toggle */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--muted); cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .2s ease;
}
.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 14px var(--glow); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }

@media (max-width: 660px) {
  .nav__inner { height: auto; min-height: 60px; padding-block: 10px; gap: 10px 14px; flex-wrap: wrap; }
  .brand__name { display: none; }
  .nav__links { gap: 8px 16px; flex-wrap: wrap; justify-content: flex-end; }
  .theme-toggle { width: 30px; height: 30px; }
}

/* ---------- Buttons (console keys) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 500; line-height: 1;
  padding: 13px 22px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  position: relative;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 0 0 1px var(--accent), 0 8px 26px -10px var(--glow); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 0 0 1px var(--accent), 0 14px 36px -12px var(--glow), 0 0 22px var(--glow); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: var(--surface); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); background: var(--accent-soft); box-shadow: 0 0 18px var(--glow); }
.btn__arrow { transition: transform .2s ease; }
.btn:hover .btn__arrow { transform: translateX(3px); }
.btn:active { transform: translateY(0); }

/* ---------- Tags / chips ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 5px 11px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color .18s ease, color .18s ease;
}
.tag:hover { border-color: var(--accent); color: var(--ink); }
.tag--solid { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-ink); }

/* Skill chip with signal-strength meter */
.tag--meter { display: inline-flex; align-items: center; gap: 9px; }
.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.meter i {
  display: block; width: 3px; border-radius: 1px;
  background: var(--line-strong);
}
.meter i:nth-child(1){ height: 4px; }
.meter i:nth-child(2){ height: 6px; }
.meter i:nth-child(3){ height: 8px; }
.meter i:nth-child(4){ height: 10px; }
.meter i:nth-child(5){ height: 12px; }
.tag--meter[data-level="3"] .meter i:nth-child(-n+3),
.tag--meter[data-level="4"] .meter i:nth-child(-n+4),
.tag--meter[data-level="5"] .meter i:nth-child(-n+5) { background: var(--accent); }
/* meters energize bar-by-bar once the skills column reveals */
.js .skills.reveal .meter i { transition: background .3s ease; }
.js .skills.reveal .meter i:nth-child(1) { transition-delay: .08s; }
.js .skills.reveal .meter i:nth-child(2) { transition-delay: .16s; }
.js .skills.reveal .meter i:nth-child(3) { transition-delay: .24s; }
.js .skills.reveal .meter i:nth-child(4) { transition-delay: .32s; }
.js .skills.reveal .meter i:nth-child(5) { transition-delay: .40s; }
.js .skills.reveal:not(.in) .tag--meter .meter i { background: var(--line-strong); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding-top: clamp(40px, 7vw, 72px); padding-bottom: clamp(48px, 8vw, 88px);
  background:
    radial-gradient(1100px 460px at 78% -8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(800px 380px at 6% 105%, color-mix(in srgb, var(--accent-deep) 12%, transparent), transparent 72%);
}
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.js .hero__canvas.live { display: block; }
.js .hero__canvas.live + .hero__svg { opacity: 0; }   /* hide static fallback once canvas runs */
.hero .wrap { position: relative; z-index: 1; }
.hero__bg::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 22%, transparent 68%); }
/* faint graticule dots, fading out radially — texture without noise */
.hero__bg::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 26%, transparent) 1px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(760px 500px at 74% 28%, #000 28%, transparent 78%);
          mask-image: radial-gradient(760px 500px at 74% 28%, #000 28%, transparent 78%);
  opacity: .5;
}
/* Narrow screens: the hero copy spans the full width, so the readability
   scrim has to reach past the desktop 22%/68% ramp or the trace crosses it. */
@media (max-width: 760px) {
  .hero__bg::after {
    background: linear-gradient(90deg, var(--bg) 48%, color-mix(in srgb, var(--bg) 76%, transparent) 100%);
  }
}

/* System status bar */
.statusbar {
  display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line-strong);
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.statusbar .seg { display: inline-flex; align-items: center; gap: 8px; }
.statusbar .seg b { color: var(--success); font-weight: 600; }
.statusbar .sep { color: var(--faint); }
.statusbar time { color: var(--accent-ink); }

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(42px, 7.4vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.026em;
}
.hero h1 .accent { color: var(--accent); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 .accent {
    background: linear-gradient(115deg, var(--accent) 25%, var(--accent-ink) 90%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
  }
}
:root[data-theme="dark"] .hero h1 .accent { filter: drop-shadow(0 0 20px var(--glow)); }
.hero__tagline {
  font-size: clamp(19px, 2.6vw, 25px);
  color: var(--ink);
  font-weight: 400;
  margin-top: 22px;
  max-width: 32ch;
  line-height: 1.34;
}
.hero__intro { margin-top: 20px; max-width: 56ch; color: var(--muted); }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  margin-top: 24px; font-size: 14.5px; color: var(--muted);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 8px; }
.hero__meta svg { color: var(--accent); flex: none; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* KPI tiles */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-top: 40px;
}
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 16px 16px 14px;
  transition: transform .2s ease, border-color .25s ease, box-shadow .25s ease;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 72%);
  opacity: .55;
}
.kpi--copper::before { background: linear-gradient(90deg, var(--accent-2), transparent 72%); }
.kpi:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
  box-shadow: 0 12px 32px -18px var(--glow);
}
.kpi--copper:hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line-strong)); }
.kpi__label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
  display: block; margin-bottom: 8px;
}
.kpi__val {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(22px, 3vw, 28px); line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.kpi__val small { font-size: .58em; margin-left: 1px; }
.kpi--copper .kpi__val { color: var(--accent-2); }
@media (max-width: 680px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* Hero static SVG fallback (themed; shown when canvas is inactive) */
.hero__svg { transition: opacity .4s ease; }
.hero__svg .grid line { stroke: var(--canvas-grid); stroke-width: 1; }
.hero__svg .band { fill: var(--canvas-band); }
.hero__svg .trace { stroke: var(--canvas-trace); stroke-width: 2.5; }
.hero__svg .dot { fill: var(--canvas-trace); }
:root[data-theme="dark"] .hero__svg .trace { filter: drop-shadow(0 0 8px var(--glow)); }
:root[data-theme="dark"] .hero__svg .dot { filter: drop-shadow(0 0 7px var(--glow)); }

/* ---------- Work / subsystem panels ---------- */
.work-list { display: flex; flex-direction: column; gap: clamp(20px, 3vw, 30px); position: relative; }
/* The projects are labelled CH-01..CH-05 like channels on an instrument, and
   the work itself is about sources sharing one DC bus. Run that bus down the
   stack: the rail sits behind the cards, which are opaque, so it only shows
   in the gaps — the channels read as taps on a continuous line. */
.work-list::before {
  content: ""; position: absolute; pointer-events: none;
  left: 0; top: 10px; bottom: 10px; width: 1px;
  background: linear-gradient(180deg,
    transparent 0%, var(--line-strong) 7%,
    var(--line-strong) 93%, transparent 100%);
}
/* energy on the bus: a slow pulse travels the rail, echoing the hero playhead.
   It paints above the cards so it reads as one continuous run rather than
   blinking on and off in the gaps. */
@media (prefers-reduced-motion: no-preference) {
  .work-list::after {
    content: ""; position: absolute; z-index: 2; pointer-events: none;
    left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px;
    background: linear-gradient(180deg, transparent 0%, var(--accent) 50%, transparent 100%);
    background-size: 100% 96px;
    background-repeat: no-repeat;
    opacity: .45;
    animation: bus-flow 16s linear infinite;
  }
}
@keyframes bus-flow {
  from { background-position: 0 -96px; }
  to   { background-position: 0 calc(100% + 96px); }
}

.project {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(22px, 4vw, 48px);
  align-items: center;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .3s ease, border-color .3s ease, background-size .35s ease;
}
/* Each channel taps the bus: a short accent stripe down the card's leading
   edge. Must follow the background shorthand above, which resets the image. */
.project {
  background-image: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 2px 78px;
  background-position: left top;
}
.project:hover { background-size: 2px 132px; }
/* cursor-tracked inner sheen (CSS vars set by JS, pointer:fine only) */
.project::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 60%);
  opacity: 0; transition: opacity .3s ease;
}
/* top-border energize pulse */
.project::after {
  content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0); transform-origin: left; opacity: 0;
}
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }
.project:hover::before { opacity: 1; }
.project:hover::after { animation: sweep .7s ease forwards; }
@keyframes sweep {
  0% { transform: scaleX(0); transform-origin: left; opacity: 1; }
  60% { opacity: 1; }
  100% { transform: scaleX(1); transform-origin: left; opacity: 0; }
}
.project > * { position: relative; z-index: 1; }
.project:nth-child(even) .project__media { order: 2; }
.project__body { min-width: 0; }

/* mono channel header strip */
.project__chan {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
}
:root[data-theme="dark"] .project__chan { text-shadow: 0 0 9px var(--glow); }
/* the channel id and the category are both uppercase mono and ran together as
   one string; separate them by weight and size rather than a rule, which would
   strand a leading tick whenever the category wraps to its own line */
.project__chan { column-gap: 14px; }
/* the row left ~200px of dead space; close it with a channel-strip rule */
.project__chan::after {
  content: ""; flex: 1 1 32px; min-width: 20px; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.project__chan .cat {
  color: var(--faint); font-weight: 500;
  font-size: 10.5px; letter-spacing: 0.14em;
}
.project h3 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(24px, 3.2vw, 31px); line-height: 1.12;
  letter-spacing: -0.02em; margin-top: 14px;
}
.project__sub { color: var(--muted); margin-top: 12px; max-width: 48ch; }

/* per-project KPI micro-strip (real figures) */
.project__kpis {
  display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 18px;
}
.project__kpis span {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.03em;
  color: var(--muted);
  padding: 4px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.project__kpis span b { color: var(--accent-ink); font-weight: 600; }

.project__tags { margin-top: 18px; }
.project__link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px; font-weight: 500; color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 13.5px; letter-spacing: 0.02em;
}
.project__link svg { transition: transform .2s ease; }
.project:hover .project__link svg { transform: translateX(4px); }
.project__media {
  position: relative;
  border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  aspect-ratio: 16 / 11;
  display: grid; place-items: center;
}
/* viewfinder corner ticks, revealed on hover */
.project__media::before, .project__media::after {
  content: ""; position: absolute; width: 16px; height: 16px; z-index: 1;
  border: 1.5px solid var(--accent); opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.project__media::before { top: 9px; left: 9px; border-right: 0; border-bottom: 0; transform: translate(4px, 4px); }
.project__media::after { bottom: 9px; right: 9px; border-left: 0; border-top: 0; transform: translate(-4px, -4px); }
.project:hover .project__media::before,
.project:hover .project__media::after { opacity: .85; transform: translate(0, 0); }
.project__media img { width: 100%; height: 100%; object-fit: cover; }
.project__media img, .project__media svg { transition: transform .55s cubic-bezier(.2,.7,.2,1); }
.project:hover .project__media img,
.project:hover .project__media svg { transform: scale(1.03); }
.project__media--contain { padding: 18px; }
.project__media--contain img { object-fit: contain; }
:root[data-theme="dark"] .project__media--contain img { filter: brightness(.97) contrast(1.02); }

/* Project assets carry their own baked-in ground, so a raw asset reads as a
   pasted rectangle in whichever theme it was not drawn for. Mount each one
   instead: --screen matches the architecture SVGs' own navy so image and
   bezel merge into one panel; --print keeps the plotted figure on a white
   plate, dimmed as a whole in dark mode so no seam appears at its edge. */
.project__media--screen {
  background: linear-gradient(157deg, #0A1320 0%, #111D2D 100%);
  box-shadow: inset 0 0 0 1px rgba(150, 190, 210, .10);
}
:root[data-theme="light"] .project__media--screen { border-color: #C9C2B3; }
:root[data-theme="dark"] .project__media--screen img { filter: none; }

.project__media--print { background: var(--surface-2); }
.project__media--print .plate {
  display: block; width: 100%; height: 100%;
  background: #FFFFFF; border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px rgba(20, 30, 40, .12), 0 8px 22px -12px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.project__media--print .plate img { width: 100%; height: 100%; object-fit: contain; }
:root[data-theme="dark"] .project__media--print .plate { filter: brightness(.93); }
:root[data-theme="dark"] .project__media--print .plate img { filter: none; }
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .project__media { order: 0; }
  .project__media { aspect-ratio: 16 / 10; }
}

/* ---------- Stat / metric blocks ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line-strong); border: 1px solid var(--line-strong);
  border-radius: var(--r); overflow: hidden;
}
.stat { background: var(--surface); padding: 22px 20px; transition: background .25s ease; }
.stat:hover { background: color-mix(in srgb, var(--surface) 90%, var(--accent)); }
.stat__num {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(25px, 3.4vw, 33px); line-height: 1; letter-spacing: -0.01em;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .stat__num { text-shadow: 0 0 14px var(--glow); }
.stat__num small { font-size: .55em; font-weight: 600; color: var(--accent-2); margin-left: 2px; }
.stat__label { font-size: 13.5px; color: var(--muted); margin-top: 9px; line-height: 1.4; }

/* ---------- About / operator profile ---------- */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.about-grid .prose p + p { margin-top: 16px; }
.skills { display: flex; flex-direction: column; gap: 22px; position: relative; padding-left: 22px; }
.skills::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 18%, transparent));
  border-radius: 2px;
}
.skill-group { position: relative; }
.skill-group::before {
  content: ""; position: absolute; left: -22px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  box-shadow: 0 0 8px var(--glow);
}
.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 12px; margin-top: 0;
}
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Thesis / archived record ---------- */
#thesis .thesis-card { filter: saturate(.72); }
.thesis-card {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(18px, 3vw, 28px);
  align-items: start; background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg); padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow-sm);
  position: relative;
}
.thesis-card__stamp {
  position: absolute; top: 16px; right: 18px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 8px;
}
.thesis-card__icon { width: 54px; height: 54px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.thesis-card__body { min-width: 0; }
.thesis-card__body h3 { font-family: var(--font-serif); font-size: clamp(19px, 2.4vw, 23px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; max-width: 40ch; }
.thesis-card__en { color: var(--muted); margin: 10px 0 16px; max-width: 60ch; }

/* The thesis compared four-wire sensing against the Wheatstone bridge but the
   section carried no figure, leaving the card's right half empty. Draw the
   bridge instead of describing it. */
/* own row, full width; min-width:0 keeps it from inflating the auto column
   (below 760px the stamp becomes a grid item, so the cells shift) */
.thesis-figure { grid-column: 1 / -1; min-width: 0; justify-self: start; width: min(300px, 100%); margin: 6px 0 0; }
.thesis-figure svg { width: 100%; height: auto; overflow: visible; }
.thesis-figure figcaption {
  margin-top: 10px; text-align: center;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint);
}
.thesis-figure figcaption b { color: var(--accent-ink); font-weight: 600; }
@media (min-width: 980px) {
  .thesis-card { grid-template-columns: auto 1fr 300px; }
  .thesis-figure { grid-column: 3; grid-row: 1; justify-self: end; margin-top: 26px; }
}
.wb-wire { fill: none; stroke: var(--line-strong); stroke-width: 1.6; stroke-linecap: round; }
.wb-res { fill: var(--surface); stroke: var(--muted); stroke-width: 1.6; }
.wb-res--x { stroke: var(--accent); }
.wb-meter { fill: var(--surface); stroke: var(--muted); stroke-width: 1.6; }
.wb-node { fill: var(--accent); }
.wb-glyph {
  fill: var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  text-anchor: middle;
}
.wb-label {
  fill: var(--faint); font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  text-anchor: middle; letter-spacing: .06em;
}
.wb-label--x { fill: var(--accent-ink); }
.wb-rail {
  fill: var(--faint); font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-anchor: middle; letter-spacing: .12em;
}
@media (max-width: 760px) {
  .thesis-card { grid-template-columns: auto 1fr; }
  .thesis-card__stamp { position: static; display: inline-block; margin-bottom: 10px; }
}

/* ---------- Contact / uplink console ---------- */
#contact { position: relative; overflow: hidden; }
.contact { text-align: center; position: relative; z-index: 1; }
.contact h2 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.02em; line-height: 1.08; }
.contact h2 .caret {
  display: inline-block; width: .5ch; margin-left: .12ch;
  color: var(--accent); animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.contact p { color: var(--muted); margin: 18px auto 32px; max-width: 48ch; }
/* the four chips need ~825px but the narrow text column offers 680, which
   stranded one of them on its own line; let just this row use the full width */
.contact__links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  width: min(900px, calc(100vw - 96px));
  margin-inline: auto;
}
.contact__link {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 15px; font-weight: 500;
  transition: border-color .18s ease, transform .15s ease, background .18s ease, box-shadow .2s ease;
}
.contact__link .proto { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.contact__link:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); box-shadow: 0 0 18px var(--glow); }
.contact__link:hover .proto { color: var(--accent-ink); }
.contact__link svg { color: var(--accent); flex: none; }
.contact__bg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 180px; opacity: .14; pointer-events: none; z-index: 0; }
.contact__bg .trace { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* ---------- Footer / signal wire ---------- */
.footer { border-top: 1px solid var(--line-strong); padding-block: 30px; position: relative; }
.footer::before {
  content: ""; position: absolute; top: -1px; left: 0; height: 2px; width: 90px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: wire 5.5s linear infinite;
}
@keyframes wire { 0% { transform: translateX(-90px); } 100% { transform: translateX(100vw); } }
.footer__inner { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.footer small { color: var(--faint); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; }
.footer__nav { display: flex; gap: 20px; }
.footer__nav a { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.footer__nav a:hover { color: var(--accent-ink); }

/* =================================================================
   Project detail pages
   ================================================================= */
.backlink { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 30px; }
.backlink:hover { color: var(--accent-ink); }
.backlink svg { transition: transform .2s ease; }
.backlink:hover svg { transform: translateX(-3px); }

/* 404 is far shorter than a viewport, which left the footer floating in the
   middle with a dead band beneath it. Fill the height and centre the message
   so the page reads as composed rather than cut off. */
.page-404 { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page-404 main { flex: 1 0 auto; display: grid; align-items: center; }
.page-404 .detail-hero { width: 100%; padding-block: clamp(40px, 8vh, 96px); }
.page-404 .footer { margin-top: auto; }

.detail-hero {
  padding-top: clamp(30px, 5vw, 52px); padding-bottom: clamp(28px, 4vw, 44px);
  position: relative;
  background:
    radial-gradient(900px 380px at 82% -14%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    radial-gradient(640px 300px at 2% 112%, color-mix(in srgb, var(--accent-deep) 9%, transparent), transparent 72%);
}
.detail-hero__cat { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
:root[data-theme="dark"] .detail-hero__cat { text-shadow: 0 0 10px var(--glow); }
.detail-hero h1 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(34px, 6vw, 58px); line-height: 1.06; letter-spacing: -0.025em;
  margin-top: 16px; max-width: 18ch;
}
.detail-hero__sub { font-size: clamp(18px, 2.4vw, 22px); color: var(--muted); margin-top: 20px; max-width: 60ch; line-height: 1.5; }

.meta-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; margin-top: 38px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.meta-row > div { background: var(--surface); padding: 15px 18px 13px; }
.meta-row dt { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
/* A source URL is one unbreakable string. In a 150px-min track it overran its
   cell and the row's overflow:hidden cut it off mid-address — wrap instead. */
.meta-row dd { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }

/* Content blocks */
.block { padding-block: clamp(30px, 5vw, 56px); }
.block + .block { border-top: 1px solid var(--line); }
.block__label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
:root[data-theme="dark"] .block__label { text-shadow: 0 0 10px var(--glow); }
.block h2 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(24px, 3.4vw, 33px); letter-spacing: -0.02em; line-height: 1.14; margin-bottom: 20px; }
.block h3 { font-size: 19px; font-weight: 600; margin: 28px 0 10px; letter-spacing: -0.01em; }

.prose { color: var(--ink); }
.prose p { max-width: 68ch; color: var(--muted); }
.prose p strong, .prose p em { color: var(--ink); }
.prose p + p { margin-top: 16px; }
.prose strong { font-weight: 600; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.prose a:hover { text-decoration-color: var(--accent); }

/* Key list with themed check */
.keylist { list-style: none; padding: 0; display: grid; gap: 14px; margin-top: 8px; }
.keylist li { position: relative; padding-left: 30px; max-width: 70ch; color: var(--muted); }
.keylist li strong { color: var(--ink); }
.keylist li::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--accent-soft);
}
.keylist li::after {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 18px; height: 18px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center no-repeat;
}

/* Figures */
.figure { margin-top: 26px; }
.figure__frame {
  border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .25s ease, box-shadow .3s ease;
}
.figure:hover .figure__frame {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line-strong));
  box-shadow: var(--shadow-md);
}
.figure__frame img { width: 100%; height: auto; }
.figure__frame--pad { padding: clamp(14px, 2.5vw, 26px); background: var(--surface-2); }
.figure figcaption { font-size: 13.5px; color: var(--faint); margin-top: 12px; line-height: 1.5; max-width: 70ch; }
.figure figcaption b { color: var(--muted); font-weight: 600; }

.figure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 26px; }
.figure-grid .figure__frame { background: #0f1420; }
.figure-grid figcaption { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.03em; text-align: center; margin-top: 9px; }

/* Inline chart card */
.chart-card { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: clamp(20px, 3vw, 30px); box-shadow: var(--shadow-sm); }
.chart-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.chart-card p.cc-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.bar-row { display: grid; grid-template-columns: 132px 1fr 64px; align-items: center; gap: 14px; margin-bottom: 13px; }
.bar-row__label { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); text-align: right; }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 30px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 6px 0 0 6px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); display: block; box-shadow: 0 0 14px var(--glow) inset; }
.bar-fill--muted { background: var(--line-strong); box-shadow: none; }
.bar-fill--best { background: linear-gradient(90deg, var(--accent-2), #F0B27A); }
.bar-row__val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-row__val.best { color: var(--accent-2); }
.cc-foot { font-size: 12.5px; color: var(--faint); margin-top: 16px; }
@media (max-width: 540px) { .bar-row { grid-template-columns: 96px 1fr 52px; gap: 9px; } .bar-row__label { font-size: 11.5px; } }

/* ---------- Inline result graphics (theme-aware SVGs) ---------- */
.rsvg { width: 100%; height: auto; display: block; }
.rsvg text { font-family: var(--font-mono); letter-spacing: .02em; }
.rsvg .t-title { fill: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.rsvg .t-ink { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.rsvg .t-muted { fill: var(--muted); font-size: 11.5px; }
.rsvg .t-faint { fill: var(--faint); font-size: 10.5px; }
.rsvg .t-acc { fill: var(--accent-ink); font-size: 11.5px; font-weight: 600; }
.rsvg .t-copper { fill: var(--accent-2); font-size: 13.5px; font-weight: 600; }
.rsvg .t-amber { fill: var(--amber); font-size: 11px; font-weight: 600; }
.rsvg .box { fill: var(--surface); stroke: var(--line-strong); }
.rsvg .box--acc { stroke: var(--accent); }
.rsvg .s-line { stroke: var(--line-strong); }
.rsvg .s-acc { stroke: var(--accent); }
.rsvg .s-amber { stroke: var(--amber); }
.rsvg .f-acc { fill: var(--accent); }
.rsvg .f-mutedfill { fill: var(--line-strong); }
.rsvg .f-band { fill: var(--band); }
.rsvg .f-soft { fill: var(--accent-soft); }
.rsvg .f-amber-soft { fill: var(--amber); opacity: .16; }
.rsvg .f-success { fill: var(--success); }
.rsvg .stop-a { stop-color: var(--accent-deep); }
.rsvg .stop-b { stop-color: var(--accent); }
.rsvg .stop-c1 { stop-color: var(--accent-2); }
.rsvg .stop-c2 { stop-color: #F0B27A; }
:root[data-theme="dark"] .rsvg .dotglow { filter: drop-shadow(0 0 6px var(--glow)); }
:root[data-theme="dark"] .rsvg .lineglow { filter: drop-shadow(0 0 7px var(--glow)); }

/* connectors: animated signal-flow dashes */
.rsvg .flow { stroke-dasharray: 4 7; animation: rsvg-flow 1.3s linear infinite; }
@keyframes rsvg-flow { to { stroke-dashoffset: -11; } }

/* draw-on-reveal for marked paths (pathLength="1" set in markup) */
.js .reveal .draw1 { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .reveal.in .draw1 { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s cubic-bezier(.3,0,.2,1) .15s; }

/* chart-card bars grow when the card reveals */
.js .chart-card.reveal .bar-fill { transition: width .9s cubic-bezier(.2,.7,.2,1) .1s; }
.js .chart-card.reveal:not(.in) .bar-fill { width: 0 !important; }
.js .chart-card.reveal.in .bar-row:nth-of-type(2) .bar-fill { transition-delay: .22s; }
.js .chart-card.reveal.in .bar-row:nth-of-type(3) .bar-fill { transition-delay: .34s; }
.js .chart-card.reveal.in .bar-row:nth-of-type(4) .bar-fill { transition-delay: .46s; }

/* Callout */
.callout {
  background: var(--accent-soft); border-radius: var(--r);
  padding: 22px 24px; margin-top: 26px;
  border-left: 3px solid var(--accent); max-width: 72ch;
}
.callout p { color: var(--ink); }
.callout strong { color: var(--accent-ink); }

/* ---------- MP1 · Smart Energy Node Phase 2 ---------- */
.mp1-detail-hero { padding-bottom: clamp(38px, 6vw, 68px); }
.mp1-kicker-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.mp1-kicker-row .detail-hero__cat { margin: 0; }
.phase-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font: 600 11.5px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
}
.phase-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 9px color-mix(in srgb, var(--amber) 65%, transparent); }
.figure--hero { margin-top: 0; }
.mp1-architecture-frame { background: #0b1320; border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
.mp1-architecture-frame img { display: block; }
.figure__zoom { display: block; cursor: zoom-in; }
.mp1-schematic-frame { background: #fff; }
.mp1-schematic-frame img { display: block; }
.mp1-knee-frame { background: var(--surface); }
.mp1-stats-wrap { margin-top: 38px; }

.mp1-intro-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(320px, 1.15fr); gap: clamp(30px, 7vw, 86px); align-items: start; }
.mp1-intro-grid h2 { margin: 0; max-width: 15ch; }

.mp1-flow {
  display: grid; grid-template-columns: repeat(7, auto); align-items: stretch; gap: 10px;
  margin-top: 30px; padding: clamp(16px, 2.5vw, 24px);
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.mp1-flow > i { align-self: center; color: var(--accent); font-size: 22px; font-style: normal; }
.mp1-flow__step { min-width: 0; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.mp1-flow__step span { display: block; margin-bottom: 13px; color: var(--faint); font: 600 10px/1 var(--font-mono); letter-spacing: .12em; }
.mp1-flow__step b { display: block; color: var(--ink); font-size: 15px; }
.mp1-flow__step small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.mp1-flow__step--bus { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.mp1-flow__step--bus b { color: var(--accent-ink); }
/* the tinted bus panel lifts the backdrop, leaving the 10px step index at 4.27:1
   against it — one step darker so the label clears AA like its siblings */
.mp1-flow__step--bus span { color: var(--muted); }

.mp1-table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
.mp1-map { width: 100%; border-collapse: collapse; min-width: 680px; }
.mp1-map th, .mp1-map td { padding: 14px 17px; text-align: left; border-bottom: 1px solid var(--line); }
.mp1-map tr:last-child td { border-bottom: 0; }
.mp1-map th { color: var(--faint); background: var(--surface-2); font: 600 11px/1.25 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp1-map td { color: var(--muted); font-size: 13.5px; }
.mp1-map td b { color: var(--ink); }
.mp1-map code { color: var(--accent-ink); background: var(--accent-soft); padding: 3px 6px; border-radius: 5px; font: 600 12px/1 var(--font-mono); }

.mp1-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.mp1-data-frame { background: #fff; padding: clamp(10px, 1.6vw, 18px); }
.mp1-data-frame img { border-radius: 5px; }
.mp1-decision {
  display: grid; grid-template-columns: auto 1fr; gap: 25px; align-items: center;
  margin-top: 24px; padding: clamp(20px, 3vw, 30px);
  background: linear-gradient(115deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line-strong)); border-radius: var(--r);
}
.mp1-decision__value { min-width: 160px; color: var(--accent); font: 700 clamp(31px, 4.5vw, 46px)/.95 var(--font-mono); letter-spacing: -.05em; }
.mp1-decision__value span { display: block; margin-top: 9px; color: var(--accent-2); font-size: .44em; letter-spacing: .05em; }
.mp1-decision h3 { margin: 0 0 7px; }
.mp1-decision p { color: var(--muted); max-width: 60ch; }
.mp1-decision p b { color: var(--ink); }

.mp1-feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.mp1-feature-grid article { padding: 22px 20px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.mp1-feature-grid article > span { color: var(--accent); font: 600 11px/1 var(--font-mono); letter-spacing: .12em; }
.mp1-feature-grid h3 { margin: 22px 0 8px; font-size: 18px; }
.mp1-feature-grid p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.mp1-codebar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.mp1-codebar span { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--muted); font: 500 11.5px/1.3 var(--font-mono); }
.mp1-codebar b { color: var(--accent-ink); font-weight: 600; }

.mp1-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.mp1-status-card { overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.mp1-status-card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.mp1-status-card__head span { padding: 5px 8px; border-radius: 5px; font: 700 10.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp1-status-card__head b { color: var(--ink); font-size: 14px; }
.mp1-status-card--verified .mp1-status-card__head { background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.mp1-status-card--verified .mp1-status-card__head span { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.mp1-status-card--open .mp1-status-card__head { background: color-mix(in srgb, var(--amber) 8%, var(--surface)); }
.mp1-status-card--open .mp1-status-card__head span { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.mp1-status-card ul { list-style: none; margin: 0; padding: 10px 19px 16px; }
.mp1-status-card li { position: relative; padding: 9px 0 9px 24px; color: var(--muted); font-size: 13.5px; line-height: 1.5; border-bottom: 1px solid var(--line); }
.mp1-status-card li:last-child { border-bottom: 0; }
.mp1-status-card li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 7px; height: 7px; border-radius: 50%; }
.mp1-status-card--verified li::before { background: var(--success); box-shadow: 0 0 8px color-mix(in srgb, var(--success) 55%, transparent); }
.mp1-status-card--open li::before { border: 1.5px solid var(--amber); }

@media (max-width: 900px) {
  .mp1-flow { grid-template-columns: 1fr; }
  .mp1-flow > i { transform: rotate(90deg); justify-self: center; line-height: .5; }
  .mp1-feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .mp1-intro-grid, .mp1-result-grid, .mp1-status-grid { grid-template-columns: 1fr; }
  .mp1-intro-grid h2 { max-width: 21ch; }
  .mp1-result-grid .figure + .figure { margin-top: 4px; }
}
@media (max-width: 560px) {
  .mp1-kicker-row { align-items: flex-start; }
  .mp1-feature-grid { grid-template-columns: 1fr; }
  .mp1-decision { grid-template-columns: 1fr; gap: 16px; }
  .mp1-decision__value { min-width: 0; }
  .mp1-codebar { display: grid; }
}

/* ---------- MP2 · Forecast-free microgrid control · Phase 6 ---------- */
.mp2-detail-hero { padding-bottom: clamp(38px, 6vw, 68px); }
.mp2-detail-hero .phase-pill i { background: var(--success); box-shadow: 0 0 9px color-mix(in srgb, var(--success) 65%, transparent); }
.mp2-dark-frame { background: #0a1320; border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
.mp2-dark-frame img { display: block; }
.mp2-stats-wrap { margin-top: 38px; }
.mp2-intro-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(320px, 1.15fr); gap: clamp(30px, 7vw, 86px); align-items: start; }
.mp2-intro-grid h2 { margin: 0; max-width: 15ch; }

.mp2-component-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 30px; }
.mp2-component-grid article { min-width: 0; padding: 22px 20px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.mp2-component-grid h3 { margin: 19px 0 8px; font-size: 17px; }
.mp2-component-grid p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.mp2-dot { display: block; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px color-mix(in srgb, currentColor 60%, transparent); }
.mp2-dot--pv { color: #d99a21; background: currentColor; }
.mp2-dot--wind { color: #38bdf8; background: currentColor; }
.mp2-dot--bio { color: #fb7185; background: currentColor; }
.mp2-dot--bat { color: #4ade80; background: currentColor; }

.mp2-equation { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; margin-top: 16px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line-strong)); border-radius: var(--r); background: linear-gradient(105deg, var(--accent-soft), var(--surface)); }
.mp2-equation > span { color: var(--accent-ink); font: 700 10.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.mp2-equation b { color: var(--ink); font: 600 clamp(15px, 2vw, 19px)/1.35 var(--font-mono); text-align: center; }
.mp2-equation small { color: var(--muted); font-size: 11.5px; text-align: right; }

.mp2-pipeline { display: grid; grid-template-columns: repeat(7, auto); align-items: stretch; gap: 10px; margin-top: 30px; padding: clamp(16px, 2.5vw, 24px); border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.mp2-pipeline > i { align-self: center; color: var(--accent); font-size: 22px; font-style: normal; }
.mp2-pipeline > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.mp2-pipeline span { display: block; margin-bottom: 13px; color: var(--faint); font: 600 10px/1 var(--font-mono); letter-spacing: .12em; }
.mp2-pipeline b { display: block; color: var(--ink); font-size: 15px; }
.mp2-pipeline small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.mp2-result-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 22px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--line-strong); }
.mp2-result-strip article { padding: 20px; background: var(--surface); }
.mp2-result-strip span { display: block; color: var(--faint); font: 600 10.5px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp2-result-strip b { display: block; margin: 12px 0 7px; color: var(--accent-ink); font: 700 clamp(24px, 3vw, 33px)/1 var(--font-mono); letter-spacing: -.04em; }
.mp2-result-strip small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }

.mp2-scale-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.mp2-scale-grid article { padding: 21px 19px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.mp2-scale-grid span { color: var(--accent); font: 700 11px/1 var(--font-mono); letter-spacing: .08em; }
.mp2-scale-grid b { display: block; margin: 17px 0 7px; color: var(--ink); font-size: 17px; }
.mp2-scale-grid p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.mp2-matrix-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
.mp2-matrix-wrap > div { display: grid; grid-template-columns: minmax(210px, 1.25fr) repeat(3, minmax(145px, 1fr)); min-width: 720px; border-bottom: 1px solid var(--line); }
.mp2-matrix-wrap > div:last-child { border-bottom: 0; }
.mp2-matrix-wrap span, .mp2-matrix-wrap b { padding: 13px 16px; border-right: 1px solid var(--line); }
.mp2-matrix-wrap span:last-child { border-right: 0; }
.mp2-matrix-wrap b { color: var(--ink); font-size: 13px; font-weight: 600; }
.mp2-matrix-wrap span { color: var(--muted); font: 500 11.5px/1.35 var(--font-mono); }
.mp2-matrix-head { background: var(--surface-2); }
.mp2-matrix-head span { color: var(--faint); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }

.mp2-evidence-browser {
  overflow: hidden;
  margin-top: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.mp2-evidence-browser + .mp2-evidence-browser { margin-top: 20px; }
.mp2-evidence-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(105deg, var(--accent-soft), var(--surface));
}
.mp2-evidence-head h3 {
  max-width: 28ch;
  margin: 8px 0 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.7vw, 27px);
  line-height: 1.18;
  letter-spacing: -.025em;
}
.mp2-evidence-eyebrow {
  color: var(--accent-ink);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.mp2-evidence-controls {
  display: flex;
  flex: none;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
}
.mp2-evidence-controls button {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: 600 11.5px/1 var(--font-mono);
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.mp2-evidence-controls button small { display: block; margin-top: 5px; color: inherit; font-size: 9px; opacity: .72; }
.mp2-evidence-controls button:hover { color: var(--ink); background: var(--surface); }
.mp2-evidence-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mp2-evidence-controls button[aria-pressed="true"] {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line-strong));
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.mp2-evidence-controls--traces { flex-wrap: wrap; justify-content: flex-end; max-width: 550px; }
.mp2-evidence-figure { margin: 0; padding: clamp(14px, 2.4vw, 24px); }
.mp2-paper-frame {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line-strong) 75%, #fff);
  border-radius: calc(var(--r) - 2px);
  background: #fff;
  box-shadow: 0 16px 42px rgba(4, 10, 22, .14);
}
.mp2-paper-frame a { display: block; }
.mp2-paper-frame img { display: block; width: 100%; height: auto; transition: opacity .18s ease; }
.mp2-paper-frame img.is-switching { opacity: .3; }
.mp2-evidence-figure figcaption {
  max-width: 92ch;
  margin: 14px 2px 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.55;
}
.mp2-evidence-figure figcaption b { color: var(--muted); font-weight: 650; }
.mp2-evidence-note {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}
.mp2-evidence-note span {
  flex: none;
  color: var(--accent-ink);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mp2-provenance { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 1px; overflow-x: auto; margin-top: 28px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--line); }
.mp2-provenance span, .mp2-provenance code { padding: 12px 14px; white-space: nowrap; background: var(--surface); }
.mp2-provenance span { color: var(--faint); font: 600 10px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp2-provenance code { color: var(--accent-ink); font: 600 11.5px/1.2 var(--font-mono); }

@media (max-width: 900px) {
  .mp2-component-grid, .mp2-result-strip, .mp2-scale-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp2-pipeline { grid-template-columns: 1fr; }
  .mp2-pipeline > i { transform: rotate(90deg); justify-self: center; line-height: .5; }
  .mp2-provenance { grid-template-columns: auto 1fr; }
}
@media (max-width: 760px) {
  .mp2-intro-grid { grid-template-columns: 1fr; }
  .mp2-intro-grid h2 { max-width: 21ch; }
  .mp2-equation { grid-template-columns: 1fr; gap: 10px; }
  .mp2-equation b, .mp2-equation small { text-align: left; }
  .mp2-evidence-head { align-items: stretch; flex-direction: column; }
  .mp2-evidence-controls { align-self: stretch; overflow-x: auto; }
  .mp2-evidence-controls button { flex: 1 0 auto; }
  .mp2-evidence-controls--traces { flex-wrap: nowrap; justify-content: flex-start; max-width: none; }
}
@media (max-width: 560px) {
  .mp2-component-grid, .mp2-result-strip, .mp2-scale-grid { grid-template-columns: 1fr; }
  .mp2-evidence-head { padding: 19px 16px; }
  .mp2-evidence-figure { padding: 10px; }
  .mp2-evidence-figure figcaption { margin-inline: 4px; }
  .mp2-evidence-note { align-items: flex-start; flex-direction: column; gap: 7px; }
}

/* MP2 editorial case-study layer */
.mp2-case-study main {
  overflow: clip;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 48%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 48%, transparent) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: center top;
}
.mp2-case-study .backlink { margin-bottom: 10px; }
.mp2-detail-hero {
  isolation: isolate;
  overflow: hidden;
  padding-top: clamp(34px, 5vw, 64px);
  padding-bottom: clamp(36px, 5vw, 58px);
  border-bottom: 1px solid var(--line-strong);
  background:
    radial-gradient(800px 480px at 86% 22%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg-2) 88%, transparent), var(--bg));
}
.mp2-detail-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .46;
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent, #000 52%, #000);
}
.mp2-hero-grid { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(380px, .96fr); gap: clamp(34px, 6vw, 72px); align-items: center; }
.mp2-hero-copy { min-width: 0; }
.mp2-detail-hero h1 { max-width: 12ch; font-size: clamp(43px, 6.2vw, 70px); line-height: .99; letter-spacing: -.042em; }
.mp2-detail-hero .detail-hero__sub { max-width: 55ch; margin-top: 24px; font-size: clamp(17px, 2vw, 21px); }
.mp2-hero-verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  margin-top: 30px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line-strong));
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--r) var(--r) 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.mp2-hero-verdict > span {
  padding-top: 3px;
  color: var(--accent-2);
  font: 700 9.5px/1.25 var(--font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.mp2-hero-verdict p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.mp2-hero-verdict strong { color: var(--ink); font-weight: 650; }

.mp2-hero-visual {
  overflow: hidden;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, #24364b);
  border-radius: 22px;
  background: #08111c;
  box-shadow: 0 34px 90px -35px rgba(0,0,0,.92), inset 0 1px 0 rgba(255,255,255,.07), 0 0 45px rgba(47,183,201,.08);
}
.mp2-panel-top, .mp2-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #9fb1c3; font: 600 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp2-panel-top { padding: 14px 16px; border-bottom: 1px solid #1c2b3e; background: #0c1724; }
.mp2-panel-top span { display: inline-flex; align-items: center; gap: 9px; }
.mp2-panel-top i { width: 7px; height: 7px; border-radius: 50%; background: #36e29a; box-shadow: 0 0 9px rgba(54,226,154,.7); }
.mp2-panel-top code { color: #70d4e1; font: inherit; letter-spacing: .04em; text-transform: none; }
.mp2-hero-visual > a { display: block; padding: clamp(8px, 1.4vw, 16px); }
.mp2-hero-visual img { width: 100%; }
.mp2-panel-foot { justify-content: stretch; padding: 0 16px 14px; }
.mp2-panel-foot span { flex: 1; padding: 11px 12px; border: 1px solid #1c2b3e; background: #0c1724; }
.mp2-panel-foot b { display: block; margin-bottom: 6px; color: #e8edf2; font-size: 13px; letter-spacing: -.02em; text-transform: none; }
.mp2-hero-visual figcaption { padding: 12px 16px 15px; border-top: 1px solid #1c2b3e; color: #8293a5; font-size: 11.5px; line-height: 1.5; }
.mp2-hero-visual figcaption b { color: #c8d4df; font-weight: 600; }
.mp2-meta-row { margin-top: clamp(28px, 4vw, 46px); border-radius: 12px; background: color-mix(in srgb, var(--accent) 24%, var(--line-strong)); }
.mp2-meta-row > div { background: color-mix(in srgb, var(--surface) 94%, transparent); }

.mp2-command-wrap { padding-block: 22px; border-bottom: 1px solid var(--line-strong); background: color-mix(in srgb, var(--bg-2) 94%, transparent); }
.mp2-stats { border-radius: 12px; }
.mp2-stats .stat { position: relative; padding: 18px 20px; }
.mp2-stats .stat::after { content: ""; position: absolute; right: 18px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .35; }
.mp2-stats .stat__num { font-size: clamp(24px, 3vw, 31px); }
.mp2-stats .stat__label { max-width: 22ch; font-size: 12.5px; }

.mp2-project-nav {
  position: sticky;
  z-index: 35;
  top: 65px;
  border-bottom: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
}
.mp2-project-nav .wrap { display: flex; align-items: center; gap: 28px; min-height: 52px; }
.mp2-project-nav__label { flex: none; color: var(--faint); font: 700 9.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.mp2-project-nav__links { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mp2-project-nav__links::-webkit-scrollbar { display: none; }
.mp2-project-nav a { position: relative; flex: none; padding: 18px 11px 16px; color: var(--muted); font: 600 11px/1 var(--font-mono); letter-spacing: .025em; }
.mp2-project-nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform .2s ease; }
.mp2-project-nav a:hover, .mp2-project-nav a.active { color: var(--accent-ink); }
.mp2-project-nav a.active::after { transform: scaleX(1); }

.mp2-case-study .block { padding-block: clamp(58px, 8vw, 92px); }
.mp2-case-study .block + .block { border-top-color: color-mix(in srgb, var(--line-strong) 70%, transparent); }
.mp2-section--tint { background: color-mix(in srgb, var(--bg-2) 91%, transparent); }
.mp2-context { background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 96%, transparent), var(--bg)); }
.mp2-intro-grid h2 { font-size: clamp(31px, 4.5vw, 45px); }

.mp2-verdict-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: clamp(34px, 5vw, 52px); }
.mp2-verdict-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, color-mix(in srgb, var(--surface) 96%, transparent), var(--surface-2));
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.mp2-verdict-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--card-accent, var(--accent)); }
.mp2-verdict-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 48%, var(--line-strong)); box-shadow: var(--shadow-md), var(--shadow-inset); }
.mp2-verdict-card--learned { --card-accent: #2fb7c9; }
.mp2-verdict-card--dr { --card-accent: #36e29a; }
.mp2-verdict-card--classical { --card-accent: #e0915a; }
.mp2-verdict-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mp2-verdict-card > div span, .mp2-verdict-card > div b { font: 700 9.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.mp2-verdict-card > div span { color: var(--faint); }
.mp2-verdict-card > div b { color: var(--card-accent); }
.mp2-verdict-card h3 { min-height: 2.5em; margin: 28px 0 10px; font-family: var(--font-serif); font-size: 21px; line-height: 1.18; }
.mp2-verdict-card p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.mp2-verdict-card small { display: block; margin-top: 24px; color: var(--faint); font: 600 9.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

.mp2-component-grid { margin-top: 34px; }
.mp2-component-grid article { position: relative; overflow: hidden; padding: 23px 20px 21px; }
.mp2-component-grid article::after { content: attr(data-source); position: absolute; right: 16px; top: 17px; color: var(--faint); font: 700 9px/1 var(--font-mono); letter-spacing: .12em; }
.mp2-component-grid h3 { margin: 20px 0 11px; }
.mp2-component-grid strong { display: block; margin-bottom: 9px; color: var(--accent-ink); font: 700 15px/1 var(--font-mono); }
.mp2-component-grid p { font-size: 12.5px; }
.mp2-equation { padding: 19px 21px; box-shadow: var(--shadow-inset); }
.mp2-pipeline { margin-top: 32px; border-radius: var(--r-lg); box-shadow: var(--shadow-md), var(--shadow-inset); }
.mp2-pipeline > i { font-size: 19px; opacity: .7; }
.mp2-pipeline > div { padding: 16px; border-radius: 11px; background: linear-gradient(145deg, var(--surface-2), var(--surface)); }
.mp2-pipeline span { margin-bottom: 15px; color: var(--accent); font-weight: 700; }
.mp2-pipeline small { font-size: 11.5px; line-height: 1.45; }

.mp2-feature-figure .figure__frame { border-radius: var(--r-lg); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.06); }
.mp2-feature-figure figcaption { padding-left: 2px; }
.mp2-results-section {
  background:
    radial-gradient(760px 360px at 12% 10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg-2) 94%, var(--bg)));
}
.mp2-result-strip { margin-top: 24px; border-color: color-mix(in srgb, var(--accent) 28%, var(--line-strong)); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.mp2-result-strip article { position: relative; padding: 22px 20px; background: color-mix(in srgb, var(--surface) 96%, transparent); }
.mp2-result-strip article::before { content: ""; position: absolute; left: 20px; top: 0; width: 42px; height: 2px; background: var(--accent); }
.mp2-result-strip span { font-weight: 700; letter-spacing: .09em; }
.mp2-result-strip b { margin: 13px 0 8px; font-size: clamp(25px, 3vw, 34px); }
.mp2-scale-grid { gap: 12px; }
.mp2-matrix-wrap { box-shadow: var(--shadow-sm); }
.mp2-evidence-browser { box-shadow: var(--shadow-md), var(--shadow-inset); }
.mp2-limits-section .mp1-status-card { border-radius: var(--r-lg); box-shadow: var(--shadow-md), var(--shadow-inset); }
.mp2-stack-section { padding-bottom: clamp(48px, 6vw, 70px) !important; }
.mp2-provenance { box-shadow: var(--shadow-sm); }

@media (max-width: 980px) {
  .mp2-hero-grid { grid-template-columns: 1fr; }
  .mp2-hero-copy { max-width: 760px; }
  .mp2-hero-visual { max-width: 780px; }
  .mp2-verdict-grid { grid-template-columns: 1fr; }
  .mp2-verdict-card h3 { min-height: 0; }
}
@media (max-width: 900px) {
  .mp2-project-nav .wrap { gap: 16px; }
}
@media (max-width: 760px) {
  .mp2-detail-hero h1 { font-size: clamp(39px, 12vw, 55px); }
  .mp2-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .mp2-panel-foot { flex-wrap: wrap; }
  .mp2-panel-foot span { min-width: calc(50% - 8px); }
  .mp2-project-nav { top: 61px; }
  .mp2-project-nav__label { display: none; }
  .mp2-project-nav .wrap { padding-inline: 10px; }
}
@media (max-width: 560px) {
  .mp2-hero-verdict { grid-template-columns: 1fr; gap: 8px; }
  .mp2-hero-verdict > span { writing-mode: initial; transform: none; }
  .mp2-meta-row { grid-template-columns: 1fr 1fr; }
  .mp2-result-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* MP2 motion + result storytelling
   Keeps the established visual system and adds progressive enhancement. */
.mp2-hero-visual > a {
  position: relative;
  overflow: hidden;
}
.mp2-hero-visual > a::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -34%;
  width: 28%;
  background: linear-gradient(90deg, transparent, rgba(111, 208, 222, .04) 34%, rgba(111, 208, 222, .24) 52%, rgba(111, 208, 222, .04) 68%, transparent);
  transform: skewX(-8deg);
  animation: mp2-scan 6.8s cubic-bezier(.45, 0, .55, 1) infinite;
  pointer-events: none;
}
@keyframes mp2-scan {
  0%, 18% { left: -34%; opacity: 0; }
  27% { opacity: 1; }
  67% { opacity: .85; }
  78%, 100% { left: 112%; opacity: 0; }
}

.mp2-feature-figure .figure__frame {
  transform-origin: 50% 100%;
  transition: clip-path .95s cubic-bezier(.2, .75, .2, 1), box-shadow .3s ease;
}
.mp2-feature-figure .figure__frame img {
  transition: transform .65s cubic-bezier(.2, .7, .2, 1);
}
.mp2-feature-figure:hover .figure__frame img { transform: scale(1.012); }
.js .mp2-feature-figure.reveal:not(.in) .figure__frame {
  clip-path: inset(0 0 100% 0 round var(--r-lg));
}
.js .mp2-feature-figure.reveal.in .figure__frame {
  clip-path: inset(0 0 0 0 round var(--r-lg));
}

.js .mp2-stats.reveal .stat,
.js .mp2-verdict-grid.reveal .mp2-verdict-card,
.js .mp2-component-grid.reveal article,
.js .mp2-result-strip.reveal article {
  transition: opacity .55s ease, transform .6s cubic-bezier(.2, .7, .2, 1), border-color .22s ease, box-shadow .22s ease;
}
.js .mp2-stats.reveal:not(.in) .stat,
.js .mp2-verdict-grid.reveal:not(.in) .mp2-verdict-card,
.js .mp2-component-grid.reveal:not(.in) article,
.js .mp2-result-strip.reveal:not(.in) article {
  opacity: 0;
  transform: translateY(18px);
}
.js .mp2-stats.reveal.in .stat:nth-child(2),
.js .mp2-verdict-grid.reveal.in .mp2-verdict-card:nth-child(2),
.js .mp2-component-grid.reveal.in article:nth-child(2),
.js .mp2-result-strip.reveal.in article:nth-child(2) { transition-delay: .09s; }
.js .mp2-stats.reveal.in .stat:nth-child(3),
.js .mp2-verdict-grid.reveal.in .mp2-verdict-card:nth-child(3),
.js .mp2-component-grid.reveal.in article:nth-child(3),
.js .mp2-result-strip.reveal.in article:nth-child(3) { transition-delay: .18s; }
.js .mp2-stats.reveal.in .stat:nth-child(4),
.js .mp2-component-grid.reveal.in article:nth-child(4),
.js .mp2-result-strip.reveal.in article:nth-child(4) { transition-delay: .27s; }

.mp2-result-compare {
  overflow: hidden;
  margin-top: clamp(34px, 5vw, 52px);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line-strong));
  border-radius: var(--r-lg);
  background:
    radial-gradient(620px 260px at 85% -20%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    color-mix(in srgb, var(--surface) 97%, transparent);
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.mp2-result-compare__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(22px, 3vw, 32px);
}
.mp2-result-compare__head > div:first-child > span {
  color: var(--accent-ink);
  font: 700 9.5px/1 var(--font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.mp2-result-compare__head h3 {
  margin-top: 10px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.05;
  letter-spacing: -.03em;
}
.mp2-result-legend {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font: 600 10px/1 var(--font-mono);
}
.mp2-result-legend span { display: inline-flex; align-items: center; gap: 7px; }
.mp2-result-legend i { width: 18px; height: 3px; border-radius: 99px; }
.mp2-result-legend__learned { background: linear-gradient(90deg, var(--accent), var(--success)); box-shadow: 0 0 8px var(--glow); }
.mp2-result-legend__droop { background: var(--accent-2); }

.mp2-compare-row {
  display: grid;
  grid-template-columns: minmax(175px, .42fr) minmax(350px, 1fr);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  padding: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
}
.mp2-compare-label > span {
  display: block;
  color: var(--faint);
  font: 600 8.5px/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.mp2-compare-label h4 {
  margin-top: 9px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}
.mp2-compare-label b {
  display: inline-flex;
  margin-top: 15px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--success) 34%, var(--line));
  border-radius: 6px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 8%, transparent);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: .04em;
}
.mp2-compare-bars { display: grid; gap: 12px; }
.mp2-compare-bar {
  display: grid;
  grid-template-columns: 66px minmax(120px, 1fr) 62px;
  align-items: center;
  gap: 12px;
}
.mp2-compare-bar > span {
  color: var(--faint);
  font: 600 9.5px/1 var(--font-mono);
}
.mp2-compare-bar > div {
  height: 9px;
  overflow: visible;
  border-radius: 99px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.mp2-compare-bar i {
  position: relative;
  display: block;
  width: var(--bar);
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  transform-origin: left center;
  transition: width 1.05s cubic-bezier(.18, .8, .2, 1);
}
.mp2-bar--0066 { --bar: 6.6%; }
.mp2-bar--0525 { --bar: 52.5%; }
.mp2-bar--0663 { --bar: 66.3%; }
.mp2-bar--1000 { --bar: 100%; }
.mp2-compare-bar i::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: inherit;
  box-shadow: 0 0 10px currentColor;
  transform: translateY(-50%);
}
.mp2-compare-bar--learned i {
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent-deep), var(--accent), var(--success));
}
.mp2-compare-bar--droop i {
  color: var(--accent-2);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-2) 55%, var(--surface)), var(--accent-2));
}
.mp2-compare-bar > b {
  color: var(--ink);
  font: 650 11px/1 var(--font-mono);
  text-align: right;
}
.js .mp2-result-compare.reveal:not(.in) .mp2-compare-bar i { width: 0; }
.js .mp2-result-compare.reveal.in .mp2-compare-row:nth-of-type(3) .mp2-compare-bar i { transition-delay: .15s; }
.js .mp2-result-compare.reveal.in .mp2-compare-row:nth-of-type(4) .mp2-compare-bar i { transition-delay: .3s; }
.mp2-result-compare__note {
  padding: 14px clamp(22px, 3vw, 32px) 17px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}

.mp2-paper-frame img {
  transform: scale(1);
  filter: blur(0);
  transition: opacity .2s ease, transform .32s cubic-bezier(.2, .7, .2, 1), filter .2s ease;
}
.mp2-paper-frame img.is-switching {
  opacity: .24;
  transform: scale(.987);
  filter: blur(2px);
}

@media (max-width: 760px) {
  .mp2-result-compare__head { align-items: flex-start; flex-direction: column; }
  .mp2-compare-row { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 500px) {
  .mp2-result-legend { width: 100%; justify-content: space-between; }
  .mp2-compare-bar { grid-template-columns: 58px minmax(90px, 1fr) 54px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .mp2-hero-visual > a::after { display: none; }
  .mp2-feature-figure .figure__frame,
  .mp2-feature-figure .figure__frame img,
  .mp2-compare-bar i,
  .mp2-paper-frame img,
  .mp2-stats .stat,
  .mp2-verdict-card,
  .mp2-component-grid article,
  .mp2-result-strip article {
    transition: none !important;
  }
  .js .mp2-feature-figure.reveal .figure__frame { clip-path: none; }
  .js .mp2-result-compare.reveal .mp2-compare-bar i { width: var(--bar); }
}

/* Next project nav */
.next-project { border-top: 1px solid var(--line-strong); }
.next-project a {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-block: 36px;
  padding-inline: clamp(14px, 2vw, 22px); margin-inline: calc(-1 * clamp(14px, 2vw, 22px));
  border-radius: var(--r-lg);
  transition: background .25s ease;
}
.next-project a:hover { background: var(--accent-soft); }
.next-project .np-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.next-project .np-title { font-family: var(--font-serif); font-size: clamp(22px, 3.4vw, 30px); font-weight: 600; letter-spacing: -0.02em; transition: color .2s ease; }
.next-project a:hover .np-title { color: var(--accent); }
.next-project .np-arrow { color: var(--accent); flex: none; transition: transform .2s ease; }
.next-project a:hover .np-arrow { transform: translateX(5px); }

/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s cubic-bezier(.2,.7,.2,1), transform .55s cubic-bezier(.2,.7,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .project, .contact__link, .btn__arrow, .theme-toggle, .nav__links a::after,
  .section-head h2::after, .project__link svg, .next-project .np-arrow, .next-project .np-title,
  .kpi, .stat, .figure__frame, .next-project a, .meter i, .mp2-paper-frame img,
  .mp2-verdict-card, .mp2-project-nav a::after,
  .project__media img, .project__media svg, .project__media::before, .project__media::after { transition: none !important; }
  .project:hover .project__media img,
  .project:hover .project__media svg { transform: none; }
  .kpi:hover { transform: none; }
  .rsvg .flow { animation: none !important; }
  .js .reveal .draw1 { stroke-dashoffset: 0 !important; transition: none !important; }
  .js .chart-card.reveal .bar-fill { transition: none !important; }
  .led, .led::after, .brand__mark::after, .footer::before, .contact h2 .caret,
  .project:hover::after, .scroll-progress { animation: none !important; }
  .scroll-progress { display: none; }
  .section-head h2::after { transform: scaleX(1); }
  .hero__canvas { display: none !important; }   /* always show static SVG */
}
