/* ===========================================================================
   style.css — Fristenrechner
   ---------------------------------------------------------------------------
   Farbtoken, Knopfformen, Kopfleiste, Reiter und Dunkelmodus sind aus dem
   MSB-Quiz übernommen, das sie aus dem Einarbeitungsplan-Konfigurator hat.
   Wer hier etwas am Aussehen ändert, sieht erst dort nach, ob es das schon
   gibt.
   =========================================================================== */

:root {
  /* Ohne color-scheme zeichnet der Browser Bildlaufleiste, Schreibcursor,
     Auswahlliste und die Grundfläche eines <button> weiter hell. */
  color-scheme: light;

  --navy:         #012F60;
  --navy-hell:    #1B4E8C;
  --navy-zart:    #E8F1FF;

  --blau:            #1C71FE;
  --blau-text:       #155FD6;
  --blau-flae:       #1766E8;
  --blau-flae-hover: #1459CC;

  --grund:        #F3F5F9;
  --weiss:        #FFFFFF;
  --linie:        #E2E8F0;
  --linie-stark:  #CBD5E1;
  --text:         #1B2636;
  --text-still:   #56677C;

  --gruen:        #1E7A4C;
  --gruen-flae:   #E9F6EE;
  --rot:          #B3261E;
  --rot-flae:     #FDECEA;
  --warn-text:    #8A5A00;
  --warn-flae:    #FFF6E0;

  --schatten-karte: 0 1px 2px rgba(15, 35, 65, .05), 0 1px 3px rgba(15, 35, 65, .04);

  --radius:       12px;
  --radius-klein: 8px;

  /* Eine Spalte für alles: Kopfleiste, Inhalt und Fußzeile rücken um
     denselben Betrag ein. */
  --spalte:       1000px;
  --rand:         24px;
  --einzug:       max(var(--rand), calc((100% - var(--spalte)) / 2 + var(--rand)));

  --schrift: "HamburgSans", "Segoe UI Variable Text", "Segoe UI", system-ui,
             -apple-system, "Helvetica Neue", Arial, sans-serif;
  --schrift-titel: "HamburgSans", "Segoe UI Variable Display", "Segoe UI",
             system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Muss vor allem anderen stehen: sonst gewinnt jedes spätere `display`
   gegen das hidden-Attribut. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--grund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--schrift-titel);
  color: var(--navy);
  letter-spacing: -.005em;
  margin: 0;
}

/* Erklärtexte sollen keine Wortreste in der letzten Zeile lassen. */
p, li { text-wrap: pretty; }


/* ===== Kopfleiste ======================================================== */

.kopfleiste {
  display: flex; align-items: center; gap: 22px;
  padding: 10px var(--einzug);
  background: var(--weiss);
  border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 20;
}

.marke-block {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 4px 6px;
  border-radius: var(--radius-klein);
  cursor: pointer; font-family: var(--schrift); text-align: left;
  flex: none;
}
.marke-block:hover { background: var(--grund); }
.marke-block:focus-visible { outline: 2px solid var(--blau); outline-offset: 1px; }

.marke-strich { width: 22px; height: 6px; border-radius: 3px; background: var(--blau); flex: none; }
.marke-stapel { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.marke-text { font-family: var(--schrift-titel); font-size: 17px; font-weight: 800; color: var(--navy); }
.marke-autor { font-size: 11.5px; color: var(--text-still); }

.reiter { display: flex; gap: 4px; flex: none; }

.reiter-knopf {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 12px; font-family: var(--schrift); font-size: 14.5px;
  font-weight: 600; color: var(--text-still); cursor: pointer;
}
.reiter-knopf:hover { color: var(--navy); background: var(--grund); }
.reiter-knopf.aktiv { color: var(--blau-text); border-bottom-color: var(--blau); }
.reiter-knopf:focus-visible { outline: 2px solid var(--blau); outline-offset: -2px; }

.kopf-einstellungen { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.thema-knopf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: none; border: 0; border-radius: 50%;
  color: var(--text-still); cursor: pointer;
}
.thema-knopf:hover { background: var(--grund); color: var(--navy); }
.thema-knopf:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }
.ico-thema { width: 17px; height: 17px; }
.ico-sonne { display: none; }


/* ===== Knöpfe und Felder ================================================= */

.knopf {
  font-family: var(--schrift); font-size: 15px; font-weight: 600;
  padding: 10px 20px; border-radius: var(--radius-klein);
  border: 1px solid transparent; cursor: pointer;
  background: var(--blau-flae); color: #fff;
}
.knopf:hover { background: var(--blau-flae-hover); }

.knopf-mini {
  font-family: var(--schrift); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-klein);
  border: 1px solid var(--linie-stark); background: transparent;
  color: var(--navy); cursor: pointer;
}
.knopf-mini:hover { background: var(--grund); }

.knopf:focus-visible, .knopf-mini:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--blau); outline-offset: 2px;
}

select, input[type="date"], input[type="number"] {
  font-family: var(--schrift); font-size: 15px;
  padding: 9px 11px; border-radius: var(--radius-klein);
  border: 1px solid var(--linie-stark);
  background: var(--weiss); color: var(--text);
  min-width: 0;
}


