/* Fidryn design system ("Statute"): warm paper, black ink, rubric red.
   Shared by the public site and the localhost mill. The three token blocks
   below are parsed by xtask/tests/design_tokens.rs; keep them in this shape. */

:root {
  color-scheme: light;
  --paper: #f7f2e8; --paper-2: #efe7d6; --paper-3: #e6dbc4;
  --ink: #1c1813; --ink-2: #3d362c; --ink-3: #6f6454; --rule: #d6c9b1; --rubric: #a3281d;
  --det: #2e6a39; --con: #23507f; --sus: #8a5d06; --nc: #9c3d10; --oc: #6b3a72; --inc: #b0182b;
  --tok-kw: #a3281d; --tok-type: #23507f; --tok-str: #3b6a2c; --tok-num: #86570a; --tok-com: #5e6652; --tok-punct: #6b6152;
  --grain-opacity: .06;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 6px; --gutter: clamp(16px, 4vw, 40px); --measure: 42rem; --row: 30px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15120e; --paper-2: #1e1a15; --paper-3: #28221b;
  --ink: #efe6d6; --ink-2: #cfc3ae; --ink-3: #9a8e7a; --rule: #3a3228; --rubric: #e0725f;
  --det: #8cc79a; --con: #8fb4e8; --sus: #e2b457; --nc: #ec9a67; --oc: #cfa1d8; --inc: #f07b7b;
  --tok-kw: #ec8a74; --tok-type: #9dbde8; --tok-str: #a8cf95; --tok-num: #e2b86a; --tok-com: #9aa08a; --tok-punct: #a79a84;
  --grain-opacity: .03;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15120e; --paper-2: #1e1a15; --paper-3: #28221b;
    --ink: #efe6d6; --ink-2: #cfc3ae; --ink-3: #9a8e7a; --rule: #3a3228; --rubric: #e0725f;
    --det: #8cc79a; --con: #8fb4e8; --sus: #e2b457; --nc: #ec9a67; --oc: #cfa1d8; --inc: #f07b7b;
    --tok-kw: #ec8a74; --tok-type: #9dbde8; --tok-str: #a8cf95; --tok-num: #e2b86a; --tok-com: #9aa08a; --tok-punct: #a79a84;
    --grain-opacity: .03;
  }
}

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/plex-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The page ground lives on html so the grain layer (body::before, z-index -1)
   paints above it and below everything else. */
html {
  background: var(--paper);
  color: var(--ink-2);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  font: 400 16px/1.6 var(--serif);
  font-variation-settings: "opsz" 14;
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
.site-head, main, .site-foot { width: 100%; max-width: 1360px; margin-inline: auto; }
main { flex: 1 0 auto; }

img, video { max-width: 100%; height: auto; }
p { margin: 0 0 1em; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

a {
  color: var(--rubric);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--rubric) 55%, transparent);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; }
.code pre:focus-visible, .search-results a:focus-visible { outline-offset: -2px; }
::selection { background: color-mix(in srgb, var(--rubric) 22%, transparent); color: var(--ink); }

:not(pre) > code {
  padding: .08em .32em;
  border-radius: min(var(--r), 4px);
  background: var(--paper-2);
  color: var(--ink);
  font: 400 .86em/1 var(--mono);
  overflow-wrap: break-word;
}
kbd {
  padding: 0 .35em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink-2);
  font: 500 .78em/1.5 var(--mono);
}
hr { margin: 2em 0; border: 0; border-top: 1px solid var(--rule); }

/* ---------- utilities ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  z-index: 100;
  top: -80px;
  left: max(12px, env(safe-area-inset-left, 0px));
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
}
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }
.label { margin: 0; font: 600 12px/1.35 var(--sans); color: var(--ink-3); letter-spacing: 0; text-transform: none; }
.eyebrow { margin: 0 0 14px; font: 600 13px/1.35 var(--sans); color: var(--rubric); }
.kicker { margin: 0 0 10px; font: 600 13px/1.35 var(--sans); color: var(--rubric); }
.lede { margin: 0 0 16px; font-size: 19px; line-height: 1.55; color: var(--ink-2); }

/* ---------- header ---------- */

