/*
 * Check-in für Kiosk (iPad hochkant) und Handy. Farben und Schriften wie in der
 * Gebetsanzeige. Logische Eigenschaften (inline/block), damit Urdu (RTL) ohne
 * eigene Regeln spiegelt. Urdu nutzt die Nastaliq-Schrift des Systems (iOS,
 * macOS und Android bringen Noto Nastaliq Urdu mit), keine externe Anfrage.
 */

@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;
}
@font-face {
  font-family: 'El Messiri';
  src: url('fonts/elmessiri-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gruen-1: #011F1B;
  --gruen-2: #024D40;
  --gold: #B49E68;
  --gold-hell: #EBCF8F;
  --tinte: #FFFFFF;
  --tinte-2: rgba(255, 255, 255, 0.68);
  --linie: rgba(255, 255, 255, 0.16);
  --flaeche: rgba(255, 255, 255, 0.06);
  --flaeche-aktiv: rgba(235, 207, 143, 0.16);
  --fehler: #8C2F2F;
  --f-titel: 'El Messiri', 'Palatino', serif;
  --f-text: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', 'Noto Naskh Arabic', serif;
  --rand: clamp(16px, 4vw, 40px);
  --rund: clamp(16px, 2.4vw, 26px);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: linear-gradient(180deg, var(--gruen-1) 0%, var(--gruen-2) 100%) fixed;
  color: var(--tinte);
  font-family: var(--f-text);
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html[lang="ur"] body { font-family: var(--f-urdu); line-height: 1.9; }
html[lang="ur"] .gebet-name,
html[lang="ur"] .titel,
html[lang="ur"] .danke-titel { font-family: var(--f-urdu); line-height: 1.8; }
/* Nastaliq hat tiefe Unterlängen, groß gesetzt reichen sie sonst in die nächste Zeile. */
html[lang="ur"] .gebet-name { line-height: 2.3; margin-block: 0; }

button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--gold-hell); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ Kopf */

.kopf {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  padding: 14px var(--rand);
  border-block-end: 1px solid var(--linie);
}
.kopf p { margin: 0; }
.kopf-ort {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--gold);
  font-family: var(--f-titel);
  font-size: clamp(17px, 2.6vw, 26px);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[lang="ur"] .kopf-ort { font-family: var(--f-titel); }
.kopf-zeit { color: var(--tinte-2); font-size: clamp(14px, 2.1vw, 20px); white-space: nowrap; }
.uhr { color: var(--tinte); font-weight: 600; font-variant-numeric: tabular-nums; }
.sprache {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 48px;
  padding: 4px 16px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche);
  font-size: 18px;
  cursor: pointer;
}
.sprache:lang(ur) { font-family: var(--f-urdu); font-size: 18px; line-height: 1.6; }
.sprache:lang(de) { font-family: var(--f-text); }

/* ------------------------------------------------------------------ Ansichten */

.haupt {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vh, 36px) var(--rand) clamp(20px, 3vh, 40px);
}
.ansicht {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 28px);
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
}
.ansicht-hinweis { justify-content: center; text-align: center; }

.titel {
  margin: 0;
  font-family: var(--f-titel);
  font-size: clamp(30px, 6vw, 56px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--gold-hell);
  text-align: center;
}
.hinweis {
  margin: 0;
  color: var(--tinte-2);
  font-size: clamp(18px, 2.8vw, 26px);
  text-align: center;
}

/* ------------------------------------------------------------------ Gebet */

