/* docs.css — every reference page: a symbol page, a namespace overview, the
 * color palette, and the API index. Loaded after base.css, which owns the
 * tokens. (This replaces the old item.css/api.css pair; api.css was never
 * referenced by the generator at all.)
 *
 * A reference page is a document, so it is set as one: a measured column, a
 * serif heading, a signature that reads as code, and rules instead of cards. */

main { padding: 34px 0 0 }

/* ---------- breadcrumbs ---------- */

.crumbs {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}
.crumbs a { color: var(--muted) }
.crumbs a:hover { color: var(--ink) }
.crumbs .here { color: var(--ink) }

/* ---------- symbol head ---------- */

.item { max-width: 78ch }
.item-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.item-head h1 {
  font-size: clamp(27px, 4vw, 36px);
  letter-spacing: -0.02em;
  word-break: break-word;
}

.sig {
  display: block;
  margin: 18px 0 0;
  padding: 11px 14px;
  font-size: 14px;
  background: var(--code-bg);
  border: 1px solid var(--code-rule);
  border-left: 2px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
}

.desc { margin-top: 20px }
.desc p { margin: 0 0 14px }
.desc p:last-child { margin-bottom: 0 }

.ns-blurb { margin: 20px 0 0; color: var(--ink-2) }

/* ---------- sections within a page ---------- */

.params h2, .examples h2, .related h2, .swatch-group h3 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 34px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}

.param {
  display: grid;
  gap: 3px 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 620px) {
  .param { grid-template-columns: minmax(90px, 22%) 1fr; align-items: baseline }
}
.param:last-child { border-bottom: none }
.pname { color: var(--c-arg); font-size: 13.5px }
.pdesc { color: var(--ink-2); font-size: 15px }

.examples pre { margin-top: 0 }
.examples pre + pre { margin-top: 12px }

.rel-row { display: flex; flex-wrap: wrap; gap: 8px }
.rel {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 4px 10px;
}
.rel:hover { color: var(--accent); border-color: var(--accent); text-decoration: none }

.back {
  display: inline-block;
  margin: 40px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.back:hover { color: var(--ink) }

/* ---------- namespace overview ---------- */

.ns-methods { margin-top: 26px; border-top: 1px solid var(--rule) }
.ns-method {
  display: grid;
  gap: 2px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
}
@media (min-width: 720px) {
  .ns-method { grid-template-columns: minmax(0, 46%) 1fr; gap: 18px; align-items: baseline }
}
.ns-method:hover { background: var(--paper-2); text-decoration: none }
.nm-sig { font-size: 13.5px; color: var(--c-fn) }
.nm-tip { color: var(--muted); font-size: 14.5px }

/* ---------- color palette ---------- */

.swatch-row {
  display: grid;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  font-size: 13px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.swatch.flash { background: var(--accent-bg) }
.chip {
  width: 17px; height: 17px;
  flex: none;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .18);
}
.cname { font-family: var(--mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis }
.chex { font-family: var(--mono); color: var(--muted); margin-left: auto; font-size: 12px }

/* ---------- API index ---------- */

.ref { max-width: var(--max) }
.ref-intro { max-width: 68ch; margin-bottom: 40px }
.ref-intro h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.02em; margin: 0 0 12px }
.ref-intro p { color: var(--muted); margin: 0 0 22px }

.search {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 11px 14px;
}
.search::placeholder { color: var(--muted) }
.search:focus { outline: none; border-color: var(--accent) }

.noresults { margin-top: 14px; color: var(--muted); font-size: 14.5px }

.idx-sec { margin-bottom: 44px }
.idx-sec h2 {
  font-size: 20px;
  margin: 0 0 6px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
}
.sec-blurb { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; max-width: 74ch }

.idx-grid {
  display: grid;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.idx-item {
  display: grid;
  gap: 1px;
  padding: 11px 14px;
  color: inherit;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.idx-item:hover { background: var(--paper-2); text-decoration: none }
.idx-item code { font-size: 13.5px; color: var(--c-fn) }
.idx-item span { color: var(--muted); font-size: 13.5px }

/* ---------- deep-link flash (from ludic-highlight.js) -------------------- *
 * The token cards themselves are styled in base.css, which every page links. */

:target { scroll-margin-top: calc(var(--hdr) + 16px) }
.flash { animation: flash 1.1s ease-out }
@keyframes flash {
  from { background: var(--accent-bg) }
  to   { background: transparent }
}
/* No standing tint here: `animation: none` plus a background would leave the
   highlight on the element forever, which is exactly what a reader who asked
   for less motion did not ask for. */
@media (prefers-reduced-motion: reduce) {
  .flash { animation: none }
}
