/* =============================================================================
   KELLER GRUNDBAU – Messe-Touchscreen
   ============================================================================= */

/* Schrift: Keller-Vorgabe ist verbindlich „Effra", alternativ Arial – kein
   anderer Ersatz zulässig. Effra-Dateien liegen unter assets/fonts/ (von
   Keller selbst auf kellergrundbau.de öffentlich ausgeliefert, hier mit deren
   Freigabe für die Kiosk-Domain übernommen). Bisher nur Regular (400) und
   Medium (500) vorhanden – für 600/700/800 synthetisiert der Browser
   (font-synthesis) daraus ein fettes Effra, bis Keller die fehlenden
   Schnittgrade (u. a. die auf kellergrundbau.de als "..._1_0.woff2"
   referenzierte Datei) nachliefert. */
@font-face {
  font-family: 'Effra';
  src: url('../assets/fonts/effra-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Effra';
  src: url('../assets/fonts/effra-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy:        #003466;
  --navy-dark:   #011343;
  --navy-800:    #0a3f70;
  --gold:        #fdc600;
  --gold-dark:   #e0ad00;
  --steel:       #d2dbe4;
  --steel-light: #eef2f6;
  --paper:       #f1f3f5;
  --ink:         #333333;
  --white:       #ffffff;

  --radius:  0;
  --radius-lg: 0;
  --service-h: clamp(32px, 4vh, 40px);
  --header-h:  clamp(58px, 7vh, 80px);
  --topbar-h:  calc(var(--service-h) + var(--header-h));
  --font: 'Effra', Arial, sans-serif;

  --shadow: none;
  --shadow-lg: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body.hide-cursor,
body.hide-cursor * { cursor: none !important; }

img { -webkit-user-drag: none; user-drag: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* =============================================================================
   SERVICE-BAR + HEADER + NAVIGATION   (Aufbau analog kellergrundbau.de)
   ============================================================================= */

/* --- schmale dunkle Service-Leiste, Inhalt rechtsbündig -------------------- */
.servicebar {
  flex: 0 0 auto;
  height: var(--service-h);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 clamp(14px, 2.4vw, 40px);
  z-index: 31;
}
.servicebar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.92);
}
.servicebar__item svg { width: 1.15em; height: 1.15em; flex: 0 0 auto; }

/* --- weiße Kopfzeile: Logo | Navigation | Aktion -------------------------- */
.header {
  flex: 0 0 auto;
  height: var(--header-h);
  background: var(--white);
  color: var(--navy);
  display: flex;
  align-items: stretch;
  padding: 0 clamp(14px, 2.4vw, 40px);
  gap: clamp(12px, 2vw, 34px);
  border-bottom: 1px solid var(--steel);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.brand__logo { height: clamp(26px, 3.4vh, 40px); width: auto; display: block; }

.nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: clamp(2px, 0.5vw, 8px);
  overflow: hidden;
}

.nav__btn {
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 clamp(10px, 1.3vw, 18px);
  border-radius: 0;
  border-bottom: 3px solid transparent;
  font-size: clamp(13px, 1.25vw, 18px);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
/* Navigation wie kellergrundbau.de: reine Textlinks – Icons/Nummern aus */
.nav__btn svg,
.nav__btn .nav__nr { display: none; }
.nav__btn:hover { background: var(--steel-light); }
.nav__btn.is-active {
  color: var(--navy);
  font-weight: 700;
  border-bottom-color: var(--gold);
  background: transparent;
}

.header__actions { display: flex; align-items: center; flex: 0 0 auto; }

/* gold-eckiger Aktionsbutton mit navyfarbenem Pfeil-Tab (analog CTA) */
.cta-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: clamp(38px, 4.6vh, 48px);
  padding: 0 clamp(14px, 1.6vw, 22px) 0 clamp(26px, 2.6vw, 38px);
  border-radius: 0;
  background: var(--gold);
  color: var(--navy);
  font-family: inherit;
  font-size: clamp(13px, 1.2vw, 17px);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.cta-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: clamp(16px, 1.7vw, 24px);
  background: var(--navy);
  clip-path: polygon(0 0, 55% 0, 100% 50%, 55% 100%, 0 100%);
}
.cta-btn svg { width: 1.25em; height: 1.25em; flex: 0 0 auto; }
.cta-btn:hover { background: var(--gold-dark); }

@media (max-width: 900px) {
  .cta-btn span { display: none; }
  .cta-btn { padding-right: clamp(12px, 1.6vw, 18px); }
}

/* =============================================================================
   STAGE / VIEWS
   ============================================================================= */
.stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.view.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* --- HOME ------------------------------------------------------------------ */
.home {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: clamp(18px, 3.5vh, 48px) clamp(20px, 4vw, 72px) clamp(16px, 3vh, 40px);
  overflow-y: auto;
  justify-content: center;
}

.tiles {
  position: relative;
  flex: 1 1 auto;
  max-height: 82%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(12px, 2vw, 30px);
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  align-content: center;
}
.home__edge {
  position: absolute;
  left: 100%;
  margin-left: clamp(10px, 1.6vw, 22px);
  top: 50%;
  transform: translateY(-50%);
  height: 100%;
  pointer-events: none;
}

.tile {
  position: relative;
  z-index: 0;
  background: var(--white);
  border-radius: 0;
  padding: clamp(18px, 2.6vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease;
  border: 1px solid var(--steel);
  min-height: 150px;
}
.tile:hover { border-color: var(--navy); }
.tile:active { transform: scale(0.99); }

.tile__nr {
  position: absolute;
  right: clamp(14px, 1.8vw, 26px);
  top: clamp(10px, 1.4vw, 20px);
  font-size: clamp(30px, 4vw, 58px);
  font-weight: 800;
  color: var(--steel-light);
  line-height: 1;
}
.tile__icon {
  width: clamp(44px, 5vw, 68px);
  height: clamp(44px, 5vw, 68px);
  border-radius: 0;
  background: var(--navy);
  color: var(--white);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.tile__icon svg { width: 60%; height: 60%; }

.tile__head {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile__headline {
  font-size: clamp(19px, 2.2vw, 30px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
}
.tile__headsub {
  font-size: clamp(13px, 1.4vw, 18px);
  color: var(--navy-800);
  font-weight: 700;
  line-height: 1.3;
}

/* Pfeil-Dekor – standardmäßig ausgeblendet, blendet beim Hover/Antippen ein.
   Die Dauer ist bewusst an die JS-Navigationsverzögerung (OPEN_DELAY in app.js)
   angepasst: bei Touch soll der Pfeil sichtbar "herausfahren", bevor die
   Unterseite geöffnet wird. Beide Werte zusammen ändern. */
.tile__arrow {
  position: relative;
  z-index: -1;
  top: -120px;
  left: -110px;
  width: 90%;
  height: auto;
  margin-bottom: -66.7%; /* hebt den durch top/left verschobenen Platzbedarf auf (Seitenverhältnis bei width:90%), sonst wird der Text nach unten gedrückt */
  transform: translateX(-130%);
  transition: transform 1.2s ease;
  pointer-events: none;
}
.tile:hover .tile__arrow,
.tile.is-opening .tile__arrow {
  transform: translateX(0);
}

/* --- CONTENT VIEW -------------------------------------------------------- */
.content { background: var(--navy-dark); }

.content__bar {
  flex: 0 0 auto;
  height: clamp(52px, 6.5vh, 74px);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 clamp(12px, 2vw, 26px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  font-size: clamp(14px, 1.5vw, 19px);
  padding: 11px clamp(14px, 1.8vw, 22px);
  border-radius: 0;
  min-height: 46px;
}
.back-btn svg { width: 1.2em; height: 1.2em; }
.content__title {
  font-weight: 800;
  font-size: clamp(15px, 1.7vw, 22px);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.content__title .nr { color: var(--gold); }
.content__spacer { flex: 1 1 auto; }

.bar-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-weight: 700;
  font-size: clamp(12px, 1.3vw, 16px);
  padding: 9px 16px;
  border-radius: 0;
  min-height: 40px;
}
.bar-btn:hover { background: var(--gold); color: var(--navy); }

.content__body {
  flex: 1 1 auto;
  position: relative;
  background: var(--navy-dark);
  overflow: hidden;
}
.content__body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--white);
}

/* video */
.content__body video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* iframe blocked fallback */
.blocked {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 8vh 12vw;
  color: var(--white);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
}
.blocked.is-visible { display: flex; }
.blocked svg { width: 64px; height: 64px; color: var(--gold); }
.blocked h3 { margin: 0; font-size: clamp(20px, 2.4vw, 30px); }
.blocked p { margin: 0; max-width: 640px; line-height: 1.55; color: rgba(255,255,255,0.8); font-size: clamp(14px,1.5vw,18px); }
.blocked__shot {
  max-width: min(50vw, 560px);
  max-height: 38vh;
  width: auto;
  height: auto;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}
/* Plan B: QR-Code zur echten URL, solange die Seite sich nicht einbetten lässt */
.blocked__qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.blocked__qr {
  background: var(--white);
  padding: 12px;
  line-height: 0;
}
p.blocked__qr-hint {
  max-width: 280px;
  font-size: clamp(12px, 1.3vw, 15px);
  color: rgba(255,255,255,0.7);
}

/* =============================================================================
   YOUTUBE FACADE (performantes Embed)
   ============================================================================= */
.yt {
  position: absolute;
  inset: 0;
  background: #000;
}
/* .yt__cover bleibt über dem Iframe liegen, bis die Wiedergabe wirklich
   läuft (siehe app.js, .is-hidden wird erst beim PLAYING-Event gesetzt) –
   so verdeckt das schöne Vorschaubild YouTubes eigenen grauen Ladebildschirm,
   statt dass beides kurz nacheinander sichtbar aufblitzt. */
.yt__cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: #000 center / cover no-repeat;
  cursor: pointer;
  transition: opacity 0.4s ease;
}
.yt__cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,0.15), rgba(0,0,0,0.5));
}
.yt__cover.is-hidden { opacity: 0; pointer-events: none; }
.yt__play {
  position: relative;
  width: clamp(80px, 9vw, 130px);
  height: clamp(80px, 9vw, 130px);
  border-radius: 0;
  background: var(--gold);
  display: grid;
  place-items: center;
  transition: transform 0.15s, opacity 0.2s ease;
}
.yt__cover:hover .yt__play { transform: scale(1.06); }
/* Nach dem Antippen (Ladephase) den Play-Pfeil ausblenden, Vorschaubild bleibt */
.yt__cover.is-loading .yt__play { opacity: 0; }
.yt__play svg { width: 42%; height: 42%; margin-left: 8%; color: var(--navy); }
/* pointer-events: none -> Klicks auf YouTube-eigene UI-Elemente (Video-Titel,
   Kanal-Link, Teilen-Button, "Auf YouTube ansehen") sind damit unmöglich; der
   Kiosk soll ausschließlich das Video abspielen, ohne dass man zu YouTube
   wegnavigieren kann. */
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; z-index: 1; }

