/* The Book — "The Scorebook" identity carried to the web.
   Buff stock, a sage grid, blue-black ink, a red pencil for corrections.
   One family: Archivo, expressive through weight and width. */

:root {
  --paper: #efe7d4;
  --paper-raised: #f7f1e2;
  --paper-bright: #faf5e9;
  --ink: #1b2b3a;
  --graphite: #5c5750;
  --field: #3c6b4a;
  --field-deep: #2f5539;
  --rule: #6e8266;
  --rule-faint: #9fae96;
  --pencil: #a8322a;
  --on-field: #f7f1e2;

  --measure: 62ch;
  --frame: 68rem;
  --step: clamp(1rem, 0.9rem + 0.5vw, 1.15rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16202b;
    --paper-raised: #1e2b38;
    --paper-bright: #273543;
    --ink: #e8e2d4;
    --graphite: #a79f92;
    --field: #6fa37c;
    --field-deep: #5b8a67;
    --rule: #63806a;
    --rule-faint: #3e5548;
    --pencil: #e0776b;
    --on-field: #10281a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--step);
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 640;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1rem; max-width: var(--measure); }
a { color: inherit; }

/* --- frame ------------------------------------------------------------- */

.frame {
  max-width: var(--frame);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.band { padding-block: clamp(3rem, 8vw, 5.5rem); }
.band + .band { border-top: 1px solid var(--rule); }
.notation-band { background: var(--paper-raised); }

/* --- masthead -------------------------------------------------------- */

.masthead-wrap { border-bottom: 1px solid var(--rule); }
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
}

.wordmark {
  font-weight: 720;
  font-stretch: 88%;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
}

.masthead nav {
  display: flex;
  gap: 1.5rem;
  font-stretch: 84%;
  font-weight: 560;
  font-size: 0.95rem;
}
.masthead nav a { color: var(--graphite); text-decoration: none; }
.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current="page"] { color: var(--pencil); }

/* --- hero ------------------------------------------------------------ */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: start;
}
@media (min-width: 56rem) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(20rem, 0.95fr); }
}

.hero h1 {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 3.9rem);
  font-stretch: 90%;
  max-width: 15ch;
}
.hero .lede {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  color: var(--ink);
  margin-top: 1.4rem;
}
.hero .fine { color: var(--graphite); font-size: 0.95rem; max-width: 52ch; }

/* --- call to action ------------------------------------------------- */

.cta {
  display: inline-block;
  margin: 0.6rem 0 1.2rem;
  padding: 0.7rem 1.3rem;
  background: var(--field);
  color: var(--on-field);
  font-weight: 620;
  font-stretch: 92%;
  text-decoration: none;
  border-radius: 10px;
}
.cta:hover { background: var(--field-deep); }
.cta:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; }

/* --- the scorecard illustration ----------------------------------- */

.scorecard {
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem 1rem 0.75rem;
}
.scorecard-caption {
  color: var(--graphite);
  font-size: 0.8rem;
  font-stretch: 84%;
  margin: 0.7rem 0 0;
}

