/* Azox design system.
   Dark, high-contrast, technical. Everything scales from a small set
   of tokens so the whole site can be retuned from one place. */

/* Sora, self-hosted: no third-party request, no layout shift.
   One variable file covers weights 300–800. */
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/sora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/sora-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Surfaces. Blue-tinted near-black rather than pure black, which
     is what gives a dark interface depth instead of a flat void. */
  --bg: #0b0d13;
  --surface: #11141c;
  --surface-2: #161a24;
  --surface-3: #1d222e;
  --border: #212633;
  --border-bright: #303748;

  /* Text */
  --text: #f2f4f8;
  --text-dim: #9ba3b4;
  /* Was #6b7385 — 4.08:1 on the page background, below the 4.5:1
     minimum for body-sized text. Measured, not guessed. */
  --text-faint: #8892a6;

  /* Accents. Kept as small marks — a dot, a hairline, a highlight —
     rather than large fields of colour.
     The lime is the primary: bright enough to carry the identity,
     used sparingly so it stays a signal rather than noise. */
  --accent: #d4f835;
  --accent-2: #7dd3a0;
  --accent-3: #818cf8;
  --accent-warm: #fb923c;
  --accent-dim: rgba(212, 248, 53, 0.11);
  /* Flat, not gradients: one accent that reads the same everywhere.
     A gradient makes the same element look like two different colours
     depending on where it sits on the page. */
  --gradient: var(--accent);
  --gradient-wide: var(--accent);

  /* Syntax highlighting */
  --code-tag: #7ee3ff;
  --code-attr: #a97cff;
  --code-string: #9ff5b0;
  --code-keyword: #ff8ab8;
  --code-comment: #59597a;
  --code-fn: #ffd479;

  --font-sans: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --measure: 68ch;
  --nav-height: 62px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.68;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* Ambient light, slowly drifting so the page never feels static. */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  background:
    none;
  pointer-events: none;
  z-index: 0;
  animation: drift 26s var(--ease) infinite alternate;
}

@keyframes drift {
  to {
    transform: translate3d(2%, -1.5%, 0) scale(1.06);
  }
}

/* ---------- Entrance animations ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Sections animate up on load, staggered down the page.
   `backwards` rather than `both`: the element holds the starting
   frame only until its delay elapses, then animates and stays put.
   Nothing can leave it stuck invisible — an earlier attempt using a
   scroll-driven timeline did exactly that wherever the timeline
   failed to attach, which is too high a price for an entrance. */
.reveal {
  animation: rise 0.7s var(--ease) backwards;
}

.reveal:nth-of-type(1) { animation-delay: 0.05s; }
.reveal:nth-of-type(2) { animation-delay: 0.1s; }
.reveal:nth-of-type(3) { animation-delay: 0.15s; }
.reveal:nth-of-type(4) { animation-delay: 0.2s; }
.reveal:nth-of-type(5) { animation-delay: 0.25s; }

/* Above-the-fold content animates immediately — waiting for an
   observer would show a blank hero. */
.rise-in {
  animation: rise 0.7s var(--ease) both;
}

.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }
.delay-5 { animation-delay: 0.3s; }

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4 {
  line-height: 1.14;
  letter-spacing: -0.028em;
  margin: 0 0 0.5em;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.2rem, 6.4vw, 3.9rem);
  letter-spacing: -0.042em;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 3.6vw, 2.15rem);
  margin-top: 2.4em;
  letter-spacing: -0.034em;
}

h3 {
  font-size: clamp(1.08rem, 2.4vw, 1.3rem);
  margin-top: 2em;
  letter-spacing: -0.022em;
}

p {
  margin: 0 0 1.15em;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.18s var(--ease);
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 5px;
}

strong {
  color: #fff;
  font-weight: 600;
}

ul,
ol {
  padding-left: 1.3em;
  margin: 0 0 1.15em;
}
li {
  margin-bottom: 0.45em;
}

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

/* ---------- Layout ---------- */

.shell {
  position: relative;
  z-index: 1;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2rem);
}

