/* ==========================================================================================================
   Atlas — documentation theme stylesheet
   ----------------------------------------------------------------------------------------------------------
   One file, no build step, ordered in cascade layers (later layers win):

     reset       box model, margins, media defaults
     tokens      the token tiers: fallback scheme values, derived colours, type scale, spacing, radius, layers,
                 motion, shadows, widths. The REAL scheme values come from snippets/theme-styles.liquid
                 (unlayered, so they beat the fallbacks here).
     base        elements: body, headings, links, focus, selection, inline code, kbd, forms
     layout      the page frame: skip link, main, containers, sections, surfaces, and the DOC SHELL
                 (.atlas-shell: sidebar | main) with the R§2.2 breakpoints
     components  reusable pieces: buttons, icon buttons, badges, labels, prose, header bar, announcement,
                 sidebar navigation, drawer, footer, language switcher, form fields
     sections    section-specific rules (one block per section, named after its file)
     utilities   visibility helpers, scripts-only controls, reduced motion
     print       the print layout (R§8): every surface token is overridden

   Naming: every class starts with `atlas-`, BEM-style (`atlas-block__element--modifier`). Tokens are
   `--atlas-*`. Breakpoints (max-width queries, from R§2.2): xl 1280, lg 1024, md 900, sm 640.

   EXTENDING: add a component's rules inside `@layer components { ... }` under a new `--- Name ---`
   heading comment, and a section's inside `@layer sections`. Never hard-code a colour: use a token, or derive one
   with color-mix() from a token, so each style and both modes stay correct.
   ========================================================================================================== */

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

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

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

  body,
  h1, h2, h3, h4, h5, h6,
  p, figure, blockquote, dl, dd, pre {
    margin: 0;
  }

  ul[role="list"],
  ol[role="list"] {
    list-style: none;
    margin: 0;
    padding: 0;
  }

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

  img,
  video {
    height: auto;
  }

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

  button {
    cursor: pointer;
  }

  [hidden] {
    display: none !important;
  }
}

/* ==========================================================================================================
   TOKENS
   Tier 1 (scheme): --atlas-<token> printed per mode by snippets/theme-styles.liquid; the values below are
   only a fallback (the Atlas light palette) for a page without that snippet.
   Tier 2 (derived): computed from tier 1 on every element that carries a scheme (<html data-mode>, a
   [data-mode] element, an inverse surface), so they follow the mode.
   Tier 3 (component-local): custom properties on a component's root, e.g. --atlas-icon-size.
   ========================================================================================================== */
