@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: oklch(0.12 0.002 260);
  --ink: oklch(0.95 0.004 90);
  --text: oklch(0.84 0.005 260);
  --muted: oklch(0.68 0.006 260);
  --faint: oklch(0.46 0.006 260);
  --hair: oklch(0.24 0.004 260);
  --up: oklch(0.56 0.13 152);
  --down: oklch(0.52 0.17 27);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --measure: 42rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(120% 60% at 50% -12%, oklch(0.25 0.006 250) 0%, oklch(0.18 0.004 255) 35%, transparent 70%),
    radial-gradient(70% 40% at 100% 100%, oklch(0.16 0.006 160 / 0.6), transparent 70%),
    linear-gradient(180deg, oklch(0.14 0.003 258) 0%, var(--bg) 40%, oklch(0.105 0.002 260) 100%);
  background-repeat: no-repeat;
}

a { color: inherit; }

::selection { background: var(--ink); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 450;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.skip {
  position: fixed;
  left: var(--gutter);
  top: -4rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- Top bar (same as the home page) ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem var(--gutter);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  mask-image: linear-gradient(#000 65%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}

.brand svg { width: 22px; height: 22px; flex: none; }

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.topnav a {
  position: relative;
  padding: 0.4rem 0;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s;
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--up);
  transition: right .35s var(--ease);
}

.topnav a:hover { color: var(--ink); }
.topnav a[aria-current] { color: var(--ink); }
.topnav a[aria-current]::after { right: 0; }
.topnav .narrow { display: none; }

@media (max-width: 480px) {
  .topnav .wide { display: none; }
  .topnav .narrow { display: inline-block; }
}

/* ---------- Document layout ---------- */

.doc {
  flex: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 8.5rem var(--gutter) 2rem;
  display: grid;
  grid-template-columns: 13rem minmax(0, var(--measure));
  column-gap: clamp(2.5rem, 6vw, 5rem);
  justify-content: center;
  align-items: start;
}

.docnav {
  position: sticky;
  top: 6rem;
}

.docnav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.docnav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  text-decoration: none;
  color: var(--faint);
  transition: color .2s;
}

.docnav a::before {
  content: "";
  width: 1rem;
  height: 1px;
  background: var(--hair);
  transition: background .2s, width .35s var(--ease);
}

.docnav a:hover { color: var(--muted); }
.docnav a[aria-current] { color: var(--ink); }
.docnav a[aria-current]::before { width: 1.75rem; background: var(--up); }

.docnav .back {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hair);
}

article { min-width: 0; }

.kicker {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.5rem;
  color: var(--faint);
}

.kicker b { color: var(--up); font-weight: 500; }

.kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hair);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 em { font-style: italic; font-weight: 300; color: var(--muted); }

.meta {
  margin: 1.25rem 0 0;
  color: var(--faint);
}

.lead {
  margin: 2rem 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.summary {
  margin: 2.5rem 0 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--hair);
  border-left: 2px solid var(--up);
  color: var(--text);
}

.summary .label { display: block; color: var(--faint); margin-bottom: 0.75rem; }
.summary p { margin: 0; }
.summary p + p { margin-top: 0.6rem; }
.summary ul { margin: 0; padding-left: 1.1rem; }
.summary li + li { margin-top: 0.35rem; }

article h2 {
  margin: 3rem 0 0.9rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

article h3 {
  margin: 1.9rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 550;
  color: var(--ink);
}

article p, article li, article dd {
  color: var(--text);
  text-wrap: pretty;
}

article p { margin: 0 0 1rem; }

article ul, article ol { margin: 0 0 1rem; padding-left: 1.2rem; }
article li { margin: 0.35rem 0; }
article li::marker { color: var(--faint); }

article a {
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  transition: border-color .2s;
}
article a:hover { border-color: var(--up); }

article dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 2rem;
  margin: 1.25rem 0;
}
article dt { color: var(--faint); }
article dd { margin: 0; }

.index {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  border-top: 1px solid var(--hair);
}

.index li {
  margin: 0;
  border-bottom: 1px solid var(--hair);
}

.index a {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding: 1.25rem 0;
  border: 0;
  text-decoration: none;
  transition: padding-left .35s var(--ease);
}

.index a:hover { padding-left: 0.5rem; }
.index .n { color: var(--up); }
.index .t { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; color: var(--ink); }
.index .d { grid-column: 2; margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95rem; }
.index .arrow { color: var(--faint); transition: color .2s; }
.index a:hover .arrow { color: var(--ink); }

.notice {
  margin: 3rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hair);
  color: var(--muted);
  font-size: 0.9rem;
}

address { font-style: normal; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: clamp(3rem, 8vh, 6rem);
  padding: 1.75rem var(--gutter) 2.25rem;
  border-top: 1px solid var(--hair);
  color: var(--faint);
}

footer nav { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; }
footer a { text-decoration: none; transition: color .2s; }
footer a:hover, footer a[aria-current] { color: var(--ink); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .doc {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 7rem;
    row-gap: 2.5rem;
  }
  .docnav {
    position: static;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 0.75rem;
    border-bottom: 1px solid var(--hair);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .docnav::-webkit-scrollbar { display: none; }
  .docnav ol { display: flex; gap: 1.5rem; width: max-content; }
  .docnav a { white-space: nowrap; }
  .docnav a::before { display: none; }
  .docnav a[aria-current] { box-shadow: inset 0 -1px 0 var(--up); }
  .docnav .back { display: none; }
  article dl { grid-template-columns: 1fr; gap: 0.2rem; }
  article dt { margin-top: 0.75rem; }
}

@media (max-width: 640px) {
  .brand .label { display: none; }
  .topnav { gap: 1rem; }
  .index a { grid-template-columns: 2.25rem 1fr; }
  .index .arrow { display: none; }
}

@media (max-width: 380px) {
  .label { letter-spacing: 0.1em; }
  .topnav { gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