.narrow {
  max-width: var(--measure);
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(7, 7, 11, 0.78);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-right: auto;
}
.brand:hover {
  text-decoration: none;
}

.brand-mark {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-version {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.brand:hover .brand-version {
  border-color: var(--border-bright);
  color: var(--text-dim);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.45rem;
  font-size: 0.92rem;
  font-weight: 450;
}

.nav-links a {
  position: relative;
  color: var(--text-dim);
  padding-block: 0.3rem;
}
.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Underline that grows from the centre on hover. */
.nav-links a::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 1.5px;
  background: var(--gradient);
  transition: width 0.26s var(--ease), left 0.26s var(--ease);
}
.nav-links a:hover::after,
.nav-links a.is-active::after {
  width: 100%;
  left: 0;
}
.nav-links a.is-active {
  color: var(--text);
}

@media (max-width: 760px) {
  .nav {
    padding-block: 0.55rem;
  }
  .nav-inner {
    flex-wrap: wrap;
    gap: 0.45rem 1.1rem;
  }
  .brand {
    margin-right: 0;
    width: 100%;
  }
  .nav-links {
    width: 100%;
    gap: 1.1rem;
    font-size: 0.87rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar {
    display: none;
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.76rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 550;
  letter-spacing: -0.012em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
  transition-duration: 0.06s;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--gradient);
  color: #06060a;
  font-weight: 640;
  box-shadow: 0 0 0 rgba(212, 248, 53, 0);
}
.btn-primary:hover {
  box-shadow: 0 10px 30px -10px rgba(212, 248, 53, 0.42);
}

/* A highlight that crosses the button on hover. */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(-100%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover::after {
  transform: translateX(100%);
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-bright);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.87em;
}

:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.13em 0.42em;
  color: var(--accent);
  white-space: nowrap;
}

.code {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1.5rem;
  overflow: hidden;
  transition: border-color 0.25s var(--ease);
}
.code:hover {
  border-color: var(--border-bright);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.52rem 0.6rem 0.52rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
}

.code pre {
  margin: 0;
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.845rem;
  line-height: 1.72;
  tab-size: 2;
}

.copy-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.28rem 0.62rem;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
    background 0.18s var(--ease);
}
.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.copy-btn[data-copied='true'] {
  color: var(--code-string);
  border-color: var(--code-string);
}

/* Syntax tokens */
.t-tag { color: var(--code-tag); }
.t-attr { color: var(--code-attr); }
.t-str { color: var(--code-string); }
.t-kw { color: var(--code-keyword); }
.t-fn { color: var(--code-fn); }
.t-com { color: var(--code-comment); font-style: italic; }
.t-punc { color: var(--text-faint); }

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

.hero {
  position: relative;
  padding: clamp(3.5rem, 11vw, 7.5rem) 0 clamp(2.5rem, 7vw, 4rem);
}

/* A faint technical grid, fading out downward and drifting slowly.
   Reinforces the "built from parts you can see" feeling without
   adding an image. */
.hero::before {
  content: '';
  position: absolute;
  inset: -20% 0 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6) 22%, transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6) 22%, transparent 78%);
  opacity: 0.55;
  pointer-events: none;
  animation: gridDrift 22s linear infinite;
}

@keyframes gridDrift {
  to {
    background-position: 68px 68px;
  }
}

/* A scanning line that sweeps the hero once on load — a single pass,
   not a loop, so it reads as the page coming online rather than as
   decoration that never settles. */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(212, 248, 53, 0.05);
  pointer-events: none;
  transform: translateY(-100%);
  animation: scan 2.2s var(--ease) 0.35s both;
}

@keyframes scan {
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

.hero > .container {
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(77, 232, 240, 0.26);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  margin-bottom: 1.6rem;
}

/* A quietly pulsing dot, to signal the project is alive. */
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.hero h1 {
  max-width: 16ch;
  margin-bottom: 0.35em;
}

.hero-tagline {
  color: var(--accent);
  animation: shimmer 9s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: 220% center;
  }
}

