/* Scale of Time — Stile. Jeder Abschnitt trägt die ID seines Bauteils aus
   docs/design/designsystem.md. Geprüft von tools/pruefe_designsystem.py. */

/* == SOT-GRUND-01 Schriften == */
@font-face { font-family: "Source Sans 3"; src: url("../fonts/source-sans-3.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* == SOT-GRUND-02 Maße, Schrift, Bewegung == */
:root {
  --schrift-text: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --schrift-titel: var(--schrift-text);   /* Titel: dieselbe Schrift, fett (700) und eng gesetzt */
  --schrift-zahl: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --a-1: 4px; --a-2: 8px; --a-3: 12px; --a-4: 16px; --a-5: 24px; --a-6: 32px;
  --r-1: 6px; --r-2: 12px; --r-rund: 999px;
  --dauer: .28s;
  --kurve: cubic-bezier(.2, .7, .2, 1);
  --karte-breite: 392px;
}

/* == SOT-GRUND-03 Farben dunkel == */
[data-theme="dark"] {
  color-scheme: dark;
  --grund: #171614;
  --grund-mitte: #1c1b19;
  --flaeche: #22211f;
  --flaeche-2: #2f2d2a;
  --linie: rgba(255, 250, 240, .13);
  --linie-stark: rgba(255, 250, 240, .34);
  --text: #f7f5f2;
  --text-2: #b5b1aa;
  --text-3: #918d86;
  --akzent: #ffd60a;
  --auf-akzent: #171614;
  --schatten: 0 18px 50px rgba(0, 0, 0, .5);
  --b-teilchen: #bf5af2;
  --b-technik: #40c8e0;
  --b-leben: #30d158;
  --b-alltag: #ff9f0a;
  --b-geschichte: #ff453a;
  --b-erde: #ac8e68;
  --b-kosmos: #0a84ff;
}

/* == SOT-GRUND-04 Farben hell == */
[data-theme="light"] {
  color-scheme: light;
  --grund: #f7f5f2;
  --grund-mitte: #fbfaf8;
  --flaeche: #ffffff;
  --flaeche-2: #ebe8e3;
  --linie: rgba(60, 55, 45, .16);
  --linie-stark: rgba(60, 55, 45, .42);
  --text: #12110f;
  --text-2: #57534c;
  --text-3: #736e66;
  --akzent: #a05a00;
  --auf-akzent: #ffffff;
  --schatten: 0 14px 40px rgba(40, 30, 10, .16);
  --b-teilchen: #8944ab;
  --b-technik: #008299;
  --b-leben: #248a3d;
  --b-alltag: #c93400;
  --b-geschichte: #d70015;
  --b-erde: #7f6545;
  --b-kosmos: #0040dd;
}

/* == SOT-GRUND-05 Seite == */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: radial-gradient(ellipse 90% 80% at 50% 46%, var(--grund-mitte) 0%, var(--grund) 72%) var(--grund);
  color: var(--text);
  font: 400 16px/1.47 var(--schrift-text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
p, h1, h2 { margin: 0; }
button { font: inherit; color: inherit; }
sup { font-size: .68em; line-height: 0; vertical-align: .55em; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ohne-skript { position: fixed; inset: 40% 0 auto; text-align: center; padding: var(--a-4); }

/* == SOT-ICON-01 Zeichen == */
.zeichen { width: 20px; height: 20px; flex: none; fill: currentColor; }
.zeichen--linie { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.zeichen--linie .zeichen__voll { fill: currentColor; stroke: none; }

/* == SOT-ICON-02 Zeichen aus dem Sprite == */
.etikett__zeichen { width: 26px; height: 26px; color: var(--etikett-farbe); }
.etikett__stern, .marke .zeichen { width: 14px; height: 14px; color: var(--akzent); }
.etikett__stern { display: inline-block; vertical-align: -2px; margin-right: 4px; }

/* == SOT-BTN-01 Knopf == */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--a-2);
  min-width: 40px; height: 40px; padding: 0 var(--a-3);
  border: 1px solid transparent; border-radius: var(--r-rund);
  background: var(--flaeche-2);
  color: var(--text); cursor: pointer;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background var(--dauer), border-color var(--dauer), color var(--dauer);
}
.knopf:hover { border-color: var(--linie-stark); }
.knopf--zeichen { width: 40px; padding: 0; }
.knopf--text { padding: 0 var(--a-4) 0 var(--a-3); }
.knopf.is-aktiv { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.knopf:disabled { opacity: .35; cursor: default; }

/* == SOT-BTN-02 Umschalter == */
.umschalter {
  display: inline-flex; height: 40px; padding: 3px;
  border: 0; border-radius: var(--r-rund);
  background: var(--flaeche-2);
}
.umschalter__teil {
  min-width: 38px; padding: 0 var(--a-2); border: 0; border-radius: var(--r-rund);
  background: transparent; color: var(--text-2); cursor: pointer;
  font: 600 13px/1 var(--schrift-text);
  transition: background var(--dauer), color var(--dauer);
}
.umschalter__teil:hover { color: var(--text); }
.umschalter__teil[aria-pressed="true"] { background: var(--flaeche); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .22); }

/* == SOT-KOPF-01 Kopfleiste == */
.kopf {
  position: fixed; inset: 0 0 auto 0; z-index: 3;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--a-3) var(--a-4);
  padding: max(var(--a-4), env(safe-area-inset-top)) var(--a-5) var(--a-5);
  background: linear-gradient(to bottom, var(--grund) 30%, transparent);
  pointer-events: none;
}
.kopf > * { pointer-events: auto; }
.kopf__marke { display: flex; align-items: baseline; gap: var(--a-4); min-width: 0; }
.kopf__titel { font: 700 24px/1.1 var(--schrift-titel); letter-spacing: -.022em; white-space: nowrap; }
.kopf__titel i { font-style: normal; }
.kopf__unterzeile { color: var(--text-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf__werkzeuge { display: flex; align-items: center; gap: var(--a-2); }

/* == SOT-CHIP-01 Bereichs-Chip == */
.bereiche {
  grid-column: 1 / -1; display: flex; gap: var(--a-2);
  overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--a-5) * -1); padding: 2px var(--a-5);
}
.bereiche::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: var(--a-2); flex: none;
  height: 32px; padding: 0 var(--a-3) 0 var(--a-2);
  border: 1px solid transparent; border-radius: var(--r-rund);
  background: var(--flaeche-2);
  color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: opacity var(--dauer), border-color var(--dauer);
}
.chip .zeichen { width: 18px; height: 18px; color: var(--chip-farbe, var(--akzent)); transition: color var(--dauer), opacity var(--dauer); }
.chip:hover { border-color: var(--linie-stark); }
.chip[aria-pressed="true"] { border-color: var(--chip-farbe, var(--text)); background: color-mix(in srgb, var(--chip-farbe, var(--text)) 16%, var(--flaeche)); }
.hat-auswahl .chip[data-bereich][aria-pressed="false"] { color: var(--text-3); }
.hat-auswahl .chip[data-bereich][aria-pressed="false"] .zeichen { color: var(--text-3); opacity: .6; }
.chip--alle { padding: 0 var(--a-3); }
.chip--alle[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--grund); }
.chip--alle[aria-pressed="true"] .chip__zahl { color: var(--grund); opacity: .7; }
.chip--stern { margin-right: var(--a-2); }
.chip--stern[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.chip--stern[aria-pressed="true"] .zeichen, .chip--stern[aria-pressed="true"] .chip__zahl { color: var(--auf-akzent); }
.chip__zahl { font: 400 11px/1 var(--schrift-zahl); color: var(--text-3); }

/* == SOT-INFO-01 Marke == */
.marke {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--a-2);
  border: 0; border-radius: var(--r-1); background: var(--flaeche-2);
  font: 600 12px/1 var(--schrift-text); color: var(--text-2);
  white-space: nowrap;
}
.marke--bereich { background: color-mix(in srgb, var(--marke-farbe) 15%, transparent); color: var(--marke-farbe); }
.marke--bereich::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--marke-farbe); }
.marke--schaetz { background: none; box-shadow: inset 0 0 0 1px var(--linie-stark); }
.marke--stern { background: color-mix(in srgb, var(--akzent) 16%, transparent); color: var(--akzent); }

