/* ==========================================================================
   عهدي — myahdapp.com
   Shared stylesheet. No frameworks, no build step, no external requests.

   Palette and the three-colour wird system are sampled from the app itself
   (حفظ green / مراجعة blue / تلاوة purple), so the site reads as the app.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */
:root {
  /* Surfaces — kept neutral so content and accents can register. */
  --bg:          #FBFAF7;
  --surface:     #FFFFFF;
  --surface-alt: #F4F2EC;

  /* Text. Headings darker than body: colour does hierarchy work for free.
     Never pure black — it is harsh and flattens the type. */
  --ink:         #141A16;
  --body:        #55605A;
  --muted:       #616B66;

  /* Accent is reserved for interactive things — links, buttons, active
     states — so its presence *is* the affordance. */
  --accent:      #248448;
  --accent-ink:  #1B6537;
  --accent-soft: #E6F2EA;

  /* The app's semantic wird colours. Never used alone: every appearance is
     paired with an icon and a label. */
  --hifz:        #2FA344;
  --hifz-ink:    #1B6E2B;
  --hifz-soft:   #E4F5E7;
  --muraja:      #2394DC;
  --muraja-ink:  #0D5C92;
  --muraja-soft: #E1F1FB;
  --tilawa:      #6B4FD0;
  --tilawa-ink:  #4B31B8;
  --tilawa-soft: #ECE7FB;

  --cream:       #E4B484;
  --cream-soft:  #FBF1E6;

  /* Caption-highlight colours, sampled straight off the App Store screenshots.
     Far more saturated than the -soft tints they replace. */
  --hl-green:    #5AD28A;
  --hl-cyan:     #5ACCD2;
  --hl-tan:      #E4BA8A;

  --border:      #E8E4DB;
  --border-soft: #F0EDE6;

  /* Three-tier shadow system, tinted toward the surfaces it falls on
     rather than neutral grey. */
  --sh-1: 0 1px 2px rgba(20,26,22,.04), 0 4px 12px rgba(20,26,22,.05);
  --sh-2: 0 2px 4px rgba(20,26,22,.05), 0 12px 28px rgba(20,26,22,.08);
  --sh-3: 0 4px 10px rgba(20,26,22,.06), 0 28px 56px rgba(20,26,22,.12);

  --radius:   20px;
  --radius-lg: 28px;
  --measure:  66ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0F1311;
    --surface:     #171D19;
    --surface-alt: #131916;

    --ink:         #F2F2F2;
    --body:        #B8C1BB;
    --muted:       #8B9590;

    --accent:      #4FC97E;
    --accent-ink:  #6FD996;
    --accent-soft: #14261B;

    --hifz:        #4FC968;
    --hifz-ink:    #6FDA85;
    --hifz-soft:   #142616;
    --muraja:      #47B2F0;
    --muraja-ink:  #6FC6F5;
    --muraja-soft: #0F2231;
    --tilawa:      #9B85F0;
    --tilawa-ink:  #B4A3F5;
    --tilawa-soft: #1B1733;

    --cream:       #E4B484;
    --cream-soft:  #241C14;

    /* Dark mode inverts which side needs to be light: the ink goes pale, so
       the block has to darken or the text washes out. */
    --hl-green:    #1E5E31;
    --hl-cyan:     #17545A;
    --hl-tan:      #5C4630;

    --border:      #29312C;
    --border-soft: #202722;

    --sh-1: 0 1px 2px rgba(0,0,0,.30), 0 4px 12px rgba(0,0,0,.28);
    --sh-2: 0 2px 4px rgba(0,0,0,.34), 0 12px 28px rgba(0,0,0,.38);
    --sh-3: 0 4px 10px rgba(0,0,0,.38), 0 28px 56px rgba(0,0,0,.46);
  }
}

/* --- Wordmark / heading face -------------------------------------------
   Almadinah — the same face the app uses. Self-hosted, so still no
   third-party requests. Body copy stays on the system stack (SF Arabic),
   which is more readable at paragraph sizes. Two faces, no more.
   -------------------------------------------------------------------- */
