/*
 * ERICADE Radio API — shared stylesheet for every page on api.ericade.net: the portal (/index.htm), the
 * reference pages under /docs/, /radio/index.htm, the error documents (/400.html … /503.html) and /down.html.
 *
 * Usage:  <link rel="stylesheet" href="/assets/css/ericade.css">   (root-relative: an error document is
 *         served at whatever path failed, so a relative href would not resolve)
 *
 * This is a port of the Moleant web design system (api.moleant.com, /assets/css/moleant.css), so the two
 * sites look alike. It differs from the original in three ways only, which keeps a later change there
 * easy to carry over:
 *   - the brand tokens are named --er-* instead of --mo-*; the values are the same;
 *   - the brand is a text wordmark (.brand__name, .site-footer__brand) - there is no logo image;
 *   - everything marked "ERICADE addition" below: .method-ws, .card--link, .page-fill, the error pages
 *     (.error-page), .doc-footer and the print rules that lay out docs/ericade-api-v2.pdf.
 *
 * Contents
 *   1. Fonts           Self-hosted Poppins (SIL OFL 1.1, see /assets/fonts/OFL.txt). No third-party requests.
 *   2. Design tokens   Brand palette, semantic colours, type, spacing, shape. Pages and components use the
 *                      semantic --color-* tokens only, so light/dark mode and dark sections work automatically.
 *   3. Themes          Light by default; dark follows prefers-color-scheme, or force it with
 *                      <html data-theme="dark|light">. Add class "on-dark" to any section with a dark
 *                      background (header, hero, footer) to re-map the tokens inside it.
 *   4. Base            Element defaults (typography, links, code, tables, focus).
 *   5. Accessibility   .visually-hidden, .skip-link.
 *   6. Layout          .container, .section, .grid, .split, .stack, .cluster.
 *   7. Components      Header, nav, buttons, hero, facts, cards, steps, checklist, callouts, code samples,
 *                      tables, method badges, endpoint URLs, FAQ, footer, link cards, error pages.
 *   8. Documentation   Classes used by the API reference pages: callouts (.note, .warning, .internal,
 *                      .deprecated), .endpoint-url, .method-*, and the page layout (.doc, .doc-header,
 *                      .doc-toc, .doc-footer, .endpoint).
 *   9. Utilities, reduced motion, print (including the layout of the documentation PDF).
 */

/* 1. Fonts ------------------------------------------------------------------------------------------ */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-latin-700.woff2") format("woff2");
}

/* 2. Design tokens ---------------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Brand (the palette of the Moleant design system this stylesheet is a port of) */
  --er-purple: #9305b8;
  --er-purple-600: #76049a;
  --er-purple-300: #d59bea;
  --er-purple-50: #f6ebfa;
  --er-gold: #d4ac50;
  --er-gold-300: #e6c77f;
  --er-gold-50: #fbf5e6;
  --er-slate: #7d8ead;
  --er-ink: #0c111d;
  --er-ink-800: #141b2d;
  --er-ink-700: #1e2740;

  /* Neutrals */
  --er-gray-50: #f7f8fb;
  --er-gray-100: #eef1f6;
  --er-gray-200: #e2e6ef;
  --er-gray-300: #cbd2df;
  --er-gray-400: #9aa3b5;
  --er-gray-500: #6b7488;
  --er-gray-600: #4f576a;
  --er-gray-700: #373e4f;
  --er-gray-900: #121725;

  /* Semantic colours: light */
  --color-bg: var(--er-gray-50);
  --color-surface: #fff;
  --color-surface-alt: var(--er-gray-100);
  --color-text: var(--er-gray-900);
  --color-text-muted: var(--er-gray-600);
  --color-heading: var(--er-ink);
  --color-border: var(--er-gray-200);
  --color-border-strong: var(--er-gray-300);
  --color-link: var(--er-purple);
  --color-link-hover: var(--er-purple-600);
  --color-accent: var(--er-purple);
  --color-accent-hover: var(--er-purple-600);
  --color-accent-contrast: #fff;
  --color-accent-soft: var(--er-purple-50);
  --color-accent-strong: var(--er-purple);
  --color-eyebrow: var(--er-purple);
  --color-focus: var(--er-purple);
  --color-row-hover: var(--er-gray-50);
  --color-inline-code-bg: var(--er-gray-100);
  --color-code-bg: var(--er-ink-800);
  --color-code-bar: #0f1524;
  --color-code-border: #222b41;
  --color-code-text: #e6e9f2;
  --color-code-muted: #aab3c7;
  --color-info: #1d5fa8;
  --color-info-bg: #eaf2fb;
  --color-note: #9a5b00;
  --color-note-bg: #fff6e5;
  --color-warning: #b42318;
  --color-warning-bg: #fdeceb;
  --color-success: #1f7a4d;
  --color-success-bg: #e8f5ee;
  --color-neutral: var(--er-gray-600);
  --color-neutral-bg: var(--er-gray-100);

  /* Typography */
  --font-sans: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.2rem, 1.1rem + 0.45vw, 1.4rem);
  --text-2xl: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
  --text-3xl: clamp(2.1rem, 1.55rem + 2.4vw, 3.4rem);
  --leading-tight: 1.2;
  --leading-normal: 1.65;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --section-space: clamp(3.5rem, 2rem + 5vw, 6rem);

  /* Shape and depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(12 17 29 / 0.06);
  --shadow: 0 1px 3px rgb(12 17 29 / 0.08), 0 8px 24px rgb(12 17 29 / 0.06);

  /* Layout */
  --container: 72rem;
  --container-narrow: 46rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --header-height: 4rem;
}

