/* ==========================================================================
   Vorlesefestival – Download-Seite
   Ergänzt base.css und die tf-/vf-Komponenten. Alle Regeln sind auf #vfd
   begrenzt und mit vfd- benannt, damit nichts mit dem übrigen CSS kollidiert.
   ========================================================================== */

/* Hero-Grafik (liegt im vorhandenen tf-hero, außerhalb von #vfd) */
section.tf-hero .vfd-hero-grafik { display: block; width: 100%; max-width: 460px; height: auto; margin-inline: auto; }
@media (max-width: 1150px) { section.tf-hero .vfd-hero-grafik { max-width: 340px; } }

/* Variablen: greifen auf die Seiten-Variablen zu, mit Ersatzwerten */
#vfd {
  --vfd-rot: var(--main-color, #ff2f23);
  --vfd-gelb: var(--secondary-color, #ffc700);
  --vfd-navy: var(--textcolor, #1a3056);
  --vfd-navy-mittel: var(--textcolor-medium-soft, #647697);
  --vfd-offwhite: var(--background-off-white, #fffaf6);
  --vfd-karte: #fdf8f3;
  --vfd-karte-rand: #eee4d8;
  --vfd-gelb-hell: var(--vf-s1-hell, #fff3ba);
  --vfd-rosa-hell: var(--vf-s3-hell, #fbd0cc);
  --vfd-blau-hell: var(--vf-s4-hell, #cddcea);
  --vfd-gruen-hell: var(--vf-s5-hell, #deece1);
  --vfd-linie: rgba(26, 48, 86, 0.12);
  --vfd-header-hoehe: 50px;   /* Höhe des verkleinerten tf-header */
}
#vfd *, #vfd *::before, #vfd *::after { box-sizing: border-box; }
#vfd [hidden] { display: none !important; }   /* tf-button setzt display:flex und würde hidden sonst aufheben */

/* Icons im Linien-Stil (überschreibt die fill-Regeln von tf-button) */
#vfd svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#vfd .tf-button svg, #vfd .tf-button:hover svg { fill: none; }

/* --------------------------------------------------------------------------
   Größen-Auswahl
   -------------------------------------------------------------------------- */
#vfd .vfd-wahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 1.5rem; border: 0; padding: 0; min-width: 0; }
#vfd .vfd-wahl legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#vfd .vfd-wahl label { position: relative; display: flex; gap: 1rem; align-items: flex-start; background: var(--vfd-karte); border: 2px solid var(--vfd-karte-rand); border-radius: 1rem; padding: 1.5rem; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
#vfd .vfd-wahl input { position: absolute; inset: 0; opacity: 0; margin: 0; }
#vfd .vfd-wahl label:hover { border-color: var(--vfd-navy-mittel); }
#vfd .vfd-wahl label:has(input:checked) { border-color: var(--vfd-navy); background: white; }
#vfd .vfd-wahl label:has(input:focus-visible) { outline: 3px solid var(--vfd-gelb); outline-offset: 3px; }
#vfd .vfd-wahl-text { flex: 1; min-width: 0; }
#vfd .vfd-wahl-text b { display: block; font-size: 1.25rem; line-height: 1.5rem; font-weight: bold; }
#vfd .vfd-wahl-text span { display: block; margin-top: 0.25rem; font-size: 1.05rem; line-height: 1.5rem; font-weight: 400; }
#vfd .vfd-radio { flex: none; width: 24px; height: 24px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--vfd-navy-mittel); display: grid; place-items: center; }
#vfd .vfd-wahl input:checked ~ .vfd-radio { border-color: var(--vfd-navy); background: var(--vfd-navy); }
#vfd .vfd-wahl input:checked ~ .vfd-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: white; }

#vfd .vfd-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--vfd-navy); }
#vfd .vfd-icon svg { width: 22px; height: 22px; }
#vfd .vfd-icon.vfd-gelb { background: var(--vfd-gelb-hell); }
#vfd .vfd-icon.vfd-blau { background: var(--vfd-blau-hell); }
#vfd .vfd-icon.vfd-rosa { background: var(--vfd-rosa-hell); }
#vfd .vfd-icon.vfd-gruen { background: var(--vfd-gruen-hell); }

/* --------------------------------------------------------------------------
   Sticky-Leiste mit kompakter Größen-Auswahl
   -------------------------------------------------------------------------- */
#vfd .vfd-leiste { position: fixed; top: var(--vfd-header-hoehe); left: 0; right: 0; z-index: 5; background: var(--vfd-offwhite); border-bottom: 1px solid var(--vfd-linie); box-shadow: 0 2px 10px rgba(26, 48, 86, 0.08); transform: translateY(-120%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
#vfd .vfd-leiste.vfd-sichtbar { transform: none; visibility: visible; }
#vfd .vfd-leiste-innen { width: min(90vw, 1400px); margin: auto; padding: 0.5rem 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; }
#vfd .vfd-leiste-frage { font-size: 1rem; font-weight: 600; }
#vfd .vfd-segment { display: flex; gap: 4px; padding: 4px; min-width: 0; background: white; border: 1px solid var(--vfd-karte-rand); border-radius: 25px; }
#vfd .vfd-segment label { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 1rem; border-radius: 21px; font-size: 1rem; line-height: 1.3rem; font-weight: 500; white-space: nowrap; cursor: pointer; }
#vfd .vfd-segment input { position: absolute; inset: 0; opacity: 0; margin: 0; }
#vfd .vfd-segment label:has(input:checked) { background: var(--vfd-navy); color: white; }
#vfd .vfd-segment label:has(input:focus-visible) { outline: 3px solid var(--vfd-gelb); outline-offset: 2px; }
#vfd .vfd-segment i { flex: none; width: 10px; height: 10px; border-radius: 50%; }
#vfd .vfd-punkt-gelb { background: var(--vf-s1, #ffe74f); }
#vfd .vfd-punkt-blau { background: var(--vf-s4, #70a3d8); }

/* --------------------------------------------------------------------------
   Downloads: je Gruppe eine Überschrift und ein weißes Feld mit Zeilen
   -------------------------------------------------------------------------- */
#vfd .vfd-gruppe + .vfd-gruppe { margin-top: 4rem; }
#vfd .vfd-gruppenkopf { margin: 0 0 1.25rem; }
#vfd .vfd-gruppenkopf h3 { display: block; margin: 0; max-width: none; font-size: 1.75rem; line-height: 2.2rem; letter-spacing: -0.01em; font-weight: bold; }
#vfd .vfd-gruppenkopf p { margin: 0.15rem 0 0; font-size: 1.125rem; line-height: 1.6rem; font-weight: 400; color: var(--vfd-navy-mittel); }

#vfd .vfd-panel { background: white; border: 1px solid var(--vfd-karte-rand); border-radius: 16px; }
#vfd .vfd-zeile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1.25rem 1.5rem; padding: 1.5rem 1.75rem; }
#vfd .vfd-zeile + .vfd-zeile { border-top: 1px solid var(--vfd-karte-rand); }
#vfd .vfd-zeile-text { min-width: 0; }
#vfd .vfd-zeile h4 { display: block; margin: 0; max-width: none; font-size: 1.375rem; line-height: 1.75rem; letter-spacing: -0.01em; font-weight: bold; }
#vfd .vfd-zeile p { margin: 0.15rem 0 0; font-size: 1.125rem; line-height: 1.6rem; }
#vfd .vfd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-top: 0.6rem; font-size: 1rem; line-height: 1.4rem; font-weight: 400; color: var(--vfd-navy-mittel); }

#vfd .vfd-version { padding: 0.15rem 0.65rem; border-radius: 0.5rem; font-size: 1rem; line-height: 1.4rem; font-weight: 600; color: var(--vfd-navy); background: var(--vfd-gelb-hell); }
#vfd[data-groesse="gross"] .vfd-version { background: var(--vfd-blau-hell); }
#vfd .vfd-version.vfd-version-immer { background: var(--vfd-gruen-hell); }

/* Knöpfe: feste Mindestbreiten, damit sie in allen Zeilen untereinander stehen;
   bei längerem Text wachsen sie, statt ihn abzuschneiden */
#vfd .vfd-knoepfe { display: flex; justify-content: flex-end; gap: 0.75rem; }
#vfd .vfd-knoepfe .tf-button, #vfd .vfd-modal-fuss .tf-button { margin: 0; }
#vfd .vfd-knoepfe .tf-button { flex: none; width: auto; min-width: 10.5rem; justify-content: center; padding-inline: 1.25rem; white-space: nowrap; overflow: visible; }
#vfd .vfd-knoepfe .tf-button.red { min-width: 14rem; }
#vfd .tf-button svg.vfd-voll, #vfd .tf-button:hover svg.vfd-voll { fill: currentColor; stroke: none; }

/* Jingle: Fortschritt erscheint, sobald abgespielt wird */
#vfd .vfd-fortschritt { display: flex; align-items: center; gap: 0.75rem; max-width: 26rem; margin-top: 0.75rem; }
#vfd .vfd-fortschritt-spur { flex: 1; min-width: 0; height: 6px; border-radius: 3px; background: var(--vfd-gruen-hell); overflow: hidden; }
#vfd .vfd-fortschritt-spur i { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--vfd-navy); }
#vfd .vfd-fortschritt-zeit { flex: none; font-size: 1rem; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--vfd-navy-mittel); }
#vfd .vfd-modal-zu:focus-visible { outline: 3px solid var(--vfd-gelb); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Vorschau-Fenster
   -------------------------------------------------------------------------- */
#vfd .vfd-modal { width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 0; border-radius: 1rem; overflow: hidden; background: white; color: var(--vfd-navy); box-shadow: 0 20px 60px rgba(26, 48, 86, 0.3); }
#vfd .vfd-modal[open] { display: flex; flex-direction: column; }
#vfd .vfd-modal::backdrop { background: rgba(26, 48, 86, 0.55); }
#vfd .vfd-modal-kopf { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 0.6rem 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--vfd-linie); }
#vfd .vfd-modal-kopf strong { font-size: 1.25rem; line-height: 1.5rem; font-weight: bold; }
#vfd .vfd-modal-zu { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid rgba(26, 48, 86, 0.25); background: white; color: var(--vfd-navy); display: grid; place-items: center; cursor: pointer; }
#vfd .vfd-modal-zu svg { width: 18px; height: 18px; }
#vfd .vfd-modal-inhalt { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding: 1.5rem; background: var(--background-grey, #f7f5f2); }
#vfd .vfd-modal-inhalt img { display: block; width: 100%; max-width: 720px; height: auto; margin: 0; background: white; box-shadow: var(--box-shadow-card, 0 1px 5px #00000024); }
#vfd .vfd-modal-fuss { display: flex; justify-content: flex-end; padding: 0.9rem 1.25rem; border-top: 1px solid var(--vfd-linie); }

/* --------------------------------------------------------------------------
   Breiten
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  #vfd .vfd-zeile { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 1.25rem; }
  #vfd .vfd-knoepfe { grid-column: 1 / -1; flex-wrap: wrap; justify-content: stretch; }
  #vfd .vfd-knoepfe .tf-button, #vfd .vfd-knoepfe .tf-button.red { flex: 1 1 auto; min-width: max-content; }
}
@media (max-width: 520px) {
  #vfd .vfd-leiste-frage { display: none; }
  #vfd .vfd-segment { width: 100%; }
  #vfd .vfd-segment label { flex: 1; justify-content: center; padding-inline: 0.5rem; }
  #vfd .vfd-modal-kopf { grid-template-columns: 1fr auto; }
  #vfd .vfd-modal-kopf .vfd-version { grid-row: 2; grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  #vfd .vfd-leiste, #vfd .vfd-wahl label { transition: none; }
}
