/* Sky colors are copied from the app (AdhanApp/Views/Home/TimeOfDayBackground.swift) */
:root {
  --font: "Rubik", system-ui, sans-serif;
  --fg: #ffffff;
  --fg-2: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.14);
  --glass-strong: rgba(255, 255, 255, 0.26);
  --glass-border: rgba(255, 255, 255, 0.28);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bar-fg: #ffffff;
  --bar-bg: rgba(12, 16, 34, 0.6);
  --bar-border: rgba(255, 255, 255, 0.12);
  color-scheme: dark;
}
body[data-tone="light"] {
  --fg: #0b1220;
  --fg-2: rgba(11, 18, 32, 0.66);
  --glass: rgba(255, 255, 255, 0.32);
  --glass-strong: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.6);
  --bar-fg: #0b1220;
  --bar-bg: rgba(255, 255, 255, 0.62);
  --bar-border: rgba(255, 255, 255, 0.7);
}

* { box-sizing: border-box; }
/* Safari 26 tints the area under its floating toolbar with the html background,
   so app.js keeps it matched to the bottom color of the current sky */
html { -webkit-text-size-adjust: 100%; background-color: #1a2980; transition: background-color 1.4s var(--ease); scroll-behavior: smooth; }
html:has(body.page-night) { background-color: rgb(15 13 41); }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
  overflow-x: hidden;
  transition: color 0.9s var(--ease);
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }

/* ---------- Sky ---------- */
/* Safari 26 colors its status bar from a full-width fixed element at the top edge (6px or taller).
   This strip carries the top color of the current sky (set by app.js), so the status bar matches it. */
