/* Daily Miftah website.
   Colours and fonts follow the app theme (android/core/ui Theme.kt).
   Fonts are self-hosted copies of the app's fonts, under the SIL Open Font
   Licence (see fonts/OFL-*.txt). No external fonts, scripts or trackers. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/plus_jakarta_sans.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Amiri Quran";
  src: url("/fonts/amiri_quran.ttf") format("truetype");
  font-display: swap;
}

:root {
  --surface: #fdf8f2;
  --raised: #ffffff;
  --sunken: #fbeadb;
  --ink: #12292b;
  --ink-soft: #4a423a;
  --muted: #6e6358;
  --primary: #d3e6cf;
  --primary-strong: #3f6b45;
  --on-strong: #ffffff;
  --chip: #f8e4d0;
  --chip-ink: #6b4a2b;
  --gold: #8a6420;
  --gold-soft: #f0c9a0;
  --line: rgba(92, 64, 36, 0.18);
  --track: rgba(92, 64, 36, 0.1);
  --shadow: 0 24px 60px -24px rgba(18, 41, 43, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0f1e20;
    --raised: #172a2c;
    --sunken: #2a2219;
    --ink: #f3ece2;
    --ink-soft: #d5cabb;
    --muted: #b0a497;
    --primary: #34523a;
    --primary-strong: #9cc7a2;
    --on-strong: #0f1e20;
    --chip: #3a2c1e;
    --chip-ink: #f0c9a0;
    --gold: #e2b66f;
    --gold-soft: #b98a4e;
    --line: rgba(243, 236, 226, 0.16);
    --track: rgba(243, 236, 226, 0.1);
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

* { 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(--surface);
  color: var(--ink);
  font: 17px/1.65 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--primary-strong); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 68rem; padding: 0 20px; }

/* Header */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 0; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none;
}
.brand span { color: var(--gold); }
.brand svg { width: 34px; height: 34px; flex: none; }
nav a { color: var(--ink-soft); text-decoration: none; margin-inline-start: 18px; font-size: 0.95rem; font-weight: 500; }
nav a:hover { color: var(--primary-strong); text-decoration: underline; }

/* Simple hero */
.hero { padding: 48px 0 32px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
.hero p.lead, .lead { font-size: 1.2rem; color: var(--ink-soft); margin: 0 0 24px; max-width: 34rem; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: var(--ink);
  border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 0.95rem;
}
.badge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-strong);
}

/* Landing hero */
.landing-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center; gap: 32px; padding: 32px 0 64px;
}
.eyebrow {
  display: inline-block; background: var(--chip); color: var(--chip-ink);
  border-radius: 999px; padding: 5px 14px; font-size: 0.85rem; font-weight: 600; margin: 0 0 18px;
}
.landing-hero h1 {
  font-size: clamp(2.8rem, 7.4vw, 5.2rem); line-height: 1; letter-spacing: -0.035em;
  margin: 0 0 22px; font-weight: 800;
}
.landing-hero h1 em { font-style: normal; color: var(--primary-strong); }
.landing-hero .lead { font-size: 1.25rem; max-width: 27rem; margin-bottom: 28px; }
.hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.trust { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 26px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.92rem; }
.trust li { display: inline-flex; align-items: center; gap: 7px; }
.trust li::before {
  content: ""; width: 14px; height: 8px; border-inline-start: 2.5px solid var(--primary-strong);
  border-bottom: 2.5px solid var(--primary-strong); transform: rotate(-45deg) translateY(-2px);
}
[dir="rtl"] .trust li::before { transform: scaleX(-1) rotate(-45deg) translateY(-2px); }

