/* Docs pages for functionstore.tools.
   Hand-authored and lives at website/ — website/docs/ is generated and
   wiped on every build, so nothing authored may sit inside it.
   Shares the family's token names; only --accent differs per site. */

:root {
  --bg: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #161616;
  --bg-3: #1c1c1c;
  --bg-deep: #050505;
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #f5f5f5;
  --text-dim: #a3a3a3;
  --text-faint: #737373;
  --accent: #fbbf24;
  --accent-dim: #2a1f08;
  --accent-bright: #fcd34d;
  --green: #4ade80;
  --max-w: 1140px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: 84px; scroll-behavior: smooth; }
:target { scroll-margin-top: 84px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
code, kbd { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.9em; }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ───── Header (mirrors index.html; site-nav.css owns the brand + drawer) ───── */
header.site {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; max-width: var(--max-w); margin: 0 auto;
}
nav.site-nav { display: flex; gap: 28px; align-items: center; font-size: 14px; }
/* :not(.btn) keeps these from overriding .btn-primary — nav.site-nav a has
   higher specificity, so without it the CTA inherits the muted nav color. */
nav.site-nav a:not(.btn) { color: var(--text-dim); }
nav.site-nav a:not(.btn):hover { color: var(--text); }
nav.site-nav a[aria-current="page"]:not(.btn) { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0a0a0a; }
.btn-primary:hover { background: var(--accent-bright); color: #0a0a0a; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ───── Layout ───── */
.docs-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-top: 32px;
  padding-bottom: 72px;
}
.docs-side {
  position: sticky; top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding-right: 8px;
  font-size: 14px;
}
.docs-side::-webkit-scrollbar { width: 8px; }
.docs-side::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.side-group { margin-bottom: 22px; }
.side-group h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint);
}
.side-glyph { color: var(--accent); font-size: 12px; }
.side-group ul { list-style: none; margin: 0; padding: 0; }
.side-group li a {
  display: block; padding: 5px 10px; margin-left: -10px;
  border-radius: 6px; color: var(--text-dim);
  overflow-wrap: anywhere;
}
.side-group li a:hover { background: var(--bg-2); color: var(--text); }
.side-group li a[aria-current="page"] {
  background: var(--accent-dim); color: var(--accent-bright); font-weight: 600;
}

.docs-search { margin-bottom: 24px; }

/* ───── Content ───── */
.docs-main { min-width: 0; }
.crumbs { margin: 0 0 8px; font-size: 13px; color: var(--text-faint); }
.crumbs a { color: var(--text-dim); }
.docs-main h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.1;
}
.lede { margin: 0 0 16px; font-size: 17px; color: var(--text-dim); max-width: 62ch; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-dim);
}
.badge-cat { background: var(--accent-dim); border-color: rgba(251,191,36,0.28); color: var(--accent); }
.badge-warn { background: #2a1408; border-color: rgba(251,146,60,0.3); color: #fdba74; }

.toc {
  margin: 0 0 32px; padding: 16px 20px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px;
}
.toc > span {
  display: block; margin-bottom: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint);
}
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.toc li a { font-size: 14px; }

.docs-body { max-width: 74ch; }
.docs-body h2 {
  margin: 44px 0 12px; padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
}
.docs-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.docs-body h3 { margin: 30px 0 10px; font-size: 18px; font-weight: 600; }
.docs-body h4 { margin: 24px 0 8px; font-size: 15px; font-weight: 600; color: var(--text-dim); }
.docs-body p { margin: 0 0 14px; }
.docs-body ul, .docs-body ol { margin: 0 0 16px; padding-left: 22px; }
.docs-body li { margin-bottom: 6px; }
.docs-body img { max-width: 100%; height: auto; vertical-align: middle; }
/* Wiki-era inline icon glyphs sit in running text at their native size. */
.docs-body p > img, .docs-body li > img { border-radius: 3px; }

.docs-body code {
  background: var(--bg-3); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px; color: var(--accent-bright);
}
.docs-body pre {
  background: var(--bg-deep); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
  overflow-x: auto; margin: 0 0 18px;
}
.docs-body pre code { background: none; border: none; padding: 0; color: var(--text); }
.docs-body blockquote {
  margin: 0 0 18px; padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-1); border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.docs-body blockquote p:last-child { margin-bottom: 0; }