@layer tokens {
  :root {
    color-scheme: light;
    --atlas-background: #ffffff;
    --atlas-surface: #f6f7f9;
    --atlas-muted: #eef0f4;
    --atlas-border: #e3e6eb;
    --atlas-border-strong: #cdd2da;
    --atlas-text: #0b0d12;
    --atlas-text-secondary: #4b5260;
    --atlas-text-faint: #5d6470;
    --atlas-accent: #4338ca;
    --atlas-accent-surface: #eef0fd;
    --atlas-accent-border: #c7cbf5;
    --atlas-highlight: #eef0fd;
    --atlas-highlight-label: #312e81;
    --atlas-primary-button: #0b0d12;
    --atlas-primary-button-label: #ffffff;
    --atlas-secondary-button: #f6f7f9;
    --atlas-secondary-button-label: #0b0d12;
    --atlas-success: #15803d;
    --atlas-warning: #a16207;
    --atlas-danger: #c81e1e;
    --atlas-code-background: #0d1017;
    --atlas-code-text: #e6e9ef;
    --atlas-code-border: #1e232c;
    --atlas-overlay-strength: 42%;

    /* Fonts (theme-styles prints the chosen families) */
    --atlas-font-heading: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --atlas-font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --atlas-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Type scale (R§1.4), desktop values; the phone values are below */
    --atlas-text-xs: 0.78125rem;
    --atlas-text-sm: 0.875rem;
    --atlas-text-md: 1rem;
    --atlas-text-lg: 1.15625rem;
    --atlas-text-xl: 1.5rem;
    --atlas-text-2xl: 1.9375rem;
    --atlas-text-3xl: 2.625rem;
    --atlas-text-4xl: 3.25rem;
    --atlas-text-5xl: 4.125rem;
    --atlas-heading-xs: var(--atlas-text-lg);
    --atlas-heading-sm: var(--atlas-text-xl);
    --atlas-heading-md: var(--atlas-text-2xl);
    --atlas-heading-lg: var(--atlas-text-3xl);
    --atlas-heading-xl: var(--atlas-text-4xl);
    --atlas-heading-2xl: var(--atlas-text-5xl);

    --atlas-leading-tight: 1.1;
    --atlas-leading-normal: 1.5;
    --atlas-leading-relaxed: 1.72;
    --atlas-leading-heading-xl: 1.15;
    --atlas-leading-heading-lg: 1.2;
    --atlas-leading-heading-md: 1.3;
    --atlas-leading-heading-sm: 1.35;
    --atlas-leading-heading-xs: 1.45;

    --atlas-tracking-display: -0.045em;
    --atlas-tracking-tighter: -0.033em;
    --atlas-tracking-tight: -0.02em;
    --atlas-tracking-wide: 0.08em;

    --atlas-weight-regular: 400;
    --atlas-weight-semibold: 600;
    --atlas-weight-bold: 700;

    /* Spacing (R§1.5) */
    --atlas-space-xs: 0.25rem;
    --atlas-space-sm: 0.5rem;
    --atlas-space-md: 1rem;
    --atlas-space-lg: 1.5rem;
    --atlas-space-xl: 2rem;
    --atlas-space-2xl: 3rem;
    --atlas-space-3xl: 4rem;
    --atlas-space-4xl: 5rem;
    --atlas-space-5xl: 6rem;
    --atlas-space-6xl: 7rem;

    /* Radius: one base (theme setting radius_base), the scale derived from it.
       Base 10 gives 5 / 8 / 10 / 14 / 20 / 28; base 14 (Canvas) gives 7 / 11 / 14 / 20 / 28 / 39. */
    --atlas-radius-base: 10px;
    --atlas-radius-xs: calc(var(--atlas-radius-base) * 0.5);
    --atlas-radius-sm: calc(var(--atlas-radius-base) * 0.8);
    --atlas-radius-md: var(--atlas-radius-base);
    --atlas-radius-lg: calc(var(--atlas-radius-base) * 1.4);
    --atlas-radius-xl: calc(var(--atlas-radius-base) * 2);
    --atlas-radius-2xl: calc(var(--atlas-radius-base) * 2.8);
    --atlas-radius-full: 9999px;
    --atlas-radius-button: var(--atlas-radius-xs);

    /* Widths and the shell (R§1.5, R§2.1) */
    --atlas-content-width: 768px;
    --atlas-sidebar-width: 256px;
    --atlas-toc-width: 216px;
    --atlas-wide-width: 1280px;
    --atlas-shell-max: 1536px;
    --atlas-shell-gap: 48px;
    --atlas-gutter: 24px;
    --atlas-topbar-height: 56px;
    --atlas-scroll-offset: 80px;
    --atlas-target-min: 24px;

    /* Layers (R§1.5) */
    --atlas-z-sticky: 30;
    --atlas-z-topbar: 40;
    --atlas-z-popover: 50;
    --atlas-z-scrim: 60;
    --atlas-z-drawer: 100;
    --atlas-z-toast: 1000;

    /* Motion */
    --atlas-duration-fast: 0.1s;
    --atlas-duration-normal: 0.2s;
    --atlas-duration-slow: 0.5s;
    --atlas-ease: ease-out;
    --atlas-ease-toggle: cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --atlas-shadow-sm: 0 1px 3px rgb(0 0 0 / 0.1);
    --atlas-shadow-md: 0 6px 16px rgb(0 0 0 / 0.12);
    --atlas-shadow-lg: 0 16px 48px rgb(0 0 0 / 0.2);
  }

  /* Tier 2: derived colours, recomputed wherever a scheme is applied. */
  :root,
  [data-mode],
  .atlas-surface--inverse {
    --atlas-state-hover: color-mix(in srgb, var(--atlas-text) 5%, transparent);
    --atlas-state-active: color-mix(in srgb, var(--atlas-text) 9%, transparent);
    --atlas-accent-hover: color-mix(in srgb, var(--atlas-accent) 82%, var(--atlas-text));
    --atlas-primary-button-hover: color-mix(in srgb, var(--atlas-primary-button) 84%, var(--atlas-background));
    --atlas-secondary-button-hover: color-mix(in srgb, var(--atlas-secondary-button-label) 6%, var(--atlas-secondary-button));
    --atlas-overlay: color-mix(in srgb, #08090b var(--atlas-overlay-strength), transparent);
    --atlas-success-subtle: color-mix(in srgb, var(--atlas-success) 10%, var(--atlas-background));
    --atlas-success-border: color-mix(in srgb, var(--atlas-success) 38%, var(--atlas-background));
    --atlas-warning-subtle: color-mix(in srgb, var(--atlas-warning) 10%, var(--atlas-background));
    --atlas-warning-border: color-mix(in srgb, var(--atlas-warning) 38%, var(--atlas-background));
    --atlas-danger-subtle: color-mix(in srgb, var(--atlas-danger) 10%, var(--atlas-background));
    --atlas-danger-border: color-mix(in srgb, var(--atlas-danger) 38%, var(--atlas-background));
    --atlas-code-muted: color-mix(in srgb, var(--atlas-code-text) 58%, var(--atlas-code-background));
    --atlas-code-highlight: color-mix(in srgb, var(--atlas-code-text) 9%, var(--atlas-code-background));
    /* Focus: an outline in the accent and a halo in the highlight fill (Canvas: ink + pink, the design system's). */
    --atlas-focus-outline: var(--atlas-accent);
    --atlas-focus-halo: var(--atlas-highlight);
    --atlas-selection: color-mix(in srgb, var(--atlas-accent-border) 60%, var(--atlas-background));
  }

  @media (max-width: 639.98px) {
    :root {
      --atlas-text-xs: 0.75rem;
      --atlas-text-lg: 1.0625rem;
      --atlas-text-xl: 1.3125rem;
      --atlas-text-2xl: 1.625rem;
      --atlas-text-3xl: 2rem;
      --atlas-text-4xl: 2.375rem;
      --atlas-text-5xl: 2.75rem;
      --atlas-gutter: 16px;
    }
  }
}

/* ==========================================================================================================
   BASE
   ========================================================================================================== */
@layer base {
  html {
    font-size: 16px;
    scroll-padding-top: var(--atlas-scroll-offset);
    background: var(--atlas-background);
  }

  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--atlas-background);
    color: var(--atlas-text);
    font-family: var(--atlas-font-body);
    font-size: var(--atlas-text-md);
    line-height: var(--atlas-leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--atlas-font-heading);
    font-weight: var(--atlas-weight-bold);
    color: var(--atlas-text);
  }

  h1, h2, h3 {
    text-wrap: balance;
  }

  a {
    color: var(--atlas-accent);
    text-underline-offset: 0.2em;
  }

  a:hover {
    color: var(--atlas-accent-hover);
  }

  strong,
  b {
    font-weight: var(--atlas-weight-semibold);
  }

  ::selection {
    background: var(--atlas-selection);
    color: var(--atlas-text);
  }

  :focus-visible {
    outline: 2px solid var(--atlas-focus-outline);
    outline-offset: 0;
    box-shadow: 0 0 0 6px var(--atlas-focus-halo);
  }

  :focus:not(:focus-visible) {
    outline: none;
  }

  /* Inline code and keys (R§1.4, R§4.30): the code block's own `code` is reset by `pre code` below. */
  /* Ligatures off: a mono face such as JetBrains Mono would draw `-->` or `!=` as one glyph, and a reader must see
     the characters they will type. */
  code,
  kbd,
  samp,
  pre {
    font-family: var(--atlas-font-mono);
    font-variant-ligatures: none;
  }

  /* Code reads left to right on a right-to-left page too: a code run is isolated, so the page's direction cannot
     reorder its punctuation, and a code block keeps its lines, prompts and gutters on the left. */
  code,
  kbd,
  samp {
    direction: ltr;
    unicode-bidi: isolate;
  }

  pre {
    direction: ltr;
    text-align: left;
  }

  :not(pre) > code {
    padding: 0.125em 0.375em;
    border-radius: var(--atlas-radius-xs);
    background: var(--atlas-muted);
    color: var(--atlas-text);
    font-size: 0.87em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  kbd {
    display: inline-block;
    padding: 0 0.25rem;
    border: 1px solid var(--atlas-border-strong);
    border-radius: var(--atlas-radius-xs);
    background: var(--atlas-background);
    color: var(--atlas-text-faint);
    font-size: var(--atlas-text-xs);
    line-height: 1.5;
  }

  pre code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
  }

  hr {
    height: 0;
    border: 0;
    border-top: 1px solid var(--atlas-border);
  }

  /* 16px fields so iOS does not zoom (R§9) */
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* ==========================================================================================================
   LAYOUT
   ========================================================================================================== */