.site-head {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 10px;
  border-bottom: 3px double var(--ink);
}
.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover .wordmark { color: var(--rubric); }
.mono {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--rubric);
  color: var(--ink);
  font: 600 16px/1 var(--serif);
  font-variation-settings: "opsz" 36;
}
.wordmark { font: 560 22px/1 var(--serif); font-variation-settings: "opsz" 72; color: var(--ink); }
/* The padding is room inside the clip for the Docs link's focus ring (2px
   outline plus 2px offset; the phone link's 44px box reaches 1px past the
   line); the negative margin keeps the layout and the ellipsis where they were. */
.crumb {
  min-width: 0;
  margin: -6px;
  padding: 6px;
  overflow: hidden;
  font: 600 12px/1.35 var(--sans);
  color: var(--ink-3);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--rubric); }
.site-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.site-nav a { font: 600 12px/1.3 var(--sans); color: var(--ink); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--rubric); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

.search { position: relative; flex: 0 1 230px; min-width: 150px; margin: 0; }
.search input {
  display: block;
  width: 100%;
  height: var(--row);
  margin: 0;
  padding: 0 34px 0 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper-2);
  color: var(--ink);
  font: 400 13px/1 var(--sans);
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search kbd {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--ink-3);
  font-size: 11px;
}
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }

.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: min(70vh, 540px);
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  box-shadow: 0 20px 40px rgb(0 0 0 / .2);
}
.search-results a {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 1px 10px;
  padding: 8px 16px 9px;
  color: var(--ink);
  text-decoration: none;
}
.search-results .n { grid-row: span 2; padding-top: 3px; font: 500 12px/1.4 var(--sans); color: var(--rubric); }
.search-results .h { font: 500 15px/1.35 var(--serif); color: var(--ink); }
.search-results .t {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-3);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-results mark { border-radius: 2px; background: color-mix(in srgb, var(--rubric) 18%, transparent); color: inherit; }
.search-results li[aria-selected="true"] a { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--rubric); }
.search-results .empty { padding: 10px 16px; font: 400 13px/1.4 var(--sans); color: var(--ink-3); }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--row);
  height: var(--row);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle span {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.theme-toggle:hover { border-color: var(--ink-3); }
.menu-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: var(--row);
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}
.menu-btn:hover { border-color: var(--ink-3); }

/* ---------- buttons, commands, copy ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(var(--row) + 4px);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font: 600 12px/1 var(--sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.btn.pri { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn.pri:hover { border-color: var(--ink-2); background: var(--ink-2); }
.btn.sec { border-color: var(--ink); }
.btn.sec:hover { background: var(--paper-2); }
.btn.sm { height: calc(var(--row) - 2px); padding: 0 10px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .42; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: fidryn-spin .8s linear infinite;
}
@keyframes fidryn-spin { to { transform: rotate(360deg); } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font: 400 13px/1.5 var(--mono);
}
.cmd .prompt { flex: none; color: var(--ink-3); -webkit-user-select: none; user-select: none; }
.cmd code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  overflow-x: auto;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  scrollbar-width: thin;
}
.copy {
  position: relative;
  flex: none;
  margin-left: auto;
  padding: 3px 7px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-3);
  font: 600 12px/1.2 var(--sans);
  cursor: pointer;
}
.copy:hover { background: var(--paper-3); color: var(--ink); }
.copy[data-copied] { color: var(--det); }

/* ---------- code frames and syntax ---------- */

.code { margin: 0 0 1.25em; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); }
.code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--row);
  padding: 3px 6px 3px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-3);
  font: 600 12px/1.3 var(--sans);
}
.code figcaption span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.code pre {
  margin: 0;
  padding: 12px 14px 13px;
  overflow-x: auto;
  background: none;
  color: var(--ink);
  font: 400 13px/1.62 var(--mono);
  tab-size: 4;
}
.code pre code { padding: 0; border-radius: 0; background: none; color: inherit; font: inherit; }
.code pre.lines { padding-left: 8px; }
.code pre.lines .line::before {
  content: attr(data-n);
  display: inline-block;
  width: 3ch;
  margin-right: 2ch;
  color: var(--ink-3);
  text-align: right;
}
.code pre.lines .line.gap { color: var(--ink-3); }
.tk-kw { color: var(--tok-kw); }
.tk-ty { color: var(--tok-type); }
.tk-st { color: var(--tok-str); }
.tk-nu { color: var(--tok-num); }
.tk-co { color: var(--tok-com); }
.tk-pu { color: var(--tok-punct); }