/* ===== Grundgerüst ======================================================= */

.mitte {
  display: flex; flex-direction: column; gap: 18px;
  padding: 26px var(--einzug) 60px;
}

.ansicht { display: flex; flex-direction: column; gap: 18px; }

.tafel {
  background: var(--weiss);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.tafel-titel { font-size: 17px; margin-bottom: 14px; }

.tafel-fuss {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--linie);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.tafel-fuss .knopf-mini { margin-left: auto; }

.held { padding: 8px 2px 0; }
.held h1 { font-size: 29px; margin-bottom: 10px; }
.held-text { max-width: 64ch; margin: 0; color: var(--text-still); }

.augenmarke {
  display: block;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--blau-text);
  margin-bottom: 5px;
}

.leermeldung { margin: 0; color: var(--text-still); }


/* ===== Eingabezeile ====================================================== */

/* Prozess und Datum stehen nebeneinander, solange Platz ist. Die Beschriftung
   sitzt über dem Feld: nebeneinander rutschte sie bei langen Prozessnamen
   aus der Zeile. */
.eingabe-zeile { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }

.feld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.feld-weit { flex: 1 1 320px; }
.feld label {
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-still);
}
.feld select, .feld input { width: 100%; }

.anker-hinweis { margin: 12px 0 0; font-size: 14px; color: var(--text-still); max-width: 72ch; }


/* ===== Kopftafel des Fahrplans =========================================== */

.tafel-anker { background: var(--navy-zart); border-color: var(--blau); }

.anker-zeile { display: flex; gap: 28px; flex-wrap: wrap; justify-content: space-between; }

.anker-marke {
  display: block;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--blau-text);
  margin-bottom: 2px;
}

.anker-datum { font-family: var(--schrift-titel); font-size: 24px; color: var(--navy); }

.korridor { text-align: right; }
.korridor strong { font-size: 16px; color: var(--navy); }
.korridor .fp-quelle { justify-content: flex-end; }

.feiertagszeile {
  margin: 14px 0 0; padding-top: 12px;
  border-top: 1px solid var(--linie-stark);
  font-size: 13.5px; color: var(--text-still);
}


/* ===== Fahrplan ========================================================== */

.fahrplan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.fp-zeile {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--linie);
}
.fp-zeile:first-child { border-top: 0; padding-top: 0; }

.fp-nr {
  flex: none;
  width: 26px; height: 26px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--navy); color: #fff;
  font-family: var(--schrift-titel); font-size: 13px; font-weight: 800;
}

.fp-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fp-name { font-size: 15.5px; color: var(--navy); }
.fp-nachricht { font-size: 12.5px; font-weight: 600; color: var(--blau-text); }
.fp-regel { font-size: 14px; color: var(--text); }
.fp-hinweis { font-size: 13.5px; color: var(--text-still); max-width: 66ch; }
.fp-quelle { display: block; font-size: 12px; color: var(--text-still); }
.fp-quelle a { color: var(--blau-text); text-underline-offset: 2px; }

.fp-daten { flex: none; display: flex; flex-direction: column; gap: 6px; text-align: right; }
.fp-datum strong { font-family: var(--schrift-titel); font-size: 16px; color: var(--navy); white-space: nowrap; }
.fp-datum-marke {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-still);
}

.fp-zwischen {
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-still);
  margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--linie-stark);
}

.fahrplan-zusatz .fp-nr { background: transparent; color: var(--blau-text); border: 1px dashed var(--linie-stark); }

.merker { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.merker li { font-size: 14px; color: var(--text-still); max-width: 76ch; }


/* ===== Ergebnis einer einzelnen Frist ==================================== */

.tafel-ergebnis { display: flex; flex-direction: column; gap: 4px; }
.ergebnis-datum { font-family: var(--schrift-titel); font-size: 30px; color: var(--navy); line-height: 1.15; }
.ergebnis-regel { margin: 4px 0 0; font-size: 15px; }
.ergebnis-ab { margin: 0; font-size: 14px; color: var(--text-still); }
.ergebnis-ab strong { color: var(--text); }
.ergebnis-feiertage {
  margin: 10px 0 0; padding: 9px 12px;
  background: var(--warn-flae); border-radius: var(--radius-klein);
  font-size: 13.5px; color: var(--warn-text);
}
.ergebnis-hinweis { margin: 10px 0 0; font-size: 14px; color: var(--text-still); max-width: 72ch; }


/* ===== Technische Fristen ================================================ */

.tech-zeile {
  display: flex; gap: 20px; justify-content: space-between; align-items: flex-start;
  padding: 13px 0; border-top: 1px solid var(--linie);
}
.tech-zeile:first-child { border-top: 0; padding-top: 0; }
.tech-zeile > div { display: flex; flex-direction: column; gap: 3px; }
.tech-zeile strong { color: var(--navy); }
.tech-frist { text-align: right; flex: none; max-width: 42%; }
.tech-frist strong { font-family: var(--schrift-titel); font-size: 16px; }

.tech-merker {
  margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--linie-stark);
  font-size: 13.5px; color: var(--text-still);
}


