/*
 * site.css
 * Public help centre design system for gab-help.
 * Copyright 2026 Gab AI, Inc. License: AGPLv3+
 *
 * Hand authored. No preprocessor, no framework. Layer order is declared up
 * front so component rules never depend on source position to win.
 */

@layer reset, tokens, base, layout, components, utilities;

/* ==========================================================================
   RESET
   ========================================================================== */

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

  * {
    margin: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    tab-size: 2;
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  ul[class],
  ol[class] {
    list-style: none;
    padding: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  dialog {
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    max-width: none;
    max-height: none;
  }

  summary {
    cursor: pointer;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  :target {
    scroll-margin-top: calc(var(--header-h) + 1.5rem);
  }
}

/* ==========================================================================
   TOKENS
   ========================================================================== */

@layer tokens {
  :root {
    color-scheme: light dark;

    /* Brand ---------------------------------------------------------- */
    --accent: light-dark(oklch(56% 0.146 158), oklch(78% 0.164 158));
    --accent-hover: light-dark(oklch(49% 0.134 158), oklch(85% 0.15 158));
    --accent-solid: light-dark(oklch(62% 0.163 158), oklch(66% 0.166 158));
    --accent-solid-hover: light-dark(oklch(57% 0.157 158), oklch(72% 0.164 158));
    --accent-on-solid: light-dark(oklch(100% 0 0), oklch(17% 0.03 158));
    --accent-tint: light-dark(oklch(96.5% 0.028 158), oklch(26% 0.045 158));
    --accent-tint-strong: light-dark(oklch(93% 0.05 158), oklch(31% 0.055 158));
    --accent-ring: light-dark(oklch(62% 0.163 158 / 0.4), oklch(78% 0.164 158 / 0.45));

    /* Neutrals ------------------------------------------------------- */
    --canvas: light-dark(oklch(99.3% 0.002 250), oklch(15.2% 0.011 262));
    --canvas-sunken: light-dark(oklch(97.4% 0.003 250), oklch(12.8% 0.011 262));
    --surface: light-dark(oklch(100% 0 0), oklch(18.4% 0.013 262));
    --surface-raised: light-dark(oklch(100% 0 0), oklch(21.4% 0.014 262));
    --surface-hover: light-dark(oklch(98.2% 0.003 250), oklch(23.5% 0.015 262));

    --border: light-dark(oklch(91.5% 0.004 250), oklch(27.5% 0.012 262));
    --border-strong: light-dark(oklch(85% 0.006 250), oklch(35% 0.014 262));

    --ink: light-dark(oklch(23% 0.012 262), oklch(96% 0.004 250));
    --ink-secondary: light-dark(oklch(44% 0.011 262), oklch(78% 0.008 250));
    --ink-muted: light-dark(oklch(56% 0.01 262), oklch(64% 0.009 250));

    /* Elevation ------------------------------------------------------ */
    --shadow-xs: 0 1px 2px light-dark(oklch(20% 0.02 262 / 0.05), oklch(0% 0 0 / 0.3));
    --shadow-sm:
      0 1px 2px light-dark(oklch(20% 0.02 262 / 0.05), oklch(0% 0 0 / 0.28)),
      0 2px 8px light-dark(oklch(20% 0.02 262 / 0.04), oklch(0% 0 0 / 0.22));
    --shadow-md:
      0 2px 4px light-dark(oklch(20% 0.02 262 / 0.05), oklch(0% 0 0 / 0.3)),
      0 8px 24px light-dark(oklch(20% 0.02 262 / 0.07), oklch(0% 0 0 / 0.32));
    --shadow-lg:
      0 4px 8px light-dark(oklch(20% 0.02 262 / 0.05), oklch(0% 0 0 / 0.32)),
      0 24px 56px light-dark(oklch(20% 0.02 262 / 0.11), oklch(0% 0 0 / 0.45));

    /* Radii ---------------------------------------------------------- */
    --r-xs: 6px;
    --r-sm: 9px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-full: 999px;

    /* Type ----------------------------------------------------------- */
    --font-sans:
      ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Inter",
      "Helvetica Neue", Arial, "Noto Sans", sans-serif,
      "Apple Color Emoji", "Segoe UI Emoji";
    --font-mono:
      ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
      Consolas, "Liberation Mono", monospace;

    --fs-xs: 0.8125rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-md: 1.0625rem;
    --fs-lg: clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);
    --fs-xl: clamp(1.3rem, 1.16rem + 0.7vw, 1.6rem);
    --fs-2xl: clamp(1.65rem, 1.35rem + 1.5vw, 2.35rem);
    --fs-3xl: clamp(2.1rem, 1.6rem + 2.5vw, 3.25rem);

    /* Rhythm --------------------------------------------------------- */
    --header-h: 60px;
    --shell-max: 1200px;
    --shell-pad: clamp(1.125rem, 0.7rem + 2vw, 2.5rem);
    --section-gap: clamp(3rem, 2rem + 5vw, 6rem);

    /* Motion --------------------------------------------------------- */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 380ms;
  }

  :root[data-theme="light"] {
    color-scheme: light;
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
  }
}

/* ==========================================================================
   BASE
   ========================================================================== */

@layer base {
  html {
    scroll-behavior: smooth;
  }

  body {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background-color: var(--canvas);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    line-height: 1.6;
    font-optical-sizing: auto;
    font-synthesis-weight: none;
    letter-spacing: -0.003em;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-weight: 640;
    line-height: 1.18;
    letter-spacing: -0.022em;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--fs-3xl);
    letter-spacing: -0.032em;
  }

  h2 {
    font-size: var(--fs-2xl);
    letter-spacing: -0.026em;
  }

  h3 {
    font-size: var(--fs-xl);
  }

  p {
    text-wrap: pretty;
  }

  strong,
  b {
    font-weight: 640;
  }

  code,
  kbd,
  pre,
  samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
  }

  hr {
    height: 1px;
    border: 0;
    background-color: var(--border);
  }

  ::selection {
    background-color: var(--accent-tint-strong);
    color: var(--ink);
  }

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

  /* Scoped so we never fight the browser default inside the CMS prose. */
  a:not([class]) {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: from-font;
    text-underline-offset: 0.18em;
  }

  a:not([class]):hover {
    color: var(--accent-hover);
  }
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

