/* Ich habe ME/CFS – Microsite
   Mobile first. Farben aus der Broschüre; Fließtext minimal abgedunkelt für Lesbarkeit (WCAG AA). */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blau: #11a5cb;          /* Broschüre: Text & Pinsel */
  --blau-text: #0a7896;     /* lesbarer Fließtext (5.1:1 auf Weiß, 4.7:1 auf Beige) */
  --blau-dunkel: #0a6a85;
  --terra: #c56e58;         /* Broschüre: Hervorhebungen, Überschriften */
  --terra-text: #b35c46;    /* lesbare Variante (4.6:1) */
  --tuerkis: #41b9ce;       /* Cover-Hintergrund */
  --sand: #e9c9af;          /* Cover-Boden */
  --papier: #ffffff;
  --papier-2: #fbf6f2;
  --linie: #ecdcd2;
  --fs: 1.125rem;           /* 18px Grundschrift mobil */
  --gutter: 20px;
  --topbar-h: 56px;
  color-scheme: light;
}
:root[data-fs="l"] { --fs: 1.3125rem; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 350;
  font-size: var(--fs);
  line-height: 1.6;
  color: var(--blau-text);
  background: var(--papier);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blau-dunkel); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--terra); outline-offset: 3px; border-radius: 4px; }
strong, b { font-weight: 600; }
p { margin: 0 0 1em; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--linie);
}
.brand { color: var(--terra-text); text-decoration: none; font-weight: 500; letter-spacing: .01em; white-space: nowrap; font-size: 1rem; }
.brand b { font-weight: 700; }
.topbar-nr { display: none; font-size: .8125rem; color: var(--blau-text); white-space: nowrap; }
@media (min-width: 520px) { .topbar-nr { display: inline; } }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn-icon, .btn-menu {
  font: inherit; color: var(--blau-dunkel); background: none; cursor: pointer;
  border: 1.5px solid currentColor; border-radius: 999px; min-height: 40px;
}
.btn-icon { width: 44px; font-weight: 600; font-size: .85rem; line-height: 1; }
.btn-icon span { font-size: 1.15em; }
:root[data-fs="l"] .btn-icon { background: var(--blau-dunkel); color: #fff; border-color: var(--blau-dunkel); }
.btn-menu { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 12px; font-weight: 500; font-size: .95rem; }
.burger, .burger::before, .burger::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -5px; } .burger::after { top: 5px; }
.btn-menu[aria-expanded="true"] .burger { background: transparent; }
.btn-menu[aria-expanded="true"] .burger::before { top: 0; transform: rotate(45deg); }
.btn-menu[aria-expanded="true"] .burger::after { top: 0; transform: rotate(-45deg); }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.progress::after { content: ""; display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--terra); }

