/* chips: tinted light in the day theme, a dim warm tint in the dark so text on them keeps contrast */
:root { --chip-soft: rgb(var(--light) / 0.4); --chip-strong: rgb(var(--light) / 0.85); }
:root[data-theme="dark"] { --chip-soft: rgb(var(--light) / 0.16); --chip-strong: rgb(var(--light) / 0.24); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chip-soft: rgb(var(--light) / 0.16); --chip-strong: rgb(var(--light) / 0.24); } }
/* Docs, updates and 404: the cue-sheet pages. Loaded after styles.css. */

/* ---------- header on paper ---------- */
.site-nav ul a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.45em; }
@media (pointer: coarse) {
  .site-nav ul a, .site-nav .btn { display: inline-flex; align-items: center; min-height: 48px; }
}

/* ---------- layout ---------- */
.page-layout {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  column-gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 6rem);
}
.docs-content { min-width: 0; max-width: 46rem; }

/* ---------- type ---------- */
.docs-content h1, .updates-layout h1 { font-size: clamp(2.4rem, 5vw, 3.75rem); line-height: 1.04; letter-spacing: -0.03em; }
.docs-content h2, .updates-history h2 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); line-height: 1.12; margin-bottom: 1rem; }
.docs-lede { font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.55; color: var(--ink-2); margin: 1.4rem 0 0; max-width: 62ch; }
.docs-content p, .docs-content li, .updates-layout p, .updates-layout li { max-width: 68ch; }
.docs-content p, .updates-layout p { margin: 0 0 1rem; color: var(--ink-2); }
.docs-content strong, .updates-layout strong { color: var(--ink); font-weight: 500; }
.docs-content a:not(.btn), .updates-layout a:not(.btn), .empty-stage a:not(.btn) { color: var(--ink); }
code, .mono-block { font-family: var(--font-cue); }
code { font-size: 0.9em; background: var(--chip-soft); padding: 0.08em 0.35em; border-radius: 3px; color: var(--ink); overflow-wrap: anywhere; }
.btn-link { text-decoration-thickness: 1px; }
.btn-link .arrow { display: inline-block; transition: transform var(--dur-quick) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn-link:hover .arrow { transform: translateX(3px); } }

.doc-section { padding-block: 2.6rem 0.4rem; margin-top: 2.4rem; border-top: 1px solid var(--rule); scroll-margin-top: 1.5rem; }
.doc-list { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--ink-2); }
.doc-list li { margin-bottom: 0.5rem; }
.doc-caution { background: var(--chip-soft); padding: 0.9rem 1.1rem; border-radius: 4px; color: var(--ink) !important; }

.standby {
  display: inline-block; font: 400 0.78rem/1 var(--font-cue); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); background: var(--chip-strong); padding: 0.45em 0.7em; border-radius: 3px; vertical-align: middle; line-height: 1.25; max-width: 100%;
}
.doc-section h2 .standby { margin-left: 0.6rem; }

/* copy pill */
.copy-pill code:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.copy-pill { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 1.1rem; padding: 0.35rem 0.4rem 0.35rem 1rem; background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 4px; max-width: 100%; }
.copy-pill code { background: none; padding: 0; font-size: 0.9rem; min-width: 0; overflow-x: auto; white-space: nowrap; overflow-wrap: normal; }
.copy { flex: none; min-width: 6.5rem; min-height: 48px; font: 400 0.875rem/1 var(--font-cue); background: var(--btn-bg); color: var(--btn-fg); border: 0; border-radius: 4px; padding: 0 1rem; cursor: pointer; transition: background-color var(--dur-quick) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.copy:active { transform: scale(0.97); }
.copy[data-state="copied"] { background: var(--accent); color: var(--accent-ink); }

/* tables and blocks */
.table-scroll { overflow-x: auto; margin: 0 0 1.2rem; }
.doc-table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.95rem; }
.doc-table th { text-align: left; font: 400 0.78rem/1.2 var(--font-cue); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--ink); }
.doc-table td { vertical-align: top; padding: 0.75rem 1rem 0.75rem 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.doc-table td:first-child code { font-weight: 700; overflow-wrap: normal; white-space: nowrap; }
.mono-block { margin: 0 0 1.2rem; padding: 1.1rem 1.25rem; background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 4px; overflow-x: auto; font-size: 0.85rem; line-height: 1.7; }
.mono-block code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; white-space: pre; }
.ann { color: var(--ink-2); }

