/* envago.de — Design Tokens (west-spinx aligned) */
:root {
  /* Surfaces — dark first */
  --bg: #000000;
  --bg-2: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --line: rgba(255,255,255,0.10);
  --line-2: rgba(255,255,255,0.20);
  --line-3: rgba(255,255,255,0.32);

  /* Ink — on dark */
  --ink: #ffffff;
  --ink-2: #c4c4c4;
  --ink-3: #8a8a8a;
  --ink-4: #5a5a5a;
  /* Helle Linien in den Funktions-Icons der Startseite, zwischen --ink und --ink-2 */
  --ink-icon: #e0e0e0;

  /* Brand */
  --lime: #bbdd33;
  --lime-deep: #a3c41f;
  --lime-bright: #d4ea7a;

  --petrol: #265066;
  --petrol-deep: #1a3a4d;
  --petrol-light: #4a82a0;
  --petrol-tint: #2f6580;

  /* Light surfaces (for mockup chrome only) */
  --light-bg: #fafaf7;
  --light-bg-warm: #f5f3ec;
  --light-surface: #ffffff;
  --light-ink: #0c1a23;
  --light-ink-2: #2a3a45;
  --light-ink-3: #5a6a75;
  --light-ink-4: #8a98a2;
  --light-line: #e6e3da;
  --light-line-2: #efece4;

  /* Curated gradient pairings (animated headline spans) */
  --grad-lime-coral: linear-gradient(110deg, #7ac781 0%, #bbdd33 50%, #99cc00 100%);
  --grad-blue-magenta: linear-gradient(110deg, var(--petrol) 0%, #29abe2 50%, #7ac781 100%);
  --grad-lime-mint: linear-gradient(110deg, #29abe2 0%, #7ac781 50%, #bbdd33 100%);

  /* Typography */
  --font-sans: "Archivo", "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Archivo", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Radii — tighter than before to match west-spinx */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 20px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(0,0,0,0.4);
  --sh-2: 0 8px 24px -8px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --sh-3: 0 30px 60px -20px rgba(0,0,0,0.6), 0 12px 30px -12px rgba(0,0,0,0.35);
  --sh-glow: 0 0 0 6px rgba(187,221,51,0.18);

  /* Container */
  --maxw: 1280px;
  --pad: clamp(20px, 4vw, 56px);

  /* Grafiken (Spec 2026-09-28) */
  --flow-out: #bbdd33;
  --flow-in: #29abe2;
  --urgent: #e8a33a;
  --sp-power: #bbdd33;
  --sp-gas: #f0b429;
  --sp-water: #29abe2;
  --sp-heat: #e8703a;
  --dl-a: #29abe2;
  --dl-b: #9b7be0;
  --dl-team: #4f9a56;

  /* Produkt-Kennfarben (Entscheidung 2026-10-01). Lime ist allein die Marke envago,
     keine Produktfarbe. Ablesen = Blau (envago EAST dunkel, Ableseportal hell),
     Zählerwechsel = Grün (envago WEST), Workforcetool = Türkis dazwischen, weil es für
     beide genutzt wird. Alle ≥ 3:1 auf --bg-2, also auch als kleine Markierung sichtbar. */
  --product-east: #1a6aa8;
  --product-ableseportal: #29abe2;
  --product-workforcetool: #2a9d8f;
  --product-west: #4f9a56;

  /* Text in Kennfarbe auf dem dunklen Menü (≥ 4,5:1 auf #0a0a0a, auch mit Hover-Tint).
     envago EAST ist dafür zu dunkel (3,5:1) und bekommt eine hellere Abstufung. */
  --product-east-text: #5f97c2;                        /* 6,31:1 */
  --product-ableseportal-text: var(--product-ableseportal); /* 7,56:1 */
  --product-workforcetool-text: var(--product-workforcetool); /* 5,96:1 */
  --product-west-text: var(--product-west);            /* 5,74:1 */

  /* Schrift auf Buttons in Kennfarbe (13 px, ≥ 4,5:1 auf Grund- und Hover-Ton) */
  --product-east-ink: #ffffff;          /* 5,72:1 · Hover 4,86:1 */
  --product-ableseportal-ink: #000000;  /* 8,02:1 · Hover 8,98:1 */
  --product-workforcetool-ink: #000000; /* 6,32:1 · Hover 7,40:1 */
  --product-west-ink: #000000;          /* 6,09:1 · Hover 7,20:1 */

  /* Hover-Ton der Buttons: etwas heller (EAST 8 %, sonst 12 % Weiß) */
  --product-east-hover: #2c76af;
  --product-ableseportal-hover: #43b5e5;
  --product-workforcetool-hover: #44a99c;
  --product-west-hover: #64a66a;
}

/* Akzentfarbe: global Lime (Marke envago). Auf den Produktseiten und an den
   Produkteinträgen im Menü setzt [data-product] sie auf die Kennfarbe. UI-Akzente
   (Eyebrow-Linie, Kachel-Labels, Fokus, Flächen) lesen nur diese Variablen. */
:root {
  --accent: var(--lime);
  --accent-text: var(--lime);
  --accent-ink: #000000;
  --accent-hover: #d4ff5a;

  /* Hintergrund-Blobs (Hero bzw. Abschlussbereich). Global die Marken-Mischung,
     auf den Produktseiten setzt [data-product] eine Familie um die Kennfarbe;
     --glow-2 ist der große Blob in der Mitte. */
  --glow-1: #7be0a8;
  --glow-2: #bbdd33;
  --glow-3: #29abe2;
  --glow-4: #34d399;
  --cta-glow-1: #29abe2;
  --cta-glow-2: var(--petrol);
  --cta-glow-3: #7ac781;
  --cta-glow-4: #bbdd33;
}

/* Produktkontext: Ein Element mit data-product (Menüeintrag, <body> einer Produktseite)
   legt fest, welche Kennfarbe darunter als Akzent gilt. btn-product und das Menü lesen
   nur diese Akzent-Variablen. */
[data-product="east"] {
  --accent: var(--product-east);
  --accent-text: var(--product-east-text);
  --accent-ink: var(--product-east-ink);
  --accent-hover: var(--product-east-hover);
  --glow-1: #5f97c2;
  --glow-2: #1a6aa8;
  --glow-3: #29abe2;
  --glow-4: #2c76af;
  --cta-glow-1: var(--glow-1);
  --cta-glow-2: var(--glow-2);
  --cta-glow-3: var(--glow-3);
  --cta-glow-4: var(--glow-4);
}
[data-product="ableseportal"] {
  --accent: var(--product-ableseportal);
  --accent-text: var(--product-ableseportal-text);
  --accent-ink: var(--product-ableseportal-ink);
  --accent-hover: var(--product-ableseportal-hover);
  --glow-1: #7fc8f0;
  --glow-2: #29abe2;
  --glow-3: #1a6aa8;
  --glow-4: #43b5e5;
  --cta-glow-1: var(--glow-1);
  --cta-glow-2: var(--glow-2);
  --cta-glow-3: var(--glow-3);
  --cta-glow-4: var(--glow-4);
}
[data-product="workforcetool"] {
  --accent: var(--product-workforcetool);
  --accent-text: var(--product-workforcetool-text);
  --accent-ink: var(--product-workforcetool-ink);
  --accent-hover: var(--product-workforcetool-hover);
  --glow-1: #44a99c;
  --glow-2: #2a9d8f;
  --glow-3: #29abe2;
  --glow-4: #4f9a56;
  --cta-glow-1: var(--glow-1);
  --cta-glow-2: var(--glow-2);
  --cta-glow-3: var(--glow-3);
  --cta-glow-4: var(--glow-4);
}
[data-product="west"] {
  --accent: var(--product-west);
  --accent-text: var(--product-west-text);
  --accent-ink: var(--product-west-ink);
  --accent-hover: var(--product-west-hover);
  --glow-1: #7ac781;
  --glow-2: #4f9a56;
  --glow-3: #2a9d8f;
  --glow-4: #64a66a;
  --cta-glow-1: var(--glow-1);
  --cta-glow-2: var(--glow-2);
  --cta-glow-3: var(--glow-3);
  --cta-glow-4: var(--glow-4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; } /* Fokus und Sprungziele nicht unter der festen Navigation (WCAG 2.4.11) */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad);
}

/* Mono eyebrow — west-spinx style */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
  opacity: 1;
}

/* Section title pattern (west-spinx .sec-title) */
.sec-title {
  font-family: var(--font-sans);
  font-weight: 800;
  /* Unter ~380 px etwas kleiner, damit „Für Organisationen,“ in eine Zeile passt
     und „Für“ nicht allein steht. */
  font-size: clamp(min(36px, 9.5vw), 5.2vw, 80px);
  line-height: 0.96;
  letter-spacing: -0.035em;
  margin: 18px 0 18px;
  text-transform: none;
  color: var(--ink);
}
.sec-lead {
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0;
}

/* (no extra rule needed — JS skips gradient spans when splitting) */

/* Word-splitter spans need padding-bottom so descenders (g, p, y) aren't
   clipped — inline-block + bg-clip:text + line-height tight = clipped glyphs. */
.hero h1 .wd,
.hero h1 .wd .blue {
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

/* Hero word entry — used by site.js word-splitter */
@keyframes wd-in {
  from { opacity: 0; transform: translateY(0.4em); }
  to { opacity: 1; transform: translateY(0); }
}

/* Animated gradient text span — three keyframe families, each anchored
   at a brand color (the rest position when paused). */
@keyframes gradShiftLime {
  0%, 100% { background-position: 50% 50%; }
  25%      { background-position: 0% 50%; }
  75%      { background-position: 100% 50%; }
}
@keyframes gradShiftMint {
  0%, 100% { background-position: 100% 50%; }
  50%      { background-position: 0% 50%; }
}
@keyframes gradShiftBlue {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.blue {
  position: relative;
  display: inline-block;
  background: var(--grad, var(--grad-lime-coral));
  background-size: 600% 600%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradShiftLime 8s ease-in-out infinite;
  animation-fill-mode: both;
  animation-play-state: paused;
}
body.is-scrolling .blue { animation-play-state: running !important; }

/* Per-context gradient assignments */
.hero h1 .blue { --grad: var(--grad-lime-coral); --grad-rest: var(--rest-coral, 0); }
.hero h1 .blue.alt { --grad: var(--grad-blue-magenta); --grad-rest: var(--rest-bm, 0); }
.section .sec-title .blue { --grad: var(--grad-lime-mint); --grad-rest: var(--rest-mint, 0); }
.products .sec-title .blue { --grad: var(--grad-lime-mint); --grad-rest: var(--rest-mint, 0); }
.audience .sec-title .blue { --grad: var(--grad-blue-magenta); --grad-rest: var(--rest-bm, 0); }
.stats-section .sec-title .blue { --grad: var(--grad-lime-coral); --grad-rest: var(--rest-coral, 0); }
.features .sec-title .blue { --grad: var(--grad-blue-magenta); --grad-rest: var(--rest-bm, 0); }
.cta h2 .blue { --grad: var(--grad-blue-magenta); --grad-rest: var(--rest-bm, 0); }
.testi-numbers .n .blue { --grad: var(--grad-lime-coral); --grad-rest: var(--rest-coral, 0); }

/* Per-family keyframe assignment so each gradient parks on its brand color */
.section .sec-title .blue,
.products .sec-title .blue { animation-name: gradShiftMint; }

.hero h1 .blue.alt,
.audience .sec-title .blue,
.features .sec-title .blue,
.cta h2 .blue { animation-name: gradShiftBlue; }

/* Produktseiten: Verlaufs-Texte starten im Farbton des Produkts.
   Jeder Text behält seinen Verlauf; beim Scrollen läuft wie überall die ganze Skala
   (0 % → 100 % → 0 %) durch. Geändert ist nur der Startpunkt: --rest-* je Verlauf und
   Produkt, als Zahl 0–100 (Position im Verlauf). Bei background-size 600 % zeigt eine
   Position p ungefähr den Verlaufsabschnitt um 5p/6 + 1/12.
   Ausnahme Hero-Zeile: --grad-lime-coral (Grün → Lime → Gelbgrün) enthält kein Blau,
   deshalb nutzt sie auf envago EAST, Ableseportal und Workforcetool --grad-lime-mint
   (Blau → Grün → Lime). */
body[data-product="east"]          { --rest-mint: 0;  --rest-bm: 30;  --rest-coral: 0; }
body[data-product="ableseportal"]  { --rest-mint: 0;  --rest-bm: 50;  --rest-coral: 0; }
body[data-product="workforcetool"] { --rest-mint: 20; --rest-bm: 80;  --rest-coral: 0; }
body[data-product="west"]          { --rest-mint: 50; --rest-bm: 100; --rest-coral: 0; }
html body:is([data-product="east"], [data-product="ableseportal"], [data-product="workforcetool"]) .hero h1 .blue {
  --grad: var(--grad-lime-mint) !important;
  --grad-rest: var(--rest-mint) !important;
}
@keyframes gradSweep {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
/* Linear, damit eine negative Verzögerung genau auf den Startpunkt fällt:
   Position p ist nach p × 0,04 s erreicht (0 → 100 % in 4 s).
   !important, weil Seiten und Abschnitte eigene Keyframes und Verzögerungen setzen.
   Nicht für animation-play-state: das schaltet body.is-scrolling beim Scrollen um. */
html body[data-product] .blue {
  background-position: calc(var(--grad-rest, 0) * 1%) 50%;
  animation-name: gradSweep !important;
  animation-timing-function: linear !important;
  animation-delay: calc(var(--grad-rest, 0) * -0.04s) !important;
  animation-direction: normal !important;
  animation-fill-mode: both !important;
}
@media (prefers-reduced-motion: no-preference) {
  html body[data-product] .blue {
    animation-duration: 8s !important;
    animation-iteration-count: infinite !important;
  }
}
/* Bewegung reduziert: keine Animation, der Text steht auf seinem Startpunkt */
@media (prefers-reduced-motion: reduce) {
  html body[data-product] .blue { animation: none !important; }
}

/* Descender + right-edge clipping fix for gradient-clipped text.
   Negative margin-bottom compensates the padding so the inline-block's
   layout footprint stays at the baseline — otherwise the line containing
   .blue becomes taller than its neighbours in multi-line headlines. */
.sec-title .blue,
.cta h2 .blue,
.testi-numbers .n .blue,
.stat-cell .num .blue {
  padding-bottom: 0.16em !important;
  padding-right: 0.06em !important;
  margin-bottom: -0.16em !important;
  vertical-align: baseline;
}

/* Animated liquid blobs behind headlines */
@keyframes blob1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.15); }
  66% { transform: translate(-20px, 25px) scale(0.9); }
}
@keyframes blob2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-25px, 15px) scale(0.92); }
  66% { transform: translate(20px, -25px) scale(1.12); }
}
@keyframes blob3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15px, -15px) scale(1.08); }
}
.blob-stage {
  position: absolute;
  inset: -60px -40px;
  z-index: 0;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.5;
}
.blob-stage .blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.blob-stage .b1 {
  width: 380px; height: 380px;
  top: -10%; left: 5%;
  background: radial-gradient(circle, var(--glow-1) 0%, transparent 70%);
  animation: blob1 14s ease-in-out infinite;
  animation-play-state: paused;
}
.blob-stage .b2 {
  width: 420px; height: 420px;
  top: 10%; left: 35%;
  background: radial-gradient(circle, var(--glow-2) 0%, transparent 70%);
  animation: blob2 18s ease-in-out infinite;
  animation-play-state: paused;
}
.blob-stage .b3 {
  width: 320px; height: 320px;
  top: -20%; left: 60%;
  background: radial-gradient(circle, var(--glow-3) 0%, transparent 70%);
  animation: blob3 16s ease-in-out infinite;
  animation-play-state: paused;
}
.blob-stage .b4 {
  width: 280px; height: 280px;
  top: 25%; right: 5%;
  background: radial-gradient(circle, var(--glow-4) 0%, transparent 70%);
  animation: blob1 20s ease-in-out infinite reverse;
  animation-play-state: paused;
}
body.is-scrolling .blob-stage .blob { animation-play-state: running !important; }
.has-blobs { position: relative; }
.has-blobs > * { position: relative; z-index: 1; }

