/* source-coop CLI guide. Colours and type follow Source Cooperative's brand
   (ops-source brand/brand.json): Ink on Bone, links shown by underline, not
   colour. Berkeley Mono is licensed: it loads from Radiant Earth's font
   server and is never committed here. */

@font-face { font-family: "Berkeley Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("https://assets.radiant.earth/fonts/BerkeleyMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("https://assets.radiant.earth/fonts/BerkeleyMono-Bold.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("https://assets.radiant.earth/fonts/BerkeleyMono-Oblique.woff2") format("woff2"); }

:root {
  --ink: #121A1B;
  --bone: #EFEBEA;
  --bg: var(--bone);
  --fg: var(--ink);
  --muted: #4A5253;
  --line: rgba(18, 26, 27, 0.16);
  --line-strong: rgba(18, 26, 27, 0.35);
  --panel: #F7F5F4;
  --nav-active: rgba(18, 26, 27, 0.07);
  --term-border: transparent;
  --warning: #B87A00;
  --danger: #C8261E;
  --mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: var(--ink);
  --fg: var(--bone);
  --muted: #ABAFAE;
  --line: rgba(239, 235, 234, 0.18);
  --line-strong: rgba(239, 235, 234, 0.4);
  --panel: #1B2425;
  --nav-active: rgba(239, 235, 234, 0.1);
  --term-border: rgba(239, 235, 234, 0.22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); }
body { margin: 0; font: 400 16px/1.55 var(--sans); background: var(--bg); color: var(--fg); }
a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; padding: 8px 12px; background: var(--fg); color: var(--bg); z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand span { font: 700 14px var(--mono); padding-left: 14px; border-left: 1px solid var(--line-strong); }
.logo { height: 26px; width: auto; display: block; }
.logo-bone, :root[data-theme="dark"] .logo-ink { display: none; }
:root[data-theme="dark"] .logo-bone { display: block; }
.spacer { flex: 1 1 auto; }
/* Search: a box in the header, and the sections it finds under it. */
.search { position: relative; flex: 0 1 240px; min-width: 0; }
.search input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--fg); font: 14px var(--sans); }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); cursor: pointer; }
.search-results { position: absolute; right: 0; top: calc(100% + 8px); width: min(440px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 28px rgba(18, 26, 27, 0.18); padding: 6px; z-index: 20; }
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--nav-active); outline: none; }
.search-results a:hover b, .search-results a:focus-visible b { text-decoration: underline; }
.search-results b { display: block; font-size: 14px; }
.search-results small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.search-results span { display: block; font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 3px; }
.search-results mark { background: none; color: var(--fg); font-weight: 600; }
.search-results p { margin: 0; padding: 8px 10px; font-size: 14px; color: var(--muted); }
@media (max-width: 860px) { .search { flex-basis: 100%; order: 10; } .search-results { left: 0; right: auto; width: 100%; } }

