:root {
  color-scheme: dark;
  --bg: #050906;
  --panel: #09140e;
  --panel-strong: #0d1c14;
  --line: #1d3a29;
  --line-strong: #2c6042;
  --text: #ecfff3;
  --muted: #89a695;
  --dim: #587064;
  --green: #56f09a;
  --green-dark: #0e3c25;
  --cyan: #72d6ff;
  --amber: #ffc65c;
  --coral: #ff8f70;
  --header-height: 68px;
  --content: 1180px;
  font-family: Bahnschrift, "Segoe UI Variable", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 20px); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); line-height: 1.6; }
body, button, a { letter-spacing: 0; }
a { color: inherit; }
button { font: inherit; }
img { display: block; max-width: 100%; }
code, pre, .eyebrow, .wordmark, .status, .metric, .flow, .flag, .site-footer {
  font-family: "Cascadia Code", "IBM Plex Mono", Consolas, ui-monospace, monospace;
}
h1, h2, h3, p { overflow-wrap: anywhere; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 8px 12px;
  background: var(--green);
  color: #041008;
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 6, .94);
  backdrop-filter: blur(14px);
}
.wordmark { width: max-content; text-decoration: none; font-size: 18px; font-weight: 900; }
.wordmark span { color: var(--green); }
.site-nav { position: relative; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font: 700 11px "Cascadia Code", Consolas, monospace;
  text-transform: uppercase;
}
.nav-links a b { margin-right: 6px; color: var(--dim); }
.nav-links a:hover { color: var(--text); }
.status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 118px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  color: var(--green);
  font-size: 10px;
}
.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(86, 240, 154, .6);
  animation: status-pulse 2.8s ease-in-out infinite;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.menu-toggle { display: none; }

