/* rootpy — site styles
 *
 * One accent colour on a monochrome page. Everything else is spacing,
 * hairlines and type. Dark is the default; light is warm paper.
 */

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */

:root {
  --bg:          #0a0a0b;
  --bg-2:        #0e0e10;
  --surface:     #121215;
  --surface-2:   #17171b;
  --surface-3:   #1d1d22;
  --line:        #26262c;
  --line-2:      #34343c;
  --text:        #eceae5;
  --text-2:      #a2a19d;
  /* text-3 carries the sidebar links and every small label, so it has to stay
     readable. It was #6c6c72, which is 3.2:1 on the lightest surface -- below
     the 4.5:1 that normal text needs. This keeps the same cool-grey hue. */
  --text-3:      #89898f;
  --accent:      #f7ebd5;
  --accent-2:    #e0caa2;
  --accent-soft: rgba(247, 235, 213, 0.09);
  --accent-line: rgba(247, 235, 213, 0.22);
  --danger:      #e8927c;
  --ok:          #9fc7a6;

  /* Comments stay the dimmest thing in a code block, but not dimmer than
     4.5:1 on --surface. #58585f read 2.65:1, which is hard to read. */
  --t-com:   #7c7c83;
  --t-str:   #c7b48d;
  --t-kw:    #f7ebd5;
  --t-const: #d8c8a2;
  --t-num:   #c3bcae;
  --t-fn:    #ffffff;
  --t-meth:  #e6e2da;
  --t-attr:  #adaba6;
  --t-cls:   #efe1c2;
  --t-dec:   #b9a786;
  --t-mod:   #d0cdc6;
  --t-flag:  #c7b48d;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 8px 30px rgba(0, 0, 0, .5);
  --shadow-3: 0 24px 70px rgba(0, 0, 0, .65);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono',
               Menlo, Consolas, 'Liberation Mono', monospace;

  --topbar-h: 58px;
  --sidebar-w: 268px;
  --content-max: 820px;
  --radius: 8px;
  --radius-sm: 5px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme='light'] {
  --bg:          #f7ebd5;
  --bg-2:        #f3e5cb;
  --surface:     #fdf8ee;
  --surface-2:   #fbf3e4;
  --surface-3:   #f6ecd9;
  --line:        #e0cfb0;
  --line-2:      #cdb88f;
  --text:        #17171a;
  --text-2:      #55524b;
  --text-3:      #686352;
  --accent:      #1d1a14;
  --accent-2:    #3b3527;
  --accent-soft: rgba(29, 26, 20, 0.06);
  --accent-line: rgba(29, 26, 20, 0.22);
  --danger:      #a3402a;
  --ok:          #3d6b46;

  --t-com:   #797260;
  --t-str:   #7a5a18;
  --t-kw:    #1d1a14;
  --t-const: #5c4a1c;
  --t-num:   #4a453a;
  --t-fn:    #0d0c0a;
  --t-meth:  #2a2720;
  --t-attr:  #56524a;
  --t-cls:   #3f3822;
  --t-dec:   #6d5d33;
  --t-mod:   #3a362d;
  --t-flag:  #7a5a18;

  --shadow-1: 0 1px 2px rgba(80, 60, 20, .10);
  --shadow-2: 0 8px 30px rgba(80, 60, 20, .14);
  --shadow-3: 0 24px 70px rgba(80, 60, 20, .20);
}

/* ------------------------------------------------------------------ *
 * Reset
 * ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 560;
  letter-spacing: -0.017em;
  line-height: 1.25;
  color: var(--text);
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* The browser hides [hidden] with display:none from its own stylesheet, which
   any author `display` rule then beats. Several blocks here are flex or grid
   AND start hidden, so without this they show up regardless of the attribute. */
[hidden] { display: none !important; }

a {
  color: var(--text);
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color .15s var(--ease), text-decoration-color .15s var(--ease);
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

code, kbd, pre { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--accent); color: var(--bg); }

