/*
 * QuranStream — site styles.
 *
 * The palette is taken from the app's own artwork: the deep teal and cream of
 * the logo, and the gold of the splash frame. Nothing here is invented, so the
 * site and the app read as one thing.
 *
 * Arabic is the default and the document is RTL. Every rule that could hard-code
 * a side uses logical properties (inline-start/end, margin-inline) so the
 * English LTR mode is the same stylesheet, mirrored by the browser rather than
 * by a second set of rules.
 */

:root {
  --teal-900: #06302f;
  --teal-800: #0e4645;
  --teal-700: #145b59;
  --gold: #c9a227;
  --gold-soft: #d4af5f;
  --cream: #f8edd9;
  --cream-dim: #efe2c9;
  --ink: #0a1615;
  --paper: #fbf7ef;

  --radius: 14px;
  --shadow: 0 18px 50px -24px rgba(6, 48, 47, .45);
  --measure: 62ch;

  --font-ar: 'Cairo', system-ui, sans-serif;
  --font-ar-display: 'Amiri', Georgia, serif;
  --font-en: 'Cormorant Garamond', Georgia, serif;
  --font-en-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ar);
  font-weight: 400;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* English swaps the type stack; the layout is untouched. */
html[lang="en"] body { font-family: var(--font-en-body); line-height: 1.7; }

/*
 * The mosaic ground.
 *
 * One tile from the app's own splash artwork, repeated and held very faint —
 * it should register as texture, not as pattern. Fixed so the page appears to
 * move over it rather than carry it.
 */
.pattern-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('media/pattern.png');
  background-size: 300px;
  opacity: .5;
  pointer-events: none;
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .75rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(251, 247, 239, .88);
  backdrop-filter: blur(12px);
  border-block-end: 1px solid rgba(14, 70, 69, .12);
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--teal-800);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand img { border-radius: 9px; }

.nav {
  display: flex;
  gap: clamp(.75rem, 2vw, 1.6rem);
  margin-inline-start: auto;
  font-size: .95rem;
}
.nav a {
  color: var(--teal-800);
  text-decoration: none;
  padding-block: .35rem;
  border-block-end: 2px solid transparent;
  transition: border-color .2s, color .2s;
}
.nav a:hover { border-block-end-color: var(--gold); }

.lang-toggle {
  min-width: 3rem;
  padding: .4rem .8rem;
  font: inherit;
  font-weight: 700;
  color: var(--teal-800);
  background: transparent;
  border: 1.5px solid rgba(14, 70, 69, .3);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.lang-toggle:hover { background: rgba(14, 70, 69, .07); border-color: var(--teal-800); }

@media (max-width: 720px) {
  .nav { display: none; }
  .lang-toggle { margin-inline-start: auto; }
}

/* ── Hero ───────────────────────────────────────────────── */

.hero { padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem); }

/*
 * The hero sits inside a scalloped frame quoting the app's splash screen: a
 * gold rule inside a deeper one, with the corners cut. Built from gradients
 * and radii rather than an image, so it stays crisp at any width.
 */
.hero-frame {
  position: relative;
  max-width: 1100px;
  margin-inline: auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1.5rem, 5vw, 4rem);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(20, 91, 89, .96) 0%, var(--teal-900) 62%);
  border: 2px solid var(--gold-soft);
  border-radius: 36px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* The inner hairline, the detail that makes the frame read as ornament. */
.hero-frame::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(212, 175, 95, .45);
  border-radius: 28px;
  pointer-events: none;
}
/* A ghost of the mosaic inside the frame, so the ground continues through it. */
.hero-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('media/pattern.png');
  background-size: 260px;
  opacity: .06;
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero-inner { position: relative; text-align: center; }

.hero-logo {
  border-radius: 22px;
  margin-block-end: 1.25rem;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-ar-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.45;
  color: var(--cream);
}
html[lang="en"] .hero h1 { font-family: var(--font-en); font-weight: 600; line-height: 1.2; }

.lede {
  max-width: var(--measure);
  margin: 0 auto 2rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--cream-dim);
}

.hero-cta { display: flex; flex-wrap: wrap; gap: .85rem; justify-content: center; }