.hero {
  position: relative;
  isolation: isolate;
  min-height: min(780px, calc(100svh - var(--header-height) - 54px));
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .85fr);
  align-items: center;
  gap: 72px;
  padding: 68px max(24px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
}
.hero-texture {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .29;
  filter: saturate(.86) contrast(1.08);
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(5, 9, 6, .61);
}
.hero-copy { max-width: 620px; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 28px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 72px;
  line-height: .92;
  font-weight: 900;
}
h1 span { color: var(--green); }
.lede { max-width: 630px; margin: 0; color: #aac4b4; font-size: 17px; line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease;
}
.button-primary { border-color: var(--green); background: var(--green); color: #031008; }
.button-secondary { background: rgba(9, 20, 14, .88); color: var(--text); }
.button:hover { transform: translateY(-2px); }

.packet-scope {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(7, 17, 12, .94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .38);
}
.packet-scope figcaption, .trace-heading, .sequence {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font: 700 10px "Cascadia Code", Consolas, monospace;
}
.packet-scope figcaption strong { color: var(--green); }
.window-row {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  align-items: end;
  gap: 10px;
  margin: 26px 0;
}
.window-row small { display: block; color: var(--muted); font: 700 9px "Cascadia Code", Consolas, monospace; }
.window-row b { display: block; margin-top: 5px; font: 900 34px "Cascadia Code", Consolas, monospace; }
.window-row div:last-child b { color: var(--green); }
.window-arrow { align-self: center; color: var(--green); text-align: center; font-size: 24px; }
.request-trace { padding-top: 20px; border-top: 1px solid var(--line); }
.trace-heading strong { color: var(--cyan); }
.segment-line {
  display: grid;
  grid-template-columns: 17fr 66fr;
  gap: 4px;
  height: 54px;
  margin: 12px 0 10px;
}
.segment { display: grid; place-items: center; min-width: 0; font: 900 12px "Cascadia Code", Consolas, monospace; }
.segment-first { background: var(--green); color: #041008; }
.segment-second { border: 1px solid var(--line-strong); background: var(--green-dark); color: var(--green); }
.scope-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px dashed var(--line-strong); color: var(--muted); font-size: 12px; }

.metric-band { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metric { min-height: 134px; padding: 24px max(20px, calc((100vw - var(--content)) / 8)); border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric b { display: block; color: var(--green); font-size: 27px; line-height: 1.1; }
.metric:nth-child(3) b { color: var(--cyan); }
.metric span, .metric small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; }
.metric small { margin-top: 3px; color: var(--dim); }
.evidence-boundary {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: var(--content);
  margin: 28px auto 0;
  padding: 18px 20px;
  border-left: 3px solid var(--amber);
  background: #16160d;
  color: #c9c8ae;
}
.boundary-mark { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border: 1px solid var(--amber); color: var(--amber); font-weight: 900; }
.evidence-boundary p { margin: 0; font-size: 13px; }

.section { max-width: var(--content); margin: 0 auto; padding: 100px 24px; }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: end; margin-bottom: 42px; }
.section-heading .eyebrow { grid-column: 1 / -1; margin-bottom: -30px; }
.section-heading h2 { margin: 0; max-width: 720px; font-size: 42px; line-height: 1.12; }
.section-heading > p:last-child { margin: 0; color: var(--muted); }

.flow { display: flex; align-items: stretch; overflow-x: auto; padding-bottom: 8px; }
.flow-node {
  flex: 0 0 168px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.flow-node small { color: var(--dim); font-size: 9px; }
.flow-node b { margin-top: 5px; color: #bdd4c5; font-size: 10px; }
.flow-node.active { border-color: var(--green); background: var(--green-dark); }
.flow-node.active b { color: var(--green); }
.flow-link { flex: 1 0 36px; align-self: center; height: 2px; background: var(--green); animation: link-pulse 2.4s ease-in-out infinite; }
.flow-note { margin: 18px 0 0; color: var(--dim); font-size: 12px; }

.code-compare { display: grid; grid-template-columns: 1fr 72px 1fr; align-items: stretch; }
.code-panel { min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); }
.code-panel.muted { opacity: .72; }
.code-panel header { display: flex; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--dim); font: 700 10px "Cascadia Code", Consolas, monospace; }
.code-panel header strong { color: var(--muted); }
.code-panel pre { min-height: 290px; margin: 0; overflow-x: auto; padding: 24px; color: #bdd4c5; font-size: 13px; line-height: 1.75; }
.code-panel mark { background: transparent; color: var(--coral); }
.code-panel:not(.muted) mark { color: var(--green); }
.code-dim, .code-comment { color: var(--dim); }
.code-panel footer { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; min-height: 76px; padding: 16px 18px; border-top: 1px solid var(--line); }
.code-panel footer p { margin: 0; color: var(--muted); font-size: 12px; }
.flag { padding: 4px 7px; border: 1px solid currentColor; font-size: 8px; }
.flag-warn { color: var(--coral); }
.flag-ok { color: var(--green); }
.rewrite-arrow { display: grid; place-items: center; align-content: center; color: var(--green); font: 900 20px "Cascadia Code", Consolas, monospace; }
.rewrite-arrow span { color: var(--dim); font-size: 8px; writing-mode: vertical-rl; }
.preserved-grid, .answer-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 30px; border: 1px solid var(--line); }
.preserved-grid > div, .answer-grid article { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.preserved-grid > div:last-child, .answer-grid article:last-child { border-right: 0; }
.preserved-grid span, .answer-grid span { color: var(--green); font: 700 10px "Cascadia Code", Consolas, monospace; }
.preserved-grid b { display: block; margin-top: 10px; }
.preserved-grid p, .answer-grid p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.command-list { display: grid; gap: 14px; }
.command-block { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.command-block header { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 7px 8px 7px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font: 700 10px "Cascadia Code", Consolas, monospace; }
.copy-button { flex: 0 0 38px; font-size: 18px; }
.copy-button[data-state="copied"] { border-color: var(--green); color: var(--green); }
.copy-button[data-state="failed"] { border-color: var(--coral); color: var(--coral); }
.command-block pre { margin: 0; overflow-x: auto; padding: 20px; color: #cae5d5; font-size: 12px; }
.command-block.cleanup { border-color: #5e5331; }
.command-block.cleanup > p { margin: 0; padding: 0 20px 18px; color: var(--amber); font-size: 12px; }

.answer-grid { margin-top: 0; }
.answer-grid h3 { margin: 18px 0 0; font-size: 18px; }
.final-verdict { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: center; margin-top: 28px; padding: 24px; border: 1px solid var(--green); background: var(--green-dark); }
.final-verdict > span { color: var(--green); font: 900 12px "Cascadia Code", Consolas, monospace; }
.final-verdict p { margin: 0; color: #bfe6ce; }
.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px max(24px, calc((100vw - var(--content)) / 2)); border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }
.site-footer strong { color: var(--muted); }

@keyframes status-pulse { 50% { opacity: .38; } }
@keyframes link-pulse { 50% { opacity: .28; } }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; max-height: none; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .section-heading { grid-template-columns: 1fr; gap: 18px; }
  .section-heading .eyebrow { grid-column: auto; margin-bottom: 0; }
  .code-compare { grid-template-columns: 1fr; gap: 14px; }
  .rewrite-arrow { min-height: 48px; transform: rotate(90deg); }
  .preserved-grid, .answer-grid { grid-template-columns: repeat(2, 1fr); }
  .preserved-grid > div:nth-child(2), .answer-grid article:nth-child(2) { border-right: 0; }
  .preserved-grid > div:nth-child(-n + 2), .answer-grid article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  :root { --header-height: 62px; }
  .site-header { grid-template-columns: 1fr auto auto; gap: 10px; padding: 0 16px; }
  .menu-toggle { display: inline-grid; gap: 4px; }
  .menu-toggle span { width: 16px; height: 1px; background: currentColor; }
  .nav-links { position: absolute; top: 48px; right: 0; display: none; min-width: 190px; padding: 8px; border: 1px solid var(--line-strong); background: var(--panel-strong); }
  .nav-links[data-open="true"] { display: grid; }
  .nav-links a { min-height: 42px; display: flex; align-items: center; padding: 0 10px; }
  .status { min-width: 36px; width: 36px; padding: 0; justify-content: center; }
  .status span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hero { min-height: auto; gap: 38px; padding: 46px 18px 42px; }
  h1 { font-size: 48px; }
  .lede { font-size: 15px; }
  .packet-scope { padding: 18px; }
  .window-row b { font-size: 26px; }
  .sequence { font-size: 8px; }
  .metric { min-height: 116px; padding: 20px 16px; }
  .metric b { font-size: 22px; }
  .evidence-boundary { margin: 18px; }
  .section { padding: 72px 18px; }
  .section-heading h2 { font-size: 32px; }
  .flow { flex-direction: column; overflow: visible; }
  .flow-node { flex-basis: auto; min-height: 74px; }
  .flow-link { flex: 0 0 28px; width: 2px; align-self: center; }
  .preserved-grid, .answer-grid { grid-template-columns: 1fr; }
  .preserved-grid > div, .answer-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .preserved-grid > div:nth-child(2), .answer-grid article:nth-child(2) { border-bottom: 1px solid var(--line); }
  .preserved-grid > div:last-child, .answer-grid article:last-child { border-bottom: 0; }
  .final-verdict { grid-template-columns: 1fr; gap: 8px; }
  .site-footer { flex-direction: column; padding: 22px 18px; }
}

@media (max-width: 390px) {
  h1 { font-size: 43px; }
  .hero-actions { display: grid; }
  .window-row { grid-template-columns: 1fr 30px 1fr; }
  .window-row small { min-height: 29px; }
  .segment-line { grid-template-columns: 22fr 61fr; }
}

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