:root {
  --ink: #111823;
  --ink-soft: #293442;
  --paper: #f4efe4;
  --paper-deep: #e8dfd0;
  --white: #fffdf8;
  --muted: #697381;
  --line: #c7c0b4;
  --coral: #f26f5e;
  --teal: #31b7a7;
  --yellow: #f3be54;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.17em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

.skip-link {
  position: absolute;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--yellow);
  color: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.2rem clamp(1.25rem, 4vw, 4.5rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand-lockup,
.site-header nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.brand-lockup a {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  text-decoration: none;
}

.brand-lockup span,
.site-header nav,
.site-footer .footer-meta,
.eyebrow,
.section-marker,
.demo-topline,
.demo-label,
.script-tag,
.score-label,
.score-note,
.answer-label,
.formula-label,
.callout-kicker,
.sample-index,
.sample-value,
.source-date,
.source-list span,
.boundary-strip span,
.answer-stamp span {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.brand-lockup span {
  color: var(--muted);
}

.site-header nav {
  justify-content: flex-end;
  font-size: 0.85rem;
}

.site-header nav a,
.site-footer nav a {
  text-decoration: none;
}

.site-header nav a:hover,
.site-footer nav a:hover {
  color: var(--coral);
}

.language-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  background: var(--ink);
  color: var(--white);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(22rem, 0.92fr);
  gap: clamp(2rem, 5vw, 6rem);
  max-width: 1400px;
  min-height: 43rem;
  margin: 0 auto;
  padding: clamp(2.7rem, 7vw, 6rem) clamp(1.25rem, 4vw, 4.5rem) clamp(3rem, 7vw, 6rem);
  background: var(--ink);
  color: var(--white);
}

.hero-copy {
  align-self: center;
  max-width: 44rem;
}

.eyebrow {
  margin: 0 0 1.3rem;
  color: var(--teal);
}

.hero h1 {
  max-width: 13ch;
  margin: 0;
  color: var(--white);
  font-family: var(--display);
  font-size: clamp(3.5rem, 7.7vw, 7.1rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.88;
}

.hero h1 em {
  color: var(--yellow);
  font-style: normal;
}

.deck {
  max-width: 39rem;
  margin: 2rem 0 1.4rem;
  color: #e4e8e3;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.45;
}

.deck strong {
  color: var(--yellow);
}

.audience-cue {
  max-width: 35rem;
  margin: 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--coral);
  color: #d6ddd8;
  font-size: 0.92rem;
}

.audience-cue span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--coral);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.source-cue {
  margin: 1rem 0 0;
  color: #aeb9bd;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.25rem;
  margin-top: 2rem;
  color: var(--white);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.hero-rail a {
  min-height: 2.75rem;
  padding: 0.65rem 0;
  text-decoration: none;
}

.hero-rail a::before {
  margin-right: 0.35rem;
  color: var(--teal);
  content: "↘";
}

.hero-demo {
  align-self: center;
  max-width: 31rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0.8rem 0.8rem 0 var(--coral);
}

.demo-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.demo-label {
  margin: 1.25rem 0 0.45rem;
  color: var(--muted);
}

.audio-boundary {
  margin: 1.25rem 0 0.9rem;
  padding: 0.9rem 0.9rem 0.8rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--coral);
}

.audio-boundary > span {
  color: var(--coral);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.audio-boundary p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.4;
}

.audio-boundary a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 0.35rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

audio {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  accent-color: var(--coral);
}

.transcript-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.3rem 0 1.2rem;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.5;
}

.script-tag {
  color: var(--coral);
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.score-card {
  min-width: 0;
  padding: 0.95rem 0.9rem 0.85rem;
  background: var(--paper-deep);
  border-top: 4px solid var(--muted);
}

.score-card-single {
  border-top-color: var(--coral);
}

.score-card-lattice {
  border-top-color: var(--teal);
}

.score-card.is-active {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.score-label,
.score-note {
  display: block;
  letter-spacing: 0.07em;
}

.score-label {
  color: var(--muted);
}

.score-value {
  display: block;
  margin: 0.35rem 0;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.08em;
  line-height: 1;
}

.score-card-single .score-value {
  color: var(--coral);
}

.score-card-lattice .score-value {
  color: #168679;
}

.score-note {
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.4;
}

.judge-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.1rem 0 0;
  padding: 0;
  border: 0;
}

.judge-toggle legend {
  width: 100%;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.judge-toggle label {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.75rem;
  background: var(--white);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.82rem;
}

.judge-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0 0.45rem 0 0;
  accent-color: var(--coral);
}

.live-result {
  min-height: 2.9rem;
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.answer-stamp {
  margin: 1.1rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.answer-stamp span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--coral);
}

.content-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(3.2rem, 7vw, 6rem) clamp(1.25rem, 7vw, 7rem);
  border-bottom: 1px solid var(--line);
}

