/* ============================================================
   fam-calc.net — Shared Design System
   Neutrale Basis + Emerald-Akzent/-Schimmer; Dark-Mode-Toggle wie fin-calc.
   Geteilte Tokens, Base, Chrome (Header/Footer/Skip-Link/Label) + Sprach-Toggle.
   Seiten-spezifische Styles liegen scoped in den jeweiligen .astro-Komponenten.
   Muster: pet-calc.net design.css (Token-Namen + Komponentenklassen 1:1,
   nur Akzent-Werte anders). WCAG-Kontraste verifiziert 2026-07-02:
   Light --brand-strong #047857 auf #fafafa = 5,3:1 · Dark #34d399 auf #0a0a0b = 10,3:1.
   ============================================================ */

/* ============ FONTS (selbst gehostet, variabel) ============ */
@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/geist-variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono-variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ============ TOKENS ============ */
:root {
  --bg: #fafafa;          /* neutral */
  --bg-elev: #ffffff;
  --bg-sunken: #f1f1f3;
  --fg: #18181b;          /* neutrales Near-Black */
  --fg-muted: #52525b;
  --fg-subtle: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --brand: #059669;          /* EMERALD — Akzent/Flächen, Dot, Linien (non-text ≥3:1) */
  --brand-strong: #047857;   /* Emerald dunkel — Text/Links/Hover (≥4,5:1) */
  --positive: #16a34a;       /* kräftig & klar unterscheidbar */
  --warning: #d97706;
  --negative: #dc2626;

  /* Aliase + Chrome — neutral; Emerald nur als Akzent */
  --text: var(--fg);
  --text-muted: var(--fg-muted);
  --text-subtle: var(--fg-subtle);
  --accent: #18181b;          /* neutral: UI-Chrome, Fokus, Card-Border */
  --accent-soft: #ececef;     /* neutrale Tönung (Fokus-Ring) */
  --brand-soft: #d9f2e5;      /* Emerald-Tönung (Badges) */
  --brand-on: #ffffff;
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --focus: var(--accent);

  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step-mono: clamp(0.7rem, 0.66rem + 0.18vw, 0.78rem);
  --step-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-lead: clamp(1.25rem, 1.05rem + 0.9vw, 1.625rem);
  --step-h2:   clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem);
  --step-h1:   clamp(2.5rem, 1.8rem + 3.5vw, 4.75rem);

  --gap-1: 0.5rem;  --gap-2: 1rem;    --gap-3: 1.5rem;  --gap-4: 2.25rem;
  --gap-5: 3.5rem;  --gap-6: 5.5rem;  --gap-7: 8rem;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --transition: 160ms cubic-bezier(0.2, 0, 0, 1);

  --max-w: 1180px;
  --max-w-text: 820px;
  --pad-x: clamp(1.25rem, 4vw, 2.5rem);
}

/* ============ DARK MODE (neutral + Emerald) — Mechanik wie fin-calc ============
   Standard folgt dem System (prefers-color-scheme). Ein expliziter
   data-theme="light|dark" (Sonne/Mond-Toggle, gespeichert als fam-theme)
   gewinnt. NEUTRALES Fast-Schwarz; grün ist nur der Emerald-Akzent + der
   dezente Schimmer. Nur Farb-Tokens werden überschrieben — Layout/Typo bleibt. */
:root { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0b; --bg-elev: #161618; --bg-sunken: #060607;
    --fg: #fafafa; --fg-muted: #a1a1aa; --fg-subtle: #71717a;
    --border: #27272a; --border-strong: #3f3f46;
    --brand: #10b981; --brand-strong: #34d399;
    --positive: #4ade80; --warning: #fbbf24; --negative: #f87171;
    --accent: #fafafa; --accent-soft: #1f1f23; --brand-soft: #0c2b1f; --brand-on: #0a0a0b;
    --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.5); --shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b; --bg-elev: #161618; --bg-sunken: #060607;
  --fg: #fafafa; --fg-muted: #a1a1aa; --fg-subtle: #71717a;
  --border: #27272a; --border-strong: #3f3f46;
  --brand: #10b981; --brand-strong: #34d399;
  --positive: #4ade80; --warning: #fbbf24; --negative: #f87171;
  --accent: #fafafa; --accent-soft: #1f1f23; --brand-soft: #0c2b1f; --brand-on: #0a0a0b;
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.5); --shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ============ BASE ============ */
html { scroll-behavior: smooth; background: var(--bg); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
  background: transparent;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Emerald-Schimmer: fixer, weicher Farbverlauf hinter transparentem Body —
   bewusst dezenter als pet-calcs Ember-Glow (Rechtsthema, ruhige Tonalität).
   Liegt auf der --bg-Basis (html), Content darüber. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(72rem 42rem at 50% -14%, rgba(5, 150, 105, 0.13), transparent 70%),
    radial-gradient(54rem 36rem at 88% 0%,   rgba(13, 148, 136, 0.08), transparent 66%),
    radial-gradient(46rem 32rem at 4% 14%,   rgba(16, 185, 129, 0.06), transparent 70%);
}