.btn {
  display: inline-block;
  padding: .8rem 1.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #2a1f05;
  box-shadow: 0 10px 26px -12px rgba(201, 162, 39, .9);
}
.btn-ghost {
  color: var(--cream);
  border: 1.5px solid rgba(248, 237, 217, .45);
}
.btn-ghost:hover { background: rgba(248, 237, 217, .1); }

.hero-note {
  margin-block-start: 1.75rem;
  margin-block-end: 0;
  font-size: .9rem;
  color: rgba(248, 237, 217, .65);
  letter-spacing: .02em;
}

/* ── Sections ───────────────────────────────────────────── */

.section {
  max-width: 1100px;
  margin-inline: auto;
  padding: clamp(3rem, 8vw, 5.5rem) clamp(1rem, 4vw, 2.5rem);
}

.section-title {
  margin: 0 0 .75rem;
  font-family: var(--font-ar-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--teal-800);
  text-align: center;
}
html[lang="en"] .section-title { font-family: var(--font-en); }

/* The gold rule under each heading — a small nod to the app's panel borders. */
.section-title::after {
  content: '';
  display: block;
  width: 68px;
  height: 2px;
  margin: .7rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.section-lede {
  max-width: var(--measure);
  margin: 0 auto 2.75rem;
  text-align: center;
  color: #33504e;
  font-size: 1.05rem;
}

.section-dark {
  max-width: none;
  background: var(--teal-900);
  color: var(--cream);
}
.section-dark .section-title { color: var(--cream); }
.section-dark .section-lede { color: rgba(248, 237, 217, .78); }

.section-accent {
  max-width: none;
  background:
    linear-gradient(180deg, rgba(14, 70, 69, .05), rgba(201, 162, 39, .09));
}

/* ── Feature cards ──────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}

.card {
  padding: 1.9rem 1.5rem;
  background: #fff;
  border: 1px solid rgba(14, 70, 69, .1);
  border-radius: var(--radius);
  text-align: center;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 162, 39, .5);
  box-shadow: var(--shadow);
}
.card-icon {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--gold);
  margin-block-end: .85rem;
}
.card h3 {
  margin: 0 0 .5rem;
  font-size: 1.15rem;
  color: var(--teal-800);
}
.card p { margin: 0; font-size: .96rem; color: #435f5d; }

/* ── Demo ───────────────────────────────────────────────── */

.demo {
  max-width: 900px;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}
.demo-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  border: 2px solid rgba(212, 175, 95, .55);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8);
  background: #000;
}
.demo figcaption {
  margin-block-start: .9rem;
  text-align: center;
  font-size: .9rem;
  color: rgba(248, 237, 217, .6);
}

/* ── Preset grid ────────────────────────────────────────── */

/*
 * The live preview.
 *
 * A replica of the app's display: the same 16:9 canvas, the same four panels at
 * the same fractions of it. LAYOUT in src/design/presets.ts places them in
 * pixels against 1920x1080; the percentages below are those numbers divided
 * through, so the preview stays true at any width without a script measuring
 * anything.
 */
.preview-stage {
  max-width: 940px;
  margin: 0 auto 2.75rem;
}

.preview-canvas {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(212, 175, 95, .5);
  box-shadow: var(--shadow);
  background: #000;
  /* Panel geometry scales with the canvas, so radii and borders keep their
     proportion the way they do on a real screen. */
  container-type: inline-size;
}

.preview-bg,
.preview-dim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.preview-bg { object-fit: cover; }
.preview-dim { background: rgba(0, 0, 0, .1); }

/* Each panel: absolute, positioned from LAYOUT, styled from the preset. */
.pv-el {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0 1.5%;
  text-align: center;
  overflow: hidden;
  /* The panel fill, border and radius are set from the preset at runtime. */
  transition: background .35s, border-color .35s, border-radius .35s, color .35s;
}