.hero-lede {
  font-size: clamp(1.03rem, 2.1vw, 1.2rem);
  color: var(--text-dim);
  max-width: 54ch;
  margin-bottom: 2.1rem;
  font-weight: 350;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.install-line {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.62rem 0.7rem 0.62rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  max-width: 100%;
  overflow-x: auto;
  transition: border-color 0.25s var(--ease);
}
.install-line:hover {
  border-color: var(--border-bright);
}
.install-line span {
  white-space: nowrap;
}
.install-prompt {
  color: var(--accent);
}

/* ---------- Stats strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 3rem;
}

.stat {
  position: relative;
  background: var(--surface);
  padding: 1.25rem 1.4rem;
  overflow: hidden;
  transition: background 0.3s var(--ease);
}

.stat:hover {
  background: var(--surface-2);
}

/* A hairline that lights up under the tile on hover. */
.stat::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--gradient);
  transform: scaleX(0);
  transition: transform 0.45s var(--ease);
}

.stat:hover::after {
  transform: scaleX(1);
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 680;
  letter-spacing: -0.035em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin: 0.2rem 0 0;
}

/* ---------- Feature grid ---------- */

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  overflow: hidden;
  transition: transform 0.32s var(--ease), border-color 0.32s var(--ease),
    box-shadow 0.32s var(--ease);
}

/* A gradient hairline that sweeps in along the top edge on hover. */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.42s var(--ease);
  z-index: 1;
}

/* A soft light that follows the pointer across the card. The
   coordinates come from site.js; with no script it simply never
   appears, and the card still has its border and hover lift. */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    16rem 16rem at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--dot, var(--accent)) 12%, transparent),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.card:hover::after {
  opacity: 1;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-bright);
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
}
.card:hover::before {
  transform: scaleX(1);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.03rem;
  font-weight: 600;
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 350;
}

.card-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.8rem;
}

/* A small coloured dot as the marker, rather than colouring the whole
   label — enough to identify a card at a glance without the grid
   turning into a wall of colour. */
.card-icon::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
  flex-shrink: 0;
}