/* ---------- outcome stamps (small caps on purpose: they are marks, not labels) ---------- */

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: var(--r);
  color: var(--ink-2);
  font: 500 10.5px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
}
.stamp::before { content: ""; flex: none; width: 6px; height: 6px; background: currentColor; }
.stamp.det { color: var(--det); }
.stamp.con { color: var(--con); }
.stamp.sus { color: var(--sus); }
.stamp.nc { color: var(--nc); }
.stamp.oc { color: var(--oc); }
.stamp.inc { color: var(--inc); }
a.stamp:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

/* ---------- tables and notes ---------- */

.table-wrap { max-width: 100%; margin: 0 0 1.4em; overflow-x: auto; }
table { width: 100%; border: 1px solid var(--rule); border-collapse: collapse; font-size: 15px; line-height: 1.5; }
th, td { padding: 7px 10px; border: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { background: var(--paper-2); color: var(--ink-2); font: 600 12px/1.35 var(--sans); }
td { color: var(--ink-2); }
blockquote {
  margin: 1.4em 0;
  padding: 11px 16px;
  border-left: 3px solid var(--rubric);
  border-radius: 0 var(--r) var(--r) 0;
  background: color-mix(in srgb, var(--rubric) 7%, var(--paper));
  color: var(--ink-2);
  font-size: .95em;
}
blockquote > :first-child { margin-top: 0; }
blockquote > p:first-child > strong:first-child { color: var(--rubric); font: 600 .8em/1 var(--sans); }
blockquote > :last-child { margin-bottom: 0; }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }

/* ---------- landing ---------- */

.hero { padding: 44px 0 34px; }
.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: end;
  gap: 48px;
  margin-bottom: 30px;
}
.hero h1 {
  margin: 0;
  color: var(--ink);
  font: 400 clamp(42px, 5.6vw, 80px)/1.02 var(--serif);
  font-variation-settings: "opsz" 144;
  letter-spacing: -.02em;
}
.hero-side .lede { max-width: 34rem; }
.note { margin: 0 0 10px; padding: 11px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--ink); color: var(--ink-2); font-size: 15px; }
.note p { margin: 0; }
.note strong { margin-right: 4px; color: var(--ink); font: 600 12px/1 var(--sans); }
.band { padding: 28px 0 32px; border-top: 1px solid var(--ink); }
.band h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font: 460 30px/1.2 var(--serif);
  font-variation-settings: "opsz" 48;
  letter-spacing: -.01em;
}
.mark {
  margin-right: .3em;
  color: var(--rubric);
  font-size: 15px;
  font-weight: 400;
  font-variation-settings: "opsz" 14;
  letter-spacing: 0;
  white-space: nowrap;
}
.band-lede { max-width: 46rem; margin: 0 0 18px; color: var(--ink-2); }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.three > div { padding: 14px 20px 4px 0; }
.three > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.three h3 { margin: 0 0 6px; color: var(--ink); font: 560 18px/1.25 var(--serif); font-variation-settings: "opsz" 30; }
.three p { margin: 0; font-size: 15px; }

.legend { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.legend li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
}
.legend li::before { content: "?"; color: var(--rubric); font: 500 13px/1 var(--sans); }
.legend .q { margin: 0; color: var(--ink); line-height: 1.45; }
.legend .stamp { position: relative; }