/* Stumm/Ton-Umschalter – Video startet ohne Ton (sec.muted in config.js) */
.yt__sound {
  position: absolute;
  right: clamp(14px, 2vw, 28px);
  top: clamp(14px, 2vw, 28px);
  z-index: 3;
  width: clamp(44px, 5vw, 60px);
  height: clamp(44px, 5vw, 60px);
  border-radius: 50%;
  background: rgba(1, 19, 67, 0.72);
  color: var(--white);
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.15s;
}
.yt__sound svg { width: 52%; height: 52%; }
.yt__sound:hover { background: rgba(1, 19, 67, 0.9); transform: scale(1.05); }
.yt__sound:active { transform: scale(0.94); }

/* Eigene Vor-/Zurück-Steuerung + Fortschrittsbalken – ersetzt YouTubes eigene
   (absichtlich nicht klickbare, siehe .yt iframe) Steuerleiste. Nur sichtbar,
   solange das Vorschaubild ausgeblendet ist (Video läuft wirklich sichtbar). */
.yt__controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 20px);
  padding: clamp(12px, 2vh, 22px) clamp(16px, 3vw, 34px);
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.yt__controls.is-visible { opacity: 1; pointer-events: auto; }
.yt__skip {
  flex: 0 0 auto;
  width: clamp(40px, 4.5vw, 54px);
  height: clamp(40px, 4.5vw, 54px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.15s;
}
.yt__skip svg { width: 44%; height: 44%; }
.yt__skip:hover { background: rgba(255, 255, 255, 0.3); }
.yt__skip:active { transform: scale(0.92); }
.yt__seekbar {
  flex: 1 1 auto;
  height: clamp(28px, 3.5vh, 40px);
  display: flex;
  align-items: center;
  cursor: pointer;
}
.yt__seekbar-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  overflow: hidden;
}
.yt__seekbar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--gold);
  border-radius: 3px;
}