.section-marker {
  margin-bottom: 1.5rem;
  color: var(--coral);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: start;
}

.section-grid-wide {
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.65fr);
}

h2 {
  max-width: 16ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.96;
}

.section-lede {
  max-width: 38rem;
  margin: 1.2rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  line-height: 1.45;
}

.content-section > p,
.method-note,
.license-note {
  max-width: 57rem;
  margin: 2rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.answer-block,
.formula-card,
.source-callout {
  padding: 1.25rem;
  background: var(--ink);
  color: var(--white);
}

.answer-label,
.formula-label,
.callout-kicker {
  color: var(--yellow);
}

.answer-flow {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin: 1rem 0 0.6rem;
  color: var(--white);
  font-family: var(--display);
  font-size: clamp(2.2rem, 4.4vw, 4.2rem);
  letter-spacing: -0.08em;
  line-height: 1;
}

.answer-flow strong:first-child {
  color: var(--coral);
}

.answer-flow strong:last-child {
  color: var(--teal);
}

.answer-flow span {
  color: var(--paper-deep);
  font-family: var(--sans);
  font-size: 1.25rem;
}

.answer-block p,
.formula-card p,
.source-callout p {
  margin: 0;
  color: #dbe0db;
  font-size: 0.86rem;
}

.notation-key {
  display: grid;
  grid-template-columns: 0.7rem 1fr;
  gap: 0.55rem 0.7rem;
  align-content: start;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.key-dot {
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.25rem;
  border-radius: 50%;
}

.key-dot-selected {
  background: var(--teal);
}

.key-dot-plain {
  background: var(--line);
}

.lattice-figure,
.sample-figure {
  margin: 3rem 0 0;
}

.lattice-list,
.sample-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lattice-row {
  display: grid;
  grid-template-columns: 2.5rem 5.2rem minmax(0, 1fr) 9rem;
  gap: 1rem;
  align-items: center;
  min-width: 0;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.lattice-row:last-child {
  border-bottom: 1px solid var(--line);
}

.slot-number {
  color: var(--coral);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
}

.slot-label,
.slot-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.variant-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.variant {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  max-width: 100%;
  padding: 0.45rem 0.7rem;
  overflow-wrap: anywhere;
  background: var(--white);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.88rem;
}

.variant-selected {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--ink);
  font-weight: 700;
}

figcaption {
  max-width: 58rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.formula-card {
  border-left: 4px solid var(--yellow);
}

.formula-card code {
  display: block;
  margin: 0.75rem 0;
  color: var(--white);
  font-family: var(--mono);
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.table-wrap {
  max-width: 100%;
  margin-top: 2.5rem;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  background: var(--white);
  text-align: left;
}

caption {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  padding: 0.95rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

thead th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody th {
  font-weight: 700;
}

tbody td:last-child {
  color: var(--coral);
  font-family: var(--mono);
}

td code,
.content-section p code {
  padding: 0.08rem 0.22rem;
  background: var(--paper-deep);
  font-family: var(--mono);
  font-size: 0.9em;
}

.method-note {
  padding-left: 1rem;
  border-left: 3px solid var(--yellow);
  font-size: 0.86rem;
}

.dataset-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.dataset-facts div {
  min-width: 0;
  padding: 0.9rem 0.7rem;
  background: var(--ink);
  color: var(--white);
}

.dataset-facts strong {
  display: block;
  color: var(--yellow);
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.2vw, 2.8rem);
  letter-spacing: -0.08em;
  line-height: 1;
}

.dataset-facts span {
  display: block;
  margin-top: 0.45rem;
  color: #d9dfda;
  font-family: var(--mono);
  font-size: 0.61rem;
  line-height: 1.35;
  text-transform: uppercase;
}

.sample-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) 3rem;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.75rem;
  border-top: 1px solid var(--line);
}

.sample-row:last-child {
  border-bottom: 1px solid var(--line);
}

.sample-index {
  color: var(--muted);
}

.sample-bar-wrap {
  height: 0.9rem;
  background: var(--paper-deep);
}

.sample-bar {
  display: block;
  height: 100%;
  background: var(--teal);
}

.bar-5 { width: 5%; }
.bar-10 { width: 10%; }
.bar-15 { width: 15%; }
.bar-20 { width: 20%; }
.bar-25 { width: 25%; }
.bar-30 { width: 30%; }
.bar-35 { width: 35%; }
.bar-40 { width: 40%; }
.bar-45 { width: 45%; }
.bar-50 { width: 50%; }
.bar-55 { width: 55%; }
.bar-60 { width: 60%; }
.bar-65 { width: 65%; }
.bar-70 { width: 70%; }
.bar-75 { width: 75%; }
.bar-80 { width: 80%; }
.bar-85 { width: 85%; }
.bar-90 { width: 90%; }
.bar-95 { width: 95%; }
.bar-100 { width: 100%; }

.sample-value {
  color: var(--ink-soft);
  text-align: right;
}

.boundary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: baseline;
  max-width: 60rem;
  margin: 2rem 0 0;
  padding: 1rem 1.1rem;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.boundary-strip span {
  color: var(--coral);
}

.source-callout {
  border-right: 4px solid var(--teal);
}

.source-callout a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 1.1rem;
  color: var(--yellow);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.limits-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.limits-list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.limits-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.limits-list span {
  color: var(--coral);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
}

.limits-list p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.source-date {
  padding: 1rem;
  background: var(--yellow);
  color: var(--ink);
  text-align: right;
}

.source-date strong {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 2.3rem;
  letter-spacing: -0.08em;
  line-height: 0.85;
}

.source-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 2.4rem;
}

.source-list a {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) minmax(11rem, 0.45fr);
  gap: 1rem;
  align-items: center;
  min-height: 3.4rem;
  padding: 0.7rem 0.8rem;
  background: var(--white);
  border-left: 3px solid var(--teal);
  text-decoration: none;
}

