/*! Nixosoft Art Design 1.0.0 — full theme. https://cdn.nixosoft.com/nixosoft-art-design/1.0.0/ · design-systems/nixosoft-art-design */
/* Nixosoft Art Design: tokens. Indigo cloth, cream ink and dyed thread.
 *
 * The second Nixosoft design system, taken from the Heddle website (heddle.hiradnikoo.com).
 * Nixosoft-AI-Designs (sand and sage) is for apps and tools people work in; this one is for
 * public, editorial and art-led sites: product homes, the company sites, showcases.
 *
 * Dark indigo is the default. Light "blueprint paper" is the same threads, deepened to
 * read on a pale blue sheet. Both are complete: every colour token has a value in each.
 *   :root                                   dark (indigo cloth)
 *   :root[data-theme="light"]               light, chosen
 *   @media (prefers-color-scheme: light)
 *     :root:not([data-theme="dark"])        light, when the visitor chose "Same as system"
 *                                           (theme.js sets data-theme="dark" until they do)
 *
 * Vazirmatn is first in every stack (NX-LG-020) but only claims Arabic-script code points,
 * so Latin text falls through to the editorial faces after it.
 * Font files are relative (fonts/…): they resolve against this stylesheet on the CDN.
 */
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-opsz-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-opsz-italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* the cloth */
  --paper: #06090f;
  --paper-2: #0a0f1b;
  --sheet: #101829;
  --ink: #e9eef6;
  --ink-2: #b3c0d4;
  --ink-3: #7d8ca5;
  --rule: #1a2540;
  --rule-2: #27375a;

  /* dyed threads: emphasis, timelines, diagrams. --accent is the product's one thread. */
  --accent: #f2c14e;     /* gold: emphasis, the shuttle, primary actions */
  --madder: #ff8fa3;     /* rose */
  --indigo: #8cc4ff;     /* sky */
  --saffron: #f2c14e;
  --moss: #6fd6a5;
  --plum: #b9a6ff;
  --teal: #5fd0d6;
  --live: #ff5a5f;       /* LIVE / on-air only, never decoration */

  --link: #9ccbff;
  --on-accent: #06090f;
  --code-bg: #070b14;
  --film: #03060c;
  --label-ink: #f1e9da;          /* captions printed on a render: the same in both themes */
  --label-bg: rgba(10, 10, 14, .62);
  --scrim: rgba(3, 5, 10, .72);  /* behind dialogs */
  --shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 14px 30px -16px rgba(0, 0, 0, .75);
  --shadow-lift: 0 1px 0 rgba(0, 0, 0, .25), 0 22px 40px -16px rgba(0, 0, 0, .85);
  --shadow-dialog: 0 30px 80px rgba(0, 0, 0, .6);

  /* code */
  --tok-kw: #ff9cc0;
  --tok-str: #7fdcaa;
  --tok-num: #8cc4ff;
  --tok-prop: #c4b3ff;
  --tok-fn: #f2c14e;

  /* type: an editorial serif for headings, a grotesk for reading, a mono, a hand for notes */
  --serif: "Vazirmatn", "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Vazirmatn", "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "Vazirmatn", "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --hand: "Vazirmatn", "Caveat", "Segoe Print", cursive;

  /* shape */
  --radius-control: 10px;   /* buttons, fields, chips: softly squared */
  --radius-sheet: 14px;     /* sheets and cards */
  --radius-film: 10px;      /* a render pinned to the page */
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