/* x/1920, y/1080, w/1920, h/1080 — straight from LAYOUT. */
.pv-reciter     { inset-inline-start: 7.29%;  top: 45.00%; width: 29.17%; height: 9.63%; }
.pv-surah       { inset-inline-start: 63.54%; top: 45.00%; width: 29.17%; height: 9.63%; }
.pv-arabic      { inset-inline-start: 7.29%;  top: 57.59%; width: 85.42%; height: 19.44%; }
.pv-translation { inset-inline-start: 13.54%; top: 80.00%; width: 72.92%; height: 9.63%; }

/* Type scales with the canvas width, so the preview reads the same at any size. */
.pv-reciter, .pv-surah { font-size: clamp(.6rem, 2.1cqw, 1.05rem); font-weight: 600; }
.pv-arabic {
  font-family: var(--font-ar-display);
  font-size: clamp(1rem, 4.4cqw, 2.4rem);
  line-height: 1.7;
}
.pv-translation { font-size: clamp(.55rem, 1.85cqw, .95rem); }

/* The highlighted word — the app's own behaviour, shown at rest. */
.pv-word-on { color: var(--pv-highlight, #f6e6b4); }

.preview-caption {
  margin-block-start: .9rem;
  text-align: center;
  font-size: .92rem;
  color: #4c6664;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 1rem;
}

/* The chosen preset, marked in the grid. */
.preset[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), var(--shadow);
}

.preset {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(14, 70, 69, .12);
  background: #fff;
  transition: transform .18s, box-shadow .2s;
}
.preset:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/*
 * Each swatch is the preset drawn as the app draws it: the panel colour as the
 * ground, its border colour as the rule, and a line of Qur'anic text in the
 * preset's own body colour — so what you see here is what the screen shows.
 */
.preset-swatch {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: .75rem;
  font-family: var(--font-ar-display);
  font-size: 1.35rem;
  text-align: center;
}
.preset-name {
  display: block;
  padding: .6rem .75rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--teal-800);
  text-align: center;
  border-block-start: 1px solid rgba(14, 70, 69, .08);
}

/* ── Share ──────────────────────────────────────────────── */

.share-frame {
  max-width: 900px;
  margin-inline: auto;
  text-align: center;
}
.share-lede {
  max-width: var(--measure);
  margin: 0 auto 2rem;
  font-size: 1.08rem;
  color: #33504e;
}
.platforms {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
.platforms li {
  padding: .45rem 1.1rem;
  background: #fff;
  border: 1px solid rgba(201, 162, 39, .4);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--teal-800);
}
.share-note {
  max-width: var(--measure);
  margin-inline: auto;
  font-size: .95rem;
  color: #4c6664;
}

/* ── Get ────────────────────────────────────────────────── */

.get-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: 760px;
  margin-inline: auto;
}
.get-card {
  display: block;
  padding: 1.75rem;
  background: var(--teal-800);
  color: var(--cream);
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid rgba(212, 175, 95, .35);
  transition: transform .18s, box-shadow .2s, background .2s;
}
.get-card:hover {
  transform: translateY(-3px);
  background: var(--teal-700);
  box-shadow: var(--shadow);
}
.get-kind {
  display: block;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-block-end: .35rem;
}
.get-name { display: block; font-size: 1.3rem; font-weight: 700; }
.get-note {
  display: block;
  margin-block-start: .3rem;
  font-size: .9rem;
  color: rgba(248, 237, 217, .7);
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
  background: var(--teal-900);
  color: rgba(248, 237, 217, .75);
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem);
}
.footer-inner { max-width: 800px; margin-inline: auto; text-align: center; }
.licence {
  font-size: .92rem;
  line-height: 1.8;
  padding: 1.25rem;
  border: 1px solid rgba(212, 175, 95, .3);
  border-radius: var(--radius);
}
.licence strong { display: block; color: var(--gold-soft); margin-block-end: .4rem; }
.licence a, .footer-links a {
  color: var(--gold-soft);
  text-decoration: none;
  border-block-end: 1px solid rgba(212, 175, 95, .4);
}
.licence a:hover, .footer-links a:hover { color: var(--cream); }
.licence a { display: inline-block; margin-block-start: .5rem; }
.credits { font-size: .88rem; color: rgba(248, 237, 217, .55); }
.footer-links { display: flex; gap: .75rem; justify-content: center; font-size: .9rem; }
