/* σ-Uniformity — liquid-glass theme, polished typography */

:root {
  --color-accent: #2966c5;
  --color-accent-hover: #1f4f9b;

  --color-text: #14181f;
  --color-text-muted: #4f5564;
  --color-text-faint: #8b909a;

  --color-bg: #f3f5fa;
  --color-bg-deep: #e9edf5;

  /* Glass surfaces */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-bg-soft: rgba(255, 255, 255, 0.38);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-border-soft: rgba(255, 255, 255, 0.45);
  --glass-edge: rgba(20, 30, 60, 0.08);
  --glass-shadow: 0 8px 32px rgba(20, 30, 60, 0.08), 0 1px 2px rgba(20, 30, 60, 0.04);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --color-code-bg: rgba(20, 30, 60, 0.05);

  --color-info-tint: rgba(41, 102, 197, 0.06);
  --color-info-edge: rgba(41, 102, 197, 0.18);
  --color-warn-tint: rgba(189, 130, 30, 0.07);
  --color-warn-edge: rgba(189, 130, 30, 0.22);

  /* Typography — variable fonts loaded from Google */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 5rem;
  --s-10: 6rem;

  --space-xs: var(--s-1);
  --space-sm: var(--s-2);
  --space-md: var(--s-4);
  --space-lg: var(--s-5);
  --space-xl: var(--s-6);
  --space-2xl: var(--s-7);
  --space-3xl: var(--s-8);

  --container-max: 1100px;
  --container-narrow: 760px;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --transition: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-fast: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --focus-ring: 0 0 0 3px rgba(41, 102, 197, 0.35);

  /* Backwards-compat tokens */
  --color-primary: var(--color-accent);
  --color-primary-dark: var(--color-accent-hover);
  --color-text-light: var(--color-text-muted);
  --color-bg-alt: var(--color-bg-deep);
  --color-bg-code: var(--color-code-bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #87b2ee;
    --color-accent-hover: #a3c5f4;

    --color-text: #ecedf2;
    --color-text-muted: #a8aebb;
    --color-text-faint: #767c89;

    --color-bg: #0c0f15;
    --color-bg-deep: #070a0f;

    --glass-bg: rgba(28, 34, 48, 0.55);
    --glass-bg-strong: rgba(28, 34, 48, 0.72);
    --glass-bg-soft: rgba(28, 34, 48, 0.38);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-border-soft: rgba(255, 255, 255, 0.06);
    --glass-edge: rgba(0, 0, 0, 0.5);
    --glass-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
    --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

    --color-code-bg: rgba(255, 255, 255, 0.05);

    --color-info-tint: rgba(135, 178, 238, 0.08);
    --color-info-edge: rgba(135, 178, 238, 0.22);
    --color-warn-tint: rgba(212, 168, 90, 0.10);
    --color-warn-edge: rgba(212, 168, 90, 0.28);

    --focus-ring: 0 0 0 3px rgba(135, 178, 238, 0.45);
  }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overflow-x: clip;          /* Never let the page scroll horizontally; wide
                                content must use its own .table-scroll /
                                .catalogue-chart__plot wrapper. */
}

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11' 1, 'ss03' 1, 'kern' 1;
  font-variant-ligatures: common-ligatures contextual;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 720px) {
  body { font-size: 1rem; line-height: 1.65; } /* 16px on desktop — was 17 */
}

/* Ambient aurora */
body::before {
  content: "";
  position: fixed;
  inset: -10% -10% -10% -10%;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 12% 8%, rgba(80, 130, 220, 0.30), transparent 60%),
    radial-gradient(45% 40% at 88% 18%, rgba(150, 110, 220, 0.22), transparent 65%),
    radial-gradient(55% 45% at 78% 92%, rgba(70, 180, 200, 0.22), transparent 65%),
    radial-gradient(40% 35% at 18% 88%, rgba(220, 140, 180, 0.18), transparent 65%);
  filter: saturate(1.05);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(60% 50% at 12% 8%, rgba(40, 80, 180, 0.35), transparent 60%),
      radial-gradient(45% 40% at 88% 18%, rgba(110, 70, 200, 0.30), transparent 65%),
      radial-gradient(55% 45% at 78% 92%, rgba(20, 130, 160, 0.30), transparent 65%),
      radial-gradient(40% 35% at 18% 88%, rgba(170, 80, 130, 0.22), transparent 65%);
  }
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -46px;
  left: 0;
  background: var(--color-accent);
  color: white;
  padding: var(--s-2) var(--s-4);
  z-index: 1000;
  text-decoration: none;
  font-weight: 500;
  border-radius: 0 0 var(--radius-sm) 0;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 4px; }