/* Reveal animation utilities
   Der versteckte Anfangszustand gilt nur, wenn JavaScript läuft (die Klasse
   „js“ setzt ein Inline-Skript im <head>). Ohne JS bleibt alles sichtbar. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.js .reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.js .reveal-stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
.js .reveal-stagger.in > *:nth-child(1) { transition-delay: 0.05s; }
.js .reveal-stagger.in > *:nth-child(2) { transition-delay: 0.12s; }
.js .reveal-stagger.in > *:nth-child(3) { transition-delay: 0.19s; }
.js .reveal-stagger.in > *:nth-child(4) { transition-delay: 0.26s; }
.js .reveal-stagger.in > *:nth-child(5) { transition-delay: 0.33s; }
.js .reveal-stagger.in > *:nth-child(6) { transition-delay: 0.40s; }

/* Sicherheitsnetz: Seiten mit eigenen .reveal-Regeln (z. B. east, west) dürfen
   Inhalte ohne JavaScript ebenfalls nicht verstecken. */
html:not(.js) .reveal,
html:not(.js) .reveal-stagger > * {
  opacity: 1 !important;
  transform: none !important;
}

/* Bewegung reduzieren, wenn das System es wünscht */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-fill-mode: both !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .reveal,
  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Tastaturfokus sichtbar machen */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}
#inhalt:focus { outline: none; }

/* Sprunglink „Zum Inhalt springen“: erst bei Tastaturfokus sichtbar */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--lime);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  transform: translateY(-200%);
  transition: transform .15s;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

::selection { background: var(--accent); color: var(--accent-ink); }