/* Schimmer im Dark: etwas satter, bleibt aber zurückhaltend */
:root[data-theme="dark"] body::before {
  background:
    radial-gradient(64rem 38rem at 50% -16%, rgba(52, 211, 153, 0.09), transparent 72%),
    radial-gradient(48rem 32rem at 88% -2%,  rgba(13, 148, 136, 0.07), transparent 68%),
    radial-gradient(42rem 30rem at 4% 12%,   rgba(16, 185, 129, 0.04), transparent 72%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    background:
      radial-gradient(64rem 38rem at 50% -16%, rgba(52, 211, 153, 0.09), transparent 72%),
      radial-gradient(48rem 32rem at 88% -2%,  rgba(13, 148, 136, 0.07), transparent 68%),
      radial-gradient(42rem 30rem at 4% 12%,   rgba(16, 185, 129, 0.04), transparent 72%);
  }
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--brand-strong); color: var(--brand-on); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hidden { display: none !important; }

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

/* ============ LAYOUT ============ */
.shell { max-width: var(--max-w); margin: 0 auto; padding-inline: var(--pad-x); }
.shell--text { max-width: var(--max-w-text); }

.skip-link {
  position: absolute; top: 0; left: 0;
  padding: 0.6rem 1rem; background: var(--fg); color: var(--bg);
  font-family: var(--font-mono); font-size: var(--step-mono);
  text-decoration: none; transform: translateY(-110%);
  transition: transform var(--transition); z-index: 100;
}
.skip-link:focus { transform: translateY(0); }

/* ============ HEADER / BRAND / CONTROLS ============ */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 10;
}
.site-header__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-3); padding-block: 1rem;
}
.brand {
  font-family: var(--font-mono); font-size: var(--step-mono);
  letter-spacing: 0.02em; text-decoration: none; color: var(--fg);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand strong { font-weight: 600; color: var(--brand-strong); }
.brand__mark { width: 24px; height: 24px; flex-shrink: 0; display: block; }

.site-header__right { display: flex; align-items: center; gap: var(--gap-3); }
.site-nav { display: inline-flex; gap: var(--gap-2); }
.site-nav a {
  font-family: var(--font-mono); font-size: var(--step-mono); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-muted); text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 0.15rem; transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand-strong); border-bottom-color: var(--brand-strong); }
.controls { display: flex; align-items: center; gap: var(--gap-2); }
/* Einheitliche Header-Control-Höhe (--ctrl-h): DE/EN-Gruppe + Icon-Buttons gleich hoch */
.controls { --ctrl-h: 36px; }
.control-group {
  display: inline-flex; height: var(--ctrl-h); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.control-group button {
  padding: 0 0.7rem; font-family: var(--font-mono); font-size: var(--step-mono);
  color: var(--fg-muted); transition: color var(--transition), background var(--transition);
  min-width: 36px; display: inline-flex; align-items: center; justify-content: center;
}
.control-group button + button { border-inline-start: 1px solid var(--border); }
.control-group button:hover { color: var(--fg); }
.control-group button[aria-pressed="true"] { color: var(--brand-strong); background: var(--bg-elev); }

/* Header-Icon-Buttons (Theme + Share) — exakt so hoch/breit wie --ctrl-h */
.theme-toggle, .share-toggle {
  flex: 0 0 auto; position: relative;
  width: var(--ctrl-h, 36px); height: var(--ctrl-h, 36px); padding: 0; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.theme-toggle:hover, .share-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* Theme: Sonne/Mond schalten per [data-theme] (wie fin-calc) */
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; } }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; } }
:root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* Share: Link↔Check tauschen + kurzer Toast (wie fin-calc) */
.share-toggle .icon-link, .share-toggle .icon-check { transition: opacity 0.15s ease, transform 0.15s ease; }
.share-toggle .icon-check { position: absolute; opacity: 0; transform: scale(0.6); }
.share-toggle.is-copied { color: var(--positive); border-color: var(--positive); background: color-mix(in srgb, var(--positive) 10%, var(--bg-elev)); }
.share-toggle.is-copied .icon-link { opacity: 0; transform: scale(0.6); }
.share-toggle.is-copied .icon-check { opacity: 1; transform: scale(1); }
.share-toast {
  position: absolute; top: 100%; right: 0; margin-top: 6px; padding: 4px 10px;
  background: var(--text); color: var(--bg); font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  border-radius: var(--radius-sm); white-space: nowrap; opacity: 0; pointer-events: none;
  transform: translateY(-4px); transition: opacity 0.18s ease, transform 0.18s ease; z-index: 20;
}
.share-toast.visible { opacity: 1; transform: translateY(0); }

