/* Bea website.
   Palette taken from Beatrix: the accretion disc (pink → violet), her plum
   outline, the inner glow and the cheeks. The hero is always "space";
   everything else follows the light/dark theme. */

:root {
  /* Beatrix */
  --disc-pink: #FC61B9;
  --disc-lilac: #DB82DA;
  --disc-violet: #B492F9;
  --outline: #3C2B55;
  --glow: #FFD3E8;
  --cheek: #FC9A96;
  --face: #FAF3EC;
  --disc: linear-gradient(115deg, var(--disc-pink), var(--disc-lilac) 55%, var(--disc-violet));

  /* Space (hero and code, same in both themes) */
  --space: #150E22;
  --space-2: #1E1530;
  --space-line: #3C2B55;
  --space-text: #EDE6F7;
  --space-soft: #B9ABD3;

  /* Theme: light */
  --bg: #FFFFFF;
  --bg-alt: #F7F3FC;
  --ink: #241A36;
  --ink-soft: #5D5073;
  --line: #E6DDF2;
  --link: #A31F6E;
  --edge: var(--outline);   /* the chunky outline on buttons and panels */
  --chip: #F1E8FB;

  /* Code tokens (on --space-2) */
  --tk-c: #8C7FA8;
  --tk-k: #FF85CB;
  --tk-x: #FFE07A;
  --tk-t: #C8B0FF;
  --tk-f: #9EE6F2;
  --tk-s: #FFB8A8;
  --tk-e: #FF85CB;
  --tk-n: #FFB8A8;
  --tk-o: #D3C5EE;
  --tk-a: #9EE6F2;
  --tk-p: #8C7FA8;

  --font-display: "Unbounded", "Avenir Next", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 14px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110B1B;
    --bg-alt: #181024;
    --ink: #EDE6F7;
    --ink-soft: #B3A6C9;
    --line: #2E2343;
    --link: #FF8FD0;
    --edge: #6E5893;
    --chip: #231833;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #110B1B;
  --bg-alt: #181024;
  --ink: #EDE6F7;
  --ink-soft: #B3A6C9;
  --line: #2E2343;
  --link: #FF8FD0;
  --edge: #6E5893;
  --chip: #231833;
  color-scheme: dark;
}

/* --- Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

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

:focus-visible { outline: 3px solid var(--disc-pink); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

code {
  font-family: var(--font-mono);
  font-stretch: 87.5%;
  font-size: 0.86em;
}
:not(pre) > code {
  background: var(--chip);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  overflow-wrap: break-word;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: 66ch; }
.prose p:last-child { margin-bottom: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--bg); color: var(--ink); padding: 8px 14px; border: 2px solid var(--edge); border-radius: 10px;
}
.skip:focus { top: 12px; }

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font: 600 0.98rem/1 var(--font-body);
  padding: 0.8em 1.25em;
  border-radius: 999px;
  border: 2px solid var(--edge);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.btn:hover { background: var(--chip); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--disc);
  color: #241A36;
  border-color: var(--outline);
}
.btn-primary:hover { background: var(--disc); filter: brightness(1.06) saturate(1.05); }
.btn-small { padding: 0.55em 0.95em; font-size: 0.9rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.home .site-header {
  background: color-mix(in srgb, var(--space) 86%, transparent);
  border-bottom-color: transparent;
  --ink: var(--space-text);
  --link: var(--space-text);
  --chip: #2A1E3F;
  --edge: #6E5893;
  color: var(--space-text);
}
.bar {
  max-width: var(--wrap); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 1.4rem/1 var(--font-display);
  color: inherit; text-decoration: none; letter-spacing: -0.02em;
  margin-right: auto;
}
.brand img { display: block; }
.site-header nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-header nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  color: inherit; text-decoration: none; font-weight: 600; font-size: 0.97rem;
}
.site-header nav a:hover { background: var(--chip); }
.site-header nav a[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--edge); }
.site-header nav .gh svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer;
}
.theme-toggle:hover { background: var(--chip); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

@media (max-width: 640px) {
  .bar { gap: 6px; flex-wrap: wrap; }
  .site-header nav { order: 3; width: 100%; overflow-x: auto; }
  .site-header nav ul { gap: 0; }
  .site-header nav a { padding: 6px 10px; font-size: 0.93rem; }
  .site-header nav .gh span { display: none; }
}
@media (max-width: 420px) {
  /* Four sections and GitHub fit across a phone. */
  .site-header nav a { padding: 6px 7px; font-size: 0.88rem; }
}

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

