/* ==========================================================================
   nr-llm landing site — stylesheet
   Netresearch brand: Raleway (headings/nav/buttons) + Open Sans (body).
   Light-first per brand; dark mode uses neutral surfaces only (brand colours
   stay as accents — no invented dark brand hexes).
   ========================================================================== */

/* ---- Fonts (self-hosted, variable weight axis) ---- */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/open-sans-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/raleway-var.woff2') format('woff2');
}

/* ---- Design tokens ---- */
:root {
  --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Raleway', 'Helvetica Neue', Arial, sans-serif;

  /* Brand */
  --teal: #2F99A4;
  --teal-dark: #257880;
  --teal-text: #15585E;
  --orange: #FF4D00;

  /* Light surfaces / ink */
  --ink: #585961;
  --ink-strong: #4D4F57;
  --muted: #6C6E77;          /* AA on white/#F5F5F5/service tint (>=4.5:1) */
  --teal-deep: #1F6D74;      /* button hover (white text >=6:1) */
  --bg: #FFFFFF;
  --bg-alt: #F5F5F5;
  --surface: #FFFFFF;
  --border: #CCCDCC;
  --border-light: #E5E5E5;
  --error: #DC3545;

  /* Semantic */
  --link: var(--teal-text);
  --link-hover: var(--teal-dark);
  --btn-outline-ink: var(--teal-text);
  --accent: var(--teal);
  --code-bg: #F5F7F8;
  --code-ink: #24303A;
  --focus: #257880;
  --shadow-sm: 0 1px 2px rgba(24, 33, 38, 0.06), 0 1px 3px rgba(24, 33, 38, 0.08);
  --shadow-md: 0 4px 12px rgba(24, 33, 38, 0.08), 0 2px 4px rgba(24, 33, 38, 0.06);
  --shadow-lg: 0 12px 32px rgba(24, 33, 38, 0.12);

  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 1200px;
  --maxw-prose: 90ch;
  --gap: clamp(1.5rem, 3vw, 3rem);
  --section-y: clamp(3rem, 7vw, 6rem);
}

/* Dark reading theme — neutral surfaces; brand teal kept as accent. */
:root[data-theme='dark'] {
  --ink: #E6E7EA;
  --ink-strong: #F3F4F6;
  --muted: #A9ABB3;
  --bg: #15171C;
  --bg-alt: #1B1E24;
  --surface: #1F232A;
  --border: #363A43;
  --border-light: #2A2E36;
  --link: #5CC6D1;
  --btn-outline-ink: #5CC6D1;
  --link-hover: #83D5DE;
  --accent: #3FB0BC;
  --code-bg: #12151A;
  --code-ink: #DCE4EA;
  --focus: #5CC6D1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #E6E7EA;
    --ink-strong: #F3F4F6;
    --muted: #A9ABB3;
    --bg: #15171C;
    --bg-alt: #1B1E24;
    --surface: #1F232A;
    --border: #363A43;
    --border-light: #2A2E36;
    --link: #5CC6D1;
  --btn-outline-ink: #5CC6D1;
    --link-hover: #83D5DE;
    --accent: #3FB0BC;
    --code-bg: #12151A;
    --code-ink: #DCE4EA;
    --focus: #5CC6D1;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

/* ---- Minimal reset ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* keep the attribute authoritative over component display rules */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink-strong); line-height: 1.2; font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 0 0 0.6em; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin: 1.6em 0 0.4em; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, 'Liberation Mono', monospace; }

/* ---- Accessibility helpers ---- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 100;
  background: var(--teal-dark); color: #fff; padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; color: #fff; }
/* Skip-link target is programmatically focusable (tabindex=-1); don't paint a
   focus ring around the whole main region when focus lands there. */
#main:focus { outline: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Layout ---- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section__intro { max-width: var(--maxw-prose); color: var(--ink); }
.eyebrow { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8rem; color: var(--teal-text); margin: 0 0 0.5rem; }
:root[data-theme='dark'] .eyebrow { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .eyebrow { color: var(--link); } }

