/* ============================================================
   SuperPlacer docs — layout and typography of the Documentation
   section. Loaded after the site's styles.css: takes its palette
   and fonts (with fallbacks, so a page also reads without it).
   The site scales its text with --type-scale; a three-column help
   needs reading sizes of its own, so the docs have one knob:
   --doc-scale (1 = the sizes below).
   ============================================================ */

:root {
  --doc-scale: 1;

  --d-bg:        var(--bg, #0a0a0b);
  --d-card:      var(--bg-card, #111113);
  --d-border:    var(--border, #1e1e22);
  --d-border-hi: var(--border-hi, #2e2e34);
  --d-text:      var(--text, #e8e8ea);
  --d-body:      #c9c9ce;
  --d-muted:     var(--muted, #8d8d93);
  --d-accent:    var(--accent, #FFC400);
  --d-green:     #a8cc3e;
  --d-blue:      #6ea8fe;
  --d-red:       #e06c75;
  --d-mono:      var(--font-mono, 'DM Mono', monospace);
  --d-sans:      var(--font-sans, 'DM Sans', sans-serif);

  --d-nav-h:     64px;
  --d-side-w:    280px;
  --d-toc-w:     230px;
  --d-text-w:    760px;
  --d-media-w:   1040px;
}

body.docs {
  background: var(--d-bg);
  color: var(--d-text);
  font-family: var(--d-sans);
  font-size: calc(16px * var(--doc-scale));
}

.nav-link.is-current { color: var(--d-accent); }

/* ── SHELL: sidebar | page | on this page ─────────────────── */
.docs-shell {
  display: grid;
  grid-template-columns: var(--d-side-w) minmax(0, 1fr) var(--d-toc-w);
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - var(--d-nav-h));
}

.docs-shell--home { grid-template-columns: var(--d-side-w) minmax(0, 1fr); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.docs-sidebar {
  position: sticky;
  top: var(--d-nav-h);
  height: calc(100vh - var(--d-nav-h));
  overflow-y: auto;
  border-right: 1px solid var(--d-border);
  padding: 28px 20px 40px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--d-border-hi) transparent;
}

.docs-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.docs-home {
  font-family: var(--d-mono);
  font-size: calc(13px * var(--doc-scale));
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-text);
  text-decoration: none;
}

.docs-home:hover { color: var(--d-accent); }

.docs-menu-close { display: none; }

.docs-lang { margin-left: auto; display: inline-flex; border: 1px solid var(--d-border-hi); border-radius: 5px; overflow: hidden; }

.docs-lang a {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.08em;
  color: var(--d-muted);
  text-decoration: none;
  padding: 3px 8px;
}

.docs-lang a + a { border-left: 1px solid var(--d-border-hi); }
.docs-lang a:hover { color: var(--d-text); }
.docs-lang a.is-active { color: #0a0a0b; background: var(--d-accent); }

.docs-search input {
  width: 100%;
  font-family: var(--d-sans);
  font-size: calc(14px * var(--doc-scale));
  color: var(--d-text);
  background: var(--d-card);
  border: 1px solid var(--d-border-hi);
  border-radius: 6px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}

.docs-search input::placeholder { color: var(--d-muted); }
.docs-search input:focus { border-color: var(--d-accent); }

.docs-search-results { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }

.docs-search-results a {
  display: block;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--d-text);
  font-size: calc(14px * var(--doc-scale));
}

.docs-search-results a:hover,
.docs-search-results a.is-first { background: var(--d-card); }

.docs-search-results small {
  display: block;
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  color: var(--d-muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.docs-search-results .empty { color: var(--d-muted); font-size: calc(14px * var(--doc-scale)); padding: 8px 10px; }

.docs-nav { margin-top: 22px; }

.docs-group + .docs-group { margin-top: 22px; }

.docs-group-title {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d-accent);
  margin-bottom: 8px;
}

.docs-link {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: calc(14.5px * var(--doc-scale));
  line-height: 1.35;
  color: var(--d-muted);
  text-decoration: none;
  padding: 5px 10px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  border-radius: 0 5px 5px 0;
  transition: color 0.15s, background 0.15s;
}

.docs-link:hover { color: var(--d-text); }
.docs-link.is-active { color: var(--d-text); background: var(--d-card); border-left-color: var(--d-accent); }

/* page status dots (review build only) */
.st { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.st-stub     { background: #4a4a52; }
.st-draft    { background: var(--d-accent); }
.st-approved { background: var(--d-green); }

/* ── PAGE ─────────────────────────────────────────────────── */
.docs-main {
  min-width: 0;
  padding: 44px 56px 72px;
}

.docs-main > * { max-width: var(--d-text-w); }

/* text keeps a reading width; screenshots, tables and code may use the page's full width */
.docs-main > .docs-content { max-width: var(--d-media-w); }
.docs-content > * { max-width: var(--d-text-w); }
.docs-content > .doc-figure,
.docs-content > table,
.docs-content > pre { max-width: var(--d-media-w); }

.docs-menu-btn { display: none; }

.docs-banner {
  font-size: calc(13.5px * var(--doc-scale));
  color: var(--d-text);
  border: 1px solid rgba(255,196,0,0.35);
  background: rgba(255,196,0,0.06);
  border-radius: 6px;
  padding: 9px 14px;
  margin-bottom: 26px;
}

.docs-crumbs {
  font-family: var(--d-mono);
  font-size: calc(12px * var(--doc-scale));
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--d-muted);
  margin-bottom: 14px;
}

.docs-crumbs a { color: var(--d-muted); text-decoration: none; }
.docs-crumbs a:hover { color: var(--d-text); }
.docs-crumbs span { margin: 0 8px; color: var(--d-border-hi); }

.docs-title {
  font-size: calc(clamp(30px, 3vw, 42px) * var(--doc-scale));
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--d-text);
}

.docs-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.docs-badges:empty { display: none; }

.pill {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--d-border-hi);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--d-muted);
}

.pill-draft    { color: var(--d-accent); border-color: rgba(255,196,0,0.4); }
.pill-approved { color: var(--d-green); border-color: rgba(168,204,62,0.4); }
.pill-fallback { color: var(--d-blue); border-color: rgba(110,168,254,0.4); }
.pill-edition  { color: var(--d-text); border-color: var(--d-border-hi); background: var(--d-card); }

/* ── CONTENT TYPOGRAPHY ───────────────────────────────────── */
.docs-content {
  margin-top: 28px;
  font-size: calc(17px * var(--doc-scale));
  line-height: 1.7;
  color: var(--d-body);
}

.docs-content > * + * { margin-top: 18px; }

.docs-content p.lead {
  font-size: calc(25.4px * var(--doc-scale));   /* 1.3 x the former 19.5 px (author 2026-10-13: the lead must stand out of the body text) */
  font-weight: 300;
  color: var(--d-text);
  line-height: 1.5;
}

.docs-content h2 {
  font-size: calc(27px * var(--doc-scale));
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--d-text);
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--d-border);
  scroll-margin-top: calc(var(--d-nav-h) + 20px);
}

.docs-content h3 {
  font-size: calc(20px * var(--doc-scale));
  font-weight: 500;
  color: var(--d-text);
  margin-top: 36px;
  scroll-margin-top: calc(var(--d-nav-h) + 20px);
}

.docs-content h4 {
  font-family: var(--d-mono);
  font-size: calc(14px * var(--doc-scale));
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--d-accent);
  margin-top: 28px;
}

.docs-content h2 + *, .docs-content h3 + *, .docs-content h4 + * { margin-top: 12px; }

.docs-content strong { color: var(--d-text); font-weight: 500; }
.docs-content em { color: var(--d-text); }

.docs-content a { color: var(--d-accent); text-decoration: none; border-bottom: 1px solid rgba(255,196,0,0.3); }
.docs-content a:hover { border-bottom-color: var(--d-accent); }

.docs-content ul, .docs-content ol { padding-left: 1.4em; }
.docs-content li + li { margin-top: 6px; }
.docs-content li > ul, .docs-content li > ol { margin-top: 6px; }
.docs-content ul li::marker { color: var(--d-muted); }
.docs-content ol li::marker { color: var(--d-muted); font-family: var(--d-mono); font-size: 0.9em; }

.docs-content code {
  font-family: var(--d-mono);
  font-size: 0.88em;
  color: var(--d-text);
  background: var(--d-card);
  border: 1px solid var(--d-border);
  border-radius: 4px;
  padding: 1px 6px;
}

.docs-content pre {
  background: var(--d-card);
  border: 1px solid var(--d-border);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.55;
}

.docs-content pre code { background: none; border: 0; padding: 0; font-size: calc(14px * var(--doc-scale)); }

/* keys: ++Ctrl+Shift+R++ */
.keys { white-space: nowrap; color: var(--d-muted); }

.keys kbd {
  font-family: var(--d-mono);
  font-size: 0.8em;
  color: var(--d-text);
  background: #16161a;
  border: 1px solid var(--d-border-hi);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 7px;
  margin: 0 1px;
  position: relative;
  top: -1px;
}

/* tables */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(15.5px * var(--doc-scale));
  display: block;
  overflow-x: auto;
}