/* blueprint paper: the same threads, deepened to read on a pale blue sheet */
:root[data-theme="light"] {
  --paper: #edf1f7;
  --paper-2: #e1e8f2;
  --sheet: #f8fafd;
  --ink: #12203a;
  --ink-2: #3a4b68;
  --ink-3: #58687f;
  --rule: #cdd7e6;
  --rule-2: #b4c2d7;
  --accent: #1f4fb8;
  --madder: #c0305f;
  --indigo: #1f5fc4;
  --saffron: #c8901a;
  --moss: #2d8257;
  --plum: #6a4bc4;
  --teal: #1f7f86;
  --live: #c4232c;
  --link: #1f4fb8;
  --on-accent: #ffffff;
  --code-bg: #ffffff;
  --film: #03060c;
  --label-ink: #f1e9da;
  --label-bg: rgba(10, 10, 14, .62);
  --scrim: rgba(18, 32, 58, .45);
  --shadow: 0 1px 0 rgba(18, 32, 58, .05), 0 10px 24px -14px rgba(18, 32, 58, .35);
  --shadow-lift: 0 1px 0 rgba(18, 32, 58, .05), 0 18px 34px -16px rgba(18, 32, 58, .45);
  --shadow-dialog: 0 30px 80px rgba(18, 32, 58, .35);
  --tok-kw: #b0306a;
  --tok-str: #2d7a4f;
  --tok-num: #1f57b8;
  --tok-prop: #6a4bc4;
  --tok-fn: #8a5d00;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --paper: #edf1f7;
    --paper-2: #e1e8f2;
    --sheet: #f8fafd;
    --ink: #12203a;
    --ink-2: #3a4b68;
    --ink-3: #58687f;
    --rule: #cdd7e6;
    --rule-2: #b4c2d7;
    --accent: #1f4fb8;
    --madder: #c0305f;
    --indigo: #1f5fc4;
    --saffron: #c8901a;
    --moss: #2d8257;
    --plum: #6a4bc4;
    --teal: #1f7f86;
    --live: #c4232c;
    --link: #1f4fb8;
    --on-accent: #ffffff;
    --code-bg: #ffffff;
    --film: #03060c;
    --label-ink: #f1e9da;
    --label-bg: rgba(10, 10, 14, .62);
    --scrim: rgba(18, 32, 58, .45);
    --shadow: 0 1px 0 rgba(18, 32, 58, .05), 0 10px 24px -14px rgba(18, 32, 58, .35);
    --shadow-lift: 0 1px 0 rgba(18, 32, 58, .05), 0 18px 34px -16px rgba(18, 32, 58, .45);
    --shadow-dialog: 0 30px 80px rgba(18, 32, 58, .35);
    --tok-kw: #b0306a;
    --tok-str: #2d7a4f;
    --tok-num: #1f57b8;
    --tok-prop: #6a4bc4;
    --tok-fn: #8a5d00;
    color-scheme: light;
  }
}

/* Nixosoft Art Design: components. Every colour is a token (tokens.css).
 *
 * The look borrows from the loom: a deep indigo ground like dyed cloth, cream text, and a
 * handful of thread colours used for emphasis, timelines and diagrams. Renders sit on the
 * page like prints pinned to a board, framed in a lighter sheet so they never melt into
 * the background. Headings are an editorial serif; notes in the margin are handwritten.
 */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  background-color: var(--paper);
  /* a faint woven texture: a barely-there warp and weft */
  background-image:
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--ink) 2.2%, transparent) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--ink) 1.6%, transparent) 0 1px, transparent 1px 9px);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg { max-width: 100%; }
figure { margin: 0; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--saffron) 45%, transparent); }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }

/* Icons: Material Symbols Rounded (icons.css on the CDN loads the font). */
.material-symbols-rounded, .ms {
  font-family: "Material Symbols Rounded";
  font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap;
  direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  vertical-align: -4px; user-select: none;
}
.icon-flip-rtl:dir(rtl) { transform: scaleX(-1); }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.08; letter-spacing: -.012em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(44px, 7.4vw, 92px); font-weight: 400; letter-spacing: -.025em; }
h2 { font-size: clamp(32px, 4.4vw, 52px); }
h3 { font-size: clamp(21px, 2vw, 25px); }
h1 em, h2 em { font-style: italic; color: var(--accent); }
p { margin: 0 0 1em; }
.lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: var(--ink-2); max-width: 38em; }
.kicker {
  font-family: var(--hand); font-size: 25px; line-height: 1; color: var(--accent);
  display: inline-block; transform: rotate(-2deg); margin: 0 0 10px;
}
.eyebrow { font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.small { font-size: 14.5px; color: var(--ink-3); }
code, kbd { font-family: var(--mono); font-size: .88em; }
:not(pre) > code {
  background: color-mix(in srgb, var(--saffron) 18%, transparent);
  padding: .08em .35em; border-radius: 4px; color: var(--ink);
}
kbd { border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--sheet); }
.hand { font-family: var(--hand); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand svg, .brand img { width: 30px; height: 30px; }
.brand b { font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
.nav { display: flex; align-items: center; gap: 4px; margin-inline-start: 8px; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: 15.5px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--radius-control); position: relative;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); }
/* the current page is underlined with a loose hand-drawn thread in the product's colour */
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; inset-inline: 12px; bottom: 1px; height: 6px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 6' preserveAspectRatio='none'%3E%3Cpath d='M1 4 C 12 1.5, 22 5.5, 33 3 S 52 2, 59 3.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 6' preserveAspectRatio='none'%3E%3Cpath d='M1 4 C 12 1.5, 22 5.5, 33 3 S 52 2, 59 3.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.bar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-control);
  background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer;
}
.iconbtn:hover { background: var(--paper-2); color: var(--ink); }
.menu-btn { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 16px/1 var(--sans);
  padding: 13px 20px; border-radius: var(--radius-control); text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); color: var(--ink); background: transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); text-decoration: none; }
.btn:active { transform: none; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { box-shadow: 3px 3px 0 var(--ink-3); }
.btn.sm { padding: 8px 13px; font-size: 14.5px; border-radius: var(--radius-control); }
.btn .ver { font: 500 13px/1 var(--mono); opacity: .75; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea {
  font: 400 16px/1.4 var(--sans); color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule-2); border-radius: var(--radius-control); padding: 10px 12px; min-width: 0;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }

/* ---------- the theme switch (theme.js fills <div data-nx-theme-switch>) ---------- */
.seg-choice { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--paper-2); }
.seg-choice button {
  font: 500 14px/1 var(--sans); color: var(--ink-2); background: transparent; border: 0;
  padding: 8px 12px; border-radius: var(--radius-control); cursor: pointer;
}
.seg-choice button:hover { color: var(--ink); }
.seg-choice button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: 500 13.5px/1 var(--sans);
  padding: 6px 10px; border-radius: var(--radius-control); border: 1px solid var(--rule-2);
  color: var(--ink-2); background: transparent; text-decoration: none;
}
.chip.thread { border-color: color-mix(in srgb, var(--thread, var(--accent)) 55%, transparent); color: var(--ink); background: color-mix(in srgb, var(--thread, var(--accent)) 12%, transparent); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 25%, transparent); }

/* ---------- paper bits ---------- */
.sheet {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sheet); box-shadow: var(--shadow);
}
.card {
  display: block; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sheet);
  padding: 22px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none;
}
a.card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--rule-2); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-2); }
.card p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: clamp(16px, 2.2vw, 24px); grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.tape {
  position: absolute; width: 92px; height: 26px; top: -12px; inset-inline-start: 50%;
  translate: -50% 0; rotate: -3deg; z-index: 2;
  background: color-mix(in srgb, var(--saffron) 55%, transparent);
  border-inline: 2px dotted color-mix(in srgb, var(--paper) 60%, transparent);
  opacity: .62;
}
:root[data-theme="light"] .tape { mix-blend-mode: multiply; opacity: 1; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .tape { mix-blend-mode: multiply; opacity: 1; } }

/* a render pinned to the page */
.film {
  position: relative; background: var(--film); border-radius: var(--radius-film); overflow: hidden;
  aspect-ratio: 16 / 9; box-shadow: var(--shadow);
}
.film video, .film img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.film.tall { aspect-ratio: 9 / 16; }
.film .label {
  position: absolute; inset-inline-start: 10px; bottom: 9px; z-index: 1;
  font: 500 12px/1 var(--mono); color: var(--label-ink); background: var(--label-bg);
  padding: 5px 8px; border-radius: 6px;
}

