:root {
  color-scheme: dark light;
  --ink: #eef5f1;
  --muted: #a8bbb4;
  --obsidian: #0c1513;
  --deep: #122824;
  --panel: #172f2a;
  --panel-light: #e9e4d8;
  --foam: #f7f5ef;
  --river: #49d5bd;
  --river-dark: #0d6258;
  --ember: #ff9773;
  --gold: #f0c86e;
  --line: rgba(238, 245, 241, .16);
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --page: min(1320px, calc(100vw - 48px));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--obsidian);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; text-underline-offset: .25em; }

button,
input,
select { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--river);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--obsidian);
  background: var(--foam);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  padding: 0 max(24px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line);
}

.site-header > p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.site-header > a:last-child {
  justify-self: end;
  color: var(--river);
  font-size: .8rem;
  font-weight: 750;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
}

.brand img { display: block; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, .6fr);
  gap: clamp(48px, 8vw, 120px);
  align-items: end;
  width: var(--page);
  margin: 0 auto;
  padding: clamp(72px, 9vw, 130px) 0 72px;
}

.eyebrow,
.field-label {
  margin: 0 0 15px;
  color: var(--river);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p { margin-top: 0; }

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.035em;
}

h1 {
  max-width: 900px;
  margin-bottom: 28px;
  font-size: clamp(3rem, 6vw, 6.3rem);
  line-height: .95;
}

h1 em { color: var(--river); font-weight: 500; }

.lede {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
}

.verdict {
  padding: 28px;
  border: 1px solid var(--ember);
  background: rgba(255, 151, 115, .06);
}

.verdict-label {
  margin-bottom: 8px;
  color: var(--ember);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.verdict strong {
  display: block;
  margin-bottom: 14px;
  color: var(--ember);
  font-family: var(--mono);
  font-size: 2.1rem;
}

.verdict p:last-child { margin: 0; color: var(--muted); font-size: .88rem; }

.corpus-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: var(--page);
  margin: 0 auto 100px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.corpus-strip div { padding: 25px 20px 25px 0; }
.corpus-strip strong { display: block; color: var(--river); font-family: var(--serif); font-size: 2rem; }
.corpus-strip span { color: var(--muted); font-size: .76rem; }
.corpus-strip > p { grid-column: 1 / -1; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .64rem; overflow-wrap: anywhere; }

.boundary,
.explorer,
.mutations,
.limits {
  padding: 100px max(24px, calc((100vw - 1320px) / 2));
}

.boundary { background: var(--deep); }

.section-heading {
  display: grid;
  grid-template-columns: .5fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.section-heading .eyebrow { grid-row: 1 / span 2; }
.section-heading h2 { margin-bottom: 10px; font-size: clamp(2.5rem, 4vw, 4.6rem); line-height: 1; }
.section-heading > p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); }

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.boundary-grid article { min-height: 270px; padding: 28px 26px 28px 0; border-bottom: 1px solid var(--line); }
.boundary-grid article + article { padding-left: 26px; border-left: 1px solid var(--line); }
.boundary-grid span { color: var(--muted); font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
.boundary-grid h3 { margin: 45px 0 14px; font-size: 1.55rem; }
.boundary-grid p { margin: 0; color: var(--muted); font-size: .86rem; }
.boundary-grid .inside { background: linear-gradient(180deg, rgba(73, 213, 189, .08), transparent); }
.boundary-grid .inside span { color: var(--river); }

.explorer { background: var(--panel-light); color: var(--obsidian); }
.explorer .eyebrow { color: var(--river-dark); }
.explorer .section-heading > p:last-child { color: #52605c; }

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, .38fr) minmax(0, 1fr);
  min-height: 740px;
  border: 1px solid rgba(12, 21, 19, .2);
  background: var(--foam);
}

.scenario-browser { padding: 28px; border-right: 1px solid rgba(12, 21, 19, .18); background: #ded9cc; }
.field-group + .field-group { margin-top: 18px; }
label { display: block; margin-bottom: 7px; font-size: .75rem; font-weight: 750; }
input,
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--obsidian);
  background: var(--foam);
  border: 1px solid rgba(12, 21, 19, .35);
  border-radius: 0;
}

input:disabled,
select:disabled { cursor: not-allowed; opacity: .65; }

