/* Calibration charts and scrollable data tables. */
.stats-page .scoring-components { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin: 24px 0; }
.stats-page .scoring-components article { border-top: 4px solid #397b78; padding-top: 12px; }
.stats-page .scoring-components article:nth-child(2) { border-color: #ac4946; }
.stats-page .scoring-components article:nth-child(3) { border-color: #547ba0; }
.stats-page .scoring-components article:nth-child(4) { border-color: #826c36; }
.stats-page .scoring-components h3 { font-size: 24px; margin: 0; }
.stats-page .scoring-components strong { font-size: 32px; }
.stats-page .scoring-components strong span { font-size: 18px; font-weight: normal; }
.stats-page .component-caption { font-size: 14px; margin-top: 4px; }
@media (max-width: 820px) {
  .stats-page .scoring-components { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
.stats-page .stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 28px 0; }
.stats-page .metric-panel { min-width: 0; }
.stats-page .metric-panel strong { font-size: 32px; }
.stats-page .problem-block { border: 0; border-top: 1px solid #bfc8c3; border-radius: 0; box-shadow: none; background: transparent; padding: 32px 0; }
.stats-page h1 { font-size: 44px; }
.stats-page h2 { font-size: 28px; }
.stats-page .bar-list { display: grid; gap: 14px; margin: 28px 0; }
.stats-page .bar-row { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(80px, 3fr) 44px; gap: 16px; align-items: center; }
.stats-page .bar-track { background: #dce2df; }
.stats-page .bar-fill { height: 100%; background: #397b78; }
.stats-page .table-scroll, .history-scroll { overflow-x: auto; max-width: 100%; }
.stats-page .reference-table { min-width: 780px; }
.stats-page .reference-table th { white-space: normal; }
.history-chart { display: flex; align-items: end; gap: 6px; height: 220px; min-width: 1100px; padding: 20px 0; border-bottom: 1px solid #77847e; }
.history-chart a { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; font-size: 11px; text-decoration: none; }
.history-bar { display: block; width: 100%; background: #397b78; min-height: 0; }
.history-chart a:hover .history-bar, .history-chart a:focus .history-bar { background: #b34743; }
@media (max-width: 820px) {
  .stats-page .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-page h1 { font-size: 34px; }
  .stats-page .bar-row { grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; }
  .stats-page .bar-row > span { grid-column: 1 / -1; }
}
:root {
  --ink: #18202a;
  --muted: #56616f;
  --paper: #fbf7ee;
  --surface: #ffffff;
  --line: #d8d5ca;
  --blue: #245a85;
  --green: #2f765b;
  --red: #b14231;
  --gold: #c8912f;
  --shadow: 0 16px 48px rgba(20, 28, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

a {
  color: var(--blue);
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: rgba(251, 247, 238, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--ink);
}

.formula {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #f8faf8;
  color: #1f2b36;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;
  line-height: 1.45;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 28px;
  background: #fff;
}

.reference-table th,
.reference-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.reference-table th {
  background: #eef4f1;
  font-family: Arial, Helvetica, sans-serif;
}

.reference-table[data-sortable-table] th {
  cursor: pointer;
}

.reference-table[data-sortable-table] th::after {
  content: " \2195";
  color: var(--muted);
  font-weight: 400;
}

.hero {
  position: relative;
  min-height: 78vh;
  display: grid;
  align-items: end;
  padding: clamp(24px, 4vw, 54px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.napkin-theme-image {
  object-fit: contain;
  object-position: right center;
  padding: clamp(24px, 5vw, 76px);
}

.foc-theme-image {
  object-fit: contain;
  object-position: right center;
  padding: clamp(18px, 5vw, 70px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(251, 247, 238, 0.97), rgba(251, 247, 238, 0.84) 42%, rgba(251, 247, 238, 0.05));
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: clamp(10px, 2vw, 24px) 0;
}

.calibration-snapshot {
  display: grid;
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.45fr);
  gap: 54px;
  padding: 42px clamp(18px, 4vw, 54px);
  background: var(--ink);
  color: #fff;
  border-bottom: 5px solid var(--gold);
}

.calibration-snapshot .eyebrow {
  color: #e9b95b;
}

.snapshot-overview h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.snapshot-overview h2 strong {
  font-size: 4rem;
  line-height: 0.9;
}

.snapshot-overview h2 span {
  color: #bcc9c5;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.2rem;
}

.snapshot-overview p {
  max-width: 390px;
  color: #dce3e0;
}

.snapshot-button {
  border-color: #fff;
  background: #fff;
  color: var(--ink);
}

.snapshot-detail h3 {
  margin-bottom: 18px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
}

.snapshot-components {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
}

.snapshot-component > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

.snapshot-track {
  height: 8px;
  overflow: hidden;
  background: #43505a;
}

.snapshot-track span {
  display: block;
  height: 100%;
  background: #58aaa4;
}

.snapshot-component:nth-child(2) .snapshot-track span { background: #d86b60; }
.snapshot-component:nth-child(3) .snapshot-track span { background: #75a5d0; }
.snapshot-component:nth-child(4) .snapshot-track span { background: #d5ad52; }

.snapshot-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid #43505a;
  color: #dce3e0;
  font-size: 0.9rem;
}

.snapshot-context span,
.snapshot-context strong {
  display: block;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 940px;
  margin-bottom: 18px;
  font-size: clamp(2.4rem, 7vw, 5.9rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  font-size: 1.2rem;
}

.lede {
  max-width: 720px;
  color: #2d3845;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.button-row,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--ink);
  color: #fff;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.band,
.featured,
.leaderboard-band,
.signup,
.page,
.problem-page {
  padding: clamp(42px, 7vw, 88px) clamp(18px, 4vw, 54px);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 28px;
}

.three-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.three-column article,
.problem-card,
.leaderboard-card,
.source-box,
.answer-target,
.metric-panel,
.problem-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.three-column article {
  padding: 22px;
}

.featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 30px;
  align-items: center;
  background: #eef4f1;
  border-block: 1px solid var(--line);
}

.featured p {
  max-width: 760px;
}

.leaderboard-band {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.leaderboard-card {
  padding: 22px;
}

.leaderboard-card ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 22px;
}

.leaderboard-card li {
  padding-left: 4px;
}

.leaderboard-card strong,
.leaderboard-card span {
  display: block;
}

.leaderboard-card strong {
  font-family: Arial, Helvetica, sans-serif;
}

.leaderboard-card span {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

.grading-band {
  background: #f8faf8;
  border-bottom: 1px solid var(--line);
}

.grading-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grading-grid article,
.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.score-card {
  display: grid;
  gap: 12px;
}

.score-image {
  width: min(160px, 42vw);
  margin-bottom: 4px;
}

.metric-panel {
  display: grid;
  gap: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
  font-family: Arial, Helvetica, sans-serif;
}

.metric-panel strong {
  font-size: 2rem;
  line-height: 1;
}

.text-link {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 1.05fr);
  gap: 36px;
  align-items: center;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-cloud span,
.card-meta span,
.choices span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84rem;
}

.signup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 480px);
  gap: 28px;
  align-items: start;
  background: #fff;
}

.signup-form,
.guess-form {
  display: grid;
  gap: 14px;
  font-family: Arial, Helvetica, sans-serif;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid #bfc5ca;
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px clamp(18px, 4vw, 54px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.page,
.problem-page {
  max-width: 1180px;
  margin: 0 auto;
}

.page-hero,
.problem-hero {
  margin-bottom: 34px;
}

body[data-problem-id] .problem-hero {
  position: relative;
  overflow: hidden;
}

body[data-problem-id] .problem-hero::before {
  content: "";
  position: absolute;
  top: -12px;
  right: 0;
  z-index: 0;
  width: min(220px, 32vw);
  aspect-ratio: 1 / 1;
  background: url("assets/back-of-the-napkin-circle.png") center / contain no-repeat;
  opacity: 0.16;
  pointer-events: none;
}

body[data-problem-id] .problem-hero > * {
  position: relative;
  z-index: 1;
}

.page-hero.compact {
  max-width: 860px;
}

.content-grid,
.problem-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 28px;
  align-items: start;
}

.content-main {
  max-width: 780px;
}

.content-main h2 {
  margin-top: 34px;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.source-box {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.source-box h2 {
  font-size: 1.35rem;
}

.archive-list {
  display: grid;
  gap: 18px;
}

.problem-card {
  padding: 22px;
}

.problem-card h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.answer-target {
  padding: 22px;
  box-shadow: var(--shadow);
}

.answer-target span,
.result-grid span {
  display: block;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-target strong {
  display: block;
  margin: 8px 0;
  color: var(--green);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.1rem;
  line-height: 1;
}

.problem-block {
  margin-bottom: 22px;
  padding: clamp(20px, 3vw, 32px);
}

.problem-block h2 {
  font-size: clamp(1.4rem, 2vw, 2.05rem);
}

.prompt {
  border-left: 6px solid var(--gold);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.gate-block {
  border-left: 6px solid var(--red);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.option-card input {
  width: auto;
  margin-right: 4px;
}

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

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: start;
  font-weight: 700;
}

.checkbox input {
  width: auto;
  margin-top: 5px;
}

.result-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-grid div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
}

.result-grid strong {
  display: block;
  margin-top: 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.2rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.histogram {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.histogram-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr minmax(32px, auto);
  gap: 10px;
  align-items: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e4d8;
}

.bar-fill {
  height: 100%;
  background: var(--blue);
}

.worksheet,
.question-list {
  padding-left: 22px;
}

.worksheet li,
.question-list li {
  margin-bottom: 8px;
}

.answer {
  border-left: 6px solid var(--green);
}

.notebook {
  border-left: 6px solid var(--gold);
  background: #fffdf7;
}

.method-note {
  margin: 4px 0 22px;
  padding: 14px 16px;
  border-left: 4px solid var(--blue);
  background: #eef4f1;
  color: #33414d;
  font-size: 0.96rem;
}

.results-provenance {
  margin-top: 16px;
}

.sources {
  display: grid;
  gap: 10px;
}

.fact-box {
  border-left: 6px solid var(--blue);
}

@media (max-width: 820px) {
  .site-header,
  .site-footer,
  .featured,
  .split,
  .signup,
  .content-grid,
  .problem-hero {
    grid-template-columns: 1fr;
  }

  .calibration-snapshot {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .snapshot-context {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .hero {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
    padding: 30px 18px 0;
  }

  .hero-image {
    position: relative;
    inset: auto;
    order: 2;
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
  }

  .napkin-theme-image {
    object-position: center bottom;
    padding: 0;
  }

  .foc-theme-image {
    object-position: center bottom;
    padding: 0;
  }

  .hero-copy {
    order: 1;
    max-width: none;
    padding: 0;
  }

  .hero::after {
    display: none;
  }

  .three-column,
  .leaderboard-grid,
  .grading-grid,
  .form-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .histogram-row {
    grid-template-columns: 1fr;
  }
}
