:root {
  color-scheme: light;
  --paper: #f7f1e6;
  --paper-2: #efe5d5;
  --ink: #101314;
  --ink-2: #22292b;
  --muted: #59656a;
  --soft: #77838a;
  --line: #d9cebc;
  --line-strong: #bcae96;
  --panel: #fffaf0;
  --panel-deep: #171d1f;
  --signal: #00a676;
  --signal-dark: #007a59;
  --cyan: #00b8d9;
  --amber: #d98500;
  --steel: #6f7d86;
  --shadow: 0 22px 70px rgba(16, 19, 20, 0.12);
  --max: 1180px;
  --font-display: "Space Grotesk", "Archivo", sans-serif;
  --font-sans: "Archivo", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 19, 20, 0.045) 1px, transparent 1px) 0 0 / 84px 84px,
    linear-gradient(180deg, rgba(16, 19, 20, 0.035) 1px, transparent 1px) 0 0 / 84px 84px,
    var(--paper);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--signal); color: #fff; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
strong { color: var(--ink); font-weight: 700; }
.mono { font-family: var(--font-mono); }
.wrap {
  width: min(var(--max), calc(100vw - 48px));
  margin-inline: auto;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  transform: translateY(-140%);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
  font-weight: 700;
}
.skip-link:focus { transform: none; }

.scroll-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--signal), var(--cyan));
  z-index: 90;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(247, 241, 230, 0.84);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.site-header.scrolled { border-bottom-color: rgba(16, 19, 20, 0.12); }
