/*
 * FrameSouth betadoc — the client-facing skin.
 *
 * Self-contained by requirement: system font stacks, no CDN, no webfont, no
 * external request of any kind. It shares the product's editorial voice without
 * being the product, and it is theme-aware in both directions: an explicit
 * choice wins, and the system preference decides when there is none.
 */

:root {
  color-scheme: light dark;

  --paper: #fbfaf8;
  --paper-2: #ffffff;
  --ink: #14110f;
  --ink-2: #55504a;
  --ink-3: #7d766d;
  --line: #e4e0da;
  --line-2: #cfc9c0;
  --accent: #b4471c;
  --ok: #1c7a4a;
  --ok-bg: #e6f4ec;
  --part: #9a6410;
  --part-bg: #fbf0dc;
  --todo: #6b6560;
  --todo-bg: #f0eeea;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c0b0a;
    --paper-2: #15130f;
    --ink: #f3efe7;
    --ink-2: #b3ada2;
    --ink-3: #8a8378;
    --line: #2a2622;
    --line-2: #423c35;
    --accent: #ef8b5c;
    --ok: #63d09a;
    --ok-bg: #10261b;
    --part: #e0ab52;
    --part-bg: #2a2010;
    --todo: #928b82;
    --todo-bg: #1c1a17;
  }
}

:root[data-theme="dark"] {
  --paper: #0c0b0a;
  --paper-2: #15130f;
  --ink: #f3efe7;
  --ink-2: #b3ada2;
  --ink-3: #8a8378;
  --line: #2a2622;
  --line-2: #423c35;
  --accent: #ef8b5c;
  --ok: #63d09a;
  --ok-bg: #10261b;
  --part: #e0ab52;
  --part-bg: #2a2010;
  --todo: #928b82;
  --todo-bg: #1c1a17;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 74rem; margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 3rem); }
.narrow { max-width: 46rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
h2 { font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.9rem); margin: 0.6rem 0 1.2rem; }
h3 { font-size: 1.28rem; margin: 2rem 0 0.6rem; }

p { margin: 0 0 1.1rem; }
.lede { font-size: 1.16rem; color: var(--ink-2); max-width: 42rem; }

/* Header ------------------------------------------------------------- */

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.85rem; }
.top__mark { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.top__nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.top__nav a, .themetoggle {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; padding: 0.6rem 0.7rem; border-radius: 999px;
  border: 1px solid transparent; background: none; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center;
}
.top__nav a:hover, .themetoggle:hover { border-color: var(--line-2); color: var(--ink); }
.top__nav .cta { border-color: var(--line-2); color: var(--ink); }
.top__nav .cta:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Hero --------------------------------------------------------------- */

.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.hero__grid { display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 1.4rem + 4.8vw, 5rem); margin: 0.6rem 0 0.5rem; }
.hero__tag { font-family: var(--serif); font-size: clamp(1.2rem, 1rem + 1.2vw, 1.9rem); color: var(--ink-2); margin: 0 0 1.4rem; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 1.75rem; margin: 1.75rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.fact__n { font-family: var(--mono); font-size: 1.65rem; display: block; line-height: 1.1; }
.fact__l { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }

.buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.9rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 48px;
  padding: 0.6rem 1.4rem; border-radius: 999px; border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; color: var(--ink); background: none; cursor: pointer;
}
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:hover { border-color: var(--ink); }
.btn--solid:hover { opacity: 0.88; }

.video {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--paper-2); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.45);
}
.video video { display: block; width: 100%; height: auto; background: #0a0908; }
.video__cap { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 0.7rem 0.95rem; border-top: 1px solid var(--line); margin: 0; }

@media (min-width: 62rem) {
  .hero__grid { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
}

/* Sections ----------------------------------------------------------- */

section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
section > .wrap > .label { margin-bottom: 0.2rem; }

.cols { display: grid; gap: 1.5rem; }
@media (min-width: 50rem) { .cols--2 { grid-template-columns: 1fr 1fr; gap: 2.5rem; } }
@media (min-width: 50rem) { .cols--3 { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }

.card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  padding: 1.4rem 1.5rem;
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.codenow {
  display: grid; gap: 0.35rem; justify-items: start;
  border: 1px dashed var(--line-2); border-radius: 12px; background: var(--paper-2);
  padding: 1.1rem 1.3rem; margin: 1.5rem 0;
}
.codenow__l, .codenow__m {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3);
}
.codenow__n { font-family: var(--mono); font-size: 2rem; letter-spacing: 0.3em; color: var(--ink); }
.codenow--none { display: block; font-size: 0.92rem; color: var(--ink-2); }

.pull {
  font-family: var(--serif); font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  line-height: 1.28; border-left: 3px solid var(--accent); padding-left: 1.4rem;
  margin: 2rem 0; color: var(--ink);
}

/* Tables ------------------------------------------------------------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 40rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td code, p code, li code { font-family: var(--mono); font-size: 0.82em; background: var(--todo-bg); padding: 0.1rem 0.35rem; border-radius: 4px; }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: 999px;
  white-space: nowrap;
}
.tag--built { background: var(--ok-bg); color: var(--ok); }
.tag--part { background: var(--part-bg); color: var(--part); }
.tag--todo { background: var(--todo-bg); color: var(--todo); }

.legend { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1rem 0 1.5rem; font-size: 0.86rem; color: var(--ink-2); }

/* Architecture SVG --------------------------------------------------- */

.diagram { border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); padding: 1rem; overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 36rem; }

/* Steps -------------------------------------------------------------- */

ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
ol.steps li { counter-increment: s; position: relative; padding-left: 3rem; margin-bottom: 1.4rem; }
ol.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: 0.1rem;
  font-family: var(--mono); font-size: 0.85rem; color: var(--accent);
}

pre {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.15rem; overflow-x: auto; font-family: var(--mono); font-size: 0.82rem; line-height: 1.55;
}
pre code { background: none; padding: 0; }

/* Demo call to action ------------------------------------------------ */

.demo { border-top: 1px solid var(--line); background: var(--paper-2); }
.demo__inner { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 54rem) { .demo__inner { grid-template-columns: 1.2fr 1fr; } }
.demo h2 { margin-top: 0; }

footer { border-top: 1px solid var(--line); padding-block: 2.5rem 3.5rem; color: var(--ink-3); font-size: 0.86rem; }
footer p { margin: 0 0 0.5rem; }

/* Documentation page ------------------------------------------------- */

.doclayout { display: grid; gap: 2.5rem; padding-block: 2.5rem 4rem; }
@media (min-width: 62rem) {
  .doclayout { grid-template-columns: 15rem minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .toc { position: sticky; top: 5rem; }
}
.toc ol { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: 0.9rem; }
.toc li { margin-bottom: 0.35rem; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.doc h2 { font-size: 1.7rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.doc h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.doc ul, .doc ol { padding-left: 1.3rem; }
.doc li { margin-bottom: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