/* Touch: alle Header-Controls einheitlich auf 44px (ein Token regelt alles) */
@media (pointer: coarse) { .controls { --ctrl-h: 44px; } }

/* ============ LABEL (Eyebrow, seitenübergreifend) ============ */
.label {
  font-family: var(--font-mono); font-size: var(--step-mono);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted);
  margin-bottom: var(--gap-3); display: inline-flex; align-items: center; gap: 0.5rem;
}
.label::before {
  content: ''; width: 6px; height: 6px; background: var(--brand);
  border-radius: 50%; display: inline-block; flex-shrink: 0;
}

/* ============ FORM CONTROLS & KOMPONENTEN (1:1 von fin-calc, Emerald via Token) ============ */

/* Feld (Label + Control) */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field > .field-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500; line-height: 1.35;
  min-height: 32px; display: flex; align-items: flex-end;
}
.field-help { font-size: 11px; color: var(--text-subtle); margin-top: 2px; line-height: 1.4; }

/* Eingabe-Wrap (Input + Suffix) */
.input-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-wrap > input, .input-wrap > select {
  width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 9px 11px; font: inherit; font-family: var(--font-mono); font-size: 14px;
  outline: none; appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.input-wrap > input[inputmode="numeric"], .input-wrap > input[inputmode="decimal"] { -moz-appearance: textfield; }
.input-wrap > input::-webkit-outer-spin-button, .input-wrap > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap > input:read-only { color: var(--text-muted); cursor: not-allowed; }
.input-wrap .suffix { padding: 0 10px 0 2px; color: var(--text-subtle); font-size: 13px; font-family: var(--font-mono); user-select: none; white-space: nowrap; }
.input-wrap--sm { display: inline-flex; width: auto; }
.input-wrap--sm > input { width: 7ch; padding: 6px 8px; text-align: right; }
.input-wrap--sm .suffix { padding: 0 8px 0 2px; }

/* Segmented Control (fin-calc): eingelassener Track, aktiver Pill erhöht */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 4px; padding: 4px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius);
}
.segmented button {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 7px 8px; font: inherit; font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.12s ease; white-space: nowrap;
}
.segmented button:hover:not(.is-active) { color: var(--text); }
.segmented button.is-active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
/* Segmented als Tab-Umschalter (schrumpft auf Inhaltsbreite, z. B. Tabelle/Grafik) */
.seg-tabs { display: inline-grid; margin: 0 0 14px; }
/* Viz als Tab-Panel: kein Abschnitts-Trenner nötig */
.viz--tab { border-top: 0; margin-top: 0; padding-top: 0; }

/* Generische Card */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* Eingabe-Card + Sektion */
.input-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; box-shadow: var(--shadow); }
.input-section { padding: 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 18px; }
.input-section:last-child { border-bottom: 0; }
/* Vertikaler Rhythmus kommt vom Section-Gap, NICHT von der Label-min-height:
   sonst bekommen nur .field-Kinder Abstand (Label-Box), die .toggle-row aber 0.
   Darum hier min-height neutralisieren und h2-Margin in den Gap auflösen. */
.input-card .input-section > h2 { margin-bottom: 0; }
.input-section .field label, .input-section .field > .field-label { min-height: 0; }
.input-section h2, .section-title {
  margin: 0 0 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 500; color: var(--text-subtle); display: flex; align-items: center; gap: 10px;
}
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-full { grid-column: 1 / -1; }
@media (max-width: 600px) { .input-grid { grid-template-columns: 1fr; } }

