/* ============================================================
   Luis A. Figueroa — Portfolio
   Design system + components. No frameworks, no build step.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --c-1: #4d8dff;   /* signal blue  */
  --c-2: #f2b544;   /* gold         */
  --c-3: #3fdcc0;   /* mint         */
  --c-4: #a78bfa;   /* violet       */

  --max: 1180px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  --nav-h: 68px;
}

html[data-theme='dark'] {
  --bg: #070a12;
  --bg-2: #0b1020;
  --surface: rgba(255, 255, 255, .034);
  --surface-2: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --ink: #e9edf8;
  --ink-2: #9aa7c4;
  --ink-3: #6b7796;
  --glow: rgba(77, 141, 255, .3);
  --shadow: 0 24px 60px -22px rgba(0, 0, 0, .85);
  --grid-line: rgba(255, 255, 255, .045);
  --scrim: rgba(3, 5, 10, .78);
}

html[data-theme='light'] {
  --bg: #f6f7fb;
  --bg-2: #ffffff;
  --surface: rgba(12, 20, 40, .028);
  --surface-2: rgba(12, 20, 40, .05);
  --line: rgba(12, 20, 40, .11);
  --line-2: rgba(12, 20, 40, .2);
  --ink: #0d1425;
  --ink-2: #4a5570;
  --ink-3: #77819c;
  --glow: rgba(48, 105, 220, .2);
  --shadow: 0 22px 50px -26px rgba(16, 28, 56, .38);
  --grid-line: rgba(12, 20, 40, .045);
  --scrim: rgba(232, 235, 245, .82);
  --c-1: #2f6fe0;
  --c-2: #c98614;
  --c-3: #14a58c;
  --c-4: #7c5cf0;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 20px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(.95rem, .35vw + .88rem, 1.04rem);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}
body.is-locked { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

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

svg[viewBox] { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.filled { fill: currentColor; stroke: none; }

.wrap { width: min(100% - (var(--gut) * 2), var(--max)); margin-inline: auto; }

/* Hairline grid.
   Flex-wrap rather than CSS grid so a partial final row stretches to fill
   instead of leaving empty tracks; separators are outlines (which overlap
   between neighbours) rather than gap-coloured background, so there is
   never a stray filled block. */
.gridlines {
  display: flex; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.section--alt .gridlines { background: var(--bg-2); }
.gridlines > * { flex: 1 1 var(--cell, 200px); min-width: 0; outline: 1px solid var(--line); }

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 200;
  padding: .6rem 1rem; background: var(--c-1); color: #fff; border-radius: var(--r-sm);
  transform: translateY(-160%); transition: transform .25s var(--ease);
}
.skip:focus { transform: none; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -.025em; }
h2 { font-size: clamp(1.95rem, 4.4vw, 3.15rem); }
h3 { font-size: clamp(1.05rem, 1.5vw, 1.28rem); letter-spacing: -.01em; }

.eyebrow {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before {
  content: ''; width: 26px; height: 1px; background: currentColor; opacity: .55;
}

.shead { max-width: 62ch; margin-bottom: clamp(2.2rem, 5vw, 3.4rem); }
.shead h2 { margin-top: .9rem; }
.shead__lede { margin-top: 1.05rem; color: var(--ink-2); font-size: 1.02em; }

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

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .72rem 1.15rem; border-radius: 100px;
  background: var(--btn-bg); border: 1px solid var(--line);
  font-size: .9rem; font-weight: 500; letter-spacing: -.005em;
  transition: border-color .22s, background .22s, transform .22s var(--ease), color .22s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--line-2); transform: translateY(-2px); background: var(--surface-2); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--c-1); border-color: transparent; color: #fff;
  box-shadow: 0 10px 30px -12px var(--glow);
}
.btn--primary:hover { background: var(--c-1); filter: brightness(1.08); box-shadow: 0 16px 38px -12px var(--glow); }
.btn--ghost { background: transparent; }
.btn--sm { padding: .5rem .85rem; font-size: .82rem; }

.iconbtn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
  transition: color .2s, border-color .2s, background .2s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.iconbtn svg { width: 17px; height: 17px; }

.linklike { color: var(--ink-2); border-bottom: 1px dashed var(--line-2); }
.linklike:hover { color: var(--ink); }

kbd {
  font-family: var(--font-mono); font-size: .66rem; padding: .12rem .34rem;
  border: 1px solid var(--line); border-radius: 5px; color: var(--ink-3);
  background: var(--surface); line-height: 1.5;
}

/* ---------- Scroll rail ---------- */
.scroll-rail { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 90; pointer-events: none; }
.scroll-rail span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-1), var(--c-3));
  box-shadow: 0 0 12px var(--glow);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 1.2rem;
  padding-inline: var(--gut);
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--line);
}