.sc-grid { display: grid; grid-template-columns: 3.4rem repeat(3, 1fr); }
.sc-grid > * {
  border-right: 1px solid var(--rule-faint);
  border-bottom: 1px solid var(--rule-faint);
  min-height: 3.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sc-grid > .sc-head {
  min-height: 0;
  padding-block: 0.35rem;
  font-stretch: 80%;
  font-weight: 640;
  font-size: 0.82rem;
  color: var(--graphite);
  border-bottom: 1.5px solid var(--rule);
}
.sc-grid > .sc-rowhead {
  justify-content: flex-start;
  padding-left: 0.15rem;
  gap: 0.3rem;
  font-stretch: 80%;
  font-weight: 600;
  font-size: 0.85rem;
}
.sc-grid > .sc-rowhead .num { color: var(--graphite); }
.sc-grid > :nth-child(4n) { border-right: 0; }
.sc-grid > :nth-last-child(-n + 4) { border-bottom: 0; }

.sc-grid svg { width: 3rem; height: 3rem; display: block; }
.diamond-out { stroke: var(--pencil); }
.diamond-line { stroke: var(--rule-faint); }
.path { stroke: var(--field); }
.fill { fill: var(--field); opacity: 0.92; }
.mark {
  font-family: "Archivo", sans-serif;
  font-size: 0.68rem;
  font-weight: 640;
  font-stretch: 82%;
  fill: var(--ink);
}
.mark-run { fill: var(--on-field); }
.mark-out { fill: var(--pencil); }

@media (prefers-reduced-motion: no-preference) {
  .path { stroke-dasharray: 44; stroke-dashoffset: 44; animation: trace 0.7s ease-out 0.3s forwards; }
  .fill { opacity: 0; animation: ink-in 0.5s ease-out 0.9s forwards; }
  @keyframes trace { to { stroke-dashoffset: 0; } }
  @keyframes ink-in { to { opacity: 0.92; } }
}

/* --- ledger: what it records ------------------------------------- */

.section-head {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  font-stretch: 90%;
  margin-bottom: 2rem;
}

.ledger { border-top: 1px solid var(--rule); }
.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem 2.5rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule-faint);
}
@media (min-width: 44rem) {
  .entry { grid-template-columns: 13.5rem minmax(0, 1fr); }
}
.entry dt {
  font-stretch: 82%;
  font-weight: 640;
  font-size: 1.05rem;
  color: var(--ink);
}
.entry dd { margin: 0; color: var(--graphite); max-width: 52ch; }
.entry dd code { color: var(--ink); }

/* --- notation ---------------------------------------------------- */

.gloss { display: grid; gap: 2.25rem; margin-top: 1.75rem; }
@media (min-width: 44rem) { .gloss { grid-template-columns: 1fr 1fr; } }

.gloss .call {
  font-stretch: 78%;
  font-weight: 560;
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem);
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 0.5rem;
}
.gloss p { color: var(--graphite); margin: 0; }

code {
  font-family: "Archivo", ui-sans-serif, sans-serif;
  font-stretch: 80%;
  font-weight: 560;
  background: color-mix(in srgb, var(--field) 12%, transparent);
  padding: 0.05em 0.35em;
  border-radius: 3px;
}

/* --- document pages (privacy, terms) --------------------------- */

.doc { padding-block: clamp(2.5rem, 6vw, 4rem); }
.doc h1 { font-size: clamp(1.9rem, 1.5rem + 1.8vw, 2.6rem); font-stretch: 90%; }
.doc .updated { color: var(--graphite); font-size: 0.9rem; margin-top: 0.5rem; }
.doc h2 {
  font-size: 1.15rem;
  font-stretch: 86%;
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule-faint);
}
.doc p, .doc li { max-width: 68ch; color: var(--ink); }
.doc ul { padding-left: 1.1rem; }
.doc li { margin-bottom: 0.4rem; }
.doc .summary {
  background: var(--paper-raised);
  border-left: 3px solid var(--field);
  padding: 1rem 1.2rem;
  border-radius: 0 4px 4px 0;
}
.doc .summary p:last-child { margin-bottom: 0; }
.doc a { color: var(--field-deep); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { .doc a { color: var(--field); } }

/* --- footer ---------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3rem;
  color: var(--graphite);
  font-size: 0.9rem;
}
.site-foot p { max-width: 70ch; margin-bottom: 0.75rem; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-faint);
  font-stretch: 84%;
  font-weight: 540;
}
.foot-links a { color: var(--ink); text-decoration: none; }
.foot-links a:hover { color: var(--pencil); }
.foot-links .spacer { flex: 1 1 1rem; }
.foot-links > span:last-child { color: var(--graphite); }

:where(a):focus-visible { outline: 2px solid var(--pencil); outline-offset: 2px; border-radius: 2px; }
