/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: Netresearch DTT GmbH
 */

/* ==========================================================================
   nr-llm landing site — stylesheet
   Lufox brand: Manrope (headings, eyebrows, card titles) + IBM Plex Sans
   (body text, buttons, labels). Token values follow the Lufox colour table;
   the dark theme uses its dark column. Links and label text are ink with an
   underline, because the enhanced-contrast gate needs 7:1 and brand blue
   reaches 5.17:1 on white. Brand blue marks focus, borders and small graphic
   accents only. No gradients, no shadows.
   The legacy token names (--teal, --orange, --nr-*) are kept so the component
   rules below did not have to be renamed; their values are Lufox values.
   ========================================================================== */

/* ---- Fonts (self-hosted, SIL OFL 1.1; licences beside the files) ---- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/manrope-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

/* ---- Design tokens ---- */
:root {
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-head: Manrope, 'Helvetica Neue', Arial, sans-serif;

  /* Brand: accents are brand blue, solid fills and text are ink. */
  --teal: #2563EB;           /* graphic accent: borders, active rings */
  --teal-dark: #15171C;      /* solid fill: primary button, badges, step numbers */
  --teal-deep: #3D4048;      /* solid fill on hover */
  --on-solid: #FFFFFF;       /* text on the solid fill, 17.93:1 */
  --teal-text: #15171C;
  --orange: #2563EB;         /* small graphic marks: bullets, search highlight */
  --nr-primary: #2563EB;
  --nr-accent: #2563EB;
  --nr-text: #3D4048;
  --nr-primary-text: var(--link);
  --nr-primary-fill: var(--teal-dark);
  --nr-primary-tint: #F5F3EE;
  --nr-accent-text: #15171C;
  --nr-border-strong: #5F626A;

  /* Light surfaces / ink */
  --ink: #15171C;
  --ink-strong: #15171C;
  --muted: #3D4048;          /* 10.37:1 on white, 9.35:1 on #F5F3EE */
  --bg: #FFFFFF;
  --bg-alt: #F5F3EE;
  --surface: #FFFFFF;
  --hero-bg: #15171C;
  --border: #15171C1F;
  --border-light: #15171C1F;
  --error: #DC3545;

  /* Semantic */
  --link: var(--teal-text);
  --link-hover: #3D4048;
  --btn-outline-ink: var(--teal-text);
  --accent: var(--teal);
  --code-bg: #F5F3EE;
  --code-ink: #15171C;
  --focus: #2563EB;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;

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

/* Dark theme — the dark column of the Lufox tokens. Screen only, so printing
   keeps the light values. #2A2D34 (tint) is derived, one step above #1F2228. */
@media screen {
  :root[data-theme='dark'] {
    --teal: #60A5FA;
    --teal-dark: #F5F3EE;
    --teal-deep: #C5C7CC;
    --on-solid: #15171C;
    --teal-text: #F5F3EE;
    --orange: #60A5FA;
    --ink: #F5F3EE;
    --ink-strong: #F5F3EE;
    --muted: #C5C7CC;
    --bg: #15171C;
    --bg-alt: #1F2228;
    --surface: #1F2228;
    --hero-bg: #1F2228;
    --border: #F5F3EE29;
    --border-light: #F5F3EE29;
    --nr-accent-text: #F5F3EE;
    --nr-primary-tint: #2A2D34;
    --nr-border-strong: #9A9DA4;
    --link-hover: #C5C7CC;
    --code-bg: #15171C;
    --code-ink: #F5F3EE;
    --focus: #60A5FA;
  }
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --teal: #60A5FA;
    --teal-dark: #F5F3EE;
    --teal-deep: #C5C7CC;
    --on-solid: #15171C;
    --teal-text: #F5F3EE;
    --orange: #60A5FA;
    --ink: #F5F3EE;
    --ink-strong: #F5F3EE;
    --muted: #C5C7CC;
    --bg: #15171C;
    --bg-alt: #1F2228;
    --surface: #1F2228;
    --hero-bg: #1F2228;
    --border: #F5F3EE29;
    --border-light: #F5F3EE29;
    --nr-accent-text: #F5F3EE;
    --nr-primary-tint: #2A2D34;
    --nr-border-strong: #9A9DA4;
    --link-hover: #C5C7CC;
    --code-bg: #15171C;
    --code-ink: #F5F3EE;
    --focus: #60A5FA;
  }
}

