/* Shuruq — the site follows the sky, like the app.
   Colours are the app's own sky stops (Shared/Sky.swift). No third-party fonts: New York on Apple
   devices via ui-serif, Georgia elsewhere; Amiri Quran is served from this site. */

@font-face {
  font-family: "Amiri Quran";
  src: url("/assets/AmiriQuran-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --arabic: "Amiri Quran", "Geeza Pro", "Noto Naskh Arabic", serif;

  /* Sky tokens, rewritten live by sky.js; these are dawn, the page's first light. */
  --sky-0: #1b2147;
  --sky-1: #3f3f74;
  --sky-2: #8e6e91;
  --sky-3: #e9bfa2;
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.8);
  --stars: 0.45;
  --orb: #ffd2a6;

  --paper: #fbf4ee;
  --paper-ink: #1b2147;
  --paper-soft: #5a5870;
  --gold: #f2d595;
  --gold-deep: #8a5a1c;
  --emerald: #1a6b58;

  --gutter: clamp(16px, 5vw, 56px);
  --measure: 34rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--sky-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 12px; z-index: 10; background: var(--paper); color: var(--paper-ink); padding: 8px 14px; border-radius: 999px; }

/* ---------- The sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 45%, var(--sky-2) 82%, var(--sky-3) 100%);
  transition: background 0.2s linear;
}
.sky__stars {
  position: absolute;
  inset: 0 0 45% 0;
  opacity: var(--stars);
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 41% 26%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 71% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 16%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 93% 38%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 34% 44%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 48%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 50% 4%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 79% 6%, #fff 50%, transparent 51%);
}
.sky__arc {
  position: absolute;
  left: 50%;
  top: 7vh;
  width: min(1100px, 94vw);
  height: auto;
  transform: translateX(-50%);
  overflow: visible;
}
.sky__arc path {
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.32;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 0.5 12;
  vector-effect: non-scaling-stroke;
}
.sky__sun { fill: var(--orb); filter: drop-shadow(0 0 18px var(--orb)) drop-shadow(0 0 42px var(--orb)); }
.sky__moon-lit { fill: var(--orb); }
.sky__moon { opacity: 0; transition: opacity 0.6s ease; filter: drop-shadow(0 0 14px rgba(244, 235, 208, 0.55)); }
.sky__sun-g { transition: opacity 0.6s ease; }
.is-night .sky__moon { opacity: 1; }
.is-night .sky__sun-g { opacity: 0; }

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.bar nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.bar nav a {
  text-decoration: none;
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.bar nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, transparent); }

/* ---------- Home: one prayer day in one scroll ---------- */

.phase {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 12vh var(--gutter);
  max-width: 1200px;
  margin: 0 auto;
}
.phase__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(28px, 6vw, 96px);
  align-items: center;
}
.phase:nth-of-type(odd) .phase__phone { order: -1; }

.kicker {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.kicker [lang="ar"] {
  font-family: var(--arabic);
  font-size: 1.5rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.phase h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.2rem, 5.4vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 22px;
  text-wrap: balance;
}
.phase p {
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 14px;
  text-wrap: pretty;
}
.phase ul {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: grid;
  gap: 10px;
  max-width: var(--measure);
}
.phase li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  font-size: 1rem;
  color: var(--ink-soft);
}
.phase li::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 0.55em;
  background: var(--gold);
  clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%);
}

