/* =========================================================================
   Gemeinsames Designsystem für zusammen-ferien.schule und zusammen-arbeiten.schule
   -------------------------------------------------------------------------
   Alle Farbpaare sind auf Kontrast gerechnet; die Werte stehen als Kommentar
   dabei und werden von test/kontrast.test.mjs automatisch nachgeprüft. Wer hier
   eine Farbe ändert, muss den Test bestehen — sonst driftet das System wieder
   ab wie im Vorgängersystem, wo drei zentrale Paare unter dem Mindestwert lagen.

   Zustände werden nie allein über Farbe angezeigt: ausgewählte Elemente tragen
   zusätzlich ein Häkchen, Feiertage im Planer einen Punkt.
   ========================================================================= */

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('lexend.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  --grund: #f6f8f9;
  --flaeche: #ffffff;
  --flaeche-2: #eef3f5;
  --tinte: #18262e;        /* auf --grund: 14,5:1 */
  --tinte-leise: #4a5c66;  /* auf --grund:  7,3:1 */
  --rand: #d2dde1;
  --rand-stark: #748b95;  /* auf --flaeche: 3,6:1 — Ränder von Bedienelementen (WCAG 1.4.11) */

  --akzent: #0e5a75;          /* Meer  — Weiß darauf: 7,7:1 */
  --auf-akzent: #ffffff;
  --akzent-leise: #d9ebf2;
  --signal: #ffc933;          /* Sonne — Tinte darauf: 10,1:1 */
  --auf-signal: #18262e;
  --signal-rand: #c99a10;

  --warn: #8a3419;
  --warn-flaeche: #fbeae4;

  --schrift: 'Lexend', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --daten: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;

  --radius: 10px;
  --fokus: 3px;
}

/* zusammen-arbeiten: eigenes Akzentpaar, damit die Schwesterseiten
   unterscheidbar bleiben, ohne ein zweites Stylesheet zu brauchen. */
:root[data-app='arbeiten'] {
  --akzent: #5d3a9b;          /* Beere — Weiß darauf: 8,3:1 */
  --akzent-leise: #e8e0f5;
  --signal: #cbe3a5;          /* Lind  — Tinte darauf: 11,1:1 */
  --auf-signal: #18262e;
  --signal-rand: #7ba03f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-thema='hell']) {
    --grund: #101a1f;
    --flaeche: #182830;
    --flaeche-2: #1f333c;
    --tinte: #e6edf0;
    --tinte-leise: #a6b8c0;
    --rand: #2b414b;
    --rand-stark: #637f8f;  /* auf --flaeche: 3,6:1 — WCAG 1.4.11 für Bedienelemente */

    --akzent: #79bfda;        /* auf --grund: 8,8:1 */
    --auf-akzent: #0a1720;
    --akzent-leise: #1d3a47;
    --signal: #ffc933;
    --auf-signal: #18262e;
    --signal-rand: #ffdb77;

    --warn: #f0a58c;
    --warn-flaeche: #33201a;
  }
  :root[data-app='arbeiten']:not([data-thema='hell']) {
    --akzent: #bda3ec;
    --auf-akzent: #17102a;
    --akzent-leise: #2e2445;
    --signal: #cbe3a5;
    --signal-rand: #a8ce6e;
  }
}

:root[data-thema='dunkel'] {
  --grund: #101a1f;
  --flaeche: #182830;
  --flaeche-2: #1f333c;
  --tinte: #e6edf0;
  --tinte-leise: #a6b8c0;
  --rand: #2b414b;
  --rand-stark: #637f8f;
  --akzent: #79bfda;
  --auf-akzent: #0a1720;
  --akzent-leise: #1d3a47;
  --signal: #ffc933;
  --auf-signal: #18262e;
  --signal-rand: #ffdb77;
  --warn: #f0a58c;
  --warn-flaeche: #33201a;
}
:root[data-thema='dunkel'][data-app='arbeiten'] {
  --akzent: #bda3ec;
  --auf-akzent: #17102a;
  --akzent-leise: #2e2445;
  --signal: #cbe3a5;
  --signal-rand: #a8ce6e;
}

* { box-sizing: border-box; }