/* == SOT-BUEHNE-01 Bühne == */
.buehne { position: fixed; inset: 0; z-index: 1; }
.buehne__leinwand { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.buehne__leinwand.is-zieht { cursor: grabbing; }
.buehne__leinwand.is-zeigt { cursor: pointer; }

/* == SOT-BUEHNE-02 Etikett == */
.etiketten { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.etikett {
  position: absolute; left: 0; top: 0; max-width: var(--etikett-breite, 300px); padding: 2px 8px 0 0;
  border: 0; border-radius: var(--r-1); background: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  text-align: left; color: var(--text);
  text-shadow: 0 0 5px var(--grund), 0 0 5px var(--grund), 0 0 10px var(--grund);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s, visibility 0s .2s;
  will-change: transform;
}
.etikett.is-da { opacity: var(--kraft, 1); visibility: visible; pointer-events: auto; transition: opacity .2s; }
.etikett__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.etikett--stern .etikett__titel { font-weight: 650; }
.etikett__titel, .etikett__dauer { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etikett__titel { font: 500 15px/1.25 var(--schrift-text); }
.etikett__dauer { font: 500 12px/1.3 var(--schrift-zahl); color: var(--etikett-farbe); }
.etikett.is-fokus .etikett__titel { font: 700 20px/1.2 var(--schrift-titel); letter-spacing: -.022em; }
.etikett:hover .etikett__titel, .etikett.is-wahl .etikett__titel { text-decoration: underline; text-decoration-color: var(--etikett-farbe); text-underline-offset: 3px; }

/* == SOT-INFO-02 Bedienhinweis == */
.hinweis {
  position: absolute; left: 50%; bottom: 176px; transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--a-5)); padding: var(--a-2) var(--a-4);
  border: 1px solid var(--linie); border-radius: var(--r-rund);
  background: color-mix(in srgb, var(--flaeche) 88%, transparent);
  color: var(--text-2); font-size: 14px; text-align: center;
  transition: opacity .6s, visibility 0s .6s; pointer-events: none;
}
.hinweis.is-weg { opacity: 0; visibility: hidden; }

/* == SOT-ZUST-01 Zustand (Laden, Leer, Fehler) == */
.zustand {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 2 * var(--a-5)));
  display: flex; flex-direction: column; align-items: center; gap: var(--a-3); text-align: center;
}
.zustand[hidden] { display: none; }
.zustand__titel { font: 700 22px/1.2 var(--schrift-titel); letter-spacing: -.022em; }
.zustand__text { color: var(--text-2); }
.zustand__text:empty { display: none; }