/* Toggle / Switch (fin-calc) */
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.toggle-row label { font-size: 12px; color: var(--text); cursor: pointer; flex: 1; }
.toggle-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 36px; height: 20px;
  background: var(--border-strong); border-radius: 10px; position: relative; cursor: pointer; transition: background 0.15s; flex-shrink: 0;
}
.toggle-row input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--bg-elev); border-radius: 50%; transition: left 0.15s; }
.toggle-row input[type="checkbox"]:checked { background: var(--brand); }
.toggle-row input[type="checkbox"]:checked::after { left: 18px; }

/* Compare-Card (fin-calc) */
.compare-card { background: var(--bg-elev); border: 1px solid var(--border); border-top: 3px solid var(--card-accent, var(--brand)); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.compare-card .headline { font-family: var(--font-mono); font-size: clamp(22px, 2.6vw, 30px); font-weight: 400; letter-spacing: -0.03em; line-height: 1; margin: 0 0 6px; }
.compare-card .headline-sub { color: var(--text-muted); font-size: 12px; line-height: 1.4; }

/* Breakdown-Card + Tabelle (fin-calc) */
.breakdown-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.breakdown-card h3 { margin: 0 0 16px; font-size: 16px; font-weight: 500; letter-spacing: -0.015em; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown-table td { padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: middle; }
.breakdown-table td.num-col { text-align: right; font-family: var(--font-mono); color: var(--text); font-weight: 500; }
.breakdown-table tr.total td { border-top: 1px solid var(--border-strong); border-bottom: 0; padding-top: 14px; color: var(--text); font-weight: 500; }
.breakdown-table tr.total td.num-col { font-weight: 600; }

/* Bar-Compare (fin-calc) — Mini-Vergleichsdiagramme */
.bar-compare-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.bar-compare-row:last-child { margin-bottom: 0; }
.bar-compare-row .name { color: var(--text-muted); font-weight: 500; }
.bar-compare-row .bar-track { background: var(--bg-sunken); height: 22px; border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.bar-compare-row .bar-track { display: block; }
.bar-compare-row .bar-fill { display: block; height: 100%; border-radius: var(--radius-sm); background: var(--row-color, var(--brand)); transition: width 0.3s ease; }
.bar-compare-row .val { text-align: right; font-family: var(--font-mono); font-weight: 500; color: var(--text); }

/* Aktions-Buttons (subtil, fin-calc-Stil) */
.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); background: var(--bg-elev); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.12s ease;
}
.btn:hover { border-color: var(--text); }
.btn--primary { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }
/* Hover-Fläche ist brand-strong (nicht brand): weiße Schrift braucht ≥4,5:1 */
.btn--primary:hover { background: var(--brand-strong); color: var(--brand-on); border-color: var(--brand-strong); }

/* ============ RATGEBER / ARTIKEL ============ */
/* Prose-Styles global, weil Slot-Inhalt im Seiten-Scope liegt, nicht im Layout-Scope. */
.article { padding-block: clamp(2.5rem, 6vw, 4rem); }
.article__inner { max-width: var(--max-w-text); }
.crumb { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); margin: 0 0 1.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.crumb a { color: var(--text-muted); text-decoration: none; }
.crumb a:hover { color: var(--brand-strong); }
.article__kicker { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-strong); margin: 0 0 0.75rem; }
.article h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.9rem); line-height: 1.1; letter-spacing: -0.025em; font-weight: 500; margin: 0; color: var(--text); max-width: 22ch; }
.article__meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); margin: 1rem 0 0; }

/* Spacing-Logik wie fin-calc: explizite Margins je Element, h2 mit Trennlinie. */
.prose { margin-top: 2.5rem; font-size: 16px; line-height: 1.7; color: var(--text-muted); }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 1.1rem; }
.prose .lead { font-size: 1.15rem; line-height: 1.6; color: var(--text); margin: 0 0 2.4rem; }
.prose h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); line-height: 1.2; letter-spacing: -0.02em; font-weight: 500; color: var(--text); margin: 3rem 0 1.3rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 1.9rem 0 0.5rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); transition: text-decoration-color 0.15s ease; }
.prose a:hover { text-decoration-color: var(--brand-strong); }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.3rem; display: grid; gap: 0.5rem; }
.prose li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0.2rem 0 1.4rem; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subtle); font-weight: 500; }
.prose td.num, .prose th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.prose .tldr { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin: 0 0 1.6rem; font-size: 15px; line-height: 1.6; color: var(--text-muted); }
.prose .tldr strong { color: var(--text); }

