/* crelay / License – same document look as cre.ooo (privacy policy, credits):
   paper & ink, Allo text, mono HUD labels, FT88 eyebrows, hairline rules, expo-out motion.
   Dark by default, light via data-theme set by /js/theme.js. */

/* ── Fonts (all SIL OFL 1.1, licence files next to them in /site-fonts) ── */
@font-face {
  font-family: 'Allo';
  src: url('/site-fonts/AlloVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Variable';
  src: url('/site-fonts/geist-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono Variable';
  src: url('/site-fonts/geist-mono-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'FT88';
  src: url('/site-fonts/FT88-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ── */
:root {
  --font-sans: 'Allo', 'Geist Variable', system-ui, sans-serif;
  --font-heading: 'Geist Variable', system-ui, sans-serif;
  --font-display: 'FT88', 'Allo', system-ui, sans-serif;
  --font-mono: 'Geist Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;

  --paper: #c8c8c7;
  --ink: #1e1e1e;
  --ink-muted: #1e1e1eb3;
  --ink-faint: #1e1e1e73;
  --line: #1e1e1e1f;
  --fill: #1e1e1e14;
  --fill-strong: #1e1e1e29;
  --surface: #fdfcfb;
  --chrome: #f7f7f7eb;
  --shadow-control: 0 0 0 1px #1e1e1e0f, 0 2px 6px -2px #1e1e1e24;
  --shadow-modal: 0 24px 60px -24px #1e1e1e59;
  --grain: 0.07;
  --flower-filter: grayscale(1) opacity(0.6);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --gutter: clamp(1rem, 0.69rem + 1.31vw, 1.875rem);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0e0e0e;
  --ink: #f7f7f7;
  --ink-muted: #f7f7f780;
  --ink-faint: #f7f7f752;
  --line: #f7f7f71a;
  --fill: #f7f7f70f;
  --fill-strong: #f7f7f724;
  --surface: #262626;
  --chrome: #1e1e1eeb;
  --shadow-control: 0 0 0 1px #f7f7f70f, 0 2px 6px -2px #0006;
  --shadow-modal: 0 24px 70px -20px #000000b3;
  --grain: 0.11;
  --flower-filter: grayscale(1) brightness(0.75) contrast(1.05);
  color-scheme: dark;
}

/* Only while the user switches the theme, so page load never animates. */
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, box-shadow !important;
  transition-duration: 260ms !important;
  transition-timing-function: cubic-bezier(0.65, 0, 0.35, 1) !important;
  transition-delay: 0s !important;
}

/* ── Allo roundness: --rond drives the ROND axis; hover rounds, press sharpens (stepped, cached) ── */
@property --rond {
  syntax: '<number>';
  inherits: true;
  initial-value: 30;
}
:root { --rond-base: 30; --rond-hover: 80; --rond: var(--rond-base); }
:where(html, a, button, input, textarea, select, .doc h1, .license h2) {
  font-variation-settings: 'ROND' var(--rond);
}
:where(a, button) { transition: --rond 0.3s steps(5, jump-end); }
:where(a, button):is(:hover, :focus-visible) { --rond: var(--rond-hover); }
:where(a, button):active { --rond: 15; }
:where(input, textarea) { font-feature-settings: 'calt', 'liga', 'ss02'; transition: --rond 0.3s steps(5, jump-end); }
:where(input, textarea):focus { --rond: calc(var(--rond-hover) - 20); }

/* ── Base ── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  scroll-padding-top: 6.5rem;
  background: var(--paper);
  font-family: var(--font-sans);
  font-weight: 460;
  font-optical-sizing: auto;
  font-feature-settings: 'calt', 'liga';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.7;
  overflow-x: hidden;
}
/* Paper grain over everything (very faint, never intercepts input). */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url('/img/grain.svg');
  mix-blend-mode: overlay;
}
::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.text-hud {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 560;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.text-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Eyebrow line: "(§) Label ——— meta", label in FT88. */
.eyebrow { display: flex; align-items: center; gap: 0.75rem; color: var(--ink-muted); }
.eyebrow.text-eyebrow { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.06em; }
.eyebrow__index { color: var(--ink); }
.eyebrow__rule { flex: 1; height: 1px; background: var(--line); }
.eyebrow .edited { white-space: nowrap; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding: 0 0.45rem;
  border-radius: 0.3125rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Reading progress ── */
#progress {
  --progress: 0;
  position: fixed;
  inset: env(safe-area-inset-top) 0 auto;
  z-index: 60;
  height: 2px;
  background: var(--ink);
  transform: scaleX(var(--progress));
  transform-origin: left;
  pointer-events: none;
}

/* ── Header (HUD line + nav box + switches) ── */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  padding: max(0.5rem, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
  color: var(--ink);
  transition: translate 0.5s var(--ease-out-expo);
}
.site-header.is-hidden:not(:focus-within) { translate: 0 -100%; }
.site-header::before {
  content: '';
  position: absolute;
  inset: -6rem 0 -1.75rem;
  z-index: -1;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 3rem), transparent);
  mask-image: linear-gradient(#000 calc(100% - 3rem), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-quart);
}
.site-header.is-scrolled::before { opacity: 1; }
.site-header > * { pointer-events: auto; }

.hud { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.625rem; width: max-content; max-width: 100%; }
.hud-chip {
  display: inline-flex;
  align-items: center;
  height: 1.125rem;
  padding: 0 0.375rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
  -webkit-backdrop-filter: blur(14px) saturate(0.8);
  backdrop-filter: blur(14px) saturate(0.8);
}
.hud-chip__key { color: var(--ink-faint); }
.hud-chip__value { color: var(--ink); }

.site-header__row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; }
.site-header__center { display: flex; align-items: stretch; gap: 0.375rem; }
.site-header__end { display: flex; justify-content: flex-end; align-items: center; gap: 0.375rem; }

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand__sep, .brand__page { color: var(--ink-faint); }

.navbox, .seg {
  background: var(--chrome);
  box-shadow: var(--shadow-control);
  border-radius: 0.5rem;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}
.navbox { display: flex; align-items: center; padding: 0.25rem; gap: 0.125rem; }
.navbox form { margin: 0; display: contents; }
.navbox__link {
  position: relative;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.3125rem;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 560;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.25s var(--ease-out-quart), background-color 0.25s var(--ease-out-quart), --rond 0.3s steps(5, jump-end);
}
.navbox__link:hover, .navbox__link[aria-current='page'] { color: var(--ink); }
.navbox__link[aria-current='page'] { background: var(--fill); }
.navbox__link[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0.2rem;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: currentColor;
}

.seg { --seg-w: 2.125rem; --seg-index: 1; position: relative; display: inline-flex; padding: 0.1875rem; }
.seg__thumb {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: var(--seg-w);
  height: calc(100% - 0.375rem);
  border-radius: 0.3125rem;
  background: var(--fill-strong);
  translate: calc(var(--seg-index) * var(--seg-w)) 0;
  transition: translate 0.5s var(--ease-out-expo);
}
.seg__btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--seg-w);
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.3125rem;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.25s var(--ease-out-quart), transform 0.3s var(--ease-out-expo);
}
.seg__btn:hover, .seg__btn[aria-pressed='true'] { color: var(--ink); }
.seg__btn:active { transform: scale(0.96); }