/* Muss vor allen Layout-Regeln stehen: sonst gewinnt ein späteres display:flex
   gegen das display:none des hidden-Attributs, und versteckte Bereiche sind
   sichtbar. Genau das ist beim ersten Durchlauf passiert. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--tinte);
  font-family: var(--schrift);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:where(a) { color: var(--akzent); text-underline-offset: 3px; }

:focus-visible {
  outline: var(--fokus) solid var(--akzent);
  outline-offset: 2px;
  border-radius: 3px;
}

.nur-vorlesen {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

.spring-ziel {
  position: absolute; left: 8px; top: -60px;
  background: var(--akzent); color: var(--auf-akzent);
  padding: 10px 16px; border-radius: var(--radius); z-index: 50;
  transition: top .15s;
}
.spring-ziel:focus { top: 8px; }

/* ---------------------------------------------------------------- Kopf */

.kopf {
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
}
.kopf-innen {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.marke {
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
  text-decoration: none; color: var(--tinte);
}
.marke b { color: var(--akzent); font-weight: 700; }
.kopf nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.kopf nav a {
  font-size: 14.5px; padding: 6px 10px; border-radius: 8px;
  color: var(--tinte-leise); text-decoration: none;
}
.kopf nav a:hover { background: var(--flaeche-2); color: var(--tinte); }

/* ---------------------------------------------------------------- Gerüst */

main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }

h1 {
  font-size: clamp(26px, 4.2vw, 38px);
  line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 700; margin: 0 0 8px; text-wrap: balance;
}
.untertitel { color: var(--tinte-leise); margin: 0 0 26px; max-width: 60ch; }

.gitter { display: grid; gap: 30px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
@media (max-width: 900px) { .gitter { grid-template-columns: 1fr; } }

.feld {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
}
.feld > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--tinte-leise); margin: 0 0 14px; font-weight: 600;
}
.feld > h2 .schritt {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--akzent); color: var(--auf-akzent);
  font-size: 11px; margin-right: 7px; vertical-align: -3px;
}

/* ---------------------------------------------------------------- Länderwahl */

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }

.chip {
  font: inherit; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px 7px 10px;
  border: 1.5px solid var(--rand-stark);
  background: var(--flaeche); color: var(--tinte);
  border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--akzent); }
.chip .haken { width: 14px; text-align: center; opacity: 0; font-size: 13px; }
.chip[aria-pressed='true'] {
  background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent);
  font-weight: 600;
}
.chip[aria-pressed='true'] .haken { opacity: 1; }
.chip.vlz { border-style: dashed; }

.chip-werkzeuge { display: flex; gap: 14px; margin-top: 14px; }
.knopf-leise {
  font: inherit; font-size: 14px; background: none; border: none; padding: 0;
  color: var(--akzent); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- Karte */

.karte-huelle { margin-top: 18px; }
.karte-huelle > summary {
  cursor: pointer; font-size: 14.5px; color: var(--tinte-leise);
  padding: 6px 0; list-style-position: inside;
}
.karte { width: 100%; height: auto; max-width: 380px; display: block; margin: 10px auto 0; }
.karte .land {
  fill: var(--flaeche-2);
  stroke: var(--rand-stark);
  stroke-width: 1;
  cursor: pointer;
  transition: fill .12s;
}
.karte .land:hover { fill: var(--akzent-leise); }
.karte .land[data-gewaehlt='ja'] { fill: var(--akzent); }
.karte .land:focus-visible {
  outline: none;
  stroke: var(--tinte); stroke-width: 3;
}
.karte-haken { fill: var(--auf-akzent); font-size: 15px; text-anchor: middle; pointer-events: none; font-weight: 700; }

/* ---------------------------------------------------------------- Dauer */

.dauer { display: flex; align-items: center; gap: 10px; }
.dauer button {
  font: inherit; font-size: 21px; line-height: 1;
  width: 44px; height: 44px; border-radius: 9px;
  border: 1.5px solid var(--rand-stark); background: var(--flaeche); color: var(--tinte);
  cursor: pointer;
}
.dauer button:hover:not(:disabled) { border-color: var(--akzent); }
.dauer button:disabled { opacity: .4; cursor: not-allowed; }
.dauer input {
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums;
  width: 78px; height: 44px; text-align: center;
  border: 1.5px solid var(--rand-stark); border-radius: 9px;
  background: var(--flaeche); color: var(--tinte);
}
.dauer .einheit { color: var(--tinte-leise); font-size: 15px; }

.schalter { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; font-size: 15px; }
.schalter input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--akzent); }
.schalter span { color: var(--tinte-leise); }

/* ---------------------------------------------------------------- Status */