.nav-wrap {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}
.brand, .primary-nav, .nav-cta { position: relative; z-index: 1; }
.primary-nav, .hero-copy, .ops-panel { min-width: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  display: inline-block;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--signal);
}
.primary-nav {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 2.8vw, 34px);
}
.primary-nav a, .nav-cta {
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.primary-nav a:hover, .nav-cta:hover { color: var(--ink); }
.nav-cta {
  justify-self: end;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 10px 16px;
  background: rgba(255, 250, 240, 0.62);
}

.hero {
  padding: clamp(56px, 7vw, 104px) 0 42px;
  min-height: calc(100svh - 76px);
  display: grid;
  align-content: center;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: clamp(34px, 6vw, 78px);
  align-items: center;
}
.hero-copy h1 {
  margin: 0;
  max-width: 7.2ch;
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 12vw, 9.7rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
  text-wrap: balance;
}
.role-line {
  margin: 24px 0 0;
  max-width: 760px;
  font-family: var(--font-mono);
  font-size: clamp(0.76rem, 1.4vw, 0.92rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--signal-dark);
  overflow-wrap: anywhere;
}
.hero-statement {
  margin: 28px 0 0;
  max-width: 15ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.hero-lede {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  overflow-wrap: break-word;
}
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 38px;
}
.btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  padding: 0 22px;
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 0.22s var(--ease), background 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s var(--ease);
}
.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--signal-dark); }
.btn-quiet { color: var(--ink); border-color: var(--line-strong); background: rgba(255, 250, 240, 0.68); }
.btn-quiet:hover, .btn-outline:hover { border-color: var(--ink); }
.btn-outline { border-color: rgba(255, 250, 240, 0.42); color: #fff; }
.text-link {
  color: var(--muted);
  font-weight: 800;
  border-bottom: 2px solid var(--line-strong);
  padding-bottom: 2px;
}
.text-link:hover { color: var(--ink); border-color: var(--ink); }

.ops-panel {
  background: var(--panel-deep);
  color: #ecf4ed;
  min-height: 620px;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.ops-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(180deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 42px 42px;
  pointer-events: none;
}
.panel-chrome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aab9b1;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 8px rgba(0, 166, 118, 0.14);
}
.ops-panel h2 {
  position: relative;
  max-width: 12ch;
  margin: 38px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.topology {
  position: relative;
  height: 250px;
  margin: 28px 0 10px;
}
.topology-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.topology-lines path {
  fill: none;
  stroke: rgba(0, 184, 217, 0.42);
  stroke-width: 1.5;
  stroke-dasharray: 5 7;
}
.node {
  position: absolute;
  min-width: 74px;
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(236, 244, 237, 0.24);
  background: rgba(16, 19, 20, 0.72);
  color: #f7fff8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.node::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  inset: -4px auto auto -4px;
}
.node-core {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 104px;
  min-height: 50px;
  background: var(--signal);
  color: var(--ink);
  font-weight: 700;
}
.node-a { left: 5%; top: 14%; }
.node-b { right: 6%; top: 12%; }
.node-c { left: 8%; bottom: 16%; }
.node-d { right: 8%; bottom: 18%; }
.node-e { left: 50%; top: 2%; transform: translateX(-50%); border-color: rgba(217, 133, 0, 0.68); }
.activity-grid {
  position: relative;
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 24px;
  border-top: 1px solid rgba(236, 244, 237, 0.18);
  padding-top: 24px;
}
.panel-label {
  display: block;
  font-family: var(--font-mono);
  color: #93a39b;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.activity-grid strong {
  display: block;
  margin-top: 10px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 4.8rem;
  line-height: 0.84;
  letter-spacing: -0.06em;
}
.activity-grid strong + span {
  display: block;
  margin-top: 12px;
  color: #bed0c6;
  font-size: 0.86rem;
}
.fleet {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin: 12px 0 14px;
}
.fleet i {
  aspect-ratio: 1;
  background: var(--signal);
  opacity: 0.85;
}
.fleet i.dim { background: rgba(236, 244, 237, 0.17); opacity: 1; }
.fleet i.warn { background: var(--amber); }
.panel-rows { display: grid; gap: 8px; }
.prow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #aebfb6;
  font-size: 0.72rem;
}
.prow span:last-child { color: #ecf4ed; }
.panel-feed {
  position: relative;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(236, 244, 237, 0.18);
  color: #aab9b1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.74rem;
}

.proof-strip {
  margin-top: clamp(32px, 6vw, 68px);
  border-block: 1px solid var(--line);
  padding: 18px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px clamp(20px, 4vw, 44px);
}
.proof-strip span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.proof-strip strong {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.34rem);
  letter-spacing: -0.02em;
}

.section, .impact-section { padding: clamp(76px, 10vw, 132px) 0; }
.section-index, .metric-kicker, .lane-num, .repo-type {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--signal-dark);
}
.section-intro {
  display: grid;
  grid-template-columns: 0.32fr 1fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
  margin-bottom: clamp(36px, 5vw, 70px);
}
.section-intro h2, .thesis-copy h2, .contact-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.4vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: -0.052em;
}
.section-intro p, .contact-copy p {
  max-width: 670px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
}
.section-intro-split {
  grid-template-columns: 0.32fr 0.98fr 0.7fr;
}

