/* Tokens. Provisional: there is no brand kit yet (see the project note). */
:root {
  --bg: #fbfaf7;
  --surface: #f1efe9;
  --text: #1c1b19;
  --muted: #5c5a55;
  --border: #d6d3cb;
  --primary: #0b5c4a;
  --on-primary: #ffffff;
  --panel-bg: #1c1b19;
  --panel-text: #fbfaf7;
  --panel-muted: #b9b6ad;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --s6: 64px; --s7: 96px;
  --radius: 12px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --surface: #1f201d;
    --text: #ecebe6;
    --muted: #a9a79f;
    --border: #3a3b36;
    --primary: #7fd1b9;
    --on-primary: #10201b;
    --panel-bg: #24251f;
    --panel-text: #ecebe6;
    --panel-muted: #a9a79f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--sans);
}
.wrap { max-width: 68rem; margin: 0 auto; padding: 0 var(--s3); }
main > .wrap { margin-bottom: var(--s7); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; }
h1 { font-size: clamp(2.25rem, 7vw, 4.25rem); line-height: 1.08; letter-spacing: -0.01em; max-width: 18ch; }
h2 { font-size: clamp(1.625rem, 4vw, 2.5rem); line-height: 1.15; margin-bottom: var(--s4); max-width: 24ch; }
h3 { font-size: 1.3125rem; line-height: 1.25; margin-bottom: var(--s2); }
p { margin: 0 0 var(--s3); max-width: 62ch; }
p:last-child { margin-bottom: 0; }
ol, ul { list-style: none; margin: 0; padding: 0; }
.tag { display: block; font: 0.8125rem/1.6 var(--mono); color: var(--muted); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s3); top: var(--s3); background: var(--bg); padding: var(--s2) var(--s3); }

.site-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s2) var(--s4);
  padding-top: var(--s3); padding-bottom: var(--s3);
}
.wordmark { font: 500 1.375rem var(--serif); color: var(--text); text-decoration: none; padding: 10px 0; }
nav { display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin-left: calc(var(--s2) * -1); }
nav a { color: var(--text); text-decoration: none; padding: 10px var(--s2); font-size: 0.9375rem; }
nav a:hover, .wordmark:hover { text-decoration: underline; }

.intro { padding-top: var(--s6); padding-bottom: var(--s2); }
.lead { font-size: clamp(1.125rem, 2.2vw, 1.375rem); margin-top: var(--s4); max-width: 46ch; }

.panel {
  background: var(--panel-bg); color: var(--panel-text);
  border-radius: var(--radius);
  padding: clamp(var(--s4), 6vw, var(--s6));
}
.panel .tag { color: var(--panel-muted); margin-bottom: var(--s3); }
.panel h2 { margin-bottom: var(--s3); }

.steps { border-top: 1px solid var(--border); }
.steps li {
  display: grid; grid-template-columns: 9rem 1fr; gap: var(--s2) var(--s4);
  padding: var(--s4) 0; border-bottom: 1px solid var(--border);
}
.steps .tag { padding-top: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: var(--s3); }
.cards li { background: var(--surface); border-radius: var(--radius); padding: var(--s4); }
.cards .tag { margin-bottom: var(--s5); }

.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: var(--s5) var(--s6); }
.rules li { border-top: 2px solid var(--text); padding-top: var(--s3); }

.site-foot {
  border-top: 1px solid var(--border);
  padding-top: var(--s4); padding-bottom: var(--s6);
  color: var(--muted); font-size: 0.9375rem;
}
.site-foot p { margin-bottom: var(--s1); }

@media (max-width: 36rem) {
  main > .wrap { margin-bottom: var(--s6); }
  .intro { padding-top: var(--s5); }
  .steps li { grid-template-columns: 1fr; }
  .steps .tag { padding-top: 0; }
}

/* 404 page */
.lone { max-width: 40rem; margin: 0 auto; padding: var(--s7) var(--s3); }
.lone h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); margin: var(--s3) 0; }
a { color: var(--primary); }
.button {
  display: inline-block; margin-top: var(--s3);
  padding: 10px var(--s3); min-height: 44px;
  border-radius: var(--radius);
  background: var(--primary); color: var(--on-primary);
  font-weight: 600; text-decoration: none;
}
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* Motion. Words of the headline rise in on load; sections rise in as they scroll into view
   (browsers without scroll-driven animations just show them). Off under reduced motion. */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --dur: .7s; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } }
  @keyframes fade { from { opacity: 0; } }

  .site-head { animation: fade var(--dur) var(--ease) both; }
  h1 span { display: inline-block; animation: rise var(--dur) var(--ease) both; }
  h1 span:nth-child(2) { animation-delay: .06s; }
  h1 span:nth-child(3) { animation-delay: .12s; }
  h1 span:nth-child(4) { animation-delay: .18s; }
  h1 span:nth-child(5) { animation-delay: .24s; }
  h1 span:nth-child(6) { animation-delay: .30s; }
  h1 span:nth-child(7) { animation-delay: .36s; }
  h1 span:nth-child(8) { animation-delay: .42s; }
  h1 span:nth-child(9) { animation-delay: .48s; }
  h1 span:nth-child(10) { animation-delay: .54s; }
  h1 span:nth-child(11) { animation-delay: .60s; }
  h1 span:nth-child(12) { animation-delay: .66s; }
  .lead { animation: rise var(--dur) var(--ease) .9s both; }

  @supports (animation-timeline: view()) {
    .panel, main > section > h2, .steps li, .cards li, .rules li {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }

  .cards li { transition: translate .25s var(--ease), box-shadow .25s var(--ease); }
  .cards li:hover { translate: 0 -6px; box-shadow: 0 10px 24px rgb(0 0 0 / .18); }
  nav a, .wordmark { transition: color .2s; }
  nav a:hover, .wordmark:hover { color: var(--primary); }
}