/* ------------------------------------------------------------------ *
 * Page furniture
 * ------------------------------------------------------------------ */

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme='light'] .grain { opacity: .05; }

.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 60;
  transition: width .08s linear;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ *
 * Top bar
 * ------------------------------------------------------------------ */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand .mark {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand .mark::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 1px 7px;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }

/* ------------------------------------------------------------------ *
 * Contributors: a button in the top bar, and the panel it opens
 * ------------------------------------------------------------------ */

.credits { position: relative; flex-shrink: 0; }

.creditsbtn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s var(--ease), background .15s var(--ease),
              border-color .15s var(--ease);
}
.creditsbtn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.creditsbtn[aria-expanded='true'] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}
.creditsbtn svg { width: 14px; height: 14px; flex-shrink: 0; }
.creditsbtn .chev svg { width: 12px; height: 12px; }
.creditsbtn .chev {
  display: inline-flex;
  opacity: .6;
  transition: transform .18s var(--ease);
}
.creditsbtn[aria-expanded='true'] .chev { transform: rotate(180deg); }

.credits-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: 254px;
  max-width: calc(100vw - 28px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.person + .person {
  margin-top: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.person-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 4px 6px;
}
.person-links { display: flex; flex-direction: column; gap: 2px; }
.person-links a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12.5px;
  text-decoration: none;
  transition: color .13s var(--ease), background .13s var(--ease);
}
.person-links a:hover { color: var(--text); background: var(--surface-2); }
.person-links svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .8; }
.person-links .who { font-family: var(--font-mono); font-size: 12px; }

.searchbtn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  min-width: 210px;
  padding: 0 8px 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.searchbtn:hover { border-color: var(--line-2); background: var(--surface-2); }
.searchbtn .lbl { flex: 1; text-align: left; }
.searchbtn svg { width: 14px; height: 14px; opacity: .65; flex-shrink: 0; }

kbd {
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-3);
  white-space: nowrap;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease),
              border-color .15s var(--ease);
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.iconbtn svg { width: 16px; height: 16px; }

.topbar-links { display: flex; align-items: center; gap: 2px; }

#menu-toggle { display: none; }

/* ------------------------------------------------------------------ *
 * Shell
 * ------------------------------------------------------------------ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
  padding-top: var(--topbar-h);
  position: relative;
  z-index: 2;
}

/* ------------------------------------------------------------------ *
 * Sidebar
 * ------------------------------------------------------------------ */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 12px 60px 20px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 8px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

.nav-group + .nav-group { margin-top: 3px; }