.source-list a:hover {
  border-left-color: var(--coral);
}

.source-list span {
  color: var(--coral);
}

.source-list strong {
  font-size: 0.92rem;
}

.source-list small {
  color: var(--muted);
  font-size: 0.76rem;
}

.license-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 4.5rem) 3rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer nav {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.site-footer p {
  margin: 0;
}

.site-footer .footer-meta {
  color: var(--muted);
  text-align: right;
}

.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.25rem;
  background: var(--ink);
  color: var(--white);
}

.error-card {
  width: min(100%, 40rem);
  padding: clamp(2rem, 7vw, 5rem);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0.8rem 0.8rem 0 var(--coral);
}

.error-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.08em;
  line-height: 0.94;
}

.error-card p:not(.eyebrow) {
  max-width: 30rem;
  margin: 1.4rem 0 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 1.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.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: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-demo {
    max-width: 100%;
  }

  .hero-demo {
    width: min(100%, 39rem);
  }

  .section-grid,
  .section-grid-wide {
    grid-template-columns: 1fr;
  }

  h2 {
    max-width: 18ch;
  }

  .source-date {
    width: min(100%, 10rem);
    text-align: left;
  }

  .site-footer {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer .footer-meta {
    text-align: left;
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.7rem;
  }

  .site-header nav a:first-child {
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero {
    min-height: auto;
    padding-top: 2.4rem;
    padding-bottom: 3.2rem;
  }

  .hero h1 {
    font-size: clamp(3.2rem, 16vw, 5.3rem);
  }

  .deck {
    font-size: 1rem;
  }

  .hero-demo {
    box-shadow: 0.45rem 0.45rem 0 var(--coral);
  }

  .demo-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .score-grid,
  .dataset-facts {
    grid-template-columns: 1fr 1fr;
  }

  .dataset-facts div:last-child {
    grid-column: 1 / -1;
  }

  .lattice-row {
    grid-template-columns: 2rem 1fr;
    gap: 0.45rem 0.7rem;
  }

  .lattice-row .slot-label {
    grid-column: 2;
    grid-row: 1;
  }

  .lattice-row .variant-rail,
  .lattice-row .slot-count {
    grid-column: 2;
  }

  .slot-count {
    padding-bottom: 0.15rem;
  }

  .variant {
    font-size: 0.8rem;
  }

  .source-list a {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.55rem;
  }

  .source-list small {
    grid-column: 2;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
