:root {
  --paper: #f7f4ee;
  --paper-strong: #eee8dc;
  --white: #fffdf9;
  --ink: #172033;
  --muted: #626a78;
  --line: #d9d2c6;
  --navy: #15263f;
  --blue: #235c8f;
  --blue-open: #e7f0f6;
  --gold: #ad7229;
  --shadow: 0 16px 42px rgba(23, 32, 51, 0.09);
  --radius: 16px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--gold);
}

a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #dc9841;
  outline-offset: 4px;
}

img,
video {
  display: block;
  width: 100%;
}

p {
  margin-top: 0;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--serif);
  font-weight: 650;
  line-height: 1.08;
  text-wrap: balance;
}

h1 {
  max-width: 900px;
  margin-bottom: 24px;
  font-size: clamp(3.6rem, 8vw, 7rem);
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2.25rem, 4.5vw, 4rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 9px 13px;
  background: var(--ink);
  color: white;
  transform: translateY(-180%);
}

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

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(217, 210, 198, 0.9);
  background: rgba(247, 244, 238, 0.96);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.wordmark {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark span {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

nav {
  display: flex;
  gap: 22px;
}

nav a {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
}

.hero {
  padding-top: 88px;
  border-bottom: 1px solid var(--line);
  background-color: var(--white);
  background-image:
    linear-gradient(rgba(21, 38, 63, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 38, 63, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
}

.hero-copy {
  max-width: 980px;
}

.eyebrow,
.section-kicker,
.difference-label {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede {
  max-width: 850px;
  margin-bottom: 28px;
  color: #354155;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  background: var(--navy);
  color: white;
}

.button.primary:hover {
  background: var(--blue);
}

.button.secondary {
  color: var(--navy);
}

.text-link {
  margin-left: 6px;
  font-size: 0.87rem;
  font-weight: 700;
}

.scope-line {
  max-width: 800px;
  margin-bottom: 58px;
  padding-left: 16px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  font-size: 0.9rem;
}

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

.metric {
  padding: 25px 28px 30px;
  border-left: 1px solid var(--line);
}

.metric:last-child {
  border-right: 1px solid var(--line);
}

.metric-value {
  margin-bottom: 2px;
  color: var(--navy);
  font-family: var(--mono);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.065em;
}

.metric p:last-child {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.section {
  padding: 88px 0;
}

.section.tinted {
  border-top: 1px solid var(--line);
  background: var(--paper-strong);
}

.section.dark {
  background: var(--navy);
  color: white;
}

.section-heading {
  max-width: 800px;
  margin-bottom: 44px;
}

.section-heading > p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.light-copy > p:last-child {
  color: #cbd5e2;
}

.setup-section {
  border-bottom: 1px solid var(--line);
  background: var(--paper-strong);
}

.dataset-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding: 26px 28px;
  border-top: 4px solid var(--gold);
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
}

.dataset-source h3 {
  margin-bottom: 8px;
}

.dataset-source p:last-child {
  margin-bottom: 0;
  color: #cbd5e2;
  font-size: 0.86rem;
}

.dataset-label {
  margin-bottom: 8px;
  color: #e5ad68;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dataset-source-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.dataset-source-actions a {
  color: #d9e7f4;
}

.dataset-source-actions .source-button {
  border-color: white;
  color: white;
}

.dataset-source-actions .source-button:hover {
  border-color: #e5ad68;
  color: #e5ad68;
}

.dataset-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.dataset-stats article {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.dataset-stats article:last-child {
  border-right: 0;
}

.dataset-stats strong,
.dataset-stats span {
  display: block;
}

.dataset-stats strong {
  color: var(--navy);
  font-family: var(--mono);
  font-size: clamp(1.35rem, 2.7vw, 2rem);
  letter-spacing: -0.055em;
  line-height: 1.2;
}

.dataset-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.schema-table {
  box-shadow: none;
}

.schema-table td:last-child {
  min-width: 360px;
  white-space: normal;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.setup-grid article {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.setup-grid span {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setup-grid h3 {
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.setup-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.setup-detail {
  background: var(--white);
}

.checksum code {
  word-break: break-all;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.result-block {
  padding: 46px 0 58px;
  border-top: 1px solid var(--line);
}

.result-intro {
  display: grid;
  grid-template-columns: 56px minmax(0, 760px);
  gap: 20px;
  margin-bottom: 26px;
}

.result-intro p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.result-number {
  margin: 2px 0 0;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

thead th {
  background: var(--paper-strong);
  color: #485365;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

.focus-row {
  background: var(--blue-open);
}

.figure-card {
  margin: 28px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.figure-card a {
  display: block;
}

.figure-card img {
  height: auto;
}

.figure-card figcaption {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.performance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px;
  align-items: stretch;
}

.difference-card {
  padding: 24px;
  border-top: 4px solid var(--gold);
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
}

.difference-value {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 1;
}

.difference-card p:last-child {
  margin-bottom: 0;
  color: #cbd5e2;
  font-size: 0.87rem;
}

.detail-block {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.7);
}

.detail-block summary {
  padding: 16px 18px;
  cursor: pointer;
  color: var(--navy);
  font-weight: 750;
}

.detail-content {
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 0.91rem;
}

.detail-content > :last-child {
  margin-bottom: 0;
}

.detail-content ul {
  margin-top: 0;
  padding-left: 20px;
}

.detail-content li + li {
  margin-top: 8px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.video-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.video-card video {
  aspect-ratio: 16 / 9;
  background: #09111f;
  object-fit: contain;
}

.video-card figcaption {
  padding: 17px 18px 19px;
  color: #cbd5e2;
  font-size: 0.88rem;
}

.video-card strong {
  color: white;
}

.formula {
  overflow-x: auto;
  padding: 14px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-family: var(--serif);
  font-size: 1.08rem;
  white-space: nowrap;
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.boundary-grid article {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.boundary-grid ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.boundary-grid li + li {
  margin-top: 7px;
}

.next-step {
  margin: 20px 0 24px;
  padding: 16px 18px;
  border-left: 3px solid var(--gold);
  background: rgba(255, 253, 249, 0.65);
}

.downloads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.downloads a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.downloads a:hover {
  border-color: var(--gold);
}

.downloads span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.sources-block {
  margin-top: 14px;
}

footer {
  padding: 26px 0;
  background: #0d1829;
  color: #bec8d6;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.8rem;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  color: #d8e4f2;
}

@media (max-width: 900px) {
  .performance-grid {
    grid-template-columns: 1fr;
  }

  .difference-card {
    display: grid;
    grid-template-columns: repeat(2, auto);
    column-gap: 24px;
    align-items: end;
  }

  .difference-label,
  .difference-value {
    grid-column: 1;
  }

  .difference-card > p:nth-child(3),
  .difference-card > p:nth-child(4) {
    grid-column: 2;
  }

  .difference-card > p:nth-child(3) {
    grid-row: 1 / span 2;
    align-self: end;
  }

  .dataset-stats,
  .downloads {
    grid-template-columns: repeat(2, 1fr);
  }

  .dataset-stats article:nth-child(2) {
    border-right: 0;
  }

  .dataset-stats article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15px;
  }

  .shell {
    width: min(100% - 28px, 1120px);
  }

  .site-header {
    position: static;
  }

  .header-inner {
    min-height: 58px;
  }

  .wordmark span,
  nav a:nth-child(3),
  nav a:nth-child(4) {
    display: none;
  }

  nav {
    gap: 14px;
  }

  .hero {
    padding-top: 58px;
  }

  h1 {
    font-size: clamp(3.2rem, 17vw, 5rem);
  }

  .text-link {
    width: 100%;
    margin: 4px 0 0;
  }

  .scope-line {
    margin-bottom: 42px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:last-child {
    padding: 19px 4px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .metric-value {
    font-size: 2.45rem;
  }

  .section {
    padding: 64px 0;
  }

  .section-heading {
    margin-bottom: 34px;
  }

  .result-block {
    padding: 36px 0 44px;
  }

  .result-intro {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .video-grid,
  .setup-grid,
  .dataset-stats,
  .boundary-grid,
  .downloads {
    grid-template-columns: 1fr;
  }

  .dataset-source {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .dataset-source-actions {
    align-items: flex-start;
  }

  .dataset-stats article,
  .dataset-stats article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dataset-stats article:last-child {
    border-bottom: 0;
  }

  .difference-card {
    display: block;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

@media print {
  .site-header,
  .actions,
  .video-grid,
  footer {
    display: none;
  }

  .section,
  .hero {
    padding: 28px 0;
  }

  .detail-block:not([open]) > *:not(summary) {
    display: block;
  }
}