.nav-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-head:hover { color: var(--text); background: var(--surface); }
.nav-head[aria-expanded='true'] { color: var(--text); }
/* The heading itself is what you are reading, before any one recipe is. */
.nav-head.active { color: var(--accent); background: var(--accent-soft); }
.nav-head.active .num { color: var(--accent); opacity: .75; }
.nav-head .caret {
  width: 11px; height: 11px;
  flex-shrink: 0;
  opacity: .5;
  transition: transform .2s var(--ease);
}
.nav-head[aria-expanded='true'] .caret { transform: rotate(90deg); }
.nav-head .num {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.nav-items {
  display: none;
  margin: 1px 0 6px;
  padding-left: 19px;
  border-left: 1px solid var(--line);
  margin-left: 15px;
}
.nav-head[aria-expanded='true'] + .nav-items { display: block; }

.nav-items a {
  display: block;
  position: relative;
  padding: 4.5px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  transition: color .13s var(--ease), background .13s var(--ease);
}
.nav-items a:hover { color: var(--text); background: var(--surface); }
.nav-items a.active { color: var(--accent); background: var(--accent-soft); }
.nav-items a.active::before {
  content: '';
  position: absolute;
  left: -20px; top: 50%;
  transform: translateY(-50%);
  width: 1px; height: 15px;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: 26px;
  padding: 14px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ------------------------------------------------------------------ *
 * Main
 * ------------------------------------------------------------------ */

.main {
  min-width: 0;
  padding: 0 40px 140px;
}
.wrap { max-width: var(--content-max); margin: 0 auto; }

section[id] { scroll-margin-top: calc(var(--topbar-h) + 22px); }
[id] { scroll-margin-top: calc(var(--topbar-h) + 22px); }

/* ------------------------------------------------------------------ *
 * Hero
 * ------------------------------------------------------------------ */

.hero {
  padding: 74px 0 54px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 22px;
}
.eyebrow .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero h1 {
  font-size: clamp(40px, 6.4vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.038em;
  font-weight: 620;
  margin-bottom: 20px;
}
.hero h1 .accent { color: var(--accent); }

.hero .lede {
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 62ch;
  margin-bottom: 30px;
}
.hero .lede strong { color: var(--text); font-weight: 560; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 34px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 3px 11px;
}
.tag.accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ------------------------------------------------------------------ *
 * The install block — the first thing on the page
 * ------------------------------------------------------------------ */

.install {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.install-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.install-top .dots { display: flex; gap: 5px; }
.install-top .dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-2);
  display: block;
}
.install-top .dots i:first-child { background: var(--accent-2); opacity: .55; }

.install-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
}
.install-body .prompt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 17px;
  user-select: none;
  flex-shrink: 0;
}
.install-body code {
  flex: 1;
  font-size: clamp(14px, 2.4vw, 18px);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.install-body code::-webkit-scrollbar { display: none; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s var(--ease);
}
.copy:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.copy.done { color: var(--accent); border-color: var(--accent); }
.copy svg { width: 13px; height: 13px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 17px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--line-2);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.btn:hover { border-color: var(--accent-line); background: var(--surface-2); color: var(--text); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 560;
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.btn svg { width: 15px; height: 15px; }
.btn.small { height: 32px; padding: 0 13px; font-size: 12.5px; }

/* ------------------------------------------------------------------ *
 * The reader's own ids
 * ------------------------------------------------------------------ */

.ids-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.ids-head > div { flex: 1; min-width: 0; }
.ids-head h2 {
  font-size: 22px;
  letter-spacing: -0.022em;
  margin-bottom: 9px;
}
.ids-head p {
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 72ch;
}
.ids-head .btn { flex-shrink: 0; }

.ids-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
#ids.has-values .ids-fields { border-color: var(--accent-line); }

.id-field { display: grid; gap: 5px; min-width: 0; }
.id-field label {
  font-size: 12px;
  font-weight: 560;
  letter-spacing: .01em;
  color: var(--text);
}
.id-field input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  transition: border-color .15s var(--ease);
}
.id-field input::placeholder { color: var(--text-3); }
.id-field input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.id-field .id-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.45; }

.ids-state {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* A blank inside a code sample. Dashed while it is still a name, an ordinary
   string once the reader has filled it in. */
.t-ph {
  cursor: pointer;
  border-bottom: 1px dashed var(--accent-line);
  border-radius: 2px;
  transition: background .13s var(--ease);
}
.t-ph:hover { background: var(--accent-soft); }
.t-ph.filled {
  color: var(--t-str);
  border-bottom-color: transparent;
}
.t-ph.filled:hover { border-bottom-color: var(--accent-line); }

@media (max-width: 720px) {
  .ids-fields { grid-template-columns: minmax(0, 1fr); }
  .ids-head { flex-direction: column; gap: 14px; }
}

/* ------------------------------------------------------------------ *
 * Sections
 * ------------------------------------------------------------------ */

.section { padding: 62px 0 0; }
.section + .section { border-top: 1px solid var(--line); }

.section-head { margin-bottom: 30px; }
.section-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 11px;
}
.section-head h2 {
  font-size: 29px;
  letter-spacing: -0.026em;
  margin-bottom: 11px;
}
.section-head p {
  color: var(--text-2);
  font-size: 15.5px;
  max-width: 68ch;
}