.contents { margin: 0; padding: 0; list-style: none; column-gap: 48px; }
.contents li { break-inside: avoid; }
.contents a { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.contents .n { flex: none; width: 38px; color: var(--rubric); font-size: 17px; }
.contents .t { flex: none; font-size: 17px; }
.contents .lead { flex: 1 1 24px; min-width: 24px; border-bottom: 1px dotted var(--ink-3); transform: translateY(-5px); }
.contents .d { flex: 0 1 auto; min-width: 0; color: var(--ink-3); font: 400 13px/1.35 var(--sans); text-align: right; }
.contents a:hover .t { color: var(--rubric); }

/* ---------- landing specimen ---------- */

.specimen { overflow: hidden; border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); }
.spec-tabs { display: flex; border-bottom: 1px solid var(--rule); }
.spec-tabs [role="tab"] {
  display: flex;
  flex: 1 1 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border: 0;
  border-right: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  font: 600 12px/1.3 var(--sans);
  text-align: center;
  cursor: pointer;
}
.spec-tabs [role="tab"]:last-child { border-right: 0; }
.spec-tabs [role="tab"]:hover { background: var(--paper-2); color: var(--ink); }
.spec-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.spec-tabs [aria-selected="true"], .spec-tabs [aria-selected="true"]:hover { background: var(--ink); color: var(--paper); }
.spec-tabs [aria-selected="true"]:focus-visible { box-shadow: inset 0 0 0 5px var(--paper); }
.spec-tabs [aria-selected="true"] .stamp { color: var(--paper); }
.spec-panel + .spec-panel { border-top: 1px solid var(--ink); }
.spec-cmd {
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-2);
  font: 400 12px/1.55 var(--mono);
}
.spec-cmd code { padding: 0; border-radius: 0; background: none; color: inherit; font: inherit; overflow-wrap: anywhere; }
.spec-label { display: none; }
.steps { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
.step { display: grid; align-content: start; gap: 10px; min-width: 0; padding: 14px 16px 16px; }
.step + .step { border-left: 1px solid var(--rule); }
.step .code { margin: 0; }
.step-h { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink-2); font: 600 12px/1 var(--sans); }
.step-n {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--rubric);
  border-radius: 50%;
  color: var(--rubric);
  font: 500 11px/1 var(--sans);
}
.step-outcome .stamp { justify-self: start; }
.opinion { margin: 0; padding: 0; list-style: none; }
.opinion li { padding: 7px 0; border-top: 1px solid var(--rule); color: var(--ink); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.opinion li:first-child { padding-top: 0; border-top: 0; }
.opinion .boundary { color: var(--ink-3); font-size: 14px; }
.spec-dots { display: none; }
.spec-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--rule); color: var(--ink-3); font: 400 12px/1.4 var(--sans); }
html:not(.js) .spec-tabs, html:not(.js) .spec-dots { display: none; }

/* ---------- docs ---------- */

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 40px; align-items: start; padding-top: 26px; }
.doc { min-width: 0; }
.doc h1 {
  margin: 0 0 18px;
  color: var(--ink);
  font: 400 clamp(38px, 4.4vw, 52px)/1.04 var(--serif);
  font-variation-settings: "opsz" 144;
  letter-spacing: -.02em;
}

.guides-head { display: none; }
.guides .group + .group { margin-top: 18px; }
.guides .label { margin: 0 0 6px; }
.guides ol { margin: 0; padding: 0; list-style: none; }
.guides li + li { margin-top: 4px; }
.guides li a { display: block; padding: 7px 0 7px 12px; border-left: 2px solid var(--rule); color: var(--ink); text-decoration: none; }
.guides li a:hover { border-left-color: var(--ink-3); }
.guides .n { margin-right: 6px; color: var(--ink-3); font: 500 11px/1 var(--sans); }
.guides .n:empty { display: none; }
.guides .t { font-size: 15px; font-weight: 500; line-height: 1.3; }
.guides .d { display: block; margin-top: 2px; color: var(--ink-3); font: 400 12px/1.35 var(--sans); }
.guides a[aria-current="page"] { border-left-color: var(--rubric); }
.guides a[aria-current="page"] .t, .guides a[aria-current="page"] .n { color: var(--rubric); }

