/* Studium. Gestaltung: Heft und Leuchtstift. Königsblaue Tinte auf kühlem Papier,
   Termintypen sind mit Leuchtstift markiert und immer zusätzlich beschriftet. */
:root {
  --papier: #f5f6f9;
  --blatt: #ffffff;
  --tinte: #1a2340;
  --tinte-leise: #55607c;
  --koenig: #2440c4;
  --koenig-dunkel: #1a2f96;
  --linie: #d3d8e4;
  --gelb: #ffe66b;
  --rosa: #ffb9cc;
  --gruen: #bdeeae;
  --blau: #b3dcff;
  --rot: #b3261e;
  --rot-flaeche: #fdecea;
  --ok-flaeche: #e5f5df;
  --warn-flaeche: #fff4c7;
  --radius: 10px;
  --leiste: 4rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #111727;
    --blatt: #1a2236;
    --tinte: #e8ebf5;
    --tinte-leise: #a4aec8;
    --koenig: #93a6ff;
    --koenig-dunkel: #b4c1ff;
    --linie: #333e5c;
    --rot: #ff9a92;
    --rot-flaeche: #3a1f24;
    --ok-flaeche: #1f3327;
    --warn-flaeche: #3a3319;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: 'Avenir Next', 'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Helvetica Neue', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  padding-bottom: calc(var(--leiste) + env(safe-area-inset-bottom) + 5rem);
}

main,
.kopf {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1rem;
}

a {
  color: var(--koenig);
  text-underline-offset: 0.18em;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 2rem 0 0.6rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
}

p {
  margin: 0.5rem 0;
}

.klein,
.optional,
.feldhinweis,
.eintrag-meta,
.zeitraum {
  font-size: 0.9375rem;
  color: var(--tinte-leise);
  font-weight: 400;
}

.unsichtbar,
.sprung:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprung:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 20;
  background: var(--blatt);
  padding: 0.75rem 1rem;
}

/* Kopfzeile */
.kopf {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  padding-bottom: 0.75rem;
}

.kopf h1 {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.kopf a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 0.25rem;
  font-weight: 600;
}

/* Heute: Datum wie die Kopfzeile einer Heftseite, die nächste Lektion ist das Grösste auf der Seite */
.datum {
  color: var(--tinte-leise);
  margin: 0 0 1rem;
}

.gross {
  font-size: clamp(2.5rem, 13vw, 3.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0.25rem 0 0.5rem;
}

.gross .bis {
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tinte-leise);
}

.blei {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.karte {
  background: var(--blatt);
  border: 1px solid var(--linie);
  border-left: 6px solid var(--koenig);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
}

.karte h2 {
  margin-top: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--tinte-leise);
}

.block-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Leuchtstift: Typ als Text, Farbe nur zusätzlich */
.typ {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.05em 0.45em;
  border-radius: 3px 8px 4px 9px;
  color: #1a2340;
  background: var(--gelb);
  vertical-align: 0.08em;
}

.typ-pruefung {
  background: var(--rosa);
}

.typ-abgabe {
  background: var(--gruen);
}

.typ-lernblock {
  background: var(--blau);
}

/* Listen */
.liste {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--blatt);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.liste.klein {
  padding: 0.6rem 1rem;
}

.hinweis .liste {
  margin-top: 0.5rem;
}

.eintrag {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  min-height: 3.5rem;
}

.eintrag + .eintrag {
  border-top: 1px solid var(--linie);
}

.eintrag-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.eintrag-zeit {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.eintrag-titel {
  font-weight: 500;
}

.erledigt .eintrag-titel,
.ausfall .eintrag-titel,
.ausfall .eintrag-zeit {
  text-decoration: line-through;
  color: var(--tinte-leise);
}

.ueberfaellig {
  color: var(--rot);
  font-weight: 600;
}

.frei {
  color: var(--tinte-leise);
}

.knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.thema {
  flex-wrap: wrap;
}

.thema .eintrag-text {
  flex-basis: 100%;
  padding-bottom: 0;
}

.thema .knoepfe {
  justify-content: flex-start;
  padding-bottom: 0.35rem;
}

.thema-ueben .eintrag-meta {
  color: var(--rot);
  font-weight: 600;
}

/* Knöpfe: mindestens 48 Pixel hoch */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid var(--koenig);
  border-radius: 999px;
  background: transparent;
  color: var(--koenig);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.knopf.haupt {
  background: #2440c4;
  border-color: #2440c4;
  color: #ffffff;
}

.knopf.klein {
  min-height: 2.75rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.9375rem;
}

.knopf.gefahr {
  border-color: var(--rot);
  color: var(--rot);
}

.knopf.haken::before {
  content: '';
  width: 0.55em;
  height: 0.3em;
  margin-right: 0.45em;
  border-left: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg) translateY(-0.1em);
}

