/* ==========================================================================
   Display-View – "Nachthimmel ueber der Moschee"
   Portrait 1080x1920, Chromium-Kiosk, Betrachtung aus mehreren Metern.
   ========================================================================== */

@font-face {
  font-family: 'El Messiri';
  src: url('../fonts/elmessiri-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibmplexsans-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --c-title: #B49E68;            /* wird zur Laufzeit aus Settings gesetzt */
  --c-jumma: #EBCF8F;            /* wird zur Laufzeit aus Settings gesetzt */
  --ink: #FFFFFF;
  --ink-dim: rgba(255, 255, 255, 0.6);
  --hairline: rgba(255, 255, 255, 0.12);
  --sky-top: #011F1B;
  --sky-bottom: #024D40;
  --f-display: 'El Messiri', 'Palatino', serif;
  --f-body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--sky-top);
  color: var(--ink);
  font-family: var(--f-body);
  font-variant-numeric: tabular-nums;
  cursor: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body * { cursor: none; }

::-webkit-scrollbar { display: none; }

/* --------------------------------------------------------------------------
   Hintergrund: Foto ODER default-bg.svg, Overlay nur bei Foto (unten dichter)
   -------------------------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
}
.bg-photo {
  position: absolute;
  inset: 0;
  background-image: url('../img/default-bg.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.bg-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background: linear-gradient(180deg,
    rgba(4, 8, 15, 0.58) 0%,
    rgba(4, 8, 15, 0.38) 32%,
    rgba(4, 8, 15, 0.60) 66%,
    rgba(3, 6, 12, 0.88) 100%);
}
.bg.has-photo .bg-overlay { opacity: 1; }

/* --------------------------------------------------------------------------
   Offline-Indikator (nur sichtbar, wenn letzter Fetch fehlschlug)
   -------------------------------------------------------------------------- */
.offline {
  position: fixed;
  top: clamp(10px, 1.2svh, 24px);
  right: clamp(12px, 1.6vw, 28px);
  z-index: 20;
  display: none;
  align-items: center;
  gap: 0.5em;
  opacity: 0.4;
  font-size: clamp(13px, 1.7vw, 22px);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.offline.show { display: flex; }
.offline .dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--ink);
}

/* --------------------------------------------------------------------------
   TOP: Moschee-Name, riesige Uhr, langes Datum
   -------------------------------------------------------------------------- */
.top {
  flex: none;
  text-align: center;
  padding: clamp(22px, 3.2svh, 60px) 5vw 0;
}
.mosque-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(17px, 2.9vw, 38px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.clock {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.14em;
  margin-top: clamp(2px, 0.6svh, 12px);
  font-weight: 700;
  font-size: clamp(88px, 16.4vw, 200px);
  line-height: 1.02;
  letter-spacing: -0.015em;
}
.clock-sec {
  font-size: 0.3em;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}
.date {
  margin-top: clamp(2px, 0.6svh, 12px);
  font-weight: 400;
  font-size: clamp(19px, 3.2vw, 40px);
  color: var(--ink-dim);
}
.top::after {
  content: '';
  display: block;
  width: 82%;
  height: 1px;
  margin: clamp(16px, 2.2svh, 40px) auto 0;
  background: var(--hairline);
}

/* --------------------------------------------------------------------------
   MITTE: Buehne mit Crossfade-Slides (>= 700 ms)
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.6svh, 48px) 6vw;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.slide.is-active { opacity: 1; }

/* ---- Slide: Gebetszeiten ---- */
.slide-prayer { justify-content: center; }
.slide-title {
  align-self: center;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(42px, 7.2vw, 90px);
  line-height: 1.12;
  color: var(--c-title);
}
.brush {
  display: block;
  width: 76%;
  height: auto;
  margin: clamp(-6px, -0.4svh, -2px) auto 0;
  color: var(--c-title);
}
.range {
  margin-top: clamp(2px, 0.5svh, 10px);
  text-align: center;
  font-weight: 400;
  font-size: clamp(18px, 2.9vw, 36px);
  color: var(--ink-dim);
}
.rows {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8svh, 14px);
  margin-top: clamp(14px, 2svh, 36px);
}
.row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 2vw, 26px);
  padding: clamp(4px, 0.7svh, 12px) clamp(16px, 2.6vw, 34px);
  border: 1px solid transparent;
  border-radius: clamp(10px, 1.4vw, 18px);
}
.p-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(32px, 5.3vw, 64px);
  line-height: 1.25;
}
.leader {
  flex: 1 1 auto;
  min-width: 24px;
  align-self: center;
  border-bottom: 3px dotted rgba(255, 255, 255, 0.16);
  transform: translateY(0.35em);
}
.p-time {
  font-weight: 700;
  font-size: clamp(52px, 9.2vw, 112px);
  line-height: 1.08;
  letter-spacing: 0.01em;
}

/* Jumma: feine Rahmen-Karte, Gold-Glow, minimal groesser */
.row-jumma {
  margin-top: clamp(4px, 0.7svh, 12px);
  border-color: rgba(235, 207, 143, 0.55);
  box-shadow:
    0 0 28px rgba(235, 207, 143, 0.16),
    inset 0 0 22px rgba(235, 207, 143, 0.06);
}
.row-jumma .p-name,
.row-jumma .p-time { color: var(--c-jumma); }
.row-jumma .p-name { font-size: clamp(34px, 5.7vw, 69px); }
.row-jumma .p-time { font-size: clamp(56px, 9.8vw, 120px); }
.row-jumma .leader { border-bottom-color: rgba(235, 207, 143, 0.28); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .row-jumma {
    border-color: color-mix(in srgb, var(--c-jumma) 55%, transparent);
    box-shadow:
      0 0 28px color-mix(in srgb, var(--c-jumma) 16%, transparent),
      inset 0 0 22px color-mix(in srgb, var(--c-jumma) 6%, transparent);
  }
  .row-jumma .leader { border-bottom-color: color-mix(in srgb, var(--c-jumma) 28%, transparent); }
}

