/* Darstellung anpassen (public/js/darstellung.js, darstellung-frueh.js). Nur Einstellungen der Besucherin, keine Reparatur der Seite.
   Schriftgrößen der Seite stehen in rem: Nur der Text wächst. Abstände nach WCAG 1.4.12 (Zeile 1,5, Absatz 2 em, Zeichen 0,12 em, Wort 0,16 em).
   Kontrastwerte gemessen mit contrast-check.py: Text ≥ 7:1, Türziffern (große Schrift) ≥ 6,94:1. */

html[data-a11y-text="gross"] { font-size: 112.5%; }
html[data-a11y-text="groesser"] { font-size: 125%; }
html[data-a11y-text="am-groessten"] { font-size: 150%; }
html[data-a11y-text] .kopf { flex-wrap: wrap; }
html:is([data-a11y-text], [data-a11y-zeichen], [data-a11y-wort]) :is(h1, h2, h3, p, li, dd, dt, a, strong, legend, label) { overflow-wrap: anywhere; hyphens: auto; }

html[data-a11y-zeile] body :where(h1, h2, h3, p, li, dd, dt, label, a, button, legend, span, small, figcaption) { line-height: 1.8 !important; }
html[data-a11y-zeile] main :where(p, ul, ol, dl) + :where(p, ul, ol, dl) { margin-top: 2em !important; }
html[data-a11y-zeichen] body :where(h1, h2, h3, p, li, dd, dt, label, a, button, legend, span, small, figcaption) { letter-spacing: .12em !important; }
html[data-a11y-wort] body :where(h1, h2, h3, p, li, dd, dt, label, a, button, legend, span, small, figcaption) { word-spacing: .16em !important; }