.card:nth-child(6n + 1) { --dot: #d4f835; }
.card:nth-child(6n + 2) { --dot: #7dd3a0; }
.card:nth-child(6n + 3) { --dot: #818cf8; }
.card:nth-child(6n + 4) { --dot: #fb923c; }
.card:nth-child(6n + 5) { --dot: #f0abfc; }
.card:nth-child(6n) { --dot: #38bdf8; }

/* A card that is a link to somewhere else. */
.card-link {
  display: block;
  color: inherit;
}
.card-link:hover {
  text-decoration: none;
}
.card-link .card-more {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.86rem;
  color: var(--accent);
  transition: transform 0.25s var(--ease);
}
.card-link:hover .card-more {
  transform: translateX(4px);
}

/* ---------- Section rhythm ---------- */

.section {
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

.section-title {
  margin-top: 0;
}

.section-lede {
  color: var(--text-dim);
  max-width: 58ch;
  margin-bottom: 2.2rem;
  font-weight: 350;
}

/* A small numbered marker above a section heading, so a long page
   reads as a sequence rather than as one flat column. */
.section-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.1rem;
}

.section-mark::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* An alternate band, to break up a long stack of identical sections. */
.section-alt {
  background:
    none;
  border-block: 1px solid var(--border);
}

/* ---------- Live demo ---------- */

.demo {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 900px) {
  .demo {
    grid-template-columns: 1.1fr 1fr;
  }
}

.demo-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  align-items: flex-start;
}

.demo-readout {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 600;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.demo-note {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin: 0;
}

/* ---------- Comparison ---------- */

.compare {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 860px) {
  .compare {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Docs layout ---------- */

.docs {
  display: grid;
  gap: 2.5rem;
  padding-block: 2.5rem 5rem;
  align-items: start;
}

@media (min-width: 940px) {
  .docs {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 3.5rem;
  }
}

.sidebar {
  font-size: 0.91rem;
}

@media (min-width: 940px) {
  .sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
    max-height: calc(100vh - var(--nav-height) - 3rem);
    overflow-y: auto;
  }
}

.sidebar-group {
  margin-bottom: 1.7rem;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.7rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.12rem;
}

.sidebar li {
  margin: 0;
}

.sidebar a {
  display: block;
  padding: 0.36rem 0.65rem;
  border-radius: 7px;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: color 0.18s var(--ease), background 0.18s var(--ease),
    border-color 0.18s var(--ease), padding-left 0.18s var(--ease);
}
.sidebar a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  padding-left: 0.85rem;
}
.sidebar a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface);
}

.doc-body {
  min-width: 0;
  max-width: var(--measure);
}

.doc-body > h2:first-of-type {
  margin-top: 1.5rem;
}

.lede {
  font-size: 1.07rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
  font-weight: 350;
}

/* ---------- Callouts ---------- */

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.95rem 1.15rem;
  margin: 0 0 1.5rem;
  font-size: 0.93rem;
}
.note p:last-child {
  margin-bottom: 0;
}

.note-warn {
  border-left-color: var(--code-fn);
  background: rgba(255, 212, 121, 0.08);
}

.note-good {
  border-left-color: var(--code-string);
  background: rgba(159, 245, 176, 0.07);
}

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

.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  counter-reset: step;
}

.step {
  position: relative;
  padding-left: 3rem;
  padding-bottom: 2rem;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* The connecting line between steps. */
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 1rem;
  top: 2.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: var(--border);
}

.step h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1.06rem;
}

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

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.89rem;
  min-width: 30rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-weight: 550;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

tbody tr {
  transition: background 0.16s var(--ease);
}
tbody tr:hover {
  background: var(--surface);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td code {
  white-space: nowrap;
}

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

.footer {
  border-top: 1px solid var(--border);
  padding-block: 2.75rem;
  color: var(--text-faint);
  font-size: 0.87rem;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: center;
}

.footer a {
  color: var(--text-dim);
}
.footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}

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

.pg {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  padding-bottom: 3rem;
}

@media (min-width: 900px) {
  .pg {
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - var(--nav-height) - 10rem);
    min-height: 30rem;
  }
}

.pg-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem 0.5rem 0.95rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
  flex-shrink: 0;
}

.pg-editor {
  flex: 1;
  min-height: 18rem;
  width: 100%;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.68;
  padding: 1rem 1.1rem;
  tab-size: 2;
  overflow: auto;
}
.pg-editor:focus {
  outline: none;
}

.pg-preview {
  flex: 1;
  min-height: 18rem;
  border: 0;
  width: 100%;
  background: #fff;
}

.pg-error {
  padding: 0.85rem 1.1rem;
  background: rgba(255, 138, 184, 0.1);
  border-top: 1px solid rgba(255, 138, 184, 0.3);
  color: #ffb3ce;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  white-space: pre-wrap;
  flex-shrink: 0;
  animation: rise 0.3s var(--ease) both;
}

.pg-tabs {
  display: flex;
  gap: 0.28rem;
}

.pg-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.24rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.16s var(--ease), background 0.16s var(--ease),
    border-color 0.16s var(--ease);
}
.pg-tab:hover {
  color: var(--text-dim);
}
.pg-tab[data-active='true'] {
  color: var(--accent);
  border-color: var(--border-bright);
  background: var(--surface);
}

/* ---------- Templates ---------- */

.template-preview {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.template-card {
  padding: 0;
  overflow: hidden;
}

.template-body {
  padding: 1.25rem 1.4rem 1.4rem;
}

/* A tiny abstracted wireframe, drawn in CSS rather than shipped as
   an image, so it stays crisp and weighs nothing. */
.wire {
  width: 78%;
  display: grid;
  gap: 0.4rem;
}
.wire i {
  display: block;
  height: 0.5rem;
  border-radius: 3px;
  background: var(--border-bright);
}
.wire i.tall { height: 2.2rem; }
.wire i.accent { background: var(--accent); }
.wire i.half { width: 52%; }
.wire i.third { width: 34%; }
.wire-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

/* ---------- Utilities ---------- */

.stack-sm > * + * {
  margin-top: 0.6rem;
}

.muted {
  color: var(--text-dim);
}

.mono {
  font-family: var(--font-mono);
}

.center {
  text-align: center;
}

.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  color: var(--text-faint);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
  }
}