.prose { color: var(--ink-2); font-size: 17px; line-height: 1.6; overflow-wrap: break-word; }
.prose > p:first-child { font-size: 19px; line-height: 1.55; }
.prose p { margin: 0 0 1em; }
.prose h2 {
  margin: 1.9em 0 .6em;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  color: var(--ink);
  font: 460 27px/1.2 var(--serif);
  font-variation-settings: "opsz" 48;
  letter-spacing: -.01em;
  scroll-margin-top: 16px;
}
.prose h3 {
  margin: 1.6em 0 .5em;
  color: var(--ink);
  font: 560 19px/1.3 var(--serif);
  font-variation-settings: "opsz" 30;
  scroll-margin-top: 16px;
}
.prose h4, .prose h5, .prose h6 { margin: 1.4em 0 .4em; color: var(--ink); font: 600 15px/1.4 var(--sans); scroll-margin-top: 16px; }
.prose .hn { margin-right: .5em; color: var(--rubric); font: 500 13px/1 var(--sans); letter-spacing: .04em; }
.prose .anchor { margin-left: .2em; color: var(--ink-3); font: 400 .72em/1 var(--sans); text-decoration: none; opacity: 0; }
.prose :is(h2, h3, h4, h5, h6):hover .anchor, .prose .anchor:focus-visible, .prose .anchor[data-copied] { opacity: 1; }
.prose .anchor[data-copied]::after { content: " Link copied"; color: var(--det); font-size: 12px; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.5em; }
.prose li { margin: .3em 0; }
.prose li > ul, .prose li > ol { margin: .3em 0; }
.prose li::marker { color: var(--ink-3); }
.prose hr { margin: 2em 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose :not(pre) > code { font-size: .84em; }
@media (hover: none) { .prose .anchor { opacity: 1; } }

.onpage { display: none; }
.onpage ol, .onpage-inline ol { margin: 0; padding: 0; list-style: none; }
.onpage .label { margin: 0 0 10px; }
.onpage a {
  display: block;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--rule);
  color: var(--ink-2);
  font: 400 13px/1.4 var(--sans);
  text-decoration: none;
}
.onpage .lvl-3 a { padding-left: 24px; color: var(--ink-3); }
.onpage a:hover { color: var(--ink); }
.onpage a[aria-current="true"] { padding-left: 11px; border-left: 2px solid var(--rubric); color: var(--rubric); }
.onpage .lvl-3 a[aria-current="true"] { padding-left: 23px; }
.onpage .n { margin-right: 5px; }
/* Both lists scroll inside themselves on wide screens, so keep focus rings inside the links. */
.guides a:focus-visible, .onpage a:focus-visible { outline-offset: -2px; }

.onpage-inline { margin: 0 0 26px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.onpage-inline summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 8px 0;
  color: var(--ink-2);
  font: 600 12px/1.3 var(--sans);
  list-style: none;
  cursor: pointer;
}
.onpage-inline summary::-webkit-details-marker { display: none; }
.onpage-inline summary::after { content: "+"; color: var(--ink-3); font: 400 18px/1 var(--sans); }
.onpage-inline[open] summary::after { content: "\2212"; }
.onpage-inline ol { padding-bottom: 12px; columns: 2; column-gap: 28px; }
.onpage-inline li { break-inside: avoid; }
.onpage-inline a { display: block; padding: 3px 0; color: var(--ink-2); font: 400 13px/1.4 var(--sans); text-decoration: none; }
.onpage-inline .lvl-3 a { padding-left: 1.2em; color: var(--ink-3); }
.onpage-inline .n { display: inline-block; min-width: 2.8em; color: var(--rubric); }

.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 40px; border-top: 3px double var(--ink); }
.pager a { display: grid; align-content: start; gap: 3px; padding: 14px 16px 14px 0; color: var(--ink); text-decoration: none; }
.pager .next { grid-column: 2; padding: 14px 0 14px 16px; text-align: right; }
.pager .prev + .next { border-left: 1px solid var(--rule); }
.pager .prev .label::before { content: "\2190\00a0"; }
.pager .next .label::after { content: "\00a0\2192"; }
.pager .t { color: var(--ink); font: 500 20px/1.25 var(--serif); font-variation-settings: "opsz" 30; }
.pager a:hover .t { color: var(--rubric); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 18px 0 0; font: 400 13px/1.4 var(--sans); }
.doc-meta a { color: var(--ink-2); text-decoration-color: var(--rule); }
.doc-meta a:hover { color: var(--rubric); text-decoration-color: currentColor; }
.doc-disclaimer { margin: 12px 0 0; color: var(--ink-3); font-size: 14px; line-height: 1.55; }