:root[data-a11y-kontrast] {
  --text-leise: var(--text); --akzent-text: #6E4826; /* 7,13:1 auf --grund, 7,90:1 auf --flaeche */
  --ziffer: #5C5046;                                 /* 6,94:1 / 7,68:1 */
  --linie: rgba(29, 29, 27, .32); --linie-stark: rgba(29, 29, 27, .6); --rand-feld: var(--text); --schnitt: rgba(29, 29, 27, .45);
  --fokus: var(--text);
}
:root[data-a11y-kontrast][data-theme="dunkel"] {
  --akzent-text: #E8CBA6;                            /* 9,49:1 auf --flaeche, 10,60:1 auf --grund */
  --ziffer: #C3CDD8;                                 /* 9,15:1 auf --flaeche */
  --linie: rgba(237, 231, 223, .34); --linie-stark: rgba(237, 231, 223, .6); --schnitt: rgba(0, 0, 0, .8);
}
/* Hotelfarbe (app.css, :root[data-akzent]…) ist spezifischer als :root[data-a11y-kontrast]; mit beiden Attributen gewinnt die Kontrastwahl */
:root[data-a11y-kontrast][data-akzent][data-theme="hell"] { --akzent-text: #6E4826; }
@media (prefers-color-scheme: light) { :root[data-a11y-kontrast][data-akzent]:not([data-theme="dunkel"]) { --akzent-text: #6E4826; } }
@media (prefers-color-scheme: dark) {
  :root[data-a11y-kontrast]:not([data-theme="hell"]) {
    --akzent-text: #E8CBA6; --ziffer: #C3CDD8;
    --linie: rgba(237, 231, 223, .34); --linie-stark: rgba(237, 231, 223, .6); --schnitt: rgba(0, 0, 0, .8);
  }
}

html[data-a11y-links] body a { text-decoration-line: underline !important; text-decoration-thickness: 2px; text-underline-offset: .2em; }
:root[data-a11y-schrift] { --schrift-display: var(--schrift-text); }
html[data-a11y-schrift] * { font-style: normal !important; }
html[data-a11y-fokus] :focus-visible { outline: 3px solid var(--fokus) !important; outline-offset: 3px !important; box-shadow: 0 0 0 6px var(--flaeche) !important; }
html[data-a11y-bilder] main :is(img:not(.logo), .bild-rahmen, .tagesbild) { display: none !important; }

/* Auslöser im Kopf: gleiche Trefferfläche wie Thema und Sprache */
.darstellung-knopf {
  display: inline-grid; place-items: center; width: var(--treffer); height: var(--treffer); padding: 0; border: 0; border-radius: var(--r-voll);
  background: var(--feld-aktiv); box-shadow: inset 0 0 0 1px var(--linie-stark); color: var(--akzent-text); cursor: pointer;
  transition: transform var(--d-druck) var(--kurve-aus), background-color var(--d-wechsel) var(--kurve-aus);
}
.darstellung-knopf svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.darstellung-knopf svg circle { fill: currentColor; stroke: none; }
.darstellung-knopf:active { transform: scale(.97); }
.darstellung-knopf:focus-visible { outline: 2px solid var(--fokus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .darstellung-knopf:hover { background: var(--flaeche); } }
/* Unter 400 px reicht der Kopf nicht für Logo, Darstellung, Thema und Sprache (63 + 44 + 60 + 96 px + Abstände > 280 px):
   dort bleibt der beschriftete Knopf im Fuß der einzige Weg. */
@media (max-width: 399px) { .darstellung-knopf { display: none; } }

/* Fenster */
dialog.darstellung {
  width: min(100% - 2 * var(--rand-seite), 520px); max-height: calc(100dvh - 2 * var(--a-4)); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--a-5) var(--a-5) 0;
}
/* Öffnen und Schließen: gemeinsam für alle Fenster in popups.css (dialog.fenster) */
@media (max-width: 899px), (pointer: coarse) {
  dialog.darstellung::before { content: ""; display: block; width: 36px; height: 4px; margin: calc(-1 * var(--a-2)) auto var(--a-2); border-radius: 2px; background: var(--linie-stark); touch-action: none; }
  .darstellung-kopf { touch-action: none; user-select: none; -webkit-user-select: none; }
}
.darstellung-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--a-3); }
.darstellung-kopf .titel { margin: 0; padding-top: var(--a-2); }
.darstellung-kopf .titel:focus { outline: none; }
.darstellung-zu {
  flex: none; display: grid; place-items: center; width: var(--treffer); height: var(--treffer); margin: 0 calc(-1 * var(--a-2)) 0 0;
  border: 0; border-radius: var(--r-voll); background: none; color: var(--text); cursor: pointer;
  transition: transform var(--d-druck, 140ms) var(--kurve-aus, ease-out), background-color var(--d-wechsel, 200ms) var(--kurve-aus, ease-out);
}
.darstellung-zu:active { transform: scale(.97); }
.darstellung-zu svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.darstellung-zu:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .darstellung-zu:hover { background: var(--feld-aktiv); } }
.darstellung .text { margin-top: var(--a-2); }
.darstellung-gruppe { border: 0; margin: var(--a-5) 0 0; padding: var(--a-4) 0 0; min-width: 0; border-top: 1px solid var(--linie); }
.darstellung-gruppe legend { float: left; width: 100%; padding: 0; margin-bottom: var(--a-2); font: 500 var(--t-text)/1.3 var(--schrift-text); }
.darstellung-gruppe legend + * { clear: both; }
.darstellung-stufen { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--a-2); }
.darstellung-stufen label { min-height: 48px; }
.darstellung-klein { margin-top: var(--a-4); font-size: var(--t-klein); color: var(--text-leise); }
/* Knöpfe kleben unten, damit „Fertig“ auch bei großer Schrift ohne Suchen erreichbar bleibt */
.darstellung-fuss {
  position: sticky; bottom: 0; grid-template-columns: 1fr 1fr; margin: var(--a-4) calc(-1 * var(--a-5)) 0; padding: var(--a-3) var(--a-5) var(--a-5);
  background: var(--flaeche); border-top: 1px solid var(--linie);
}
@media (max-width: 359px) { .darstellung-fuss { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .darstellung-knopf, .darstellung-zu { transition: none; }
  .darstellung-knopf:active, .darstellung-zu:active { transform: none; }
}