.docs-body table {
  width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px;
  display: block; overflow-x: auto;
}
.docs-body th, .docs-body td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
.docs-body th { background: var(--bg-2); font-weight: 600; }
.docs-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

.heading-anchor {
  margin-left: 10px; color: var(--border-strong);
  opacity: 0; transition: opacity 0.15s ease;
}
h2:hover .heading-anchor, h3:hover .heading-anchor { opacity: 1; }

.embed-video {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 12px; border: 1px solid var(--border);
  overflow: hidden; background: var(--bg-2); margin: 0 0 28px;
}
.embed-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.edit-page {
  margin: 48px 0 0; padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

/* ───── Docs index ───── */
.docs-index .doc-cat { margin-top: 44px; }
.docs-index h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.doc-card {
  display: block; padding: 14px 16px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); transition: border-color 0.15s ease, background 0.15s ease;
}
.doc-card:hover { border-color: var(--accent); background: var(--bg-2); color: var(--text); }
.doc-card strong { display: block; font-size: 15px; margin-bottom: 4px; }
.doc-card span { display: block; font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ───── Footer ───── */
footer.site { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; font-size: 13px; color: var(--text-faint);
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--accent); }

/* ───── Pagefind ───── */
:root {
  --pagefind-ui-scale: 0.8;
  --pagefind-ui-primary: var(--text);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg-1);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--bg-2);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-font: 'Inter', system-ui, sans-serif;
}
.pagefind-ui__result-link { color: var(--accent) !important; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 0; padding-top: 20px; }
  .docs-side {
    position: static; max-height: none; overflow: visible;
    margin-bottom: 32px; padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
  }
  .side-group { margin-bottom: 16px; }
}

/* ═════ Plus ═════
   Used by /plus/ (generated from content/plus.html) and by the Plus marker
   on package pages, the docs index and the sidebar.

   These mirror the same-named rules in index.html's inline <style>, the way
   the tokens and the header already do: the landing page carries its own
   copy of the chrome so it loads one stylesheet, docs.css carries the copy
   every generated page uses. Same names, same values — keep them in step. */

.plus-mark {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(251,191,36,0.28);
  vertical-align: 2px;
  white-space: nowrap;
}
a .plus-mark, .side-group .plus-mark { margin-left: 7px; }

/* The unlock callout at the top of a Plus package's page. */
.plus-note {
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 12px;
  background:
    radial-gradient(420px 160px at 100% 0%, rgba(251,191,36,0.07), transparent 70%),
    var(--bg-1);
  padding: 18px 20px;
  margin: 0 0 28px;
  font-size: 14.5px; color: var(--text-dim);
}
.plus-note strong { color: var(--text); }
.plus-note p { margin: 0 0 10px; }
.plus-note p:last-child { margin-bottom: 0; }

/* ───── Progressive disclosure ───── */
details.fold {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-1);
  margin: 0 0 10px;
}
details.fold > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14.5px; font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  list-style: none;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: '+';
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--accent); font-size: 15px; line-height: 1;
  width: 12px; text-align: center; flex: none;
}
details.fold[open] > summary::before { content: '−'; }
details.fold > summary:hover { color: var(--accent); }
details.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold-body { padding: 0 16px 16px 38px; font-size: 14.5px; color: var(--text-dim); }
.fold-body > :first-child { margin-top: 0; }
.fold-body > :last-child { margin-bottom: 0; }
.fold-body p { margin: 0 0 10px; }

/* ───── The Plus page ───── */
.plus-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.plus-page h1 { font-size: clamp(32px, 4.4vw, 44px); font-weight: 700; letter-spacing: -0.025em; margin: 0 0 14px; }
.plus-page h2 {
  font-size: 24px; font-weight: 650; letter-spacing: -0.015em;
  margin: 52px 0 14px; padding-top: 4px;
}
/* Feature metadata authored in the CMS: the icon rides its heading and the
   table of contents; hotkeys list under the feature they belong to. */
.feat-icon { vertical-align: -3px; margin-right: 7px; border-radius: 3px; }
.shortcuts .hint-line {
  margin: -4px 0 10px; font-size: 12.5px; color: var(--text-faint);
  max-width: 62ch;
}
.feat-keys { list-style: none; margin: 6px 0 14px; padding: 0; display: flex;
  flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-dim); }