.metric-rail {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  grid-auto-rows: minmax(220px, auto);
  gap: 16px;
}
.metric {
  min-width: 0;
  background: rgba(255, 250, 240, 0.72);
  border: 1px solid var(--line);
  padding: clamp(24px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.24s var(--ease), border-color 0.24s var(--ease), background 0.24s var(--ease);
}
.metric:hover { transform: translateY(-4px); border-color: var(--line-strong); background: var(--panel); }
.metric-wide { grid-row: span 2; background: var(--ink); color: #fff; border-color: var(--ink); }
.metric-tall { grid-row: span 2; background: var(--paper-2); }
.metric strong {
  display: block;
  margin: 18px 0 24px;
  color: inherit;
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 6vw, 5.8rem);
  line-height: 0.86;
  letter-spacing: -0.06em;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
}
.metric-wide .metric-kicker { color: var(--cyan); }
.unit { color: var(--signal); }
.metric p { margin: 0; color: var(--muted); font-size: 1rem; }
.metric-wide p { color: #d7e2dc; }

.thesis-grid {
  display: grid;
  grid-template-columns: minmax(270px, 0.74fr) minmax(0, 1.26fr);
  gap: clamp(34px, 7vw, 96px);
  align-items: start;
}
.portrait-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  box-shadow: 16px 16px 0 var(--ink);
}
.portrait-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 16%;
  filter: saturate(0.9) contrast(1.02);
}
.portrait-meta {
  display: grid;
  gap: 4px;
  padding: 18px 8px 4px;
}
.portrait-meta span {
  font-family: var(--font-mono);
  color: var(--signal-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.portrait-meta strong { font-size: 1.1rem; line-height: 1.25; }
.thesis-copy .lead {
  max-width: 14ch;
  margin: 24px 0 28px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--signal-dark);
}
.thesis-copy p:not(.lead) {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.06rem;
}
.language-block {
  margin-top: 30px;
}
.language-block h3 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  color: var(--signal-dark);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.language-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.language-row span {
  border: 1px solid var(--line-strong);
  background: rgba(255, 250, 240, 0.72);
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}
.language-row strong {
  color: var(--signal-dark);
  font-size: 0.95rem;
  line-height: 1.2;
}
.language-row small {
  color: var(--muted);
  font-size: 0.76rem;
}

.lanes-section {
  background: var(--ink);
  color: #f8f3ea;
}
.lanes-section .section-index, .lanes-section .lane-num { color: var(--cyan); }
.lanes-section .section-intro p, .lanes-section .lane p { color: #c4cfc8; }
.lanes-section .section-intro h2 { color: #fff; }
.lane-list { border-top: 1px solid rgba(255, 250, 240, 0.2); }
.lane {
  display: grid;
  grid-template-columns: 90px minmax(190px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(20px, 4vw, 54px);
  align-items: baseline;
  padding: clamp(28px, 4vw, 46px) 0;
  border-bottom: 1px solid rgba(255, 250, 240, 0.2);
}
.lane h3 {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.lane p { margin: 0; font-size: 1.02rem; }

.timeline {
  position: relative;
  display: grid;
  gap: 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 305px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}
.role {
  position: relative;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 90px;
  padding: clamp(34px, 5vw, 58px) 0;
  border-top: 1px solid var(--line);
}
.role:last-child { border-bottom: 1px solid var(--line); }
.role-marker {
  position: absolute;
  left: 296px;
  top: 54px;
  width: 19px;
  height: 19px;
  border: 3px solid var(--paper);
  background: var(--signal);
  box-shadow: 0 0 0 1px var(--signal-dark);
}
.role-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.54rem;
  line-height: 1.08;
  letter-spacing: -0.032em;
}
.role-head h3 span { color: var(--soft); font-weight: 600; }
.role-head p {
  margin: 12px 0 8px;
  color: var(--signal-dark);
  font-weight: 800;
}
.role-head > span {
  display: block;
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
}
.client-block + .client-block { margin-top: 26px; }
.client-block h4 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  color: var(--steel);
  font-size: 0.8rem;
  font-weight: 600;
}
.role-body ul { margin: 0; padding-left: 20px; color: var(--muted); }
.role-body li + li { margin-top: 10px; }
.role-body li::marker { color: var(--signal); }
.award-line {
  display: inline-block;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: rgba(0, 166, 118, 0.1);
  color: var(--signal-dark);
  border-left: 4px solid var(--signal);
  font-weight: 800;
}
.env-row, .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}
.env-row span, .tag-row span {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.68);
  color: var(--muted);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.stack-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.62);
}
.stack-group {
  min-height: 230px;
  padding: 24px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stack-group:nth-child(6) { border-right: none; }
.stack-group h3 {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--signal-dark);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.stack-group p {
  margin: 42px 0 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.16;
  letter-spacing: -0.026em;
}

.repo-table { border-top: 2px solid var(--ink); }
.repo-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  padding: clamp(26px, 4vw, 40px) 0;
  border-bottom: 1px solid var(--line-strong);
}
.repo-row h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.repo-row p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 720px;
}
.repo-link {
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.repo-link:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.proof-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: stretch;
}
.proof-panel {
  background: rgba(255, 250, 240, 0.72);
  border: 1px solid var(--line);
  padding: clamp(24px, 4vw, 34px);
}
.proof-large { background: var(--paper-2); }
.proof-panel h3 {
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--signal-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.award-item + .award-item { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.award-item p, .proof-panel p { color: var(--muted); margin: 8px 0 0; }
.cert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.cert-list li {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  align-items: center;
}
.cert-list img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 5px;
}
.cert-list small {
  display: block;
  color: var(--soft);
  font-size: 0.82rem;
}
.writing-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}
.writing-panel a {
  color: var(--ink);
  font-weight: 800;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 8px;
}
.writing-panel a:hover { color: var(--signal-dark); border-color: var(--signal-dark); }