/* A template card offers two things: run it, or read it. The first is
   the point of the page — before this, every card only scrolled to a
   wall of source with no way to try it. */
.card-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.card-run {
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card-run:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(212, 248, 53, 0.5);
}
.card-actions .card-more {
  margin-top: 0;
  font-size: 0.82rem;
}

/* ==========================================================
   Mobile navigation
   ==========================================================
   The links used to sit in a row that scrolled sideways off the
   screen, with nothing to open them — you had to swipe the bar to
   discover the rest. Below 860px they now live in a panel. */

.nav-toggle {
  display: none;
  position: relative;
  /* Above the panel, which is fixed and would otherwise cover the
     button that closes it. */
  z-index: 2;
  width: 2.6rem;
  height: 2.6rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-toggle:hover {
  border-color: var(--accent);
}

.nav-toggle-bar {
  position: absolute;
  left: 50%;
  width: 1.05rem;
  height: 1.5px;
  margin-left: -0.525rem;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.34s var(--ease), opacity 0.22s var(--ease);
}
.nav-toggle-bar:nth-child(1) { top: 0.92rem; }
.nav-toggle-bar:nth-child(2) { top: 1.24rem; }
.nav-toggle-bar:nth-child(3) { top: 1.56rem; }

/* The three bars fold into a cross. */
[data-open='true'] .nav-toggle-bar:nth-child(1) {
  transform: translateY(0.32rem) rotate(45deg);
}
[data-open='true'] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
[data-open='true'] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-0.32rem) rotate(-45deg);
}

@media (max-width: 859px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    inset: var(--nav-height) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.6rem 1.25rem 1.4rem;
    /* Fully opaque: at 0.97 the article behind it still showed
       through the panel, which read as a rendering fault rather than
       a menu. The backdrop is what darkens the rest of the page. */
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 28px 60px -30px rgba(0, 0, 0, 0.9);

    /* Collapsed by default, and not reachable by keyboard while it is. */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.38s var(--ease), opacity 0.26s var(--ease),
      visibility 0s linear 0.38s;
  }

  [data-open='true'] .nav-links {
    max-height: calc(100vh - var(--nav-height));
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
    transition: max-height 0.42s var(--ease), opacity 0.3s var(--ease),
      visibility 0s;
  }

  .nav-links a {
    padding: 0.95rem 0.2rem;
    font-size: 1.02rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a:last-child {
    border-bottom: 0;
  }
  /* The desktop underline indicator has no place in a stacked list. */
  .nav-links a::after {
    display: none;
  }
  .nav-links a.is-active {
    color: var(--accent);
  }

  /* Each row arrives just after the one above it. */
  [data-open='true'] .nav-links a {
    animation: nav-row 0.4s var(--ease) both;
  }
  [data-open='true'] .nav-links a:nth-child(1) { animation-delay: 0.02s; }
  [data-open='true'] .nav-links a:nth-child(2) { animation-delay: 0.06s; }
  [data-open='true'] .nav-links a:nth-child(3) { animation-delay: 0.1s; }
  [data-open='true'] .nav-links a:nth-child(4) { animation-delay: 0.14s; }
  [data-open='true'] .nav-links a:nth-child(5) { animation-delay: 0.18s; }
  [data-open='true'] .nav-links a:nth-child(6) { animation-delay: 0.22s; }
}

@keyframes nav-row {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: none; }
}

/* Everything below the panel dims while it is open, so the menu reads
   as a layer above the page rather than as part of it. */
@media (max-width: 859px) {
  .nav::after {
    content: '';
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    z-index: -1;
    background: rgba(4, 5, 8, 0.72);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s var(--ease), visibility 0s linear 0.32s;
  }

  .nav[data-open='true']::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.32s var(--ease), visibility 0s;
  }
}