/* Animated phone: pick up the phone -> read -> carry on. One loop is --loop long. */
.stage { --loop: 12s; position: relative; display: grid; justify-items: center; padding: 16px 0; }
.stage::before {
  content: ""; position: absolute; top: 4%; width: min(32rem, 96%); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--gold-soft) 0%, var(--sunken) 46%, transparent 70%);
  opacity: 0.9;
}
.phone {
  position: relative; width: 310px; max-width: 80vw; aspect-ratio: 310 / 630;
  background: var(--ink); border-radius: 48px; padding: 11px; box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) { .phone { background: #050b0c; outline: 1px solid var(--line); } }
.screen { position: relative; height: 100%; border-radius: 38px; background: var(--surface); overflow: hidden; }
.scene { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 26px 20px 20px; background: var(--surface); }

/* Scene 1: home screen, apps locked (and unlocked at the end of the loop) */
.home { align-items: center; animation: home var(--loop) infinite; }
.clock { font-size: 3rem; font-weight: 800; letter-spacing: -0.04em; margin: 18px 0 0; line-height: 1; }
.hello { margin: 4px 0 26px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: 100%; padding: 0 6px; }
.apps i { aspect-ratio: 1; border-radius: 28%; background: var(--c); animation: apps var(--loop) infinite; }
.pills { display: grid; margin-top: auto; margin-bottom: 14px; }
.pill { grid-area: 1 / 1; justify-self: center; border-radius: 999px; padding: 8px 16px; font-size: 0.78rem; font-weight: 700; margin: 0; }
.pill.lock { background: var(--chip); color: var(--chip-ink); animation: pill-lock var(--loop) infinite; }
.pill.open { background: var(--primary); color: var(--ink); animation: pill-open var(--loop) infinite; }
.tap { position: absolute; width: 46px; height: 46px; border-radius: 50%; background: var(--ink); opacity: 0; pointer-events: none; }
.tap.one { top: 41%; inset-inline-start: 31%; animation: tap-one var(--loop) infinite; }
.tap.two { bottom: 9.5%; inset-inline-end: 22%; animation: tap-two var(--loop) infinite; }
.tap.three { bottom: 21%; inset-inline-end: 24%; animation: tap-three var(--loop) infinite; }

/* Scene 2: the reading screen */
.read { animation: read var(--loop) infinite; }
.topline { display: flex; justify-content: space-between; align-items: center; font-size: 0.62rem; color: var(--muted); font-weight: 600; }
.streak { background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 4px 9px; font-weight: 700; }
.ref { align-self: center; color: var(--gold); font-size: 0.8rem; font-weight: 700; margin-top: 16px; }
/* The ayah is always shown whole: the two sides cross-fade, nothing is revealed bit by bit. */
.ayah { flex: 1; display: grid; align-items: center; padding: 8px 2px; }
.side { grid-area: 1 / 1; text-align: center; }
.side p { margin: 0; }
.arabic { font-family: "Amiri Quran", "Amiri", serif; color: var(--ink); animation: side-a var(--loop) infinite; }
.arabic .opening { font-size: 1.05rem; line-height: 2.2; color: var(--ink-soft); }
.arabic .verse { font-size: 1.5rem; line-height: 2.1; }
.translation { opacity: 0; color: var(--ink); font-size: 1.02rem; line-height: 1.6; font-weight: 500; padding: 0 6px; animation: side-t var(--loop) infinite; }
.toggle {
  align-self: center; display: flex; background: var(--track); border-radius: 999px; padding: 3px;
  font-size: 0.68rem; font-weight: 700; color: var(--muted); margin-bottom: 14px;
}
.toggle b { padding: 5px 12px; border-radius: 999px; font-weight: 700; }
.toggle b.a { background: var(--raised); color: var(--ink); animation: tog-a var(--loop) infinite; }
.toggle b.t { animation: tog-t var(--loop) infinite; }
.btns { display: flex; gap: 8px; }
.btn { flex: 1; text-align: center; border-radius: 16px; padding: 14px 6px; font-size: 0.82rem; font-weight: 700; }
.btn.ghost { border: 1.5px solid var(--line); color: var(--ink-soft); }
.btn.go { flex: 1.7; background: var(--primary); color: var(--ink); animation: press var(--loop) infinite; }
.call { text-align: center; font-size: 0.7rem; color: var(--muted); font-weight: 600; margin: 12px 0 0; }

/* Scene 3: done for today */
.done { align-items: center; justify-content: center; text-align: center; gap: 6px; opacity: 0; animation: done var(--loop) infinite; }
.check { width: 92px; height: 92px; border-radius: 50%; background: var(--primary-strong); display: grid; place-items: center; margin-bottom: 14px; animation: pop var(--loop) infinite; }
.check svg { width: 46px; height: 46px; stroke: var(--on-strong); }
.done strong { font-size: 1.35rem; letter-spacing: -0.02em; }
.done span { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.week { display: flex; gap: 7px; margin-top: 18px; }
.week b { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); }
.week b:last-child { background: var(--primary-strong); }

/* The three words under the phone light up with the scenes */
.story { position: relative; display: flex; gap: 6px 22px; flex-wrap: wrap; justify-content: center; list-style: none; padding: 0; margin: 26px 0 0; font-weight: 700; font-size: 0.95rem; }
.story li { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.story li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: 0.45; }
.story li:nth-child(1) { animation: story-1 var(--loop) infinite; }
.story li:nth-child(2) { animation: story-2 var(--loop) infinite; }
.story li:nth-child(3) { animation: story-3 var(--loop) infinite; }

@keyframes home { 0%, 12% { opacity: 1; } 15%, 85% { opacity: 0; } 89%, 100% { opacity: 1; } }
/* Waiting, not locked out: the apps stay in colour, just quieter, until the ayah is read. */
@keyframes apps { 0%, 85% { filter: saturate(0.55); opacity: 0.45; } 89%, 96% { filter: none; opacity: 1; } 100% { filter: saturate(0.55); opacity: 0.45; } }
@keyframes pill-lock { 0%, 12% { opacity: 1; } 15%, 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes pill-open { 0%, 88% { opacity: 0; } 90%, 96% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes tap-one { 0%, 6% { opacity: 0; transform: scale(0.6); } 8% { opacity: 0.3; transform: scale(1); } 12%, 100% { opacity: 0; transform: scale(1.8); } }
@keyframes tap-two { 0%, 47% { opacity: 0; transform: scale(0.6); } 49% { opacity: 0.3; transform: scale(1); } 54%, 100% { opacity: 0; transform: scale(1.8); } }
@keyframes read { 0%, 12% { transform: translateY(103%); opacity: 1; } 16%, 56% { transform: translateY(0); opacity: 1; } 60%, 99.9% { transform: translateY(0); opacity: 0; } 100% { transform: translateY(103%); opacity: 0; } }
@keyframes side-a { 0%, 35% { opacity: 1; } 38%, 100% { opacity: 0; } }
@keyframes side-t { 0%, 36% { opacity: 0; } 39%, 100% { opacity: 1; } }
@keyframes tog-a { 0%, 35% { background: var(--raised); color: var(--ink); } 37%, 100% { background: transparent; color: var(--muted); } }
@keyframes tog-t { 0%, 35% { background: transparent; color: var(--muted); } 37%, 100% { background: var(--raised); color: var(--ink); } }
@keyframes tap-three { 0%, 31% { opacity: 0; transform: scale(0.6); } 33% { opacity: 0.3; transform: scale(1); } 37%, 100% { opacity: 0; transform: scale(1.8); } }
@keyframes press { 0%, 49% { transform: scale(1); } 51% { transform: scale(0.94); } 54%, 100% { transform: scale(1); } }
@keyframes done { 0%, 57% { opacity: 0; } 61%, 83% { opacity: 1; } 87%, 100% { opacity: 0; } }
@keyframes pop { 0%, 58% { transform: scale(0.6); } 63% { transform: scale(1.1); } 66%, 100% { transform: scale(1); } }
@keyframes story-1 { 0%, 13% { color: var(--primary-strong); } 15%, 100% { color: var(--muted); } }
@keyframes story-2 { 0%, 13% { color: var(--muted); } 15%, 57% { color: var(--primary-strong); } 59%, 100% { color: var(--muted); } }
@keyframes story-3 { 0%, 57% { color: var(--muted); } 59%, 97% { color: var(--primary-strong); } 100% { color: var(--muted); } }

/* Without motion: show the reading screen, still. */
@media (prefers-reduced-motion: reduce) {
  .stage *, .stage *::before { animation: none !important; }
  .home, .done, .tap, .translation { display: none; }
  .story li { color: var(--ink-soft); }
}

/* Sections */
.gives { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 8px 0 64px; }
.give { background: var(--raised); border: 1px solid var(--line); border-radius: 24px; padding: 28px; }
.give .icon { width: 48px; height: 48px; border-radius: 15px; background: var(--chip); color: var(--chip-ink); display: grid; place-items: center; margin-bottom: 18px; }
.give .icon svg { width: 26px; height: 26px; }
.give h2 { font-size: 1.35rem; letter-spacing: -0.02em; margin: 0 0 6px; font-weight: 800; }
.give p { margin: 0; color: var(--ink-soft); }

/* Second demo: the goal. Loops on its own clock (--goal). */
.pace { --goal: 11s; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 8px 0 64px; }
.pace h2 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 800; }
.pace p { color: var(--ink-soft); font-size: 1.12rem; margin: 0; max-width: 28rem; }
.goal { background: var(--sunken); border-radius: 30px; padding: clamp(18px, 4vw, 36px); display: grid; justify-items: center; }
.goal-inner { width: 100%; max-width: 21rem; display: flex; flex-direction: column; gap: 12px; }
.g-card { background: var(--raised); border-radius: 22px; padding: 16px 18px 20px; }
.goal p { margin: 0; font-size: 0.95rem; max-width: none; }
.g-label, .g-head { color: var(--ink) !important; font-weight: 700; }
.g-head { margin-top: 6px !important; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 10px; }
.round { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: var(--ink); border: 1.5px solid var(--line); }
.round.plus { background: var(--primary); border-color: transparent; animation: plus var(--goal) infinite; }
.count { height: 3rem; width: 2.2rem; overflow: hidden; font-size: 2.4rem; font-weight: 800; line-height: 3rem; text-align: center; }
.roll { display: block; animation: roll var(--goal) infinite; }
.roll b { display: block; height: 3rem; font-weight: 800; }
.switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--track); border-radius: 999px; padding: 4px; }
.switch b { position: relative; text-align: center; padding: 10px 0; font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.switch .s1 { animation: sw-1 var(--goal) infinite; }
.switch .s2 { animation: sw-2 var(--goal) infinite; }
.thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--raised); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); animation: thumb var(--goal) infinite; }
.g-row { display: grid; background: var(--raised); border: 1px solid var(--line); border-radius: 18px; padding: 12px 16px; }
.g-row p { grid-area: 1 / 1; color: var(--ink) !important; font-weight: 600; }
.g-row small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.g-row .r1 { animation: row-1 var(--goal) infinite; }
.g-row .r2 { opacity: 0; animation: row-2 var(--goal) infinite; }
.paused { align-self: center; background: var(--raised); border: 1px solid var(--line); color: var(--chip-ink) !important; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 0.85rem !important; opacity: 0; animation: pause-chip var(--goal) infinite; }

