:root {
  color-scheme: light;
  --surface: #fcfcfb;
  --surface-2: #f4f3ef;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --hairline: #e1e0d9;
  --accent: #2a78d6;
  --accent-text: #1c5cab;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #1a1a19;
    --surface-2: #242422;
    --page: #0d0d0d;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --hairline: #2c2c2a;
    --accent: #3987e5;
    --accent-text: #86b6ef;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #1a1a19;
  --surface-2: #242422;
  --page: #0d0d0d;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --hairline: #2c2c2a;
  --accent: #3987e5;
  --accent-text: #86b6ef;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent-text); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.top { background: var(--surface); border-bottom: 1px solid var(--hairline); padding: 28px 0 24px; }
.back { font-size: 14px; text-decoration: none; }
.back:hover { text-decoration: underline; }
h1 { margin: 10px 0 6px; font-size: 32px; line-height: 1.2; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--text-secondary); font-size: 18px; max-width: 62ch; }

.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 48px; padding-top: 32px; padding-bottom: 48px; }
.toc { position: sticky; top: 24px; align-self: start; font-size: 14px; }
.toc-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--hairline); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; color: var(--text-secondary); text-decoration: none; border-left: 2px solid transparent; }
.toc a:hover { color: var(--text-primary); border-left-color: var(--accent); }

main { max-width: 760px; }
section { padding-bottom: 36px; margin-bottom: 36px; border-bottom: 1px solid var(--hairline); }
section:last-child { border-bottom: 0; }
h2 { margin: 0 0 14px; font-size: 24px; line-height: 1.25; }
h3 { margin: 24px 0 8px; font-size: 17px; }
p, ul, ol { margin: 0 0 14px; }
li { margin-bottom: 6px; }
.note { font-size: 14px; color: var(--text-secondary); }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
pre { background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 4px 0 20px; }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px; padding: 14px 16px; }
.tile .v { display: block; font-size: 28px; font-weight: 600; line-height: 1.15; }
.tile .l { display: block; margin-top: 4px; font-size: 13.5px; color: var(--text-secondary); line-height: 1.4; }

.defs dt { font-weight: 600; margin-top: 12px; }
.defs dd { margin: 2px 0 0; color: var(--text-secondary); }
.defs dd ul { margin: 6px 0 6px; }

.keys { list-style: none; padding: 0; }
.keys li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.sw { flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 4px; background: var(--c); }
.sw.hatch { border: 1px solid #898781; background: repeating-linear-gradient(135deg, transparent 0 3px, #898781 3px 4px); }
.sw.dot { width: 10px; height: 10px; margin: 7px 4px 0; border-radius: 50%; background: #0b0b0b; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--hairline); }

.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--hairline); background: var(--surface-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .id { font-size: 12.5px; color: var(--text-muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.steps li { margin-bottom: 10px; }

figure { margin: 20px 0; }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--hairline); border-radius: 8px; background: #fcfcfb; }
figcaption { margin-top: 6px; font-size: 13.5px; color: var(--text-muted); }

.glossary dt { font-weight: 600; margin-top: 16px; scroll-margin-top: 16px; }
.glossary dt:target { color: var(--accent-text); }
.glossary dd { margin: 3px 0 0; color: var(--text-secondary); }

.foot { padding-top: 16px; padding-bottom: 32px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--hairline); }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 16px; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 26px; }
  .lede { font-size: 16px; }
  .toc ol { columns: 1; }
}

/* Falling droplets in the side gutters, in the map's two flood-layer blues. */
:root { --drop-now: #256abf; --drop-2080: #9ec5f4; }
.rain { position: fixed; top: 0; bottom: 0; width: calc((100vw - 1120px) / 2); overflow: hidden; pointer-events: none; z-index: 0; }
.rain.left { left: 0; }
.rain.right { right: 0; }
.drop {
  position: absolute; top: -40px; width: var(--s); height: calc(var(--s) * 1.35);
  background: var(--c); opacity: var(--o);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M8 0C8 0 1 9 1 14a7 7 0 0 0 14 0C15 9 8 0 8 0z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M8 0C8 0 1 9 1 14a7 7 0 0 0 14 0C15 9 8 0 8 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: fall var(--d) linear var(--delay) infinite;
}
@keyframes fall {
  0% { transform: translateY(0); }
  100% { transform: translateY(calc(100vh + 80px)); }
}
.layout, .top, .foot { position: relative; z-index: 1; }
@media (max-width: 1240px) { .rain { display: none; } }
@media (prefers-reduced-motion: reduce) { .drop { animation: none; transform: translateY(var(--rest)); } }