@font-face {
  font-family: "Almadinah";
  src: url("assets/almadinah.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "SF Arabic", -apple-system, BlinkMacSystemFont, system-ui,
               "Segoe UI", "Geeza Pro", Tahoma, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  /* Arabic carries diacritics above and below the baseline, so it needs a
     little more leading than the 1.5-1.6 that suits Latin body copy. */
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Layout ------------------------------------------------------------- */
.wrap   { width: min(100% - 2.5rem, 1100px); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 720px);  margin-inline: auto; }

@media (max-width: 360px) {
  .wrap   { width: min(100% - 1.5rem, 1100px); }
  .narrow { width: min(100% - 1.5rem, 720px); }
}

section { padding-block: clamp(3.5rem, 9vw, 6.5rem); }
section[id] { scroll-margin-top: 5rem; }

/* --- Typography ---------------------------------------------------------
   Headings: Almadinah, darker, tighter leading.
   Body: system stack, lighter colour, looser leading.
   ---------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: "Almadinah", "SF Arabic", -apple-system, system-ui, sans-serif;
  font-weight: normal;
  color: var(--ink);
  text-wrap: balance;
  margin: 0 0 .45em;
}

/* Almadinah sets ~0.63x the width of the system face at equal px, so every
   heading step is scaled up to hold its intended optical weight. */
h1 { font-size: clamp(3.2rem, 10vw, 5rem);   line-height: 1.2;  letter-spacing: -.005em; }
h2 { font-size: clamp(2.1rem, 5.4vw, 3rem);  line-height: 1.25; }
h3 { font-size: clamp(1.5rem, 3vw, 1.8rem);  line-height: 1.3; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.lede { font-size: clamp(1.1rem, 2.4vw, 1.28rem); color: var(--body); }

.eyebrow {
  font-family: "SF Arabic", -apple-system, system-ui, sans-serif;
  display: inline-block;
  font-size: .85rem; font-weight: 700;
  /* No letter-spacing: Arabic is cursive, and tracking prises the joins apart. */
  letter-spacing: 0;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: .3rem .85rem;
  border-radius: 999px;
  margin: 0 0 1rem;
}

/* The app's signature headline treatment — a solid block behind part of the
   phrase, as on every App Store screenshot. */
.hl {
  background: var(--hl, var(--accent-soft));
  color: var(--ink);
  padding: .04em .26em .1em;
  border-radius: .14em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--accent-soft) center / cover no-repeat;
  background-image: url("assets/icon.png");
  border: 1px solid var(--border);
}
.brand .wordmark {
  font-family: "Almadinah", "SF Arabic", system-ui, sans-serif;
  font-size: 1.6rem; line-height: 1;
}
.site-nav { display: flex; gap: clamp(.85rem, 3.4vw, 1.9rem); font-size: .95rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
@media (max-width: 430px) { .site-nav { font-size: .85rem; } }
/* Five links plus the brand will not fit a 320px bar, and shrinking the type
   any further drops it below a readable size. Drop the most expendable link
   instead — its section is still reachable by scrolling. */
@media (max-width: 380px) { .site-nav .opt { display: none; } }

/* --- Hero --------------------------------------------------------------- */
.hero {
  text-align: center;
  padding-block: clamp(3.5rem, 10vw, 6.5rem) clamp(2.5rem, 7vw, 4rem);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 78%);
}
.hero p { margin-inline: auto; }
.hero .lede { margin-bottom: 2.25rem; }

/* Background-image rather than <img>: a missing file degrades to a soft
   tinted square instead of a broken-image glyph. */
.app-icon {
  width: 104px; height: 104px; margin: 0 auto 1.75rem;
  border-radius: 24px;
  background: linear-gradient(160deg, var(--hifz-soft), var(--accent-soft)) center / cover no-repeat;
  background-image: url("assets/icon.png");
  box-shadow: var(--sh-2);
  border: 1px solid var(--border);
}

/* --- App Store badge ---------------------------------------------------- */
.badge-row { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; }
/* Apple requires the badge unaltered, at least 40px tall, with clear space of
   at least 1/10th its height on every side. 54px -> 5.4px minimum. */
.appstore-badge { display: inline-block; padding: 8px; }
.appstore-badge img { height: 54px; width: auto; display: block; }
.appstore-badge .badge-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .appstore-badge .badge-light { display: none; }
  .appstore-badge .badge-dark  { display: block; }
}