/* == SOT-KARTE-01 Erklärung zum aktiven Beispiel == */
.karte {
  position: fixed; z-index: 1; right: var(--a-6); top: 156px; bottom: calc(var(--fuss-hoehe, 150px) + var(--a-2)); width: var(--karte-breite);
  display: flex; flex-direction: column;   /* oben verankert: der Titel bleibt beim Wechsel an seinem Platz */
  pointer-events: none;                 /* liegt frei auf dem Grund: Rad und Ziehen gehen an die Bühne */
  opacity: 0; visibility: hidden;
  transition: opacity var(--dauer) var(--kurve), visibility 0s var(--dauer);
}
.karte.is-offen { opacity: 1; visibility: visible; transition: opacity var(--dauer) var(--kurve); }
.karte__marken { display: flex; flex-wrap: wrap; gap: var(--a-2); pointer-events: auto; }
.karte__inhalt { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: var(--a-3); }
.karte__bild {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%; margin-top: var(--a-2);
  background: color-mix(in srgb, var(--karte-farbe, var(--akzent)) 14%, transparent); color: var(--karte-farbe, var(--akzent));
}
.karte__bild .zeichen { width: 30px; height: 30px; }
.karte__titel { font: 700 30px/1.12 var(--schrift-titel); letter-spacing: -.022em; text-wrap: balance; }
.karte__dauer { font: 500 17px/1.35 var(--schrift-zahl); color: var(--karte-farbe, var(--akzent)); }
.karte__sekunden { font: 400 13px/1.3 var(--schrift-zahl); color: var(--text-2); margin-top: -6px; }
.karte__text { font-size: 17px; line-height: 1.5; margin-top: var(--a-2); }
.karte__klein { font-size: 13.5px; color: var(--text-2); }
.karte__jetzt { margin-top: var(--a-2); padding-left: var(--a-3); border-left: 2px solid var(--karte-farbe, var(--akzent)); }
.karte__jetzt-wert { font: 500 14px/1.4 var(--schrift-zahl); font-variant-numeric: tabular-nums; margin-top: 2px; }
.karte__quelle { overflow-wrap: anywhere; }
.karte__quelle a { color: var(--text); text-underline-offset: 3px; pointer-events: auto; }
@media (max-height: 780px) and (min-width: 761px) { .karte__bild, .karte__jetzt { display: none; } }