/* 3. Themes ----------------------------------------------------------------------------------------- */

/* Dark tokens, applied by the OS preference, by data-theme="dark", and inside .on-dark sections. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: var(--er-ink);
    --color-surface: var(--er-ink-800);
    --color-surface-alt: #111829;
    --color-text: #e6e9f2;
    --color-text-muted: #a9b1c3;
    --color-heading: #fff;
    --color-border: #26304a;
    --color-border-strong: #34405f;
    --color-link: var(--er-purple-300);
    --color-link-hover: #ecd2f5;
    --color-accent-soft: rgb(213 155 234 / 0.12);
    --color-accent-strong: var(--er-purple-300);
    --color-eyebrow: var(--er-gold);
    --color-focus: var(--er-gold);
    --color-row-hover: #182036;
    --color-inline-code-bg: #1b2336;
    --color-info: #7fb0ea;
    --color-info-bg: rgb(127 176 234 / 0.1);
    --color-note: #e6c77f;
    --color-note-bg: rgb(230 199 127 / 0.1);
    --color-warning: #f19a92;
    --color-warning-bg: rgb(241 154 146 / 0.1);
    --color-success: #7fd1a8;
    --color-success-bg: rgb(127 209 168 / 0.1);
    --color-neutral: #a9b1c3;
    --color-neutral-bg: rgb(169 177 195 / 0.1);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: var(--er-ink);
  --color-surface: var(--er-ink-800);
  --color-surface-alt: #111829;
  --color-text: #e6e9f2;
  --color-text-muted: #a9b1c3;
  --color-heading: #fff;
  --color-border: #26304a;
  --color-border-strong: #34405f;
  --color-link: var(--er-purple-300);
  --color-link-hover: #ecd2f5;
  --color-accent-soft: rgb(213 155 234 / 0.12);
  --color-accent-strong: var(--er-purple-300);
  --color-eyebrow: var(--er-gold);
  --color-focus: var(--er-gold);
  --color-row-hover: #182036;
  --color-inline-code-bg: #1b2336;
  --color-info: #7fb0ea;
  --color-info-bg: rgb(127 176 234 / 0.1);
  --color-note: #e6c77f;
  --color-note-bg: rgb(230 199 127 / 0.1);
  --color-warning: #f19a92;
  --color-warning-bg: rgb(241 154 146 / 0.1);
  --color-success: #7fd1a8;
  --color-success-bg: rgb(127 209 168 / 0.1);
  --color-neutral: #a9b1c3;
  --color-neutral-bg: rgb(169 177 195 / 0.1);
}

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

/* A section with a dark (ink) background, in either theme. */
.on-dark {
  --color-surface: var(--er-ink-800);
  --color-surface-alt: #111829;
  --color-text: #c3cadb;
  --color-text-muted: #9aa3b5;
  --color-heading: #fff;
  --color-border: rgb(255 255 255 / 0.12);
  --color-border-strong: rgb(255 255 255 / 0.22);
  --color-link: var(--er-gold-300);
  --color-link-hover: #fff;
  --color-accent-soft: rgb(213 155 234 / 0.14);
  --color-accent-strong: var(--er-purple-300);
  --color-eyebrow: var(--er-gold);
  --color-focus: var(--er-gold);
  --color-inline-code-bg: rgb(255 255 255 / 0.08);
  color: var(--color-text);
  background-color: var(--er-ink);
}

