/* ============================================================
   Ferment-Wiki · Basis-Styles & Komponenten
   Komponenten-Spiegel der App-Widgets (Design System §4):
   Card, Chip, Status-Pill, Button, Progress-Track, Slider,
   Input-Feld — übersetzt für eine Leseseite statt einer App.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 12px); /* Anker unter der Sticky-Bar */
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;             /* Fallback */
  font-size: var(--fs-body);   /* fluide 16 → 17 px (App: 15) */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;  /* kein grauer Flash beim Tippen */
}

/* Touch: Doppeltipp-Zoom aus, Fingernägel-große Ziele, spürbares Antippen */
a, button, .chip, summary,
input[type="range"], input[type="number"], select { touch-action: manipulation; }
@media (pointer: coarse) {
  .chip { height: 40px; padding: 0 16px; }
  .topnav a { min-height: 40px; }
}

img, svg { display: block; max-width: 100%; }

a { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--color-accent-pressed); }

/* ---------- Typografie-Rollen (FermentText) ---------- */

.h-display {           /* H1 · Serif, im Web fluide 40–56 px (App: 34/38) */
  font-family: var(--font-serif);
  font-size: 40px;             /* Fallback */
  font-size: var(--fs-display);
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-weight: 400;
  text-wrap: balance;          /* gleichmäßige Umbrüche bei langen Titeln */
}
.h-section {           /* H2 · Serif statt Sans — editorialer Sektionslook (App: Sans 20 SemiBold) */
  font-family: var(--font-serif);
  font-size: 24px;             /* Fallback */
  font-size: var(--fs-h2);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 400;
}
.h-card {              /* H3 · Sans 17/22 Medium */
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 22px;
  font-weight: 500;
}
.subtitle {
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-muted);
}
.micro {               /* Label · Sans 11/14 +0.10em UPPER */
  font-size: 11px;
  line-height: 14px;
  letter-spacing: .10em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.data {                /* Messwerte · Mono 15/20 tabular */
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

p { margin: 0 0 var(--space-md); }
p:last-child { margin-bottom: 0; }

/* ---------- Layout ---------- */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--screen-h) var(--space-xxl);
}

.section { margin-top: 48px; margin-top: var(--section-gap); } /* Web: 48 → 80 px statt 32 px */
.section > .micro { display: block; margin-bottom: var(--space-sm); }
.section-head { margin-bottom: var(--space-md); }

/* Nummerierte Sektionen — Zähler läuft pro Seite, ohne HTML-Anpassung:
   "01 — Zeitfenster & Temperatur". Sektionen ohne H2 zählen nicht mit. */
.page { counter-reset: wiki-section; }
.section > .h-section::before {
  counter-increment: wiki-section;
  content: counter(wiki-section, decimal-leading-zero) " —";
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.62em;
  letter-spacing: 0;
  color: var(--color-accent);
  margin-right: 0.45em;
}

hr.hairline {
  border: none;
  border-top: 1px solid var(--color-hairline);
  margin: clamp(40px, 5vw, 64px) 0;
}

.lede {                 /* erster Absatz unter der H1, etwas größer gesetzt */
  font-size: 18px;             /* Fallback */
  font-size: var(--fs-lede);   /* fluide 18,4 → 21,6 px */
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 58ch;
}

/* ---------- Top-Bar (Pendant zur NavBar: Surface, 1px Hairline, keine Elevation) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-hairline);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--screen-h);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}
.brand {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: -0.2px;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.brand em { font-style: italic; color: var(--color-accent); }
.topnav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  flex-shrink: 0;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 400;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-pill);
  transition: color var(--motion-fast) linear, background var(--motion-fast) linear;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
.topnav a:hover { color: var(--color-text); background: var(--color-accent-tint); }
.topnav a:active { color: var(--color-accent-pressed); }
.topnav a[aria-current="page"] {
  color: var(--color-surface);
  background: var(--color-accent);
  font-weight: 600;
}
.topnav a[aria-current="page"]:hover { color: var(--color-surface); }

/* Mittelgroße Screens: enger gesetzte Pills, damit die Reihe ohne
   Scrollen passt (unter 860 px greift stattdessen das zweizeilige
   Mobile-Layout unten). */
@media (max-width: 1080px) and (min-width: 861px) {
  .topnav { gap: 2px; }
  .topnav a { padding: var(--space-sm) 10px; }
}

/* Mobil/Tablet-hoch: Brand-Zeile oben, Nav als volle Breite mit
   Horizontal-Scroll und Edge-Fade — kein JS-Hamburger nötig. */
@media (max-width: 860px) {
  .topbar-inner {
    max-width: none;               /* Scroll-Reihe darf bis an den Rand */
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }
  .brand {
    padding: 10px var(--screen-h) 6px;
    font-size: 20px;
  }
  .topnav {
    gap: 2px;
    padding: 0 var(--screen-h) 10px;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right,
        transparent 0, #000 14px, #000 calc(100% - 26px), transparent 100%);
            mask-image: linear-gradient(to right,
        transparent 0, #000 14px, #000 calc(100% - 26px), transparent 100%);
  }
  .topnav a {
    flex-shrink: 0;
    min-height: 42px;
    padding: 0 15px;
  }
  /* Anker unter der jetzt höheren Leiste */
  html { scroll-padding-top: 118px; }
}

/* ---------- Card (Atom-Basis: Surface, Radius 20, ein Schatten, kein Border) ---------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}
.card--flush { padding: 0; overflow: hidden; }
/* Sehr schmale Screens: etwas mehr Leseraum in Karten
   (:not, damit card--flush ohne Padding bleibt) */
@media (max-width: 400px) {
  .card:not(.card--flush) { padding: var(--space-md); }
}
.card-grid {
  display: grid;
  gap: var(--space-lg);
}
@media (min-width: 640px) {
  .card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Ferment-Kachel auf Übersichtsseiten (Avatar-Tile: Radius 16, Tint-Fill) */
.tile {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-tile);
  background: var(--color-accent-tint);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--color-accent);
}
.tile--secondary { background: #E9EBE0; color: var(--color-secondary); } /* 12%-Tint von secondary über surface */

.link-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform var(--motion-fast) var(--ease-emphasized),
              box-shadow var(--motion-fast) linear;
}
.link-card:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow-sheet); }
.link-card:hover .h-card { color: var(--color-accent); }
.link-card:active { transform: translateY(0); }   /* Touch: Antippen spürbar ohne Hover-Lift */