.result-count { margin: 18px 0 9px; color: #53615d; font-family: var(--mono); font-size: .64rem; }
.scenario-list,
.mutation-list { margin: 0; padding: 0; list-style: none; }
.scenario-list { max-height: 520px; overflow: auto; border-top: 1px solid rgba(12, 21, 19, .18); }
.scenario-list button,
.mutation-list button {
  width: 100%;
  padding: 13px 3px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(12, 21, 19, .16);
  text-align: left;
  cursor: pointer;
}
.scenario-list button:hover,
.scenario-list button[aria-current="true"] { color: var(--river-dark); background: rgba(13, 98, 88, .07); }
.scenario-list strong { display: block; font-size: .82rem; }
.scenario-list span { display: block; color: #45534f; font-family: var(--mono); font-size: .58rem; text-transform: uppercase; }

.trace-panel { min-width: 0; padding: clamp(26px, 4vw, 52px); }
.trace-heading { display: flex; justify-content: space-between; gap: 22px; align-items: start; }
.trace-heading h3 { margin: 0 0 7px; font-size: clamp(2rem, 3.5vw, 3.5rem); line-height: 1; }
.identifier { margin: 0; color: #62716c; font-family: var(--mono); font-size: .65rem; overflow-wrap: anywhere; }
.step-count { flex: 0 0 auto; padding: 7px 10px; color: var(--river-dark); border: 1px solid var(--river-dark); font-family: var(--mono); font-size: .65rem; }

.step-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px 0 20px; }
.step-controls button {
  min-height: 42px;
  padding: 8px 15px;
  color: var(--obsidian);
  background: transparent;
  border: 1px solid rgba(12, 21, 19, .35);
  cursor: pointer;
}
.step-controls button:disabled { cursor: not-allowed; opacity: .45; }
.step-controls button:not(:disabled):hover { color: var(--foam); background: var(--river-dark); }

.step-timeline { display: flex; gap: 6px; margin: 0 0 24px; padding: 0; list-style: none; }
.step-timeline li { flex: 1; min-width: 8px; height: 4px; background: rgba(12, 21, 19, .15); }
.step-timeline li.complete { background: var(--river-dark); }
.step-timeline li.current { background: var(--ember); }

.step-card { padding: clamp(22px, 3vw, 38px); color: var(--ink); background: var(--deep); }
.step-action h4 { max-width: 800px; margin-bottom: 10px; font-size: clamp(1.45rem, 2.5vw, 2.25rem); line-height: 1.15; }
.step-action > p:last-child { color: var(--muted); font-size: .74rem; }
code { font-family: var(--mono); overflow-wrap: anywhere; }

.trace-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 32px 0 0; border-top: 1px solid var(--line); }
.trace-grid div { min-width: 0; padding: 18px 16px 18px 0; border-bottom: 1px solid var(--line); }
.trace-grid div:not(:nth-child(3n+1)) { padding-left: 16px; border-left: 1px solid var(--line); }
dt { color: var(--muted); font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; }
dd { margin: 5px 0 0; font-size: .78rem; overflow-wrap: anywhere; }
dd[data-tone="positive"] { color: var(--river); }
dd[data-tone="pending"] { color: var(--gold); }
dd[data-tone="negative"] { color: var(--ember); }

.state-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding: 25px 0; border-bottom: 1px solid var(--line); }
.state-row div { min-width: 0; }
.state-row div:last-child { text-align: right; }
.state-row span,
.evidence-row span { display: block; color: var(--muted); font-family: var(--mono); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
.state-row code { font-size: .67rem; }

.evidence-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 24px; }
.evidence-row p { min-width: 0; margin: 0; }
.evidence-row code { font-size: .64rem; }

.vector-summary { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.vector-summary summary { color: var(--river); cursor: pointer; font-size: .78rem; font-weight: 750; }
.vector-summary dl { display: grid; grid-template-columns: repeat(5, 1fr); margin: 18px 0; border-top: 1px solid var(--line); }
.vector-summary dl div { min-width: 0; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); }
.vector-summary dl div:not(:nth-child(5n+1)) { padding-left: 12px; border-left: 1px solid var(--line); }
.vector-summary > p { margin: 0; color: var(--muted); font-size: .68rem; }

