/* =========================================================================
   Head & Shoulders – Video Landingpage
   Mobile-first, Portrait. Optimiert für 360–430px Breite.
   ========================================================================= */

/* SansFlake – H&S Hausschrift (Kunden-Asset) */
@font-face {
  font-family: "Sans Flake";
  src: url("assets/fonts/SansFlake-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sans Flake";
  src: url("assets/fonts/SansFlake-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Branding */
  --hs-blue: #003da6;          /* Primärfarbe – neues H&S-CI (Kunden-Asset) */
  --hs-blue-dark: #002d7a;     /* Active/Press-State */
  --hs-blue-tint: #e6eefc;     /* sehr helles Blau für Flächen */

  --bg: #77cae1;               /* Eis-Blau, gemittelt aus oberem BG-Bildbereich – tönt die iOS-Statusbar passend */
  --bg-soft: #f5f6f8;
  --text: #1a1d24;
  --text-muted: #5b6170;
  --border: #d7dbe3;

  /* Maße */
  --radius-video: 22px;
  --radius-btn: 16px;
  --tap-target: 52px;           /* > 44px Touch-Target */
  --page-pad: 20px;
  --maxw: 460px;

  --shadow-video: 0 12px 30px rgba(0, 30, 90, 0.18);
  --shadow-btn: 0 4px 14px rgba(0, 70, 190, 0.28);
}

* { box-sizing: border-box; }

/* Das HTML-Attribut [hidden] muss display-Regeln (flex/grid) sicher schlagen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Sans Flake", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg) url("assets/bg.jpg") center / cover no-repeat;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Seiten-Layout: vertikal, zentriert, mit sicheren Rändern ----
   Feste Viewport-Höhe → kein Scrollen. Logo (oben) und Buttons (unten)
   behalten ihre natürliche Größe, der Video-Bereich füllt den Rest und
   schrumpft auf kleinen Displays mit. */
.page {
  height: 100vh;          /* Fallback für ältere Browser */
  height: 100svh;         /* kleine Viewport-Höhe (berücksichtigt Browser-UI) */
  max-width: var(--maxw);
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    var(--page-pad)
    calc(env(safe-area-inset-bottom, 0px) + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow: hidden;       /* nichts scrollt – alles bleibt sichtbar */
}

/* ---- Logo ---- */
.brand {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2px 0 0;
}
.brand__logo {
  display: block;
  width: auto;
  height: 46px;
  max-width: 64%;
}

/* ---- Video ----
   .video ist das flexible Element: es füllt die Resthöhe zwischen Logo und
   Buttons und zentriert den (höhen-getriebenen) Player darin. */
.video {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;                 /* erlaubt Schrumpfen in der Flexbox */
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Frame & Fehlerbox: Höhe bestimmt die Größe (height-driven), Breite folgt
   dem 9:16-Verhältnis – maximal jedoch die volle Spaltenbreite. */
.video__frame,
.video__error {
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;          /* Hochformat */
}
.video__frame {
  position: relative;
  border-radius: var(--radius-video);
  overflow: hidden;
  background: linear-gradient(160deg, #d7f0fb, #a9d8ef);  /* helle Eis-Blau-Karte statt schwarz */
  box-shadow: var(--shadow-video);
}
.video__el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;   /* Frame-Hintergrund durchscheinen lassen, kein schwarzer Block */
}

/* Play-Overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: opacity 0.25s ease;
}
.play-overlay::before {
  content: "";
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.play-overlay__icon {
  position: relative;
  width: 38px;
  height: 38px;
  fill: var(--hs-blue);
  margin-left: 4px; /* optische Mitte des Play-Dreiecks */
}
.play-overlay:active::before { transform: scale(0.94); }
/* Overlay ausblenden, sobald Wiedergabe gestartet */
.video[data-state="playing"] .play-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Loading-Indicator – helle Eis-Blau-Karte, passend zum Frame */
.loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #d7f0fb, #a9d8ef);
}
.loader__spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(0, 61, 166, 0.2);
  border-top-color: var(--hs-blue);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loader & Play-Overlay zustandsabhängig zeigen/verstecken */
.video[data-state="loading"] .play-overlay,
.video[data-state="error"] .play-overlay { display: none; }
.video:not([data-state="loading"]) .loader { display: none; }
.video[data-state="error"] .video__frame { display: none; }

/* Fehlerzustand (Größe via .video__frame, .video__error oben) */
.video__error {
  border-radius: var(--radius-video);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 28px;
}
.video__error-icon {
  width: 54px;
  height: 54px;
  fill: var(--text-muted);
}
.video__error-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 24ch;
}

/* ---- Aktionen / Buttons ---- */
.actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Unsichtbar, aber Layout-Platz bleibt erhalten (kein Höhensprung beim Laden) */
.actions.is-hidden { visibility: hidden; }
.btn {
  width: 100%;
  min-height: var(--tap-target);
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 18px;
  transition: transform 0.06s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn__icon { width: 24px; height: 24px; flex: none; }
/* Labels in Versalien wie im neuen Layout */
.btn__label { text-transform: uppercase; letter-spacing: 0.02em; }

.btn--primary {
  border: 0;
  background: var(--hs-blue);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn--primary .btn__icon { fill: #fff; }
.btn--primary:hover { background: #0049c4; }
.btn--primary:active { background: var(--hs-blue-dark); transform: translateY(1px); }

.btn--secondary {
  border: 2px solid var(--hs-blue);
  background: #fff;
  color: var(--hs-blue);
}
.btn--secondary .btn__icon { fill: var(--hs-blue); }
.btn--secondary:hover { background: var(--hs-blue-tint); }
.btn--secondary:active { background: #dbe5fb; transform: translateY(1px); }

.btn:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

/* Sichtbarer Keyboard-Focus */
.btn:focus-visible,
.play-overlay:focus-visible {
  outline: 3px solid var(--hs-blue);
  outline-offset: 3px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

/* ---- Tablet/Desktop: zentriert halten, nicht aufblähen ---- */
@media (min-width: 600px) {
  .page { gap: 26px; }
}