/* ---- Header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border-light);
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-head); font-weight: 700; color: var(--ink-strong); text-decoration: none; }
.brand img { width: 44px; height: 44px; display: block; }
.brand__name { font-size: 1.05rem; }
.brand__name b { color: var(--teal-text); }
:root[data-theme='dark'] .brand__name b { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .brand__name b { color: var(--link); } }

.nav { margin-left: auto; }
.nav ul { display: flex; gap: 1.2rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav a { font-family: var(--font-head); font-weight: 600; font-size: 0.95rem; color: var(--ink); text-decoration: none; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--teal-text); }
.nav a[aria-current='true'] { color: var(--teal-text); border-bottom-color: var(--teal); }
:root[data-theme='dark'] .nav a:hover, :root[data-theme='dark'] .nav a[aria-current='true'] { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .nav a:hover, :root:not([data-theme='light']) .nav a[aria-current='true'] { color: var(--link); } }

.header-tools { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--teal); color: var(--link); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .icon-moon { display: none; }
}

.nav-toggle { display: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  padding: 0.7rem 1.3rem; border-radius: var(--radius-sm); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn--primary { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }
.btn--primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.btn--secondary { background: transparent; color: var(--btn-outline-ink); border-color: var(--teal); }
.btn--secondary:hover { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }
:root[data-theme='dark'] .btn--secondary { color: var(--link); border-color: var(--accent); }
:root[data-theme='dark'] .btn--secondary:hover { background: var(--accent); color: #08282b; }

/* ---- Hero ---- */
.hero { position: relative; padding-block: clamp(3rem, 8vw, 6.5rem); overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 90% at 15% 0%, color-mix(in srgb, var(--teal) 14%, transparent), transparent 60%),
    radial-gradient(50% 80% at 95% 20%, color-mix(in srgb, var(--teal) 10%, transparent), transparent 55%);
}
.hero__headline { font-size: clamp(2.1rem, 5.2vw, 3.6rem); margin: 0 0 0.4em; max-width: 20ch; }
.hero__sub { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--ink); max-width: 60ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.8rem; }
.hero__providers { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; margin-top: 2.4rem; }
.hero__providers span { font-size: 0.85rem; color: var(--muted); font-family: var(--font-head); font-weight: 600; letter-spacing: 0.04em; }
.provider-row { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: center; }
.provider-row img { width: 30px; height: 30px; opacity: 0.9; }
:root[data-theme='dark'] .provider-row img { filter: brightness(0) invert(1); opacity: 0.85; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .provider-row img { filter: brightness(0) invert(1); opacity: 0.85; } }

/* ---- Cards / grids ---- */
.grid { display: grid; gap: var(--gap); margin-top: 2.5rem; }
/* min-width:0 lets a grid item shrink below its content width so long,
   unbreakable strings (e.g. FQCNs) wrap instead of overflowing the card. */
.grid > * { min-width: 0; }
/* Genuinely two-up on desktop (wider boxes) — the 30rem floor prevents the
   auto-fit track count from creeping to 3-4 columns at 1200px. */
/* At most two cards side by side on desktop; one column on narrow screens. */
.grid--2, .grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 1.5rem 1.6rem; box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; overflow-wrap: anywhere; }
/* Feature-index cards carry the top-level heading under the page h1, so they use
   h2 for correct heading order — size it like a card h3, not a section h2. */
.card h2 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin: 0 0 0.4em; overflow-wrap: anywhere; }
.card h2 a { text-decoration: none; color: inherit; }
.card code, .card h3 code { overflow-wrap: anywhere; }
.card__icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal-text); margin-bottom: 0.9rem; }
:root[data-theme='dark'] .card__icon { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .card__icon { color: var(--link); } }
.card__icon svg { width: 22px; height: 22px; }

.bullets { padding-left: 0; list-style: none; }
.bullets li { position: relative; padding-left: 1.7rem; margin-bottom: 0.6rem; }
.bullets li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 8px; height: 8px; background: var(--orange); border-radius: 2px; }

/* ---- Diagram ---- */
.diagram { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 1rem; overflow-x: auto; box-shadow: var(--shadow-sm); }
.diagram pre { margin: 0; font-size: 0.82rem; line-height: 1.5; color: var(--code-ink); white-space: pre; }
.figure-caption { color: var(--muted); font-size: 0.9rem; margin-top: 0.8rem; }

/* ---- Stack diagram ---- */
.stack { margin: 2.5rem 0 0; display: grid; gap: 0.5rem; max-width: 780px; }
.stack__layer { border-radius: var(--radius); padding: 1rem 1.3rem; border: 1px solid var(--border-light); background: var(--surface); display: grid; gap: 0.15rem; box-shadow: var(--shadow-sm); position: relative; }
.stack__layer::after { content: ''; position: absolute; left: 50%; bottom: -0.55rem; width: 2px; height: 0.5rem; background: var(--border); transform: translateX(-50%); }
.stack__layer:last-of-type::after { display: none; }
.stack__name { font-family: var(--font-head); font-weight: 700; color: var(--ink-strong); }
.stack__items { font-size: 0.9rem; color: var(--muted); }
.stack__layer--service { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--surface)); }
.stack__layer--service .stack__name { color: var(--teal-text); }
:root[data-theme='dark'] .stack__layer--service .stack__name { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .stack__layer--service .stack__name { color: var(--link); } }
.stack__layer--admin { border-left: 4px solid var(--orange); }

/* ---- Code blocks ---- */
.codeblock { position: relative; margin: 1rem 0; }
.codeblock pre {
  margin: 0; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.55;
}
.codeblock__label { display: inline-block; font-family: var(--font-head); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.3rem 0.6rem; font-size: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer;
}
.copy-btn.is-copied { border-color: var(--teal); color: var(--link); }