.contact-section {
  background: var(--ink);
  color: #fff;
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(32px, 7vw, 96px);
  align-items: start;
}
.contact-copy .section-index { color: var(--cyan); }
.contact-copy h2 { color: #fff; }
.contact-copy p { color: #c4cfc8; }
.contact-copy strong { color: #fff; }
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.contact-card {
  font-style: normal;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px 24px;
  border-top: 1px solid rgba(255, 250, 240, 0.22);
  padding-top: 24px;
}
.contact-card span {
  color: #93a39b;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.contact-card a, .contact-card p {
  margin: 0;
  color: #fff;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.footer {
  background: var(--ink);
  color: #c4cfc8;
  padding: 0 0 46px;
}
.footer .wrap {
  border-top: 1px solid rgba(255, 250, 240, 0.2);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.footer span { font-size: 0.86rem; }

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.72s var(--ease), transform 0.72s var(--ease);
  }
  .reveal.in { opacity: 1; transform: none; }
  .node::before { animation: pulse 2.8s ease-out infinite; }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 166, 118, 0.45); }
    75%, 100% { box-shadow: 0 0 0 14px rgba(0, 166, 118, 0); }
  }
}

@media (max-width: 1100px) {
  .hero-grid, .thesis-grid, .contact-grid { grid-template-columns: 1fr; }
  .ops-panel { min-height: 560px; }
  .section-intro, .section-intro-split { grid-template-columns: 1fr; gap: 18px; }
  .metric-rail { grid-template-columns: repeat(2, 1fr); }
  .metric-wide, .metric-tall { grid-row: auto; }
  .timeline::before, .role-marker { display: none; }
  .role { grid-template-columns: 1fr; gap: 20px; }
  .stack-board { grid-template-columns: repeat(3, 1fr); }
  .stack-group:nth-child(3) { border-right: none; }
  .stack-group:nth-child(n+4) { border-top: 1px solid var(--line); }
  .stack-group:nth-child(6) { border-right: none; }
}

