/* kex docs — design tokens ported from kex.run (see module comment) */

:root {
  --bg: #fcf5e2;
  --bg-subtle: #f6ecd0;
  --bg-muted: #f0e2bc;
  --bg-sunken: #ead9a8;
  --ink: #2a1c0a;
  --ink-soft: #54380f;
  --muted: #7a5a25;
  --faint: #9c7a3c;
  --line: #ecdcb4;
  --line-strong: #dbc78c;
  --accent: #b06a14;
  --accent-strong: #8a4f0a;
  --accent-soft: #f4e2b8;
  --accent-ink: #5a3408;
  --code-bg: #1b140a;
  --code-bg-soft: #221a0e;
  --code-border: #382a16;
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* JetBrains Mono ships programming ligatures (-> to a single arrow, =>,
   !=, ...) on by default. They read well in code blocks, so they stay
   there — but in the search box the reader is TYPING, and -> must
   appear exactly as entered. Disable ligatures there only. */
.search-modal-panel input, .search-page-box input {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0, "dlig" 0;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(236, 178, 94, 0.28), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
}

::selection { background: var(--accent-soft); color: var(--accent-ink); }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  color: var(--ink);
}

.wrap { width: 100%; max-width: 76rem; margin-inline: auto; padding-inline: 1.5rem; }

/* ── Header ─────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(252, 245, 226, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top-inner { display: flex; align-items: center; gap: 0.75rem; height: 3.5rem; }

/* ── Search ─────────────────────────────────────────────────────────── */

.search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 2.1rem;
  min-width: 14rem;
  padding: 0 0.7rem;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.search-trigger:hover { border-color: var(--accent); color: var(--ink); }
.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--faint);
}