/* ---------- Menü (Kapitelübersicht) ---------- */
.menu {
  position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 40;
  background: var(--papier-2);
  overflow-y: auto; overscroll-behavior: contain;
}
.menu[hidden] { display: none; }
.menu-inner { max-width: 720px; margin: 0 auto; padding: 16px var(--gutter) 40px; }
.menu-home { display: block; padding: 14px 4px; font-weight: 500; color: var(--terra-text); text-decoration: none; border-bottom: 1px solid var(--linie); }
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { border-bottom: 1px solid var(--linie); }
.toc a, .toc-soon {
  display: grid; grid-template-columns: 2.25rem 1fr auto; align-items: center; gap: 8px;
  min-height: 60px; padding: 8px 4px; text-decoration: none;
}
.toc a[aria-current="page"] { background: #fff; border-radius: 10px; box-shadow: inset 4px 0 0 var(--terra); }
.toc-nr { font-weight: 600; color: var(--blau); font-size: 1.05rem; text-align: center; }
.toc-soon { opacity: .45; }
.toc-soon em, .soon { font-style: normal; font-size: .75rem; color: var(--blau-text); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }

/* ---------- Handschrift-Überschriften ---------- */
.hl { display: block; }
.hl img { width: auto; height: auto; max-width: 100%; }  /* nur max-height setzen, sonst wird verzerrt */
h1, h2 { margin: 0 0 .9em; font-weight: 400; line-height: 1.2; }
h1 .hl img, h2 .hl img { max-height: clamp(26px, 7.2vw, 40px); object-fit: contain; object-position: left; }
.hl-toc img { max-height: 22px; }
.hl-toc img[src$="schluss.png"], .hl-pn img[src$="schluss.png"] { max-height: 40px; }
.hl-card img[src$="schluss.png"] { max-height: 34px; }
h1 .hl img[src$="schluss.png"] { max-height: clamp(48px, 13vw, 72px); }
.hl-pn img { max-height: 24px; }
.hl-card img { max-height: 20px; }
.h-plain { font-size: 1.25rem; font-weight: 600; color: var(--terra-text); }

/* ---------- Startseite ---------- */
.hero { background: linear-gradient(var(--tuerkis) 0 60%, var(--sand) 60%); }
.hero-img .ill { width: 100%; max-width: 1100px; margin: 0 auto; }
.hero-text {
  background: var(--papier); padding: 28px var(--gutter) 32px;
  border-radius: 22px 22px 0 0; margin-top: -18px; position: relative;
}
.hero-lead { font-size: 1.25em; line-height: 1.45; color: var(--blau-dunkel); font-weight: 400; }
.cta {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  min-height: 54px; padding: 0 26px; border-radius: 999px;
  background: var(--terra-text); color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem;
  box-shadow: 0 2px 0 rgba(0,0,0,.08);
}
.cta:hover { background: #9c4e3a; }
.cta-alt { background: var(--blau-dunkel); }
.cta-alt:hover { background: #084f63; }
.hero-hint { font-size: .9rem; margin-top: 14px; }

.vorwort, .kapitel-liste, .mehr { padding: 36px var(--gutter); }
.vorwort { background: var(--papier-2); }
.kapitel-liste { padding-bottom: 12px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  text-decoration: none; color: inherit; background: #fff;
  border: 1px solid var(--linie); border-radius: 14px; padding: 8px 8px 12px; position: relative;
}
a.card:hover { border-color: var(--terra); }
.card-img { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 8px; background: #fff; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-nr { font-size: .75rem; font-weight: 500; color: var(--blau-text); padding: 0 4px; }
.card .hl { padding: 0 4px; }
.card-soon { opacity: .5; }
.card .soon { position: absolute; top: 12px; right: 12px; background: #fff; }

/* ---------- Kapitel ---------- */
.chapter-ill { margin: 0; background: #fff; padding: 12px var(--gutter) 0; }
.chapter-ill .zoom { display: block; cursor: zoom-in; }
.chapter-ill .ill { margin: 0 auto; width: 100%; max-width: 640px; }
.chapter-text { padding: 20px var(--gutter) 24px; max-width: 40rem; }
.kicker { font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--blau-text); margin-bottom: .5em; }
.ina { color: var(--terra-text); font-weight: 600; }
.ina.gross { font-size: 1.2em; line-height: 1.4; }
.wichtig { margin: 0 0 1.4em; padding: 0; list-style: none; font-weight: 500; }
.wichtig li { position: relative; padding-left: 1.4em; margin-bottom: .7em; }
.wichtig li::before { content: ""; position: absolute; left: .2em; top: .62em; width: .5em; height: .5em; border-radius: 50%; background: var(--terra); }

.t { color: var(--terra-text); font-weight: 600; }

/* Kleine Zusatz-Grafik im Text (z. B. Akku) */
.inline-ill { margin: 0 0 1.2em; }
.inline-ill img { width: 180px; }

/* Text aus Illustrationen zum Aufklappen (Eisberg) */
.bildtext { margin: 0 0 1.4em; border: 1.5px solid var(--linie); border-radius: 14px; background: var(--papier-2); }
.bildtext summary {
  cursor: pointer; list-style: none; padding: 14px 16px; min-height: 48px;
  font-weight: 600; color: var(--blau-dunkel); display: flex; align-items: center; gap: 10px;
}
.bildtext summary::-webkit-details-marker { display: none; }
.bildtext summary::before { content: "+"; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--blau-text); color: #fff; font-weight: 600; flex: none; }
.bildtext[open] summary::before { content: "–"; }
.bildtext > :not(summary) { padding: 0 16px; }
.bildtext-intro { margin-bottom: .6em; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0 16px 16px !important; }
.chips li { background: var(--blau-text); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: .88em; font-weight: 450; }

/* Sprechblasen (Sätze aus den Illustrationen) */
.bubbles { list-style: none; margin: 0 0 1.6em; padding: 0; display: grid; gap: 10px; }
.bubbles li {
  position: relative; padding: 12px 18px; border-radius: 22px 22px 22px 6px;
  background: var(--terra-text); color: #fff; font-weight: 500; line-height: 1.4; max-width: 92%;
}
.bubbles li:nth-child(even) { background: var(--blau-text); justify-self: end; border-radius: 22px 22px 6px 22px; }
.bubbles li::before { content: "„"; }
.bubbles li::after { content: "“"; }
.bubbles small { display: block; font-size: .85em; opacity: .9; }
.bubbles-gut li { background: #fff; color: var(--blau-dunkel); border: 2px solid var(--blau); }
.bubbles-gut li:nth-child(even) { background: #fff; color: var(--terra-text); border-color: var(--terra); }

/* Zum Schluss: Sprechblase aus der Broschüre */
.chapter-schluss .chapter-text { max-width: 44rem; margin: 0 auto; }
.sprechblase {
  position: relative; isolation: isolate; color: #fff; text-align: center;
  padding: 18% 11% 38%; margin: 0 -12px; font-weight: 500; font-size: .94em; line-height: 1.4;
}
.sprechblase p { margin-bottom: .6em; }
.sprechblase::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("../img/schluss-blase.webp") center / 100% 100% no-repeat; filter: brightness(.82) saturate(1.1);
}
.sprechblase ol { list-style: none; padding: 0; margin: 1em 0; counter-reset: n; }
.sprechblase ol { margin: .6em 0; }
.sprechblase ol li { counter-increment: n; font-weight: 700; font-size: 1.05em; line-height: 1.3; margin: 0 0 .6em; }
.sprechblase ol li::before { content: counter(n); display: inline-block; width: 1.5em; height: 1.5em; line-height: 1.5em; margin-right: .35em; border-radius: 50%; background: #fff; color: var(--terra-text); font-size: .8em; vertical-align: .1em; }
.sprechblase .danke { margin: .8em 0 0; font-weight: 400; }
.schluss-ina { margin: clamp(16px, 3vw, 34px) 0 0; }  /* Abstand: Blase berührt das Gesicht nicht */
.schluss-ina .ill { width: 100%; max-width: 1100px; margin-left: auto; }

/* Mehr wissen */
.page-mehr { max-width: 46rem; margin: 0 auto; padding: 32px var(--gutter) 16px; }
.page-mehr section { margin-bottom: 44px; }
.linkliste { list-style: none; padding: 0; margin: 0 0 1.2em; }
.linkliste li { border-bottom: 1px solid var(--linie); }
.linkliste a { display: block; padding: 12px 0; min-height: 48px; }
.credits dt { font-weight: 600; color: var(--terra-text); margin-top: 1em; }
.credits dd { margin: .2em 0 0; }
.credits dd p { margin-bottom: .5em; }
.credits sup { line-height: 0; }
.personen { list-style: none; margin: .3em 0 0; padding: 0; }
.personen li { position: relative; padding-left: 1.3em; margin-bottom: .45em; }
.personen li::before { content: ""; position: absolute; left: .2em; top: .65em; width: .45em; height: .45em; border-radius: 50%; background: var(--terra); }
.hinweis { font-size: .85rem; margin-top: 2em; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-ghost { background: transparent; color: var(--blau-dunkel); border: 1.5px solid currentColor; box-shadow: none; }
.cta-ghost:hover { background: var(--papier-2); }

/* Fachinfo im blauen Pinselstrich */
.fachinfo {
  position: relative; isolation: isolate;
  margin: 2em calc(var(--gutter) * -0.5) 0; padding: 44px 30px 40px;
  color: #fff; font-weight: 450; font-size: .94em; line-height: 1.55;
}
.fachinfo::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--blau-text);
  -webkit-mask: url("../img/brush-3.png") center / 100% 100% no-repeat;
          mask: url("../img/brush-3.png") center / 100% 100% no-repeat;
}
.fachinfo p:last-child { margin-bottom: 0; }
.fachinfo strong { font-weight: 700; }
.fachinfo a { color: #fff; }
.fachinfo-kopf { font-weight: 700; font-size: .88em; letter-spacing: .01em; }
.fachinfo-kopf span { font-size: 1.3em; line-height: 0; vertical-align: -.15em; }

/* Blättern */
.pager { display: grid; gap: 12px; padding: 8px var(--gutter) 40px; max-width: 1280px; margin: 0 auto; }
.pn {
  display: flex; flex-direction: column; gap: 8px; justify-content: center;
  min-height: 84px; padding: 14px 18px; border-radius: 16px; text-decoration: none;
  border: 1.5px solid var(--linie); background: var(--papier-2);
}
.pn-next { order: -1; background: #fff; border-color: var(--terra); }
a.pn-next:hover { background: #fff7f4; }
.pn-label { font-size: .8125rem; font-weight: 600; color: var(--blau-text); text-transform: uppercase; letter-spacing: .06em; }
.pn-next .pn-label::after { content: " →"; }
.pn-prev .pn-label::before { content: "← "; }
.pn-soon { opacity: .55; }
.pn-soon em { font-style: normal; font-size: .8rem; }

/* Footer */
.footer { background: var(--papier-2); border-top: 1px solid var(--linie); padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom)); font-size: .95rem; }
.footer .small { font-size: .8rem; }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  :root { --gutter: 32px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .vorwort .cols { columns: 2; column-gap: 40px; }
  .vorwort .cols p { break-inside: avoid; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pn-next { order: 2; text-align: right; align-items: flex-end; }
  .hl-pn img { object-position: right; }
  .pn-prev .hl-pn img { object-position: left; }
}

/* ---------- Desktop: Doppelseite wie in der Broschüre ---------- */
@media (min-width: 960px) {
  :root { --fs: 1.125rem; --topbar-h: 64px; }
  :root[data-fs="l"] { --fs: 1.3rem; }
  .brand { font-size: 1.1rem; }

  /* Breites Cover (seitlich nahtlos verlängert) füllt die ganze linke Fläche – keine Kanten */
  /* Höhe folgt der Bildspalten-BREITE (Seitenverhältnis), nicht der Fensterhöhe –
     so bleibt die Sprechblase bei jeder Fenstergröße sichtbar. */
  .hero { display: grid; grid-template-columns: 1.25fr 1fr; align-items: stretch; background: none; }
  .hero-img { position: relative; overflow: hidden; background: #3cbbcd;
              aspect-ratio: 7 / 5; max-height: calc(100vh - var(--topbar-h)); min-height: 400px; }
  .hero-img picture, .hero-img .ill {
    position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
    object-fit: cover; object-position: 50% 100%;
  }
  .hero-text > * { max-width: 34rem; }
  .hero-text { margin: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 56px 56px; }
  .hero-lead { font-size: 1.45rem; }
  .hero-text .cta { align-self: flex-start; }
  .vorwort, .kapitel-liste, .mehr { padding: 64px max(56px, calc((100vw - 1180px) / 2)); }
  .vorwort .cols { columns: 3; }
  .cards { grid-template-columns: repeat(4, 1fr); gap: 18px; }

  .chapter {
    display: grid; grid-template-columns: 1fr 1fr; align-items: start;
    max-width: 1320px; margin: 0 auto;
  }
  .chapter-ill {
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
    display: flex; align-items: center; justify-content: center; padding: 32px 40px;
  }
  .chapter-ill .zoom, .chapter-ill .ill { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; }
  .chapter-text { padding: 56px 56px 40px 32px; max-width: 38rem; }
  h1 .hl img, h2 .hl img { max-height: 42px; }
  .fachinfo { margin-left: -28px; margin-right: -28px; padding: 48px 44px 44px; }
  .chapter-schluss { display: block; }
  .chapter-schluss .chapter-text { padding: 56px 32px 0; }
  .sprechblase { padding: 12% 15% 25%; font-size: 1.1em; max-width: 760px; margin: 0 auto; }
  .page-mehr { padding-top: 56px; }

  .menu { left: auto; width: min(460px, 100vw); box-shadow: -12px 0 40px rgba(0,0,0,.12); }
}
/* Mittlere Breiten: Bildspalte breiter und Hero etwas niedriger, damit die Sprechblase nicht angeschnitten wird;
   falls doch beschnitten wird, dann rechts (Wand) statt links (Sprechblase). */
@media (min-width: 960px) and (max-width: 1279px) {
  .hero { grid-template-columns: 1.45fr 1fr; }
  .hero-text { padding: 40px 36px; }
  .hero-lead { font-size: 1.25rem; }
  .hero-img picture, .hero-img .ill { object-position: 44% 100%; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  border: 0; padding: 0; margin: 0;
  /* eigener Hintergrund: deckt auf dem iPhone auch die Notch-Ränder ab */
  background: rgba(10, 50, 62, .95);
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  display: none; align-items: center; justify-content: center;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(10, 50, 62, .6); }
.lightbox-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox-credit { color: rgba(255,255,255,.85); font-size: .72rem; letter-spacing: .02em; text-align: center; }
.lightbox-img {
  max-width: calc(100vw - 24px); max-height: calc(100dvh - 120px);
  width: auto; height: auto; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.lightbox-close {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--blau-dunkel); font: inherit; font-size: 2rem; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.lightbox-close:hover { background: var(--papier-2); }
.lightbox-close:focus-visible { outline-color: #fff; }
html.lightbox-open { overflow: hidden; }
@media (min-width: 960px) and (min-height: 541px) {
  .lightbox-img { max-width: min(1400px, calc(100vw - 160px)); max-height: calc(100dvh - 110px); padding: 12px; }
  .lightbox-close { top: 20px; right: 24px; }
}
/* Handy quer (wenig Höhe): Bild nutzt fast die ganze Höhe, Nachweis liegt im Bild,
   Schließen-Knopf sitzt neben dem Bild. */
@media (orientation: landscape) and (max-height: 540px) {
  .lightbox-fig { position: relative; }
  .lightbox-img {
    max-height: calc(100dvh - 12px);
    max-width: calc(100vw - 2 * max(64px, env(safe-area-inset-right), env(safe-area-inset-left)));
    padding: 4px; border-radius: 8px;
  }
  .lightbox-credit {
    position: absolute; right: 10px; bottom: 8px;
    font-size: .62rem; color: rgba(0,0,0,.6);
    background: rgba(255,255,255,.85); padding: 1px 6px; border-radius: 4px;
  }
  .lightbox-close { width: 44px; height: 44px; font-size: 1.6rem; top: 8px; right: max(10px, env(safe-area-inset-right)); }
}

/* externer Link: kleiner Hinweis-Pfeil */
a[target="_blank"]::after { content: " ↗"; font-size: .8em; text-decoration: none; display: inline-block; margin-left: .1em; }
a.cta[target="_blank"]::after { font-size: .9em; }

@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] .lightbox-img { animation: lb-in .18s ease-out; }
  @keyframes lb-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
  .btn-menu .burger, .btn-menu .burger::before, .btn-menu .burger::after { transition: transform .2s, background .2s; }
}

@media print {
  .topbar, .menu, .pager, .skip { display: none !important; }
}

/* ---------- 404 ---------- */
.page-404 { max-width: 40rem; margin: 0 auto; padding: 40px var(--gutter) 56px; text-align: center; }
.page-404 h1 { font-size: 1.6rem; font-weight: 600; color: var(--terra-text); margin-top: 1em; }
.page-404 .btn-row { justify-content: center; margin-top: 1.5em; }
.p404-ill { margin: 0; }