@layer layout {
  .shell {
    width: 100%;
    max-width: var(--shell-max);
    margin-inline: auto;
    padding-inline: var(--shell-pad);
  }

  .shell--narrow {
    max-width: 860px;
  }

  .shell--wide {
    max-width: 1360px;
  }

  .main {
    flex: 1 0 auto;
    display: block;
  }

  .section {
    padding-block: var(--section-gap);
  }

  .section--tight {
    padding-block: clamp(2rem, 1.4rem + 3vw, 3.5rem);
  }

  .section--sunken {
    background-color: var(--canvas-sunken);
    border-block: 1px solid var(--border);
  }

  .section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
  }

  .section__title {
    font-size: var(--fs-2xl);
  }

  .section__lede {
    margin-top: 0.6rem;
    max-width: 58ch;
    color: var(--ink-secondary);
    font-size: var(--fs-md);
  }

  .skip-link {
    position: absolute;
    inset-inline-start: 0.75rem;
    inset-block-start: -100%;
    z-index: 200;
    padding: 0.65rem 1rem;
    border-radius: var(--r-sm);
    background-color: var(--surface-raised);
    box-shadow: var(--shadow-md);
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: inset-block-start var(--dur) var(--ease);
  }

  .skip-link:focus-visible {
    inset-block-start: 0.75rem;
  }

  /* Responsive auto-fit grid used by every card collection. */
  .grid {
    display: grid;
    gap: clamp(1rem, 0.7rem + 1vw, 1.5rem);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  }

  .grid--tight {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  }

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

  .stack {
    display: grid;
    gap: 1rem;
  }
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