/* --- Hadith -------------------------------------------------------------
   Sits inside the hero, in the app's own order: name, hadith, then where the
   name comes from. Wording is copied verbatim from the onboarding screen.
   ---------------------------------------------------------------------- */
.hero .hadith {
  margin: 0 0 1.9rem;
  padding: clamp(1.5rem, 4vw, 2.25rem) clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-1);
}
.hero .hadith .attrib-top { color: var(--muted); font-size: .95rem; margin: 0 0 .85rem; max-width: none; }
.hero .hadith blockquote {
  margin: 0; color: var(--ink);
  font-size: clamp(1.2rem, 3.2vw, 1.55rem); line-height: 2.1;
  text-wrap: balance;
}
.hero .hadith .attrib { color: var(--muted); font-size: .9rem; margin: 1.15rem 0 0; }

/* The app marks the word its name comes from with a green marker, tilted a
   degree — the same highlighter language as the App Store captions. */
.hl-marker { position: relative; display: inline-block; padding-inline: .18em; isolation: isolate; }
.hl-marker::before {
  content: ""; position: absolute; inset: .18em 0 .12em;
  background: rgba(57, 228, 107, .5);
  border-radius: 6px; transform: rotate(-1deg); z-index: -1;
}
@media (prefers-color-scheme: dark) { .hl-marker::before { background: rgba(57, 228, 107, .36); } }

/* Three lines, as the app sets them. They still wrap on a narrow screen. */
.intro > span { display: block; }
.intro .wordmark {
  display: inline;
  font-family: "Almadinah", "SF Arabic", system-ui, sans-serif;
  font-size: 1.3em; line-height: 1;
}

/* --- Section heads ------------------------------------------------------ */
.section-head { margin-bottom: clamp(2rem, 5vw, 3rem); max-width: var(--measure); }
.section-head.center { margin-inline: auto; text-align: center; }

/* --- Wird cards --------------------------------------------------------- */
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2rem);
  box-shadow: var(--sh-1);
  /* A top rule in the wird's own colour — the identity anchor for the card. */
  border-top: 3px solid var(--c, var(--accent));
}
.card h3 { color: var(--c-ink, var(--ink)); margin-bottom: .35em; }
.card .chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  color: var(--c-ink); background: var(--c-soft);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: 1rem;
}
.card .chip svg { width: 15px; height: 15px; flex: none; }

/* Raster artwork carried as a mask, so it takes currentColor exactly like the
   inline SVG icons do — no separate light/dark asset needed. */
.card .chip .ic-brain {
  width: 15px; height: 15px; flex: none; display: block;
  background-color: currentColor;
  -webkit-mask: url("assets/icon-brain.png") center / contain no-repeat;
          mask: url("assets/icon-brain.png") center / contain no-repeat;
}
.card p { font-size: .98rem; }

.card--hifz   { --c: var(--hifz);   --c-ink: var(--hifz-ink);   --c-soft: var(--hifz-soft); }
.card--muraja { --c: var(--muraja); --c-ink: var(--muraja-ink); --c-soft: var(--muraja-soft); }
.card--tilawa { --c: var(--tilawa); --c-ink: var(--tilawa-ink); --c-soft: var(--tilawa-soft); }

/* --- Screenshot showcase ------------------------------------------------
   A horizontal rail rather than a grid: seven tall phone shots in a grid
   would push everything below them off the page.
   ---------------------------------------------------------------------- */