.nav__brand { display: flex; align-items: center; gap: .7rem; flex: none; }
.nav__mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; font-family: var(--font-display); font-weight: 700; font-size: .78rem;
  letter-spacing: .03em; color: #fff;
  background: linear-gradient(135deg, var(--c-1), var(--c-4));
  box-shadow: 0 6px 18px -8px var(--glow);
}
.nav__brandtext { display: flex; flex-direction: column; line-height: 1.2; }
.nav__brandtext b { font-family: var(--font-display); font-size: .88rem; font-weight: 600; letter-spacing: -.015em; }
.nav__brandtext i {
  font-style: normal; font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3);
}

.nav__links { display: flex; gap: .15rem; margin-left: auto; }
.nav__links a {
  position: relative; padding: .45rem .72rem; border-radius: 8px;
  font-size: .82rem; color: var(--ink-2); transition: color .2s, background .2s;
}
.nav__links a:hover { color: var(--ink); background: var(--surface); }
.nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after {
  content: ''; position: absolute; left: .72rem; right: .72rem; bottom: .16rem;
  height: 2px; border-radius: 2px; background: var(--c-1);
}

.nav__actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav__links + .nav__actions { margin-left: 1rem; }

.kbtn {
  display: flex; align-items: center; gap: .5rem;
  padding: .42rem .6rem .42rem .68rem; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink-3); font-size: .8rem;
  transition: color .2s, border-color .2s, background .2s;
}
.kbtn svg { width: 15px; height: 15px; }
.kbtn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }

.i-moon { display: none; }
html[data-theme='light'] .i-sun { display: none; }
html[data-theme='light'] .i-moon { display: block; }

.nav__burger { display: none; flex-direction: column; gap: 4px; }
.nav__burger span { width: 16px; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.nav__burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav__burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 1000px) {
  .kbtn span { display: none; }
  .kbtn kbd { display: none; }
}
@media (max-width: 560px) {
  :root { --nav-h: 62px; }
  .nav { gap: .6rem; }
  .nav__actions { gap: .35rem; }
  .btn--sm span { display: none; }
  .btn--sm { padding: .5rem .6rem; }
  .nav__brandtext b { font-size: .82rem; }
}
@media (max-width: 860px) {
  .nav__burger { display: flex; }
  .nav__brandtext i { display: none; }
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; gap: .2rem; padding: 1rem var(--gut) 1.6rem;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s var(--ease);
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: .7rem .6rem; font-size: .95rem; }
  .nav__links a.is-active::after { left: .6rem; right: auto; width: 14px; bottom: .5rem; }
  .nav__links + .nav__actions { margin-left: auto; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: grid; align-items: center;
  padding: calc(var(--nav-h) + 4vh) var(--gut) 8vh;
  overflow: hidden;
  isolation: isolate;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero__veil {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(70% 55% at 50% 0%, transparent, var(--bg) 78%),
    linear-gradient(180deg, transparent 55%, var(--bg) 98%);
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(72% 62% at 50% 42%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(72% 62% at 50% 42%, #000 20%, transparent 78%);
}

.hero__inner { width: min(100% - 0px, var(--max)); margin-inline: auto; }

.hero__status {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .38rem .85rem .38rem .6rem; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .77rem; color: var(--ink-2);
  backdrop-filter: blur(8px);
}
.pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--c-3); flex: none; }
.pulse::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--c-3); animation: ping 2.4s var(--ease-io) infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