/* Focus */
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: 4px; }

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-text);
  text-wrap: balance;
}

/* Tightened type scale (May 2026): each level steps down ~1.2× from the
   parent. H1 ~ 36px, H2 ~ 22px (= old H3), H3 ~ 18px, H4 = body, H5/H6 small.
   No inline overrides — every page sizes through these tags or the
   semantic helper classes. */
h1 {
  font-size: 1.75rem;       /* 28px mobile */
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: var(--s-4);
}
@media (min-width: 720px) {
  h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.025em; }  /* 36px desktop */
}

h2 {
  font-size: 1.25rem;       /* 20px mobile */
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}
@media (min-width: 720px) {
  h2 { font-size: 1.375rem; line-height: 1.25; }   /* 22px desktop — matches old H3 */
}

h3 {
  font-size: 1.0625rem;     /* 17px mobile */
  line-height: 1.35;
  font-weight: 600;
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
}
@media (min-width: 720px) {
  h3 { font-size: 1.125rem; }   /* 18px desktop */
}

h4 {
  font-size: 1rem;          /* 16px both — matches body */
  line-height: 1.4;
  font-weight: 600;
  margin-top: var(--s-4);
  margin-bottom: var(--s-2);
}

h5, h6 {
  font-size: 0.9375rem;     /* 15px */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-top: var(--s-4);
  margin-bottom: var(--s-2);
}

/* MathJax: render inline math at the SAME size as the surrounding text.
   MathJax 3 sets `font-size: 114.9%` inline by default (`matchFontHeight`).
   Force 100% via CSS as well as the JS-side `matchFontHeight: false`. */
mjx-container[jax="CHTML"],
mjx-container.MathJax { font-size: 100% !important; }
mjx-container[display="true"] { font-size: 100% !important; margin: var(--s-4) 0 !important; }

p {
  margin-bottom: var(--s-4);
  max-width: 70ch;
  text-wrap: pretty;
}

p + p { margin-top: 0; }

/* Hero / page-header descriptions get a wider max */
.hero__description, .page-header p { max-width: 64ch; }

/* Links */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(41, 102, 197, 0.35);
  text-underline-offset: 0.22em;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-hover);
  text-decoration-color: currentColor;
}
a:focus-visible { text-decoration-color: currentColor; }

@media (prefers-color-scheme: dark) {
  a { text-decoration-color: rgba(135, 178, 238, 0.4); }
}

ul, ol {
  padding-left: var(--s-5);
  margin-bottom: var(--s-5);
}
li {
  margin-bottom: var(--s-2);
  max-width: 68ch;
}
li::marker { color: var(--color-text-faint); }

blockquote {
  background: var(--glass-bg-soft);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  color: var(--color-text-muted);
  margin: var(--s-5) 0;
  box-shadow: var(--glass-inset);
  font-style: italic;
}
blockquote em { font-style: normal; }

hr {
  border: 0;
  border-top: 1px solid var(--glass-edge);
  margin: var(--s-7) 0;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-feature-settings: 'liga' 0;
}
pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--glass-bg-soft);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: var(--s-5) 0;
  border: 1px solid var(--glass-border-soft);
  line-height: 1.6;
  box-shadow: var(--glass-inset);
}
pre code { background: none; padding: 0; font-size: inherit; }

/* MathJax integration */
mjx-container[jax="CHTML"][display="true"] {
  margin: var(--s-5) 0 !important;
  font-size: 1.05em !important;
}
mjx-container[jax="CHTML"]:not([display="true"]) { font-size: 1em; }

/* Tables — always wrapped in `.table-scroll` (auto-wrapped by main.js for any
   <main> table that lacks a wrapper). The wrapper handles horizontal touch
   scroll on narrow viewports; the table itself fills the wrapper at minimum
   100% width and expands beyond it when the content needs more room.        */
.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: var(--s-5) 0;
  border-radius: var(--radius);
  background: var(--glass-bg-soft);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--glass-inset);
  background-image:
    linear-gradient(to right, var(--glass-bg-soft), var(--glass-bg-soft)),
    linear-gradient(to right, var(--glass-bg-soft), var(--glass-bg-soft)),
    linear-gradient(to right, rgba(0,0,0,0.18), rgba(0,0,0,0)),
    linear-gradient(to left,  rgba(0,0,0,0.18), rgba(0,0,0,0));
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}
.table-scroll table {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  width: max-content;
  min-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-5) 0;
  font-size: 0.9375rem;
  background: var(--glass-bg-soft);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  box-shadow: var(--glass-inset);
}
th, td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--glass-edge);
  vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