.status {
  font-size: 18px; line-height: 1.45; margin: 0 0 18px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--akzent-leise); border: 1px solid var(--rand);
  text-wrap: pretty;
}
.status strong { font-weight: 700; }
.status[data-art='fehler'] { background: var(--warn-flaeche); color: var(--warn); border-color: var(--warn); }

/* ---------------------------------------------------------------- Ergebnis */

.treffer { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.treffer li {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 14px 16px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 16px; align-items: center;
}
.treffer .laenge {
  font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums;
  line-height: 1; text-align: center; min-width: 58px;
}
.treffer .laenge small { display: block; font-size: 11px; font-weight: 400; color: var(--tinte-leise); letter-spacing: .05em; text-transform: uppercase; margin-top: 3px; }
.treffer .zeit { font-weight: 600; }
.treffer .wochentage { font-size: 14px; color: var(--tinte-leise); grid-column: 2; }
.treffer .marken { display: flex; gap: 5px; flex-wrap: wrap; grid-column: 2; margin-top: 4px; }
.marke-klein {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--flaeche-2); color: var(--tinte-leise); border: 1px solid var(--rand);
}
.treffer .ics {
  font: inherit; font-size: 13.5px; padding: 7px 12px;
  border: 1.5px solid var(--rand-stark); border-radius: 8px;
  background: var(--flaeche); color: var(--tinte); cursor: pointer; white-space: nowrap;
}
.treffer .ics:hover { border-color: var(--akzent); color: var(--akzent); }
.treffer li[data-offen='ja'] { border-style: dashed; }
.marke-klein.unsicher { border-style: dashed; border-color: var(--rand-stark); }
.marke-klein.rand { border-style: dashed; }
.marke-klein.ferien { background: var(--akzent-leise); color: var(--tinte); border-color: transparent; }
.marke-klein.feiertag::before { content: '• '; color: var(--signal-rand); font-weight: 700; }

@media (max-width: 560px) {
  .treffer li { grid-template-columns: auto 1fr; }
  .treffer .ics { grid-column: 1 / -1; justify-self: start; margin-top: 8px; }
}

/* ------------------------------------------------------------ Jahresgruppen */

.jahr-gruppe { margin-bottom: 10px; }
.jahr-gruppe > summary {
  cursor: pointer;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 11px 15px;
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius);
  list-style: none;
}
.jahr-gruppe > summary::-webkit-details-marker { display: none; }
.jahr-gruppe > summary::before {
  content: '▸';
  color: var(--tinte-leise); font-size: 13px;
  transition: transform .12s;
  display: inline-block;
}
.jahr-gruppe[open] > summary::before { transform: rotate(90deg); }
.jahr-gruppe > summary:hover { border-color: var(--akzent); }
.jahr-zahl { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.jahr-info { font-size: 14px; color: var(--tinte-leise); }
.jahr-gruppe[open] > summary {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  background: var(--akzent-leise);
}
.jahr-inhalt {
  border: 1px solid var(--rand); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px;
  background: var(--flaeche-2);
}
.jahr-inhalt .rest { margin: 10px 2px 0; }
.leeres-jahr {
  margin: 0 0 14px; font-size: 15px; color: var(--tinte-leise);
}

/* ---------------------------------------------------------------- Auswege */

.auswege { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ausweg {
  font: inherit; font-size: 15px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--akzent); background: var(--flaeche); color: var(--tinte);
  cursor: pointer;
}
.ausweg:hover { background: var(--akzent-leise); }
.ausweg b { color: var(--akzent); }

/* ---------------------------------------------------------------- Jahresplaner */

.planer-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.planer-kopf h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--tinte-leise); font-weight: 600; }
.jahre { display: flex; gap: 5px; margin-left: auto; }
.jahr {
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums;
  padding: 5px 11px; border-radius: 7px; cursor: pointer;
  border: 1.5px solid var(--rand-stark); background: var(--flaeche); color: var(--tinte);
}
.jahr[aria-pressed='true'] { background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent); font-weight: 600; }