.hero__name {
  margin: 1.4rem 0 0;
  font-size: clamp(3.1rem, 12.5vw, 9.5rem);
  font-weight: 700; letter-spacing: -.045em; line-height: .9;
  /* line-height < 1 pulls the line box above the descenders; reserve room so
     the "g" tail clears the text below at every size. */
  padding-bottom: .1em;
}
/* Masked only while the text slides in; main.js unmasks on transitionend so
   descenders are not clipped at rest. Falls back to visible without JS.
   flow-root so the span's negative margin below cannot collapse out. */
.hero__name .l { display: flow-root; }
.hero__name .l:not(.is-revealed) { overflow: hidden; }
.hero__name .l > span {
  display: block;
  background: linear-gradient(180deg, var(--ink) 32%, color-mix(in srgb, var(--ink) 46%, var(--bg)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  /* The glyphs are painted by this background, and a background never paints
     outside its own box — so with line-height < 1 the "g" descender fell
     outside it and came out transparent. Extend the box past the descender
     and take the space straight back, leaving layout untouched. */
  padding-bottom: .25em;
  margin-bottom: -.25em;
}
html[data-theme='light'] .hero__name .l > span {
  background-image: linear-gradient(180deg, var(--ink) 42%, color-mix(in srgb, var(--ink) 62%, var(--bg)) 100%);
}

.hero__rotator {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .8rem;
  margin-top: 1.5rem; font-family: var(--font-mono); font-size: clamp(.75rem, 1.5vw, .88rem);
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.hero__rotator-static { color: var(--c-1); }
.hero__rotator-slot { display: inline-block; height: 1.5em; overflow: hidden; vertical-align: bottom; }
.hero__rotator-track { display: flex; flex-direction: column; transition: transform .62s var(--ease); }
.hero__rotator-track em {
  font-style: normal; height: 1.5em; line-height: 1.5em; white-space: nowrap; flex: none;
}
.hero__rotator-sep { opacity: .4; }
/* Stacked on narrow screens, where the separator would dangle at a line end. */
@media (max-width: 620px) {
  .hero__rotator { flex-direction: column; gap: .35rem; }
  .hero__rotator-sep { display: none; }
}

.hero__lede {
  margin-top: 1.6rem; max-width: 46ch;
  font-size: clamp(1.02rem, 1.3vw, 1.2rem); color: var(--ink-2);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 2.2rem; }

.hero__metrics { --cell: 170px; margin-top: clamp(3rem, 7vw, 4.6rem); }
.hero__metrics li { background: var(--bg); padding: 1.1rem 1.15rem 1.2rem; transition: background .3s; }
.hero__metrics li:hover { background: var(--bg-2); }
.metric__n {
  font-family: var(--font-display); font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  font-weight: 700; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--c-1), var(--c-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__metrics li:nth-child(2) .metric__n { background-image: linear-gradient(120deg, var(--c-2), var(--c-1)); -webkit-background-clip: text; background-clip: text; }
.hero__metrics li:nth-child(4) .metric__n { background-image: linear-gradient(120deg, var(--c-4), var(--c-1)); -webkit-background-clip: text; background-clip: text; }
.metric__l { margin-top: .5rem; font-size: .8rem; color: var(--ink-2); line-height: 1.4; }
.metric__note { margin-top: .25rem; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-3); letter-spacing: .04em; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%);
  width: 22px; height: 34px; border: 1px solid var(--line-2); border-radius: 12px;
  display: grid; justify-items: center; padding-top: 7px; opacity: .7;
}
.hero__scroll span { width: 2px; height: 6px; border-radius: 2px; background: var(--ink-2); animation: wheel 2s var(--ease-io) infinite; }
@keyframes wheel { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(8px); opacity: .2; } }

/* ---------- Sections ---------- */
.section { padding: clamp(4.5rem, 11vw, 8.5rem) 0; position: relative; }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line); }
html[data-theme='dark'] .section--alt { background: #090d18; }

/* Scroll reveal */
[data-anim] { opacity: 0; transform: translateY(22px); transition: opacity .75s var(--ease), transform .75s var(--ease); }
[data-anim].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-anim] { opacity: 1; transform: none; transition: none; }
}