/* ── Document page ── */
.doc-page { position: relative; isolation: isolate; }
.doc-flowers { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.doc-flower { position: absolute; height: auto; user-select: none; filter: var(--flower-filter); }
.doc-flower--tr { top: 11rem; right: -1%; width: clamp(6rem, 11vw, 11rem); rotate: 160deg; }
.doc-flower--bl { bottom: 1rem; left: -4%; width: clamp(8rem, 16vw, 16rem); rotate: 16deg; }

.doc { padding: 8rem var(--gutter) 4rem; max-width: 82rem; margin: 0 auto; }
.doc__hero { padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.doc h1 {
  margin: clamp(1.5rem, 4vw, 3rem) 0 0;
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 1.4rem + 5.2vw, 6rem);
  font-weight: 660;
  letter-spacing: -0.03em;
  line-height: 0.95;
  overflow-wrap: anywhere;
  animation: title-in 1.1s 0.1s var(--ease-out-expo) both;
}
@keyframes title-in { from { --rond: 0; font-weight: 260; opacity: 0; } }
.doc__intro {
  margin: clamp(1rem, 2.5vw, 1.75rem) 0 0;
  max-width: 34rem;
  font-size: clamp(1.125rem, 1.08rem + 0.19vw, 1.25rem);
  color: var(--ink-muted);
}
.doc__meta { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 1.5rem; }

.doc__layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}
.doc__layout--single { grid-template-columns: minmax(0, 1fr); }

