/* ==========================================================================
   Silbenfuchs – Basis: Schriften, Farben, Grundelemente
   --------------------------------------------------------------------------
   Alle Farben und Maße als Variablen (Design-Tokens) – Anpassungen am
   Erscheinungsbild erfolgen zentral hier.
   ========================================================================== */

/* ---------- Schriften (lokal, keine externen Server) ---------- */
@font-face {
  font-family: "Grundschrift";
  src: url("../fonts/grundschrift-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABeeZee";
  src: url("../fonts/abeezee-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "ABeeZee";
  src: url("../fonts/abeezee-ext-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Andika";
  src: url("../fonts/andika-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Andika";
  src: url("../fonts/andika-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- Design-Tokens ---------- */
:root {
  color-scheme: light;

  /* Farben */
  --hintergrund: #FBF6EF;
  --flaeche: #FFFFFF;
  --flaeche-leise: #F6F1E9;
  --linie: #E7DED1;
  --text: #2B2F3A;
  --text-leise: #5E6472;
  --fuchs: #E8702A;
  --fuchs-dunkel: #B9541A;
  --fuchs-hell: #FDEBDC;
  --wald: #2E7D6B;
  --wald-hell: #E2F2ED;
  --himmel: #DCEBF7;
  --vokal: #D23B48;
  --konsonant: #2D5DA1;
  --fehler: #B42318;
  --fehler-hell: #FDECEA;
  --fokus: #1D4ED8;

  /* Schrift */
  --oberflaeche: "ABeeZee", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --leseschrift: "Grundschrift";

  /* Maße */
  --radius: 16px;
  --radius-klein: 10px;
  --abstand: 16px;
  --schatten: 0 1px 2px rgb(43 47 58 / 6%), 0 6px 18px rgb(43 47 58 / 6%);
  --kopfhoehe: 68px;
  --tipp: 48px; /* Mindestgröße für Touch-Ziele */
}

/* ---------- Grundgerüst ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--hintergrund);
  color: var(--text);
  font-family: var(--oberflaeche);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-weight: 400; line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; margin-top: 1.2em; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85em; background: var(--flaeche-leise); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Lesetext in der gewählten Leseschrift */
.leseschrift { font-family: var(--leseschrift), var(--oberflaeche); }

/* Sichtbarer Tastaturfokus */
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }

.nur-screenreader {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.sprunglink { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--flaeche); padding: 8px 14px; border-radius: 8px; }
.sprunglink:focus { left: 8px; }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: var(--tipp); padding: 8px 16px;
  border: 1px solid var(--linie); border-radius: var(--radius-klein);
  background: var(--flaeche); color: var(--text);
  font: inherit; line-height: 1.2; cursor: pointer; text-align: center;
  transition: background-color .15s, border-color .15s, transform .08s;
  touch-action: manipulation;
}
.knopf:hover { background: var(--flaeche-leise); }
.knopf:active { transform: translateY(1px); }
.knopf:disabled { opacity: .5; cursor: default; transform: none; }
.knopf[aria-pressed="true"] { background: var(--fuchs-hell); border-color: var(--fuchs); }
.knopf-primaer { background: var(--fuchs); border-color: var(--fuchs); color: #fff; }
.knopf-primaer:hover { background: var(--fuchs-dunkel); border-color: var(--fuchs-dunkel); }
.knopf-gross { font-size: 1.15rem; min-height: 54px; padding: 10px 20px; }
.knopf-breit { width: 100%; margin-top: 10px; }
.knopf-klein { min-height: 40px; min-width: 40px; padding: 6px 10px; }
.knopf-leise { color: var(--text-leise); }
.knopf-gefahr { background: var(--fehler); border-color: var(--fehler); color: #fff; }
.knopf-gefahr:hover { background: #8f1c13; }
.knopf-gefahr-leise:hover { background: var(--fehler-hell); border-color: var(--fehler); }
.knopfgruppe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Formulare ---------- */
input[type="text"], input[type="search"], input[type="password"], select {
  width: 100%; min-height: var(--tipp); padding: 8px 12px;
  border: 1px solid var(--linie); border-radius: var(--radius-klein);
  background: var(--flaeche); color: var(--text); font: inherit;
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--fehler); background: var(--fehler-hell); }
input[type="range"] { width: 100%; accent-color: var(--fuchs); min-height: 36px; }
input[type="file"] { font: inherit; max-width: 100%; }
.feld { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.feld > label { font-size: .9rem; color: var(--text-leise); }
.feld-wert { color: var(--text); font-variant-numeric: tabular-nums; }
.feld-schalter { flex-direction: row; align-items: center; gap: 12px; }
.feld-schalter label { color: var(--text); font-size: .95rem; }
.feld-fehler { display: block; color: var(--fehler); font-size: .85rem; min-height: 0; }
.feld-fehler:empty { display: none; }
.feld-hinweis { color: var(--text-leise); font-size: .85rem; margin: 6px 0 0; }

/* Schalter (Checkbox im Kippschalter-Look) */
.schalter {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 52px; height: 30px; border-radius: 30px; margin: 0;
  background: #CFC7BB; position: relative; cursor: pointer; transition: background .2s;
}
.schalter::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform .2s;
}
.schalter:checked { background: var(--wald); }
.schalter:checked::after { transform: translateX(22px); }

/* ---------- Karten ---------- */
.karte {
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius); box-shadow: var(--schatten);
  padding: clamp(14px, 2vw, 22px);
  min-width: 0;
}
.karte-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.karte-kopf h1, .karte-kopf h2 { margin: 0; }
.einleitung { color: var(--text-leise); max-width: 80ch; }
.leer-hinweis { color: var(--text-leise); font-style: italic; }
.version { color: var(--text-leise); font-size: .85rem; }

/* ---------- Hinweise (Toasts) ---------- */
.hinweise { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.hinweis { background: var(--text); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--schatten); transition: opacity .35s, transform .35s; }
.hinweis-erfolg { background: var(--wald); }
.hinweis-fehler { background: var(--fehler); }
.hinweis-weg { opacity: 0; transform: translateY(8px); }

/* ---------- Dialoge ---------- */
.dialog { border: none; border-radius: var(--radius); padding: 22px; width: min(92vw, 480px); box-shadow: 0 20px 60px rgb(0 0 0 / 25%); color: var(--text); }
.dialog::backdrop { background: rgb(43 47 58 / 45%); }
.dialog-breit { width: min(96vw, 860px); max-height: 90vh; max-height: 90dvh; }
.dialog-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: -22px; background: var(--flaeche); padding: 4px 0 10px; z-index: 1; }
.dialog-kopf h2 { margin: 0; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.dialog-info { color: var(--text-leise); }

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