/* ---------- Summary ---------- */
.summary { display: grid; gap: clamp(2rem, 5vw, 3.5rem); grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; }
@media (max-width: 900px) { .summary { grid-template-columns: 1fr; } }

.summary__lede { font-size: clamp(1.1rem, 1.7vw, 1.32rem); line-height: 1.55; letter-spacing: -.015em; }
.summary__text > div p { margin-top: 1.15rem; color: var(--ink-2); }
.summary__text strong { color: var(--ink); font-weight: 600; }

.summary__sig { margin-top: 2rem; opacity: .5; }
.sig { width: 190px; height: 48px; color: var(--c-1); stroke-width: 2.4; }
.sig path { stroke-dasharray: 700; stroke-dashoffset: 700; }
.in .sig path { animation: draw 2.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.pillars { --cell: 100%; }
.pillar { background: var(--bg); padding: 1.4rem 1.5rem; position: relative; transition: background .3s; }
.section--alt .pillar { background: var(--bg-2); }
.pillar:hover { background: var(--surface-2); }
.pillar__k { font-family: var(--font-mono); font-size: .68rem; color: var(--c-1); letter-spacing: .12em; }
.pillar h3 { margin-top: .55rem; font-size: 1.02rem; }
.pillar p { margin-top: .5rem; font-size: .89rem; color: var(--ink-2); line-height: 1.6; }

/* ---------- Dashboard ---------- */
.dash { display: grid; gap: clamp(1rem, 2vw, 1.4rem); grid-template-columns: repeat(3, 1fr); }
.card--wide { grid-column: span 2; }
@media (max-width: 980px) {
  .dash { grid-template-columns: 1fr; }
  .card--wide { grid-column: auto; }
}

.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(1.3rem, 2.4vw, 1.9rem);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
html[data-theme='dark'] .card { background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.008)); }
.card__head h3 { font-size: 1.14rem; }
.card__head p { margin-top: .35rem; font-size: .86rem; color: var(--ink-3); }
.card__foot { margin-top: 1.4rem; font-size: .74rem; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: .02em; line-height: 1.6; }