/* ---------- drawer backdrop (the drawer itself is .guides, below 720px) ---------- */

.backdrop { position: fixed; z-index: 45; inset: 0; background: rgb(18 14 10 / .45); }

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

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 56px;
  padding: 14px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 3px double var(--ink);
  color: var(--ink-3);
  font: 400 12px/1.5 var(--sans);
}
.site-foot p { margin: 0; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-foot a { color: var(--ink-3); text-decoration: none; }
.site-foot a:hover { color: var(--rubric); text-decoration: underline; }

/* ---------- 404 ---------- */

.notfound { position: relative; max-width: 60rem; padding: 72px 0 40px 84px; }
.nf-mark { position: absolute; top: 88px; left: 0; margin: 0; color: var(--rubric); font: 400 26px/1 var(--serif); font-variation-settings: "opsz" 36; }
.notfound h1 {
  margin: 0 0 18px;
  color: var(--ink);
  font: 400 clamp(52px, 8vw, 110px)/.95 var(--serif);
  font-variation-settings: "opsz" 144;
  letter-spacing: -.02em;
}
.notfound .lede { max-width: 36rem; margin-bottom: 24px; }

/* ---------- tablet and up ---------- */

@media (min-width: 720px) {
  .menu-btn, .backdrop { display: none !important; }
  .page-landing .guides, .page-404 .guides { display: none; }
  .doc-layout { grid-template-columns: 210px minmax(0, var(--measure)); gap: 0 36px; }
  .page-doc .guides {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-bottom: 16px;
    scrollbar-width: thin;
  }
}

@media (min-width: 720px) and (max-width: 1199px) {
  .steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .step-source { grid-column: 1 / -1; border-bottom: 1px solid var(--rule); }
  .step-case { border-left: 0; }
  .site-nav { gap: 14px; }
  .search { flex-basis: 190px; min-width: 120px; }
}

/* ---------- desktop ---------- */

@media (min-width: 1200px) {
  .doc-layout { grid-template-columns: 230px minmax(0, var(--measure)) 210px; justify-content: space-between; gap: 0 48px; }
  .onpage { display: block; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding-bottom: 16px; }
  .onpage-inline { display: none; }
  .contents { columns: 2; }
}

/* ---------- phone ---------- */

@media (max-width: 719px) {
  .site-head { flex-wrap: wrap; gap: 8px 10px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .brand { min-height: 44px; }
  .crumb { flex: 1 1 0; line-height: 44px; }
  .crumb a { padding-block: 15px; }
  .site-nav { display: none; }
  .theme-toggle { width: 44px; height: 44px; margin-left: auto; }
  .menu-btn { height: 44px; padding: 0 14px; }
  .search { flex: 1 0 100%; order: 5; min-width: 0; }
  .search input { height: 44px; font-size: 16px; }
  .search kbd { display: none; }
  .search-results { left: 0; width: auto; }
  .search-results a { min-height: 44px; }

  .btn { height: auto; min-height: 44px; padding: 0 18px; }
  .copy { min-height: 32px; padding: 4px 10px; }
  .copy::after { content: ""; position: absolute; top: 50%; left: 50%; width: max(100%, 44px); height: 44px; transform: translate(-50%, -50%); }
  .code figcaption { min-height: 46px; padding-block: 0; }
  .code pre { font-size: 12.5px; }
  .table-wrap table { font-size: 14px; }
  .prose .anchor { position: relative; display: inline-block; min-width: 24px; text-align: center; }
  .prose .anchor::before { content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }

  .hero { padding: 26px 0 26px; }
  .hero-top { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 24px; }
  .lede { font-size: 17px; }
  .band { padding: 24px 0 26px; }
  .band h2 { font-size: 25px; }
  .three { grid-template-columns: minmax(0, 1fr); }
  .three > div, .three > div + div { padding: 14px 0 12px; border-left: 0; }
  .three > div + div { border-top: 1px solid var(--rule); }
  .legend li { grid-template-columns: 18px minmax(0, 1fr); align-items: baseline; row-gap: 10px; padding: 12px 14px; }
  .legend .stamp { grid-column: 2; justify-self: start; }
  .legend .stamp::after { content: ""; position: absolute; inset: -13px -6px; }
  .contents { columns: 1; }
  .contents a { flex-wrap: wrap; row-gap: 0; min-height: 44px; padding: 8px 0; }
  .contents .lead { display: none; }
  .contents .d { flex-basis: 100%; padding-left: 48px; text-align: left; }

  .specimen { overflow: visible; border: 0; border-radius: 0; background: none; }
  .spec-tabs { display: none; }
  .spec-panels {
    display: flex;
    gap: 12px;
    margin-inline: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
    padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px));
    scrollbar-width: none;
  }
  .spec-panels::-webkit-scrollbar { display: none; }
  .spec-panel {
    display: flex;
    flex: 0 0 86%;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--ink);
    border-radius: var(--r);
    background: var(--paper);
    scroll-snap-align: start;
  }
  .spec-panel + .spec-panel { border-top: 1px solid var(--ink); }
  .spec-cmd, .step-h { display: none; }
  .spec-label {
    display: block;
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-2);
    color: var(--ink);
    font: 600 13px/1.3 var(--sans);
  }
  .steps { display: flex; flex-direction: column; }
  .step { padding: 14px; }
  .step + .step { border-left: 0; }
  .step-outcome { order: -1; }
  .step-source { border-top: 1px solid var(--rule); }
  .step-case { display: none; }
  /* A short excerpt that never scrolls sideways inside a swipeable card. */
  .step-source pre { max-height: calc(17 * 1.62em + 12px); overflow: hidden; font-size: 11.5px; }
  .spec-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
  .spec-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
  .spec-dots i.on { background: var(--rubric); }
  .spec-foot { padding: 10px 0 0; border-top: 0; text-align: center; }

  .doc-layout { padding-top: 18px; }
  .guides { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
  .guides li a { min-height: 44px; }
  .onpage-inline ol { columns: 1; }
  .onpage-inline a { display: flex; align-items: center; min-height: 44px; }
  .onpage-inline summary { min-height: 44px; }
  .prose > p:first-child { font-size: 18px; }
  .prose h2 { font-size: 23px; }
  .prose h3 { font-size: 18px; }
  .pager .t { font-size: 17px; }
  .doc-meta a, .site-foot a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-foot { margin-top: 40px; }

  .notfound { padding: 40px 0 24px; }
  .nf-mark { position: static; margin-bottom: 14px; }

  /* With JavaScript the guides become an off-canvas drawer; without it they stay inline. */
  html.js .guides {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 86vw);
    margin: 0;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 18px calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--ink);
    border-bottom: 0;
    background: var(--paper);
    box-shadow: 20px 0 40px rgb(0 0 0 / .25);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.drawer-open { overflow: hidden; }
  html.js body.drawer-open .guides { transform: none; visibility: visible; transition: transform .22s ease; }
  html.js .guides-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
}

/* ---------- motion and print ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  body::before, .skip, .site-nav, .search, .theme-toggle, .menu-btn, .guides, .onpage, .onpage-inline,
  .backdrop, .copy, .anchor, .spec-tabs, .spec-dots, .pager, .doc-meta { display: none !important; }
  *, *::before, *::after { background: transparent !important; box-shadow: none !important; color: #000 !important; }
  html { color-scheme: light !important; background: #fff !important; }
  body { padding: 0; }
  .doc-layout { display: block; }
  .spec-panel[hidden] { display: block !important; }
  .code pre, .spec-cmd code, .cmd code { overflow: visible; white-space: pre-wrap; }
  .table-wrap { overflow: visible; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  h2, h3 { break-after: avoid; }
  .code, table, blockquote, .legend li { break-inside: avoid; }
}
