:root {
  --paper: #f3efe3;
  --paper-deep: #e9e3d1;
  --ink: #211f1a;
  --ink-soft: #4d4a42;
  --line: #cfc7b0;
  --card: #faf7ee;
  --accent: #8a3b1f;
  --accent-ink: #ffffff;
  --rail-a: #c9c4b4;
  --rail-b: #2b2925;
  --meter-off: #d8d2bf;
  --meter-on: #2b2925;
  --focus: #1d4ed8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  --paper: #171512;
  --paper-deep: #211e19;
  --ink: #ece7d8;
  --ink-soft: #b9b3a2;
  --line: #3d392f;
  --card: #201d17;
  --accent: #e08a5a;
  --accent-ink: #171512;
  --rail-a: #6e6a5c;
  --rail-b: #f0ead9;
  --meter-off: #3d392f;
  --meter-on: #ece7d8;
  --focus: #9ec1ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, transparent 0 27px, rgba(0, 0, 0, 0.028) 27px 28px);
}
[data-theme="dark"] body::before { background-image: repeating-linear-gradient(0deg, transparent 0 27px, rgba(255, 255, 255, 0.03) 27px 28px); }
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 50;
}
.skip-link:focus { top: 0.5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3rem;
  padding: 0 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.topbar .home { font-family: var(--serif); font-weight: 700; color: var(--ink); text-decoration: none; }
.topnav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; padding: 0.4rem 0.6rem; }
.topnav a[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.spacer { flex: 1 1 auto; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
main { max-width: 56rem; margin: 0 auto; padding: 0 1.25rem 3rem; }
section { scroll-margin-top: 4rem; }
.hero { padding: 2.5rem 0 0.5rem; max-width: 44rem; }
.dateline { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.95rem; }
h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5.4vw, 3.2rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}
.deck { font-size: 1.2rem; line-height: 1.55; margin: 0; max-width: 40rem; }
h2 { font-family: var(--serif); font-size: 1.65rem; line-height: 1.25; margin: 3rem 0 1rem; }
.plink { color: var(--ink-soft); text-decoration: none; font-size: 1.1rem; padding: 0.5rem; }
.share { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 1.75rem; padding: 1rem 0; }
.share h2 { font-family: var(--sans); font-size: 1rem; margin: 0 0 0.25rem; }
.share-summary, .share-checked { margin: 0 0 0.25rem; font-size: 0.95rem; color: var(--ink-soft); }
.share-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.share-btn, .share-open {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.share-open { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.share-status { min-height: 1.4em; margin: 0.4rem 0 0; font-size: 0.95rem; }
.rail-wrap { margin: 1.25rem 0 0; }
.rail-ends { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.rail {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.7rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: linear-gradient(90deg, var(--rail-a), var(--rail-b));
  scroll-snap-type: x proximity;
}
.grade {
  flex: 0 0 auto;
  min-width: 3rem;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  background: var(--card);
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: 0.45rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}
.grade[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.result {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  padding: 1.5rem;
}
.result-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.result-grade { font-family: var(--serif); font-size: 3.2rem; line-height: 1; margin: 0; min-width: 5.5rem; }
.result-verdict { font-size: 1.25rem; margin: 0; flex: 1 1 16rem; }
.meters { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1rem; }
.meter { display: flex; align-items: center; gap: 0.7rem; }
.meter-label { font-size: 0.95rem; color: var(--ink-soft); min-width: 4.5rem; }
.meter-blocks { display: inline-flex; gap: 0.3rem; }
.meter-blocks i { width: 1.6rem; height: 0.7rem; border-radius: 2px; background: var(--meter-off); }
.meter-blocks i.on { background: var(--meter-on); }
.sample { margin: 1.25rem 0 0; }
.sample svg { display: block; width: 100%; max-width: 34rem; height: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 0.4rem; }
.sample figcaption, .trio figcaption { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.4rem; }
.result-uses { margin: 1rem 0 0; }
.uses-label { color: var(--ink-soft); }
.result-link { margin: 0.75rem 0 0; font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.result-link code { font-size: 0.85rem; word-break: break-all; }
.mini-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0.35rem;
  padding: 0.45rem 0.9rem;
  min-height: 2.75rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.mini-status { min-height: 1.4em; margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.trio svg { display: block; width: 100%; max-width: 38rem; height: auto; background: var(--card); border: 1px solid var(--line); border-radius: 0.6rem; }
.trio { margin: 1rem 0 0; }
.trio-label { font: 700 15px var(--sans); fill: var(--ink); }
.key { margin: 1rem 0; }
.key div { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.key div:last-child { border-bottom: 1px solid var(--line); }
.key dt { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin: 0; }
.key dd { margin: 0; }
.boundary { max-width: 44rem; }
.grades { width: 100%; border-collapse: collapse; font-size: 0.98rem; display: block; overflow-x: auto; }
.grades caption { text-align: left; padding-bottom: 0.6rem; color: var(--ink-soft); }
.grades thead, .grades tbody { display: table; width: 100%; min-width: 38rem; }
.grades th, .grades td { text-align: left; padding: 0.55rem 0.75rem; border-top: 1px solid var(--line); vertical-align: top; }
.grades tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.grades tbody tr:target td { background: var(--paper-deep); }
.grades td:first-child, .grades th:first-child { font-weight: 700; white-space: nowrap; }
.grades tr[id] { scroll-margin-top: 4rem; }
details { border-top: 1px solid var(--line); padding: 0.8rem 0; max-width: 44rem; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; font-size: 1.08rem; }
details p { margin: 0.5rem 0 0.25rem; }
.sources { padding-left: 1.25rem; max-width: 46rem; }
.sources li { margin-bottom: 0.6rem; }
.sources a, main a:not(.grade):not(.share-btn):not(.plink) { color: inherit; }
footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 1.25rem 2.5rem; text-align: center; color: var(--ink-soft); }
footer a { color: inherit; }
.totop { font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .result { padding: 1.1rem; }
  .result-grade { font-size: 2.6rem; min-width: 4.5rem; }
  .key div { grid-template-columns: 3.5rem 1fr; gap: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