.docs-content th {
  font-family: var(--d-mono);
  font-size: calc(11.5px * var(--doc-scale));
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--d-muted);
  text-align: left;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--d-border-hi);
}

.docs-content td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--d-border);
  vertical-align: top;
}

/* figures and screenshot placeholders */
.doc-figure {
  margin: 26px 0 0;
  border: 1px solid var(--d-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--d-card);
}

/* A screenshot is never stretched past its own size: a small one (a popup, a window) shows at 1:1, centred, its frame hugs it. */
.doc-figure img { display: block; width: auto; max-width: 100%; height: auto; }
.docs-content > .doc-figure:not(.doc-figure--video):not(.is-pending) { width: fit-content; margin-left: auto; margin-right: auto; }

.doc-figure figcaption {
  font-family: var(--d-mono);
  font-size: calc(12.5px * var(--doc-scale));
  letter-spacing: 0.02em;
  color: var(--d-muted);
  padding: 10px 14px;
  border-top: 1px solid var(--d-border);
}

.docs-content img { max-width: 100%; }

/* video clips (docs.js: the one in view plays muted and looped; click = pause; the bar scrubs; the corner = full screen) */
.doc-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.doc-video video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.doc-figure--video .doc-video { border-radius: 0; }

.doc-video-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}
.doc-video-badge::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 17px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--d-accent);
}
.doc-video.is-paused .doc-video-badge { opacity: 1; }