.hero {
  position: relative;
  background:
    radial-gradient(60% 70% at 78% 45%, rgba(252, 97, 185, 0.22), transparent 70%),
    radial-gradient(40% 50% at 85% 60%, rgba(180, 146, 249, 0.2), transparent 70%),
    var(--space);
  color: var(--space-text);
  overflow: hidden;
  padding: clamp(40px, 7vw, 96px) 0 clamp(120px, 14vw, 170px);
  margin-top: -1px;
}
.stars {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.8;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 72%, #FFD3E8, transparent),
    radial-gradient(1.4px 1.4px at 44% 30%, #fff, transparent),
    radial-gradient(1px 1px at 57% 84%, #C8B0FF, transparent),
    radial-gradient(1.2px 1.2px at 66% 12%, #fff, transparent),
    radial-gradient(1px 1px at 91% 22%, #FFD3E8, transparent),
    radial-gradient(1.3px 1.3px at 95% 78%, #fff, transparent),
    radial-gradient(1px 1px at 7% 88%, #C8B0FF, transparent),
    radial-gradient(1px 1px at 36% 48%, #fff, transparent),
    radial-gradient(1.1px 1.1px at 74% 66%, #fff, transparent);
}
.hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center; gap: clamp(24px, 4vw, 64px);
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(5rem, 3rem + 10vw, 10rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
  margin: 0 0 0.12em -0.04em;
  background: var(--disc);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.lede {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.35rem, 1rem + 1.5vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.7em;
}
.hero-sub { color: var(--space-soft); font-size: 1.1rem; max-width: 52ch; }
.hero-sub code, .hero code { background: #2A1E3F; color: var(--space-text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 22px; }
.hero .btn-ghost { color: var(--space-text); border-color: #6E5893; }
.hero .btn-ghost:hover { background: #2A1E3F; }
.beta { display: flex; align-items: center; gap: 10px; color: var(--space-soft); font-size: 0.95rem; margin: 0; }
.beta-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--disc-pink); box-shadow: 0 0 0 4px rgba(252, 97, 185, 0.22);
}

.hero-art { display: grid; place-items: center; }
.beatrix {
  width: min(100%, 470px); height: auto;
  filter: drop-shadow(0 0 40px rgba(252, 97, 185, 0.35));
  animation: arrive 1.1s cubic-bezier(.2, .8, .2, 1) both;
}
.bx-eyes {
  transform-box: fill-box; transform-origin: center;
  animation: blink 6.5s 1.6s infinite;
}
@keyframes arrive {
  from { opacity: 0; transform: scale(0.86) rotate(-6deg); }
  to { opacity: 1; transform: none; }
}
@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.08); }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; }
  .beatrix { width: min(64vw, 300px); }
  .wordmark { font-size: clamp(4.2rem, 22vw, 6.5rem); }
}

/* --- Code blocks ------------------------------------------------------------------- */

.code {
  background: var(--space-2);
  color: var(--space-text);
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
:root[data-theme="dark"] .code { border-color: #4A3768; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code { border-color: #4A3768; } }

.code-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid #2F2445;
  background: #1A1229;
  min-height: 44px;
}
.code-file { font: 500 0.8rem/1 var(--font-mono); font-stretch: 87.5%; color: var(--space-soft); margin-right: auto; }
.tabs { display: flex; gap: 2px; margin-right: auto; margin-left: -8px; flex-wrap: wrap; }
.tabs button {
  font: 600 0.88rem/1 var(--font-body);
  color: var(--space-soft);
  background: transparent; border: 0; cursor: pointer;
  padding: 9px 12px; border-radius: 999px;
}
.tabs button:hover { color: var(--space-text); background: #2A1E3F; }
.tabs button[aria-selected="true"] { color: #241A36; background: var(--disc); }
.copy, .open-pg {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 0.82rem/1 var(--font-body);
  color: var(--space-soft); background: transparent;
  border: 1px solid #3C2B55; border-radius: 999px;
  padding: 7px 10px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.copy:hover, .open-pg:hover { color: var(--space-text); border-color: #6E5893; }
.copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.copy.done { color: var(--space-text); border-color: var(--disc-pink); }
@media (max-width: 520px) { .copy span { display: none; } }

.code pre, .pg pre {
  margin: 0; padding: 16px 18px 18px;
  overflow: auto;
  font-family: var(--font-mono); font-stretch: 87.5%;
  font-size: 0.84rem; line-height: 1.7;
  tab-size: 2;
}
.code pre code, .pg pre code { font-size: inherit; background: none; padding: 0; white-space: pre; }
.code-panel[hidden] { display: none; }
.code-panel { animation: fade-in 0.22s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.tk-c { color: var(--tk-c); font-style: italic; }
.tk-k { color: var(--tk-k); }
.tk-x { color: var(--tk-x); font-weight: 600; }
.tk-t { color: var(--tk-t); }
.tk-f { color: var(--tk-f); }
.tk-s { color: var(--tk-s); }
.tk-e { color: var(--tk-e); }
.tk-n { color: var(--tk-n); }
.tk-o { color: var(--tk-o); }
.tk-a { color: var(--tk-a); }
.tk-p { color: var(--tk-p); }

/* Inline highlighted code on light backgrounds uses darker tokens */
:not(pre) > code[class^="lang-"] { color: var(--ink); }

/* --- Event horizon (home) ---------------------------------------------------------- */

.horizon-section { margin-top: clamp(-130px, -11vw, -90px); position: relative; padding-bottom: clamp(48px, 7vw, 96px); }
.horizon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  align-items: stretch;
}
.horizon-pane { display: flex; min-width: 0; }
.horizon-pane .code { flex: 1; box-shadow: 0 30px 60px -30px rgba(21, 14, 34, 0.55); }
.horizon-core { display: grid; place-items: center; position: relative; }
.horizon-core::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: linear-gradient(90deg, var(--disc-pink), var(--disc-violet));
  opacity: 0.7;
}
.horizon-core img { position: relative; width: 60px; height: 60px; filter: drop-shadow(0 0 12px rgba(252, 97, 185, 0.5)); }
.horizon-caption {
  font-family: var(--font-body); font-weight: 500;
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.25rem); line-height: 1.55; letter-spacing: 0;
  color: var(--ink-soft); max-width: 70ch; margin: 28px auto 0; text-align: center;
}
@media (max-width: 960px) {
  .horizon { grid-template-columns: minmax(0, 1fr); }
  .horizon-core { height: 64px; }
  .horizon-core::before { left: 50%; right: auto; top: 0; bottom: 0; width: 2px; height: auto; background: linear-gradient(180deg, var(--disc-pink), var(--disc-violet)); }
  .horizon-core img { width: 48px; height: 48px; }
}

/* "Now self-hosted": a link down to the section that tells the story. */
.hosted-badge {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 8px 14px 8px 12px;
  border: 1.5px solid #6E5893; border-radius: 999px;
  color: var(--space-text); font-size: 0.95rem; text-decoration: none;
  background: rgba(180, 146, 249, 0.10);
}
.hosted-badge:hover { background: rgba(180, 146, 249, 0.20); color: var(--space-text); }
.hosted-badge strong { color: #FFE07A; font-weight: 700; }
.hosted-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #FFE07A; box-shadow: 0 0 0 4px rgba(255, 224, 122, 0.22);
}
.btn-quiet { border-color: var(--line); }

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

section.why, section.features, section.glance, section.hosted, section.ecosystem, section.try, section.cousins {
  padding: clamp(56px, 8vw, 104px) 0;
}
.why { border-top: 1px solid var(--line); }
.why-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.promises li { padding: 22px 0 22px 22px; border-left: 3px solid; border-image: var(--disc) 1; }
.promises li + li { margin-top: 6px; }
.promises h3 { margin-bottom: 0.35em; }
.promises p { margin: 0; color: var(--ink-soft); }
@media (max-width: 860px) { .why-grid { grid-template-columns: minmax(0, 1fr); } }

.section-title { margin-bottom: 0.4em; }
.section-lede { color: var(--ink-soft); font-size: 1.12rem; max-width: 64ch; margin-bottom: 2em; }

.features { background: var(--bg-alt); }
.features .section-title { margin-bottom: 1.4em; }
.feature {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(24px, 5vw, 64px); align-items: start;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}
.feature:first-of-type { border-top: 0; padding-top: 0; }
.feature-text { padding-top: 6px; max-width: 46ch; }
.feature-text p { color: var(--ink-soft); }
.feature-text h3 { font-size: 1.35rem; }
.feature-text h3 code { font-size: 0.9em; }
@media (max-width: 860px) { .feature { grid-template-columns: minmax(0, 1fr); } }
.feature-code, .feature-text { min-width: 0; }

.table-scroll { overflow-x: auto; border: 2px solid var(--edge); border-radius: var(--radius); }
.glance table { border-collapse: collapse; width: 100%; min-width: 720px; }
.glance th { text-align: left; font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.glance td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.glance tr:last-child td { border-bottom: 0; }
.glance td:nth-child(1), .glance td:nth-child(2) { background: var(--space-2); color: var(--space-text); width: 34%; }
.glance td:nth-child(2) { border-left: 1px solid #2F2445; }
.glance td pre { margin: 0; font-family: var(--font-mono); font-stretch: 87.5%; font-size: 0.82rem; line-height: 1.65; white-space: pre; }
.glance td:nth-child(3) { color: var(--ink-soft); font-size: 0.97rem; }
.glance th:nth-child(1), .glance th:nth-child(2) { background: #1A1229; color: var(--space-soft); border-bottom-color: #2F2445; }

.ecosystem { background: var(--bg-alt); }
.eco-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.eco-code { display: grid; gap: 18px; min-width: 0; }
.checks { list-style: none; padding: 0; margin: 1.4em 0 0; display: grid; gap: 10px; }
.checks li { padding-left: 30px; position: relative; }
.checks + p { margin-top: 1.4em; }
.checks li::before {
  content: ""; position: absolute; left: 2px; top: 0.42em;
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #000 0 42%, transparent 44%), var(--disc);
  box-shadow: 0 0 0 1.5px var(--outline);
}
@media (max-width: 960px) { .eco-grid { grid-template-columns: minmax(0, 1fr); } }

.try-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: clamp(28px, 4vw, 48px);
  border: 2px solid var(--edge); border-radius: 24px;
  background:
    radial-gradient(80% 140% at 100% 0%, rgba(252, 97, 185, 0.13), transparent 60%),
    radial-gradient(60% 120% at 0% 100%, rgba(180, 146, 249, 0.14), transparent 60%);
}
.try h2 { margin-bottom: 0.3em; }
.try p { margin: 0; color: var(--ink-soft); max-width: 56ch; }

.cousins { padding-top: 0; }
.cousins-inner { display: flex; gap: clamp(24px, 4vw, 48px); align-items: center; }
.cousins-inner img { flex: none; width: clamp(110px, 16vw, 160px); height: auto; }
@media (max-width: 600px) { .cousins-inner { flex-direction: column; align-items: flex-start; } }

/* --- Footer ----------------------------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--line); padding: 48px 0 32px; background: var(--bg); }
.footer-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-brand { display: flex; gap: 16px; align-items: flex-start; max-width: 46ch; }
.footer-brand p { color: var(--ink-soft); margin: 0; }
.footer-brand strong { color: var(--ink); }
.site-footer nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer nav a { color: var(--ink); text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }
.fine { color: var(--ink-soft); font-size: 0.88rem; margin-top: 32px; }

/* --- Page heads (tour, community) -------------------------------------------------------------- */

.page-head { padding: clamp(36px, 6vw, 72px) 0 clamp(20px, 3vw, 36px); }
.page-head h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); letter-spacing: -0.03em;
}

/* --- Tour --------------------------------------------------------------------------------------- */

.chapter-grid {
  list-style: none; padding: 0; margin: 0 0 80px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 20px;
}
.chapter-card { border: 2px solid var(--edge); border-radius: var(--radius); padding: 22px 24px; }
.chapter-card h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 12px; }
.chapter-num {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--disc); color: #241A36; font-size: 0.95rem;
  box-shadow: 0 0 0 2px var(--outline);
}
.chapter-card ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.chapter-card a { font-weight: 600; }
.chapter-teaches { display: block; color: var(--ink-soft); font-size: 0.9rem; }

.tour-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px); padding-top: 36px; padding-bottom: 72px;
}
.tour-nav { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; padding-right: 6px; }
.tour-nav summary { display: none; }
.tour-nav ol { list-style: none; padding: 0; margin: 0; }
.chapters > li { margin-bottom: 18px; }
.chapter-title { display: block; font-weight: 700; font-size: 0.92rem; margin-bottom: 6px; }
.chapters ol { border-left: 2px solid var(--line); }
.chapters ol a {
  display: block; padding: 4px 12px; margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem;
}
.chapters ol a:hover { color: var(--ink); }
.chapters ol a[aria-current="page"] { color: var(--ink); font-weight: 600; border-left-color: var(--disc-pink); }

.lesson { min-width: 0; max-width: 820px; }
.lesson-chapter { color: var(--ink-soft); font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.lesson-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.8rem); letter-spacing: -0.03em; margin-bottom: 14px; }
.teaches { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.teaches li { font-size: 0.88rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); }
.lesson-notes { margin-bottom: 28px; font-size: 1.08rem; }
.lesson-code pre { max-height: 70vh; }
.source-note { color: var(--ink-soft); font-size: 0.92rem; margin: 14px 0 40px; overflow-wrap: anywhere; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a {
  display: block; padding: 16px 20px; border: 2px solid var(--edge); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); font-weight: 700;
}
.pager a:hover { background: var(--bg-alt); }
.pager span { display: block; font-weight: 500; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 2px; }
.pager-next { text-align: right; grid-column: 2; }

@media (max-width: 900px) {
  .tour-layout { grid-template-columns: minmax(0, 1fr); padding-top: 20px; }
  .tour-nav { position: static; max-height: none; }
  .tour-nav summary {
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; cursor: pointer; padding: 12px 16px;
    border: 2px solid var(--edge); border-radius: 12px;
  }
  .tour-nav details[open] summary { margin-bottom: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}

/* --- Playground --------------------------------------------------------------------------------- */

.playground .site-footer { display: none; }
.pg { max-width: 1480px; margin: 0 auto; padding: 20px var(--gutter) 28px; }
.pg-bar { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pg-title h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -0.02em; margin: 0 0 2px; }
.pg-title p { margin: 0; color: var(--ink-soft); }
.pg-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pg-select select {
  font: 600 0.9rem var(--font-body); color: var(--ink); background: var(--bg);
  border: 2px solid var(--edge); border-radius: 999px; padding: 0.5em 2.2em 0.5em 1em;
  appearance: none; cursor: pointer; max-width: 70vw;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.pg-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; height: calc(100vh - 230px); min-height: 460px; }
.pg-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--space-2); color: var(--space-text);
  border: 2px solid var(--outline); border-radius: var(--radius); overflow: hidden;
}
.pg-pane-head {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 6px 8px 6px 14px; background: #1A1229; border-bottom: 1px solid #2F2445;
  font: 500 0.8rem/1 var(--font-mono); font-stretch: 87.5%; color: var(--space-soft);
}
.pg-pane-head > span:first-child { margin-right: auto; }
.pg-hint { font-family: var(--font-body); font-size: 0.8rem; }
.pg-status { font-family: var(--font-body); font-size: 0.82rem; }
.pg-status.err { color: #FFB8A8; }
.editor { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.editor-hl, .editor textarea {
  position: absolute; inset: 0; margin: 0;
  padding: 16px 18px 18px;
  font-family: var(--font-mono); font-stretch: 87.5%;
  font-size: 0.84rem; line-height: 1.7; tab-size: 2;
  white-space: pre; overflow: auto; border: 0;
  font-variant-ligatures: none;
}
.editor-hl { pointer-events: none; overflow: hidden; }
.editor textarea {
  resize: none; background: transparent; color: transparent;
  caret-color: var(--disc-pink); outline: none;
}
.editor textarea::selection { background: rgba(252, 97, 185, 0.32); color: transparent; }
.editor:focus-within { box-shadow: inset 0 0 0 2px rgba(252, 97, 185, 0.45); }
.pg-output { flex: 1; min-height: 0; }
.pg-output.err code { color: #FFD3E8; }
.pg-note { color: var(--ink-soft); font-size: 0.92rem; margin: 14px 0 0; max-width: 90ch; }
@media (max-width: 860px) {
  .pg-panes { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pg-pane { height: 56vh; min-height: 340px; }
}

/* --- Bea is written in Bea (home) -------------------------------------------------------------- */

.hosted { border-top: 1px solid var(--line); }
.hosted-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.hosted-grid h3 { margin-top: 1.4em; }
.hosted-code { display: grid; gap: 20px; }
.kicker {
  font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--link); margin: 0 0 0.9em;
}
@media (max-width: 960px) { .hosted-grid { grid-template-columns: minmax(0, 1fr); } }
.feature-code .code pre { max-height: 36em; }

/* --- Toolchain ------------------------------------------------------------------------------------ */

.toolchain { padding-bottom: 80px; }
.tool-section { padding: 36px 0 12px; border-top: 1px solid var(--line); }
.tool-section > h2 { margin-bottom: 0.6em; }
.tool-section > p { max-width: 70ch; color: var(--ink-soft); }
.tool-section .table-scroll { margin: 24px 0; }
.tool-section .code { margin: 24px 0; }
.install-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.install-grid .code { margin: 0 0 20px; }
.install-grid h3 { margin-top: 1.1em; }
.install-grid h3:first-child { margin-top: 0; }
@media (max-width: 900px) { .install-grid { grid-template-columns: minmax(0, 1fr); } }
table.spec { border-collapse: collapse; width: 100%; min-width: 560px; }
.spec th, .spec td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec thead th { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; background: var(--bg-alt); }
.spec tbody th { font-weight: 600; white-space: nowrap; width: 1%; }
.spec tbody td { color: var(--ink-soft); }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.steps { padding-left: 1.4em; max-width: 74ch; display: grid; gap: 12px; margin: 20px 0; }
.steps li { padding-left: 6px; color: var(--ink-soft); }
.steps strong { color: var(--ink); }

/* --- Community ----------------------------------------------------------------------------------- */

.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0; border-top: 1px solid var(--line); }
.way { padding: 28px 28px 32px 0; border-bottom: 1px solid var(--line); }
.way h2 { font-family: var(--font-body); font-weight: 700; font-size: 1.3rem; letter-spacing: 0; }
.way p { color: var(--ink-soft); }
@media (min-width: 700px) {
  .way:nth-child(odd) { padding-right: 40px; border-right: 1px solid var(--line); }
  .way:nth-child(even) { padding-left: 40px; }
  .ways { grid-template-columns: 1fr 1fr; }
}
.editors { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 64px); padding: 64px 0; align-items: start; }
@media (max-width: 900px) { .editors { grid-template-columns: minmax(0, 1fr); } }
.cousins-small { display: flex; align-items: center; gap: 20px; padding: 0 0 72px; color: var(--ink-soft); }
.cousins-small p { margin: 0; max-width: 60ch; }

/* --- 404 ------------------------------------------------------------------------------------------ */

.lost { text-align: center; padding: 80px var(--gutter) 100px; }
.lost h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); letter-spacing: -0.02em; margin-top: 24px; }
.lost p { color: var(--ink-soft); }
.lost .btn { margin: 6px; }

/* --- Motion preferences ----------------------------------------------------------------------- */

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

/* Diagnostics use box-drawing characters that Martian Mono doesn't have;
   a system monospace keeps the gutter lines aligned. */
.code code.lang-text, .code code.lang-output, .pg-output.err code {
  font-family: ui-monospace, "SF Mono", Menlo, "DejaVu Sans Mono", "Cascadia Mono", Consolas, monospace;
  font-stretch: normal;
}
.glance td:nth-child(1), .glance td:nth-child(2) { border-bottom-color: #2F2445; }
@media (max-width: 560px) {
  .code-head { flex-wrap: wrap; row-gap: 6px; }
  .tabs { flex-wrap: nowrap; }
}
.tour-nav summary::after { content: "Show"; font-weight: 500; font-size: 0.9rem; color: var(--ink-soft); }
.tour-nav details[open] summary::after { content: "Hide"; }
.tour-nav summary::-webkit-details-marker { display: none; }