th {
  font-weight: 600;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
@media (prefers-color-scheme: dark) {
  th { background: rgba(255, 255, 255, 0.04); }
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.container--narrow { max-width: var(--container-narrow); }

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

.header {
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border-bottom: 1px solid var(--glass-border-soft);
  z-index: 100;
  box-shadow: var(--glass-inset);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.header__logo {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.015em;
  transition: opacity var(--transition-fast);
}
.header__logo:hover { color: var(--color-text); opacity: 0.75; text-decoration: none; }
.header__logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9375rem;
  color: white;
  box-shadow: 0 2px 6px rgba(41, 102, 197, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Nav */
.nav { display: flex; align-items: center; }
.nav__list {
  display: flex;
  list-style: none;
  gap: var(--s-1);
  padding: 0;
  margin: 0;
}
.nav__list li { margin: 0; }
.nav__link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-pill);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav__link:hover {
  color: var(--color-text);
  background: var(--glass-bg-soft);
  text-decoration: none;
}
.nav__link[aria-current="page"] {
  color: var(--color-text);
  background: var(--glass-bg-soft);
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  z-index: 200;
  position: relative;
}
.nav__toggle:hover { background: var(--glass-bg-soft); }
.nav__toggle-icon { width: 24px; height: 24px; display: block; }
.nav__toggle-icon--close { display: none; }
.nav__toggle[aria-expanded="true"] .nav__toggle-icon--open { display: none; }
.nav__toggle[aria-expanded="true"] .nav__toggle-icon--close { display: block; }

@media (max-width: 720px) {
  .nav__toggle { display: block; }

  .nav__list {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: calc(64px + var(--s-4)) 0 var(--s-6);

    background: var(--color-bg-deep);
    border: none;
    border-radius: 0;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--transition), transform var(--transition), visibility 0s linear var(--transition);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 150;
  }
  .nav__list[data-open="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity var(--transition), transform var(--transition), visibility 0s linear 0s;
  }

  .nav__list li {
    width: 100%;
    border-bottom: 1px solid var(--glass-edge);
  }
  .nav__list li:last-child { border-bottom: none; }

  .nav__group {
    display: flex;
    align-items: stretch;
    width: 100%;
  }
  .nav__group .nav__link {
    flex: 1;
    border-bottom: none;
    border-radius: 0;
  }
  .nav__group-toggle {
    flex: 0 0 56px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--glass-edge);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition);
  }
  .nav__group-toggle:hover { background: var(--glass-bg); color: var(--color-text); }
  .nav__group-toggle svg { width: 18px; height: 18px; transition: transform var(--transition); }
  .nav__group-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

  .nav__sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0,0,0,0.18);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
  }
  .nav__sublist[data-open="true"] { max-height: 1200px; }
  .nav__sublist li { border-bottom: 1px solid var(--glass-edge); }
  .nav__sublist li:last-child { border-bottom: none; }
  .nav__sublink {
    display: block;
    padding: var(--s-3) var(--s-5) var(--s-3) calc(var(--s-5) + var(--s-4));
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.4;
  }
  .nav__sublink:hover,
  .nav__sublink[aria-current="page"] {
    background: var(--glass-bg);
    color: var(--color-text);
  }

  .nav__link {
    display: block;
    width: 100%;
    padding: var(--s-4) var(--s-5);
    font-size: 1.0625rem;
    font-weight: 600;
    border-radius: 0;
  }
  .nav__link:hover,
  .nav__link[aria-current="page"] {
    background: var(--glass-bg);
  }

  body[data-nav-open="true"] { overflow: hidden; }
}

@media (min-width: 721px) {
  .nav__group-toggle, .nav__sublist { display: none; }
  .nav__group { display: contents; }
}

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