/* ==========================================================
   Docs sidebar on small screens
   ==========================================================
   Eleven links stacked above the article meant scrolling past the
   whole index before reaching the page you asked for. */

.sidebar-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}
.sidebar-toggle:hover {
  border-color: var(--accent);
}

.sidebar-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.3s var(--ease);
}
[data-open='true'] > .sidebar-toggle .sidebar-chevron {
  transform: rotate(-135deg) translate(-2px, -2px);
}

@media (max-width: 939px) {
  .sidebar-toggle {
    display: flex;
  }

  .sidebar-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s var(--ease), opacity 0.26s var(--ease),
      visibility 0s linear 0.4s;
  }

  .sidebar[data-open='true'] .sidebar-panel {
    max-height: 80vh;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    margin-top: 1rem;
    transition: max-height 0.44s var(--ease), opacity 0.3s var(--ease),
      visibility 0s;
  }
}

/* ==========================================================
   Reveal on scroll
   ==========================================================
   Set by site.js. The default is visible, so a page without
   JavaScript — which is most of this site — reads the same. */

.reveal[data-revealed='false'] {
  opacity: 0;
  transform: translateY(1.4rem);
}
.reveal[data-revealed='true'] {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .reveal[data-revealed='false'] {
    opacity: 1;
    transform: none;
  }
  .nav-links,
  .sidebar-panel,
  .nav-toggle-bar,
  .sidebar-chevron {
    transition-duration: 0.01ms !important;
  }
  [data-open='true'] .nav-links a {
    animation: none;
  }
}

/* ==========================================================
   Depth
   ==========================================================
   Flat surfaces on a flat ground read as a template. What follows adds
   depth without going back to gradient text: a slow aurora behind the
   page, glass on raised surfaces, and light that responds to the
   pointer. All of it is decoration — remove this block and the site
   still works, only plainer. */

/* A wash that drifts behind everything, fixed so it does not scroll
   with the content. Very low opacity: it should be felt, not seen. */
body::before {
  content: '';
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 78vh;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(40rem 30rem at 18% 0%, rgba(212, 248, 53, 0.1), transparent 62%),
    radial-gradient(36rem 28rem at 82% 8%, rgba(129, 140, 248, 0.11), transparent 64%),
    radial-gradient(30rem 26rem at 52% 32%, rgba(125, 211, 160, 0.07), transparent 66%);
  filter: blur(28px);
  animation: aurora 26s var(--ease) infinite alternate;
}

@keyframes aurora {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(2%, 2%, 0) scale(1.07); }
  100% { transform: translate3d(-1%, 1%, 0) scale(1.02); }
}

/* A fine grain over the whole page. It stops large dark areas from
   looking like flat fill, which is most of what makes a dark theme
   feel cheap. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Raised surfaces get a hairline of light along the top edge — the
   cue that says "this sits above the page" rather than "this is a
   rectangle of a different colour". */
.card,
.stat-row,
.code,
.pg-pane {
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 34px -18px rgba(0, 0, 0, 0.75);
}

.card {
  transition:
    transform 0.36s var(--ease),
    border-color 0.36s var(--ease),
    box-shadow 0.36s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 26px 50px -22px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(212, 248, 53, 0.08);
}

/* The primary button carries a real glow, since it is the one thing
   on the page that should pull the eye. */
.btn-primary {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 10px 30px -10px rgba(212, 248, 53, 0.45);
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 16px 40px -12px rgba(212, 248, 53, 0.62);
}
.btn-primary:active {
  transform: translateY(0);
}

/* The nav gains a hairline that brightens as the page scrolls under
   it, so the bar separates from the content instead of floating. */
.nav {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* The hero's headline arrives rather than appearing. */
.hero-tagline,
.hero h1 {
  animation: rise 0.85s var(--ease) both;
}
.hero-tagline { animation-delay: 0.08s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(1.2rem); }
  to { opacity: 1; transform: none; }
}