.trace-provenance { margin-top: 20px; padding: 18px 0; border-top: 1px solid rgba(12, 21, 19, .18); border-bottom: 1px solid rgba(12, 21, 19, .18); }
.trace-provenance summary { cursor: pointer; font-weight: 750; }
.trace-provenance dl { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.trace-provenance dt { color: #45534f; }
.trace-provenance ul { padding-left: 20px; color: #52605c; font-size: .75rem; }

.mutations { background: var(--deep); }
.mutations .result-count { color: var(--muted); }
.mutation-layout { display: grid; grid-template-columns: minmax(260px, .55fr) 1fr; gap: 55px; }
.mutation-list { max-height: 450px; overflow: auto; border-top: 1px solid var(--line); }
.mutation-list button { color: var(--ink); border-color: var(--line); }
.mutation-list button:hover,
.mutation-list button[aria-current="true"] { color: var(--river); background: rgba(73, 213, 189, .06); }
.mutation-list strong { display: block; font-family: var(--mono); font-size: .67rem; overflow-wrap: anywhere; }
.mutation-list span { color: var(--muted); font-size: .67rem; }
.mutation-detail { align-self: start; padding: clamp(25px, 4vw, 48px); border: 1px solid var(--line); background: var(--panel); }
.mutation-detail h3 { margin-bottom: 30px; font-size: clamp(1.7rem, 3vw, 3rem); overflow-wrap: anywhere; }
.mutation-detail dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; }
.mutation-detail dl div { min-width: 0; padding: 16px 16px 16px 0; border-top: 1px solid var(--line); }
.mutation-detail dl div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }

.limits { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; background: var(--obsidian); }
.limits h2 { max-width: 550px; font-size: clamp(2.4rem, 4vw, 4.5rem); line-height: 1; }
.limits ul { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.limits li { padding: 18px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .72rem; text-transform: uppercase; }

.no-script { margin: 0; padding: 35px max(24px, calc((100vw - 1320px) / 2)); color: var(--obsidian); background: var(--gold); }
.no-script h2 { margin-bottom: 8px; }
.no-script p { max-width: 800px; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px max(24px, calc((100vw - 1320px) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
footer p { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .hero,
  .section-heading,
  .limits { grid-template-columns: 1fr; }
  .section-heading .eyebrow { grid-row: auto; }
  .boundary-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .scenario-browser { border-right: 0; border-bottom: 1px solid rgba(12, 21, 19, .18); }
  .scenario-list { max-height: 280px; }
  .mutation-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  :root { --page: min(100% - 32px, 1320px); }
  .site-header { grid-template-columns: 1fr auto; padding: 12px 16px; }
  .site-header > p { display: none; }
  .site-header > a:last-child { font-size: .7rem; }
  .hero { padding-top: 62px; }
  .corpus-strip { grid-template-columns: repeat(2, 1fr); }
  .boundary,
  .explorer,
  .mutations,
  .limits { padding: 72px 16px; }
  .boundary-grid,
  .trace-grid,
  .mutation-detail dl { grid-template-columns: 1fr; }
  .boundary-grid article + article,
  .trace-grid div:not(:nth-child(3n+1)),
  .mutation-detail dl div:nth-child(even) { padding-left: 0; border-left: 0; }
  .trace-grid div { padding-left: 0; }
  .trace-heading { display: block; }
  .step-count { display: inline-block; margin-top: 15px; }
  .evidence-row { grid-template-columns: 1fr; }
  .trace-provenance dl { grid-template-columns: 1fr; }
  .vector-summary dl { grid-template-columns: repeat(2, 1fr); }
  .vector-summary dl div:not(:nth-child(5n+1)) { padding-left: 0; border-left: 0; }
  .vector-summary dl div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
  footer { display: block; }
}

@media (max-width: 360px) {
  .brand span { display: none; }
  h1 { font-size: 2.65rem; }
  .corpus-strip { grid-template-columns: 1fr; }
  .state-row { grid-template-columns: 1fr; }
  .state-row > span { transform: rotate(90deg); justify-self: start; }
  .state-row div:last-child { text-align: left; }
  .vector-summary dl { grid-template-columns: 1fr; }
  .vector-summary dl div:nth-child(even) { padding-left: 0; border-left: 0; }
}

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