.hero {
  padding: var(--s-9) 0 var(--s-8);
}
.hero__content { max-width: 760px; }
.hero__tagline {
  display: inline-block;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--s-3);
}
.hero__title {
  margin: 0 0 var(--s-4);
  font-size: 2rem;          /* 32px mobile — was 40 */
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}
@media (min-width: 720px) { .hero__title { font-size: 2.5rem; } }   /* 40px — was 56 */
@media (min-width: 1000px) { .hero__title { font-size: 3rem; } }    /* 48px — was 64 */
.hero__description {
  font-size: 1rem;          /* 16px — was 18 */
  color: var(--color-text-muted);
  margin-bottom: var(--s-5);
  line-height: 1.55;
  max-width: 60ch;
  text-wrap: pretty;
}
@media (min-width: 720px) {
  .hero__description { font-size: 1.0625rem; }   /* 17px — was 20 */
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn--primary {
  background: var(--color-accent);
  color: var(--btn-primary-text, #ffffff);
  border-color: transparent;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn--primary:hover {
  background: var(--color-accent-hover);
  color: var(--btn-primary-text, #ffffff);
  border-color: transparent;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--primary:active {
  background: var(--color-accent-hover);
  color: var(--btn-primary-text, #ffffff);
  transform: translateY(0);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.14),
    inset 0 1px 2px rgba(0, 0, 0, 0.12);
}
.btn--primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--color-bg),
    0 0 0 4px var(--color-accent);
}
@media (prefers-color-scheme: dark) {
  /* Dark-mode accent is light blue (#87b2ee) — switch to dark text for contrast. */
  .btn--primary { --btn-primary-text: #0c0f15; }
}

.btn--secondary {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  color: var(--color-text);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset);
}
.btn--secondary:hover {
  background: var(--glass-bg-strong);
  color: var(--color-text);
  border-color: var(--glass-border);
}
.btn--large {
  padding: var(--s-3) var(--s-6);
  font-size: 1rem;
}

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

.section { padding: var(--s-8) 0; }
.section--alt { padding: var(--s-8) 0; }

.section__header { text-align: center; margin-bottom: var(--s-7); }
.section__header h2,
.section__title { margin-top: 0; margin-bottom: var(--s-3); }
.section__description {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 56ch;
  margin: 0 auto;
}

/* ----------------------------------------------------------------------
   Tile cards — glass
   ---------------------------------------------------------------------- */

.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  display: flex;
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.card:hover {
  transform: translateY(-2px);
  background: var(--glass-bg-strong);
  box-shadow: 0 14px 40px rgba(20, 30, 60, 0.10), 0 1px 2px rgba(20, 30, 60, 0.05), var(--glass-inset);
}
@media (prefers-color-scheme: dark) {
  .card:hover { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.3), var(--glass-inset); }
}
.card__content {
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  width: 100%;
}
.card__title {
  margin: 0 0 var(--s-3);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card__description {
  color: var(--color-text-muted);
  margin-bottom: var(--s-5);
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ----------------------------------------------------------------------
   Grids
   ---------------------------------------------------------------------- */

.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
}
@media (min-width: 1000px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: var(--s-5);
  box-shadow: var(--glass-inset);
}
.stat__value {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.05;
  margin-bottom: var(--s-1);
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}
.stat__label {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
}

/* ----------------------------------------------------------------------
   Catalogue chart — unified β-strip plot
   ---------------------------------------------------------------------- */

.catalogue-chart {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-3) var(--s-3);
  margin: var(--s-5) 0;
  box-shadow: var(--glass-shadow), var(--glass-inset);
  max-width: 100%;
  overflow: hidden;
}
@media (min-width: 720px) {
  .catalogue-chart {
    padding: var(--s-5) var(--s-5) var(--s-4);
    margin: var(--s-6) 0;
  }
}
.catalogue-chart__header {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin-bottom: var(--s-4);
}
.catalogue-chart__title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
  margin: 0;
}
.catalogue-chart__subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
  max-width: 70ch;
}
.catalogue-chart__plot {
  width: 100%;
  min-height: 380px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.18), rgba(0,0,0,0)),
    linear-gradient(to left,  rgba(0,0,0,0.18), rgba(0,0,0,0));
  background-position: left center, right center;
  background-repeat: no-repeat;
  background-size: 12px 100%, 12px 100%;
  background-attachment: scroll, scroll;
}
.catalogue-chart__plot svg {
  display: block;
  margin: 0 auto;
  height: auto;
  overflow: visible;
  min-width: 760px;
  max-width: none;
}
@media (min-width: 760px) {
  .catalogue-chart__plot { overflow-x: visible; background-image: none; }
  .catalogue-chart__plot svg { min-width: 0; max-width: 100%; }
}
.catalogue-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--glass-edge);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.catalogue-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.catalogue-chart__swatch {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}
.catalogue-chart__legend-item--active {
  color: var(--color-text);
  font-weight: 500;
}
.catalogue-chart__legend-item--dim { opacity: 0.5; }