/* Naechste Gebetszeile: Akzentleiste links, sanfter Schein, Marker */
.row.is-next {
  background: linear-gradient(90deg, rgba(180, 158, 104, 0.13), rgba(180, 158, 104, 0.0) 62%);
}
.row.is-next::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 14%;
  width: clamp(4px, 0.5vw, 6px);
  border-radius: 3px;
  background: var(--c-title);
  box-shadow: 0 0 16px var(--c-title);
}
.row.is-next .p-time { text-shadow: 0 0 26px rgba(180, 158, 104, 0.4); }
.row .marker {
  display: none;
  width: clamp(8px, 1vw, 12px);
  height: clamp(8px, 1vw, 12px);
  border-radius: 50%;
  align-self: center;
  background: var(--c-title);
  box-shadow: 0 0 12px var(--c-title);
}
.row.is-next .marker { display: block; }
.row-jumma.is-next { background: linear-gradient(90deg, rgba(235, 207, 143, 0.10), rgba(235, 207, 143, 0.0) 62%); }
.row-jumma.is-next::before { background: var(--c-jumma); box-shadow: 0 0 16px var(--c-jumma); }
.row-jumma.is-next .marker { background: var(--c-jumma); box-shadow: 0 0 12px var(--c-jumma); }
.row-jumma.is-next .p-time { text-shadow: 0 0 26px rgba(235, 207, 143, 0.35); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .row.is-next { background: linear-gradient(90deg, color-mix(in srgb, var(--c-title) 13%, transparent), transparent 62%); }
  .row.is-next .p-time { text-shadow: 0 0 26px color-mix(in srgb, var(--c-title) 40%, transparent); }
  .row-jumma.is-next { background: linear-gradient(90deg, color-mix(in srgb, var(--c-jumma) 10%, transparent), transparent 62%); }
  .row-jumma.is-next .p-time { text-shadow: 0 0 26px color-mix(in srgb, var(--c-jumma) 35%, transparent); }
}

/* ---- Slide: Hadith ---- */
.slide-hadith {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: clamp(10px, 1.6svh, 28px);
}
.quote-mark {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(110px, 17vw, 210px);
  line-height: 0.55;
  height: 0.42em;
  /* Luft zwischen Anfuehrungszeichen und Zitattext (zusaetzlich zum Stage-Gap) */
  margin-bottom: clamp(14px, 2.4svh, 44px);
  color: var(--c-title);
  opacity: 0.5;
}
.hadith-text {
  max-width: 88%;
  font-weight: 400;
  font-size: clamp(30px, 4.7vw, 58px);
  line-height: 1.55;
}
.hadith-text.len-m { font-size: clamp(26px, 4vw, 50px); }
.hadith-text.len-l { font-size: clamp(22px, 3.3vw, 42px); line-height: 1.5; }
.hadith-source {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(18px, 2.9vw, 36px);
  letter-spacing: 0.1em;
  color: var(--c-title);
}
.hadith-source::before { content: '— '; }

/* ---- Slide: Announcement ---- */
.slide-announcement {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: clamp(12px, 1.9svh, 34px);
}
.ann-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(40px, 6.5vw, 82px);
  line-height: 1.15;
  color: var(--c-title);
  max-width: 92%;
}
.ann-body {
  max-width: 88%;
  font-weight: 400;
  font-size: clamp(26px, 4.2vw, 52px);
  line-height: 1.5;
  white-space: pre-line;
}
.ann-image {
  max-width: 84%;
  max-height: 38svh;
  object-fit: contain;
  border-radius: clamp(12px, 1.6vw, 20px);
  border: 1px solid var(--hairline);
}

/* --------------------------------------------------------------------------
   BOTTOM: Countdown-Leiste + Fortschrittslinie
   -------------------------------------------------------------------------- */
.bottom {
  flex: none;
  text-align: center;
  padding: clamp(14px, 2svh, 34px) 6vw clamp(22px, 3svh, 52px);
  border-top: 1px solid var(--hairline);
}
.cd-label {
  font-weight: 400;
  font-size: clamp(14px, 2.1vw, 26px);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.cd-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(18px, 3.2vw, 44px);
  margin-top: clamp(2px, 0.5svh, 10px);
}
.cd-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(34px, 5.6vw, 70px);
  color: var(--c-title);
  transition: color 0.6s ease;
}
.cd-time {
  font-weight: 700;
  font-size: clamp(42px, 7.4vw, 92px);
  letter-spacing: 0.01em;
}
.cd-track {
  height: 2px;
  margin-top: clamp(10px, 1.3svh, 22px);
  border-radius: 1px;
  overflow: hidden;
  background: var(--hairline);
}
.cd-fill {
  height: 100%;
  width: 100%;
  background: var(--c-title);
  box-shadow: 0 0 10px var(--c-title);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 1s linear, background 0.6s ease;
}
.bottom.is-jumma .cd-name { color: var(--c-jumma); }
.bottom.is-jumma .cd-fill { background: var(--c-jumma); box-shadow: 0 0 10px var(--c-jumma); }

/* --------------------------------------------------------------------------
   Einmaliger Einblend-Stagger beim Boot (body.boot wird per JS entfernt)
   -------------------------------------------------------------------------- */
@keyframes boot-rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.boot [data-stagger] {
  animation: boot-rise 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