/* =============================================================================
   FLIPBOOK
   ============================================================================= */
.flip {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vh, 26px);
  background:
    radial-gradient(120% 90% at 50% 0%, #0c477e 0%, var(--navy-dark) 70%);
}
.flip__stage {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.flip__book { touch-action: pan-y; }
.flip__book .page {
  background: var(--white);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}
.flip__book .page img { width: 100%; height: 100%; display: block; }

.flip__controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 30px);
  margin-top: clamp(8px, 1.6vh, 20px);
  color: var(--white);
}
.flip__nav {
  width: clamp(52px, 6vw, 74px);
  height: clamp(52px, 6vw, 74px);
  border-radius: 0;
  background: rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.15s;
}
.flip__nav svg { width: 44%; height: 44%; }
.flip__nav:hover { background: var(--gold); color: var(--navy); }
.flip__nav:active { transform: scale(0.94); }
.flip__nav[disabled] { opacity: 0.3; pointer-events: none; }
.flip__counter {
  font-weight: 800;
  font-size: clamp(14px, 1.6vw, 20px);
  min-width: 90px;
  text-align: center;
  letter-spacing: 0.03em;
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--white);
  gap: 18px;
  background: var(--navy-dark);
}
.loader.is-hidden { display: none; }
.loader__ring {
  width: 56px; height: 56px;
  border: 5px solid rgba(255,255,255,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loader__text { font-weight: 700; letter-spacing: 0.04em; font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.flip__error {
  color: rgba(255,255,255,0.85);
  text-align: center;
  padding: 6vh 10vw;
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.6;
}
.flip__error strong { color: var(--gold); display: block; margin-bottom: 8px; font-size: 1.15em; }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 1024px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .nav__btn { padding: 0 clamp(7px, 1vw, 12px); font-size: clamp(12px, 1.15vw, 16px); }
}
@media (max-width: 640px), (orientation: portrait) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .servicebar { display: none; }
}
@media (max-height: 560px) {
  .home { padding-top: 12px; padding-bottom: 8px; }
  .tile { min-height: 110px; }
}

/* Kein Fokus-Ring bei Touch, aber sichtbar bei Tastatur */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