.gebet { text-align: center; }
.gebet p { margin: 0; }
.gebet-hinweis {
  color: var(--gold);
  font-size: clamp(14px, 2.2vw, 20px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
html[lang="ur"] .gebet-hinweis { letter-spacing: 0; text-transform: none; }
.gebet-name {
  margin: 4px 0 2px;
  font-family: var(--f-titel);
  font-size: clamp(44px, 10vw, 96px);
  font-weight: 600;
  line-height: 1.05;
  color: var(--gold-hell);
}
.gebet-zeit { color: var(--tinte-2); font-size: clamp(17px, 2.6vw, 24px); font-variant-numeric: tabular-nums; }
.anleitung { margin: 0; text-align: center; color: var(--tinte-2); font-size: clamp(16px, 2.3vw, 22px); }

/* ------------------------------------------------------------------ Kacheln */

.kacheln {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(clamp(132px, 20vh, 280px), 1fr);
  gap: clamp(12px, 2vw, 22px);
}
.kachel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding: 18px 12px;
  border: 2px solid var(--linie);
  border-radius: var(--rund);
  background: var(--flaeche);
  cursor: pointer;
  transition: transform 80ms ease, background-color 120ms ease, border-color 120ms ease;
}
.kachel:active { transform: scale(0.97); }
.kachel.aktiv { border-color: var(--gold-hell); background: var(--flaeche-aktiv); }
.kachel-name { font-size: clamp(26px, 5.4vw, 48px); font-weight: 600; line-height: 1.1; }
html[lang="ur"] .kachel-name { line-height: 1.7; }
.kachel-alter { color: var(--tinte-2); font-size: clamp(13px, 2vw, 19px); }
.kachel-zahl {
  position: absolute;
  inset-block-start: clamp(8px, 1.4vw, 14px);
  inset-inline-end: clamp(10px, 1.6vw, 16px);
  min-width: 1.6em;
  padding: 0 0.3em;
  border-radius: 999px;
  color: var(--tinte-2);
  font-family: var(--f-text);
  font-size: clamp(22px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.kachel.aktiv .kachel-zahl { background: var(--gold-hell); color: var(--gruen-1); }

/* ------------------------------------------------------------------ Knöpfe */

.aktionen { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(12px, 2vw, 22px); }
.knopf {
  min-height: clamp(60px, 8vh, 88px);
  padding: 10px 18px;
  border-radius: var(--rund);
  font-size: clamp(18px, 2.8vw, 26px);
  font-weight: 600;
  cursor: pointer;
}
.knopf:disabled { opacity: 0.4; cursor: default; }
.knopf-haupt { border: 0; background: var(--gold-hell); color: var(--gruen-1); }
.knopf-zweit { border: 2px solid var(--linie); background: transparent; }
.knopf-link {
  align-self: center;
  min-height: 48px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--gold-hell);
  font-size: clamp(16px, 2.4vw, 22px);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* ------------------------------------------------------------------ Auswahl (Kiosk) */

.auswahl { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2vw, 22px); }
.auswahl-knopf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: clamp(96px, 13vh, 150px);
  padding: 12px;
  border: 2px solid var(--linie);
  border-radius: var(--rund);
  background: var(--flaeche);
  cursor: pointer;
}
.auswahl-knopf:active { transform: scale(0.97); }
.auswahl-name { font-family: var(--f-titel); font-size: clamp(28px, 5vw, 46px); font-weight: 600; color: var(--gold-hell); line-height: 1.15; }
html[lang="ur"] .auswahl-name { font-family: var(--f-urdu); line-height: 1.8; }
.auswahl-zeit { color: var(--tinte-2); font-size: clamp(16px, 2.4vw, 22px); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Danke, Meldung */

.danke {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--rand);
  background: radial-gradient(circle at 50% 40%, var(--gruen-2) 0%, var(--gruen-1) 75%);
  text-align: center;
  animation: einblenden 200ms ease-out;
}
.danke p { margin: 0; }
.danke-haken { width: clamp(110px, 22vw, 190px); height: auto; color: var(--gold-hell); }
.danke-titel { font-family: var(--f-titel); font-size: clamp(44px, 9vw, 88px); font-weight: 600; color: var(--gold-hell); }
.danke-gebet { font-size: clamp(22px, 4vw, 36px); }
.danke-zahlen { color: var(--tinte-2); font-size: clamp(18px, 3vw, 28px); }

.meldung {
  position: fixed;
  inset-inline: var(--rand);
  inset-block-end: calc(env(safe-area-inset-bottom) + 20px);
  z-index: 60;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--fehler);
  font-size: clamp(16px, 2.4vw, 22px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ Handy */

@media (max-width: 560px) {
  .kopf { flex-wrap: wrap; padding-block: 10px; }
  .kopf-ort { flex: 1 1 0; }
  .kopf-zeit { order: 3; flex-basis: 100%; }
  .kacheln { grid-auto-rows: minmax(124px, 1fr); }
  .aktionen { grid-template-columns: 1fr; }
  .aktionen .knopf-haupt { order: -1; }
  .auswahl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .kachel, .auswahl-knopf, .danke { transition: none; animation: none; }
}

/* ------------------------------------------------------------------ Fuß */

.fuss { padding: 4px var(--rand) calc(10px + env(safe-area-inset-bottom)); text-align: center; }
.fuss-link {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--tinte-2);
  opacity: 0.55;
  font-size: 14px;
  text-decoration: none;
}
html[lang="ur"] .fuss-link { font-size: 15px; }