.showcase { background: var(--surface-alt); border-block: 1px solid var(--border-soft); overflow: hidden; }
.rail {
  display: flex; gap: 1.25rem;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-block: .5rem 2rem;
  /* Bleed to the viewport edges so the rail reads as scrollable. */
  padding-inline: max(1.25rem, calc((100vw - 1100px) / 2));
  margin-inline: calc(50% - 50vw);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.rail::-webkit-scrollbar-track { background: transparent; }

.rail figure {
  flex: 0 0 auto; margin: 0; scroll-snap-align: center;
  width: clamp(210px, 58vw, 290px);
}
.rail img {
  width: 100%; border-radius: var(--radius);
  box-shadow: var(--sh-2);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

/* --- Feature rows ------------------------------------------------------- */
/* minmax(0, …) rather than 1fr: a bare 1fr track has min-width:auto, so the
   image's max-width would pin the column at 340px and blow out narrow screens. */
.feature { display: grid; gap: clamp(1.75rem, 5vw, 3.5rem); align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) {
  .feature { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .feature.flip > :first-child { order: 2; }
}


/* --- Feature list ------------------------------------------------------- */
.ticks { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .85rem; }
.ticks li { display: flex; align-items: flex-start; gap: .7rem; color: var(--body); }
.ticks svg { width: 20px; height: 20px; flex: none; margin-top: .28em; color: var(--accent); }

/* --- Mushaf page -------------------------------------------------------
   One large page, cropped clear of the device frame so it reads as paper
   rather than a screenshot of a phone.
   ---------------------------------------------------------------------- */
.feature .page-shot {
  width: 100%;
  max-width: min(400px, 100%);
  height: auto;
  margin-inline: auto;
  /* No border, radius or shadow here: the mockup already carries the device
     frame and its own soft shadow, and the PNG's alpha is preserved so it sits
     straight on the page background. Adding a box would frame the frame. */
}

/* --- Privacy ------------------------------------------------------------ */
.privacy { background: linear-gradient(180deg, var(--bg) 0%, var(--accent-soft) 100%); }
.checklist {
  list-style: none; padding: 0; margin: 1.75rem 0 0;
  display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.checklist li { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 600; font-size: .97rem; }
.checklist svg { width: 20px; height: 20px; flex: none; color: var(--accent); }

/* --- Closing CTA -------------------------------------------------------- */
.cta { text-align: center; }
.cta p { margin-inline: auto; }

/* --- Long-form documents (privacy / support) ---------------------------- */
.doc { padding-block: clamp(2.5rem, 6vw, 4rem); }
.doc h1 { font-size: clamp(2.4rem, 6.5vw, 3.4rem); margin-bottom: .3em; }
.doc h2 { font-size: clamp(1.7rem, 4vw, 2.1rem); margin-top: 2.75rem; padding-top: 1.75rem; border-top: 1px solid var(--border-soft); }
.doc h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1.5rem; }
.doc h3 { margin-top: 1.9rem; font-size: 1.35rem; }
.doc ul, .doc ol { max-width: var(--measure); padding-inline-start: 1.4rem; }
.doc li { margin-bottom: .55rem; }
.doc .updated { color: var(--muted); font-size: .95rem; }

.callout {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.35rem 1.6rem;
  margin: 1.75rem 0;
  box-shadow: var(--sh-1);
}

[dir="ltr"] { text-align: left; }
.lang-switch { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 2rem; font-size: .95rem; }
.lang-switch a {
  padding: .45rem 1rem; border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; color: var(--muted); background: var(--surface);
}
.lang-switch a:hover { color: var(--accent); border-color: var(--accent); }

/* --- FAQ ---------------------------------------------------------------- */
.faq details {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.15rem 1.45rem; margin-bottom: .85rem;
  box-shadow: var(--sh-1);
}
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; float: inline-end; color: var(--accent); font-weight: 400; }
.faq details[open] summary::after { content: "－"; }
.faq details[open] summary { margin-bottom: .8rem; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding-block: 2.75rem;
  color: var(--muted); font-size: .93rem;
  background: var(--surface-alt);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 0; }