/* 4. Base ------------------------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4);
  color: var(--color-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); font-weight: 500; }
h4 { font-size: var(--text-lg); font-weight: 500; }

p,
ul,
ol,
dl,
figure,
blockquote {
  margin: 0 0 var(--space-4);
}

p {
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: var(--space-1);
}

strong,
b {
  font-weight: 700;
}

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

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

img,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

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

:not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-inline-code-bg);
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  background: var(--color-code-bg);
  color: var(--color-code-text);
  font-size: var(--text-sm);
  line-height: 1.6;
  tab-size: 2;
  overflow-x: auto;
}

pre code {
  font-size: inherit;
}

a > code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

hr {
  margin: var(--space-6) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

table {
  width: 100%;
  margin: 0 0 var(--space-5);
  border-collapse: collapse;
  font-size: var(--text-sm);
}

caption {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: left;
  caption-side: top;
}

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

thead th {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--color-row-hover);
}

::selection {
  background: var(--er-gold-300);
  color: var(--er-ink);
}

/* 5. Accessibility ---------------------------------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  top: -10rem;
  left: var(--space-4);
  z-index: 1000;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--er-gold);
  color: var(--er-ink);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
  outline-color: #fff;
}

/* 6. Layout ----------------------------------------------------------------------------------------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2 * var(--gutter), var(--container-narrow));
}

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

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

.section__header {
  max-width: 46rem;
  margin-bottom: var(--space-7);
}

.section__header--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  margin-bottom: var(--space-3);
  color: var(--color-eyebrow);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* Responsive card grid: set --grid-min on the element to change the minimum column width. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 16rem)), 1fr));
  gap: var(--space-5);
}

/* minmax(0, 1fr) tracks keep wide content (code, tables) from stretching the grid past the screen. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7);
  align-items: start;
}

@media (min-width: 60rem) {
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stack > * {
  margin-block: 0;
}

.stack > * + * {
  margin-top: var(--stack-space, var(--space-4));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* 7. Components ------------------------------------------------------------------------------------- */

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  background-color: rgb(12 17 29 / 0.94);
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background-color: rgb(12 17 29 / 0.82);
    backdrop-filter: saturate(160%) blur(12px);
  }
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  min-height: var(--header-height);
  padding-block: var(--space-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand img {
  width: auto;
  height: 28px;
}

/* ERICADE addition: the brand is set in type where the original has a logo image. */
.brand__name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
}

.brand__product {
  padding-left: 0.75rem;
  border-left: 1px solid rgb(255 255 255 / 0.25);
  color: var(--er-gold);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a:not(.btn) {
  display: inline-block;
  padding: 0.4rem 0;
  color: #d7dcea;
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:not(.btn):hover,
.site-nav a[aria-current="page"] {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: var(--er-gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}

@media (max-width: 47.99rem) {
  .site-header {
    position: relative;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav ul {
    gap: var(--space-1) var(--space-4);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn svg {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-accent-contrast);
}

.btn--secondary {
  border-color: currentColor;
  background: transparent;
  color: var(--color-link);
}

.btn--secondary:hover {
  background: var(--color-accent-soft);
  color: var(--color-link-hover);
}

.btn--gold {
  background: var(--er-gold);
  color: var(--er-ink);
}

.btn--gold:hover {
  background: var(--er-gold-300);
  color: var(--er-ink);
}

.btn--outline-light {
  border-color: rgb(255 255 255 / 0.45);
  background: transparent;
  color: #fff;
}

.btn--outline-light:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.btn--sm {
  min-height: 2.25rem;
  padding: 0.4rem 1rem;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 2rem + 5vw, 6rem);
}

.hero::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60rem 30rem at 90% -20%, rgb(147 5 184 / 0.38), transparent 60%),
    radial-gradient(44rem 26rem at -10% 120%, rgb(212 172 80 / 0.16), transparent 60%);
  content: "";
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7);
  align-items: center;
}

@media (min-width: 64rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }
}

.hero h1 {
  margin-bottom: var(--space-5);
}

.hero .lead {
  max-width: 38rem;
  color: var(--color-text);
}

.hero__actions {
  margin-top: var(--space-6);
}

.hero__media img {
  width: 100%;
  filter: drop-shadow(0 30px 50px rgb(0 0 0 / 0.45));
}

/* Key facts: a <dl> of short label/value pairs */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 1px;
  margin: var(--space-7) 0 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-border);
}

.facts > div {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
}