.doc-modes { display: grid; margin: 0 0 1rem; }
.doc-modes > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }
.doc-modes > div:first-child { border-top: 1px solid var(--rule); }
.doc-modes dt { font: 700 0.85rem/1.5 var(--font-cue); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.doc-modes dd { margin: 0; color: var(--ink-2); max-width: 60ch; }
.doc-deeper { list-style: none; padding: 0; }
.doc-deeper li { margin: 0; }
.doc-deeper a { display: inline-flex; align-items: center; min-height: 48px; }

/* ---------- cue sheet ToC ---------- */
.docs-toc { position: sticky; top: 1.5rem; padding-right: 1rem; }
.toc-label { margin: 0 0 0.9rem; font: 400 0.78rem/1.2 var(--font-cue); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.docs-toc ul { list-style: none; margin: 0; padding: 0; position: relative; }
.docs-toc li { position: relative; z-index: 1; }
.docs-toc a {
  display: grid; grid-template-columns: 3.1rem minmax(0, 1fr); align-items: center; column-gap: 0.35rem;
  min-height: 48px; padding: 0.3rem 0.75rem 0.3rem 1.6rem;
  text-decoration: none; color: var(--ink-2); line-height: 1.25; font-size: 0.97rem;
  transition: color var(--dur-quick) var(--ease-out);
}
.docs-toc a::before { content: attr(data-cue); font: 400 0.82rem/1 var(--font-cue); letter-spacing: 0.04em; color: var(--ink-2); transition: color var(--dur-quick) var(--ease-out); }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a[aria-current="location"] { color: var(--ink); }
.docs-toc a[aria-current="location"]::before { color: var(--ink); font-weight: 700; }

/* the one moving element: spike-tape cross + soft pool of light */
.toc-indicator { display: none; position: absolute; left: 0; top: 0; width: 100%; height: var(--ih, 44px); transform: translate3d(0, var(--iy, 0px), 0); pointer-events: none; z-index: 0; }
.js .toc-indicator { display: block; }
.toc-indicator.is-ready { transition: transform var(--dur-fast) var(--ease-out); }
.toc-indicator::before { content: ""; position: absolute; left: 0.1rem; top: 50%; width: 0.95rem; height: 0.95rem; margin-top: -0.475rem; transform: rotate(-4deg);
  background: linear-gradient(var(--tape-red), var(--tape-red)) center / 100% 3px no-repeat, linear-gradient(var(--tape-red), var(--tape-red)) center / 3px 100% no-repeat; }
.toc-indicator::after { content: ""; position: absolute; inset: 2px -0.25rem 2px 0.35rem; border-radius: 999px;
  background: radial-gradient(closest-side, rgb(var(--light) / var(--toc-core, 0.95)), rgb(var(--light) / var(--toc-mid, 0.55)) 65%, rgb(var(--light) / 0)); }
/* At night a full-strength pool reads as a glare; a faint warm wash marks the cue without shouting. */
:root[data-theme="dark"] .toc-indicator { --toc-core: 0.2; --toc-mid: 0.08; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toc-indicator { --toc-core: 0.2; --toc-mid: 0.08; } }

/* ---------- updates: cue rows ---------- */
.updates-layout { max-width: 62rem; padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 6rem); }
.updates-update { margin-top: 1rem; }
.cues { list-style: none; margin: 3rem 0 2rem; padding: 0; }
.cue { position: relative; display: grid; grid-template-columns: 5rem 2.5rem minmax(0, 1fr); column-gap: 0.6rem; padding: 2.2rem 0; border-top: 1px solid var(--rule); isolation: isolate; }
.cue:last-child { border-bottom: 1px solid var(--rule); }
.cue-no { font: 400 1rem/1.7 var(--font-cue); letter-spacing: 0.06em; color: var(--ink-2); padding-top: 0.5rem; }
.cue-cross { margin-top: 0.7rem; }
.cue-cross rect { fill: currentColor; }
.cue-cross--red { color: var(--tape-red); }
.cue-cross--yellow { color: var(--tape-yellow); }
.cue-cross--blue { color: var(--tape-blue); }
.cue-body { min-width: 0; }
.cue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.cue-head h2 { font-size: clamp(1.55rem, 2.3vw, 2rem); margin: 0; }
.updates-layout .cue-meta { margin: 0.5rem 0 1rem; font: 400 0.85rem/1.4 var(--font-cue); letter-spacing: 0.06em; color: var(--ink-2); }
.cue--standby::before { content: ""; position: absolute; z-index: -1; inset: -1.5rem -3rem;
  background: radial-gradient(closest-side, rgb(var(--light) / 0.6), rgb(var(--light) / 0.28) 60%, rgb(var(--light) / 0)); border-radius: 50%; }
.updates-history { margin-top: 2.5rem; }
.updates-history h2 { font-size: clamp(1.4rem, 2vw, 1.7rem); }

/* ---------- 404 ---------- */
.empty-stage { min-height: 58svh; display: grid; align-items: center; padding-block: 4rem; text-align: center; }
.empty-mark { position: relative; display: grid; place-items: center; width: 14rem; height: 8rem; margin: 0 auto 1.2rem; isolation: isolate; }
.empty-mark::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(closest-side, rgb(var(--light) / 0.8), rgb(var(--light) / 0.35) 60%, rgb(var(--light) / 0)); }
.empty-stage h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
.empty-note { margin: 1rem 0 2rem; font: 400 1rem/1.5 var(--font-body); color: var(--ink-2); }
.empty-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1.5rem; margin: 0; }
.empty-links .btn-link { font: 400 0.9375rem/1 var(--font-cue); display: inline-flex; align-items: center; min-height: 48px; }

/* ---------- small screens: cue strip above content ---------- */
@media (max-width: 860px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: sticky; top: 0; z-index: 4; margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter); background: var(--paper); border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
  .toc-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: -1px; }
  .docs-toc ul { display: flex; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .docs-toc ul::-webkit-scrollbar { display: none; }
  .docs-toc li { flex: none; }
  .docs-toc a { padding: 0.3rem 0.9rem 0.3rem 1.5rem; white-space: nowrap; grid-template-columns: auto auto; }
  .docs-toc a::before { margin-right: 0.15rem; }
  .toc-indicator { width: var(--iw, 6rem); height: 100%; transform: translate3d(var(--ix, 0px), 0, 0); }
  .doc-section { scroll-margin-top: 4.5rem; }
  .doc-modes > div { grid-template-columns: 1fr; gap: 0.2rem; }
  .cue { grid-template-columns: 3.4rem 1.6rem minmax(0, 1fr); column-gap: 0.5rem; }
  .cue--standby::before { inset: -1rem -1rem; }
  .doc-section h2 .standby { margin-left: 0; display: block; width: fit-content; margin-top: 0.6rem; }
}

/* styles.css already stops motion globally under reduced motion; restated here for the page-only transitions */
@media (prefers-reduced-motion: reduce) {
  .btn-link .arrow, .copy, .docs-toc a, .docs-toc a::before, .toc-indicator.is-ready { transition: none; }
}