/* The version: a small button showing it, opening a list of the releases. */
.version { position: relative; }
.version-button { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--fg); font: 600 13px var(--sans); cursor: pointer; }
.version-button:disabled { cursor: default; }
.version-button:disabled svg { display: none; }
.version-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 220px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 28px rgba(18, 26, 27, 0.18); padding: 6px; display: flex; flex-direction: column; z-index: 20; }
.version-menu[hidden] { display: none; }
.version-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-size: 14px; }
.version-menu a:hover { background: var(--nav-active); text-decoration: underline; }
.version-menu a[aria-current="page"] { background: var(--nav-active); font-weight: 600; }
.version-menu .tick { width: 14px; flex: none; }
.version-menu .note { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.version-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0 2px; }
.version-menu .all { font-size: 13px; color: var(--muted); text-decoration: underline; }
@media (max-width: 860px) { .version-menu { right: auto; left: 0; } }
.top-link { font-size: 14px; }
.theme { width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.theme .icon-sun, :root[data-theme="dark"] .theme .icon-moon { display: none; }
:root[data-theme="dark"] .theme .icon-sun { display: block; }

.old-version { background: var(--fg); color: var(--bg); }
.old-version[hidden] { display: none; }
.old-version > div { max-width: 1200px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 15px; }
.old-version a { font-weight: 600; }

/* Layout */
.layout { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: flex-start; }
.toc { flex: 1 1 220px; max-width: 260px; font-size: 14px; line-height: 20px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.toc summary { font: 700 12px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0 10px 8px; list-style: none; pointer-events: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 12px; margin: 2px 0 6px; }
.toc a { display: block; padding: 5px 10px; border-radius: 6px; text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc a[aria-current="page"] { font-weight: 600; background: var(--nav-active); }
.toc .group { font: 700 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; margin-top: 18px; }
.toc > details > ul > .group:first-child { margin-top: 4px; }
main { flex: 999 1 560px; min-width: 0; max-width: 820px; }

@media (max-width: 860px) {
  .toc { position: static; max-width: none; max-height: none; flex-basis: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
  .toc summary { cursor: pointer; pointer-events: auto; padding: 6px 10px; }
  .toc summary::after { content: " ▾"; }
  .toc details[open] summary::after { content: " ▴"; }
}

/* Content */
main h1, main h2, main h3, main h4 { font-family: var(--mono); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; scroll-margin-top: 16px; }
main h1 { font-size: 34px; margin: 0 0 16px; }
main h2 { font-size: 24px; margin: 40px 0 12px; }
main h3 { font-size: 18px; margin: 32px 0 10px; }
main p, main ul, main ol { margin: 0 0 16px; max-width: 70ch; }
main li { margin: 4px 0; }
code { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--nav-active); padding: 1px 4px; border-radius: 4px; }
:not(.keycast) > kbd { font: 0.85em var(--mono); padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; white-space: nowrap; }
pre { margin: 0 0 16px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; font: 14px/1.6 var(--mono); }
pre code { font-size: inherit; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; font-size: 14px; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { font: 700 13px var(--mono); border-bottom-color: var(--line-strong); }
blockquote { margin: 0 0 16px; padding: 4px 16px; border: 1px solid var(--line-strong); border-radius: 8px; }
.callout-title { font: 700 13px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; margin: 8px 0 4px; }
.callout-warning, .callout-caution { border-color: var(--warning); }
.callout p:last-child { margin-bottom: 8px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; text-decoration: none; font-weight: 600; }
.pager a span { font: 400 13px var(--sans); color: var(--muted); }
.pager a:hover { text-decoration: underline; }
.pager-next { text-align: right; margin-left: auto; }

/* Footer */
.bottom { border-top: 1px solid var(--line); }
.bottom-inner { max-width: 1200px; margin: 0 auto; padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); }

/* Demo player (assets/player.js). The terminal is Ink in both themes. */
figure.demo { margin: 24px 0; }
figure.demo > img, figure.demo noscript img { width: 100%; height: auto; display: block; }
figure.demo figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
figure.demo figcaption code { color: var(--fg); }
.player { position: relative; display: flex; flex-direction: column; background: var(--ink); color: var(--bone); border-radius: 10px; overflow: hidden; border: 1px solid var(--term-border); }
.player button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; padding: 0; }
.player :focus-visible { outline: 2px solid var(--bone); outline-offset: -2px; }
.player-view { position: relative; display: flex; }
.player-screen { position: relative; flex: 1 1 auto; min-width: 0; cursor: pointer; -webkit-user-select: none; user-select: none; aspect-ratio: var(--ratio, 1240 / 798); }
.player-screen svg { display: block; width: 100%; height: auto; }
.player-screen.poster > svg { opacity: 0.35; }
.player-poster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.player-poster[hidden] { display: none; }
.player-poster .big { width: 80px; height: 80px; border-radius: 40px; background: var(--bone); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.player-poster .big:focus-visible { outline: 3px solid var(--bone); outline-offset: 4px; }
.player-poster .badge { font: 13px var(--mono); background: var(--ink); padding: 4px 10px; border-radius: 4px; }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 4px 14px 4px 6px; border-top: 1px solid rgba(239, 235, 234, 0.14); }
.player-bar[hidden] { display: none; }
.player-bar .toggle { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; flex: none; }
.player-track { position: relative; flex: 1 1 auto; height: 44px; display: flex; align-items: center; }
.player-track .rail, .player-track .fill { position: absolute; left: 0; height: 3px; border-radius: 2px; }
.player-track .rail { right: 0; background: rgba(239, 235, 234, 0.22); }
.player-track .fill { background: var(--bone); width: 0; }
.player-track .tick { position: absolute; top: 15px; width: 2px; height: 14px; margin-left: -1px; background: rgba(239, 235, 234, 0.4); }
.player-track .tick.past { background: var(--bone); }
.player-track .thumb { position: absolute; width: 12px; height: 12px; margin-left: -6px; border-radius: 6px; background: var(--bone); box-shadow: 0 0 0 3px var(--ink); left: 0; pointer-events: none; }
.player-track input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.player-track input:focus-visible ~ .thumb { outline: 2px solid var(--bone); outline-offset: 3px; }
.player-time { flex: none; font: 12px var(--mono); font-variant-numeric: tabular-nums; color: rgba(239, 235, 234, 0.82); white-space: nowrap; }
.player-rail { flex: none; width: 52px; border-left: 1px solid rgba(239, 235, 234, 0.14); display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.player-rail[hidden] { display: none; }
.player-rail button { width: 44px; min-height: 64px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.player-rail span { font: 11px/1 var(--mono); }
.player-steps { position: absolute; top: 0; right: 0; bottom: 0; width: 300px; max-width: 88%; background: #1B2425; border-left: 1px solid rgba(239, 235, 234, 0.2); display: flex; flex-direction: column; z-index: 2; }
.player-steps[hidden] { display: none; }
.player-steps header { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 14px; border-bottom: 1px solid rgba(239, 235, 234, 0.14); font: 700 12px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.player-steps header button { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.player-steps ol { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1 1 auto; }
.player-steps li { margin: 0; }
.player-steps li button { display: flex; gap: 12px; align-items: baseline; width: 100%; min-height: 40px; padding: 9px 14px; text-align: left; font-size: 14px; line-height: 20px; }
.player-steps li button:hover { background: rgba(239, 235, 234, 0.1); }
.player-steps li button[aria-current="step"] { background: var(--bone); color: var(--ink); font-weight: 600; }
.player-steps .t { font: 12px var(--mono); min-width: 32px; opacity: 0.8; flex: none; }
/* Copying (player.js): the rows a drag picks, and the note once copied. */
.player .pick { position: absolute; left: 0; right: 0; background: rgba(239, 235, 234, 0.16); border-left: 3px solid var(--bone); pointer-events: none; }
.player .toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font: 600 13px var(--sans); color: var(--ink); background: var(--bone); border-radius: 6px; padding: 6px 12px; pointer-events: none; z-index: 3; white-space: nowrap; }
/* The key overlay (player.js keycaps): a keycap in Bone, bottom right of the terminal. */
.keycast { position: absolute; right: 16px; bottom: 16px; pointer-events: none; z-index: 1; }
.keycast kbd { display: block; font: 700 15px/1 var(--mono); color: var(--ink); background: var(--bone); border: 1px solid rgba(18, 26, 27, 0.3); border-bottom-width: 3px; border-radius: 6px; padding: 7px 10px 6px; min-width: 1.4em; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); white-space: nowrap; }
@media (max-width: 560px) {
  .keycast kbd { font-size: 12px; padding: 5px 7px 4px; }
  .player-rail { width: 44px; }
  .player-poster .big { width: 56px; height: 56px; }
  .player-poster .big svg { width: 22px; height: 22px; }
  .player-poster .badge { font-size: 12px; }
  .player-time { display: none; }
}
@media print {
  .top, .toc, .pager, .bottom, .player-bar, .player-rail { display: none; }
}
