/*
 * Gemeinsame Basis für alle Seiten (Kern). Seit dem Umbau dunkel und plakativ, siehe SPEC Abschnitt 10.
 * Tokens und Schriften aus der Lulububu-CI (assets/lulububu.css), kleiner Reset,
 * Blob-Helfer, "Später"-Marker und ein paar Kleinigkeiten, die jede App braucht.
 * Buttons und Layout gehören in die CSS-Datei der jeweiligen App.
 */

/* ---- Schriften (Pfade relativ zu css/) ---- */
@font-face { font-family: "Bjola"; src: url("../assets/fonts/bjola-webfont.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Signika"; src: url("../assets/fonts/Signika-Light.ttf") format("truetype"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Signika"; src: url("../assets/fonts/Signika-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Signika"; src: url("../assets/fonts/Signika-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Signika"; src: url("../assets/fonts/Signika-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* ---- Tokens: „Leuchtreklame bei Nacht“ (SPEC Abschnitt 10) ----
 * Schwarz ist die Bühne, die Lulububu-Farben leuchten darauf, Schrift ist Weiß.
 * --paper und --ink heißen noch wie im hellen Dummy: --paper ist der Grund (schwarz),
 * --ink die Schrift (weiß). Wer wirklich Schwarz oder Weiß meint, nimmt --black und --white.
 */
:root {
  color-scheme: dark;

  --black: #000000;
  --white: #ffffff;

  --paper: var(--black);          /* Grund */
  --ink: var(--white);            /* Schrift */
  --card: var(--black);           /* Flächen bleiben schwarz und bekommen eine Kontur */
  --muted: #b9b9b9;               /* Nebentext, 10,7:1 auf Schwarz */
  --line: #4d4d4d;                /* Schienen, ruhige Linien */

  /* Markenfarben. Grün ist auf Schwarz das helle Grün der CI, das dunkle bleibt als --green-deep. */
  --blue: #2094ff;
  --bluegray: #568bbd;
  --pink: #f0017d;
  --green: #00e71d;
  --green-light: #00e71d;
  --green-deep: #3a9c5e;
  --orange: #ff622f;
  --purple: #ae64ff;
  --yellow: #ffea00;
  --gold: #cab33d;

  /* Fehlzündung, leerer Tank */
  --dud: #5c5c5c;

  --accent: var(--blue);
  --ink-mix: 78%;                 /* Schrift in Akzentfarbe auf Schwarz: leicht aufgehellt */
  --on-accent: var(--black);      /* Schrift auf vollflächigem Akzent: immer Schwarz */
  --accent-text: color-mix(in srgb, var(--accent) var(--ink-mix), #fff);

  /* Regenbogen in der Reihenfolge der CI, schließt mit der ersten Farbe (läuft nahtlos um). */
  --rainbow-stops: var(--pink), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple), var(--pink);
  --rainbow: linear-gradient(90deg, var(--rainbow-stops));

  /* Harter, versetzter Schatten in Akzentfarbe („Aufkleber“). Größe über --pop-d. */
  --pop-d: 6px;
  --pop: var(--pop-d) var(--pop-d) 0 var(--accent);

  --font-head: "Bjola", "Signika", system-ui, sans-serif;
  --font-text: "Signika", system-ui, sans-serif;

  --blob-ratio: 141.9 / 113.45;   /* Seitenverhältnis der Blob-Form */
  --blob-radius: 48% 52% 45% 55% / 55% 45% 55% 45%;  /* Blob-Näherung per border-radius */
}

/* Akzent je Akt: Klasse aus scene.accent bilden, z. B. "t-" + scene.accent */
.t-blue   { --accent: var(--blue); }
.t-pink   { --accent: var(--pink); }
.t-orange { --accent: var(--orange); }
.t-purple { --accent: var(--purple); }
.t-green  { --accent: var(--green); }
.t-yellow { --accent: var(--yellow); --ink-mix: 100%; }
/* --accent-text hängt von --accent ab und muss dort neu berechnet werden, wo der Akzent wechselt.
   Auf :root allein bliebe es beim Blau. */
.t-blue, .t-pink, .t-orange, .t-purple, .t-green, .t-yellow {
  --accent-text: color-mix(in srgb, var(--accent) var(--ink-mix), #fff);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
html { background: var(--black); }
::selection { background: var(--accent); color: var(--black); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-weight: 400;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---- Blob ----
 * Markup (Symbol einmal pro Seite, siehe SPEC Abschnitt 11):
 *   <svg class="blob" aria-hidden="true"><use href="#blob"/></svg>
 * Füllung = --accent, Seitenverhältnis wie im Logo, Breite bestimmt die Größe.
 */
.blob { display: block; width: 100%; height: auto; aspect-ratio: var(--blob-ratio); fill: var(--accent); overflow: visible; }
.blob.is-dud { fill: var(--dud); }

/* Beliebiges Element in Blob-Form schneiden (z. B. einen Startknopf). */
.blob-mask {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 141.9 113.45' preserveAspectRatio='none'%3E%3Cpath d='m0 57.17c2.19-12.63 6.89-23.66 16.19-33.17 1.81-1.83 3.17-3.89 4.81-5.83a42.75 42.75 0 0 1 17.88-12.81 24 24 0 0 1 4.68-1.24c5.91-1 11.82-2 17.79-2.81 10-1.29 20.08-2.23 29.91.23 7.82 2 16.22 3.18 22.77 7.69 9.72 6.71 18.82 13.88 23.44 24 3.13 6.85 4.2 13.93 4.41 21.19a67.67 67.67 0 0 1 -6.23 29.53c-5.13 11.53-14.64 20.27-28.87 25a90.24 90.24 0 0 1 -36.94 4.05c-5.38-.48-10.66-.57-16-.55-9.47 0-18.87-1.49-27.18-5.15-15.3-6.7-24.21-17.5-26.06-31.72-.81-6.29-.45-12.67-.6-18.41z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 141.9 113.45' preserveAspectRatio='none'%3E%3Cpath d='m0 57.17c2.19-12.63 6.89-23.66 16.19-33.17 1.81-1.83 3.17-3.89 4.81-5.83a42.75 42.75 0 0 1 17.88-12.81 24 24 0 0 1 4.68-1.24c5.91-1 11.82-2 17.79-2.81 10-1.29 20.08-2.23 29.91.23 7.82 2 16.22 3.18 22.77 7.69 9.72 6.71 18.82 13.88 23.44 24 3.13 6.85 4.2 13.93 4.41 21.19a67.67 67.67 0 0 1 -6.23 29.53c-5.13 11.53-14.64 20.27-28.87 25a90.24 90.24 0 0 1 -36.94 4.05c-5.38-.48-10.66-.57-16-.55-9.47 0-18.87-1.49-27.18-5.15-15.3-6.7-24.21-17.5-26.06-31.72-.81-6.29-.45-12.67-.6-18.41z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* Kleine Blobs ohne SVG (Tank-Anzeige, Punkte, Marken). */
.blob-dot { display: inline-block; width: 1em; height: .8em; border-radius: var(--blob-radius); background: var(--accent); vertical-align: middle; }
.blob-dot.is-empty { background: transparent; box-shadow: inset 0 0 0 2px var(--dud); }

/* ---- "Später"-Marker ----
 * <span class="later">Echter QR-Code und Kurz-URL kommen mit dem Server.</span>
 * Zeigt eine gestrichelte Pille "Später" und danach den erklärenden Text.
 * Größe über --later-size (Standard 14px), Farbe folgt currentColor (auch auf dunklem Grund).
 * Als Block: class="later is-block".
 */
.later {
  --later-size: 14px;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .25em .55em;
  font-family: var(--font-text);
  font-size: var(--later-size);
  font-weight: 400;
  line-height: 1.35;
  color: inherit;
  opacity: .8;
}
.later::before {
  content: "Später";
  flex: none;
  font-weight: 600;
  font-size: .85em;
  line-height: 1;
  padding: .3em .7em .32em;
  border: 1.5px dashed currentColor;
  border-radius: 999px;
}
.later.is-block { display: flex; }

/* ---- Regenbogen-Rand (SPEC Abschnitt 10.3) ----
 * <div class="rainbow-edge" aria-hidden="true"></div> als letztes Kind von <body>.
 * Ein Ring in Randbreite, darin dreht sich ein Regenbogen-Kegel: Die Farben fahren um den Rand.
 * Gedreht wird nur per transform, das kostet auch auf Handys kaum etwas.
 *   --rb-w     Breite des Rands (Standard 3px)
 *   --rb-turn  Dauer einer Runde (Standard 9s)
 *   --rb-size  Kantenlänge des Kegels, muss die Diagonale decken (Standard 150vmax)
 * In einer skalierten Bühne: position: absolute und --rb-size in Bühnenpixeln setzen.
 * .is-pulse  Rand atmet (für große Flächen wie die Leinwand)
 * .is-flare  kurz breit (Höhepunkte: Auflösung, Start, Podium), per JS für rund 0,7 s setzen
 */
.rainbow-edge {
  --rb-w: 3px;
  --rb-turn: 9s;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  overflow: hidden;
  padding: var(--rb-w);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: padding .28s cubic-bezier(.2, .9, .2, 1);
}
.rainbow-edge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--rb-size, 150vmax);
  height: var(--rb-size, 150vmax);
  margin: calc(var(--rb-size, 150vmax) / -2) 0 0 calc(var(--rb-size, 150vmax) / -2);
  background: conic-gradient(from 0deg, var(--rainbow-stops));
  animation: rb-turn var(--rb-turn) linear infinite;
}
.rainbow-edge.is-pulse { animation: rb-pulse 2.6s ease-in-out infinite; }
.rainbow-edge.is-flare { padding: calc(var(--rb-w) * 4); animation: none; }
@keyframes rb-turn { to { transform: rotate(1turn); } }
@keyframes rb-pulse { 50% { padding: calc(var(--rb-w) * 2); } }

/* ---- Kleinigkeiten ---- */
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.head { font-family: var(--font-head); font-weight: 400; line-height: 1.05; letter-spacing: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

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