/* Lumilnar design system, "Befund mit Randnotiz" (see DESIGN.md at the repo root).
   Shared by every page of lumilnar.de: the Astro pages (src/layouts/Base.astro), the generated
   feature pages and the static pages in public/. Holds the font, the tokens, the base type, buttons,
   the header and footer (markup: src/lib/chrome.mjs) and the signature components. Page CSS
   (tokens.css, style.css, features.css, legal.css) builds on these variables only. */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/assets/fonts/plex-sans-latin-var.woff2') format('woff2');
  font-weight: 100 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/assets/fonts/plex-sans-latin-var-italic.woff2') format('woff2');
  font-weight: 100 700; font-style: italic; font-display: swap;
}

:root {
  --ground: #F1F2F2; --sheet: #FFFFFF; --sunken: #E6E8E8;
  --rule: #E3E5E5; --rule-strong: #C9CED6;
  --ink: #141414; --ink-2: #3A3F46; --ink-3: #5A5F66;
  --blue: #1F3FBF; --blue-strong: #18329A; --blue-soft: #EEF1FB; --on-blue: #FFFFFF;
  --flag: #B3261E; --flag-soft: #FBEDEC;
  --good: #1D7A46; --good-soft: #E7F3EC; --amber: #9A6400; --amber-soft: #FBF1DE;
  --float: 0 8px 24px rgba(20, 20, 20, .12);
  --r: 4px;
  --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max: 1200px;
  --gutter: 24px;
  /* Rhythm: the gap between sections is always clearly larger than any gap inside one. */
  --section: clamp(88px, 10vw, 144px);
  --stack: 32px;
  /* Motion: strong ease-out for things arriving, ease-in-out for things moving on screen. */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --t-press: 140ms; --t-hover: 180ms; --t-reveal: 640ms;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ground: #0E1013; --sheet: #17191D; --sunken: #22252A;
  --rule: #2A2E34; --rule-strong: #3A3F47;
  --ink: #F2F3F4; --ink-2: #C9CDD3; --ink-3: #9AA0A8;
  --blue: #8FA5FF; --blue-strong: #B4C3FF; --blue-soft: #1B2340; --on-blue: #0E1013;
  --flag: #FF8A80; --flag-soft: #3A1C1A;
  --good: #6FCF97; --good-soft: #15291D; --amber: #F2C46D; --amber-soft: #2E2410;
  --float: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --gutter: 16px; --stack: 24px; } }

/* Base */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--blue-strong); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-soft); }
.num, td, .tabular { font-variant-numeric: tabular-nums; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: var(--r); border: 0; font: 500 16px/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: background-color var(--t-hover) ease, color var(--t-hover) ease, box-shadow var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--blue); color: var(--on-blue); }
.btn-primary:hover { background: var(--blue-strong); color: var(--on-blue); }
.btn-secondary { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.btn-secondary:hover { background: var(--ground); color: var(--ink); }
/* Quiet: the second action next to a primary one. Blue text with an arrow that moves on hover. */
.btn-quiet { background: transparent; color: var(--blue); padding: 0 4px; }
.btn-quiet:hover { color: var(--blue-strong); }
.btn-quiet .arrow { display: inline-block; transition: transform var(--t-hover) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn-quiet:hover .arrow { transform: translateX(3px); } }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
@media (hover: none) { .btn:hover { background: inherit; } .btn-primary:hover { background: var(--blue); } .btn-secondary:hover { background: var(--sheet); } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--sheet); }
.site-header .container { position: relative; display: flex; align-items: center; gap: 24px; height: 68px; }
.logo { font-family: var(--font); font-weight: 600; font-size: 22px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo:hover { color: var(--ink); }
.nav { display: flex; min-width: 0; margin-left: 12px; }
.nav { gap: 22px; }
.nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 10px; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 240ms var(--ease-out); }
.nav a:hover { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .nav a:hover::after { transform: scaleX(1); } }
.nav a[aria-current="page"] { color: var(--blue); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.nav-actions .nav-login { background: transparent; box-shadow: none; padding: 0 12px; color: var(--ink); }
.nav-actions .nav-login:hover { background: transparent; color: var(--blue); }
.nav-actions .lang { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--ink-2); font-weight: 500; font-size: 15px; text-decoration: none; }
.nav .nav-account { display: none; }
.menu-btn { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--r); background: var(--ground); color: var(--ink); cursor: pointer; }
@media (max-width: 1180px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; padding: 8px var(--gutter) 20px; background: var(--sheet); box-shadow: var(--float); }
  .nav.open { display: flex; }
  .nav { margin-left: 0; }
  .nav a { min-height: 52px; padding: 0; font-size: 18px; border-bottom: 1px solid var(--rule); border-radius: 0; }
  .nav a::after { display: none; }
  .nav a:hover { background: transparent; color: var(--blue); }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 640px) {
  .site-header .container { height: 60px; gap: 12px; }
  .nav-login { display: none; }
  .nav .nav-account { display: flex; }
  .nav-actions { gap: 4px; }
  .nav-actions .btn-sm { padding: 0 12px; }
}

