/* Mobile-first stylesheet.
   Basis-Regeln gelten fuer kleine Screens (Smartphone).
   Groessere Layouts werden progressiv per min-width-Media-Queries ergaenzt. */

:root {
  --bg: #ffffff;
  --fg: #1f2933;
  --muted: #52606d;
  --accent: #1d4e89;
  --accent-light: #e8eef6;
  --border: #d9e2ec;
  --max: 960px;
  --pad: 1rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
header.site {
  background: var(--accent);
  color: #fff;
}
header.site .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: .9rem var(--pad);
}
header.site a { color: #fff; text-decoration: none; }
header.site .brand { font-size: 1.2rem; font-weight: 700; }
header.site .tagline { font-size: .85rem; opacity: .85; }

/* ---------- Navigation ----------
   Mobile: Burger-Menue per versteckter Checkbox (kein JavaScript).
   Ab >=640px (Media-Query weiter unten): klassische horizontale Leiste. */
nav.main {
  border-bottom: 1px solid var(--border);
  background: var(--accent-light);
}

/* Steuer-Checkbox visuell ausblenden, aber per Tastatur bedienbar lassen. */
.nav-check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Burger-Schaltflaeche (Label der Checkbox). */
.nav-burger {
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: .75rem var(--pad);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

/* Drei-Balken-Icon aus einem Span + zwei Pseudo-Elementen. */
.nav-bars,
.nav-bars::before,
.nav-bars::after {
  content: "";
  display: block;
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 3px;
  transition: transform .2s ease, background-color .2s ease, top .2s ease;
}
.nav-bars { position: relative; }
.nav-bars::before { position: absolute; left: 0; top: -8px; }
.nav-bars::after  { position: absolute; left: 0; top: 8px; }

/* Sichtbarer Fokusrahmen fuer Tastaturnutzer. */
.nav-check:focus-visible + .nav-burger {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Menue-Inhalt: mobil standardmaessig eingeklappt. */
nav.main .inner {
  display: none;
  flex-direction: column;
  max-width: var(--max);
  margin: 0 auto;
  border-top: 1px solid var(--border);
}
nav.main a {
  color: var(--accent);
  text-decoration: none;
  padding: .75rem var(--pad);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
nav.main a:last-child { border-bottom: 0; }
nav.main a:hover { text-decoration: underline; background: #fff; }

/* Geoeffneter Zustand: Menue zeigen, Balken zum X verwandeln. */
.nav-check:checked ~ .inner { display: flex; }
.nav-check:checked + .nav-burger .nav-bars { background: transparent; }
.nav-check:checked + .nav-burger .nav-bars::before { top: 0; transform: rotate(45deg); }
.nav-check:checked + .nav-burger .nav-bars::after  { top: 0; transform: rotate(-45deg); }

/* ---------- Main / Typografie ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--pad) 2.5rem;
}

h1 { line-height: 1.2; font-size: 1.6rem; }
h2 {
  margin-top: 1.75rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--accent-light);
  font-size: 1.3rem;
}

.lead { font-size: 1.05rem; color: var(--muted); }

sup.ref a {
  text-decoration: none;
  font-weight: 700;
  padding: 0 .15rem;
}

/* ---------- Karten-Raster ----------
   min(100%, 240px) verhindert Ueberlauf auf sehr schmalen Screens. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
  margin: 1.5rem 0;
}
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  background: #fff;
}
.card h3 { margin: 0 0 .35rem; }
.card a { text-decoration: none; }

/* ---------- Schul-Tabelle ----------
   Mobile: jede Zeile wird zu einer gestapelten Karte; die Kopfzeile
   wird ausgeblendet und je Zelle per data-label beschriftet. */
table.schools {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .95rem;
}
table.schools thead {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
table.schools tr {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .75rem;
  margin-bottom: .75rem;
}
table.schools td {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  text-align: right;
  padding: .35rem 0;
  border-bottom: 1px solid var(--accent-light);
}
table.schools td:last-child { border-bottom: 0; }
table.schools td::before {
  content: attr(data-label);
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
table.schools td:first-child {
  font-weight: 600;
  font-size: 1.02rem;
}

.note {
  background: #fff8e6;
  border: 1px solid #f0d98c;
  border-radius: 8px;
  padding: .8rem 1rem;
  margin: 1.25rem 0;
  font-size: .95rem;
}

ol.references {
  font-size: .9rem;
  color: var(--muted);
  padding-left: 1.3rem;
}
ol.references li { margin-bottom: .5rem; }

footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
}
footer.site .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--pad);
}

/* ==========================================================
   Tablet und groesser: >= 640px
   ========================================================== */
@media (min-width: 640px) {
  :root { --pad: 1.25rem; }

  header.site .inner { padding: 1rem var(--pad); }
  header.site .brand { font-size: 1.35rem; }
  header.site .tagline { font-size: .9rem; }

  /* Burger ausblenden, Navigation immer als horizontale Leiste zeigen -
     unabhaengig vom Checkbox-Zustand. */
  .nav-burger { display: none; }
  nav.main .inner {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    padding: .5rem var(--pad);
    border-top: 0;
  }
  nav.main a {
    padding: .35rem .1rem;
    border-bottom: 0;
  }
  nav.main a:hover { background: transparent; }

  main { padding: 1.75rem var(--pad) 3rem; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; margin-top: 2rem; }

  /* Tabelle wieder als klassische Tabelle darstellen. */
  table.schools thead {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    overflow: visible;
  }
  table.schools th {
    text-align: left;
    padding: .55rem .6rem;
    border-bottom: 1px solid var(--border);
    background: var(--accent-light);
    vertical-align: top;
  }
  table.schools tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }
  table.schools td {
    display: table-cell;
    text-align: left;
    gap: 0;
    padding: .55rem .6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }
  table.schools td::before { content: none; }
  table.schools td:first-child { font-size: inherit; }
}
