/* Scroll the Quran: With Meaning — scrollthequran.app
   Colours match the app (mobile/src/constants/theme.ts). No external requests. */

@font-face {
  font-family: 'UthmanicHafs';
  src: url('/assets/fonts/UthmanicHafs1Ver18.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #F5F0E6;
  --surface: #EDE7D9;
  --raised: #E4DCCB;
  --border: #D6CCB8;
  --text: #1E3D34;
  --muted: #5B7768;
  --gold: #A8803F;
  --gold-soft: rgba(168, 128, 63, 0.16);
  --forest: #0F4D3A;
  --on-forest: #F4EFE3;
  --shadow: 0 30px 60px -30px rgba(30, 61, 52, 0.45);

  /* Phone mockup screen: the app's light theme */
  --p-bg: #F5F0E6;
  --p-text: #1E3D34;
  --p-muted: #5B7768;
  --p-gold: #A8803F;
  --p-chip: rgba(30, 61, 52, 0.07);
  --p-track: rgba(30, 61, 52, 0.12);
  --p-gold-line: rgba(168, 128, 63, 0.4);
  --p-sweep: rgba(255, 255, 255, 0.75);

  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --wrap: 1120px;
  --radius: 20px;
  color-scheme: light;
}

/* Dark: follows the device unless the header switch picked a theme (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1411;
    --surface: #16201B;
    --raised: #1E2A24;
    --border: #2A3832;
    --text: #F4EFE3;
    --muted: #A9B3AC;
    --gold: #C9A45C;
    --gold-soft: rgba(201, 164, 92, 0.18);
    --forest: #13543F;
    --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
    --p-bg: #0D1411;
    --p-text: #F4EFE3;
    --p-muted: #A9B3AC;
    --p-gold: #C9A45C;
    --p-chip: rgba(244, 239, 227, 0.08);
    --p-track: rgba(244, 239, 227, 0.12);
    --p-gold-line: rgba(201, 164, 92, 0.35);
    --p-sweep: rgba(255, 231, 176, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1411;
  --surface: #16201B;
  --raised: #1E2A24;
  --border: #2A3832;
  --text: #F4EFE3;
  --muted: #A9B3AC;
  --gold: #C9A45C;
  --gold-soft: rgba(201, 164, 92, 0.18);
  --forest: #13543F;
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
  --p-bg: #0D1411;
  --p-text: #F4EFE3;
  --p-muted: #A9B3AC;
  --p-gold: #C9A45C;
  --p-chip: rgba(244, 239, 227, 0.08);
  --p-track: rgba(244, 239, 227, 0.12);
  --p-gold-line: rgba(201, 164, 92, 0.35);
  --p-sweep: rgba(255, 231, 176, 0.45);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--gold); }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
h3 { font-size: 1.3rem; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.muted { color: var(--muted); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.brand:hover { color: inherit; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.site-nav { display: flex; gap: 22px; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); }
@media (max-width: 640px) { .site-nav .optional { display: none; } .site-nav { gap: 16px; } }
.site-nav { align-items: center; }

/* Light/dark switch (assets/theme.js) */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: -6px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Show the sun in dark (switch to light), the moon in light (switch to dark). */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* Hero */
.hero { padding: 72px 0 96px; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; }
.hero h1 { margin: 18px 0 22px; }
.hero h1 em { font-style: italic; color: var(--gold); }
.store-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 11px 16px;
  border-radius: 14px;
  background: var(--forest);
  color: var(--on-forest);
  text-decoration: none;
  line-height: 1.2;
}
.store svg { width: 24px; height: 24px; flex: none; }
.store small { display: block; font-size: 0.72rem; opacity: 0.75; }
.store strong { font-size: 1.02rem; font-weight: 600; }
.launch-note { margin-top: 16px; font-size: 0.92rem; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
}

@media (max-width: 880px) {
  .hero { padding: 40px 0 72px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 48px; }
  .hero .copy { text-align: center; }
  .hero .lead { margin: 0 auto; }
  .hero .pills, .store-row { justify-content: center; }
}