/* Footer */
.site-footer { background: var(--sheet); margin-top: var(--section); padding: 64px 0 28px; font-size: 15px; color: var(--ink-2); }
.site-footer > .container:first-child { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.site-footer .logo { font-size: 28px; }
.site-footer .footer-brand p { margin: 10px 0 0; max-width: 32ch; }
.site-footer h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--ink); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a, .site-footer .link-btn { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-2); text-decoration: none; }
.site-footer li a:hover, .site-footer .link-btn:hover { color: var(--blue); }
.site-footer .link-btn { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.site-footer .footer-bottom { margin-top: 56px; color: var(--ink-3); font-size: 13px; }
@media (max-width: 860px) { .site-footer > .container:first-child { grid-template-columns: repeat(2, minmax(0, 1fr)); } .site-footer .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .site-footer { padding-top: 48px; } }

/* Icons (src/lib/icons.ts, components/Icon.tsx): stroke SVG in the text colour */
.ico { display: inline-block; flex-shrink: 0; vertical-align: -0.2em; }

/* Sheet: the white surface on the grey ground */
.sheet { background: var(--sheet); border-radius: var(--r); padding: 24px; }

/* Range bar: where a value sits in its reference range.
   <span class="range" style="--lo:20%;--hi:80%;--pos:6%" role="img" aria-label="…"><i></i></span>
   Add .out when the value is outside the range. */
.range { position: relative; display: block; height: 14px; min-width: 80px; }
.range::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 4px; border-radius: 2px; background: var(--rule); }
.range::after { content: ''; position: absolute; top: 3px; height: 8px; left: var(--lo, 20%); width: calc(var(--hi, 80%) - var(--lo, 20%)); border-radius: 4px; background: var(--rule-strong); }
.range > i { position: absolute; z-index: 1; top: 0; left: clamp(0px, calc(var(--pos, 50%) - 7px), calc(100% - 14px)); width: 14px; height: 14px; border-radius: 999px; background: var(--ink); }
.range.out > i { background: var(--flag); }

/* Flag letter after a value (H/L), and the margin note: Lumilnar's own words */
.flag { color: var(--flag); font-weight: 600; margin-left: .2em; }
.note { color: var(--blue); font-style: italic; font-size: 18px; line-height: 1.45; }
.note strong, .note b { font-style: normal; font-weight: 600; }

/* Motion (public/ds.js adds .ds-motion only when the visitor allows motion).
   Range dots ([data-reveal]) travel from the left end of the bar to their value; ds.js drives that
   with a transform, so the dot's position itself never animates. Margin notes fade up just after.
   [data-reveal-group]: the children of a section arrive in reading order as it scrolls into view. */
.ds-motion .range[data-reveal]:not(.is-in) > i { opacity: 0; }
.ds-motion .note[data-reveal] { transition: opacity .5s ease calc(var(--reveal-delay, 0ms) + 350ms), transform .5s var(--ease-out) calc(var(--reveal-delay, 0ms) + 350ms); }
.ds-motion .note[data-reveal]:not(.is-in) { opacity: 0; transform: translateY(8px); }
.ds-motion [data-reveal-group] > * { transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out); transition-delay: calc(var(--i, 0) * 80ms); }
.ds-motion [data-reveal-group]:not(.is-in) > * { opacity: 0; transform: translateY(20px); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