@layer layout {
  /* --- Skip link (R§3.1) --- */
  .atlas-skip-link {
    position: fixed;
    inset-block-start: 8px;
    inset-inline-start: 8px;
    z-index: var(--atlas-z-toast);
    padding: 8px 16px;
    border-radius: var(--atlas-radius-md);
    background: var(--atlas-primary-button);
    color: var(--atlas-primary-button-label);
    font-size: var(--atlas-text-sm);
    font-weight: var(--atlas-weight-semibold);
    text-decoration: none;
    opacity: 0;
    transform: translateY(calc(-100% - 16px));
    transition: transform var(--atlas-duration-fast) var(--atlas-ease), opacity var(--atlas-duration-fast) var(--atlas-ease);
  }

  .atlas-skip-link:focus-visible {
    opacity: 1;
    transform: none;
    color: var(--atlas-primary-button-label);
  }

  /* --- Page frame --- */
  .atlas-main {
    flex: 1 0 auto;
  }

  .atlas-main:focus {
    outline: none;
  }

  .atlas-footer-section {
    margin-top: auto;
  }

  /* --- Containers: a centred column with the page gutter ---
     .atlas-container--content  the reading width (theme setting content_width)
     .atlas-container--wide     1280px, for landing sections
     .atlas-container--full     the shell's 1536px */
  .atlas-container {
    width: min(100% - 2 * var(--atlas-gutter), var(--atlas-container-max, var(--atlas-content-width)));
    margin-inline: auto;
  }

  .atlas-container--wide {
    --atlas-container-max: var(--atlas-wide-width);
  }

  .atlas-container--full {
    --atlas-container-max: var(--atlas-shell-max);
  }

  /* --- Sections: padding from the section's own settings (--atlas-pt / --atlas-pb), three quarters on phones --- */
  .atlas-section {
    padding-block: var(--atlas-pt, 48px) var(--atlas-pb, 48px);
  }

  @media (max-width: 639.98px) {
    .atlas-section {
      padding-block: calc(var(--atlas-pt, 48px) * 0.75) calc(var(--atlas-pb, 48px) * 0.75);
    }
  }

  /* --- Surfaces: what a section's "Background" select picks. Each reads the current mode's tokens, and the
     inverse surface swaps to the other mode's scheme (snippets/theme-styles.liquid). --- */
  .atlas-surface--page {
    background: var(--atlas-background);
    color: var(--atlas-text);
  }

  .atlas-surface--surface {
    background: var(--atlas-surface);
    color: var(--atlas-text);
  }

  .atlas-surface--accent {
    background: var(--atlas-accent-surface);
    color: var(--atlas-text);
  }

  .atlas-surface--inverse {
    background: var(--atlas-background);
    color: var(--atlas-text);
  }

  /* --- The doc shell (R§2.1, R§2.2) ---------------------------------------------------------------------
     Rendered by layout/theme.liquid on every page, around `content_for_layout`:

       <div class="atlas-shell [atlas-shell--no-sidebar]">
         <div class="atlas-shell__sidebar">{% render 'docs-sidebar', id_prefix: 'atlas-rail', print_nav_map: false %}</div>
         <main id="main-content" class="atlas-main atlas-shell__main">…sections…</main>
       </div>

     ≥1024  sidebar | main (the sidebar sticky below the topbar)
     <1024  one column; the sidebar column is hidden (the header's drawer holds it)
     <640   the gutter drops to 16px (token)
     --no-sidebar: the sidebar menu has no links, so main takes the whole width.
     The "On this page" column belongs to the doc page, not the shell: main-doc draws its own article | contents grid
     inside main (atlas-doc.css), so wide pages (landing, changelog, 404) simply have none. Article width: the theme's
     content_width; .atlas-article--wide widens one to the wide container. */
  .atlas-shell {
    display: grid;
    flex: 1 0 auto;
    grid-template-columns: var(--atlas-sidebar-width) minmax(0, 1fr);
    grid-template-areas: "sidebar main";
    column-gap: var(--atlas-shell-gap);
    width: 100%;
    max-width: var(--atlas-shell-max);
    margin-inline: auto;
    padding-inline: var(--atlas-gutter);
  }

  .atlas-shell--no-sidebar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }

  .atlas-shell__sidebar {
    position: sticky;
    inset-block-start: var(--atlas-topbar-height);
    grid-area: sidebar;
    align-self: start;
    max-height: calc(100vh - var(--atlas-topbar-height));
    padding-block: 32px 64px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .atlas-shell__main {
    grid-area: main;
    min-width: 0;
    padding-block: 32px 96px;
  }

  .atlas-article {
    max-width: var(--atlas-content-width);
    min-width: 0;
  }

  .atlas-article--wide {
    max-width: var(--atlas-wide-width);
  }

  @media (max-width: 1023.98px) {
    .atlas-shell {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas: "main";
    }

    .atlas-shell__sidebar {
      display: none;
    }
  }
}

/* ==========================================================================================================
   COMPONENTS
   ========================================================================================================== */
