/*
 * KI Mobil – Anfragen — handgeschriebenes CSS (kein Build-Schritt).
 * Gestaltung angelehnt an ai-at.eu: viel Weissraum, grosse Ueberschriften in
 * normaler Strichstaerke, Pillen-Knoepfe, AI:AT-Blau und das Mintgruen.
 * Die WCAG-2.2-AA-Grundlagen des Archetyps bleiben erhalten.
 *
 * Kontrast (gerechnet, Ziel 4.5:1 Text / 3:1 Bedienelemente):
 *   hell:   --fg #111111 auf --bg #ffffff            = 18.9:1
 *           --muted #595959 auf #ffffff              =  7.0:1
 *           --accent #005af0 auf #ffffff             =  5.6:1
 *           #ffffff auf --accent #005af0             =  5.6:1
 *           #111111 auf --mint #c6f2b8               = 15.6:1
 *           --border-stark #767676 auf #ffffff       =  4.6:1 (Feldrahmen)
 *   dunkel: --fg #f2f2f2 auf --bg #121212            = 15.8:1
 *           --accent #8cb4ff auf #121212             =  9.4:1
 *
 * --border ist bewusst nur dekorativ (Tabellenlinien). Alles, was bedient wird,
 * nutzt --border-stark oder eine Flaeche mit ausreichendem Kontrast.
 */

:root {
  /* Seitenhintergrund ist leicht grau, die Inhaltsflaeche weiss — wie auf ai-at.eu. */
  --bg: #f0f0f0;
  --flaeche: #ffffff;
  --surface: #f0f0f0;
  --fg: #111111;
  --muted: #595959;
  --accent: #005af0; /* AI:AT-Blau */
  --accent-fg: #ffffff;
  --mint: #c6f2b8; /* AI:AT-Gruen */
  --mint-fg: #111111;
  --border: #dcdcdc; /* nur dekorativ: Tabellenlinien */
  --border-stark: #767676; /* Rahmen von Bedienelementen */
  --focus: #005af0;

  --radius: 12px;
  --radius-pille: 999px;
  --radius-karte: 24px;
  --space: 1rem;
  /* Interactive target floor: 24px hard min (2.5.8 AA); 48px is the default. */
  --target-min: 48px;

  font-size: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --flaeche: #1c1c1c;
    --surface: #1e1e1e;
    --fg: #f2f2f2;
    --muted: #b3b3b3;
    --accent: #8cb4ff;
    --accent-fg: #0a1a3a;
    --mint: #c6f2b8;
    --mint-fg: #111111;
    --border: #3a3a3a;
    --border-stark: #9a9a9a;
    --focus: #8cb4ff;
  }
}

* {
  box-sizing: border-box;
}

html {
  /* 2.4.11 Focus Not Obscured: keep focused content clear of the sticky header. */
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* ai-at.eu setzt "Geist". Die Datei wird bewusst NICHT von Google geladen —
     ein selbst gehostetes internes Werkzeug soll keine Anfragen nach draussen
     schicken. Wer Geist installiert hat, sieht sie; alle anderen die
     System-Schrift, die ihr sehr nahe kommt. */
  font-family:
    'Geist',
    'Inter',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  line-height: 1.5;
}

/* --- Ueberschriften: gross, aber in normaler Strichstaerke (ai-at.eu) --- */
h1,
h2,
h3 {
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin-block: 0 var(--space);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-block: calc(var(--space) * 2) var(--space);
}

/* --- Skip link: visually hidden until focused (first focusable element) --- */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 0.5rem;
}

/* --- Focus visibility: never remove the outline; make it obvious --- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- Header / nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space) * 2);
  padding: var(--space) calc(var(--space) * 1.5);
  background: var(--flaeche);
  border-bottom: 1px solid var(--border);
}

/* Kopfzeile bleibt auch im Dunkelmodus hell: beide Logos sind fuer helle
   Flaechen gemacht, ein Umfaerben wuerde sie verfaelschen. */