/* Trajectory chart */
.traj { margin-top: 1.6rem; }
.traj + .traj { margin-top: 2.2rem; padding-top: 2.2rem; border-top: 1px solid var(--line); }
.traj__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; justify-content: space-between; }
.traj__label { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.traj__sub { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); letter-spacing: .05em; }
.traj__delta {
  font-family: var(--font-mono); font-size: .8rem; font-weight: 500;
  padding: .18rem .55rem; border-radius: 6px;
  background: color-mix(in srgb, var(--tc) 16%, transparent);
  color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent);
}
.traj__chart { position: relative; margin-top: 1rem; }
.traj__chart svg { width: 100%; height: auto; overflow: visible; }
.traj__line { stroke: var(--tc); stroke-width: 2.4; fill: none; }
.in .traj__line { animation: draw 1.9s .25s var(--ease) forwards; }
.traj__area { opacity: 0; stroke: none; }
.traj__chart svg { shape-rendering: geometricPrecision; }
.in .traj__area { animation: fadein .9s 1.1s var(--ease) forwards; }
@keyframes fadein { to { opacity: 1; } }
.traj__dot { fill: var(--bg); stroke: var(--tc); stroke-width: 2.4; opacity: 0; transform-box: fill-box; transform-origin: center; }
.in .traj__dot { animation: pop .5s var(--ease) forwards; }
.traj__dot.d2 { animation-delay: 1.9s; }
.traj__dot.d1 { animation-delay: .3s; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
/* Sizes below are SVG user units, so they scale with the viewBox.
   Narrow viewports scale the chart down hard — compensate. */
.traj__tag { font-family: var(--font-mono); font-size: 13px; fill: var(--ink-2); stroke: none; }
.traj__grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
@media (max-width: 760px) {
  .traj__tag { font-size: 24px; }
  .traj__grid { stroke-width: 2; stroke-dasharray: 6 9; }
  .traj__line { stroke-width: 4.5; }
  .traj__dot { stroke-width: 4.5; r: 9; }
}
.traj__note { margin-top: .9rem; font-size: .85rem; color: var(--ink-2); max-width: 62ch; }

/* Gauges */
.gauges { display: grid; gap: 1.15rem; margin-top: 1.5rem; }
.gauge { display: grid; grid-template-columns: 62px 1fr; gap: .95rem; align-items: center; }
.gauge__ring { position: relative; width: 62px; height: 62px; }
.gauge__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge__track { stroke: var(--line); stroke-width: 5; }
.gauge__arc { stroke: var(--gc); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 163.4; stroke-dashoffset: 163.4; transition: stroke-dashoffset 1.5s .3s var(--ease); }
.gauge__val {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 500; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.gauge__meta b { display: block; font-family: var(--font-display); font-size: .92rem; font-weight: 600; letter-spacing: -.01em; }
.gauge__meta span { display: block; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-3); letter-spacing: .05em; margin-top: .1rem; }
.gauge__meta i { display: block; font-style: normal; font-size: .8rem; color: var(--ink-2); margin-top: .3rem; line-height: 1.45; }

/* Scale */
.scale { --cell: 165px; margin-top: 1.6rem; }
.scale__cell { background: var(--bg); padding: 1.15rem 1.2rem; }
html[data-theme='dark'] .scale__cell { background: #0a0e1a; }
.scale__n { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.scale__from { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); margin-top: .35rem; }
.scale__l { margin-top: .5rem; font-size: .84rem; color: var(--ink-2); }
.scale__bar { margin-top: .7rem; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.scale__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c-1), var(--c-3)); transition: width 1.6s .4s var(--ease); }

/* Ledger marquee */
.ledger { margin-top: clamp(2rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
html[data-theme='dark'] .ledger { background: #0a0e1a; }
.ledger__label {
  padding: .55rem 1rem; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3);
}
.ledger__viewport { overflow: hidden; padding: .85rem 0; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ledger__track { display: flex; gap: 2.2rem; width: max-content; animation: slide 60s linear infinite; }
.ledger:hover .ledger__track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }
.ledger__item { display: flex; align-items: center; gap: .7rem; font-size: .85rem; color: var(--ink-2); white-space: nowrap; }
.ledger__item::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--c-2); flex: none; }
@media (prefers-reduced-motion: reduce) {
  .ledger__track { animation: none; flex-wrap: wrap; width: 100%; padding-inline: 1rem; gap: .7rem 2rem; }
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 2.4rem; }
.chip {
  padding: .45rem .9rem; border-radius: 100px; border: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-2); background: transparent;
  transition: all .22s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip[aria-selected='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip__c { font-family: var(--font-mono); font-size: .68rem; opacity: .6; margin-left: .35rem; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: clamp(1.6rem, 4vw, 2.6rem); }
.timeline__rail { position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline__rail span { position: absolute; inset: 0 0 auto 0; height: 0; background: linear-gradient(180deg, var(--c-1), var(--c-3)); box-shadow: 0 0 10px var(--glow); }
@media (max-width: 640px) { .timeline { padding-left: 1.5rem; } }

.timeline__list { display: grid; gap: .7rem; }

.role {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg);
  transition: opacity .4s var(--ease), transform .4s var(--ease), border-color .25s, background .25s, max-height .4s;
}
.section--alt .role { background: var(--bg-2); }
.role.is-hidden { display: none; }
.role::before {
  content: ''; position: absolute; left: calc(clamp(1.6rem, 4vw, 2.6rem) * -1 + 2px);
  top: 26px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line-2); transition: border-color .25s, background .25s, box-shadow .25s;
}
@media (max-width: 640px) { .role::before { left: -1.4rem; } }
.role:hover { border-color: var(--line-2); }
.role:hover::before, .role.is-current::before { border-color: var(--c-1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-1) 14%, transparent); }
.role.is-current::before { background: var(--c-1); }