.planer { overflow-x: auto; }
.planer table { border-collapse: separate; border-spacing: 2px; font-size: 10px; }
.planer th.monatsname {
  font-weight: 500; color: var(--tinte-leise); font-size: 10.5px;
  text-align: right; padding-right: 6px; white-space: nowrap;
}
.planer thead th {
  text-align: center; padding: 0 0 3px;
  font-weight: 500; font-size: 9.5px; color: var(--tinte-leise);
}
.planer thead th[data-we='ja'] { color: var(--tinte); font-weight: 600; }
.planer td {
  width: 14px; height: 14px; padding: 0; border-radius: 3px;
  background: var(--flaeche-2); border: 1px solid transparent;
}
/* Tage außerhalb des Monats bleiben vollständig leer. Sie einzufärben, damit
   die Wochenendbänder durchlaufen, war ein Fehler: Neben einem Trefferbalken
   sah das aus wie ein freier Tag, der nicht mitzählt — dabei liegt der Tag
   schlicht in der Nachbarzeile.
   Die Wochenendfarbe verlangt deshalb ausdrücklich einen echten Tag. Sich auf
   die Reihenfolge der Regeln zu verlassen reichte nicht: Bei gleicher
   Spezifität gewann die spätere, und die Attrappen waren wieder da.

   Die drei Regeln unten tragen deshalb dieselbe Spezifität und stehen in der
   Reihenfolge ihres Vorrangs: außerhalb, Wochenende, Treffer. Nur eine davon zu
   qualifizieren kehrte den Vorrang um — dann wurden Wochenenden mitten in einem
   Zeitraum grau. */
.planer td[data-aus='ja'] { background: transparent; }
.planer td[data-aus='nein'][data-we='ja'] { background: var(--rand); }
.planer td[data-aus='nein'][data-treffer='ja'] {
  background: var(--signal);
  border-color: var(--signal-rand);
}
.planer td[data-treffer='ja'] { cursor: pointer; }
.planer td[data-treffer='ja']:hover { border-color: var(--tinte); }
.planer td[role='button']:focus-visible {
  outline: var(--fokus) solid var(--akzent);
  outline-offset: 1px;
  position: relative; z-index: 1;
}

/* Hervorhebung des angesprungenen Eintrags */
@keyframes aufblitzen {
  from { box-shadow: 0 0 0 3px var(--signal); }
  to   { box-shadow: 0 0 0 3px transparent; }
}
.treffer li.hervorgehoben {
  animation: aufblitzen 1.6s ease-out;
  border-color: var(--signal-rand);
}
@media (prefers-reduced-motion: reduce) {
  .treffer li.hervorgehoben { animation: none; box-shadow: 0 0 0 3px var(--signal); }
}
.planer td[data-feiertag='ja']::after {
  content: ''; display: block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--auf-signal); margin: 5px auto;
}
.datengrenze { margin: 12px 0 0; font-size: 13px; color: var(--tinte-leise); max-width: 70ch; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--tinte-leise); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }
/* Diese Klassen ersetzen fruehere style-Attribute im Markup. Die
   Inhaltssicherheitsrichtlinie erlaubt keine eingebetteten Stile
   (style-src 'self'), und sie aufzuweichen waere der falsche Weg. */
.legende i.muster-treffer { background: var(--signal); border-color: var(--signal-rand); }
.legende i.muster-wochenende { background: var(--rand); }
.abstand-oben { margin-top: 22px; }
.lesespalte { max-width: 70ch; }

/* Ersatzinhalt ohne JavaScript */
.ohne-js { overflow-x: auto; }
.ohne-js table { border-collapse: collapse; font-size: 14px; }
.ohne-js caption { text-align: left; padding-bottom: 8px; font-weight: 600; }
.ohne-js th { text-align: left; padding: 4px 14px 4px 0; vertical-align: top; white-space: nowrap; }
.ohne-js td { padding: 4px 0; vertical-align: top; }

/* ---------------------------------------------------------------- Fuß */

footer {
  max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px;
  border-top: 1px solid var(--rand);
  font-size: 13.5px; color: var(--tinte-leise); line-height: 1.7;
}
footer a { color: var(--tinte-leise); }
footer p { margin: 0 0 10px; max-width: 80ch; }
.stand { font-family: var(--daten); font-size: 12px; }

.hinweisband {
  background: var(--signal); color: var(--auf-signal);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 14px; font-size: 15px;
}
.hinweisband button {
  font: inherit; margin-left: auto; background: none; border: none;
  color: var(--auf-signal); cursor: pointer; text-decoration: underline; padding: 0;
}

/* ---------------------------------------------------------------- Sonderfälle */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .chip[aria-pressed='true'] { border-width: 3px; }
  .karte .land[data-gewaehlt='ja'] { fill: Highlight; }
  /* Muss die Spezifität der Trefferregel oben erreichen, sonst greift sie nicht. */
  .planer td[data-aus='nein'][data-treffer='ja'] { background: Highlight; border-color: CanvasText; }
  .treffer li { border-width: 2px; }
}