@layer components {
  /* --- Icons (snippets/icon.liquid) --- */
  .atlas-icon {
    flex: none;
    width: var(--atlas-icon-size, 1.25em);
    height: var(--atlas-icon-size, 1.25em);
  }

  [dir="rtl"] .atlas-icon--flip-rtl {
    transform: scaleX(-1);
  }

  /* --- Small labels: mono uppercase micro-labels for navigation metadata (R§1.4, R§10) --- */
  .atlas-label {
    font-family: var(--atlas-font-mono);
    font-size: var(--atlas-text-xs);
    font-weight: var(--atlas-weight-semibold);
    letter-spacing: var(--atlas-tracking-wide);
    text-transform: uppercase;
    color: var(--atlas-text-faint);
  }

  .atlas-eyebrow {
    margin-block-end: var(--atlas-space-md);
    font-family: var(--atlas-font-mono);
    font-size: var(--atlas-text-sm);
    letter-spacing: var(--atlas-tracking-wide);
    text-transform: uppercase;
    color: var(--atlas-text-faint);
  }

  .atlas-display {
    font-size: var(--atlas-heading-2xl);
    line-height: var(--atlas-leading-heading-xl);
    letter-spacing: var(--atlas-tracking-display);
  }

  .atlas-title {
    font-size: var(--atlas-heading-lg);
    line-height: var(--atlas-leading-heading-lg);
    letter-spacing: var(--atlas-tracking-tighter);
  }

  .atlas-lede {
    margin-block-end: var(--atlas-space-2xl);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-lg);
    line-height: var(--atlas-leading-relaxed);
  }

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

  /* --- Buttons (R§4.19): primary is ink, never the accent ---
     .atlas-button--primary | --secondary | --tertiary | --ghost | --text, sizes --sm | --lg.
     The radius follows the theme's button shape (--atlas-radius-button). */
  .atlas-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375em;
    min-height: 2.5rem;
    padding: 0.5em 1em;
    border: 1px solid transparent;
    border-radius: var(--atlas-radius-button);
    background: transparent;
    color: var(--atlas-text);
    font-size: var(--atlas-text-sm);
    font-weight: var(--atlas-weight-semibold);
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--atlas-duration-normal) var(--atlas-ease), border-color var(--atlas-duration-normal) var(--atlas-ease), color var(--atlas-duration-normal) var(--atlas-ease);
  }

  .atlas-button .atlas-icon {
    --atlas-icon-size: 1.15em;
  }

  .atlas-button--primary {
    border-color: var(--atlas-primary-button);
    background: var(--atlas-primary-button);
    color: var(--atlas-primary-button-label);
  }

  .atlas-button--primary:hover {
    border-color: var(--atlas-primary-button-hover);
    background: var(--atlas-primary-button-hover);
    color: var(--atlas-primary-button-label);
  }

  .atlas-button--secondary {
    border-color: var(--atlas-border);
    background: var(--atlas-secondary-button);
    color: var(--atlas-secondary-button-label);
  }

  .atlas-button--secondary:hover {
    border-color: var(--atlas-border-strong);
    background: var(--atlas-secondary-button-hover);
    color: var(--atlas-secondary-button-label);
  }

  .atlas-button--tertiary {
    border-color: var(--atlas-border-strong);
    color: var(--atlas-text);
  }

  .atlas-button--tertiary:hover {
    background: var(--atlas-state-hover);
    color: var(--atlas-text);
  }

  .atlas-button--ghost:hover {
    background: var(--atlas-state-hover);
    color: var(--atlas-text);
  }

  .atlas-button--text {
    min-height: 0;
    padding: 0;
    font-size: var(--atlas-text-lg);
  }

  .atlas-button--text:hover {
    color: var(--atlas-accent);
  }

  .atlas-button--sm {
    min-height: 2rem;
    font-size: var(--atlas-text-xs);
  }

  .atlas-button--lg {
    min-height: 3rem;
    padding-inline: 1.25em;
    font-size: var(--atlas-text-md);
  }

  .atlas-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--atlas-space-sm) var(--atlas-space-md);
  }

  /* --- Icon buttons: 36px, with a 44px invisible tap target (R§4.19, R§9) --- */
  .atlas-icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--atlas-radius-xs);
    background: transparent;
    color: var(--atlas-text-secondary);
    text-decoration: none;
    transition: background-color var(--atlas-duration-fast) var(--atlas-ease), color var(--atlas-duration-fast) var(--atlas-ease), border-color var(--atlas-duration-fast) var(--atlas-ease);
  }

  .atlas-icon-button::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }

  .atlas-icon-button:hover {
    background: var(--atlas-state-hover);
    color: var(--atlas-text);
  }

  .atlas-icon-button--bordered {
    width: 34px;
    height: 34px;
    border-color: var(--atlas-border);
    border-radius: var(--atlas-radius-sm);
  }

  .atlas-icon-button--bordered:hover {
    border-color: var(--atlas-border-strong);
  }

  /* --- Badges (R§4.18; the version badge R§3.3) --- */
  .atlas-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 2px 6px;
    border: 1px solid var(--atlas-border);
    border-radius: var(--atlas-radius-xs);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-xs);
    font-weight: var(--atlas-weight-semibold);
    line-height: 1.4;
    white-space: nowrap;
  }

  .atlas-badge--version {
    padding: 2px 4px;
    font-family: var(--atlas-font-mono);
  }

  /* --- Prose: rendered Markdown (R§1.4, R§1.5) ---
     Paragraphs and lists are the muted body colour; headings and bold are bright. Block rhythm: 0.875rem
     after a paragraph, list or quote, 1.5rem after any other block, 2.75rem above an h2 and around a rule.
     Components drawn over the filter's markup (callouts, code, tabs, steps, …) extend this block. */
  .atlas-prose {
    min-width: 0;
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-md);
    line-height: var(--atlas-leading-relaxed);
    overflow-wrap: break-word;
  }

  .atlas-prose > * {
    margin-block: 0 var(--atlas-space-lg);
  }

  .atlas-prose > :is(p, ul, ol, blockquote) {
    margin-block-end: 0.875rem;
  }

  .atlas-prose > :last-child {
    margin-block-end: 0;
  }

  .atlas-prose :is(h2, h3, h4, h5, h6) {
    color: var(--atlas-text);
  }

  .atlas-prose h2 {
    margin-block: 2.75rem 0.5rem;
    font-size: var(--atlas-heading-sm);
    line-height: var(--atlas-leading-heading-sm);
    letter-spacing: var(--atlas-tracking-tight);
  }

  .atlas-prose h3 {
    margin-block: 2rem 0.5rem;
    font-size: var(--atlas-heading-xs);
    line-height: var(--atlas-leading-heading-xs);
    letter-spacing: var(--atlas-tracking-tight);
  }

  .atlas-prose :is(h4, h5, h6) {
    margin-block: 1.5rem 0.5rem;
    font-size: var(--atlas-text-md);
    font-weight: var(--atlas-weight-semibold);
  }

  .atlas-prose > :is(h2, h3, h4, h5, h6):first-child {
    margin-block-start: 0;
  }

  .atlas-prose :is(strong, b) {
    color: var(--atlas-text);
  }

  .atlas-prose a {
    color: var(--atlas-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }

  .atlas-prose a:hover {
    color: var(--atlas-accent-hover);
    text-decoration-thickness: 2px;
  }

  .atlas-prose :is(ul, ol) {
    padding-inline-start: 1.5rem;
  }

  .atlas-prose li + li,
  .atlas-prose li > :is(ul, ol) {
    margin-block-start: 0.375rem;
  }

  .atlas-prose li::marker {
    color: var(--atlas-text-faint);
  }

  .atlas-prose > hr {
    margin-block: 2.75rem;
  }

  .atlas-prose blockquote {
    padding-inline-start: var(--atlas-space-md);
    border-inline-start: 3px solid var(--atlas-border-strong);
  }

  .atlas-prose img {
    border-radius: var(--atlas-radius-md);
  }

  /* Code blocks are a dark slab in both modes (R§1.3); headers, copy, highlights and tabs are layered on top. */
  .atlas-prose pre {
    max-width: var(--atlas-content-width);
    padding: var(--atlas-space-md) 1.25rem;
    overflow-x: auto;
    border: 1px solid var(--atlas-code-border);
    border-radius: var(--atlas-radius-md);
    background: var(--atlas-code-background);
    color: var(--atlas-code-text);
    font-size: var(--atlas-text-sm);
    line-height: 1.5;
    tab-size: 2;
    scrollbar-width: thin;
  }

  .atlas-prose table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--atlas-text-sm);
    line-height: var(--atlas-leading-normal);
  }

  .atlas-prose :is(th, td) {
    padding: 0.625rem var(--atlas-space-md);
    border-block-end: 1px solid var(--atlas-border);
    text-align: start;
    vertical-align: top;
  }

  .atlas-prose th {
    background: var(--atlas-surface);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-xs);
    font-weight: var(--atlas-weight-semibold);
  }

  /* A wrapper a component may put around a wide block so the page itself never scrolls sideways. */
  .atlas-scroll-x {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  /* --- Header bar (R§3.3); the section wrapper is the sticky element, so stickiness spans the page --- */
  .atlas-topbar {
    display: flex;
    align-items: center;
    gap: var(--atlas-space-md);
    height: var(--atlas-topbar-height);
    /* Full-width bar, contents on the shell's edges: past the 1536px shell the logo lines up with the sidebar and
       the controls with the page's end, as the footer does. */
    padding-inline: max(var(--atlas-gutter), calc((100% - var(--atlas-shell-max)) / 2 + var(--atlas-gutter)));
    border-block-end: 1px solid var(--atlas-border);
    background: var(--atlas-background);
    color: var(--atlas-text);
  }

  .atlas-topbar__start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .atlas-topbar__end {
    display: flex;
    align-items: center;
    gap: var(--atlas-space-sm);
    margin-inline-start: auto;
  }

  .atlas-topbar__menu {
    display: none;
  }

  .atlas-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--atlas-text);
    font-family: var(--atlas-font-heading);
    font-size: 1.25rem;
    font-weight: var(--atlas-weight-bold);
    letter-spacing: var(--atlas-tracking-tight);
    text-decoration: none;
  }

  .atlas-brand:hover {
    color: var(--atlas-text);
  }

  .atlas-brand__logo {
    width: auto;
    height: var(--atlas-logo-height, 28px);
  }

  .atlas-brand__name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .atlas-logo--dark,
  [data-mode="dark"] .atlas-logo--light {
    display: none;
  }

  [data-mode="dark"] .atlas-logo--dark {
    display: block;
  }

  .atlas-topbar__links {
    display: flex;
    align-items: center;
    gap: var(--atlas-space-xs);
  }

  .atlas-topbar__link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding-inline: var(--atlas-space-sm);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-sm);
    font-weight: var(--atlas-weight-semibold);
    text-decoration: none;
    transition: color var(--atlas-duration-fast) var(--atlas-ease);
  }

  .atlas-topbar__link:hover,
  .atlas-topbar__link[aria-current="page"] {
    color: var(--atlas-text);
  }

  /* The search trigger: a button that the search overlay answers (R§3.3). */
  .atlas-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--atlas-space-sm);
    height: 34px;
    min-width: 34px;
    padding-inline: 10px 6px;
    border: 1px solid var(--atlas-border);
    border-radius: var(--atlas-radius-sm);
    background: var(--atlas-surface);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-sm);
    text-decoration: none;
    transition: border-color var(--atlas-duration-fast) var(--atlas-ease), color var(--atlas-duration-fast) var(--atlas-ease);
  }

  .atlas-search-trigger:hover {
    border-color: var(--atlas-border-strong);
    color: var(--atlas-text);
  }

  .atlas-search-trigger .atlas-icon {
    --atlas-icon-size: 16px;
  }

  .atlas-search-trigger__label {
    white-space: nowrap;
  }

  .atlas-search-trigger__kbd {
    margin-inline-start: var(--atlas-space-xs);
    border-color: var(--atlas-border-strong);
    background: transparent;
  }

  /* The mode toggle shows the mode it switches TO: a sun in dark mode, a moon in light mode (R§3.3). */
  .atlas-mode-toggle .atlas-icon {
    --atlas-icon-size: 22px;
  }

  .atlas-mode-toggle__sun,
  [data-mode="dark"] .atlas-mode-toggle__moon {
    display: none;
  }

  [data-mode="dark"] .atlas-mode-toggle__sun {
    display: block;
  }

  @media (max-width: 1023.98px) {
    .atlas-topbar__menu {
      display: inline-grid;
    }
  }

  @media (max-width: 899.98px) {
    .atlas-search-trigger {
      justify-content: center;
      width: 34px;
      padding: 0;
    }

    .atlas-search-trigger__label,
    .atlas-search-trigger__kbd {
      display: none;
    }
  }

  @media (max-width: 639.98px) {
    .atlas-topbar__nav {
      display: none;
    }
  }

  @media (max-width: 379.98px) {
    .atlas-badge--version {
      display: none;
    }
  }

  /* --- Language switcher --- */
  .atlas-language form {
    display: flex;
    align-items: center;
    gap: var(--atlas-space-xs);
  }

  .atlas-language__select {
    height: 34px;
    max-width: 9rem;
    padding-inline: var(--atlas-space-sm);
    border: 1px solid var(--atlas-border);
    border-radius: var(--atlas-radius-sm);
    background: var(--atlas-background);
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-sm);
  }

  /* --- Announcement bar (R§3.2): not sticky, scrolls away --- */
  .atlas-announcement {
    position: relative;
    padding: var(--atlas-space-sm) 48px;
    border-block-end: 1px solid var(--atlas-border);
    font-size: var(--atlas-text-sm);
    text-align: center;
  }

  .atlas-announcement.atlas-surface--accent {
    border-block-end-color: var(--atlas-accent-border);
  }

  .atlas-announcement__link {
    color: var(--atlas-accent);
    font-weight: var(--atlas-weight-semibold);
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

  .atlas-announcement__dismiss {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: var(--atlas-space-sm);
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
  }

  .atlas-announcement__dismiss .atlas-icon {
    --atlas-icon-size: 16px;
  }

  .atlas-announcement__dismiss:hover {
    background: transparent;
    opacity: 0.75;
  }

  /* --- Documentation sidebar (R§3.4; snippets/docs-sidebar) --- */
  .atlas-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--atlas-space-lg);
    font-size: var(--atlas-text-sm);
  }

  .atlas-sidebar__list {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .atlas-sidebar__label {
    display: block;
    margin-block-end: var(--atlas-space-xs);
    padding-inline: var(--atlas-space-sm);
    font-family: var(--atlas-font-mono);
    font-size: var(--atlas-text-xs);
    font-weight: var(--atlas-weight-semibold);
    letter-spacing: var(--atlas-tracking-wide);
    line-height: 1.75;
    text-transform: uppercase;
    color: var(--atlas-text-faint);
  }

  .atlas-sidebar__group--collapsible > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--atlas-space-sm);
    border-radius: var(--atlas-radius-xs);
    cursor: pointer;
    list-style: none;
  }

  .atlas-sidebar__group--collapsible > summary::-webkit-details-marker {
    display: none;
  }

  .atlas-sidebar__group--collapsible > summary:hover {
    color: var(--atlas-text);
  }

  .atlas-sidebar__group--collapsible:not([open]) > summary {
    margin-block-end: 0;
  }

  .atlas-sidebar__chevron {
    --atlas-icon-size: 12px;
    transition: transform var(--atlas-duration-fast) var(--atlas-ease-toggle);
  }

  .atlas-sidebar__group--collapsible[open] > summary .atlas-sidebar__chevron {
    transform: rotate(180deg);
  }

  .atlas-sidebar__link {
    display: block;
    padding: var(--atlas-space-xs) var(--atlas-space-sm);
    border-radius: var(--atlas-radius-xs);
    color: var(--atlas-text-secondary);
    line-height: 1.5rem;
    text-decoration: none;
    transition: background-color var(--atlas-duration-fast) var(--atlas-ease), color var(--atlas-duration-fast) var(--atlas-ease);
  }

  .atlas-sidebar__link:hover {
    background: var(--atlas-state-hover);
    color: var(--atlas-text);
  }

  /* The current page: the highlight fill and its ink (Canvas: pink under black). */
  .atlas-sidebar__link[aria-current="page"] {
    background: var(--atlas-highlight);
    color: var(--atlas-highlight-label);
    font-weight: var(--atlas-weight-semibold);
  }

  .atlas-sidebar__list--nested {
    margin-block-start: 1px;
    margin-inline-start: var(--atlas-space-md);
    border-inline-start: 1px solid var(--atlas-border);
  }

  .atlas-sidebar__list--nested .atlas-sidebar__link {
    padding-inline-start: var(--atlas-space-md);
    border-start-start-radius: 0;
    border-end-start-radius: 0;
  }

  /* --- Drawer (R§7.4): the sidebar as a modal panel under 1024px; assets/atlas.js drives it, and without
     scripts it opens as the URL's :target. --- */
  .atlas-drawer {
    display: none;
  }

  @media (max-width: 1023.98px) {
    .atlas-drawer {
      position: fixed;
      inset: 0;
      z-index: var(--atlas-z-drawer);
      display: block;
      visibility: hidden;
      pointer-events: none;
      transition: visibility 0s linear var(--atlas-duration-normal);
    }

    .atlas-drawer.is-open,
    .atlas-drawer:target {
      visibility: visible;
      pointer-events: auto;
      transition-delay: 0s;
    }

    .atlas-drawer__scrim {
      position: absolute;
      inset: 0;
      background: var(--atlas-overlay);
      opacity: 0;
      transition: opacity var(--atlas-duration-normal) var(--atlas-ease);
    }

    .atlas-drawer.is-open .atlas-drawer__scrim,
    .atlas-drawer:target .atlas-drawer__scrim {
      opacity: 1;
    }

    .atlas-drawer__panel {
      position: absolute;
      inset-block: 0;
      inset-inline-start: 0;
      display: flex;
      flex-direction: column;
      width: min(20rem, 84vw);
      border-inline-end: 1px solid var(--atlas-border);
      background: var(--atlas-background);
      color: var(--atlas-text);
      transform: translateX(-100%);
      transition: transform var(--atlas-duration-normal) var(--atlas-ease);
    }

    [dir="rtl"] .atlas-drawer__panel {
      transform: translateX(100%);
    }

    .atlas-drawer.is-open .atlas-drawer__panel,
    .atlas-drawer:target .atlas-drawer__panel {
      transform: none;
    }

    .atlas-drawer__panel:focus {
      outline: none;
    }
  }

  .atlas-drawer__head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    height: var(--atlas-topbar-height);
    padding-inline: var(--atlas-space-md);
    border-block-end: 1px solid var(--atlas-border);
  }

  .atlas-drawer__title {
    margin: 0;
  }

  .atlas-drawer__body {
    flex: 1;
    padding: var(--atlas-space-md);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* --- Footer (R§3.11) --- */
  .atlas-footer {
    border-block-start: 1px solid var(--atlas-border);
  }

  .atlas-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--atlas-space-md) var(--atlas-space-lg);
    max-width: var(--atlas-shell-max);
    margin-inline: auto;
    padding: var(--atlas-space-lg) var(--atlas-gutter);
  }

  .atlas-footer__text {
    color: var(--atlas-text-faint);
    font-size: var(--atlas-text-sm);
  }

  .atlas-footer__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--atlas-space-sm) var(--atlas-space-lg);
  }

  .atlas-footer__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--atlas-space-sm) var(--atlas-space-lg);
  }

  .atlas-footer__links--icons {
    gap: var(--atlas-space-xs);
  }

  /* The built with in1s line: its own last row, the small print's muted type, its link a footer link. */
  .atlas-footer__built {
    flex-basis: 100%;
  }

  .atlas-footer__built-link {
    gap: var(--atlas-space-xs);
    --atlas-icon-size: 1em;
  }

  /* Text links a finger reaches: at least the 24px target of WCAG 2.5.8, without changing how they look. */
  .atlas-footer__link,
  .atlas-inline-links a {
    display: inline-flex;
    align-items: center;
    min-height: var(--atlas-target-min);
  }

  .atlas-footer__link {
    color: var(--atlas-text-secondary);
    font-size: var(--atlas-text-sm);
    text-decoration: none;
  }

  .atlas-footer__link:hover,
  .atlas-footer__link[aria-current="page"] {
    color: var(--atlas-text);
  }

  .atlas-footer__links--icons .atlas-icon-button {
    border-radius: var(--atlas-radius-sm);
  }

  .atlas-footer__links--icons .atlas-icon-button:hover {
    background: var(--atlas-muted);
  }

  @media (max-width: 639.98px) {
    .atlas-footer__text {
      flex-basis: 100%;
    }
  }

  /* --- Inline link rows (the 404's most-read pages) --- */
  .atlas-inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--atlas-space-sm) var(--atlas-space-lg);
  }

  .atlas-inline-links a {
    color: var(--atlas-accent);
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

  /* --- Form fields (snippets/form-fields, form-repeater-row; the password page) --- */
  .atlas-field-label,
  .form-field__label {
    display: block;
    margin-block-end: var(--atlas-space-xs);
    color: var(--atlas-text);
    font-size: var(--atlas-text-sm);
    font-weight: var(--atlas-weight-semibold);
  }

  .atlas-input,
  .form-field__input,
  .form-field__select,
  .form-field__textarea,
  .form-field__file {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--atlas-border-strong);
    border-radius: var(--atlas-radius-md);
    background: var(--atlas-background);
    color: var(--atlas-text);
    line-height: 1.4;
    transition: border-color var(--atlas-duration-fast) var(--atlas-ease);
  }

  .form-field__textarea {
    min-height: 8rem;
    resize: vertical;
  }

  :is(.atlas-input, .form-field__input, .form-field__select, .form-field__textarea):hover {
    border-color: var(--atlas-text-faint);
  }

  :is(.atlas-input, .form-field__input, .form-field__select, .form-field__textarea)[aria-invalid="true"] {
    border-color: var(--atlas-danger);
  }

  .form-field {
    margin-block-end: var(--atlas-space-md);
  }

  .form-field__required,
  .form-field__error {
    color: var(--atlas-danger);
  }

  .form-field__error {
    margin-block-start: var(--atlas-space-xs);
    font-size: var(--atlas-text-sm);
  }

  .form-field__info,
  .form-field__calculated {
    margin-block-start: var(--atlas-space-xs);
    color: var(--atlas-text-faint);
    font-size: var(--atlas-text-sm);
  }

  .form-field__checkbox-group,
  .form-field__radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--atlas-space-sm);
  }

  :is(.form-field__checkbox-option, .form-field__radio-option, .form-field__checkbox-label) {
    display: flex;
    align-items: center;
    gap: var(--atlas-space-sm);
    color: var(--atlas-text-secondary);
  }

  :is(.form-field__checkbox-option, .form-field__radio-option, .form-field__checkbox-label) input {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--atlas-primary-button);
  }

  .form-field__repeater-rows {
    display: flex;
    flex-direction: column;
    gap: var(--atlas-space-sm);
  }

  .form-field__repeater-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--atlas-space-sm);
  }

  .form-field__repeater-cell {
    flex: 1 1 10rem;
  }

  /* --- Editor-only notes (shown to the owner in the theme editor) --- */
  .atlas-editor-note {
    padding: var(--atlas-space-md);
    border: 1px dashed var(--atlas-border-strong);
    border-radius: var(--atlas-radius-md);
    color: var(--atlas-text-faint);
    font-size: var(--atlas-text-sm);
  }
}