/* Artikel-CTA + Back-Link — 1:1 von fin-calc (Pill-Outline-Button, kein Unterstrich) */
.article-cta { margin-top: 3rem; padding: clamp(1.5rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elev); }
.article-cta__eyebrow { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); margin: 0 0 0.6rem; }
.article-cta h2 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); margin: 0 0 0.6rem; }
.article-cta__text { color: var(--text-muted); line-height: 1.6; margin: 0 0 1.1rem; max-width: 60ch; }
.article-cta__btn { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; color: var(--text); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.6rem 1.1rem; transition: color 0.16s ease, border-color 0.16s ease; }
.article-cta__btn svg { transition: transform 0.16s ease; }
.article-cta__btn:hover { color: var(--brand-strong); border-color: var(--brand-strong); }
.article-cta__btn:hover svg { transform: translateX(3px); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 2rem; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); text-decoration: none; transition: color 0.16s ease; }
.back-link:hover { color: var(--brand-strong); }
.back-link svg { transition: transform 0.16s ease; flex-shrink: 0; }
.back-link:hover svg { transform: translateX(-3px); }
@media (prefers-reduced-motion: reduce) { .article-cta__btn, .article-cta__btn svg, .back-link, .back-link svg { transition: none; } .article-cta__btn:hover svg, .back-link:hover svg { transform: none; } }

.article-sources { margin-top: 2.8rem; border-top: 1px solid var(--border); padding-top: 1.4rem; }
.article-sources h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); font-weight: 500; margin: 0 0 0.8rem; }
.article-sources ul { display: grid; gap: 0.45rem; padding: 0; font-size: 13px; }
.article-sources a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.article-sources a:hover { color: var(--brand-strong); }

/* Artikel-Liste — geteilt von Ratgeber-Index und Startseiten-Teaser */
.rg-list { margin-top: 2rem; border-top: 1px solid var(--border); }
.rg-item { border-bottom: 1px solid var(--border); }
.rg-link { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1.4rem; text-decoration: none; color: inherit; }
.rg-link:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: -2px; }
.rg-item__title { display: block; font-size: 1.2rem; font-weight: 500; letter-spacing: -0.015em; color: var(--text); transition: color 0.16s ease; }
.rg-link:hover .rg-item__title { color: var(--brand-strong); }
.rg-item__desc { display: block; margin-top: 0.3rem; color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }
.rg-item__cta { flex: 0 0 auto; color: var(--text-subtle); transition: color 0.16s ease, transform 0.16s ease; }
.rg-link:hover .rg-item__cta { color: var(--brand-strong); transform: translateX(3px); }
.rg-all { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; color: var(--text-muted); transition: color 0.16s ease; }
.rg-all:hover { color: var(--brand-strong); }
.rg-all svg { transition: transform 0.16s ease; }
.rg-all:hover svg { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .rg-item__title, .rg-item__cta, .rg-all svg { transition: none; } .rg-link:hover .rg-item__cta, .rg-all:hover svg { transform: none; } }

/* ============ RECHNER-LAYOUT (geteilt) ============ */
.rechner { padding-block: var(--gap-5, 3.5rem) var(--gap-5, 3.5rem); }
.calc-head { display: flex; align-items: stretch; justify-content: space-between; gap: 16px 40px; flex-wrap: wrap; margin-bottom: 32px; padding: clamp(20px, 3vw, 32px); }
.calc-head__text { min-width: 0; flex: 1 1 320px; align-self: flex-start; }
.calc-head__art { width: clamp(220px, 36vw, 380px); height: auto; flex: 0 0 auto; align-self: flex-end; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-subtle); font-weight: 500; margin: 0 0 12px; display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.calc-head h1 { margin: 0; font-size: clamp(26px, 3.5vw, 38px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; max-width: 22ch; }
.calc-intro { margin: 12px 0 0; color: var(--text-muted); max-width: 62ch; }
.calc-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

.calc-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 960px) { .calc-grid { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; } }
.input-col, .results-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.overview-card { padding: 20px; }
.ov-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; color: var(--text-subtle); margin: 0 0 6px; }
.ov-headline { font-family: var(--font-mono); font-size: clamp(30px, 4.2vw, 44px); font-weight: 400; letter-spacing: -0.03em; line-height: 1; color: var(--text); }
.ov-range { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 7px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.kpi__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); }
.kpi__value { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--text); display: block; margin-top: 4px; }
.kpi__range { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); display: block; margin-top: 2px; }
@media (max-width: 460px) { .kpis { grid-template-columns: 1fr; } }