/* ---- Minimal reset ---- */
*, *::before, *::after { box-sizing: border-box; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }   /* keep the attribute authoritative over component display rules */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
@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: 1100;
  background: var(--teal-dark); color: var(--on-solid); padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; color: var(--on-solid); }
/* 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: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.875rem; color: var(--teal-text); margin: 0 0 0.5rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 48px; max-width: 100%;
  font-family: var(--font-body); 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: var(--on-solid); border-color: var(--teal-dark); }
.btn--primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--on-solid); }
.btn--secondary { background: transparent; color: var(--btn-outline-ink); border-color: var(--teal); }
.btn--secondary:hover { background: var(--teal-dark); color: var(--on-solid); border-color: var(--teal-dark); }

/* ---- Hero ---- */
.hero { position: relative; padding-block: clamp(3rem, 8vw, 6.5rem); overflow: hidden; isolation: isolate; background: var(--hero-bg); }
.hero .hero__headline, .hero .hero__sub, .hero .container .eyebrow,
.hero .hero__providers span, .hero .status-facts__note { color: #FFFFFF; }
.hero .provider-row img { filter: brightness(0) invert(1); opacity: 1; }
.hero .hero__cta .btn--primary { color: #15171C; background: #FFFFFF; border-color: #FFFFFF; }
.hero .hero__cta .btn--secondary { color: #FFFFFF; background: transparent; border-color: #FFFFFF; }
.hero .hero__cta .btn:hover { color: #15171C; background: #F5F3EE; border-color: #F5F3EE; }
.hero :focus-visible { outline-color: #60A5FA; }
.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.875rem; color: var(--muted); font-family: var(--font-body); 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; }
@media screen { :root[data-theme='dark'] .provider-row img { filter: brightness(0) invert(1); opacity: 0.85; } }
@media screen and (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.25rem; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 .5rem; font-size: 1.05rem; 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; }
.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.875rem; 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 { min-width: 0; 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: var(--nr-primary-tint); }
.stack__layer--service .stack__name { color: var(--teal-text); }
.stack__layer--service .stack__items { color: var(--ink); }
.stack__layer--admin { border-color: var(--border-light); }

/* ---- 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: 3.5rem 1.1rem 1rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.55;
}
.codeblock__label { display: inline-block; font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; 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.875rem; min-width: 44px; min-height: 44px; max-width: 100%;
  border: 1px solid var(--nr-border-strong); 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-dark); color: var(--on-solid); 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: 700; 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(--link); 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(--nr-border-strong); border-radius: var(--radius-sm); background: var(--surface); min-height: 48px; padding: 0.35rem 0.6rem; }
.search__field:focus-within { border-color: var(--teal); outline: 2px solid var(--focus); outline-offset: 2px; }
.search input { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 0.95rem; padding: 0.25rem; width: 100%; min-width: 0; }
.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(--nr-border-strong); 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: 700; color: var(--ink-strong); }
.search-result__meta { font-size: 0.875rem; color: var(--teal-text); text-transform: uppercase; letter-spacing: 0.04em; }
.search-result__excerpt { font-size: 0.875rem; 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-body); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-solid); background: var(--teal-dark); 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; min-width: 0; min-height: 48px; border: 1px solid var(--nr-border-strong); 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.875rem; 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.875rem; color: var(--muted); margin-top: 0.5rem; }
.ai__privacy { font-size: 0.875rem; 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.875rem; }
.ai-sources__label { font-family: var(--font-body); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 0.875rem; 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; }
.adr-list a > * { min-width: 0; }   /* let the 1fr column shrink so long titles wrap */
.adr-title { font-family: var(--font-head); font-weight: 700; 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.875rem; 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: 1px solid var(--border-light); background: var(--bg-alt); padding: 0.8rem 1rem; border-radius: var(--radius); 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.875rem; 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.875rem; 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.875rem; 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.875rem; 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: #15171C; color: #F5F3EE; border-top: 1px solid #F5F3EE29; margin-top: var(--section-y); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; padding-block: 2.5rem; }
.site-footer a { color: #F5F3EE; display: inline-flex; min-height: 44px; align-items: center; }
.site-footer__brand { max-width: 32ch; }
.site-footer__tagline { color: #F5F3EE; 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 #F5F3EE29; padding-top: 1.2rem; font-size: 0.875rem; color: #F5F3EE; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }

/* ---- Root chooser ---- */
.chooser { min-height: 55vh; display: grid; place-items: center; }
.chooser h1 { font-size: clamp(1.8rem, 5vw, 3rem); max-width: 24ch; }
.chooser__cards { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: flex-start; margin-top: 2rem; }
.chooser__cards a { min-width: min(12rem, 100%); }

/* Print */
@media print {
  .nr-pagebar, .ai, .search, .copy-btn { display: none; }
  body { color: #000; background: #fff; }
}

/* ── Status facts, business sections and the capability card ─────────────── */

.status-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 1rem 1.5rem;
  margin: 2rem 0 .75rem;
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}
.status-facts > div { min-width: 0; }
.status-facts dt {
  font-family: var(--font-body);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.status-facts dd {
  margin: .25rem 0 0;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--ink-strong);
}
.status-facts__note {
  color: var(--muted);
  font-size: .9rem;
  max-width: var(--maxw-prose);
}

.status-pill {
  display: inline-block;
  padding: .1rem .6rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
/* The stage is a word first; every stage uses ink (7:1 text contrast). */
.status-pill--concept,
.status-pill--poc,
.status-pill--alpha { color: var(--nr-accent-text); }
.status-pill--beta,
.status-pill--stable { color: var(--link); }
.status-pill--maintenance { color: var(--muted); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.card p { margin: 0; }
/* Two classes, so it outranks `.card p` without !important. */
.card .card__meta {
  margin-top: .75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.section__more { margin-top: 1.5rem; }

.flow-list {
  counter-reset: flow;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: .75rem;
}
.flow-list li {
  counter-increment: flow;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .25rem 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  background: var(--bg-alt);
  border-radius: var(--radius);
}
.flow-list li::before {
  content: counter(flow);
  grid-row: 1 / span 2;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--link);
}
.flow-list strong { font-family: var(--font-head); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.data-table th,
.data-table td {
  padding: .75rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-light);
}
.data-table thead th {
  font-family: var(--font-body);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
}
.data-table tbody th { font-family: var(--font-head); }

.capability-card {
  margin-top: 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.capability-card > div {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 3fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.capability-card > div:last-child { border-bottom: 0; }
.capability-card dt {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--ink-strong);
}
.capability-card dd { margin: 0; }
.capability-card ul { margin: 0; padding-left: 1.1rem; }
.capability-card li { margin-bottom: .35rem; }
/* Limitations are the part a reader must not skim. */
.capability-card__limits { background: var(--bg-alt); }

@media (max-width: 640px) {
  .capability-card > div { grid-template-columns: 1fr; gap: .35rem; }
}

.cta-band__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 2rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.cta-band__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Shared page context and local reflow boundaries. */
.context-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .7rem; padding-block: .75rem; font-size: .875rem; }
.context-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.container, .doc, .card, .ai, .header-search, .cta-band__inner > *, .flow-list li > * { min-width: 0; }
h1, h2, h3, h4, p, li, dt, dd, a, summary, .stack__layer, .breadcrumb { overflow-wrap: anywhere; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--border-light); border-radius: var(--radius); }
.table-scroll .data-table { min-width: 42rem; }
.table-scroll:focus-visible { outline-offset: 3px; }
.doc table, .doc pre, .diagram { max-width: 100%; }
.site-footer :focus-visible { outline-color: #60A5FA; }
@media (max-width: 360px) {
  .hero__cta, .cta-band__actions { flex-direction: column; align-items: stretch; }
  .ai { padding: 1rem; }
}

.hero .status-facts :focus-visible { outline-color: var(--focus); }
/* Printing uses paper surfaces even when the screen preference is dark. The
   selectors also outrank the no-JS navigation and explicit dark-theme rules. */
@media print {
  :root[data-theme], :root:not([data-theme]) {
    color-scheme: light;
    --ink: #000;
    --ink-strong: #000;
    --muted: #333;
    --bg: #fff;
    --bg-alt: #fff;
    --surface: #fff;
    --link: #000;
    --teal-text: #000;
    --link-hover: #000;
    --btn-outline-ink: #000;
    --nr-accent-text: #000;
    --nr-primary-tint: #fff;
    --code-bg: #fff;
    --code-ink: #000;
  }
  :root[data-theme] :is(.nr-pagebar, .ai, .search, .copy-btn),
  :root:not([data-theme]) :is(.nr-pagebar, .ai, .search, .copy-btn) { display: none; }
  :root[data-theme] .site-footer, :root:not([data-theme]) .site-footer, .hero { background: #fff; }
  :root .hero .container *, :root .site-footer * { color: #000; }
  :root .btn { color: #000; background: #fff; border-color: #888; transition: none; }
  :root[data-theme] .provider-row img,
  :root:not([data-theme]) .provider-row img { filter: none; opacity: 1; }
}

/* ---- Agent readiness page ---- */
/* The origin of a capability is a word first; the tint only repeats it. */
.origin { display: inline-block; margin: 0 .35rem .35rem 0; padding: .1rem .55rem; border: 1px solid var(--nr-border-strong); border-radius: 999px; font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; line-height: 1.5; color: var(--ink-strong); background: var(--surface); max-width: 100%; overflow-wrap: anywhere; }
.origin--nr, .origin--nr-integration { border-color: var(--teal); background: var(--nr-primary-tint); }
.readiness-component { display: block; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.readiness-asof { font-size: 0.9rem; color: var(--muted); margin-top: 1rem; }
.origin-legend { display: grid; gap: 0; margin: 1.5rem 0 0; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.origin-legend > div { display: grid; grid-template-columns: minmax(14rem, 1fr) 3fr; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-light); }
.origin-legend > div:last-child { border-bottom: 0; }
.origin-legend dd { margin: 0; }
.readiness-table .data-table { min-width: 40rem; }
.readiness-table .data-table tbody th { width: 22%; }
.readiness-table .data-table td:nth-child(2) { width: 22%; }
.readiness-table th, .readiness-table td { overflow-wrap: anywhere; }
.readiness-table td p { margin: 0 0 .5rem; }
.readiness-table td p:last-child { margin-bottom: 0; }
.readiness-limit { color: var(--ink); }
.readiness-sources { font-size: 0.875rem; }
.readiness-sources span { color: var(--muted); }
.readiness-notes { margin-top: 1.5rem; max-width: var(--maxw-prose); }
@media (max-width: 640px) {
  .origin-legend > div { grid-template-columns: 1fr; gap: .35rem; }
  /* Narrow screens: each row becomes a card instead of a sideways scroll.
     The template sets explicit table roles, so assistive technology keeps the
     table semantics that a changed display value would otherwise drop. */
  .readiness-table { overflow: visible; border: 0; border-radius: 0; }
  .readiness-table .data-table { min-width: 0; }
  .readiness-table .data-table,
  .readiness-table .data-table tbody,
  .readiness-table .data-table tr,
  .readiness-table .data-table th,
  .readiness-table .data-table td { display: block; width: auto; }
  .readiness-table .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .readiness-table .data-table tbody tr { margin-bottom: 1rem; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--surface); }
  .readiness-table .data-table tbody th { width: auto; padding: .9rem 1rem .25rem; border-bottom: 0; font-size: 1rem; }
  .readiness-table .data-table td { padding: .25rem 1rem .9rem; border-bottom: 0; }
  .readiness-table .data-table td:nth-child(2) { width: auto; padding-bottom: .5rem; }
  .readiness-table th, .readiness-table td { hyphens: auto; }
}