.feat-keys kbd {
  background: var(--bg-3); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px;
  font: 500 12px/1.5 var(--mono, ui-monospace, monospace); color: var(--text);
  margin-right: 6px;
}
.toc .feat-icon { width: 14px; height: 14px; }

.plus-page h3 {
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  margin: 30px 0 10px;
}
.plus-page > p { color: var(--text-dim); max-width: 68ch; }
.plus-page .lede { font-size: 18px; max-width: 68ch; margin-bottom: 36px; }

.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; margin: 22px 0; }
.tier {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-1);
  padding: 26px 24px;
  display: flex; flex-direction: column;
}
.tier--plus {
  border-color: rgba(251,191,36,0.32);
  background:
    radial-gradient(520px 200px at 100% 0%, rgba(251,191,36,0.07), transparent 70%),
    var(--bg-1);
}
.tier-tag {
  display: inline-flex; align-self: flex-start;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--border);
}
.tier--plus .tier-tag { background: var(--accent-dim); color: var(--accent); border-color: rgba(251,191,36,0.3); }
.tier h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin: 15px 0 8px; }
.tier > p { color: var(--text-dim); font-size: 15px; margin: 0 0 18px; }
.tier ul { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 11px; }
.tier li { position: relative; padding-left: 24px; font-size: 14.5px; color: var(--text-dim); }
.tier li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--green); font-size: 13px; font-weight: 700; }
.tier--plus li::before { content: '◆'; color: var(--accent); font-size: 11px; }
.tier li strong { color: var(--text); font-weight: 600; }
.tier-actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.plus-tiers { margin-bottom: 8px; }

/* The generated Plus package list. */
.plus-pkgs { display: grid; gap: 12px; margin: 22px 0; }
.plus-pkg {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px;
  border: 1px solid rgba(251,191,36,0.22);
  border-radius: 12px; background: var(--bg-1);
  padding: 18px 20px;
}
.plus-pkg b { font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.plus-pkg span { display: block; font-size: 14px; color: var(--text-dim); margin-top: 5px; }
.plus-pkg .cat-of { color: var(--text-faint); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 8px; }
.plus-pkgs-empty { color: var(--text-faint); font-style: italic; }

.plus-steps { counter-reset: step; list-style: none; margin: 22px 0; padding: 0; display: grid; gap: 12px; }
.plus-steps li {
  counter-increment: step;
  position: relative; padding: 16px 20px 16px 58px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-1);
  color: var(--text-dim); font-size: 15px;
}
.plus-steps li::before {
  content: counter(step);
  position: absolute; left: 18px; top: 15px;
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(251,191,36,0.28);
  font-size: 13px; font-weight: 700;
}
.plus-steps strong { color: var(--text); }

.plus-facts { list-style: none; margin: 22px 0; padding: 0; display: grid; gap: 14px; }
.plus-facts li {
  position: relative; padding-left: 26px;
  color: var(--text-dim); font-size: 15px; max-width: 74ch;
}
.plus-facts li::before {
  content: '◆'; position: absolute; left: 0; top: 1px;
  color: var(--accent); font-size: 11px;
}
.plus-facts strong { color: var(--text); }

/* ───── The rest of the family ───── */
.prod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin: 22px 0; }
.prod {
  display: block;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-1); padding: 24px 24px 22px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.prod:hover { border-color: var(--border-strong); background: var(--bg-2); }
.prod-kind { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); }
.prod-name { display: block; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; color: var(--text); margin: 8px 0; }
.prod:hover .prod-name { color: var(--accent); }
.prod-pitch { display: block; font-size: 14.5px; color: var(--text-dim); margin-bottom: 14px; }
.prod-access { display: block; font-size: 13px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 12px; }

.plus-cta {
  margin: 64px 0 0; padding: 36px 28px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-1); text-align: center;
}
.plus-cta h2 { margin: 0 0 10px; }
.plus-cta p { color: var(--text-dim); max-width: 56ch; margin: 0 auto 24px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-lg { padding: 14px 26px; font-size: 15px; }

@media (max-width: 860px) {
  .tiers, .prod-grid { grid-template-columns: 1fr; }
  .plus-pkg { grid-template-columns: 1fr; }
}
