/* Toerdle — shared stylesheet for content pages + landers.
 *
 * Cookie-free by construction: self-referential system font stack (no Google
 * Fonts), zero third-party embeds, zero analytics (W-G5). Tokens mirror the
 * app's ToerdleTheme + the landing page. Light-primary with a readable
 * prefers-color-scheme: dark override.
 *
 * The polished marketing landing (index.html) keeps its own bespoke CSS; this
 * sheet dresses the doc pages (impressum, datenschutz, methodik, rechner,
 * ratgeber, presse, changelog, krisenhilfe, konto-loeschen) and the invite/
 * challenge landers so they read as one system.
 */

:root {
  --ink: #0E1116;
  --ink-2: #333841;
  --muted: #6B7078;
  --soft: #9EA4AD;
  --page: #F2F1ED;
  --shell: #FFFFFF;
  --shell-2: #F7F7F5;
  --section: #F0F0F3;
  --stroke: #E5E5E1;
  --line: rgba(14, 17, 22, .07);
  --carbs: #A6C97E;
  --protein: #5BA8E8;
  --fat: #F5C04A;
  --green-soft: #EAF4DF;
  --blue-soft: #E6F0FA;
  --amber-soft: #FBF0D4;
  --rose-soft: #F8E6DD;
  --shadow: 0 24px 70px -38px rgba(14, 17, 22, .42);
  --shadow-soft: 0 18px 52px -36px rgba(14, 17, 22, .32);
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-pill: 999px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--shell);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a.link, .doc a:not(.btn):not(.store-badge):not(.brand) {
  color: #2E6BBE;
  text-decoration: underline;
  text-underline-offset: 2px;
}
img, svg { display: block; max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }

/* ---- Page shell (shared with landing) — full-bleed, no floating card ---- */
.page {
  width: 100%;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--shell);
}
.wrap { width: min(100% - 64px, 900px); margin: 0 auto; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 82px; padding-top: 6px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 800; }
.brand-mark {
  display: grid; width: 40px; height: 40px; place-items: center; overflow: hidden;
  border: 1px solid rgba(14, 17, 22, .08); border-radius: 12px; background: #fff;
  box-shadow: 0 14px 30px -22px rgba(14, 17, 22, .46);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.nav-links { display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: 13px; font-weight: 700; }
.nav-links a { transition: color .18s ease; }
.nav-links a:hover { color: var(--ink); }

.btn {
  display: inline-flex; min-height: 46px; align-items: center; justify-content: center;
  gap: 10px; border-radius: var(--r-pill); font-size: 14px; font-weight: 800;
  padding: 0 22px; cursor: pointer; border: 0;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { color: #fff; background: var(--ink); box-shadow: 0 18px 38px -24px rgba(14, 17, 22, .8); }
.btn-secondary { color: var(--ink); border: 1px solid var(--stroke); background: #fff; }

.store-badge {
  display: inline-flex; min-width: 148px; min-height: 46px; align-items: center; gap: 10px;
  padding: 8px 15px; border-radius: var(--r-pill); color: #fff; background: #0B0C0F;
  box-shadow: 0 18px 36px -26px rgba(14, 17, 22, .9);
}
.store-badge svg { width: 19px; height: 19px; flex: 0 0 auto; }
.store-badge small, .store-badge strong { display: block; line-height: 1.05; }
.store-badge small { color: rgba(255, 255, 255, .68); font-size: 9px; font-weight: 700; }
.store-badge strong { margin-top: 2px; font-size: 13px; font-weight: 800; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--stroke); border-radius: var(--r-pill); color: var(--ink-2);
  background: rgba(255, 255, 255, .78); font-size: 12px; font-weight: 800;
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--carbs); }

/* ---- Doc / prose ---- */
.doc { padding: 26px 0 40px; }
.doc h1 { font-size: 42px; font-weight: 800; line-height: 1.05; margin: 8px 0 6px; letter-spacing: -.01em; }
.doc .lede { color: var(--muted); font-size: 18px; font-weight: 600; margin: 0 0 8px; max-width: 60ch; }
.doc h2 { font-size: 26px; font-weight: 800; line-height: 1.15; margin: 40px 0 10px; }
.doc h3 { font-size: 18px; font-weight: 800; margin: 26px 0 6px; }
.doc p { margin: 0 0 14px; font-size: 16px; color: var(--ink-2); max-width: 66ch; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; max-width: 66ch; }
.doc li { margin: 6px 0; font-size: 16px; color: var(--ink-2); }
.doc small, .doc .muted { color: var(--muted); font-size: 13px; }
.doc hr { border: 0; border-top: 1px solid var(--stroke); margin: 34px 0; }
.doc .updated { color: var(--soft); font-size: 13px; font-weight: 700; margin-bottom: 22px; }

.card {
  padding: 22px; border: 1px solid var(--stroke); border-radius: var(--r-md);
  background: var(--shell); margin: 0 0 16px;
}
.card.tonal { background: var(--green-soft); border-color: transparent; }
.card.warn { background: var(--amber-soft); border-color: transparent; }

.table-scroll { overflow-x: auto; margin: 0 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
th { font-weight: 800; color: var(--ink); background: var(--shell-2); }

.pill-label {
  display: inline-block; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  background: var(--section); color: var(--ink-2);
}

/* ---- Rechner (calculator) ---- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); gap: 22px; align-items: start; }
.calc-form { padding: 22px; border: 1px solid var(--stroke); border-radius: var(--r-md); background: var(--shell); }
.calc-field { margin: 0 0 16px; }
.calc-field label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.calc-field input, .calc-field select {
  width: 100%; min-height: 46px; padding: 0 14px; font-size: 16px; font-family: var(--font);
  color: var(--ink); background: #fff; border: 1px solid var(--stroke); border-radius: var(--r-sm);
}
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 700; font-family: var(--font);
  color: var(--ink-2); background: #fff; border: 1px solid var(--stroke); border-radius: var(--r-sm); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.calc-out { padding: 24px; border-radius: var(--r-md); background: var(--green-soft); position: sticky; top: 20px; }
.calc-out .big { font-size: 54px; font-weight: 800; line-height: .95; letter-spacing: -.02em; }
.calc-out .unit { font-size: 16px; font-weight: 700; color: var(--ink-2); }
.calc-out .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-top: 1px solid rgba(14,17,22,.08); }
.calc-out .row:first-of-type { border-top: 0; }
.floor-note {
  margin-top: 14px; padding: 14px; border-radius: var(--r-sm);
  background: var(--amber-soft); font-size: 14px; font-weight: 700; color: var(--ink);
}
.floor-note[hidden] { display: none; }

/* ---- Lander (invite / challenge) ---- */
.lander { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.lander-card {
  width: min(100%, 460px); padding: 34px 28px 30px; border-radius: var(--r-lg);
  background: var(--shell); border: 1px solid var(--stroke); box-shadow: var(--shadow);
  text-align: center;
}
.lander-card .brand { justify-content: center; margin-bottom: 20px; }
.lander-card h1 { font-size: 26px; font-weight: 800; line-height: 1.15; margin: 0 0 8px; }
.lander-card p { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.code-box {
  font-variant-numeric: tabular-nums; font-size: 40px; font-weight: 800; letter-spacing: .12em;
  padding: 16px; border-radius: var(--r-md); background: var(--shell-2); border: 1px dashed var(--stroke);
  margin: 0 0 8px; word-break: break-all;
}
.code-hint { color: var(--soft); font-size: 12px; font-weight: 700; margin: 0 0 22px; }
.lander-actions { display: grid; gap: 10px; }
.lander-actions .btn { width: 100%; }
.lander-actions .store-badge { justify-content: center; }
.lander-foot { margin-top: 22px; font-size: 12px; color: var(--soft); }
.lander-foot a { color: var(--muted); text-decoration: underline; }

/* ---- Footer ---- */
footer { padding: 18px 0 36px; }
.footer-line { padding-top: 26px; border-top: 1px solid var(--stroke); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px 24px; color: var(--muted); font-size: 13px; font-weight: 700; }
.footer-links a:hover { color: var(--ink); }
.copyright { margin-top: 18px; color: var(--soft); font-size: 12px; font-weight: 700; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 0 0 12px 0; font-weight: 800; z-index: 50;
}
.skip-link:focus { left: 0; }

@media (max-width: 760px) {
  .page { width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .wrap { width: min(100% - 32px, 900px); }
  .nav-links { display: none; }
  .doc h1 { font-size: 32px; }
  .doc h2 { font-size: 22px; }
  .calc { grid-template-columns: 1fr; }
  .calc-out { position: static; }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8DDC4;        /* warm cream — app dark-mode primary */
    --ink-2: #CFC6B2;
    --muted: #9A9384;
    --soft: #726C60;
    --page: #14140F;
    --shell: #1E1D17;
    --shell-2: #24231C;
    --section: #24231C;
    --stroke: #34322A;
    --green-soft: #22301C;
    --amber-soft: #322A16;
    color-scheme: dark;
  }
  body {
    background: var(--shell);
  }
  .brand-mark, .btn-secondary, .calc-field input, .calc-field select, .seg button, th { background: var(--shell-2); }
  .btn-primary { color: #14140F; background: var(--ink); }
  .seg button[aria-pressed="true"] { color: #14140F; background: var(--ink); border-color: var(--ink); }
  a.link, .doc a:not(.btn):not(.store-badge):not(.brand) { color: #8FBEF0; }
}