/* == SOT-NAV-02 Maßstabsanzeige == */
.fuss {
  position: fixed; inset: auto 0 0 0; z-index: 3;
  padding: var(--a-6) var(--a-5) max(var(--a-3), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--grund) 58%, transparent);
  pointer-events: none;
}
.fuss > * { pointer-events: auto; }
.anzeige { display: flex; align-items: center; justify-content: center; gap: var(--a-4); width: fit-content; margin: 0 auto var(--a-2); }
.anzeige__mitte { min-width: 250px; text-align: center; }
.anzeige__kopf { font: 600 12px/1 var(--schrift-text); color: var(--text-3); }
.anzeige__wert { font: 700 30px/1.2 var(--schrift-titel); letter-spacing: -.022em; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.anzeige__potenz { font: 400 12.5px/1.2 var(--schrift-zahl); color: var(--text-2); }

/* == SOT-NAV-01 Zeitlineal == */
.lineal { position: relative; height: 50px; cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.lineal::before { content: ""; position: absolute; left: 0; right: 0; top: 18px; height: 1px; background: var(--linie-stark); }
.lineal__dichte { position: absolute; left: 0; right: 0; top: 4px; height: 14px; }
.lineal__dichte i {
  position: absolute; bottom: 0; width: 1.5px; height: 8px; margin-left: -.75px; opacity: .7; border-radius: 1px;
  transition: left var(--dauer) var(--kurve), opacity var(--dauer);
}
.lineal__dichte i.is-stern { width: 2px; height: 14px; margin-left: -1px; opacity: 1; }
.lineal__dichte i.is-aus { opacity: 0; }
.lineal__marken { position: absolute; left: 0; right: 0; top: 18px; height: 30px; }
.lineal__marke { position: absolute; top: 0; transform: translateX(-50%); padding-top: 9px; font: 400 11px/1.2 var(--schrift-zahl); color: var(--text-2); white-space: nowrap; }
.lineal__marke[hidden] { display: none; }
.lineal__marke::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 6px; background: var(--linie-stark); }
.lineal__marke--anfang { transform: none; }
.lineal__marke--anfang::before { left: 0; }
.lineal__marke--ende { transform: translateX(-100%); }
.lineal__marke--ende::before { left: 100%; }
.lineal__griff {
  position: absolute; top: 0; left: 0; width: 22px; height: 26px; margin-left: -11px;
  border: 1px solid var(--akzent); border-radius: var(--r-1);
  background: color-mix(in srgb, var(--akzent) 16%, transparent);
  will-change: transform;
}
.lineal__griff::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--akzent); border-radius: 1px; }

/* == SOT-DLG-01 Dialog == */
.dialog {
  width: min(600px, calc(100% - 2 * var(--a-4))); max-height: min(720px, calc(100dvh - 2 * var(--a-5)));
  padding: 0; border: 1px solid var(--linie); border-radius: var(--r-2);
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten);
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: color-mix(in srgb, var(--grund) 72%, transparent); backdrop-filter: blur(3px); }
.dialog__kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--a-3); padding: var(--a-4) var(--a-4) var(--a-2) var(--a-5); }
.dialog__titel { font: 700 24px/1.2 var(--schrift-titel); letter-spacing: -.022em; }
.dialog__inhalt { overflow-y: auto; padding: var(--a-2) var(--a-5) var(--a-5); display: flex; flex-direction: column; gap: var(--a-3); }
.dialog__inhalt h3 { margin: var(--a-3) 0 0; font: 700 15px/1.2 var(--schrift-text); color: var(--text); }
.dialog__inhalt p { color: var(--text); }
.dialog__inhalt kbd { font: 500 12px/1 var(--schrift-zahl); padding: 2px 6px; border: 1px solid var(--linie-stark); border-radius: 4px; }

/* == SOTR-06 Schmale Breite == */
@media (max-width: 760px) {
  .kopf { padding: max(var(--a-3), env(safe-area-inset-top)) var(--a-4) var(--a-4); gap: var(--a-2) var(--a-2); }
  .kopf__titel { font-size: 20px; }
  .kopf__unterzeile { display: none; }
  .kopf__werkzeuge { gap: 6px; }
  .knopf--text { width: 40px; padding: 0; }
  .knopf--text span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bereiche { margin: 0 calc(var(--a-4) * -1); padding: 2px var(--a-4); }
  .fuss { padding: var(--a-5) var(--a-4) max(var(--a-2), env(safe-area-inset-bottom)); }
  .anzeige { gap: var(--a-2); }
  .anzeige__mitte { min-width: 196px; }
  .anzeige__wert { font-size: 23px; }
  .hinweis { width: max-content; }
  .etikett.is-fokus .etikett__titel { font-size: 17px; }
  .karte {
    right: 0; left: 0; top: auto; bottom: var(--fuss-hoehe, 150px); width: auto; height: min(32dvh, 240px);
    padding: var(--a-2) var(--a-4) 0; pointer-events: auto;
  }
  .karte__inhalt { gap: 6px; overflow-y: auto; scrollbar-width: none; }
  .karte__bild, .karte__sekunden, .karte__jetzt { display: none; }
  .karte__titel { font-size: 21px; }
  .karte__dauer { font-size: 15px; }
  .karte__text { font-size: 16px; line-height: 1.42; margin-top: 2px; }
}

/* == SOTR-02 Bewegung reduzieren == */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