.anchor {
  color: var(--text-3);
  opacity: 0;
  margin-left: 9px;
  font-weight: 400;
  text-decoration: none;
  transition: opacity .15s var(--ease);
}
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

/* ------------------------------------------------------------------ *
 * Recipes
 * ------------------------------------------------------------------ */

.recipe { padding: 30px 0; }
.recipe + .recipe { border-top: 1px dashed var(--line); }

.recipe h3 {
  font-size: 18px;
  letter-spacing: -0.018em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.recipe > p {
  color: var(--text-2);
  font-size: 14.5px;
  margin-bottom: 15px;
  max-width: 70ch;
}

/* ------------------------------------------------------------------ *
 * Code blocks
 * ------------------------------------------------------------------ */

.code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin: 0 0 15px;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px 0 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.code-head .lang {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.code-head .file {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.code-head .sp { flex: 1; }

pre {
  margin: 0;
  padding: 15px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
pre::-webkit-scrollbar { height: 9px; }
pre::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }
pre::-webkit-scrollbar-thumb:hover { background: var(--line-2); }
pre code { color: var(--text); background: none; padding: 0; font-size: inherit; }

.t-com   { color: var(--t-com); font-style: italic; }
.t-str   { color: var(--t-str); }
.t-kw    { color: var(--t-kw); font-weight: 500; }
.t-const { color: var(--t-const); }
.t-num   { color: var(--t-num); }
.t-fn    { color: var(--t-fn); }
.t-meth  { color: var(--t-meth); }
.t-attr  { color: var(--t-attr); }
.t-cls   { color: var(--t-cls); }
.t-dec   { color: var(--t-dec); font-style: italic; }
.t-mod   { color: var(--t-mod); }
.t-flag  { color: var(--t-flag); }
.t-constname { color: var(--t-const); }

p code, li code, td code, .note code, dd code {
  font-size: .89em;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  /* Not nowrap. A short identifier fits and stays on one line anyway, but a
     long quoted error message inside prose pushed the whole page wider than
     the viewport. break-word only breaks what cannot fit. */
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ------------------------------------------------------------------ *
 * Notes, warnings, gotchas
 * ------------------------------------------------------------------ */

.notes {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}
.notes li {
  position: relative;
  padding-left: 17px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 5px;
}
.notes li::before {
  content: '';
  position: absolute;
  left: 2px; top: 9px;
  width: 4px; height: 1px;
  background: var(--text-3);
}

.note {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 13px 0 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}
.note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; }
.note strong { color: var(--text); font-weight: 560; }
.note.warn {
  border-color: var(--line-2);
  border-color: color-mix(in srgb, var(--danger) 36%, var(--line));
  background: var(--surface-2);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}
.note.warn svg { color: var(--danger); }

.gotchas {
  display: grid;
  /* min(258px, 100%) rather than a bare 258px: on a narrow phone a fixed
     track minimum is wider than the container, and the grid overflows the
     page instead of shrinking. */
  grid-template-columns: repeat(auto-fit, minmax(min(258px, 100%), 1fr));
  gap: 13px;
  margin-top: 26px;
}
.gotcha {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
  /* A grid item's automatic minimum is its min-content width. One note here
     names a whole method path, which made the column 427px wide inside a
     375px phone. */
  min-width: 0;
}
.gotcha:hover { border-color: var(--line-2); transform: translateY(-1px); }
.gotcha h4 {
  font-size: 13.5px;
  font-weight: 580;
  margin-bottom: 7px;
  color: var(--accent);
  letter-spacing: -0.008em;
}
.gotcha p { font-size: 13px; color: var(--text-2); line-height: 1.6; }
/* `anywhere`, not `break-word`: both break a word that does not fit, but only
   `anywhere` also lowers the min-content width, which is what the grid track
   above is sized from. Ordinary prose is unaffected either way. */
.gotcha h4, .gotcha p { overflow-wrap: anywhere; }

.subhead {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 40px 0 18px;
}
.subhead h3 { font-size: 15px; font-weight: 580; white-space: nowrap; }
.subhead .rule { flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------------ *
 * API explorer
 * ------------------------------------------------------------------ */

.explorer { margin-top: 24px; }

.exp-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  padding: 12px 0;
  background: linear-gradient(var(--bg) 72%, transparent);
}
.exp-input {
  flex: 1;
  min-width: 210px;
  height: 36px;
  padding: 0 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.exp-input::placeholder { color: var(--text-3); }
/* outline:none here would beat the global :focus-visible rule on
   specificity, so replace the ring rather than remove it. */
.exp-input:focus {
  border-color: var(--accent-line);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.seg {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  padding: 0 13px;
  height: 34px;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--text-3);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .13s var(--ease), background .13s var(--ease);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); background: var(--surface-2); }
.seg button.on { color: var(--accent); background: var(--accent-soft); }

.exp-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.ns {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 9px;
  overflow: hidden;
}
.ns-head {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .13s var(--ease);
}
.ns-head:hover { background: var(--surface-2); }
.ns-head .caret {
  width: 11px; height: 11px; opacity: .5; flex-shrink: 0;
  transition: transform .2s var(--ease);
}
.ns-head[aria-expanded='true'] .caret { transform: rotate(90deg); }
.ns-head .path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.ns-head .cls {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}
.ns-head .n {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  flex-shrink: 0;
}
.ns-doc {
  /* First child of .ns-body, which carries the rule above it. A negative
     top margin here pulls the first line of text up onto that rule. */
  padding: 11px 14px 2px 36px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
}

.ns-body { display: none; border-top: 1px solid var(--line); }
.ns-head[aria-expanded='true'] + .ns-body { display: block; }

.m {
  padding: 11px 14px 11px 36px;
  border-bottom: 1px solid var(--line);
}
.m:last-child { border-bottom: 0; }
.m:hover { background: var(--surface-2); }
.m-sig {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.m-sig .aw { color: var(--t-kw); font-weight: 500; }
.m-sig .nm { color: var(--text); font-weight: 500; }
.m-sig .ret { color: var(--text-3); }
.m-doc { font-size: 12.5px; color: var(--text-3); margin-top: 4px; line-height: 1.55; }
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  color: var(--text-3);
  margin-left: 8px;
  vertical-align: middle;
}
.badge.prop { color: var(--accent-2); border-color: var(--accent-line); }

.exp-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* tables used by the enum / exception views */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  font-weight: 560;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.mono { font-family: var(--font-mono); color: var(--text); font-size: 12.5px; }
.tbl td.num { font-family: var(--font-mono); color: var(--accent-2); }

/* ------------------------------------------------------------------ *
 * Command palette
 * ------------------------------------------------------------------ */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 20px 20px;
}
.palette-backdrop.open { display: flex; animation: fade .13s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.palette {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: rise .16s var(--ease);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.palette-input-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}
.palette-input-row svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.palette input {
  flex: 1;
  height: 50px;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.palette input::placeholder { color: var(--text-3); }

.palette-results {
  max-height: 58vh;
  overflow-y: auto;
  padding: 7px;
  scrollbar-width: thin;
}
.palette-results::-webkit-scrollbar { width: 8px; }
.palette-results::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.p-group {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 9px 11px 5px;
}
.p-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 11px;
  border-radius: 6px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.p-item:hover, .p-item.sel { background: var(--accent-soft); }
.p-item.sel { box-shadow: inset 0 0 0 1px var(--accent-line); }
.p-item .p-ic {
  width: 22px; height: 22px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}
.p-item.sel .p-ic { background: var(--accent); color: var(--bg); }
.p-item .p-txt { min-width: 0; flex: 1; }
.p-item .p-t {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-item .p-s {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}
/* The hovered or selected row lays a cream tint over the panel, which lifts
   the background and drops --text-3 under 4.5:1. Brighten the subtitle on
   those two rows only; it also reads as part of the highlight. */
.p-item:hover .p-s, .p-item.sel .p-s { color: var(--text-2); }
.p-item mark { background: none; color: var(--accent); font-weight: 600; }

.palette-foot {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-3);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

.p-empty { padding: 34px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ------------------------------------------------------------------ *
 * Footer
 * ------------------------------------------------------------------ */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 70px;
  padding: 34px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-3);
}
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
.foot .disclaim { max-width: 46ch; line-height: 1.6; }

/* ------------------------------------------------------------------ *
 * Toast
 * ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translate(-50%, 16px);
  z-index: 95;
  padding: 9px 17px;
  border-radius: 100px;
  background: var(--accent);
  color: var(--bg);
  font-size: 13px;
  font-weight: 560;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
  box-shadow: var(--shadow-2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1080px) {
  /* Between the sidebar breakpoint and full width the content column gets
     tight. Give it back some room rather than squeezing the code blocks. */
  :root { --sidebar-w: 228px; }
  .main { padding: 0 28px 120px; }
  .sidebar { padding-left: 16px; }
}

@media (max-width: 900px) {
  #menu-toggle { display: inline-flex; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: min(85vw, 320px);
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    z-index: 45;
    transform: translateX(-102%);
    transition: transform .22s var(--ease);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: none; }
  .nav-scrim {
    position: fixed;
    inset: var(--topbar-h) 0 0;
    background: rgba(0, 0, 0, .5);
    z-index: 44;
    display: none;
  }
  .nav-scrim.open { display: block; }
  .searchbtn { min-width: 0; }
  .searchbtn .lbl, .searchbtn kbd { display: none; }
  .searchbtn { width: 32px; padding: 0; justify-content: center; }
  /* The top bar gets tight. Keep the button, drop the words. */
  .creditsbtn { width: 32px; padding: 0; justify-content: center; }
  .creditsbtn .lbl, .creditsbtn .chev { display: none; }
  .main { padding: 0 20px 100px; }
  .hero { padding: 48px 0 40px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .topbar { gap: 10px; padding: 0 14px; }
  .brand .chip { display: none; }
  /* The button is too far right on a phone to hang a 254px panel off it.
     Measure the panel from the bar instead, so it cannot run off the edge. */
  .credits { position: static; }
  .credits-panel {
    left: 14px;
    right: auto;
    width: min(300px, calc(100vw - 28px));
  }
  .main { padding: 0 16px 80px; }
  .hero h1 { font-size: 34px; }
  .hero .lede { font-size: 16px; }
  .install-body { padding: 15px 13px; gap: 9px; }
  .install-body .prompt { font-size: 14px; }
  .copy .lbl { display: none; }
  .copy { padding: 0 9px; }
  .section { padding: 44px 0 0; }
  .section-head h2 { font-size: 23px; }
  .gotchas { grid-template-columns: 1fr; }
  pre { font-size: 12px; padding: 13px; }
  .m { padding-left: 14px; }
  .ns-doc { padding-left: 14px; }
  .exp-bar { position: static; }
}

@media print {
  .topbar, .sidebar, .palette-backdrop, .progress, .grain, .copy { display: none !important; }
  .shell { display: block; padding-top: 0; }
  .main { padding: 0; }
}

/* ------------------------------------------------------------------ *
 * The three starter scripts
 * ------------------------------------------------------------------ */

.starter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 15px;
}
.starter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.starter-tabs button:hover { color: var(--text); border-color: var(--line-2); }
.starter-tabs button[aria-selected='true'] {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.starter-tabs .n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  width: 19px; height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--text-3);
  flex-shrink: 0;
}
.starter-tabs button[aria-selected='true'] .n {
  border-color: var(--accent);
  color: var(--accent);
}

.starter-panel-blurb {
  color: var(--text-2);
  font-size: 14.5px;
  margin-bottom: 13px;
  max-width: 70ch;
}
.starter-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
}
.starter-more:hover { color: var(--accent); }
.starter-more svg { width: 13px; height: 13px; }