.role__btn { display: block; width: 100%; text-align: left; padding: 1.15rem clamp(1.1rem, 2.5vw, 1.6rem); }
.role__top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.role__period {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em;
  color: var(--ink-3); flex: none; min-width: 108px;
}
.role.is-current .role__period { color: var(--c-1); }
.role__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1rem, 1.6vw, 1.14rem); letter-spacing: -.015em; flex: 1 1 auto; min-width: 0; }
.role__signal {
  font-family: var(--font-mono); font-size: .7rem; padding: .2rem .55rem; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.role__org { margin-top: .4rem; margin-left: 0; font-size: .88rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: baseline; }
.role__org b { font-weight: 500; color: var(--ink); }
.role__org span { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); }
.role__more {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .85rem;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--c-1);
}
.role__more svg { width: 13px; height: 13px; transition: transform .25s var(--ease); }
.role__btn:hover .role__more svg { transform: translateX(3px); }

@media (min-width: 720px) {
  .role__org { margin-left: calc(108px + .9rem); }
  .role__more { margin-left: calc(108px + .9rem); }
}

/* ---------- Matrix ---------- */
.matrix { display: grid; gap: clamp(1rem, 2vw, 1.4rem); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .matrix { grid-template-columns: 1fr; } }

.mgroup {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.3rem, 2.2vw, 1.7rem);
  background: var(--bg); position: relative; overflow: hidden;
  transition: border-color .3s, transform .3s var(--ease);
}
.mgroup:hover { border-color: var(--line-2); transform: translateY(-3px); }
.mgroup::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 2px;
  background: linear-gradient(90deg, var(--mc), transparent);
}
.mgroup__icon {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px;
  background: color-mix(in srgb, var(--mc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--mc) 26%, transparent); color: var(--mc);
}
.mgroup__icon svg { width: 19px; height: 19px; }
.mgroup h3 { margin-top: 1rem; font-size: 1.02rem; }
.mgroup ul { margin-top: 1.1rem; display: grid; gap: .55rem; }
.mgroup li {
  display: flex; gap: .6rem; font-size: .875rem; color: var(--ink-2); line-height: 1.5;
  padding-left: 0; transition: color .2s, transform .2s var(--ease);
}
.mgroup li::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--mc); flex: none; margin-top: .55rem; opacity: .7; }
.mgroup li:hover { color: var(--ink); transform: translateX(3px); }

/* ---------- Footprint ---------- */
.fgroup + .fgroup { margin-top: 2.6rem; }
.fgroup__head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.fgroup__head h3 { font-size: .95rem; }
.fgroup__head::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--fc); flex: none; }
.fgroup__head span { font-family: var(--font-mono); font-size: .66rem; color: var(--ink-3); margin-left: auto; letter-spacing: .06em; }

.fgrid { --cell: 190px; }
.fcell {
  background: var(--bg); padding: 1rem 1.05rem; position: relative; overflow: hidden;
  transition: background .3s;
}
.fcell:hover { background: color-mix(in srgb, var(--fc) 8%, var(--bg)); }
.fcell:focus-visible { outline: 2px solid var(--c-1); outline-offset: -2px; z-index: 1; }
.fcell__abbr { font-family: var(--font-display); font-weight: 700; font-size: .92rem; letter-spacing: -.01em; color: var(--fc); }
.fcell__name { margin-top: .25rem; font-size: .8rem; color: var(--ink); line-height: 1.4; }
.fcell__note { margin-top: .45rem; font-size: .73rem; color: var(--ink-3); line-height: 1.5; opacity: 0; max-height: 0; transition: opacity .3s, max-height .35s var(--ease); }
.fcell:hover .fcell__note, .fcell:focus-within .fcell__note { opacity: 1; max-height: 60px; }
@media (hover: none) { .fcell__note { opacity: 1; max-height: 60px; } }