/* ---------- Status-Pill (nie Farbe allein — immer ein Wort) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: .10em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-surface);
  white-space: nowrap;
}
.pill--success { background: var(--color-success); }
.pill--warning { background: var(--color-warning); }
.pill--danger  { background: var(--color-danger); }
.pill--accent  { background: var(--color-accent); }
.pill--neutral { background: var(--color-secondary); }

/* ---------- Chip (Filter/Tags: Tint-Fill, Accent-Text, Höhe 34) ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-tint);
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--motion-fast) linear, color var(--motion-fast) linear,
              transform var(--motion-fast) var(--ease-emphasized);
}
.chip:hover { transform: scale(.98); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"], .chip.is-selected {
  background: var(--color-accent);
  color: var(--color-surface);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-control);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform var(--motion-fast) var(--ease-emphasized),
              background var(--motion-fast) linear;
}
.btn-primary { background: var(--color-accent); color: var(--color-surface); }
.btn-primary:hover { background: var(--color-accent-pressed); color: var(--color-surface); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  box-shadow: inset 0 0 0 1.5px var(--color-accent);
}
.btn-secondary:hover { background: var(--color-accent-tint); color: var(--color-accent-pressed); }

/* ---------- Callout (Hinweiskarte in Semantik-Tints) ---------- */

.callout {
  border-radius: var(--radius-card);
  background: var(--color-success-tint);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  gap: var(--space-md);
  align-items: baseline;
}
.callout p { margin: 0; font-size: 14px; line-height: 22px; }
.callout--warning { background: var(--color-warning-tint); }
.callout--danger  { background: #F5DFD8; } /* Danger-Tint, gleiche Mischlogik wie success/warning */
.callout--accent  { background: var(--color-accent-tint); }
.callout .micro { flex-shrink: 0; padding-top: 3px; }

/* ---------- Daten-/Wissenstabellen ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .10em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-hairline);
  white-space: nowrap;
}
.data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-hairline);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   Volumen-Rechner — das Web-Pendant zum Recipe Calculator
   (Screen 05). „Eine Eingabe treibt alles: das Glasvolumen.“
   Slider = Atom 5: 4px Track, 26px Thumb mit 2px-Ring,
   Live-Wert oben rechts in Mono.
   ============================================================ */

.calculator { margin-top: var(--space-lg); }

.calc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.calc-value { font-family: var(--font-mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

.vol-slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.vol-slider:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: var(--radius-pill); }
.vol-slider:disabled { opacity: .45; cursor: default; }

.vol-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right,
      var(--color-accent) var(--fill, 50%),
      var(--color-accent-tint) var(--fill, 50%));
}
.vol-slider::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-tint);
}
.vol-slider::-moz-range-progress {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -11px;               /* (26−4)/2 → zentriert auf dem Track */
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.vol-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

.calc-presets { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }

/* Zutatenliste — Betrag rechts in Mono-Tabular, Name links (Subtitle-Rolle) */
.ing-list { list-style: none; margin: var(--space-lg) 0 0; padding: 0; }
.ing-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-hairline);
}
.ing-list li:last-child { border-bottom: none; }
.ing-name { font-size: 15px; }
.ing-note { font-size: 12px; color: var(--color-text-muted); }
.ing-amount {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ing-unit { color: var(--color-text-muted); font-size: 13px; margin-left: 4px; }
.calc-total {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-hairline);
}

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

.footer {
  border-top: 1px solid var(--color-hairline);
  margin-top: var(--section-gap);   /* folgt dem Sektionsrhythmus */
  background: var(--color-surface);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-lg) var(--screen-h);
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.footer p { margin: 0; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }

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

.hero {
  padding: clamp(2rem, 4vw, 3rem) 0 var(--space-lg);
  display: grid;
  gap: var(--space-lg);
}
@media (min-width: 720px) {
  .hero.with-figure { grid-template-columns: 1fr 168px; align-items: center; }
  .hero-figure { justify-self: end; }
}
/* Unterhalb des Zweispalten-Heros: Rotator mittig statt links */
@media (max-width: 719px) {
  .hero.with-figure .hero-figure { justify-self: center; }
}
.hero .lede { margin-top: var(--space-md); }
.hero-pills { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }

/* ---------- Listen ---------- */

ul.ticklist { list-style: none; margin: 0; padding: 0; }
ul.ticklist li {
  position: relative;
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
}
ul.ticklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-secondary);
}

dl.defs { margin: 0; }
dl.defs dt { font-weight: 600; margin-top: var(--space-md); }
dl.defs dt:first-child { margin-top: 0; }
dl.defs dd { margin: var(--space-xs) 0 0; color: var(--color-text-muted); }