/* ===== Werktagsrechner =================================================== */

.rechner-gitter { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rechner-ausgabe { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.rechner-ausgabe .ergebnis-datum { font-size: 24px; }


/* ===== Fußzeile ========================================================== */

.fusszeile {
  margin: 0 var(--einzug);
  padding: 16px 0 32px;
  font-size: 13px; color: var(--text-still);
  border-top: 1px solid var(--linie);
  display: flex; flex-direction: column; gap: 4px;
}
/* Link zur Überblicksseite, setzt nur das Bauskript der öffentlichen Fassung */
.fusszeile a { color: inherit; text-underline-offset: 2px; }
.fusszeile a:hover { color: var(--blau-text); }


/* ===========================================================================
   DUNKELMODUS
   Werte wie im MSB-Quiz: die Hausfarben bleiben erkennbar, werden aber
   aufgehellt, weil Blau und Marineblau auf dunklem Grund sonst zu wenig
   Kontrast haben.
   =========================================================================== */

@media screen {
  :root[data-thema="dunkel"] {
    color-scheme: dark;

    --weiss:        #161D27;
    --grund:        #1F2733;
    --text:         #E7EBF1;
    --text-still:   #A7B2C0;
    --linie:        #2C3644;
    --linie-stark:  #435064;
    --navy:         #A9C8F5;
    --navy-hell:    #8AB8FF;
    --navy-zart:    #1B2A44;
    --blau:            #4D94FF;
    --blau-text:       #8AB8FF;
    --blau-flae-hover: #2A77F0;
    --gruen:        #74C995;
    --gruen-flae:   #1A2E27;
    --rot:          #FF8A80;
    --rot-flae:     #35221F;
    --warn-text:    #EADCA4;
    --warn-flae:    #2E2618;
    --schatten-karte: none;
  }

  /* BEIDE Elemente, nicht nur body: der Hintergrund von <html> bemalt die
     gesamte Fläche, <body> nur seinen eigenen Kasten. */
  :root[data-thema="dunkel"],
  :root[data-thema="dunkel"] body { background: #0F141B; }

  :root[data-thema="dunkel"] .ico-sonne { display: block; }
  :root[data-thema="dunkel"] .ico-mond  { display: none; }

  /* Die Nummernkreise tragen im Dunkeln helles Blau, weiße Schrift darauf
     wäre zu grell. */
  :root[data-thema="dunkel"] .fp-nr { color: #0F141B; }
}


/* ===== Schmale Fenster =================================================== */

@media (max-width: 860px) {
  :root { --rand: 16px; }
  .kopfleiste { gap: 12px; flex-wrap: wrap; }
  .marke-autor { display: none; }
  .rechner-gitter { grid-template-columns: 1fr; }
  .anker-zeile { gap: 14px; }
  .korridor { text-align: left; }
  .korridor .fp-quelle { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .held h1 { font-size: 24px; }
  /* Datum unter den Text, nicht daneben: sonst bleiben für den Namen des
     Schritts zwei Wörter je Zeile. */
  .fp-zeile { flex-wrap: wrap; }
  .fp-daten { flex-direction: row; gap: 16px; text-align: left; margin-left: 40px; }
  .tech-zeile { flex-direction: column; gap: 6px; }
  .tech-frist { text-align: left; max-width: none; }
  .anker-datum { font-size: 21px; }
  .ergebnis-datum { font-size: 25px; }
}


/* ===== Bewegung: wer sie abbestellt hat, bekommt keine =================== */

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


/* ===== Druck ============================================================= */

/* Gedruckt wird der Fahrplan. Reiter, Knöpfe und Eingabefelder haben auf
   Papier nichts zu suchen, die gewählten Werte stehen im Ergebnis. */
@media print {
  .reiter, .kopf-einstellungen, .tafel-fuss, .eingabe-zeile,
  .anker-hinweis, .held-text { display: none !important; }
  .kopfleiste { position: static; border-bottom: 1px solid #999; }
  html, body { background: #fff; }
  .tafel { border-color: #999; break-inside: avoid; }
  .fp-zeile { break-inside: avoid; }
}

/* ==========================================================================
 * Zurück zur Startseite (nur öffentliche Fassung)
 * Das Bauskript setzt das Logo der Musterstadt Netze vor den Markenblock,
 * wie im MSB-Quiz. Die Regeln stehen hier, damit sie mit den anderen
 * gepflegt werden; lokal gibt es das Element nicht.
 * ========================================================================== */

.zur-startseite {
  display: flex; align-items: center; flex: none;
  padding: 3px 6px; margin-left: -6px; border-radius: 6px;
  color: var(--navy); text-decoration: none;
}
.zur-startseite:hover { background: var(--grund); }
.zur-startseite:focus-visible { outline: 2px solid var(--blau); outline-offset: 1px; }
.zur-startseite svg { display: block; width: 127.5px; height: 30px; }

@media (max-width: 860px) {
  .zur-startseite svg { width: 110.5px; height: 26px; }
}
@media (max-width: 359px) {
  .zur-startseite svg { width: 93.5px; height: 22px; }
}
@media print { .zur-startseite { display: none !important; } }