.breakdown-pair { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: stretch; }
@media (min-width: 1200px) { .breakdown-pair { grid-template-columns: 1fr 1fr; } }
.breakdown-card h3 .h3-sub { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-subtle); margin-left: 8px; }
.td-sub { font-size: 11px; color: var(--text-subtle); font-weight: 400; margin-left: 6px; }
.breakdown-card .num-col { width: 1%; white-space: nowrap; }
.cell-range { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); font-weight: 400; margin-top: 2px; }

.disclaimer { padding: 16px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.disclaimer strong { color: var(--text); }

/* ============ MINI-CHARTS (Rechner) ============
   Per JS befüllt → Styles GLOBAL, nicht Astro-scoped (pet-calc-Lehre).
   Keine Chart-Library: reine CSS-Balken + Inline-SVG, Farben nur über Tokens. */
.viz { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.viz-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); font-weight: 500; margin: 0 0 12px; }
.viz-note { margin: 10px 0 0; font-size: 11px; color: var(--text-subtle); line-height: 1.5; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 5px; }
.viz-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* Einkommensbalken: Länge = Einkommen, gefüllter Teil = Beitrag */
.incbar-group { margin-bottom: 14px; }
.incbar-group:last-child { margin-bottom: 0; }
.incbar-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin: 0 0 4px; }
/* Feste Wert-Spalte: sonst variiert die Track-Breite mit der Labellänge
   und gleiche Einkommen wären unterschiedlich lang (Vergleichbarkeit!). */
.incbar-row { display: grid; grid-template-columns: 16px 1fr 104px; align-items: center; gap: 8px; margin-bottom: 4px; }
.incbar-row:last-child { margin-bottom: 0; }
.incbar-row .who { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }
.incbar-row .val { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; text-align: right; }
.incbar-track { min-width: 0; }
.incbar { height: 16px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.incbar__fill { height: 100%; background: var(--brand); transition: width 0.3s ease; }
@media (prefers-reduced-motion: reduce) { .incbar__fill { transition: none; } }

/* Verbleib-Balken mit Schwellen-Marke (z. B. Selbstbehalt) */
.remainbar-wrap { position: relative; padding: 6px 0 22px; }
.remainbar { display: flex; height: 20px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-sunken); border: 1px solid var(--border); }
.remainbar__seg { height: 100%; background: var(--brand); }
.remainbar__marker { position: absolute; top: 0; height: 32px; border-left: 2px dashed var(--warning); }
.remainbar__marker-label { position: absolute; top: 36px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--text-subtle); white-space: nowrap; }
.remainbar-wrap--labeled { padding-bottom: 34px; }

/* Schmaler Zusammensetzungs-Balken (z. B. Tabellenbetrag = Zahlbetrag + ½ Kindergeld) */
.splitbar { display: flex; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: var(--bg-sunken); margin: 8px 0 2px; }
.splitbar__a { background: var(--brand); }
.splitbar__b { background: var(--border-strong); }

/* Bezugsdauer-Timeline (Elterngeld): Blöcke via background-size, kein Element-Spam */
.timeline { display: grid; gap: 10px; }
.timeline-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; }
.tl-name { font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.tl-name .tl-amt { display: block; font-family: var(--font-mono); color: var(--text); }
.tl-track { position: relative; height: 22px; background: var(--bg-sunken); border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.tl-bar { position: absolute; top: 0; bottom: 0; left: 0; background: var(--brand); }
.tl-bar--half { top: 25%; bottom: 25%; border-radius: 2px; }
.tl-bar--partner { opacity: 0.55; }
.tl-blocks { background-image: linear-gradient(90deg, var(--bg-elev) 0, var(--bg-elev) 1px, transparent 1px); }
.tl-axis { grid-column: 2; position: relative; height: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--text-subtle); margin-top: -4px; }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: none; right: 0; left: auto !important; }

/* ============ FOOTER ============ */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--gap-4); margin-top: var(--gap-6); }
.site-footer__row {
  display: flex; flex-wrap: wrap; gap: var(--gap-2) var(--gap-3);
  justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: var(--step-mono);
  color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.06em;
}
.site-footer a { color: var(--fg-muted); text-decoration: none; transition: color var(--transition); }
.site-footer a:hover { color: var(--brand-strong); }
.site-footer__links { display: inline-flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* ============ SPRACHE (CSS-Toggle) ============
   Beide Sprachen liegen im DOM; das aktive html[lang] blendet die andere aus. */
:root[lang="de"] [data-en] { display: none !important; }
:root[lang="en"] [data-de] { display: none !important; }

/* No-JS: Controls verstecken bis Script initialisiert (kein Flackern). */
.no-js .controls { visibility: hidden; }