/* ---------- Credentials ---------- */
.creds { display: grid; gap: clamp(1rem, 2vw, 1.4rem); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cred {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.3rem, 2.2vw, 1.7rem);
  background: var(--bg);
}
.cred > .eyebrow { margin-bottom: 1.2rem; }
.cred__item + .cred__item { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.cred__item b { display: block; font-family: var(--font-display); font-size: .96rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.cred__item span { display: block; margin-top: .3rem; font-size: .85rem; color: var(--ink-2); }
.cred__item i { font-style: normal; font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); }

.fw { display: grid; gap: .45rem; }
.fw__item {
  padding: .42rem .8rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-size: .82rem; cursor: default; position: relative;
  transition: border-color .2s, color .2s;
}
.fw__item:hover { border-color: var(--c-1); color: var(--ink); }
.fw__item small { display: block; font-family: var(--font-mono); font-size: .63rem; color: var(--ink-3); margin-top: .1rem; }

/* ---------- Contact ---------- */
.section--contact { position: relative; overflow: hidden; }
.section--contact::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(50% 60% at 50% 100%, var(--glow), transparent 70%);
  opacity: .5; pointer-events: none;
}
.contact { position: relative; text-align: center; max-width: 720px; margin-inline: auto; }
.contact .eyebrow { justify-content: center; }
.contact h2 { margin-top: 1rem; }
.contact .shead__lede { margin-inline: auto; max-width: 56ch; }
.contact__cta { display: flex; flex-wrap: wrap; gap: .65rem; justify-content: center; margin-top: 2.4rem; }
.contact__grid {
  --cell: 250px; margin-top: 2rem; text-align: left;
}
.ccell { background: var(--bg); padding: 1.15rem 1.2rem; display: block; transition: background .25s; }
.ccell:hover { background: var(--surface-2); }
.ccell__k { display: flex; align-items: center; gap: .5rem; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.ccell__k svg { width: 13px; height: 13px; }
.ccell__v { margin-top: .55rem; font-size: .95rem; font-weight: 500; overflow-wrap: anywhere; }
a.ccell:hover .ccell__v { color: var(--c-1); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 2rem 0; font-size: .82rem; color: var(--ink-3); }
.foot__inner { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between; align-items: center; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: clamp(.75rem, 3vw, 2rem); }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadein .28s var(--ease) forwards; opacity: 0; }
.modal__panel {
  position: relative; width: min(100%, 780px); max-height: min(88svh, 900px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7);
  animation: rise .38s var(--ease) forwards; opacity: 0;
}
html[data-theme='dark'] .modal__panel { background: #0c111e; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
.modal__x {
  position: sticky; float: right; top: .85rem; right: .85rem; margin: .85rem .85rem -2.6rem 0;
  width: 34px; height: 34px; display: grid; place-items: center; z-index: 2;
  border-radius: 9px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2);
  transition: color .2s, border-color .2s;
}
.modal__x:hover { color: var(--ink); border-color: var(--line-2); }
.modal__x svg { width: 16px; height: 16px; }
.modal__body { padding: clamp(1.6rem, 3.5vw, 2.6rem); }