/* Anchor styling inside the chart (Plot dots can be clickable) */
.catalogue-chart a { text-decoration: none; }

/* Make the entire data-mark area clickable. Plot draws axis ticks and (for
   the heatmap) cell-value text as <text> elements that capture pointer events
   if not suppressed; clicks then only land on uncovered slivers. Axis labels
   are not interactive, so this is safe. */
.catalogue-chart svg text { pointer-events: none; }

/* Click-activation hint — the chart is click-only, this badge says so. */
.catalogue-chart__hint {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: var(--s-1) var(--s-3) var(--s-1) var(--s-2);
  margin-top: var(--s-3);
  box-shadow: var(--glass-inset);
}
.catalogue-chart__hint-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-accent);
}
.catalogue-chart__hint strong {
  color: var(--color-accent);
  font-weight: 600;
}

/* Make dots a bit more interactive-looking */
.catalogue-chart [data-catalogue-dot]:hover,
.catalogue-chart [data-catalogue-dot]:focus-visible {
  outline: none;
  filter: drop-shadow(0 2px 6px rgba(20, 30, 60, 0.25));
}
.catalogue-chart [data-catalogue-dot]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 50%;
}

/* ----------------------------------------------------------------------
   Catalogue tooltip — floating glass card with dot detail + actions
   ---------------------------------------------------------------------- */

.catalogue-tooltip {
  width: min(340px, calc(100vw - 32px));
  font-family: var(--font-sans);
  color: var(--color-text);
  pointer-events: none;
}
.catalogue-tooltip__inner {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5) var(--s-4);
  box-shadow: 0 14px 40px rgba(20, 30, 60, 0.18), 0 1px 3px rgba(20, 30, 60, 0.08), var(--glass-inset);
}
@media (prefers-color-scheme: dark) {
  .catalogue-tooltip__inner {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4), var(--glass-inset);
  }
}

/* Pinned tooltip becomes interactive */
.catalogue-tooltip[aria-hidden="false"] { pointer-events: none; }
.catalogue-tooltip[aria-hidden="false"][data-pinned="true"],
.catalogue-tooltip[aria-hidden="false"]:hover { pointer-events: auto; }

.catalogue-tooltip__head {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  margin-bottom: var(--s-3);
}
.catalogue-tooltip__swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: var(--dot-color, var(--color-accent));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}
.catalogue-tooltip__domain {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin: 0 0 var(--s-1);
}
.catalogue-tooltip__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.catalogue-tooltip__beta {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--glass-edge);
  border-bottom: 1px solid var(--glass-edge);
  margin-bottom: var(--s-3);
}
.catalogue-tooltip__beta-label {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}
.catalogue-tooltip__beta-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}

.catalogue-tooltip__details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-1) var(--s-3);
  margin: 0 0 var(--s-3);
  font-size: 0.8125rem;
}
.catalogue-tooltip__details dt {
  color: var(--color-text-muted);
  font-weight: 500;
}
.catalogue-tooltip__details dd {
  color: var(--color-text);
  margin: 0;
  font-feature-settings: 'tnum' 1;
}

.catalogue-tooltip__note {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--color-text-muted);
  margin: 0 0 var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--glass-bg-soft);
  border-radius: var(--radius-sm);
  max-width: none;
}

.catalogue-tooltip__actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  border-top: 1px solid var(--glass-edge);
  padding-top: var(--s-3);
}
.catalogue-tooltip__btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--color-text);
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  pointer-events: auto;
}
.catalogue-tooltip__btn:hover {
  background: var(--glass-bg-strong);
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.catalogue-tooltip__btn--primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(41, 102, 197, 0.30);
}
.catalogue-tooltip__btn--primary:hover {
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(41, 102, 197, 0.45);
}

.catalogue-tooltip__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
}
.catalogue-tooltip[data-arrow="down"] .catalogue-tooltip__arrow {
  bottom: -7px;
  transform: translateX(-50%) rotate(45deg);
  border-top: none;
  border-left: none;
}
.catalogue-tooltip[data-arrow="up"] .catalogue-tooltip__arrow {
  top: -7px;
  transform: translateX(-50%) rotate(45deg);
  border-bottom: none;
  border-right: none;
}

/* ----------------------------------------------------------------------
   Callout — glass, no border-left
   ---------------------------------------------------------------------- */