.doc-video-full {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--d-text);
  background: rgba(10, 10, 11, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s;
}
.doc-video:hover .doc-video-full,
.doc-video-full:focus-visible { opacity: 1; }
.doc-video-full:hover { color: var(--d-accent); border-color: var(--d-accent); }

.doc-video-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  touch-action: none;
}
.doc-video-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.16);
  transition: height 0.15s;
}
.doc-video-fill {
  position: relative;
  width: 0;
  height: 3px;
  background: var(--d-accent);
  transition: height 0.15s;
}
.doc-video-bar:hover::before,
.doc-video-bar:hover .doc-video-fill { height: 6px; }

.doc-video:fullscreen { cursor: default; aspect-ratio: auto; }
.doc-video:fullscreen .doc-video-badge,
.doc-video:fullscreen .doc-video-full,
.doc-video:fullscreen .doc-video-bar { display: none; }

.shot-pending {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--d-border-hi);
  border-radius: 8px;
  margin: 4px;
}

.doc-figure.is-pending { border: 0; background: transparent; }
.doc-figure.is-pending .shot-pending { margin: 0; background: var(--d-card); }

.shot-pending-label {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d-accent);
}

.shot-pending-alt { color: var(--d-text); font-size: calc(15px * var(--doc-scale)); max-width: 520px; line-height: 1.5; }
.shot-pending-file { font-family: var(--d-mono); font-size: calc(12px * var(--doc-scale)); color: var(--d-muted); }

/* callouts: > [!NOTE] / [!TIP] / [!WARNING] / [!IMPORTANT] */
.callout {
  border: 1px solid var(--d-border);
  border-left: 3px solid var(--c, var(--d-blue));
  background: var(--d-card);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
}

.callout > * + * { margin-top: 8px; }

.callout-title {
  font-family: var(--d-mono);
  font-size: calc(11.5px * var(--doc-scale));
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c, var(--d-blue));
}

.callout-note      { --c: var(--d-blue); }
.callout-tip       { --c: var(--d-green); }
.callout-warning   { --c: var(--d-accent); }
.callout-important { --c: var(--d-red); }

/* prev / next */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--d-border);
}

.docs-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--d-text);
  font-size: calc(16px * var(--doc-scale));
  border: 1px solid var(--d-border);
  border-radius: 8px;
  padding: 14px 18px;
  transition: border-color 0.15s;
}

.docs-pager a:hover { border-color: var(--d-accent); }
.docs-pager .pager-next { text-align: right; grid-column: 2; }