.rd__period { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; color: var(--c-1); }
.rd__title { margin-top: .7rem; font-size: clamp(1.35rem, 3vw, 1.85rem); }
.rd__org { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: baseline; color: var(--ink-2); font-size: .92rem; }
.rd__org b { color: var(--ink); font-weight: 600; }
.rd__org span { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-3); }
.rd__summary { margin-top: 1.3rem; color: var(--ink-2); font-size: .95rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.rd__list { margin-top: 1.4rem; display: grid; gap: 1.05rem; }
.rd__list li { display: grid; grid-template-columns: 18px 1fr; gap: .8rem; }
.rd__list li::before {
  content: ''; width: 6px; height: 6px; margin-top: .55rem; margin-left: 6px;
  border-radius: 2px; background: var(--c-1); transform: rotate(45deg);
}
.rd__list b { display: block; font-family: var(--font-display); font-size: .95rem; font-weight: 600; letter-spacing: -.01em; }
.rd__list p { margin-top: .3rem; font-size: .89rem; color: var(--ink-2); line-height: 1.62; }
.rd__tags { margin-top: 1.7rem; padding-top: 1.4rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .4rem; }
.rd__tag { font-family: var(--font-mono); font-size: .7rem; padding: .28rem .6rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.rd__nav { margin-top: 1.7rem; display: flex; gap: .5rem; justify-content: space-between; }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 140; display: grid; align-items: start; justify-items: center; padding: clamp(3rem, 12vh, 9rem) 1rem 1rem; }
.palette[hidden] { display: none; }
.palette__scrim { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; animation: fadein .22s var(--ease) forwards; }
.palette__panel {
  position: relative; width: min(100%, 620px);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .75); overflow: hidden;
  animation: rise .28s var(--ease) forwards; opacity: 0;
}
html[data-theme='dark'] .palette__panel { background: #0d121f; }
.palette__inputwrap { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); }
.palette__inputwrap svg { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.palette__inputwrap input { flex: 1; border: 0; background: none; outline: none; font-size: .95rem; min-width: 0; }
.palette__inputwrap input::placeholder { color: var(--ink-3); }
.palette__results { max-height: min(46svh, 400px); overflow-y: auto; padding: .45rem; overscroll-behavior: contain; }
.palette__results:empty { display: none; }
.pres {
  display: flex; align-items: center; gap: .8rem; padding: .62rem .75rem;
  border-radius: 9px; cursor: pointer; transition: background .14s;
}
.pres[aria-selected='true'] { background: var(--surface-2); }
.pres__ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-family: var(--font-mono); font-size: .6rem; flex: none; letter-spacing: .02em; }
.pres__t { flex: 1; min-width: 0; }
.pres__t b { display: block; font-size: .89rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres__t span { display: block; font-size: .74rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres__k { font-family: var(--font-mono); font-size: .62rem; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; flex: none; }
.palette__empty { padding: 1.6rem 1rem; text-align: center; color: var(--ink-3); font-size: .88rem; }
.palette__foot { display: flex; gap: 1.1rem; padding: .6rem 1.1rem; border-top: 1px solid var(--line); font-size: .68rem; color: var(--ink-3); }
.palette__foot span { display: flex; align-items: center; gap: .3rem; }

/* ---------- Print ---------- */
@media print {
  :root { --ink: #000; --ink-2: #333; --ink-3: #555; --line: #ccc; --bg: #fff; --bg-2: #fff; }
  html[data-theme='dark'] { --ink: #000; --ink-2: #333; --ink-3: #555; --line: #ccc; --bg: #fff; --bg-2: #fff; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.45; }
  .nav, .scroll-rail, .hero__canvas, .hero__veil, .hero__scroll, .hero__cta, .modal, .palette,
  .filters, .ledger, .foot__meta, .summary__sig, .card__foot, .role__more, .traj__chart, .gauges,
  .section--contact::before, .hero__status { display: none !important; }
  .hero { min-height: auto; padding: 0 0 1rem; page-break-after: avoid; }
  .hero::before { display: none; }
  .hero__name { font-size: 26pt; }
  .hero__lede { font-size: 10.5pt; }
  .section { padding: .9rem 0; border: 0; background: #fff !important; }
  .card, .cred, .mgroup, .role, .fgrid, .hero__metrics, .pillars, .contact__grid, .scale { box-shadow: none; border-color: #ccc; background: #fff !important; }
  .role { page-break-inside: avoid; }
  [data-anim] { opacity: 1 !important; transform: none !important; }
  a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 8pt; color: #666; }
}