/* The hero: the name, at sunrise. */
.hero { text-align: left; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(4.2rem, 13vw, 9.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin: 0;
}
.hero__meaning {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 18px 0 26px;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--ink-soft);
}
.hero__meaning [lang="ar"] { font-family: var(--arabic); font-size: 1.9em; color: var(--ink); line-height: 1; }
.hero__lede {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  line-height: 1.4;
  max-width: 30rem;
  margin: 0 0 34px;
  text-wrap: balance;
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: var(--gold);
  color: #0a3a2f;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  min-height: 52px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.store:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28); }
.store svg { width: 22px; height: 22px; }
.store small { display: block; font-weight: 500; font-size: 0.74rem; opacity: 0.75; letter-spacing: 0.02em; }
.store--soon { cursor: default; }
.note { font-size: 0.86rem; color: var(--ink-soft); margin-top: 14px; }

/* The phone */
.phone {
  position: relative;
  width: min(330px, 78vw);
  margin: 0 auto;
  border-radius: 48px;
  padding: 11px;
  background: #0b0d14;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.16),
    0 40px 80px -20px rgba(0, 0, 0, 0.55),
    0 18px 36px -18px rgba(0, 0, 0, 0.45);
}
.phone img { border-radius: 38px; width: 100%; height: auto; aspect-ratio: 1206 / 2622; object-fit: cover; }
.phone__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.phone__pair .phone { width: 100%; border-radius: 36px; padding: 8px; }
.phone__pair .phone img { border-radius: 29px; }
.phone__pair .phone:last-child { margin-top: 64px; }

/* Night: the promise and the links. */
.night { text-align: center; }
.night h2 { margin-inline: auto; max-width: 16ch; }
.night p { margin-inline: auto; }
.phase .promise { /* .phase-scoped so it beats the generic .phase ul rule and stays centered */
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 30px auto 38px;
  padding: 0;
}
.phase .promise li {
  display: block;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  font-size: 0.95rem;
  color: var(--ink);
}
.phase .promise li::before { display: none; }

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px var(--gutter) 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot a { color: var(--ink-soft); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.foot a:hover { color: var(--ink); text-decoration: underline; }

/* Entrance: each phase's words rise a little as they come into view. */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }
.no-js .reveal { opacity: 1; transform: none; }

@media (max-width: 820px) {
  /* On a phone the words scroll across the arc, so it steps back. */
  .sky__arc path { stroke-opacity: 0.18; }
  .phase { padding: 14vh var(--gutter) 10vh; min-height: auto; }
  .phase__grid { grid-template-columns: 1fr; gap: 44px; }
  .phase:nth-of-type(odd) .phase__phone { order: 0; }
  .hero { padding-top: 18vh; }
  .bar nav a:not(.bar__keep) { display: none; }
  .phone__pair .phone:last-child { margin-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .sky, .sky__moon, .sky__sun-g, .store { transition: none; }
}

/* ---------- Document pages (privacy, terms, support, app) ---------- */

.doc-page { background: var(--paper); color: var(--paper-ink); }
.doc-head {
  background: linear-gradient(180deg, #1b2147 0%, #3f3f74 50%, #8e6e91 88%, #e9bfa2 100%);
  color: #fff;
  padding-bottom: clamp(56px, 10vw, 110px);
  position: relative;
}
.doc-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 32px;
  background: var(--paper);
  border-radius: 32px 32px 0 0;
}
.doc-head .bar { --ink: #fff; --ink-soft: rgba(255, 255, 255, 0.82); color: #fff; }
.doc-title {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) var(--gutter) 0;
}
.doc-title h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}
.doc-title p { margin: 0; color: rgba(255, 255, 255, 0.82); }
.doc {
  max-width: 46rem;
  margin: 0 auto;
  padding: 8px var(--gutter) 72px;
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.7;
}
.doc h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 2.2em 0 0.4em;
  letter-spacing: -0.005em;
}
.doc h2:first-child { margin-top: 0.6em; }
.doc p { margin: 0 0 1em; color: #2b2f45; }
.doc a { color: var(--emerald); text-underline-offset: 3px; }
.doc strong { font-weight: 600; }
.doc .draft {
  font-family: var(--sans);
  font-size: 0.95rem;
  background: #f4e7cf;
  border-left: 3px solid var(--gold-deep);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  color: #4a3a16;
}
.doc-page .foot { color: var(--paper-soft); border-top: 1px solid rgba(27, 33, 71, 0.1); }
.doc-page .foot a { color: var(--paper-soft); }
.doc-page .foot a:hover { color: var(--paper-ink); }

/* ---------- A shared verse ---------- */

.verse-page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.verse {
  flex: 1;
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(40px, 10vh, 120px) var(--gutter) 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.verse__ref {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 30px;
}
.verse__ar {
  font-family: var(--arabic);
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 2;
  margin: 0;
  color: var(--ink);
}
.verse__star {
  width: 18px;
  height: 18px;
  margin: 28px auto;
  background: var(--gold);
  clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%);
}
.verse__en {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.5;
  margin: 0 0 12px;
  text-wrap: balance;
}
.verse__credit { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 34px; }
.verse details {
  margin-top: 40px;
  text-align: left;
  font-size: 0.85rem;
  color: var(--ink-soft);
  max-width: 36rem;
}
.verse summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.verse details h2 { font-size: 0.95rem; margin: 1.2em 0 0.3em; color: var(--ink); }
.verse pre { white-space: pre-wrap; font-family: var(--sans); font-size: 0.8rem; }
.verse [role="status"]:empty { display: none; }

.night__cta { margin-top: 30px; }
.app-icon { border-radius: 29px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); margin-bottom: 30px; }
.app-title { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 600; }
.verse-page .bar { width: 100%; }