.doc__toc { position: sticky; top: 7rem; max-height: calc(100vh - 8rem); overflow-y: auto; scrollbar-width: none; }
.doc__toc-head { display: flex; justify-content: space-between; padding-bottom: 0.75rem; color: var(--ink-faint); }
.doc__toc ol { list-style: none; margin: 0; padding: 0; }
.doc__toc a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  font-weight: 560;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.25s var(--ease-out-quart), background-color 0.25s var(--ease-out-quart), --rond 0.3s steps(5, jump-end);
}
.doc__toc a:hover { color: var(--ink); }
.doc__toc a[aria-current] { color: var(--ink); background: var(--fill); }
.doc__toc a[aria-current]::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  width: 0.375rem;
  height: 1px;
  background: var(--ink);
}
.doc__toc-num { flex: none; width: 1.25rem; }
.doc__picker { display: none; }

/* ── License text (public page and editor preview) ── */
.license {
  counter-reset: section;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}
article.license { max-width: 44rem; }
.license > :first-child { margin-top: 0; }
.license h1, .license h2, .license h3 { color: var(--ink); overflow-wrap: anywhere; }
.license h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem); font-weight: 660; letter-spacing: -0.03em; line-height: 1.05; margin: 2rem 0 1rem; }
.license h2 {
  margin: 2.25rem 0 1rem;
  font-size: clamp(1.375rem, 1.2rem + 0.75vw, 1.875rem);
  font-weight: 660;
  letter-spacing: -0.025em;
  line-height: 1.15;
  transition: --rond 0.3s steps(5, jump-end);
}
/* Numbered like the privacy policy's sections: "(01) Title". */
.license h2::before {
  counter-increment: section;
  content: '(' counter(section, decimal-leading-zero) ')';
  display: inline-block;
  margin-right: 0.875rem;
  vertical-align: 0.35em;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: color 0.3s var(--ease-out-quart);
}
.license h2.is-active::before { color: var(--ink); }
.license .box:hover h2, .license h2:hover { --rond: var(--rond-hover); }
.license h3 { margin: 1.75rem 0 0.5rem; font-size: 1.0625rem; font-weight: 660; }
.license p { margin: 0 0 0.9rem; }
.license strong { color: var(--ink); font-weight: 660; }

.license ul { margin: 0 0 0.9rem; padding: 0; list-style: none; }
.license ul > li { position: relative; padding-left: 1.25rem; }
.license ul > li::before {
  content: '';
  position: absolute;
  left: 0.125rem;
  top: 0.8em;
  width: 0.5rem;
  height: 1px;
  background: var(--ink-faint);
}
.license ol { margin: 0 0 0.9rem; padding-left: 1.5rem; }
.license ol > li::marker { color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.85em; }
.license li + li { margin-top: 0.35rem; }

.license a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.2s var(--ease-out-quart), --rond 0.3s steps(5, jump-end);
}
.license a:hover { text-decoration-color: currentColor; }

.license blockquote { margin: 0 0 1rem; padding: 0.25rem 0 0.25rem 1.125rem; border-left: 1px solid var(--ink); color: var(--ink-muted); }
.license hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem 0; }
.license code {
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono);
  font-size: 0.82em;
}
.license pre { padding: 0.875rem 1rem; border-radius: 0.5rem; background: var(--fill); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; }
.license pre code { padding: 0; background: none; box-shadow: none; }
.license .center { text-align: center; }
.license small { font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.4; color: var(--ink-faint); letter-spacing: 0.04em; text-transform: uppercase; }
.license p > small:only-child { display: block; }