@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body {
    background:
      linear-gradient(90deg, rgba(16, 19, 20, 0.045) 1px, transparent 1px) 0 0 / 52px 52px,
      linear-gradient(180deg, rgba(16, 19, 20, 0.035) 1px, transparent 1px) 0 0 / 52px 52px,
      var(--paper);
  }
  .wrap {
    width: calc(100vw - 34px);
    max-width: var(--max);
  }
  .hero-grid { display: block; }
  .hero-copy,
  .hero-copy > *,
  .hero-statement,
  .role-line,
  .hero-lede {
    max-width: calc(100vw - 34px);
  }
  .nav-wrap { grid-template-columns: 1fr auto; min-height: 68px; }
  .primary-nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: start;
    overflow-x: auto;
    padding: 0 0 12px;
    gap: 18px;
    scrollbar-width: none;
  }
  .primary-nav::-webkit-scrollbar { display: none; }
  .primary-nav a { white-space: nowrap; }
  .hero { padding-top: 42px; }
  .hero-copy h1 {
    max-width: 6.4ch;
    font-size: clamp(3.55rem, 17vw, 4.9rem);
    line-height: 0.9;
  }
  .hero-statement { max-width: 12ch; }
  .role-line {
    font-size: 0.68rem;
    line-height: 1.75;
    letter-spacing: 0.1em;
  }
  .hero-lede {
    font-size: 0.96rem;
    line-height: 1.58;
  }
  .hero-actions .btn { width: 100%; }
  .ops-panel { min-height: auto; padding: 22px; }
  .topology { height: 210px; }
  .activity-grid { grid-template-columns: 1fr; }
  .proof-strip { align-items: flex-start; flex-direction: column; }
  .metric-rail, .proof-grid { grid-template-columns: 1fr; }
  .metric { min-height: 210px; }
  .language-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lane { grid-template-columns: 1fr; gap: 12px; }
  .repo-row { grid-template-columns: 1fr; gap: 14px; }
  .repo-link { width: max-content; }
  .stack-board { grid-template-columns: 1fr; }
  .stack-group {
    min-height: 160px;
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .stack-group:first-child { border-top: none; }
  .contact-card { grid-template-columns: 1fr; gap: 6px; }
  .footer .wrap { flex-direction: column; }
}

@media (max-width: 430px) {
  .primary-nav { display: none; }
  .nav-wrap { padding-block: 0; }
  .node { min-width: 62px; font-size: 0.65rem; padding-inline: 8px; }
  .node-core { min-width: 88px; }
  .section, .impact-section { padding: 64px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Theme toggle control
   ============================================================ */
.nav-end {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .sun { display: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .moon { display: block; fill: currentColor; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* soft cross-fade when switching themes */
body, .site-header { transition: background-color 0.3s var(--ease), color 0.3s var(--ease); }

/* ============================================================
   Dark theme
   ============================================================ */
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1211;
  --paper-2: #171d1c;
  --ink: #eef3f0;
  --ink-2: #d3dbd7;
  --muted: #9aa7a2;
  --soft: #7d8a85;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.20);
  --panel: #1a201f;
  --panel-deep: #161d1f;
  --signal: #12c48c;
  --signal-dark: #37d6a3;
  --cyan: #34c7e6;
  --steel: #909c9f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

/* page grid lines flip to light-on-dark */
[data-theme="dark"] body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 84px 84px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 84px 84px,
    var(--paper);
}
@media (max-width: 760px) {
  [data-theme="dark"] body {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 52px 52px,
      linear-gradient(180deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 52px 52px,
      var(--paper);
  }
}

/* translucent light surfaces that assumed a paper page */
[data-theme="dark"] .site-header { background: rgba(14, 18, 17, 0.82); }
[data-theme="dark"] .site-header.scrolled { border-bottom-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] :is(.nav-cta, .btn-quiet, .metric, .language-row span, .env-row span, .tag-row span, .stack-board, .proof-panel) {
  background: rgba(255, 255, 255, 0.035);
}

/* inverted sections that used --ink as their dark background */
[data-theme="dark"] .metric-wide { background: var(--panel-deep); border-color: var(--line-strong); }
[data-theme="dark"] .lanes-section,
[data-theme="dark"] .contact-section,
[data-theme="dark"] .footer { background: var(--panel-deep); }

/* buttons that used --ink as a fill stay visible via the accent */
[data-theme="dark"] .btn-primary { background: var(--signal); color: #05130d; }
[data-theme="dark"] .btn-primary:hover { background: var(--signal-dark); }
[data-theme="dark"] .repo-link:hover { background: var(--signal); color: #05130d; border-color: var(--signal); }

/* the bold offset portrait shadow becomes an accent instead of a bright block */
[data-theme="dark"] .portrait-card { box-shadow: 16px 16px 0 var(--signal-dark); }