/* ==========================================================================================================
   SECTIONS — one block per section file
   ========================================================================================================== */
@layer sections {
  /* --- header.liquid: the wrapper the platform draws around the section is the sticky element --- */
  .atlas-topbar-section {
    position: sticky;
    inset-block-start: 0;
    z-index: var(--atlas-z-topbar);
  }

  /* --- main-404.liquid (R§5.6) --- */
  .atlas-notfound {
    padding-block: var(--atlas-space-2xl) var(--atlas-space-xl);
  }

  .atlas-notfound .atlas-display {
    margin-block-end: var(--atlas-space-lg);
  }

  .atlas-notfound .atlas-lede {
    margin-block-end: var(--atlas-space-xl);
  }

  .atlas-notfound__popular {
    margin-block-start: var(--atlas-space-2xl);
    padding-block-start: var(--atlas-space-lg);
    border-block-start: 1px solid var(--atlas-border);
  }

  .atlas-notfound__popular-label {
    margin-block-end: var(--atlas-space-sm);
    color: var(--atlas-text-faint);
    font-size: var(--atlas-text-sm);
  }

  /* --- layout/password.liquid --- */
  .atlas-gate {
    display: grid;
    flex: 1 0 auto;
    place-items: center;
    padding: var(--atlas-space-2xl) var(--atlas-gutter);
    background: var(--atlas-surface);
  }

  .atlas-gate:focus {
    outline: none;
  }

  .atlas-gate__card {
    width: min(100%, 28rem);
    padding: var(--atlas-space-xl);
    border: 1px solid var(--atlas-border);
    border-radius: var(--atlas-radius-xl);
    background: var(--atlas-background);
  }

  .atlas-gate__title {
    margin-block-end: var(--atlas-space-sm);
    font-size: var(--atlas-heading-sm);
    line-height: var(--atlas-leading-heading-sm);
    letter-spacing: var(--atlas-tracking-tight);
  }

  .atlas-gate__text {
    margin-block-end: var(--atlas-space-lg);
    color: var(--atlas-text-secondary);
  }

  .atlas-gate__form {
    display: flex;
    flex-direction: column;
    gap: var(--atlas-space-sm);
  }

  .atlas-gate__form .atlas-field-label {
    margin-block-end: 0;
  }

  .atlas-gate__error {
    color: var(--atlas-danger);
    font-size: var(--atlas-text-sm);
  }
}