@media (prefers-color-scheme: dark) {
  .site-header {
    background: #ffffff;
    color: #111111;
  }

  .site-header .site-title {
    color: #111111;
  }
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--target-min);
  color: inherit;
  text-decoration: none;
}

.site-brand img {
  width: 56px;
  height: 56px;
}

.partner-logo {
  width: auto;
  /* Das KI-Mobil-Logo ist hochformatig und dreizeilig — unter etwa 56 px ist die
     Wortmarke nicht mehr lesbar. */
  height: 56px;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
}

/* Verweise im Inhalt bleiben schwarz mit Unterstreichung — wie auf ai-at.eu.
   Die Unterstreichung traegt die Erkennbarkeit, nicht die Farbe (WCAG 1.4.1). */
main a:not(.status-badge) {
  color: var(--fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

main a:hover {
  color: var(--accent);
}

/* Nav links are interactive targets — meet the 48px default. */
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 0 1.25rem;
  border-radius: var(--radius-pille);
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
}

.nav-list a:hover {
  background: var(--fg);
  color: var(--flaeche);
}

/* --- Main / layout --- */
main {
  display: block; /* IE/legacy safety for the landmark */
  max-width: 1000px;
  margin: calc(var(--space) * 1.5) auto;
  padding: calc(var(--space) * 2);
  background: var(--flaeche);
  border-radius: var(--radius-karte);
}

@media (max-width: 640px) {
  main {
    margin: 0;
    padding: var(--space);
    border-radius: 0;
  }
}

.dashboard h1 {
  margin-top: 0;
}

section {
  margin-block: calc(var(--space) * 2);
}

/* --- Stat cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space);
}

.stat-card {
  margin: 0;
  padding: var(--space);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-value {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  margin-top: 0.25rem;
  color: var(--muted);
}

/* --- Data table --- */
.data-table {
  width: 100%;
  margin-top: var(--space);
  border-collapse: collapse;
}

.data-table caption {
  color: var(--muted);
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding-block: 0.7rem;
}

/* Der Eventname ist die Zeilenueberschrift und darf nicht umbrechen wie eine
   Datenzelle — er bekommt Platz, die schmalen Spalten daneben nicht. */
.data-table tbody th[scope='row'] {
  min-width: 14rem;
  padding-right: var(--space);
  font-weight: 500;
}

.data-table tbody tr + tr {
  border-top: 1px solid var(--border);
}

.data-table thead th {
  font-weight: 500;
  color: var(--muted);
}

.data-table caption {
  text-align: left;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.data-table th,
.data-table td {
  padding: 0.625rem 0.75rem; /* >=24px row height with line-height */
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  border-bottom: 2px solid var(--border);
}

/* Linksbuendig: die Spalten tragen ueberwiegend Text (Event, Ort, Namen), nicht
   Zahlen — rechtsbuendig lies sich das als versprungene Spalte. */
.data-table td {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

/* --- Bar chart (server-rendered SVG) --- */
.bar-chart {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin-block: var(--space);
}

.bar-chart .bar {
  fill: var(--accent);
}

.bar-chart .bar-value {
  fill: var(--fg);
  font-size: 13px;
  font-weight: 600;
}

.bar-chart .bar-label {
  fill: var(--muted);
  font-size: 12px;
}

/* --- Waagrechter Scroll fuer breite Tabellen --- */
.table-scroll {
  overflow-x: auto;
  margin-block: var(--space);
}

.table-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- Dekorative Kreis-Kompositionen (angelehnt an ai-at.eu) ---
   Rein visuell: aria-hidden im Markup, hier zusaetzlich per Kontrast und
   Lage abgesichert, dass sie nie mit Text konkurrieren. */
.formen {
  display: block;
  overflow: visible;
}

.formen-flaeche {
  opacity: 0.9;
}

.formen-mint {
  fill: var(--mint);
}

.formen-blau {
  fill: var(--accent);
  opacity: 0.85;
}

.formen-linie {
  fill: none;
  stroke: var(--border-stark);
  stroke-width: 1.5;
  opacity: 0.6;
}

/* Kopf der Uebersicht: Ueberschrift links, Kreise rechts daneben. Auf
   schmalen Displays verschwinden die Kreise ganz, statt die Ueberschrift zu
   verdraengen — reine Zugabe, kein Informationsverlust. */
.anfragen-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  flex-wrap: wrap;
}

.formen-gross {
  width: 220px;
  height: auto;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .formen-gross {
    display: none;
  }
}

/* Zugangsseite: kleine Kreise oberhalb des Titels, wie ein Absender-Zeichen. */
.formen-klein {
  width: 120px;
  height: auto;
  margin-block-end: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .formen-linie {
    transition: opacity 200ms ease;
  }
}

/* --- Status-Ampel ---
   Gefuellte Pillen wie die Knoepfe auf ai-at.eu. Die Farbe ist Zugabe: der Text
   im Badge traegt die Information allein (WCAG 1.4.1). Alle Kombinationen sind
   dunkle Schrift auf heller Flaeche und liegen ueber 4.5:1. */
.status-badge {
  display: inline-block;
  padding: 0.25em 0.9em;
  border-radius: var(--radius-pille);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: #111111;
}

/* Zugesagt traegt das AI:AT-Gruen — der einzige Zustand, der gut ist. */
.status-zugesagt {
  background: var(--mint);
}

.status-offen {
  background: #e6e6e6;
}

.status-unklar {
  background: #dbe6ff;
}

.status-abgesagt {
  background: #f6dedb;
}

/* --- Eventdaten --- */
.event-daten {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem var(--space);
  margin-block: var(--space);
}

.event-daten dt {
  font-weight: 600;
  color: var(--muted);
}

.event-daten dd {
  margin: 0;
}

/* --- Formular --- */
.eintrag-form {
  max-width: 34rem;
  margin-block: var(--space);
}

.eintrag-form .feld {
  margin-block-end: var(--space);
}

.eintrag-form label,
.eintrag-form legend {
  display: block;
  font-weight: 600;
  margin-block-end: 0.25rem;
}

.eintrag-form input[type='text'],
.eintrag-form input[type='password'],
.eintrag-form textarea {
  width: 100%;
  min-height: var(--target-min);
  padding: 0.5rem;
  font: inherit;
  color: var(--fg);
  background: var(--flaeche);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius);
}

.eintrag-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
  background: var(--bg);
}