@keyframes roll { 0%, 12% { transform: translateY(0); } 16%, 30% { transform: translateY(-3rem); } 34%, 94% { transform: translateY(-6rem); } 98%, 100% { transform: translateY(0); } }
@keyframes plus { 0%, 10% { transform: scale(1); } 13% { transform: scale(0.88); } 16%, 28% { transform: scale(1); } 31% { transform: scale(0.88); } 34%, 100% { transform: scale(1); } }
@keyframes thumb { 0%, 48% { transform: translateX(0); } 53%, 94% { transform: translateX(100%); } 98%, 100% { transform: translateX(0); } }
@keyframes sw-1 { 0%, 49% { color: var(--ink); } 52%, 95% { color: var(--muted); } 98%, 100% { color: var(--ink); } }
@keyframes sw-2 { 0%, 49% { color: var(--muted); } 52%, 95% { color: var(--ink); } 98%, 100% { color: var(--muted); } }
@keyframes row-1 { 0%, 50% { opacity: 1; } 54%, 95% { opacity: 0; } 99%, 100% { opacity: 1; } }
@keyframes row-2 { 0%, 51% { opacity: 0; } 55%, 94% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes pause-chip { 0%, 68% { opacity: 0; transform: translateY(6px); } 72%, 92% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .goal *, .goal *::before { animation: none !important; }
  .switch .s1 { color: var(--ink); }
  .paused { opacity: 1; }
}

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); padding: 8px 0 32px; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.card h2 { font-size: 1.08rem; margin: 0 0 6px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

.private {
  background: var(--ink); color: var(--surface); border-radius: 30px; padding: clamp(28px, 5vw, 52px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
@media (prefers-color-scheme: dark) { .private { background: var(--raised); color: var(--ink); border: 1px solid var(--line); } }
.private h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 800; }
.private p { margin: 0; opacity: 0.85; font-size: 1.08rem; max-width: 32rem; }
.private a { color: var(--gold-soft); font-weight: 700; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .private a { color: var(--gold); } }

.closing { text-align: center; padding: 80px 0 48px; }
.closing h2 { font-size: clamp(2.2rem, 6vw, 3.8rem); letter-spacing: -0.035em; line-height: 1.05; margin: 0 0 14px; font-weight: 800; }
.closing p { color: var(--ink-soft); margin: 0 0 24px; font-size: 1.12rem; }

/* Text pages (privacy policy) */
main h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1.2; margin: 32px 0 4px; }
main h2 { font-size: 1.25rem; margin: 32px 0 8px; }
main p, main li { color: var(--ink-soft); }
main ul { padding-inline-start: 1.2rem; }
main li { margin: 6px 0; }
.meta { color: var(--muted); font-size: 0.95rem; margin: 0 0 16px; }
.summary { background: var(--sunken); border-radius: 16px; padding: 16px 18px; margin: 16px 0 8px; }
.summary p { margin: 0; color: var(--ink); }

footer {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 44px;
  color: var(--muted); font-size: 0.9rem;
}
footer p { margin: 4px 0; }
footer .links { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
footer .links a { color: var(--ink-soft); font-weight: 600; text-decoration: none; }
footer .links a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .landing-hero { grid-template-columns: 1fr; padding: 12px 0 44px; gap: 20px; }
  .gives { grid-template-columns: 1fr; padding-bottom: 44px; }
  .pace { grid-template-columns: 1fr; gap: 24px; padding-bottom: 44px; }
}