/* ---------- code ---------- */
.code {
  position: relative; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; min-width: 0;
}
.code .file {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px dashed var(--rule-2);
  font: 500 13px/1 var(--mono); color: var(--ink-3);
}
.code .file .dots { display: inline-flex; gap: 5px; }
.code .file .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--rule-2); }
.code pre, pre.code {
  margin: 0; padding: 16px 18px; overflow-x: auto; font: 400 14px/1.7 var(--mono); color: var(--ink); tab-size: 2;
}
.code .copy {
  position: absolute; top: 6px; inset-inline-end: 6px; z-index: 1;
  display: inline-flex; align-items: center; gap: 5px; font: 500 12.5px/1 var(--sans);
  background: var(--sheet); color: var(--ink-3); border: 1px solid var(--rule); border-radius: var(--radius-control);
  padding: 6px 8px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy, .code .copy:focus-visible, .code .copy.done { opacity: 1; }
@media (hover: none) { .code .copy { opacity: 1; } }
.code .copy .material-symbols-rounded { font-size: 16px; vertical-align: -3px; }
.code .line { display: block; padding-inline: 18px; margin-inline: -18px; transition: background .15s, box-shadow .15s; }
.code .line.on { background: color-mix(in srgb, var(--thread, var(--saffron)) 16%, transparent); box-shadow: inset 3px 0 0 var(--thread, var(--saffron)); }
.code .line.dim { opacity: .45; }

.tok-kw { color: var(--tok-kw); font-weight: 500; }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-com { color: var(--ink-3); font-style: italic; }
.tok-prop { color: var(--tok-prop); }
.tok-fn { color: var(--tok-fn); }
.tok-punct { color: var(--ink-3); }
.sh-prompt { color: var(--ink-3); user-select: none; }
.sh-ok { color: var(--moss); }
.sh-err { color: var(--accent); }
.sh-com { color: var(--ink-3); font-style: italic; }

/* ---------- sections ---------- */
section.band { padding-block: clamp(64px, 9vw, 120px); position: relative; }
.section-head { max-width: 44em; margin-bottom: clamp(30px, 4vw, 48px); }
.section-head h2 + p { margin-top: 16px; }
.thread-rule { display: block; width: 100%; height: 28px; color: var(--rule-2); }

/* ---------- hand-drawn notes ---------- */
.note {
  font-family: var(--hand); font-size: 22px; line-height: 1.1; color: var(--indigo);
  position: absolute; pointer-events: none; white-space: nowrap;
}
.note svg { display: block; overflow: visible; }
.note path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- dialogs ---------- */
dialog.sheet-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--rule-2); border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-dialog); }
dialog.sheet-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--rule); padding-block: 56px 40px; margin-top: 40px; font-size: 15px; color: var(--ink-2); }
.footer .cols { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
.footer h4 { font: 600 13px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.footer .about p { max-width: 26em; margin-top: 12px; }
.footer .fine { margin-top: 44px; padding-top: 18px; border-top: 1px dashed var(--rule); display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-3); font-size: 13.5px; }

/* ---------- page header (inner pages) ---------- */
.page-head { padding-block: clamp(48px, 7vw, 88px) clamp(28px, 4vw, 44px); }
.page-head h1 { font-size: clamp(40px, 6vw, 72px); }
.page-head .lede { margin-top: 18px; }

/* ---------- reader (docs, courses, long reads) ---------- */
.wrap.reader { max-width: 1440px; }
.reader { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(24px, 3vw, 48px); align-items: start; padding-block: 32px 40px; }
.reader.no-toc { grid-template-columns: 250px minmax(0, 1fr); }
.side-col { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-bottom: 20px; }
.side { font-size: 15px; }
.side h4 { font: 600 12.5px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 10px; }
.side h4:first-child { margin-top: 4px; }
.side ol, .side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side a { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side a:hover { background: var(--paper-2); color: var(--ink); }
.side a[aria-current="page"] { background: var(--sheet); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.side .num { font: 500 12.5px/1.35 var(--mono); color: var(--ink-3); min-width: 1.6em; }
.side .num .material-symbols-rounded { font-size: 16px; vertical-align: -3px; }
.side .done .num { color: var(--moss); }
.toc { font-size: 13.5px; margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--rule-2); }
.toc h4 { font: 600 12px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 10px; }
.toc a { display: block; color: var(--ink-3); text-decoration: none; padding: 4px 0 4px 12px; border-inline-start: 1px solid var(--rule); line-height: 1.35; }
.toc a.h3 { padding-inline-start: 24px; font-size: 13px; }
.toc a:hover, .toc a.on { color: var(--ink); border-color: var(--accent); }

/* prose keeps a readable measure; code and tables take the whole column */
.prose { min-width: 0; }
.prose > :not(.code):not(.table-wrap):not(.pager) { max-width: 46em; }
.prose .code pre { font-size: 14.5px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.prose > h1:first-child { font-size: clamp(36px, 4.6vw, 54px); margin-bottom: 20px; }
.prose h2 { font-size: clamp(26px, 2.8vw, 34px); margin: 2em 0 .6em; padding-top: .2em; }
.prose h3 { font-size: 22px; margin: 1.7em 0 .5em; }
.prose h4 { font-size: 18px; margin: 1.4em 0 .4em; font-family: var(--sans); font-weight: 600; }
.prose h2 a.anchor, .prose h3 a.anchor { color: var(--rule-2); text-decoration: none; margin-inline-start: 8px; font-size: .7em; opacity: 0; }
.prose h2:hover a.anchor, .prose h3:hover a.anchor { opacity: 1; }
.prose p, .prose li { color: var(--ink); }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--ink-3); }
/* a loose thread instead of a ruled line */
.prose hr { border: 0; height: 18px; margin: 2.2em 0; background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18'%3E%3Cpath d='M2 9 C 20 3, 40 15, 60 9 S 100 3, 118 9' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 120px 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18'%3E%3Cpath d='M2 9 C 20 3, 40 15, 60 9 S 100 3, 118 9' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 120px 18px no-repeat; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-inline-start: 3px solid var(--saffron); background: color-mix(in srgb, var(--saffron) 10%, transparent); border-radius: 0 10px 10px 0; color: var(--ink-2); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .code { margin: 1.2em 0; }
.prose .table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose tr:last-child td { border-bottom: 0; }
.prose .unlinked { border-bottom: 1px dotted var(--ink-3); }
.prose th, .prose td { text-align: start; padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 600; border-bottom: 1.5px solid var(--ink-3); white-space: nowrap; }
.prose img { border-radius: 10px; }
.prose p, .prose li, .prose td, .prose blockquote, .prose :not(pre) > code { overflow-wrap: anywhere; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--sheet); }
.pager a:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.pager a small { display: block; color: var(--ink-3); font-size: 13px; margin-bottom: 4px; }
.pager a b { font-family: var(--serif); font-weight: 500; font-size: 19px; }
.pager .next { text-align: end; grid-column: 2; }
.state { padding: 40px 0; color: var(--ink-3); }
.state.error { color: var(--accent); }
.state button { margin-top: 14px; }
.side-toggle { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .reader, .reader.no-toc { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: 64px; inset-inline: 0; background: var(--paper); border-bottom: 1px solid var(--rule); flex-direction: column; align-items: stretch; padding: 10px var(--gutter) 16px; margin: 0; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 10px; font-size: 17px; }
  .menu-btn { display: inline-grid; }
  .bar-end .btn .ver { display: none; }
  .footer .cols { grid-template-columns: 1fr 1fr; }
  .footer .about { grid-column: 1 / -1; }
  .reader, .reader.no-toc { grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
  .side-col { position: static; max-height: none; }
  .toc { display: none; }
  .side { display: none; border: 1px solid var(--rule); border-radius: 12px; padding: 10px; background: var(--sheet); }
  .side.open { display: block; }
  .side-toggle { display: inline-flex; margin-bottom: 4px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (max-width: 480px) {
  .bar-end .btn { padding: 8px 11px; }
  .brand b { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