.eintrag-form .radio-zeile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--target-min);
}

.eintrag-form .radio-zeile label {
  margin: 0;
  font-weight: 400;
}

.eintrag-form input[type='radio'] {
  width: 1.25rem;
  height: 1.25rem;
}

/* Datumsfeld direkt bei der "Noch zu klaeren"-Option: auf breiten Displays in
   derselben Zeile, auf schmalen darunter, damit nichts abgeschnitten wird. */
.eintrag-form .radio-zeile-mit-feld {
  flex-wrap: wrap;
}

.eintrag-form .radio-zeile-mit-feld input[type='date'] {
  min-height: 40px;
  padding: 0.25rem 0.5rem;
  font: inherit;
  color: var(--fg);
  background: var(--flaeche);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius);
}

.eintrag-form .feld-hinweis {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.eintrag-form button {
  min-height: var(--target-min);
  padding-inline: 1.75rem;
  font: inherit;
  font-weight: 500;
  color: var(--accent-fg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-pille);
  cursor: pointer;
}

.eintrag-form button:hover {
  background: var(--fg);
}

/* --- Hinweise --- */
.hinweis-erfolg,
.hinweis-fehler {
  padding: 0.75rem var(--space);
  border-radius: var(--radius);
  color: #111111;
}

.hinweis-erfolg {
  background: var(--mint);
}

.hinweis-fehler {
  background: #f6dedb;
}

/* --- Footer --- */
.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space);
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* --- Reduced motion: disable transitions/animations --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