@layer components {
  /* --- Icons -------------------------------------------------------- */

  .icon {
    flex: none;
    width: 1.25em;
    height: 1.25em;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .icon--sm {
    width: 1em;
    height: 1em;
  }

  .icon--lg {
    width: 1.5em;
    height: 1.5em;
  }

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

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--r-full);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.006em;
    white-space: nowrap;
    cursor: pointer;
    transition:
      background-color var(--dur) var(--ease),
      border-color var(--dur) var(--ease),
      color var(--dur) var(--ease),
      transform var(--dur-fast) var(--ease),
      box-shadow var(--dur) var(--ease);
  }

  .btn:active {
    transform: translateY(1px);
  }

  .btn--primary {
    background-color: var(--accent-solid);
    color: var(--accent-on-solid);
    box-shadow: var(--shadow-sm);
  }

  .btn--primary:hover {
    background-color: var(--accent-solid-hover);
    box-shadow: var(--shadow-md);
  }

  .btn--secondary {
    background-color: var(--surface);
    border-color: var(--border-strong);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
  }

  .btn--secondary:hover {
    background-color: var(--surface-hover);
    border-color: var(--ink-muted);
  }

  .btn--ghost {
    color: var(--ink-secondary);
  }

  .btn--ghost:hover {
    background-color: var(--surface-hover);
    color: var(--ink);
  }

  .btn--lg {
    padding: 0.85rem 1.6rem;
    font-size: var(--fs-base);
  }

  .btn--block {
    width: 100%;
  }

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

  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: light-dark(oklch(100% 0 0 / 0.78), oklch(15.2% 0.011 262 / 0.78));
    border-bottom: 1px solid transparent;
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease);
  }

  @supports (backdrop-filter: blur(1px)) {
    .site-header {
      backdrop-filter: saturate(180%) blur(16px);
    }
  }

  .site-header[data-stuck="true"] {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-xs);
  }

  .site-header__inner {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 0.2rem + 1.4vw, 1.75rem);
    height: var(--header-h);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex: none;
    font-weight: 660;
    font-size: var(--fs-base);
    letter-spacing: -0.024em;
    color: var(--ink);
    border-radius: var(--r-sm);
  }

  .brand__mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background-color: var(--accent-solid);
    color: var(--accent-on-solid);
    box-shadow: var(--shadow-xs);
  }

  .brand__mark svg {
    height: 18px;
    width: auto;
    fill: currentColor;
  }

  .brand__text {
    display: none;
  }

  .brand__sub {
    color: var(--ink-muted);
    font-weight: 500;
  }

  @media (min-width: 26rem) {
    .brand__text {
      display: inline;
    }
  }

  .site-nav {
    display: none;
    align-items: center;
    gap: 0.15rem;
    margin-inline-end: auto;
  }

  .site-nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 550;
    color: var(--ink-secondary);
    transition:
      color var(--dur) var(--ease),
      background-color var(--dur) var(--ease);
  }

  .site-nav__link:hover {
    color: var(--ink);
    background-color: var(--surface-hover);
  }

  .site-nav__link[aria-current="page"] {
    color: var(--ink);
    font-weight: 620;
  }

  .site-nav__link[aria-current="page"]::after {
    content: "";
    position: absolute;
    inset-inline: 0.75rem;
    bottom: -0.3rem;
    height: 2px;
    border-radius: var(--r-full);
    background-color: var(--accent-solid);
  }

  @media (min-width: 52rem) {
    .site-nav {
      display: flex;
    }
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-inline-start: auto;
  }

  @media (min-width: 52rem) {
    .header-actions {
      margin-inline-start: 0;
    }
  }

  .icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    color: var(--ink-secondary);
    transition:
      background-color var(--dur) var(--ease),
      color var(--dur) var(--ease);
  }

  .icon-btn:hover {
    background-color: var(--surface-hover);
    color: var(--ink);
  }

  .nav-toggle {
    display: inline-grid;
  }

  @media (min-width: 52rem) {
    .nav-toggle {
      display: none;
    }
  }

  /* Theme toggle shows exactly one glyph, chosen by the resolved theme. */
  .theme-toggle__moon {
    display: none;
  }

  :root[data-theme-resolved="dark"] .theme-toggle__sun {
    display: none;
  }

  :root[data-theme-resolved="dark"] .theme-toggle__moon {
    display: block;
  }

  /* --- Header search trigger ---------------------------------------- */

  .search-trigger {
    display: none;
    align-items: center;
    gap: 0.55rem;
    width: min(20rem, 28vw);
    padding: 0.42rem 0.45rem 0.42rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background-color: var(--surface);
    color: var(--ink-muted);
    font-size: var(--fs-sm);
    text-align: start;
    transition:
      border-color var(--dur) var(--ease),
      background-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease);
  }

  .search-trigger:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
  }

  .search-trigger__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  @media (min-width: 60rem) {
    .search-trigger {
      display: flex;
    }
  }

  .kbd {
    display: inline-flex;
    align-items: center;
    gap: 0.1em;
    padding: 0.15em 0.45em;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--r-xs);
    background-color: var(--canvas-sunken);
    color: var(--ink-muted);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
  }

  /* --- Mobile drawer ------------------------------------------------ */

  .mobile-nav {
    position: fixed;
    inset: var(--header-h) 0 0;
    z-index: 90;
    display: grid;
    align-content: start;
    gap: 0.25rem;
    padding: 1.25rem var(--shell-pad) 2.5rem;
    background-color: var(--canvas);
    overflow-y: auto;
    opacity: 0;
    translate: 0 -0.75rem;
    visibility: hidden;
    transition:
      opacity var(--dur) var(--ease),
      translate var(--dur) var(--ease),
      visibility var(--dur) var(--ease);
  }

  .mobile-nav[data-open="true"] {
    opacity: 1;
    translate: 0 0;
    visibility: visible;
  }

  @media (min-width: 52rem) {
    .mobile-nav {
      display: none;
    }
  }

  .mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0.25rem;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-lg);
    font-weight: 560;
    color: var(--ink);
  }

  .mobile-nav__link .icon {
    color: var(--ink-muted);
  }

  .mobile-nav__link[aria-current="page"] {
    color: var(--accent);
  }

  .mobile-nav__foot {
    margin-top: 1.5rem;
  }

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

  .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(3rem, 2rem + 6vw, 6.25rem) clamp(2.5rem, 1.7rem + 3.5vw, 4.5rem);
    border-bottom: 1px solid var(--border);
    background-color: var(--canvas);
  }

  /* Soft two-point aurora wash. Cheap, no images, respects dark mode. */
  .hero::before {
    content: "";
    position: absolute;
    inset: -40% -10% auto;
    z-index: -1;
    height: 140%;
    background:
      radial-gradient(
        42rem 26rem at 18% 12%,
        light-dark(oklch(88% 0.13 158 / 0.5), oklch(62% 0.15 158 / 0.32)),
        transparent 62%
      ),
      radial-gradient(
        36rem 24rem at 84% 4%,
        light-dark(oklch(90% 0.08 210 / 0.42), oklch(56% 0.11 220 / 0.26)),
        transparent 60%
      );
    pointer-events: none;
  }

  /* Hairline grid, masked to a gentle fade. Adds texture without noise. */
  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(to right, var(--border) 1px, transparent 1px),
      linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.5;
    mask-image: radial-gradient(70% 60% at 50% 0%, #000 10%, transparent 80%);
    pointer-events: none;
  }

  .hero__inner {
    display: grid;
    gap: 1.35rem;
    justify-items: center;
    text-align: center;
    max-width: 46rem;
    margin-inline: auto;
  }

  .hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem 0.3rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background-color: var(--surface);
    box-shadow: var(--shadow-xs);
    font-size: var(--fs-xs);
    font-weight: 560;
    color: var(--ink-secondary);
  }

  .hero__eyebrow-dot {
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    border-radius: var(--r-full);
    background-color: var(--accent-tint-strong);
    color: var(--accent);
  }

  .hero__eyebrow-dot .icon {
    width: 0.85rem;
    height: 0.85rem;
  }

  .hero__title {
    max-width: 18ch;
  }

  .hero__lede {
    max-width: 48ch;
    color: var(--ink-secondary);
    font-size: var(--fs-lg);
  }

  .hero__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 0.35rem;
  }

  .hero--compact {
    padding-block: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);
  }

  .hero--compact .hero__inner {
    justify-items: start;
    text-align: start;
    max-width: 52rem;
    margin-inline: 0;
    gap: 0.9rem;
  }

  .hero--compact .hero__title {
    font-size: var(--fs-2xl);
    max-width: 24ch;
  }

  .hero--compact .hero__lede {
    font-size: var(--fs-md);
  }

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

  .hero-search {
    width: min(100%, 34rem);
    margin-top: 0.5rem;
  }

  .hero-search__field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 0.9rem 0.9rem 1.15rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    background-color: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--ink-muted);
    font-size: var(--fs-md);
    text-align: start;
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease),
      transform var(--dur) var(--ease);
  }

  .hero-search__field:hover {
    border-color: var(--accent-solid);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
  }

  .hero-search__field .icon {
    color: var(--accent);
  }

  .hero-search__label {
    flex: 1;
  }

  .hero-search__hint {
    display: none;
  }

  @media (min-width: 40rem) {
    .hero-search__hint {
      display: inline-flex;
    }
  }

  .hero-suggest {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    font-size: var(--fs-sm);
    color: var(--ink-muted);
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background-color: var(--surface);
    color: var(--ink-secondary);
    font-size: var(--fs-sm);
    font-weight: 520;
    transition:
      border-color var(--dur) var(--ease),
      color var(--dur) var(--ease),
      background-color var(--dur) var(--ease);
  }

  .chip:hover {
    border-color: var(--accent-solid);
    background-color: var(--accent-tint);
    color: var(--accent);
  }

  /* --- Cards -------------------------------------------------------- */

  .card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.4rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background-color: var(--surface);
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease),
      transform var(--dur) var(--ease),
      background-color var(--dur) var(--ease);
  }

  /* :has() lets the whole card react to focus inside it, so keyboard and
     pointer users get the same affordance without a JS click handler. */
  .card:hover,
  .card:has(:focus-visible) {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }

  .card__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .card__glyph {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    flex: none;
    border-radius: var(--r-md);
    background-color: var(--accent-tint);
    color: var(--accent);
  }

  .card__title {
    font-size: var(--fs-lg);
    font-weight: 620;
    letter-spacing: -0.018em;
  }

  .card__title a {
    color: var(--ink);
    text-decoration: none;
  }

  .card:hover .card__title a,
  .card__title a:hover {
    color: var(--accent);
  }

  /* Stretched link: whole card is clickable, text stays selectable. */
  .card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }

  .card__count {
    margin-top: 0.1rem;
    font-size: var(--fs-xs);
    color: var(--ink-muted);
  }

  .card__list {
    display: grid;
    gap: 0.1rem;
    margin: 0 -0.5rem;
  }

  .card__list-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--ink-secondary);
    transition:
      background-color var(--dur-fast) var(--ease),
      color var(--dur-fast) var(--ease);
  }

  .card__list-link:hover {
    background-color: var(--accent-tint);
    color: var(--accent);
  }

  .card__list-link .icon {
    flex: none;
    width: 0.9em;
    height: 0.9em;
    opacity: 0;
    translate: -0.25rem 0;
    transition:
      opacity var(--dur) var(--ease),
      translate var(--dur) var(--ease);
  }

  .card__list-link:hover .icon {
    opacity: 1;
    translate: 0 0;
  }

  /* Interactive children must sit above the stretched title overlay. */
  .card__list-link,
  .card__more-link,
  .card__more .btn {
    position: relative;
    z-index: 1;
  }

  .card__more {
    margin-top: auto;
    padding-top: 1rem;
  }

  .card__more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent);
  }

  .card__more-link .icon {
    transition: translate var(--dur) var(--ease);
  }

  .card:hover .card__more-link .icon {
    translate: 0.2rem 0;
  }

  /* Compact service tile. */
  .tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.05rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--surface);
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease),
      transform var(--dur) var(--ease);
  }

  .tile:hover {
    border-color: var(--accent-solid);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
  }

  .tile__glyph {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex: none;
    border-radius: var(--r-sm);
    background-color: var(--accent-tint);
    color: var(--accent);
  }

  /* These wrappers are spans (they live inside anchors), so they need an
     explicit box before their children will stack. */
  .tile__body,
  .tile__name,
  .tile__meta,
  .palette__item-body,
  .palette__item-title,
  .palette__item-sub,
  .pager__dir,
  .pager__title,
  .pager__link > span {
    display: block;
  }

  .tile__body {
    min-width: 0;
    flex: 1;
  }

  .tile__name {
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: -0.014em;
  }

  .tile__meta {
    font-size: var(--fs-xs);
    color: var(--ink-muted);
  }

  .tile__arrow {
    color: var(--ink-muted);
    transition:
      translate var(--dur) var(--ease),
      color var(--dur) var(--ease);
  }

  .tile:hover .tile__arrow {
    translate: 0.2rem 0;
    color: var(--accent);
  }

  /* --- Breadcrumbs -------------------------------------------------- */

  .crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--fs-sm);
    color: var(--ink-muted);
  }

  .crumbs__item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
  }

  .crumbs__link {
    border-radius: var(--r-xs);
    transition: color var(--dur) var(--ease);
  }

  .crumbs__link:hover {
    color: var(--accent);
  }

  .crumbs__sep {
    width: 0.85em;
    height: 0.85em;
    opacity: 0.55;
  }

  .crumbs__current {
    color: var(--ink-secondary);
    font-weight: 550;
  }

  /* --- Accordion (FAQ) ---------------------------------------------- */

  .faq-group {
    scroll-margin-top: calc(var(--header-h) + 2rem);
  }

  .faq-group + .faq-group {
    margin-top: clamp(2.25rem, 1.7rem + 2vw, 3.25rem);
  }

  .faq-group__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
  }

  .faq-group__title {
    font-size: var(--fs-xl);
  }

  .faq-group__link {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
  }

  .qa {
    border-bottom: 1px solid var(--border);
  }

  .qa__summary {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.05rem 0.25rem;
    list-style: none;
    font-size: var(--fs-md);
    font-weight: 560;
    letter-spacing: -0.012em;
    color: var(--ink);
    border-radius: var(--r-sm);
    transition: color var(--dur) var(--ease);
  }

  .qa__summary:hover {
    color: var(--accent);
  }

  .qa__q {
    flex: 1;
    text-wrap: pretty;
  }

  .qa__chevron {
    flex: none;
    margin-top: 0.18em;
    color: var(--ink-muted);
    transition:
      rotate var(--dur) var(--ease),
      color var(--dur) var(--ease);
  }

  .qa[open] .qa__chevron {
    rotate: 180deg;
    color: var(--accent);
  }

  /* 0fr -> 1fr is the reliable way to animate unknown content height. */
  .qa__reveal {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--dur-slow) var(--ease-out);
  }

  .qa[open] .qa__reveal {
    grid-template-rows: 1fr;
  }

  .qa__reveal-inner {
    overflow: hidden;
  }

  .qa__body {
    padding: 0 0.25rem 1.4rem;
    max-width: 68ch;
  }

  .qa__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.35rem;
  }

  /* --- Article layout ----------------------------------------------- */

  .doc {
    display: grid;
    gap: clamp(2rem, 1rem + 3vw, 3.5rem);
    align-items: start;
    padding-block: clamp(2rem, 1.5rem + 2vw, 3.25rem) var(--section-gap);
    grid-template-columns: minmax(0, 1fr);
  }

  @media (min-width: 64rem) {
    .doc {
      grid-template-columns: 17rem minmax(0, 1fr);
    }
  }

  @media (min-width: 86rem) {
    .doc {
      grid-template-columns: 17rem minmax(0, 1fr) 14rem;
    }
  }

  .doc__aside {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    max-height: calc(100svh - var(--header-h) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  /* Below the two-column breakpoint the nav becomes a disclosure so it
     never buries the article under a wall of links on a phone. */
  .doc__aside {
    position: static;
    max-height: none;
    overflow: visible;
  }

  @media (min-width: 64rem) {
    .doc__aside {
      position: sticky;
      top: calc(var(--header-h) + 1.5rem);
      max-height: calc(100svh - var(--header-h) - 3rem);
      overflow-y: auto;
    }
  }

  .doc__toc {
    display: none;
  }

  @media (min-width: 86rem) {
    .doc__toc {
      display: block;
      position: sticky;
      top: calc(var(--header-h) + 1.5rem);
      max-height: calc(100svh - var(--header-h) - 3rem);
      overflow-y: auto;
    }
  }

  .doc__main {
    min-width: 0;
    max-width: 46rem;
  }

  .doc-nav {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background-color: var(--surface);
    overflow: hidden;
  }

  @media (min-width: 64rem) {
    .doc-nav {
      border: 0;
      border-radius: 0;
      background-color: transparent;
      overflow: visible;
    }
  }

  .doc-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-size: var(--fs-sm);
    font-weight: 620;
    color: var(--ink);
  }

  .doc-nav__toggle .icon {
    color: var(--ink-muted);
    transition: rotate var(--dur) var(--ease);
  }

  .doc-nav[data-open="true"] .doc-nav__toggle .icon {
    rotate: 180deg;
  }

  .doc-nav__body {
    display: none;
    padding: 0 1.1rem 1.1rem;
  }

  .doc-nav[data-open="true"] .doc-nav__body {
    display: block;
  }

  @media (min-width: 64rem) {
    .doc-nav__toggle {
      display: none;
    }

    .doc-nav__body {
      display: block;
      padding: 0;
    }
  }

  .doc-nav__label {
    margin-bottom: 0.85rem;
    font-size: var(--fs-xs);
    font-weight: 660;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .doc-nav__group + .doc-nav__group {
    margin-top: 0.35rem;
  }

  .doc-nav__group-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: start;
    color: var(--ink-secondary);
    transition:
      background-color var(--dur-fast) var(--ease),
      color var(--dur-fast) var(--ease);
  }

  .doc-nav__group-btn:hover {
    background-color: var(--surface-hover);
    color: var(--ink);
  }

  .doc-nav__group-btn .icon {
    flex: none;
    width: 0.95em;
    height: 0.95em;
    color: var(--ink-muted);
    transition: rotate var(--dur) var(--ease);
  }

  .doc-nav__group-btn[aria-expanded="true"] {
    color: var(--ink);
  }

  .doc-nav__group-btn[aria-expanded="true"] .icon {
    rotate: 90deg;
  }

  .doc-nav__sublist {
    display: none;
    margin: 0.15rem 0 0.5rem;
    padding-inline-start: 0.6rem;
    border-inline-start: 1px solid var(--border);
  }

  .doc-nav__group-btn[aria-expanded="true"] + .doc-nav__sublist {
    display: block;
  }

  .doc-nav__link {
    display: block;
    padding: 0.42rem 0.6rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    line-height: 1.45;
    color: var(--ink-muted);
    transition:
      background-color var(--dur-fast) var(--ease),
      color var(--dur-fast) var(--ease);
  }

  .doc-nav__link:hover {
    background-color: var(--surface-hover);
    color: var(--ink);
  }

  .doc-nav__link[aria-current="page"] {
    background-color: var(--accent-tint);
    color: var(--accent);
    font-weight: 600;
  }

  /* --- Table of contents -------------------------------------------- */

  .toc__label {
    margin-bottom: 0.75rem;
    font-size: var(--fs-xs);
    font-weight: 660;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .toc__list {
    display: grid;
    gap: 0.1rem;
    border-inline-start: 1px solid var(--border);
  }

  .toc__link {
    display: block;
    padding: 0.32rem 0 0.32rem 0.85rem;
    margin-inline-start: -1px;
    border-inline-start: 2px solid transparent;
    font-size: var(--fs-sm);
    line-height: 1.45;
    color: var(--ink-muted);
    transition:
      color var(--dur) var(--ease),
      border-color var(--dur) var(--ease);
  }

  .toc__link:hover {
    color: var(--ink);
  }

  .toc__link[data-depth="3"] {
    padding-inline-start: 1.6rem;
    font-size: var(--fs-xs);
  }

  .toc__link[aria-current="true"] {
    border-inline-start-color: var(--accent-solid);
    color: var(--accent);
    font-weight: 560;
  }

  /* --- Doc header / meta -------------------------------------------- */

  .doc-head {
    padding-bottom: 1.6rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
  }

  .doc-head__title {
    margin-top: 0.9rem;
    font-size: var(--fs-2xl);
  }

  .doc-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.1rem;
    margin-top: 1rem;
    font-size: var(--fs-sm);
    color: var(--ink-muted);
  }

  .doc-head__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }

  .doc-head__meta a {
    color: inherit;
    text-decoration: none;
  }

  .doc-head__meta a:hover {
    color: var(--accent);
  }

  .doc-foot {
    margin-top: 3rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
  }

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

  .pager__link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--surface);
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease);
  }

  .pager__link:hover {
    border-color: var(--accent-solid);
    box-shadow: var(--shadow-sm);
  }

  .pager__link > span {
    flex: 1;
    min-width: 0;
  }

  .pager__link--next {
    text-align: end;
    flex-direction: row-reverse;
  }

  .pager__dir {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .pager__title {
    font-size: var(--fs-sm);
    font-weight: 580;
    color: var(--ink);
  }

  .pager__icon {
    flex: none;
    color: var(--ink-muted);
  }

  .pager__link:hover .pager__icon {
    color: var(--accent);
  }

  /* --- Prose (sanitised CMS HTML) ----------------------------------- */

  .prose {
    font-size: var(--fs-md);
    line-height: 1.75;
    color: var(--ink-secondary);
  }

  .prose > div + div,
  .prose > p + p {
    margin-top: 1.15em;
  }

  .prose h1,
  .prose h2,
  .prose h3,
  .prose h4,
  .prose h5,
  .prose h6 {
    margin-top: 2.2em;
    margin-bottom: 0.7em;
    color: var(--ink);
    scroll-margin-top: calc(var(--header-h) + 1.5rem);
  }

  .prose h2 {
    font-size: var(--fs-xl);
    padding-bottom: 0.35em;
    border-bottom: 1px solid var(--border);
  }

  .prose h3 {
    font-size: var(--fs-lg);
  }

  .prose h4,
  .prose h5,
  .prose h6 {
    font-size: var(--fs-md);
    font-weight: 640;
  }

  .prose > :first-child {
    margin-top: 0;
  }

  .prose a {
    color: var(--accent);
    font-weight: 520;
    text-decoration: underline;
    text-decoration-color: color-mix(in oklch, currentColor 35%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.19em;
    transition: text-decoration-color var(--dur) var(--ease);
  }

  .prose a:hover {
    text-decoration-color: currentColor;
  }

  /* Author-supplied link with a broken scheme loses its href on sanitise.
     Make that visibly inert instead of a link-shaped dead end. */
  .prose a:not([href]) {
    color: var(--ink-muted);
    text-decoration: none;
    cursor: not-allowed;
  }

  .prose ul,
  .prose ol {
    margin-block: 1.15em;
    padding-inline-start: 1.5em;
  }

  .prose li + li {
    margin-top: 0.4em;
  }

  .prose li::marker {
    color: var(--ink-muted);
  }

  .prose ul li::marker {
    color: var(--accent);
  }

  .prose blockquote {
    margin-block: 1.5em;
    padding: 0.2em 0 0.2em 1.25em;
    border-inline-start: 3px solid var(--accent-solid);
    color: var(--ink);
    font-style: italic;
  }

  .prose pre {
    margin-block: 1.5em;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--canvas-sunken);
    overflow-x: auto;
    line-height: 1.6;
  }

  .prose :not(pre) > code {
    padding: 0.15em 0.4em;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background-color: var(--canvas-sunken);
    color: var(--ink);
  }

  .prose img {
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--canvas-sunken);
    box-shadow: var(--shadow-sm);
  }

  .prose figure {
    margin-block: 1.75em;
  }

  .prose figure img {
    margin-inline: auto;
  }

  .prose figcaption {
    margin-top: 0.7em;
    text-align: center;
    font-size: var(--fs-sm);
    color: var(--ink-muted);
  }

  /* Trix writes the raw filename and byte size into the caption. It is
     noise for a reader, so site.js flags those and we fold them away. */
  .prose figcaption[data-filemeta="true"] {
    display: none;
  }

  .prose hr {
    margin-block: 2.25em;
  }

  .prose table {
    width: 100%;
    margin-block: 1.5em;
    border-collapse: collapse;
    font-size: var(--fs-sm);
  }

  .prose th,
  .prose td {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    text-align: start;
  }

  .prose th {
    background-color: var(--canvas-sunken);
    color: var(--ink);
    font-weight: 620;
  }

  /* --- Search dialog ------------------------------------------------ */

  .palette {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    background: transparent;
    overflow: hidden;
  }

  .palette::backdrop {
    background-color: light-dark(oklch(30% 0.02 262 / 0.4), oklch(6% 0.01 262 / 0.68));
    backdrop-filter: blur(3px);
  }

  .palette__panel {
    display: flex;
    flex-direction: column;
    width: min(40rem, calc(100vw - 2rem));
    max-height: min(30rem, calc(100svh - 8rem));
    margin: clamp(2.5rem, 8vh, 7rem) auto 0;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background-color: var(--surface-raised);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  .palette__field {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex: none;
  }

  .palette__field .icon {
    color: var(--ink-muted);
  }

  .palette__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font-size: var(--fs-md);
    color: var(--ink);
  }

  .palette__input::placeholder {
    color: var(--ink-muted);
  }

  .palette__results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.5rem;
    scrollbar-width: thin;
  }

  .palette__group-label {
    padding: 0.7rem 0.65rem 0.35rem;
    font-size: var(--fs-xs);
    font-weight: 660;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .palette__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.65rem;
    border-radius: var(--r-sm);
    color: var(--ink-secondary);
    scroll-margin: 0.5rem;
  }

  .palette__item[data-active="true"] {
    background-color: var(--accent-tint);
    color: var(--accent);
  }

  .palette__item-glyph {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    flex: none;
    border-radius: var(--r-xs);
    background-color: var(--canvas-sunken);
    color: var(--ink-muted);
  }

  .palette__item[data-active="true"] .palette__item-glyph {
    background-color: var(--surface);
    color: var(--accent);
  }

  .palette__item-body {
    min-width: 0;
    flex: 1;
  }

  .palette__item-title {
    font-size: var(--fs-sm);
    font-weight: 560;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .palette__item[data-active="true"] .palette__item-title {
    color: var(--accent);
  }

  .palette__item-title mark {
    background-color: transparent;
    color: var(--accent);
    font-weight: 700;
  }

  .palette__item-sub {
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .palette__item-enter {
    flex: none;
    opacity: 0;
  }

  .palette__item[data-active="true"] .palette__item-enter {
    opacity: 1;
  }

  .palette__empty {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--ink-muted);
  }

  .palette__empty-title {
    margin-bottom: 0.35rem;
    color: var(--ink);
    font-weight: 600;
  }

  .palette__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
    padding: 0.6rem 1.1rem;
    border-top: 1px solid var(--border);
    background-color: var(--canvas-sunken);
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    flex: none;
  }

  .palette__foot-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* --- CTA ---------------------------------------------------------- */

  .cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background-color: var(--surface);
    text-align: center;
  }

  .cta::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(
      34rem 18rem at 50% 0%,
      var(--accent-tint),
      transparent 70%
    );
  }

  .cta__title {
    font-size: var(--fs-xl);
  }

  .cta__lede {
    max-width: 44ch;
    margin: 0.7rem auto 0;
    color: var(--ink-secondary);
  }

  .cta__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 1.6rem;
  }

  /* --- Empty / notice ----------------------------------------------- */

  .notice {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    text-align: center;
    color: var(--ink-muted);
  }

  .notice__glyph {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--r-full);
    background-color: var(--canvas-sunken);
    color: var(--ink-muted);
  }

  .notice__title {
    color: var(--ink);
    font-weight: 600;
  }

  /* --- Filter bar --------------------------------------------------- */

  .filter {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: min(100%, 26rem);
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background-color: var(--surface);
    transition:
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease);
  }

  .filter:focus-within {
    border-color: var(--accent-solid);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }

  .filter .icon {
    color: var(--ink-muted);
  }

  .filter__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font-size: var(--fs-sm);
  }

  .filter__clear {
    display: none;
    color: var(--ink-muted);
  }

  .filter[data-filled="true"] .filter__clear {
    display: inline-flex;
  }

  .filter__clear:hover {
    color: var(--ink);
  }

  [data-filter-hidden="true"] {
    display: none !important;
  }

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

  .site-footer {
    flex: none;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background-color: var(--canvas-sunken);
  }

  .site-footer__top {
    display: grid;
    gap: clamp(2rem, 1rem + 4vw, 3.5rem);
    padding-block: clamp(2.5rem, 2rem + 3vw, 4rem);
    grid-template-columns: minmax(0, 1fr);
  }

  @media (min-width: 48rem) {
    .site-footer__top {
      grid-template-columns: minmax(14rem, 1.4fr) minmax(0, 3fr);
    }
  }

  .site-footer__about {
    max-width: 34ch;
    margin-top: 1rem;
    font-size: var(--fs-sm);
    color: var(--ink-secondary);
  }

  .site-footer__btc {
    margin-top: 1.1rem;
    font-size: var(--fs-xs);
    color: var(--ink-muted);
  }

  .site-footer__btc-value {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    word-break: break-all;
  }

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

  .site-footer__col-title {
    margin-bottom: 0.9rem;
    font-size: var(--fs-xs);
    font-weight: 660;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .site-footer__list {
    display: grid;
    gap: 0.55rem;
  }

  .site-footer__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--fs-sm);
    color: var(--ink-secondary);
    transition: color var(--dur) var(--ease);
  }

  .site-footer__link:hover {
    color: var(--accent);
  }

  .site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-block: 1.35rem;
    border-top: 1px solid var(--border);
    font-size: var(--fs-xs);
    color: var(--ink-muted);
  }

  /* --- Status page (error / maintenance) ---------------------------- */

  .status {
    display: grid;
    justify-items: center;
    gap: 1.1rem;
    max-width: 34rem;
    margin-inline: auto;
    padding-block: clamp(3.5rem, 2rem + 8vw, 7rem);
    text-align: center;
  }

  .status__code {
    font-size: var(--fs-sm);
    font-weight: 660;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .status__title {
    font-size: var(--fs-2xl);
  }

  .status__lede {
    color: var(--ink-secondary);
  }

  .status__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
  }

  .status__trace {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--canvas-sunken);
    font-size: var(--fs-xs);
    line-height: 1.55;
    text-align: start;
    white-space: pre-wrap;
    overflow-x: auto;
    color: var(--ink-secondary);
  }

  /* --- Account menu ------------------------------------------------- */

  .account {
    position: relative;
  }

  .account__trigger {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    list-style: none;
  }

  .account__trigger::marker,
  .account__trigger::-webkit-details-marker {
    display: none;
    content: "";
  }

  .account__trigger:hover {
    background-color: var(--surface-hover);
  }

  .account__avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--r-full);
    object-fit: cover;
    border: 1px solid var(--border);
  }

  .account__initial {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--r-full);
    background-color: var(--accent-tint-strong);
    color: var(--accent);
    font-size: var(--fs-sm);
    font-weight: 660;
  }

  .account__menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.5rem);
    z-index: 20;
    min-width: 11rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--surface-raised);
    box-shadow: var(--shadow-lg);
  }

  .account__name {
    padding: 0.5rem 0.65rem 0.35rem;
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account__item {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--ink-secondary);
  }

  .account__item:hover {
    background-color: var(--surface-hover);
    color: var(--ink);
  }

  /* Lives in the header control row, so it takes the shape and height of
     .icon-btn rather than the pill .btn uses for page level actions. */
  .account__signin {
    display: none;
    height: 36px;
    padding-block: 0;
    padding-inline: 0.9rem;
    border-radius: var(--r-sm);
  }

  @media (min-width: 40rem) {
    .account__signin {
      display: inline-flex;
    }
  }

  /* Compact search affordance for viewports too narrow for the full pill. */
  .search-icon-btn {
    display: inline-grid;
  }

  @media (min-width: 60rem) {
    .search-icon-btn {
      display: none;
    }
  }

  /* Filter bar wrapper is layout-transparent so the input participates
     directly in the surrounding flex row. */
  .no-js-filter {
    display: contents;
  }

  .section__lede .chip {
    margin: 0 0.3rem 0.4rem 0;
  }

  .site-footer__brand {
    display: inline-block;
    color: var(--ink);
  }

  .site-footer__brand svg {
    width: 54px;
    height: auto;
  }
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .no-js-hide {
    display: none;
  }

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

  .lede {
    color: var(--ink-secondary);
    font-size: var(--fs-lg);
  }

  .flow > * + * {
    margin-top: 1rem;
  }

  .scroll-lock {
    overflow: hidden;
  }
}

/* ==========================================================================
   UNLAYERED
   Unlayered rules beat every @layer, which is exactly what [hidden] needs
   in order to win against component display rules.
   ========================================================================== */

[hidden] {
  display: none !important;
}

/* ==========================================================================
   MOTION PREFERENCES / PROGRESSIVE ENHANCEMENT
   ========================================================================== */

/* Cross-document view transitions. Chromium and Safari honour this; every
   other engine simply ignores the at-rule and navigates normally. */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: light-dark(oklch(70% 0.01 250), oklch(52% 0.014 262));
    --ink-secondary: light-dark(oklch(32% 0.011 262), oklch(90% 0.006 250));
    --ink-muted: light-dark(oklch(40% 0.01 262), oklch(80% 0.007 250));
  }
}

@media print {
  .site-header,
  .site-footer,
  .doc__aside,
  .doc__toc,
  .cta,
  .palette,
  .mobile-nav,
  .doc-foot {
    display: none !important;
  }

  .doc {
    display: block;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}