.knopf[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.inline {
  display: inline-flex;
  margin: 0;
}

.aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

/* Formulare */
.formular {
  display: block;
  margin: 0.5rem 0;
}

.feld {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  min-width: 0;
}

.feld label,
.feld legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  padding: 0;
}

input[type='text'],
input[type='email'],
input[type='url'],
input[type='date'],
input[type='time'],
select,
textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--tinte-leise);
  border-radius: var(--radius);
  background: var(--blatt);
  color: var(--tinte);
  font: inherit;
}

.hat-fehler input {
  border-color: var(--rot);
}

.feldfehler {
  color: var(--rot);
  font-weight: 600;
  margin: 0.3rem 0 0;
}

.feldhinweis {
  margin: 0.3rem 0 0;
}

.paar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.wahl {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3rem;
  font-weight: 500;
}

.feld .wahl {
  font-weight: 500;
  margin: 0;
}

.wahl input {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--koenig);
  flex: none;
}

.wahlreihe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.zeile {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.zeile input {
  flex: 1;
  min-width: 0;
}

/* Hinweise */
.hinweis {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background: var(--ok-flaeche);
}

.hinweis.warnung {
  background: var(--warn-flaeche);
}

.hinweis.fehler {
  background: var(--rot-flaeche);
}

.hinweis.ok {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

[hidden] {
  display: none !important;
}

.leer {
  padding: 0.5rem 0;
}

.angaben {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
}

.angaben dt {
  color: var(--tinte-leise);
}

.angaben dd {
  margin: 0;
  overflow-wrap: anywhere;
}

progress {
  width: 100%;
  height: 0.75rem;
  accent-color: var(--koenig);
}

.schnitt {
  margin-top: 1rem;
}

/* Reiter und Blättern */
.reiter {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.75rem;
  scrollbar-width: none;
}

.reiter a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  border: 1.5px solid var(--linie);
  color: var(--tinte);
  text-decoration: none;
  font-weight: 500;
}

.reiter a[aria-current] {
  background: var(--tinte);
  border-color: var(--tinte);
  color: var(--papier);
  font-weight: 600;
}

.blaettern {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.tag h2 {
  margin: 1.5rem 0 0.5rem;
}

.tag h2 a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 2.75rem;
}

.ist-heute h2 a {
  background: linear-gradient(transparent 55%, var(--gelb) 55%, var(--gelb) 92%, transparent 92%);
  padding: 0 0.2rem;
}

@media (prefers-color-scheme: dark) {
  .ist-heute h2 a {
    background: none;
    border-bottom: 4px solid var(--gelb);
  }
}

/* Schnellerfassung */
.wahl-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.wahl-gross {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1rem 1.1rem;
  min-height: 5rem;
  background: var(--blatt);
  border: 1.5px solid var(--linie);
  border-radius: var(--radius);
  color: var(--tinte);
  text-decoration: none;
}

.wahl-gross .typ {
  font-size: 1.125rem;
}

.plus {
  position: fixed;
  right: max(1rem, calc(50vw - 19rem));
  bottom: calc(var(--leiste) + env(safe-area-inset-bottom) + 1rem);
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  background: #2440c4;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 6px 18px rgb(26 35 64 / 0.28);
  z-index: 5;
}

/* Hauptnavigation unten */
.leiste {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  background: var(--blatt);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 4;
}

.leiste a {
  flex: 1;
  max-width: 10rem;
  min-height: var(--leiste);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tinte-leise);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  border-top: 4px solid transparent;
}

.leiste a[aria-current] {
  color: var(--koenig);
  border-top-color: var(--koenig);
}

/* Seiten ohne Navigation */
.schlicht {
  padding-bottom: 2rem;
}

.schlicht main {
  max-width: 28rem;
  padding-top: 12vh;
}

.marke {
  display: inline-block;
  font-weight: 700;
  font-size: 1.125rem;
  background: linear-gradient(transparent 50%, var(--gelb) 50%, var(--gelb) 92%, transparent 92%);
  padding: 0 0.25rem;
  margin-bottom: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  .marke {
    background: none;
    border-bottom: 4px solid var(--gelb);
  }
}

.schlicht h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.schlicht h2 {
  margin-top: 1.5rem;
}

/* Breite Bildschirme: Wochenansicht in sieben Spalten */
@media (min-width: 64rem) {
  main:has(.woche),
  .kopf:has(+ #netz + main .woche) {
    max-width: 78rem;
  }

  .woche {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
    align-items: start;
  }

  .woche .eintrag {
    padding: 0.4rem 0.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .knopf,
  .reiter a {
    transition: background-color 0.12s, color 0.12s;
  }
}