/* ==========================================================================================================
   UTILITIES
   ========================================================================================================== */
@layer utilities {
  .atlas-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  /* A control that needs scripts stays hidden until the head script marks <html class="atlas-js">. */
  html:not(.atlas-js) [data-atlas-js] {
    display: none !important;
  }

  /* Responsive visibility, named by the condition under which the element shows. */
  @media (max-width: 1279.98px) {
    .atlas-from-xl { display: none !important; }
  }

  @media (min-width: 1280px) {
    .atlas-below-xl { display: none !important; }
  }

  @media (max-width: 1023.98px) {
    .atlas-from-lg { display: none !important; }
  }

  @media (min-width: 1024px) {
    .atlas-below-lg { display: none !important; }
  }

  @media (max-width: 639.98px) {
    .atlas-from-sm { display: none !important; }
  }

  @media (min-width: 640px) {
    .atlas-below-sm { display: none !important; }
  }

  /* While a modal (drawer, search) is open: assets/atlas.js sets it and pads for the lost scrollbar. */
  html.atlas-scroll-locked,
  html.atlas-scroll-locked body {
    overflow: hidden;
  }

  /* Reduced motion: every transition and animation off, including hover lifts (R§1.5, R§9). */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      transition-delay: 0s !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ==========================================================================================================
   PRINT (R§8): A4, chrome hidden, black on white. Tokens are overridden with !important because the scheme
   values come from an unlayered style block, which a layered rule can only beat that way. Every surface
   token is overridden, so no callout or panel prints dark; code inverts to black on white.
   Mark anything else that must not print with [data-atlas-no-print] or .atlas-no-print.
   ========================================================================================================== */
@layer print {
  @media print {
    @page {
      size: A4;
      margin: 18mm 16mm 20mm;
    }

    :root,
    [data-mode],
    .atlas-surface--inverse {
      color-scheme: light !important;
      --atlas-background: #ffffff !important;
      --atlas-surface: #ffffff !important;
      --atlas-muted: #f2f2f2 !important;
      --atlas-border: #bbbbbb !important;
      --atlas-border-strong: #999999 !important;
      --atlas-text: #000000 !important;
      --atlas-text-secondary: #222222 !important;
      --atlas-text-faint: #444444 !important;
      --atlas-accent: #000000 !important;
      --atlas-accent-surface: #ffffff !important;
      --atlas-accent-border: #999999 !important;
      --atlas-highlight: #ffffff !important;
      --atlas-highlight-label: #000000 !important;
      --atlas-primary-button: #000000 !important;
      --atlas-primary-button-label: #ffffff !important;
      --atlas-secondary-button: #ffffff !important;
      --atlas-secondary-button-label: #000000 !important;
      --atlas-success: #000000 !important;
      --atlas-warning: #000000 !important;
      --atlas-danger: #000000 !important;
      --atlas-code-background: #ffffff !important;
      --atlas-code-text: #000000 !important;
      --atlas-code-border: #bbbbbb !important;
      --atlas-code-highlight: #eeeeee !important;
      --atlas-code-muted: #444444 !important;
      --atlas-state-hover: transparent !important;
      --atlas-success-subtle: #ffffff !important;
      --atlas-warning-subtle: #ffffff !important;
      --atlas-danger-subtle: #ffffff !important;
      --atlas-success-border: #999999 !important;
      --atlas-warning-border: #999999 !important;
      --atlas-danger-border: #999999 !important;
    }

    html,
    body {
      background: #ffffff !important;
      color: #000000 !important;
    }

    .atlas-skip-link,
    .atlas-announcement-section,
    .atlas-topbar-section,
    .atlas-footer-section,
    .atlas-shell__sidebar,
    .atlas-drawer,
    .atlas-no-print,
    [data-atlas-no-print],
    [data-atlas-js] {
      display: none !important;
    }

    .atlas-shell {
      display: block !important;
      max-width: none !important;
      padding: 0 !important;
    }

    .atlas-shell__main {
      padding: 0 !important;
    }

    .atlas-article,
    .atlas-prose,
    .atlas-prose pre,
    .atlas-container {
      width: auto !important;
      max-width: none !important;
    }

    .atlas-prose a[href^="http"]::after {
      content: " (" attr(href) ")";
      color: #444444;
      font-size: 0.85em;
      word-break: break-all;
    }

    h1, h2, h3 {
      break-after: avoid;
    }

    pre, table, figure, details, dl, blockquote,
    .markdown-alert {
      break-inside: avoid;
    }

    details::details-content {
      display: block;
      content-visibility: visible;
    }
  }
}