/* Phone mockup: a still of the app's feed, cycling through the first ayahs */
.phone-stage { position: relative; display: flex; justify-content: center; }
.phone-stage::before {
  content: '';
  position: absolute;
  inset: 8% -10% 2%;
  background: radial-gradient(closest-side, var(--gold-soft), transparent 75%);
  z-index: 0;
}
.phone {
  position: relative;
  z-index: 1;
  width: min(320px, 82vw);
  aspect-ratio: 9 / 19.5;
  border-radius: 46px;
  padding: 11px;
  background: #1b221f;
  box-shadow: var(--shadow), inset 0 0 0 1.5px #39443f;
}
.screen {
  position: relative;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: var(--p-bg);
  color: var(--p-text);
}
.screen::before {
  /* dynamic island */
  content: '';
  position: absolute;
  top: 11px;
  left: 50%;
  width: 92px;
  height: 26px;
  margin-left: -46px;
  border-radius: 20px;
  background: #000;
  z-index: 3;
}
.feed { height: 100%; animation: feed 12s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.slide {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 64px 52px 64px 26px;
  text-align: center;
}
.slide .ar {
  font-family: 'UthmanicHafs', serif;
  font-size: 30px;
  line-height: 1.9;
  direction: rtl;
}
.slide .tr { font-size: 14.5px; line-height: 1.55; color: var(--p-text); opacity: 0.92; }
.slide .tr sup { font-size: 0.62em; color: var(--p-gold); margin-left: 1px; }
.tafheem-hint {
  position: relative;
  overflow: hidden;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--p-gold);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--p-gold-line);
}
.tafheem-hint::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--p-sweep) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: nur 3.2s ease-in-out infinite 1s;
}
.counter {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--p-muted);
  z-index: 2;
}
.counter b { color: var(--p-text); font-weight: 600; }
.rail {
  position: absolute;
  right: 12px;
  bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 2;
}
.rail span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--p-chip);
}
.rail svg { width: 17px; height: 17px; stroke: var(--p-text); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.khatm {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 30px;
  font-size: 10.5px;
  color: var(--p-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}
.khatm i { flex: 1; height: 3px; border-radius: 3px; background: var(--p-track); position: relative; overflow: hidden; }
.khatm i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 18%; background: var(--p-gold); border-radius: 3px; }

/* The phone's speaker plays the recitation (listen.js), with a soft gold pulse until it's tried. */
.phone-stage { flex-direction: column; align-items: center; }
/* Stacked like this, the phone would grow to fit all its slides; keep it phone-shaped. */
.phone-stage .phone { min-height: 0; }
.rail .listen {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--p-chip);
  cursor: pointer;
}
.rail .listen::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--p-gold);
  opacity: 0;
  animation: listen-pulse 2.4s ease-out infinite 1.5s;
}
.rail .listen.heard::after { animation: none; }
.rail .listen.on { background: var(--p-gold); }
.rail .listen.on svg { stroke: var(--p-bg); }
.rail .listen:focus-visible { outline: 2px solid var(--p-gold); outline-offset: 3px; }
.listen-hint { position: relative; z-index: 1; margin-top: 16px; font-size: 13px; color: var(--muted); }
/* While listening the loop stops and the phone moves with the recitation instead. */
.feed.listening { animation: none; transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1); }

/* First visit: the Bismillah fades in over the page, like the app's first open. */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.intro[hidden] { display: none; }
.intro.in { opacity: 1; }
.intro-inner { display: grid; justify-items: center; gap: 28px; padding: 24px; text-align: center; }
.intro-ar {
  font-family: 'UthmanicHafs', serif;
  font-size: clamp(34px, 8vw, 58px);
  line-height: 1.9;
  color: var(--text);
  direction: rtl;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 0.2s, transform 1s ease 0.2s;
}
.intro.in .intro-ar { opacity: 1; transform: none; }
.intro-listen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font: 600 15px var(--sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.6s ease 1.1s;
}
.intro.in .intro-listen { opacity: 1; }
.intro-listen svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@keyframes listen-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.45); opacity: 0; }
}
@keyframes feed {
  0%, 26% { transform: translateY(0); }
  33%, 59% { transform: translateY(-100%); }
  66%, 92% { transform: translateY(-200%); }
  100% { transform: translateY(-300%); }
}
@keyframes nur {
  0% { transform: translateX(-120%); }
  55%, 100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .feed, .tafheem-hint::after, .rail .listen::after { animation: none; }
  .feed.listening, .intro, .intro-ar, .intro-listen { transition: none; }
}