/* ::: box — a flat paper card with a hairline, like the site's panels. */
.license .box {
  margin: 0 0 1.5rem;
  padding: clamp(1.125rem, 2.5vw, 1.625rem) clamp(1.125rem, 3vw, 1.875rem);
  border-radius: 0.5rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.license .box > :first-child { margin-top: 0; }
.license .box > :last-child { margin-bottom: 0; }
.license .box .box { background: var(--fill); }

/* Font setting from the editor. "sans" is the site's Allo. */
.license.font-sans, .font-sans { font-family: var(--font-sans); }
.license.font-serif, .font-serif { font-family: Georgia, 'Times New Roman', Times, serif; }
.license.font-mono, .font-mono { font-family: var(--font-mono); }
.license.font-humanist, .font-humanist { font-family: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif; }
.license.font-rounded, .font-rounded { font-family: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', Calibri, sans-serif; }
.license.font-slab, .font-slab { font-family: Rockwell, 'Rockwell Nova', 'Roboto Slab', 'DejaVu Serif', 'Sitka Small', serif; }
.license.font-classic, .font-classic { font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, 'Book Antiqua', Palatino, serif; }
.license.font-mono { font-size: 0.9375rem; }

/* ── Footer ── */
.site-foot { padding: 0 var(--gutter) max(2.5rem, env(safe-area-inset-bottom)); }
.site-foot__inner { max-width: 82rem; margin: 0 auto; padding-top: 2rem; border-top: 1px solid var(--line); }
.site-foot__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 1rem; font-size: 0.9375rem; font-weight: 560; }
.site-foot__links a { color: var(--ink-muted); text-decoration: none; transition: color 0.25s var(--ease-out-quart), --rond 0.3s steps(5, jump-end); }
.site-foot__links a:hover { color: var(--ink); }
.site-foot__top { margin-left: auto; }

/* ── Controls (login, editor) ── */
button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 560;
  color: var(--ink);
  background: var(--chrome);
  border: 0;
  box-shadow: var(--shadow-control);
  border-radius: 0.5rem;
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: transform 0.3s var(--ease-out-expo), background-color 0.25s var(--ease-out-quart), color 0.25s var(--ease-out-quart), --rond 0.3s steps(5, jump-end);
}
button:active { transform: scale(0.97); }
button svg { flex: none; opacity: 0.85; }
button.primary, .login button[type=submit] { background: var(--ink); color: var(--paper); box-shadow: none; }
button.primary svg { opacity: 1; }
input, select, textarea { font: inherit; color: var(--ink); }

main.wrap { max-width: 82rem; margin: 0 auto; padding: 7.5rem var(--gutter) 4rem; }

/* Login */
.login {
  max-width: 24rem;
  margin: 8vh auto 0;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--surface);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-control), var(--shadow-modal);
}
.login h1 { margin: 1.25rem 0 1.25rem; font-family: var(--font-sans); font-size: 2.25rem; font-weight: 660; letter-spacing: -0.03em; line-height: 1; animation: title-in 1.1s 0.1s var(--ease-out-expo) both; }
.login label { display: block; margin-bottom: 0.375rem; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }
.login input[type=password] {
  display: block;
  width: 100%;
  padding: 0.75rem 0.875rem;
  margin-bottom: 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.25s var(--ease-out-quart);
}
.login input[type=password]:focus { outline: none; box-shadow: inset 0 0 0 1px var(--ink); }
.login button[type=submit] { width: 100%; justify-content: center; padding: 0.75rem; }
.error {
  margin: 0 0 1rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--ink-faint);
  color: var(--ink);
  font-size: 0.875rem;
  animation: shake 0.45s var(--ease-out-quart);
}
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Editor */
.toolbar {
  position: sticky;
  top: 6.25rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  margin-bottom: 1.125rem;
  padding: 0.25rem;
  background: var(--chrome);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-control);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}
.toolbar .group { display: flex; gap: 0.125rem; padding-right: 0.375rem; margin-right: 0.125rem; border-right: 1px solid var(--line); }
.toolbar .group:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.toolbar button { background: none; box-shadow: none; padding: 0.4rem 0.625rem; border-radius: 0.3125rem; color: var(--ink-muted); }
.toolbar button:hover { color: var(--ink); background: var(--fill); }
.toolbar button b { font-weight: 760; }
.toolbar button:has(> b, > i, > span:not(.lbl)) .lbl { display: none; }