.docs-pager a span {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--d-muted);
}

/* ── ON THIS PAGE ─────────────────────────────────────────── */
.docs-toc {
  position: sticky;
  top: var(--d-nav-h);
  align-self: start;
  max-height: calc(100vh - var(--d-nav-h));
  overflow-y: auto;
  padding: 48px 24px 40px 8px;
}

.docs-toc-title {
  font-family: var(--d-mono);
  font-size: calc(11px * var(--doc-scale));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d-muted);
  margin-bottom: 10px;
}

.docs-toc ul { list-style: none; border-left: 1px solid var(--d-border); }

.docs-toc a {
  display: block;
  font-size: calc(13.5px * var(--doc-scale));
  line-height: 1.4;
  color: var(--d-muted);
  text-decoration: none;
  padding: 4px 0 4px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
}

.docs-toc .toc-sub a { padding-left: 26px; font-size: calc(13px * var(--doc-scale)); }
.docs-toc a:hover { color: var(--d-text); }
.docs-toc a.is-active { color: var(--d-accent); border-left-color: var(--d-accent); }

/* ── DOCS HOME ────────────────────────────────────────────── */
.docs-hero { padding: 12px 0 8px; }

.docs-eyebrow {
  font-family: var(--d-mono);
  font-size: calc(12px * var(--doc-scale));
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d-accent);
  margin-bottom: 16px;
}

.docs-hero-sub {
  font-size: calc(19px * var(--doc-scale));
  font-weight: 300;
  color: var(--d-muted);
  margin-top: 16px;
  line-height: 1.6;
}

.docs-shell--home .docs-main > .home-grid { max-width: 1180px; }

/* «How to work with …» at the bottom of the page «Documentation» opens (config home_page): the group cards */
.docs-home-block { margin-top: 0; }   /* its h2 draws the line above it, as every section of a page */
.docs-home-block .home-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 28px; }
.docs-content .home-card ul { list-style: none; padding-left: 0; margin: 6px 0 0; }
.docs-content .home-card li { margin: 0; }
.docs-content .home-card li + li { margin-top: 12px; }
.docs-content .home-card a { color: var(--d-text); text-decoration: none; border: 0; }
.docs-content .home-card a:hover { color: var(--d-accent); }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.home-card {
  border: 1px solid var(--d-border);
  border-radius: 8px;
  background: var(--d-card);
  padding: 22px 22px 18px;
}

.home-card ul { list-style: none; margin-top: 6px; }
.home-card li + li { margin-top: 12px; }

.home-card a {
  color: var(--d-text);
  text-decoration: none;
  font-size: calc(16px * var(--doc-scale));
}

.home-card a:hover { color: var(--d-accent); }

.home-card li span {
  display: block;
  font-size: calc(13.5px * var(--doc-scale));
  color: var(--d-muted);
  line-height: 1.5;
  margin-top: 2px;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .docs-shell { grid-template-columns: var(--d-side-w) minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 860px) {
  /* the site header is sized for desktops (--type-scale 2): a compact one on the docs pages */
  body.docs .nav-inner { max-width: none; padding: 0 16px; }
  body.docs .nav-logo img { height: 34px; }
  body.docs .nav-right { gap: 12px; }
  body.docs .nav-link,
  body.docs .nav-download { font-size: 12px; }
  body.docs .nav-download { padding: 6px 12px; }

  .docs-shell, .docs-shell--home { display: block; }

  .docs-sidebar {
    display: none;
    position: fixed;
    inset: var(--d-nav-h) 0 0 0;
    height: auto;
    z-index: 90;
    background: var(--d-bg);
    border-right: 0;
    padding: 20px 16px 40px;
  }

  body.docs-menu-open .docs-sidebar { display: block; }

  .docs-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    color: var(--d-text);
    background: var(--d-card);
    border: 1px solid var(--d-border-hi);
    border-radius: 6px;
    cursor: pointer;
  }
  body.docs-menu-open { overflow: hidden; }

  .docs-main { padding: 20px 16px 56px; }

  .docs-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--d-mono);
    font-size: calc(12px * var(--doc-scale));
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--d-text);
    background: var(--d-card);
    border: 1px solid var(--d-border-hi);
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 20px;
    cursor: pointer;
  }

  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager .pager-next { grid-column: 1; }
  .home-grid { grid-template-columns: 1fr; }
}