/* Sections */
section { padding: 96px 0; }
@media (max-width: 600px) { section { padding: 72px 0; } }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { margin: 12px 0 16px; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.band { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { padding: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.band .step { background: var(--bg); }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tool { padding: 30px 28px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.tool .tag { display: inline-block; margin-bottom: 14px; }
.tool h3 { margin-bottom: 10px; }
.tool p { color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.feature { background: var(--bg); padding: 28px; }
.feature svg { width: 26px; height: 26px; stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 14px; }
.feature h3 { font-family: var(--sans); font-size: 1.05rem; font-weight: 650; margin-bottom: 6px; letter-spacing: 0; }
.feature p { color: var(--muted); font-size: 0.97rem; }

@media (max-width: 880px) {
  .steps, .tools { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

.sources { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 56px; align-items: start; }
.sources dl { margin: 0; border-top: 1px solid var(--border); }
.sources dl div { display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.sources dt { font-weight: 600; }
.sources dd { margin: 0; color: var(--muted); }
.promise { margin-top: 28px; display: grid; gap: 12px; padding: 0; list-style: none; }
.promise li { display: flex; gap: 12px; align-items: baseline; }
.promise li::before { content: '✦'; color: var(--gold); font-size: 0.85em; }
@media (max-width: 880px) {
  .sources { grid-template-columns: 1fr; gap: 36px; }
  .sources dl div { grid-template-columns: 1fr; gap: 2px; }
}

.free-card {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
  padding: 56px;
  border-radius: 28px;
  background: var(--forest);
  color: var(--on-forest);
}
.free-card .eyebrow { color: #E2C58A; }
.free-card h2 { margin: 12px 0 16px; }
.free-card p { opacity: 0.85; }
.price-tile { text-align: center; padding: 30px; border-radius: 22px; background: rgba(244, 239, 227, 0.08); border: 1px solid rgba(244, 239, 227, 0.16); }
.price-tile .big { font-family: var(--serif); font-size: 4.2rem; line-height: 1; font-weight: 600; }
.price-tile p { margin-top: 12px; font-size: 0.95rem; }
.price-tile .heart { width: 30px; height: 30px; fill: #E2C58A; margin: 0 auto 12px; }
@media (max-width: 880px) { .free-card { grid-template-columns: 1fr; padding: 36px 24px; text-align: center; } }

/* Long-form pages (privacy, support) */
.page { padding: 64px 0 96px; }
.page .wrap { max-width: 760px; }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin: 12px 0 16px; }
.page .updated { color: var(--muted); font-size: 0.95rem; }
.prose { margin-top: 40px; }
.prose h2 { font-size: 1.55rem; margin: 48px 0 14px; }
.prose h3 { font-size: 1.15rem; margin: 28px 0 8px; }
.prose p, .prose ul { margin: 0 0 14px; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--gold); }
.summary-box { margin-top: 36px; padding: 26px 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.summary-box h2 { font-size: 1.2rem; margin: 0 0 12px; font-family: var(--sans); font-weight: 650; }
.summary-box ul { margin: 0; padding-left: 1.2em; }
.summary-box li { margin-bottom: 4px; }
.summary-box li::marker { color: var(--gold); }

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 36px;
  padding: 26px 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.contact-card p { color: var(--muted); }
.contact-card strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 2px; }
.button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--forest);
  color: var(--on-forest);
  text-decoration: none;
  font-weight: 600;
}
.button:hover { color: var(--on-forest); filter: brightness(1.12); }

.faq { margin-top: 12px; border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font-weight: 600;
  font-size: 1.04rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--gold); font-size: 1.4rem; line-height: 1; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 0 20px; color: var(--muted); }
.faq .answer p + p { margin-top: 10px; }
.faq .answer strong { color: var(--text); font-weight: 600; }

/* Footer */
.site-footer { padding: 40px 0 48px; border-top: 1px solid var(--border); font-size: 0.93rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 22px; }
.site-footer a { text-decoration: none; }