/* A statistic counts up into place. */
.stat-value {
  animation: rise 0.7s var(--ease) both;
}
.stat:nth-child(1) .stat-value { animation-delay: 0.18s; }
.stat:nth-child(2) .stat-value { animation-delay: 0.26s; }
.stat:nth-child(3) .stat-value { animation-delay: 0.34s; }
.stat:nth-child(4) .stat-value { animation-delay: 0.42s; }

/* A link underline that grows from the left rather than blinking on. */
.doc-body a:not(.card-run):not(.card-more) {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s var(--ease);
}
.doc-body a:not(.card-run):not(.card-more):hover {
  background-size: 100% 1px;
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .hero-tagline,
  .hero h1,
  .stat-value {
    animation: none;
  }
  .card:hover,
  .btn-primary:hover {
    transform: none;
  }
}

/* ==========================================================
   Touch targets and legibility on small screens
   ==========================================================
   Measured at 390px: the Copy buttons were 49×24, the playground tabs
   24 tall, the docs links 36, and several labels sat at 11px. A finger
   needs about 44px, and small type on a phone is read at arm's length
   in worse light than a desktop. */

@media (max-width: 859px) {
  /* A button keeps its visual size; the padding grows the hit area. */
  .copy-btn,
  .pg-tab {
    min-height: 44px;
    padding-inline: 0.85rem;
    display: inline-flex;
    align-items: center;
  }

  .pg-tabs,
  .pg-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Each docs link becomes a row you can hit without aiming. */
  .sidebar a {
    display: block;
    min-height: 44px;
    padding-block: 0.7rem;
  }

  .card-more,
  .card-run {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* The wordmark is the link home, so it gets a real target too. */
  .brand {
    min-height: 44px;
    align-items: center;
  }

  /* Small labels stay small, but not 11px. */
  .eyebrow,
  .section-mark,
  .sidebar-title,
  .stat-label,
  .code-label,
  .pg-label,
  /* The label on a code block is a bare span, so it needs naming by
     its parent rather than by a class of its own. */
  .code-head span,
  .pg-head span {
    font-size: 0.8rem;
  }

  /* Body copy a notch larger: the default reads fine on a desktop at
     60cm and poorly on a phone at 35cm. */
  .doc-body p,
  .doc-body li {
    font-size: 1.02rem;
    line-height: 1.72;
  }

  /* Code blocks scroll rather than shrinking the page. */
  .code pre,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Focus is visible everywhere, not only where a browser guesses. A
   keyboard user needs to see where they are, and the site had nothing
   consistent. */
a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* The playground header holds two groups: which file you are looking
   at, and what to do with it. Side by side they fit a desktop; on a
   phone they wrapped into one jumble where "Card.azox" sat between
   Copy and Download. They stack instead. */
.pg-actions {
  display: flex;
  gap: 0.3rem;
}

@media (max-width: 859px) {
  .pg-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
  }

  .pg-tabs,
  .pg-actions {
    justify-content: flex-start;
    gap: 0.35rem;
  }

  /* Each group scrolls on its own if it has to, rather than wrapping
     into rows that read as unrelated. */
  .pg-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pg-tabs::-webkit-scrollbar {
    display: none;
  }

  .pg-tab,
  .pg-actions .copy-btn {
    flex: 0 0 auto;
  }

  /* The editor is the point of the page, so give it room. */
  .pg-editor {
    min-height: 22rem;
  }
}

/* ==========================================================
   Search
   ========================================================== */

.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
  color: var(--text-faint);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-search:hover {
  border-color: var(--border-bright);
  color: var(--text-dim);
}

.nav-search-key {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
}

/* The overlay */

.search {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 4rem 1.25rem 1.25rem;
  background: rgba(4, 5, 8, 0.76);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0s linear 0.22s;
}
.search[data-open='true'] {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s var(--ease), visibility 0s;
}

.search-panel {
  width: min(40rem, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-bright);
  border-radius: 0.9rem;
  background: var(--surface);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transform: translateY(-0.6rem) scale(0.99);
  transition: transform 0.24s var(--ease);
}
.search[data-open='true'] .search-panel {
  transform: none;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.search-field input:focus {
  outline: none;
}
/* The browser's own clear button sits oddly in a dark field. */
.search-field input::-webkit-search-cancel-button {
  display: none;
}
.search-field kbd {
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.search-status {
  margin: 0;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.search-results {
  margin: 0;
  padding: 0 0.5rem 0.5rem;
  list-style: none;
  overflow-y: auto;
}

.search-results a {
  display: block;
  padding: 0.7rem 0.75rem;
  border-radius: 0.6rem;
  color: inherit;
  text-decoration: none;
  transition: background 0.14s var(--ease);
}
.search-results a:hover,
.search-results a[data-active='true'] {
  background: var(--surface-2);
}

.search-result-title {
  display: block;
  font-weight: 550;
  font-size: 0.95rem;
  color: var(--text);
}
.search-result-page {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}
.search-result-text {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.search-results mark {
  padding: 0 0.1em;
  border-radius: 3px;
  background: rgba(212, 248, 53, 0.18);
  color: var(--accent);
}

/* A heading you can link to shows its anchor on hover. */
.doc-body h2[id],
.doc-body h3[id] {
  scroll-margin-top: calc(var(--nav-height) + 1.5rem);
}

@media (max-width: 859px) {
  /* The label and shortcut go; the icon stays, beside the menu.
     Only this one pushes right — the toggle claiming auto as well
     split the free space and left the icon floating mid-bar. */
  .nav-search {
    margin-left: auto;
    margin-right: 0.45rem;
    min-height: 44px;
    padding-inline: 0.75rem;
  }

  .nav-toggle {
    margin-left: 0;
  }
  .nav-search-label,
  .nav-search-key {
    display: none;
  }

  .search {
    padding: 0.75rem;
  }
  .search-panel {
    max-height: calc(100vh - 1.5rem);
  }
  .search-field input {
    /* Under 16px, iOS zooms the page when the field is focused. */
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .search,
  .search-panel {
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   Header, tightened
   ==========================================================
   At 406px the bar was 114px tall: the brand stretched the full width
   and pushed the search and menu buttons onto a second row. */

@media (max-width: 859px) {
  .nav-inner {
    /* One row, whatever the width. The container's own vertical
       padding was stacking on top of the bar's min-height, making the
       header 81px where the variable says 62. */
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding-block: 0;
  }

  /* The brand takes the space it needs and no more, so the buttons
     stay beside it rather than below. */
  .brand {
    flex: 0 1 auto;
    min-width: 0;
    margin-right: 0;
  }

  .brand-mark {
    font-size: 1.05rem;
  }

  /* The version pill is the first thing to go when space is tight —
     it repeats what the docs already say. */
  @media (max-width: 400px) {
    .brand-version {
      display: none;
    }
  }

  .nav-search,
  .nav-toggle {
    flex: 0 0 auto;
  }

  .nav-search {
    /* A square, matching the menu button beside it. */
    width: 44px;
    padding: 0;
    justify-content: center;
  }
}


/* A button whose only behaviour comes from JavaScript is hidden until
   that script has run — a visible control that does nothing when
   pressed is worse than no control at all. site.js removes this. */
.nav-search,
.nav-toggle,
.sidebar-toggle {
  display: none;
}
.js .nav-search,
.js .sidebar-toggle {
  display: flex;
}

/* The menu button is the only way to another page on a phone, so its
   reveal is not optional — leaving it out of the rule above hid it
   everywhere and stranded anyone on a small screen.
   Scoped to the breakpoint: on a desktop the links are already shown,
   and a second control for them would be noise. */
@media (max-width: 859px) {
  .js .nav-toggle {
    display: block;
  }
}

/* Without the script the docs index is simply open, rather than
   collapsed behind a button that cannot be pressed. */
html:not(.js) .sidebar-panel {
  max-height: none;
  opacity: 1;
  visibility: visible;
}