.facts dt {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: var(--color-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.facts dd code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

/* Cards */
.card {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.card > :last-child {
  margin-bottom: 0;
}

.card__icon {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: var(--space-4);
  border-radius: 12px;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.card__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.card__kicker {
  margin-bottom: var(--space-1);
  color: var(--color-eyebrow);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card h3 {
  margin-bottom: var(--space-3);
}

.card p,
.card li {
  color: var(--color-text-muted);
}

/* ERICADE addition: a card that is one link, <a class="card card--link" href="…">. */
.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card--link:hover {
  border-color: var(--color-accent-strong);
  box-shadow: var(--shadow);
  color: inherit;
}

.card--link h3 {
  color: var(--color-link);
  font-size: var(--text-lg);
}

/* Numbered steps: use <ol class="steps" role="list"> */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  margin: 0;
  padding: var(--space-6) var(--space-5) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  counter-increment: step;
}

.steps > li::before {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--er-gold);
  color: var(--er-ink);
  content: counter(step);
  font-weight: 700;
}

.steps h3 {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.steps p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Checklist: use <ul class="checklist" role="list"> */
.checklist {
  display: grid;
  gap: var(--space-3);
  padding: 0;
  list-style: none;
}

.checklist > li {
  position: relative;
  margin: 0;
  padding-left: 2rem;
}

.checklist > li::before {
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--color-accent-soft);
  content: "";
}

.checklist > li::after {
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 1.3rem;
  height: 1.3rem;
  background: var(--color-accent-strong);
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}

/* Callouts: .callout plus a tone (--info default, --note, --warning, --success, --neutral) */
.callout {
  --callout-color: var(--color-info);
  --callout-bg: var(--color-info-bg);
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid color-mix(in srgb, var(--callout-color) 35%, transparent);
  border-left: 4px solid var(--callout-color);
  border-radius: var(--radius-sm);
  background: var(--callout-bg);
  color: var(--color-text);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout__title {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-heading);
  font-weight: 700;
}

.callout--note { --callout-color: var(--color-note); --callout-bg: var(--color-note-bg); }
.callout--warning { --callout-color: var(--color-warning); --callout-bg: var(--color-warning-bg); }
.callout--success { --callout-color: var(--color-success); --callout-bg: var(--color-success-bg); }
.callout--neutral { --callout-color: var(--color-neutral); --callout-bg: var(--color-neutral-bg); }

/* Code sample: <figure class="code-sample"><figcaption>…</figcaption><pre><code>…</code></pre></figure> */
.code-sample {
  margin: 0 0 var(--space-5);
  overflow: hidden;
  border: 1px solid var(--color-code-border);
  border-radius: var(--radius);
  background: var(--color-code-bg);
}

.code-sample figcaption {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--color-code-border);
  background: var(--color-code-bar);
  color: var(--color-code-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.code-sample pre {
  margin: 0;
  border-radius: 0;
}

/* Minimal static syntax colouring for hand-marked examples */
.tok-key { color: #e6c77f; }
.tok-str { color: #9fd9b4; }
.tok-num { color: #f2a97c; }
.tok-com { color: #8791a8; }
.tok-cmd { color: #d59bea; }

/* Tables: wrap in <div class="table-wrap" role="region" aria-label="…" tabindex="0"> for narrow screens */
.table-wrap {
  margin: 0 0 var(--space-5);
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

/* On narrow screens the table scrolls inside the wrapper instead of squeezing its columns. */
.table-wrap table {
  min-width: 36rem;
  margin: 0;
}

td code,
td .method {
  white-space: nowrap;
  overflow-wrap: normal;
}

.table-wrap tbody tr:last-child > * {
  border-bottom: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* FAQ: <div class="faq"><article class="faq__item"><h3>…</h3><p>…</p></article>…</div> */
.faq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: var(--space-4);
}

.faq__item {
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.faq__item h3 {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.faq__item p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Footer */
.site-footer {
  padding-block: var(--space-8) var(--space-6);
  font-size: var(--text-sm);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: var(--space-6);
}

.site-footer__about {
  grid-column: 1 / -1;
  max-width: 30rem;
}

@media (min-width: 60rem) {
  .site-footer__grid {
    grid-template-columns: 1.6fr repeat(3, 1fr);
  }

  .site-footer__about {
    grid-column: auto;
  }
}

.site-footer__about img {
  width: auto;
  height: 26px;
  margin-bottom: var(--space-4);
}

/* ERICADE addition: the text wordmark that stands in for the footer logo. */
.site-footer__brand {
  margin-bottom: var(--space-4);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
}

.site-footer h2 {
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-footer ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: 0;
}

.site-footer a {
  color: var(--color-text);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.site-footer__bottom p {
  margin: 0;
}

/* A footer that is only the bottom line (the error pages). */
.site-footer--slim {
  padding-block: var(--space-5);
}

.site-footer--slim .site-footer__bottom {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* ERICADE addition — error pages (/400.html … /503.html, /down.html):
     <body class="page-fill"> header, <main class="hero error-page on-dark">, slim footer.
   .page-fill keeps the footer at the bottom of the window when the page is shorter than it. */
.page-fill {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page-fill > main {
  flex: 1 0 auto;
}

.error-page {
  display: grid;
  align-items: center;
  text-align: center;
}

.error-page__code {
  margin-bottom: var(--space-3);
  color: var(--er-gold);
  font-size: clamp(4.5rem, 3rem + 9vw, 9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.error-page h1 {
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
}

.error-page .lead {
  margin-inline: auto;
}

.error-page__actions {
  justify-content: center;
  margin-top: var(--space-6);
}

/* The small print under the buttons: the status line, the retry countdown. */
.error-page__note {
  margin: var(--space-6) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* 8. Documentation --------------------------------------------------------------------------------- */

.note,
.warning,
.internal {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--color-note);
  border-radius: var(--radius-sm);
  background: var(--color-note-bg);
  font-size: 0.95em;
}

.warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-bg);
}

.internal {
  border-left-color: var(--color-neutral);
  background: var(--color-neutral-bg);
}

.deprecated {
  color: var(--color-text-muted);
  font-style: italic;
}

.endpoint-url {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  margin: var(--space-2) 0 var(--space-4);
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.method {
  display: inline-block;
  min-width: 4rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  background: var(--er-gray-600);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}

.method-get { background: #1f7a4d; }
.method-post { background: #1d5fa8; }
.method-put { background: #9a5b00; }
.method-patch { background: #7a4c9a; }
.method-delete { background: #b42318; }
.method-ws { background: var(--er-purple-600); } /* ERICADE addition: the station data WebSocket */

/* Reference page layout: <main class="container doc"> holding a .doc-header, a .doc-toc and one <section> per
   topic. Pages with many endpoints nest <section class="endpoint"> blocks (h3) inside topic sections (h2). */
.doc {
  padding-block: var(--space-7) var(--space-8);
}

.doc-header {
  max-width: 50rem;
  margin-bottom: var(--space-6);
}

.doc-header h1 {
  margin-bottom: var(--space-3);
  font-size: var(--text-2xl);
}

.doc-header .lead {
  margin-bottom: var(--space-3);
}

.doc-toc {
  margin: 0 0 var(--space-7);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.doc-toc__title {
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-toc ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-1) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.doc-toc li + li {
  margin-top: 0;
}

.doc h2 {
  margin-top: var(--space-8);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-border);
  font-size: var(--text-xl);
}

.doc h3 {
  margin-top: var(--space-6);
  font-size: var(--text-lg);
  font-weight: 700;
}

.doc h4 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
}

.doc .endpoint {
  margin-top: var(--space-7);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.doc .endpoint > h3 {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* ERICADE addition: in a reference table, code may wrap where it has spaces (a list of element names, a
   JSON example) but still never inside a word, so attribute names and URLs stay whole. */
.doc td code {
  white-space: normal;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ERICADE addition: the closing line of a reference page, <footer class="doc-footer"> inside .doc. */
.doc-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.doc-footer p {
  margin: 0;
}

/* 9. Utilities -------------------------------------------------------------------------------------- */

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-6 { margin-top: var(--space-6); }

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

@media print {
  .skip-link,
  .site-header,
  .hero__media,
  .hero::before {
    display: none !important;
  }

  body,
  .on-dark {
    --color-text: #000;
    --color-text-muted: #333;
    --color-heading: #000;
    --color-link: #000;
    --color-border: #bbb;
    background: #fff !important;
    color: #000;
  }

  .section {
    padding-block: 1.5rem;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }

  pre,
  .code-sample {
    border: 1px solid #999;
    background: #fff;
    color: #000;
    white-space: pre-wrap;
  }

  .card,
  .steps > li,
  .faq__item {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* ERICADE addition — print and PDF of the reference pages. docs/ericade-api-v2.pdf is printed from
   docs/ericade-api-v2.html (see CLAUDE.md for the command), so these rules ARE the PDF's layout: the
   contents on page one, every section starting on a new page, and long lines wrapping instead of being
   cut off at the page edge. Everything is scoped to .doc; the other pages print with the rules above. */
@page {
  size: A4;
  margin: 16mm 14mm 18mm 14mm;
}

@media print {
  html:has(.doc) {
    font-size: 9.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .doc ~ .site-footer {
    display: none !important;
  }

  .doc {
    width: auto;
    padding-block: 0;
    line-height: 1.45;
  }

  /* A URL after every link would double the length of the tables. */
  .doc a[href^="http"]::after {
    content: none;
  }

  .doc-header {
    max-width: none;
  }

  .doc-header h1 {
    margin-top: 0;
    font-size: 20pt;
  }

  .doc h2 {
    margin-top: 0;
    font-size: 15pt;
    break-after: avoid;
  }

  .doc h3,
  .doc h4 {
    font-size: 11pt;
    break-after: avoid;
  }

  .doc-toc {
    margin: 1.5rem 0 0;
    padding: 0;
    border: 0;
    background: none;
  }

  .doc-toc__title {
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-heading);
    font-size: 13pt;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
  }

  .doc-toc ul {
    display: block;
    columns: 2;
    column-gap: 2rem;
  }

  .doc-toc li {
    padding: 0.15rem 0;
    break-inside: avoid;
  }

  .doc > section {
    break-before: page;
  }

  /* A scrolling box cannot break across pages, and paper does not scroll. */
  .doc .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .doc .table-wrap table {
    min-width: 0;
    margin-bottom: var(--space-5);
  }

  .doc table {
    font-size: 8.5pt;
  }

  .doc thead {
    display: table-header-group;
  }

  .doc th,
  .doc td {
    padding: 4px 6px;
    border: 1px solid var(--color-border);
    overflow-wrap: break-word;
  }

  .doc thead th {
    white-space: normal;
  }

  .doc td code,
  .doc td .method {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Square corners on paper: the reference has thousands of inline code chips, and every rounded one is
     drawn as curves. Rounded they more than double the size of the PDF (1.6 MB against 0.7 MB). */
  .doc :not(pre) > code {
    border-radius: 0;
  }

  .doc tr,
  .doc .endpoint-url,
  .doc .note,
  .doc .warning,
  .doc .internal {
    break-inside: avoid;
  }

  /* The request tables (Attribute / Mandatory? / Description / Notes) and response tables (Attribute /
     Description / Example) get fixed column widths, so a long URL or checksum in the last column wraps
     inside it instead of squeezing the others. The first column fits ReturnArtistLongDescription. */
  .doc table:where(:has(> thead > tr > th:nth-child(3))) { table-layout: fixed; }
  .doc table:where(:has(> thead > tr > th:nth-child(3))) td { overflow-wrap: anywhere; }
  .doc table:where(:has(> thead > tr > th:nth-child(4))) th:nth-child(1) { width: 27%; }
  .doc table:where(:has(> thead > tr > th:nth-child(4))) th:nth-child(2) { width: 11%; }
  .doc table:where(:has(> thead > tr > th:nth-child(4))) th:nth-child(3) { width: 40%; }
  .doc table:where(:has(> thead > tr > th:nth-child(4))) th:nth-child(4) { width: 22%; }
  .doc table:where(:has(> thead > tr > th:nth-child(3)):not(:has(> thead > tr > th:nth-child(4)))) th:nth-child(1) { width: 28%; }
  .doc table:where(:has(> thead > tr > th:nth-child(3)):not(:has(> thead > tr > th:nth-child(4)))) th:nth-child(2) { width: 46%; }
  .doc table:where(:has(> thead > tr > th:nth-child(3)):not(:has(> thead > tr > th:nth-child(4)))) th:nth-child(3) { width: 26%; }
  .doc table.envelopes th:nth-child(1) { width: 22%; }
  .doc table.envelopes th:nth-child(2) { width: 30%; }
  .doc table.envelopes th:nth-child(3) { width: 48%; }

  .doc pre {
    overflow: visible;
    font-size: 7.8pt;
    overflow-wrap: anywhere;
    orphans: 5;
    widows: 3;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  /* The Statistics example runs to over a thousand short lines; two columns halve the pages it takes. */
  .doc pre.long-example {
    column-count: 2;
    column-gap: 1.25rem;
    column-rule: 1px solid #ddd;
  }

  .doc-footer {
    margin-top: var(--space-6);
    break-before: avoid;
  }
}