/* ---- Steps (dev kickstart) ---- */
.steps { counter-reset: step; margin-top: 2rem; display: grid; gap: 1.6rem; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.2rem; align-items: start; }
.step__num { counter-increment: step; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; }
.step__num::before { content: counter(step); }
.step__body { min-width: 0; }
.step__body h3 { margin-top: 0.2rem; }

/* ---- FAQ ---- */
.faq { margin-top: 1.5rem; display: grid; gap: 0.8rem; }
.faq details { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 0 1.2rem; }
.faq summary { font-family: var(--font-head); font-weight: 600; cursor: pointer; padding: 1rem 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--teal); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: '\2212'; }
.faq details > *:not(summary) { margin-bottom: 1rem; }

/* ---- Search ---- */
.search { position: relative; }
.header-search { flex: 0 1 15rem; }
.search__field { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 0.35rem 0.6rem; }
.search__field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
.search input { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 0.95rem; padding: 0.25rem; width: 100%; min-width: 8rem; }
.search input:focus { outline: none; }
.search__results {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); list-style: none; margin: 0; padding: 0.4rem; max-height: 60vh; overflow-y: auto;
}
.search-result a { display: grid; gap: 0.15rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.search-result.is-active a, .search-result a:hover { background: var(--bg-alt); }
.search-result__title { font-family: var(--font-head); font-weight: 600; color: var(--ink-strong); }
.search-result__meta { font-size: 0.75rem; color: var(--teal-text); text-transform: uppercase; letter-spacing: 0.04em; }
:root[data-theme='dark'] .search-result__meta { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .search-result__meta { color: var(--link); } }
.search-result__excerpt { font-size: 0.85rem; color: var(--muted); }
mark { background: color-mix(in srgb, var(--orange) 30%, transparent); color: inherit; padding: 0 1px; border-radius: 2px; }

/* ---- AI assistant ---- */
.ai { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-sm); }
.ai__head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.4rem; }
.ai__badge { font-family: var(--font-head); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: var(--teal); padding: 0.15rem 0.5rem; border-radius: 999px; }
.ai__form { display: flex; gap: 0.6rem; margin: 1rem 0 0.6rem; flex-wrap: wrap; }
.ai__form input { flex: 1 1 16rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; padding: 0.6rem 0.8rem; }
.ai__form input:focus-visible { border-color: var(--teal); }
.ai__output { min-height: 1.5rem; margin-top: 0.8rem; padding: 0.9rem 1rem; background: var(--bg-alt); border-radius: var(--radius-sm); }
.ai__output > *:first-child { margin-top: 0; }
.ai__output > *:last-child { margin-bottom: 0; }
.ai__output p { margin: 0 0 0.7rem; }
.ai__output ul, .ai__output ol { margin: 0 0 0.7rem; padding-left: 1.3rem; }
.ai__output li { margin: 0.2rem 0; }
.ai__output li > p { margin: 0; }
.ai__output code { background: var(--code-bg); color: var(--code-ink); padding: 0.05em 0.35em; border-radius: 4px; font-size: 0.9em; overflow-wrap: anywhere; }
.ai__output pre.ai-code { margin: 0 0 0.7rem; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; }
.ai__output pre.ai-code code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }
.ai__output a { color: var(--link); }
.ai__output strong { color: var(--ink-strong); }
.ai__output:empty:not([aria-busy='true']) { display: none; }
.ai__output[aria-busy='true']::after { content: '▋'; animation: blink 1s steps(2) infinite; color: var(--teal); }
@keyframes blink { 50% { opacity: 0; } }
.ai__status { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
.ai__privacy { font-size: 0.8rem; color: var(--muted); margin-top: 0.8rem; display: flex; gap: 0.4rem; align-items: baseline; }
.ai__privacy::before { content: '🔒'; }
.ai-sources { margin-top: 0.8rem; font-size: 0.85rem; }
.ai-sources__label { font-family: var(--font-head); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; }
.ai-sources ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.ai[data-state='unsupported'] .ai__privacy { display: none; }

/* ---- ADR pages ---- */
.adr-groups { display: grid; gap: 2rem; margin-top: 2rem; }
.adr-group h2 { border-bottom: 2px solid var(--teal); padding-bottom: 0.3rem; }
.adr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.adr-list li { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm); }
.adr-list a { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.9rem; padding: 0.8rem 1rem; text-decoration: none; color: var(--ink); align-items: baseline; }
.adr-list a:hover { background: var(--bg-alt); }
.adr-num { font-family: var(--font-head); font-weight: 700; color: var(--teal-text); font-variant-numeric: tabular-nums; }
:root[data-theme='dark'] .adr-num { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .adr-num { color: var(--link); } }
.adr-list a > * { min-width: 0; }   /* let the 1fr column shrink so long titles wrap */
.adr-title { font-family: var(--font-head); font-weight: 600; color: var(--ink-strong); overflow-wrap: anywhere; }
.adr-summary { grid-column: 2; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg-alt); color: var(--muted); border: 1px solid var(--border-light); }
.badge--accepted { color: var(--link); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }

/* ADR article (rendered RST) */
.doc { max-width: var(--maxw-prose); }
.doc h1 { font-family: var(--font-head); font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 0.6em; }
.doc pre { background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; font-size: 0.88rem; }
.doc table { border-collapse: collapse; width: 100%; margin: 1rem 0; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; }
.doc .admonition { border-left: 4px solid var(--teal); background: var(--bg-alt); padding: 0.8rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1rem 0; }
.doc .admonition-title { font-weight: 700; font-family: var(--font-head); margin: 0 0 0.3rem; }
.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--link); }

/* ---- On-page table of contents (landing) ---- */
.toc { border-bottom: 1px solid var(--border-light); background: var(--bg-alt); }
.toc .container { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.toc__label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.toc__list { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; list-style: none; margin: 0; padding: 0; }
.toc__list a { display: inline-block; padding: 0.25rem 0.7rem; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--link); background: var(--surface); }
.toc__list a:hover, .toc__list a:focus-visible { border-color: var(--accent); }

/* ---- ADR reference chips (governance page sections) ---- */
.adr-refs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.25rem; }
.adr-refs__label { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.adr-chip { display: inline-block; padding: 0.2rem 0.6rem; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--link); text-decoration: none; }
.adr-chip:hover, .adr-chip:focus-visible { border-color: var(--accent); }

/* ---- Links section ---- */
.linklist { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); list-style: none; padding: 0; margin-top: 1.5rem; }
.linklist a { display: block; padding: 1rem 1.2rem; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); }
.linklist a:hover { border-color: var(--teal); }
.linklist b { font-family: var(--font-head); color: var(--ink-strong); display: block; }
.linklist span { font-size: 0.88rem; color: var(--muted); }

/* ---- Footer ---- */
/* Footer uses a dedicated dark surface, never `var(--ink)` as a background —
   `--ink` flips to near-white in dark mode, so reusing it would render the
   near-white footer text on a near-white plate (invisible) whenever the OS is
   dark and no explicit theme has been chosen. */
.site-footer { background: #585961; color: #E9E9EC; margin-top: var(--section-y); }
:root[data-theme='dark'] .site-footer { background: #0F1115; border-top: 1px solid var(--border); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .site-footer { background: #0F1115; border-top: 1px solid var(--border); } }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; padding-block: 2.5rem; }
.site-footer a { color: #fff; }
.site-footer__brand { max-width: 32ch; }
.site-footer__tagline { color: #D8D9DC; font-size: 0.9rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1.2rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.site-footer__meta { width: 100%; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 1.2rem; font-size: 0.85rem; color: #D8D9DC; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }

/* ---- Language switch ---- */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch a { padding: 0.3rem 0.6rem; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 0.85rem; }
.lang-switch a[aria-current='true'] { background: var(--teal-dark); color: #fff; }

/* ---- Root chooser ---- */
.chooser { min-height: 80vh; display: grid; place-items: center; text-align: center; }
.chooser__cards { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; margin-top: 2rem; }
.chooser__cards a { min-width: 12rem; }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .site-header__inner { flex-wrap: wrap; padding-block: 0.5rem; }
  .nav-toggle { display: inline-grid; margin-left: auto; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--bg);
    border-bottom: 1px solid var(--border-light); box-shadow: var(--shadow-md);
    /* visibility:hidden (not just clipped height) takes the collapsed links out
       of the tab order and the accessibility tree, so a keyboard user doesn't
       land on ~7 invisible off-screen links (WCAG 2.4.3 / 2.4.7 / 2.1.1).
       Kept in the transition so the links stay visible through the close
       animation, then drop out. */
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height 0.2s ease, visibility 0.2s ease;
  }
  .nav[data-open='true'] { max-height: 70vh; visibility: visible; }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 0.5rem 1rem; }
  .nav a { padding: 0.7rem 0; border-bottom: 1px solid var(--border-light); }
  /* search drops to its own full-width row below the header bar */
  .header-search { order: 10; flex: 1 0 100%; margin-bottom: 0.5rem; }
  .header-search .search__field { width: 100%; }
  .header-search .search__results { max-height: 55vh; }
}
@media (min-width: 821px) {
  .nav[data-open] { max-height: none !important; overflow: visible; }
}

/* Print */
@media print {
  .site-header, .nav, .ai, .search, .copy-btn, .theme-toggle { display: none !important; }
  body { color: #000; background: #fff; }
}