.callout {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: var(--s-5) var(--s-6);
  margin: var(--s-5) 0;
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.callout--info {
  background: linear-gradient(180deg, var(--color-info-tint), var(--glass-bg));
  border-color: var(--color-info-edge);
}
.callout--warning {
  background: linear-gradient(180deg, var(--color-warn-tint), var(--glass-bg));
  border-color: var(--color-warn-edge);
}
.callout__title {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin: 0 0 var(--s-2);
}
.callout p { margin-bottom: var(--s-2); }
.callout p:last-child { margin-bottom: 0; }

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

.footer {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border-top: 1px solid var(--glass-border-soft);
  padding: var(--s-7) 0 var(--s-5);
  margin-top: var(--s-8);
  box-shadow: var(--glass-inset);
}
/* Desktop ≥1000px: 5 columns. Tablet 720-999px: 3 cols (two rows). Mobile
   <720px: collapse to 1 col, hide deep sub-lists, show only linked titles.   */
.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3) var(--s-5);
  margin-bottom: var(--s-6);
}
@media (min-width: 720px) {
  .footer__grid { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
}
@media (min-width: 1000px) {
  .footer__grid { grid-template-columns: repeat(5, 1fr); }
}
.footer__title {
  font-weight: 600;
  margin: 0 0 var(--s-3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}
.footer__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer__title a:hover { color: var(--color-accent); text-decoration: none; }
.footer__list { list-style: none; padding: 0; margin: 0; }
.footer__list li { margin: 0; }
.footer__link {
  color: var(--color-text-muted);
  text-decoration: none;
  display: inline-block;
  padding: var(--s-1) 0;
  font-size: 0.9375rem;
  transition: color var(--transition-fast);
}
.footer__link:hover { color: var(--color-accent); text-decoration: none; }

@media (max-width: 719px) {
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s-2);
  }
  .footer__list { display: none; }
  .footer__title {
    margin: 0;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--color-text);
    border-top: 1px solid var(--glass-edge);
    padding: var(--s-3) 0 var(--s-3);
  }
  .footer__title:first-child { border-top: none; }
  .footer__title a {
    display: block;
    color: var(--color-text);
  }
}
.footer__bottom {
  padding-top: var(--s-5);
  border-top: 1px solid var(--glass-edge);
  color: var(--color-text-faint);
  font-size: 0.875rem;
}
.footer__bottom p { margin: 0; max-width: none; }

/* ----------------------------------------------------------------------
   Page header / content
   ---------------------------------------------------------------------- */

.page-header {
  padding: var(--s-8) 0 var(--s-7);
  border-bottom: 1px solid var(--glass-border-soft);
}
.page-header h1 { margin-bottom: var(--s-4); }
.page-header .hero__description {
  font-size: 1.125rem;
  margin-bottom: 0;
  line-height: 1.55;
}

.page-content { padding: var(--s-8) 0; }

/* In page-content, the first heading needs no top margin */
.page-layout__main > *:first-child { margin-top: 0; }
.page-layout__main h1:first-child,
.page-layout__main h2:first-child,
.page-layout__main h3:first-child { margin-top: 0; }

/* Two-column page layout */
.page-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--s-7);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.page-layout__sidebar {
  position: sticky;
  top: calc(64px + var(--s-5));
  height: fit-content;
  max-height: calc(100vh - 64px - var(--s-6));
  overflow-y: auto;
}
.page-layout > * { min-width: 0; }   /* Allow grid items to shrink so wide
                                       descendants can clip/scroll inside their
                                       own wrappers. */
.page-layout__main { min-width: 0; max-width: 70ch; }
.page-layout__main p,
.page-layout__main li { max-width: 68ch; }

@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; gap: var(--s-5); }
  .page-layout__sidebar { position: relative; top: 0; max-height: none; }
}

/* Sidebar nav */
.sidebar-nav {
  background: var(--glass-bg-soft);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  padding: var(--s-4);
  box-shadow: var(--glass-inset);
}
.sidebar-nav__title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 var(--s-3);
  padding: 0 var(--s-2);
}
.sidebar-nav__list { list-style: none; padding: 0; margin: 0; }
.sidebar-nav__item { margin: 0; }
.sidebar-nav__link {
  display: block;
  padding: var(--s-2) var(--s-3);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sidebar-nav__link:hover {
  color: var(--color-text);
  background: var(--glass-bg-soft);
  text-decoration: none;
}
.sidebar-nav__link--active {
  color: var(--color-accent);
  background: var(--glass-bg);
  font-weight: 500;
}

/* Selection */
::selection {
  background: rgba(41, 102, 197, 0.25);
  color: var(--color-text);
}