.panes { display: grid; grid-template-columns: 1fr; gap: 1.125rem; }
.pane { min-width: 0; display: flex; flex-direction: column; }
.pane-label { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.625rem 0.125rem; color: var(--ink-faint); }
.pane-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.pane-label .count { margin-left: auto; margin-right: 0.25rem; }
#editor {
  width: 100%;
  height: 62vh;
  min-height: 320px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  padding: 1.125rem 1.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow-control);
  transition: box-shadow 0.25s var(--ease-out-quart);
  tab-size: 2;
}
#editor:focus { outline: none; box-shadow: 0 0 0 1px var(--ink); }
.preview {
  height: 62vh;
  min-height: 320px;
  overflow: auto;
  padding: 1.25rem 1.625rem;
  border-radius: 0.5rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.preview.updating { opacity: 0.6; transition: opacity 0.2s; }

.settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 0.875rem;
  margin-top: 1.125rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.settings label { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }
.settings input, .settings select {
  padding: 0.4rem 0.625rem;
  border: 0;
  border-radius: 0.375rem;
  background: var(--surface);
  box-shadow: var(--shadow-control);
}
.settings select option { background: var(--surface); color: var(--ink); }
.settings input:focus, .settings select:focus { outline: none; box-shadow: 0 0 0 1px var(--ink); }
.settings .hint { font-size: 0.8125rem; color: var(--ink-faint); margin-left: auto; }

.actions {
  position: sticky;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1.125rem;
  padding: 0.375rem;
  background: var(--chrome);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-control), var(--shadow-modal);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}
.actions button:not(.primary) { box-shadow: none; background: none; color: var(--ink-muted); }
.actions button:not(.primary):hover { background: var(--fill); color: var(--ink); }
kbd { font-family: var(--font-mono); font-size: 0.625rem; padding: 0.1rem 0.35rem; border-radius: 0.25rem; box-shadow: inset 0 0 0 1px currentColor; opacity: 0.6; text-transform: uppercase; }
#status {
  margin-left: auto;
  padding: 0.3rem 0.75rem;
  min-height: 1.9em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: opacity 0.3s;
}
#status:empty { opacity: 0; }
#status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
#status[data-state="ok"], #status[data-state="err"] { color: var(--ink); }
#status[data-state="busy"]::before { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.4); opacity: 0.4; } }
#status.pop { animation: pop 0.45s var(--ease-out-expo); }
@keyframes pop { 0% { transform: scale(0.85); } 100% { transform: none; } }

/* ── Responsive ── */
@media (min-width: 900px) {
  .panes { grid-template-columns: 1fr 1fr; }
  #editor, .preview { height: 68vh; }
}
@media (max-width: 1023px) {
  .doc__layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .doc__toc { display: none; }
  .doc__picker {
    position: sticky;
    top: calc(5.75rem + env(safe-area-inset-top));
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--chrome);
    box-shadow: var(--shadow-control);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    color: var(--ink-faint);
    transition: top 0.5s var(--ease-out-expo);
  }
  body:has(.site-header.is-hidden:not(:focus-within)) .doc__picker { top: calc(0.75rem + env(safe-area-inset-top)); }
  .doc__picker select { width: 100%; border: 0; background: none; color: var(--ink); font: inherit; font-size: 0.9375rem; font-weight: 560; outline: 0; }
  .doc__picker select option { background: var(--surface); color: var(--ink); }
  .doc-flowers { display: none; }
}
@media (max-width: 639px) {
  .doc { padding-top: 7rem; }
  .doc__hero .eyebrow { flex-wrap: wrap; row-gap: 0.5rem; }
  .doc__hero .eyebrow__rule { min-width: 2rem; }
  .hud-chip--wide { display: none; }
  .site-header__row { grid-template-columns: auto 1fr; }
  .site-header__center { display: none; }
  .page-admin .site-header__row { grid-template-columns: auto 1fr auto; }
  .page-admin .site-header__center { display: flex; justify-content: flex-end; }
  .page-admin .brand__sep, .page-admin .brand__page { display: none; }
  .page-admin .navbox__link { padding: 0.45rem 0.55rem; font-size: 0.875rem; }
  .seg { --seg-w: 1.875rem; }
  .toolbar .group { border-right: 0; }
  .toolbar button .lbl { display: none; }
  .settings .hint { margin-left: 0; width: 100%; }
  .site-foot__top { margin-left: 0; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--fill-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