.edge-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  z-index: 60;
  pointer-events: none;
  background-color: var(--sky-top, rgb(13 28 74));
  transition: background-color 1.4s var(--ease);
}
/* 100lvh so the sky also reaches under the browser toolbar */
.sky { position: fixed; top: 0; left: 0; right: 0; height: max(100%, 100lvh); z-index: -1; overflow: hidden; }
.sky-phase {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
.sky-phase.on { opacity: 1; }
.sky-phase[data-phase="preFajr"]    { background: linear-gradient(180deg, rgb(13 28 74), rgb(26 41 128)); }
.sky-phase[data-phase="dawn"]       { background: linear-gradient(180deg, rgb(107 64 161), rgb(232 99 122)); }
.sky-phase[data-phase="morning"]    { background: linear-gradient(180deg, rgb(87 204 242), rgb(168 230 207)); }
.sky-phase[data-phase="midday"]     { background: linear-gradient(180deg, rgb(33 150 242), rgb(99 181 245)); }
.sky-phase[data-phase="goldenHour"] { background: linear-gradient(180deg, rgb(247 150 31), rgb(255 209 0)); }
.sky-phase[data-phase="sunset"]     { background: linear-gradient(180deg, rgb(227 77 38), rgb(92 38 140)); }
.sky-phase[data-phase="night"]      { background: linear-gradient(180deg, rgb(15 13 41), rgb(10 10 26)); }

/* Moon (dark phases) and sun (light phases) */
.orb { position: absolute; top: 15%; inset-inline-end: 13%; width: clamp(80px, 11vw, 150px); aspect-ratio: 1; border-radius: 50%; opacity: 0; transition: opacity 1.4s var(--ease), transform 1.4s var(--ease); transform: translateY(20px); }
.orb.on { opacity: 1; transform: none; }
.moon { box-shadow: inset calc(clamp(80px, 11vw, 150px) * -0.22) calc(clamp(80px, 11vw, 150px) * 0.1) 0 0 #fbf3d5; filter: drop-shadow(0 0 30px rgba(251, 243, 213, 0.35)); transform: rotate(-20deg) translateY(20px); }
.moon.on { transform: rotate(-20deg); }
[dir="rtl"] .moon { scale: -1 1; }
.sun { background: radial-gradient(circle, #fffdf2 0 38%, rgba(255, 244, 200, 0.9) 42%, rgba(255, 230, 150, 0.35) 55%, rgba(255, 230, 150, 0) 70%); width: clamp(180px, 22vw, 320px); top: 6%; inset-inline-end: 7%; }

.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s var(--ease); }
.stars i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--d, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ---------- Top bar: a floating glass capsule with its own fixed look ---------- */
.topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(1160px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 8px;
  padding-inline: 10px 14px;
  border-radius: 999px;
  color: var(--bar-fg);
  background: var(--bar-bg);
  border: 1px solid var(--bar-border);
  transition: background 0.9s var(--ease), color 0.9s var(--ease), border-color 0.9s var(--ease);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; text-decoration: none; letter-spacing: -0.01em; color: inherit; }
.brand img { width: 34px; height: 34px; border-radius: 22.5%; }
.topbar-end { display: flex; align-items: center; gap: 8px; }

/* Language switcher: a native <select> laid invisibly over a small pill, so phones get their own picker */
.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.lang:hover { background: rgba(127, 127, 127, 0.28); }
.lang:focus-within { outline: 2px solid currentColor; outline-offset: 2px; }
.lang svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.badge { display: inline-block; line-height: 0; transition: transform 0.2s var(--ease); }
.badge:hover { transform: translateY(-1px); }
.badge img { height: 40px; width: auto; }
.topbar .badge img { height: 34px; }
.badge-lg img { height: 60px; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 96px 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
.hero > * { opacity: 0; transform: translateY(12px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.ready .hero > * { opacity: 1; transform: none; }
.ready .hero > :nth-child(2) { transition-delay: 0.08s; }
.ready .hero > :nth-child(3) { transition-delay: 0.16s; }
.ready .hero > :nth-child(4) { transition-delay: 0.24s; }
.ready .hero > :nth-child(5) { transition-delay: 0.32s; }

.hero-place { margin: 0 0 8px; font-size: clamp(17px, 2vw, 22px); font-weight: 600; color: var(--fg-2); }
.hero-place .dot { margin: 0 10px; opacity: 0.6; }
.countdown {
  margin: 0;
  font-size: clamp(76px, 17vw, 236px);
  line-height: 0.9;
  font-weight: 600;
  white-space: nowrap;
}
.countdown [data-bind="countdown"] { display: inline-flex; align-items: baseline; gap: 0.16em; }
.countdown .seg { display: inline-flex; align-items: baseline; }
/* Natural digit widths so "1" doesn't leave gaps. The line is left-aligned, so a changing digit only moves what follows it. */
.countdown .n { letter-spacing: -0.03em; margin-inline-end: 0.03em; font-variant-numeric: lining-nums proportional-nums; }
.countdown .u { font-size: 0.4em; font-weight: 500; margin-inline-start: 0.02em; opacity: 0.6; }
.hero-till { margin: 14px 0 0; font-size: clamp(24px, 3.2vw, 40px); font-weight: 500; letter-spacing: -0.01em; color: var(--fg-2); }
.hero-till span { font-weight: 500; }
.hero-till span { color: var(--fg); }

.strip {
  list-style: none;
  margin: 48px 0 0;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  max-width: 880px;
}
.strip li { padding: 14px 16px; border-radius: 20px; transition: background 0.4s; }
.strip li span { display: block; font-size: 14px; color: var(--fg-2); }
.strip li b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.strip li.next { background: var(--glass-strong); }
.strip li.next span { color: var(--fg); font-weight: 600; }
.strip li.past { opacity: 0.55; }

.hero-note { margin: 28px 0 0; font-size: 16px; color: var(--fg-2); max-width: 60ch; }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- The day ---------- */
.day {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr minmax(0, 420px);
  gap: 40px;
}
.chapter {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 12vh;
}
/* The first section follows the hero closely */
#tahajjud { min-height: 80vh; padding-top: 0; }
.chapter h2, .finale h2 {
  margin: 0;
  font-size: clamp(46px, 7vw, 96px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.body { margin: 24px 0 0; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; color: var(--fg-2); max-width: 30em; }
.body b { color: var(--fg); }

.chapter > * { opacity: 0.15; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.chapter.in > * { opacity: 1; transform: none; }
.chapter.in > :nth-child(2) { transition-delay: 0.06s; }
.chapter.in > :nth-child(3) { transition-delay: 0.12s; }
.chapter.in > :nth-child(4) { transition-delay: 0.18s; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
}
.stage > * {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.stage > .on { opacity: 1; }
.stage > img {
  height: min(80vh, 760px);
  width: auto;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.35));
}
.inline-shot, .inline-widgets { display: none; }

/* Adhan players */
.players { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.preview-note { margin: 12px 0 0; font-size: 14px; color: var(--fg-2); }
.player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 10px;
  padding-inline: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  text-align: start;
  transition: background 0.3s, transform 0.2s var(--ease);
}
.player:hover { background: var(--glass-strong); }
.player:active { transform: scale(0.97); }
.player b { display: block; font-size: 15px; }
.player small { display: block; font-size: 12px; color: var(--fg-2); }
.pi {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: #fff;
}
.pi::before { /* play triangle */
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #5b2a86;
}
.player.playing .pi::before { /* pause bars */
  left: 13px;
  top: 12px;
  width: 4px;
  height: 16px;
  border: 0;
  background: #5b2a86;
  box-shadow: 9px 0 0 #5b2a86;
}
.pi svg { position: absolute; inset: -3px; width: 46px; height: 46px; transform: rotate(-90deg); }
.pi circle { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }

/* Widgets chapter: Lock Screen in a real iPhone frame + floating Home Screen widget.
   Recreated from the app's actual widgets; filled with the visitor's live times. */
.widgets, .inline-widgets { position: relative; }
.lock {
  position: relative;
  container-type: inline-size;
  height: min(80vh, 760px);
  aspect-ratio: 1350 / 2760;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.35));
}
.lock-screen {
  position: absolute;
  left: 5.33%;
  top: 2.5%;
  width: 89.33%;
  height: 95%;
  border-radius: 13cqw;
  overflow: hidden;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 40%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 46% 12%, #fff, transparent),
    radial-gradient(1px 1px at 66% 33%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 84% 22%, #fff, transparent),
    radial-gradient(1px 1px at 18% 62%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 74% 58%, #fff, transparent),
    radial-gradient(1px 1px at 38% 78%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 90% 80%, #fff, transparent),
    radial-gradient(1px 1px at 56% 90%, #fff, transparent),
    radial-gradient(1px 1px at 8% 88%, #fff, transparent),
    linear-gradient(180deg, #14162e 0%, #1d2242 60%, #2b3657 100%);
}
.ls-date { margin-top: 18cqw; font-size: 6.4cqw; font-weight: 600; letter-spacing: -0.01em; }
.ls-time {
  font-size: 27cqw;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: rgba(214, 210, 245, 0.88);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 30px rgba(180, 170, 255, 0.25);
}
.ls-widget { width: 48%; margin-block-start: 5cqw; margin-inline-start: 9%; text-align: start; font-size: 4.4cqw; font-weight: 500; line-height: 1.55; }
.ls-widget div, .hw-rows div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.lock-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.home-widget {
  position: absolute;
  inset-inline-start: -24%;
  bottom: 12%;
  width: 320px;
  padding: 22px 26px 24px;
  border-radius: 30px;
  background: rgba(40, 40, 44, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hw-city { font-size: 15px; color: rgba(255, 255, 255, 0.55); margin-bottom: 6px; }
.hw-rows { font-size: 20px; line-height: 1.6; }
.hw-rows .next { font-weight: 700; }

/* ---------- Finale ---------- */
.finale {
  min-height: 100vh;
  padding: 18vh 20px 12vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.arabic {
  font-family: "Noto Sans Arabic", var(--font);
  margin: 8px 0 0;
  font-size: clamp(56px, 9vw, 124px);
  line-height: 1.5;
  padding: 0.15em 0.2em 0;
  font-weight: 600;
  background: linear-gradient(180deg, #ffe6a8, #f6c85f 60%, #c98f2b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.arabic + h2 { margin-top: 48px; }
.finale .body { margin-inline: auto; }
.finale .badge { margin-top: 40px; }
.meta { margin-top: 20px; font-size: 14px; color: var(--fg-2); }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  font-size: 14px;
  color: var(--fg-2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--fg); }

/* ---------- Long-form pages (privacy, support) ---------- */
.page-night { background: linear-gradient(180deg, rgb(13 28 74), rgb(15 13 41) 70%); background-attachment: fixed; min-height: 100vh; }
.page-night .doc { padding-top: 96px; }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.doc h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin: 24px 0 16px; }
.doc h2 { font-size: 22px; margin-top: 40px; letter-spacing: -0.01em; }
.doc p, .doc li { color: var(--fg-2); font-size: 17px; }
.doc strong { color: var(--fg); }
.doc a { color: #f6c85f; }
.doc .updated { font-size: 14px; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .day { grid-template-columns: 1fr; }
  .stage { display: none; }
  .chapter { min-height: auto; padding-block: 18vh 6vh; }
  #tahajjud { min-height: auto; padding-top: 6vh; }
  .inline-shot { display: block; width: 78%; max-width: 320px; margin: 40px auto 0; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.3)); }
  .inline-widgets { display: flex; flex-direction: column; align-items: center; margin-top: 40px; }
  .inline-widgets .lock { height: auto; width: 74%; max-width: 300px; }
  .inline-widgets .home-widget { position: relative; inset-inline-start: auto; bottom: auto; width: 88%; max-width: 340px; margin-top: -22%; }
  .strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .orb.moon { top: 16%; inset-inline-end: 18%; }
  .sun { top: 8%; inset-inline-end: -6%; }
  .hero { padding-inline: 16px; justify-content: flex-end; padding-bottom: 96px; }
  .day, .finale { padding-inline: 16px; }
  .topbar { width: calc(100% - 24px); top: max(20px, calc(env(safe-area-inset-top) + 10px)); }
  .brand { font-size: 15px; gap: 8px; }
  .topbar { padding-block: 10px; padding-inline: 12px 14px; }
  .brand img { width: 38px; height: 38px; }
  .topbar .badge img { height: 38px; }
  .lang { height: 38px; padding: 0 12px; }
  .strip li { padding: 10px 12px; }
  .strip li b { font-size: 19px; }
  .hw-rows { font-size: 18px; }
}

@media (max-width: 420px) {
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .hero > *, .chapter > * { opacity: 1; transform: none; }
}

/* ---------- Arabic ---------- */
html[lang="ar"] :is(h1, h2, .hero-till, .brand, .strip li b, .ls-date, .ls-time, .player b) { letter-spacing: 0; }
html[lang="ar"] :is(.chapter h2, .finale h2, .doc h1) { font-weight: 600; }
html[lang="ar"] :is(.chapter h2, .finale h2, .doc h1) { line-height: 1.25; }
html[lang="ar"] .body, html[lang="ar"] .doc p { line-height: 1.8; }
html[lang="ar"] .body { font-size: clamp(19px, 1.8vw, 23px); }
html[lang="ar"] .hero-note { font-size: 17px; }