/* The modal is frosted glass: a translucent warm panel over a blurred
   backdrop, in the same voice as the sticky header. */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(42, 28, 10, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.search-modal[hidden] { display: none; }

.search-modal-panel {
  width: min(44rem, 92vw);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(236, 220, 180, 0.9);
  box-shadow: 0 24px 72px rgba(42, 28, 10, 0.35);
}

.search-modal-panel input {
  width: 100%;
  box-sizing: border-box;
  padding: 1.05rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(236, 220, 180, 0.9);
  outline: none;
}
.search-modal-panel input::placeholder { color: var(--faint); }

.search-modal-results { max-height: 55vh; overflow-y: auto; padding: 0.5rem; }

.search-hit {
  display: block;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.1rem;
  border-radius: 10px;
  text-decoration: none;
}
.search-hit:hover { background: rgba(246, 236, 208, 0.6); }
.search-hit.selected { background: rgba(244, 226, 184, 0.9); }

.search-head { display: flex; align-items: baseline; gap: 0.6rem; }

.search-kind {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}
/* Each kind has its own hue, so a scan down the list separates
   functions from types from modules at a glance. */
.search-kind-module { color: #6b5bd2; }
.search-kind-function { color: #2f855a; }
.search-kind-make { color: #b06a14; }
.search-kind-trait { color: #c2498a; }
.search-kind-record { color: #2b6cb0; }
.search-kind-type { color: #0f8a8a; }
.search-kind-constant { color: #9a5a13; }
.search-name { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--ink); }
.search-qual { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: right; }
.search-sig {
  display: block;
  margin-top: 0.15rem;
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-empty { padding: 0.8rem 0.9rem; font-size: 13px; color: var(--faint); }

.search-modal-footer {
  border-top: 1px solid rgba(236, 220, 180, 0.9);
  padding: 0.55rem 0.9rem;
  font-size: 12.5px;
}
.search-modal-footer a { color: var(--accent-strong); text-decoration: none; }
.search-modal-footer a:hover { text-decoration: underline; }

/* The empty state: an explainer, example chips, and this page's items. */
.search-hint, .search-local { padding: 0.8rem 1rem 0.6rem; }

.search-hint-title { margin: 0 0 0.25rem; font-size: 13px; font-weight: 600; color: var(--ink); }
.search-hint-body { margin: 0 0 0.6rem; font-size: 12.5px; color: var(--muted); }

.search-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.search-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0.25rem 0.6rem;
  color: var(--ink-soft);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.search-chip:hover { border-color: var(--accent); color: var(--ink); }

.search-local { border-top: 1px solid rgba(236, 220, 180, 0.7); }

/* ── Full search page ──────────────────────────────────────────────── */

.search-page { max-width: 52rem; }

.search-page-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  background: rgba(246, 236, 208, 0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.search-page-box input:focus { border-color: var(--accent); }

.search-page-results { margin-top: 1.25rem; }

.search-page-hit {
  display: block;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.search-page-hit:hover { background: var(--bg-subtle); }

.search-summary {
  display: block;
  margin-top: 0.25rem;
  font-size: 13px;
  color: var(--muted);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  padding-top: 0.2rem;
}

.spacer { flex: 1; }

.pkg-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
}

.version-select {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.15rem 0.4rem 0.15rem 0.7rem;
  cursor: pointer;
}

.version-select:hover { border-color: var(--accent); }

.back { font-size: 13.5px; color: var(--muted); }
.back:hover { color: var(--accent-strong); }

/* ── Layout ─────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  gap: 3rem;
  grid-template-columns: 15rem minmax(0, 1fr);
  padding-block: 2.5rem;
}

/* The module list is longer than the viewport, and it is stuck to it —
   so it needs its own scrollbar, or everything past the fold is
   unreachable. The height is what is left below the sticky header. */
.side nav {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
}

.side-heading {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.side-list { list-style: none; margin: 0; padding: 0; }

.side-list > li > a {
  display: block;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 13.5px;
  color: var(--muted);
}

.side-list > li > a:hover { background: var(--bg-subtle); color: var(--ink); }

.side-list > li > a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}

.side-sub { list-style: none; margin: 0.15rem 0 0.4rem; padding: 0 0 0 1.1rem; }

.side-sub a {
  display: block;
  border-radius: 6px;
  padding: 0.15rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.side-sub a:hover { color: var(--accent-strong); background: var(--bg-subtle); }

/* Nested modules ("FS" → "FS.Path"): same voice as the top list, one
   step quieter and indented under their parent. */
.side-nest { list-style: none; margin: 0; padding: 0 0 0.25rem 0.75rem; }
.side-nest > li > a {
  display: block;
  border-radius: 6px;
  padding: 0.18rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
}
.side-nest > li > a:hover { background: var(--bg-subtle); color: var(--ink); }
.side-nest > li > a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}

/* Cross-reference links inside code spans: the code face stays, the
   colour signals "this goes somewhere". */
a.xref { color: var(--accent-strong); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--accent) 45%, transparent); }
a.xref:hover { border-bottom-color: var(--accent-strong); }

.content { min-width: 0; max-width: 48rem; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 1rem;
}

.crumbs a:hover { color: var(--accent-strong); }
.crumbs .sep { opacity: 0.6; }

/* ── Prose ──────────────────────────────────────────────────────────── */

.prose { color: var(--ink-soft); font-size: 1.0125rem; line-height: 1.75; }

.prose h1 { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 1rem; line-height: 1.15; }

/* The standalone index pages (site root, package versions) carry their
   h1 directly in .content.prose — unlike the entity pages, which get
   top breathing room from .layout's padding. Give those a little air
   under the header. */
.content.prose > h1 { margin-top: 2rem; }

.prose h1 .ver {
  font-family: var(--font-mono);
  font-size: 0.45em;
  font-weight: 500;
  color: var(--muted);
  vertical-align: middle;
  letter-spacing: 0;
}

.prose h2 {
  font-size: 1.35rem;
  font-weight: 650;
  margin: 2.6rem 0 0.9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.prose h3 { font-size: 1.05rem; font-weight: 600; margin: 1.6rem 0 0.5rem; }

.prose h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  margin: 1.4rem 0 0.4rem;
}

.prose p { margin: 0 0 1.1rem; }

.prose a { color: var(--accent-strong); text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }

.prose code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-muted);
  border: 1px solid var(--line);
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  color: var(--muted);
}

.prose strong { color: var(--ink); font-weight: 600; }

.lede { font-size: 1.05rem; color: var(--muted); }

/* ── Entities ───────────────────────────────────────────────────────── */

/* Anchor navigation lands a heading below the sticky header, not under
   it: reserve the header's height (3.5rem) plus breathing room. */
.entity, .fn { scroll-margin-top: 4.75rem; }

.entity h2 code { font-size: 0.95em; }

.kind {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}
/* Each declaration kind has its own hue — the same palette as the
   search results — so a module, a trait and a make are told apart at
   a glance rather than all reading as one amber badge. */
.kind-module { color: #6b5bd2; border-color: #d6cdf3; background: #efeafc; }
.kind-function { color: #2f855a; border-color: #c6e6d4; background: #e8f4ec; }
.kind-make { color: #b06a14; border-color: #ecd6ac; background: #f7ecd6; }
.kind-trait { color: #c2498a; border-color: #efcfe0; background: #f9ecf3; }
.kind-record { color: #2b6cb0; border-color: #c8dcf0; background: #e9f1fa; }
.kind-type { color: #0f8a8a; border-color: #c0e4e2; background: #e4f4f3; }
.kind-constant { color: #9a5a13; border-color: #e6d2b4; background: #f6ecdd; }

.fields, .params { margin: 0 0 1.1rem; }

.field, .param {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.field dt, .param dt { flex-shrink: 0; }
.field dd, .param dd { margin: 0; color: var(--muted); font-size: 0.95rem; }

.opt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.5rem;
  margin-left: 0.4rem;
}

.variants { margin: 0 0 1.1rem; padding-left: 1.3rem; list-style: disc; }
.variants li { margin: 0.3rem 0; }
.variants .abstract { color: var(--faint); }

.fn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 0 0 0.9rem;
  background: rgba(255, 255, 255, 0.35);
}

.fn h4 { margin: 0 0 0.4rem; font-size: 1rem; }
.fn p:last-child, .fn pre:last-child { margin-bottom: 0; }

.fn h3 { margin: 0 0 0.4rem; font-size: 1rem; }

/* The heading of a member links to itself, so a reader can copy a
   deep link without hunting for a pilcrow. */
a.self { color: inherit; text-decoration: none; }
a.self:hover code { border-color: var(--accent); }

/* A method's signature leads its box: the call shape first, prose after. */
pre.code.sig { margin-bottom: 0.8rem; padding: 0.6rem 0.9rem; }
pre.code a.xref { color: inherit; border-bottom: 1px dotted color-mix(in oklab, #e6a960 60%, transparent); }

/* "Implements Monoid, Enumerable." / "Implemented by ...": where a
   type's methods come from, said right under its heading. */
.implements, .home-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.1rem;
}

/* A member group inside a type: "Methods", "On [Number]". */
.members { margin-top: 1.8rem; }
.members > h3, .entity > h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

/* Which trait a member fulfils: a small link chip beside its name. */
.tag-trait, .tag-kind, .tag-foul {
  margin-left: 0.5rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid #efcfe0;
  border-radius: 999px;
  background: #f9ecf3;
  color: #c2498a;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.tag-kind { border-color: #e6d2b4; background: #f6ecdd; color: #9a5a13; }
/* Foul: may touch the outside world. The one chip that is a warning. */
.tag-foul { border-color: #efcdc3; background: #fbece7; color: #b4432b; font-weight: 600; }
.index .tag-foul { font-size: 11px; padding: 0.1rem 0.45rem; }
.tag-trait:hover { border-color: #c2498a; }

/* Methods a type gets from a trait without writing them. */
.inherited dt, .elsewhere dt { min-width: 9rem; }

/* ── Reference: finding a member ────────────────────────────────────── */

/* What a declaration offers, ahead of the full entries: one line per
   member, so a long type is read as a list before it is read as a page. */
.summary { margin: 1.4rem 0 2.4rem; }
.summary > h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  margin: 1.5rem 0 0.3rem;
}
.summary > h3:first-child { margin-top: 0; }
.summary > h3 a, .summary > h3 a.xref { color: inherit; text-decoration: none; border-bottom: 0; }
.summary > h3 code:not(pre code) { font-size: 1em; letter-spacing: 0; text-transform: none; }
.summary .params { margin-bottom: 0; }
.summary .param { padding: 0.28rem 0; }
.summary dd { font-size: 0.9rem; }
/* One name column for the whole list, as wide as its longest name and
   its chip, so every summary starts on the same edge. */
.summary .params { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 1.2rem; }
.summary .param { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }

/* A member's entry is a card headed by its signature: a band across the
   top, flush with the card's edges, rather than a box inside a box. The
   band is light, so the dark surface is left to the examples and the two
   are told apart at a glance. What the signature does not say shares the
   band with it, at the right: whether the member is foul, the traits it
   fulfils, its permalink. */
.fn {
  --fn-band: #faf7e4;
  overflow: hidden;
  padding: 0.95rem 1.2rem 1rem;
  border-radius: 12px;
}
.fn:has(> .fn-head) { padding-top: 0; }
.fn-head, .fn > pre.code.sig {
  margin: 0 -1.2rem 0.95rem;
  padding: 0.75rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--fn-band);
}
.fn-head { display: flex; align-items: flex-start; gap: 0.9rem; }
.fn pre.code.sig {
  border: 0;
  border-radius: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.75;
}
/* A signature keeps its line: one longer than its room scrolls there,
   beside the chips, never under them. */
.sig-line { display: block; }
.fn-head > pre.code.sig { flex: 1; min-width: 0; margin: 0; padding: 0; background: none; }
/* A further overload: its own band, part-way down the card. */
.fn > pre.code.sig { margin-top: 1.2rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
/* The token colours are made for the dark code surface. On the band every
   token starts from the band's own ink, and only what helps read a
   signature is picked out: the name, the types, the default values. */
.fn pre.code.sig span { color: inherit; }
.fn pre.code.sig .tok-fn { color: var(--ink); font-weight: 700; }
.fn pre.code.sig .tok-type { color: var(--accent-strong); }
.fn pre.code.sig .tok-op, .fn pre.code.sig .tok-punct { color: var(--faint); }
.fn pre.code.sig :is(.tok-string, .tok-number, .tok-bool, .tok-atom) { color: var(--accent); }
.fn pre.code.sig a.xref { border-bottom-color: color-mix(in oklab, var(--accent) 45%, transparent); }

/* The heading beside a signature repeats its name, so only its chips show. */
.fn-head > :is(h3, h4) {
  order: 2;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  line-height: 1;
}
.fn-head > :is(h3, h4) a.self { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.fn :is(h3, h4) :is(.tag-trait, .tag-kind, .tag-foul) { margin-left: 0; }
.fn > :is(h3, h4) a.self + :is(.tag-trait, .tag-kind, .tag-foul, .permalink) { margin-left: 0.5rem; }
.fn h5 { margin: 0.9rem 0 0.35rem; }

/* Parameters as two aligned columns, and what comes back labelled the
   same way: inside a card the rules between rows are one frame too many. */
.fn .params { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1rem; margin-bottom: 0.9rem; }
.fn .param { display: contents; }
.fn .returns { color: var(--muted); font-size: 0.95rem; }
.fn .returns strong {
  margin-right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
}

/* A block of example code, and the control that copies it: in the block's
   corner, waiting for the pointer like a card's permalink. */
.code-block { position: relative; margin: 0 0 1.1rem; }
.code-block > pre.code { margin: 0; }
.fn .code-block:last-child { margin-bottom: 0; }
.copy-code {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  height: 1.6rem;
  padding: 0 0.55rem;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  background: var(--code-bg-soft);
  box-shadow: 0 0 0 0.35rem var(--code-bg);
  color: #c9bfa9;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, opacity 0.15s;
}
.copy-code:hover { color: #fff; border-color: #e6a960; }
.copy-code.copied { color: #8fd3a8; border-color: #3d6b4c; }
@media (hover: hover) {
  .copy-code { opacity: 0; }
  .code-block:hover .copy-code, .copy-code:focus-visible, .copy-code.copied { opacity: 1; }
}

/* The address of a declaration or member: a link to its own anchor that
   the page script also copies to the clipboard. */
.prose a.permalink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s, opacity 0.15s;
}
.prose a.permalink:hover { color: var(--accent-strong); border-color: var(--accent); }
.prose a.permalink.copied { color: #2f855a; border-color: #c6e6d4; background: #e8f4ec; }
.entity > h2 a.permalink { margin-left: 0.4rem; }
/* With a pointer, a permalink waits for it: beside a declaration's heading,
   and in the corner of a member's card, where it takes no room from the
   signature until the card is under the pointer. Without one it is always
   there, in the row. */
@media (hover: hover) {
  .entity > h2 a.permalink { opacity: 0; }
  .entity > h2:hover a.permalink, .entity > h2 a.permalink:focus-visible, .entity > h2 a.permalink.copied { opacity: 1; }
  .fn { position: relative; }
  .fn-head a.permalink {
    position: absolute;
    top: 0.6rem;
    right: 0.9rem;
    opacity: 0;
    background: var(--bg);
    box-shadow: 0 0 0 0.4rem var(--fn-band);
  }
  .fn:hover .fn-head a.permalink, .fn-head a.permalink:focus-visible, .fn-head a.permalink.copied { opacity: 1; }
  /* The chips step aside for it rather than sit under it. */
  .fn-head :is(.tag-trait, .tag-kind, .tag-foul) { transition: transform 0.15s; }
  .fn:hover .fn-head :is(.tag-trait, .tag-kind, .tag-foul) { transform: translateX(-2.1rem); }
}

.prose ul { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.prose li { margin: 0.25rem 0; }

/* A file's opening comment: what the page is about, before any one
   declaration. */
.intro { font-size: 1.02rem; margin-bottom: 1.6rem; }

.caption { margin: 0 0 0.3rem; color: var(--muted); font-size: 0.95rem; }

.returns { color: var(--muted); }
.returns strong { color: var(--ink-soft); }

.deprecated {
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  padding: 0.7rem 1rem;
  margin: 1.2rem 0;
  border-radius: 0 8px 8px 0;
}

/* ── Code surface ───────────────────────────────────────────────────── */

pre.code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e9e0cf;
}

pre.code code { font-family: inherit; }

.tok-comment { color: #94876a; font-style: italic; }
.tok-keyword { color: #f0c987; }
.tok-type    { color: #e6a960; }
.tok-string  { color: #c9e0a0; }
.tok-interp  { color: #e9e0cf; }
.tok-number  { color: #ffc18a; }
.tok-fn      { color: #ffe0a0; }
.tok-method  { color: #ffe0a0; }
.tok-op      { color: #d8b878; }
.tok-punct   { color: #a89a78; }
.tok-const   { color: #e6a960; }
.tok-field   { color: #f0e8d4; }
.tok-bool    { color: #ffc18a; }

/* ── Cards (version index) ──────────────────────────────────────────── */

.cards {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  margin-top: 1.6rem;
}

/* Section headings on the index and the prelude page: what separates
   "given to you" from "one using away". */
.group {
  margin: 2.6rem 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}

.group-note { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* "prelude": this page needs no import. It sits on the page heading,
   beside the module name it qualifies. */
.tag-prelude {
  margin-left: 0.5rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

h1 .tag-prelude { font-size: 11px; vertical-align: 0.45em; }

.prelude-list {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
}

.prelude-list li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}

.prelude-note {
  color: var(--faint);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.35);
}

.card:hover { border-color: var(--line-strong); background: var(--bg-subtle); }

.card-title { display: block; font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.card:hover .card-title { color: var(--accent-strong); }
.card-meta { display: block; margin-top: 0.25rem; font-size: 12.5px; color: var(--faint); }

/* ── Footer ─────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 1.4rem 0 2rem;
  font-size: 13px;
  color: var(--faint);
}

.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.foot a:hover { color: var(--accent-strong); }

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
}
