/* ==========================================================================
   قصص الأنبياء بالعامية المصرية — website theme
   RTL-first, responsive, warm storybook palette.
   ========================================================================== */

:root {
  /* Brand */
  --orange: #ff8c42;
  --orange-dark: #f2741f;
  --orange-soft: #ffe7d3;
  --cream: #fff8f0;
  --cream-2: #fff1e2;
  --brown: #4a3728;
  --brown-soft: #7a6450;
  --green: #3fae6a;
  --green-soft: #e3f6ea;
  --red: #e35d5d;
  --red-soft: #fbe3e3;
  --gold: #f5b942;

  /* Surfaces */
  --card: #ffffff;
  --line: #f0e2d2;
  --shadow: 0 14px 34px rgba(74, 55, 40, 0.12);
  --shadow-sm: 0 6px 16px rgba(74, 55, 40, 0.10);

  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 1120px;

  --font-body: "Cairo", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-display: "Baloo Bhaijaan 2", "Cairo", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--brown);
  background:
    radial-gradient(1200px 540px at 90% -8%, var(--orange-soft) 0%, transparent 55%),
    radial-gradient(900px 480px at -10% 8%, #ffe9cf 0%, transparent 50%),
    var(--cream);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: column layout + a growing <main> pins the footer to the
     bottom of the viewport even when the page content is short (e.g. the
     player's loading state). The fab/toast/modal are position:fixed, so they
     stay out of this flow. */
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

h1, h2, h3 { font-family: var(--font-display); color: var(--brown); margin: 0 0 .4em; line-height: 1.3; }
a { color: var(--orange-dark); text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 248, 240, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; color: var(--brown); }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(145deg, var(--orange), var(--gold));
  display: grid; place-items: center; color: #fff; font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: none; align-items: center; gap: 8px; font-size: .9rem; color: var(--brown-soft); }
.user-chip.show { display: flex; }
.topbar-start { display: flex; align-items: center; gap: 10px; }
.back-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); color: var(--brown); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow-sm); transition: border .15s ease, transform .12s ease; }
.back-btn:hover { border-color: var(--orange); }
.back-btn:active { transform: translateY(1px); }
.icon-toggle { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--brown); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: border .15s ease, transform .12s ease; }
.icon-toggle:hover { border-color: var(--orange); }
.icon-toggle:active { transform: scale(.94); }
/* Moon glyph in light mode (tap → go dark); sun glyph in dark mode. */
.ic-sun { display: none; }
html[data-theme="dark"] .ic-sun { display: block; }
html[data-theme="dark"] .ic-moon { display: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease, opacity .2s ease;
  text-align: center;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(145deg, var(--orange), var(--orange-dark)); color: #fff; box-shadow: 0 10px 22px rgba(242, 116, 31, .35); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 28px rgba(242, 116, 31, .45); }
.btn-ghost { background: var(--card); color: var(--brown); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover:not(:disabled) { border-color: var(--orange); }
.btn-block { width: 100%; }
.btn-google { background: var(--card); color: var(--brown); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.btn-google svg { width: 20px; height: 20px; }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }

/* ── Cards & inputs ──────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 26px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--brown); }
.input, textarea.input {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--brown);
  background: var(--cream); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: border .15s ease, box-shadow .15s ease;
}
.input:focus, textarea.input:focus { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 140, 66, .15); }
textarea.input { resize: vertical; min-height: 84px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--brown-soft); margin: 18px 0; font-size: .88rem; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ── Auth / centered layouts ─────────────────────────────────────────────── */
.center-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-tabs { display: flex; background: var(--cream-2); border-radius: 999px; padding: 5px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 999px; font-family: var(--font-body); font-weight: 700; color: var(--brown-soft); cursor: pointer; transition: all .15s ease; }
.auth-tabs button.active { background: var(--card); color: var(--brown); box-shadow: var(--shadow-sm); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 30px 0 8px; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
.hero p { color: var(--brown-soft); max-width: 560px; margin: 0 auto; font-size: 1.05rem; }
.tag { display: inline-block; background: var(--orange-soft); color: var(--orange-dark); font-weight: 700; font-size: .85rem; padding: 6px 14px; border-radius: 999px; margin-bottom: 12px; }

/* ── Story grid ──────────────────────────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 16px; flex-wrap: wrap; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; padding-bottom: 50px; }
.story-card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.story-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(74,55,40,.18); }
/* Match the backend cover-portrait ratio (750×1344 = 400:717) so the whole
   poster shows with no crop and no letterbox bars. */
.story-card .cover { aspect-ratio: 400 / 717; background: var(--cream-2) center/cover no-repeat; }
.story-card .meta { padding: 12px 14px; }
.story-card .meta h3 { font-size: 1.02rem; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-card .meta .sub { font-size: .82rem; color: var(--brown-soft); }
.lock-badge { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; background: rgba(74,55,40,.78); color: #fff; border-radius: 999px; width: 34px; height: 34px; display: grid; place-items: center; backdrop-filter: blur(2px); }
.story-card.locked .cover { filter: saturate(.7) brightness(.92); }

/* ── Status banners ──────────────────────────────────────────────────────── */
.banner { border-radius: var(--radius-sm); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.banner.info { background: var(--orange-soft); color: var(--orange-dark); }
.banner.ok { background: var(--green-soft); color: #2c7e4d; }
.banner.warn { background: #fff3d6; color: #9a6b00; }
.banner.err { background: var(--red-soft); color: #b53b3b; }

/* ── Payment box ─────────────────────────────────────────────────────────── */
.pay-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-row .k { color: var(--brown-soft); }
.pay-row .v { font-weight: 700; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px dashed var(--orange); border-radius: var(--radius-sm); padding: 22px; text-align: center; background: var(--cream); cursor: pointer; transition: background .15s ease; }
.dropzone:hover { background: var(--cream-2); }
.preview-img { margin-top: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); max-height: 280px; margin-inline: auto; }

/* ── Player ──────────────────────────────────────────────────────────────── */
.player-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 80vh; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.player-stage .scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform-origin: center; transition: opacity .6s ease; will-change: transform, opacity; backface-visibility: hidden; }
.player-stage .scene-img.active { opacity: 1; }
/* Per-scene Ken Burns — pan + zoom via CSS vars set by the player JS from each
   scene's animation data. Kept on a keyframe animation (not a transition) so it
   never clashes with the opacity crossfade above. */
@keyframes kenburns {
  from { transform: scale(var(--kb-s0, 1)) translate(var(--kb-x0, 0%), var(--kb-y0, 0%)); }
  to   { transform: scale(var(--kb-s1, 1.14)) translate(var(--kb-x1, 0%), var(--kb-y1, 0%)); }
}
.player-stage .scene-img.kb { animation: kenburns var(--kb-dur, 14s) var(--kb-ease, ease-out) forwards; }
@media (prefers-reduced-motion: reduce) {
  .player-stage .scene-img.kb { animation: none; transform: none; }
}

.caption { position: absolute; inset-inline: 0; inset-block-end: 0; padding: 40px 22px 22px; background: linear-gradient(to top, rgba(0,0,0,.72), transparent); color: #fff; font-size: clamp(1.05rem, 2.6vw, 1.5rem); font-weight: 600; text-align: center; line-height: 1.8; }
.player-stage.no-caption .caption { display: none; }
/* Overlay controls ON the player image: subtitle (physical left) +
   fullscreen (physical right), pinned to the bottom corners. Physical
   left/right (not inset-inline) so sides are fixed regardless of RTL. */
.cc-toggle, .fs-toggle { position: absolute; bottom: 12px; z-index: 5; width: 42px; height: 42px; border-radius: 999px; border: 0; background: rgba(0,0,0,.5); color: #fff; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(4px); transition: background .15s ease, opacity .15s ease; }
.cc-toggle { left: 12px; }
.fs-toggle { right: 12px; }
.cc-toggle:hover, .fs-toggle:hover { background: rgba(0,0,0,.68); }
.cc-toggle.off { opacity: .55; }
.nav-btn { min-width: 116px; }

/* Fullscreen mode — the whole player (stage + controls) fills the screen.
   Written as separate selectors so an unknown pseudo can't drop the rule. */
.player-shell:fullscreen { display: flex; flex-direction: column; justify-content: center; gap: 14px; width: 100vw; height: 100vh; padding: 18px; background: #0b0b0e; }
.player-shell:-webkit-full-screen { display: flex; flex-direction: column; justify-content: center; gap: 14px; width: 100vw; height: 100vh; padding: 18px; background: #0b0b0e; }
.player-shell:fullscreen .player-stage { height: 100%; max-height: calc(100vh - 116px); border-radius: 14px; }
.player-shell:-webkit-full-screen .player-stage { height: 100%; max-height: calc(100vh - 116px); border-radius: 14px; }
.player-shell:fullscreen .player-bar { width: 100%; max-width: 860px; margin: 0 auto; }
.player-shell:-webkit-full-screen .player-bar { width: 100%; max-width: 860px; margin: 0 auto; }
.player-shell:fullscreen .scene-count { color: #d9cdbf; }
.player-shell:-webkit-full-screen .scene-count { color: #d9cdbf; }

.player-bar { margin-top: 14px; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--gold)); width: 0%; transition: width .25s ease; }
.controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.controls .icon-btn { width: 52px; height: 52px; border-radius: 999px; border: 0; background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer; display: grid; place-items: center; color: var(--brown); transition: transform .12s ease; }
.controls .icon-btn.main { width: 68px; height: 68px; background: linear-gradient(145deg, var(--orange), var(--orange-dark)); color: #fff; box-shadow: 0 12px 24px rgba(242,116,31,.4); }
.controls .icon-btn:active { transform: scale(.93); }
.controls .icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.scene-count { text-align: center; color: var(--brown-soft); font-size: .9rem; margin-top: 8px; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--orange-soft); border-top-color: var(--orange); animation: spin 0.9s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--brown-soft); }
.center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }
.empty { text-align: center; padding: 60px 20px; color: var(--brown-soft); }
.empty .big { font-size: 3rem; margin-bottom: 8px; }

.toast { position: fixed; inset-block-end: 22px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90%; background: var(--brown); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); transition: all .25s ease; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

footer.site { text-align: center; padding: 30px 16px; color: var(--brown-soft); font-size: .88rem; }

@media (max-width: 540px) {
  .pad { padding: 20px; }
  .story-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .back-btn span { display: none; } /* arrow-only on small screens */
}

/* ── Feedback (floating button + modal) ───────────────────────────────────── */
.fab-feedback {
  position: fixed; inset-block-end: 22px; inset-inline-start: 22px; z-index: 55;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px;
  background: linear-gradient(145deg, var(--orange), var(--orange-dark)); color: #fff;
  font-family: var(--font-body); font-weight: 700; font-size: .95rem; cursor: pointer;
  box-shadow: 0 12px 26px rgba(242, 116, 31, .4);
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
}
.fab-feedback:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(242, 116, 31, .5); }
.fab-feedback:active { transform: translateY(0) scale(.97); }
@media (max-width: 540px) { .fab-feedback { inset-block-end: 16px; inset-inline-start: 16px; padding: 12px; } .fab-feedback .lbl { display: none; } }

.modal-overlay {
  position: fixed; inset: 0; z-index: 70; padding: 18px;
  display: grid; place-items: center;
  background: rgba(20, 12, 6, .55); backdrop-filter: blur(3px);
  animation: modalFade .2s ease;
}
.modal-card {
  position: relative; width: 100%; max-width: 460px; padding: 28px 26px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  animation: modalPop .22s ease;
}
.modal-card h3 { margin: 0 0 4px; }
.modal-close {
  position: absolute; inset-block-start: 14px; inset-inline-end: 14px;
  width: 34px; height: 34px; border-radius: 999px; border: 0;
  background: var(--cream-2); color: var(--brown); cursor: pointer; font-size: 1rem; line-height: 1;
}
.modal-close:hover { color: var(--orange-dark); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.stars { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.stars button {
  background: none; border: 0; cursor: pointer; padding: 2px;
  font-size: 2.1rem; line-height: 1; color: var(--line);
  transition: transform .12s ease, color .12s ease;
}
.stars button:hover { transform: scale(1.18); }
.stars button.on { color: var(--gold); }

/* ==========================================================================
   Dark theme — warm, low-glare. Toggled via html[data-theme="dark"]
   (set before paint in header.php; persisted in localStorage).
   ========================================================================== */
html[data-theme="dark"] {
  --orange: #ff9a57;
  --orange-dark: #ff8c42;
  --orange-soft: #3a2a1c;
  --cream: #1b1512;
  --cream-2: #241c16;
  --brown: #f2e7d9;
  --brown-soft: #b6a690;
  --green: #4cc07d;
  --green-soft: #1e3327;
  --red: #ef6b6b;
  --red-soft: #3a2020;
  --gold: #f5b942;
  --card: #261d17;
  --line: #3a2d24;
  --shadow: 0 16px 38px rgba(0, 0, 0, .5);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 540px at 90% -8%, #3a2415 0%, transparent 55%),
    radial-gradient(900px 480px at -10% 8%, #2a1d12 0%, transparent 50%),
    var(--cream);
}
html[data-theme="dark"] .topbar { background: rgba(27, 21, 18, .82); }
html[data-theme="dark"] .toast { background: #0e0b09; }
html[data-theme="dark"] .btn-primary { box-shadow: 0 10px 22px rgba(0, 0, 0, .45); }
/* Banners: some used hard-coded light backgrounds — re-tone for dark. */
html[data-theme="dark"] .banner.info { background: var(--orange-soft); color: #ffb27a; }
html[data-theme="dark"] .banner.ok   { background: var(--green-soft); color: #7fd9a6; }
html[data-theme="dark"] .banner.warn { background: #3a2f15; color: #ffd98a; }
html[data-theme="dark"] .banner.err  { background: var(--red-soft); color: #ff9a9a; }

/* ==========================================================================
   Landing page — قصص الأنبياء. Signature: a warm "نور" (light) glow, echoing
   the covers that replace the prophets' faces with light. Warm storybook brand.
   ========================================================================== */

/* Global polish: smooth anchor jumps (under the sticky header) + a11y focus. */
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

.btn-lg { padding: 15px 30px; font-size: 1.08rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: .82rem; color: var(--orange-dark); background: var(--orange-soft); padding: 7px 15px; border-radius: 999px; }
.eyebrow .spark { color: var(--gold); }

/* ── Hero ──────────────────────────────────────────────────────────────────*/
.lp-hero { position: relative; overflow: clip; padding: clamp(24px, 5vw, 60px) 0 clamp(30px, 5vw, 64px); }
.lp-hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 60px); align-items: center; }
.lp-hero-copy { max-width: 600px; }
.lp-title { font-size: clamp(2.1rem, 5.2vw, 3.6rem); line-height: 1.24; margin: 16px 0 14px; }
.lp-title .hl { color: var(--orange-dark); }
.lp-sub { font-size: clamp(1.02rem, 2vw, 1.2rem); color: var(--brown-soft); margin: 0 0 26px; max-width: 52ch; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-trust { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.lp-trust li { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .92rem; }
.lp-trust svg { color: var(--green); flex: 0 0 auto; }

.lp-hero-auth { position: relative; display: flex; justify-content: center; }
.lp-hero-auth .auth-card { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.nur-glow { position: absolute; inset: -10% -8% -14% -8%; z-index: 0; pointer-events: none;
  background: radial-gradient(58% 52% at 50% 40%, rgba(246,183,60,.55), rgba(255,140,66,.16) 46%, transparent 72%); }
.auth-head { text-align: center; margin-bottom: 16px; }
.auth-head .logo-orb { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 10px; font-size: 1.8rem; background: linear-gradient(145deg, var(--orange), var(--gold)); box-shadow: 0 10px 26px rgba(242,116,31,.4); }
.auth-head h2 { margin: 0 0 2px; }
.auth-head p { margin: 0; font-size: .9rem; }

/* ── Sections ──────────────────────────────────────────────────────────────*/
.lp-section { padding: clamp(34px, 6vw, 66px) 20px; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.lp-sec-head { text-align: center; margin-bottom: clamp(22px, 4vw, 40px); }
.lp-sec-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.35rem); margin: 12px 0 0; }

/* Steps — a real ordered sequence, so numbering carries meaning. */
.lp-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lp-steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 24px 24px; box-shadow: var(--shadow-sm); text-align: center; }
.lp-steps .num { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 999px; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: #fff; background: linear-gradient(145deg, var(--orange), var(--orange-dark)); box-shadow: 0 8px 18px rgba(242,116,31,.35); }
.lp-steps h3 { margin: 0 0 6px; }
.lp-steps p { margin: 0; color: var(--brown-soft); font-size: .96rem; }

/* Features */
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--orange); }
.feat .ic { font-size: 1.9rem; display: block; margin-bottom: 10px; }
.feat h3 { margin: 0 0 5px; font-size: 1.12rem; }
.feat p { margin: 0; color: var(--brown-soft); font-size: .94rem; }

/* Showcase — real covers on a نور glow */
.lp-showcase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 30px); max-width: 760px; margin: 0 auto; }
.poster { text-align: center; }
.poster-img { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 400 / 717; background: var(--cream-2); box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; }
.poster-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster:hover .poster-img { transform: translateY(-5px); box-shadow: 0 22px 44px rgba(74,55,40,.22); }
.poster h3 { margin: 14px 0 0; font-size: 1rem; }

/* ── Footer ────────────────────────────────────────────────────────────────*/
.site-footer { margin-top: clamp(40px, 7vw, 84px); background: var(--card); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 20px 20px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand .logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: linear-gradient(145deg, var(--orange), var(--gold)); color: #fff; box-shadow: var(--shadow-sm); }
.footer-brand strong { font-family: var(--font-display); font-size: 1.1rem; color: var(--brown); }
.footer-brand p { margin: 2px 0 0; font-size: .87rem; }
.footer-links { display: flex; gap: 8px 22px; flex-wrap: wrap; }
.footer-links a { color: var(--brown-soft); font-weight: 700; font-size: .92rem; }
.footer-links a:hover { color: var(--orange-dark); }
.footer-base { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 15px 20px 26px; margin-top: 0; border-top: 1px solid var(--line); font-size: .85rem; color: var(--brown-soft); }

/* ── Catalog skeletons (loading state) ────────────────────────────────────*/
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.sk-card { border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.sk-cover { aspect-ratio: 400 / 717; }
.sk-line { height: 12px; margin: 12px 14px; border-radius: 6px; }
.sk-line.short { width: 55%; margin-top: 0; }
.shimmer { background: linear-gradient(100deg, var(--cream-2) 30%, var(--orange-soft) 50%, var(--cream-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .shimmer { animation: none; } }

/* ── Landing responsive ───────────────────────────────────────────────────*/
@media (max-width: 860px) {
  .lp-hero-inner { grid-template-columns: 1fr; }
  .lp-hero-copy { max-width: none; text-align: center; margin-inline: auto; }
  .lp-cta, .lp-trust { justify-content: center; }
  .lp-steps, .lp-features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .lp-steps, .lp-features { grid-template-columns: 1fr; }
  .lp-showcase { grid-template-columns: 1fr 1fr; max-width: 340px; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

/* ==========================================================================
   Story extras (read · lessons · PDF) + the full PDF book + print styles.
   ========================================================================== */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.story-extras { max-width: 760px; margin: 26px auto 0; }
.extras-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.extras-tab { border: 1.5px solid var(--line); background: var(--card); color: var(--brown); font-family: var(--font-body); font-weight: 700; font-size: .92rem; padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: border .15s ease, background .15s ease, color .15s ease; }
.extras-tab:hover { border-color: var(--orange); }
.extras-tab.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.extras-print { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--green); color: #fff; font-family: var(--font-body); font-weight: 700; font-size: .92rem; padding: 10px 18px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-sm); }
.extras-print:hover { filter: brightness(1.06); }
.extras-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 34px); box-shadow: var(--shadow-sm); }
.panel-off { display: none; }

.read-chapter + .read-chapter { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }
.read-chapter h3 { font-size: 1.2rem; color: var(--orange-dark); margin: 0 0 10px; }
.read-chapter p { margin: 0 0 12px; font-size: 1.08rem; line-height: 2.1; }
.read-chapter p:last-child { margin-bottom: 0; }

.lessons-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.lessons-list li { position: relative; padding: 14px 52px 14px 16px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 600; line-height: 1.8; }
.lessons-list li::before { content: "💡"; position: absolute; inset-inline-end: 16px; inset-block-start: 12px; }
.read-lessons { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line); }
.read-lessons h3 { font-size: 1.15rem; margin: 0 0 12px; }

/* Full PDF book (book.php) */
.book-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
/* ==========================================================================
   PDF storybook — the printable picture book. One scene per page:
   cover → illustrated scene pages → lessons → closing page. Used by
   player.php (#printDoc, print-only) and book.php (#book, on-screen preview +
   print). The browser's "Save as PDF" shapes the Arabic and embeds the fonts
   automatically; these styles make that output read like a real children's book.
   ========================================================================== */

/* `.print-only` containers are hidden on screen and appear only in the PDF.
   The book.php #book is a `.pdf-book` WITHOUT `.print-only`, so the same pages
   double as an on-screen preview of exactly what will print. */
.print-only { display: none; }
.pdf-book { --pdf-gold: #caa24a; }

/* A single book page. On screen (book preview) it renders as a centered sheet;
   in print it becomes a full A4 page (see the @media print block). */
.pdf-page {
  position: relative;
  background: var(--card);
  color: var(--brown);
  overflow: hidden;
  break-inside: avoid;
}
.pdf-book:not(.print-only) .pdf-page {
  width: min(100%, 760px);
  margin: 0 auto 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: clamp(26px, 5vw, 50px);
}
.pdf-book:not(.print-only) .pdf-cover,
.pdf-book:not(.print-only) .pdf-end { min-height: 62vh; }
.pdf-book:not(.print-only) .pdf-illus { min-height: 300px; }
.pdf-book:not(.print-only) .pdf-illus img { max-height: 520px; }

/* Decorative inner frame — the thin gold storybook rule on every page. */
.pdf-page::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1.5px solid rgba(202, 162, 74, .5);
  border-radius: 14px;
  pointer-events: none;
}

/* ── Cover page ─────────────────────────────────────────────────────────── */
.pdf-cover {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background: radial-gradient(70% 55% at 50% 30%, var(--orange-soft) 0%, transparent 68%), var(--cream);
}
.pdf-cover-kicker { font-family: var(--font-body); font-weight: 700; color: var(--orange-dark); font-size: .98rem; margin-bottom: 18px; }
.pdf-cover-frame {
  width: min(64%, 280px); aspect-ratio: 400 / 717;
  border-radius: 18px; overflow: hidden;
  border: 6px solid #fff;
  box-shadow: 0 18px 40px rgba(74, 55, 40, .28), 0 0 0 2px var(--pdf-gold);
  background: var(--cream-2);
}
.pdf-cover-frame img { width: 100%; height: 100%; object-fit: cover; }
.pdf-cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 4rem; }
.pdf-cover-orb { width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; font-size: 3rem; background: linear-gradient(145deg, var(--orange), var(--gold)); box-shadow: 0 16px 34px rgba(242, 116, 31, .4); margin: 4px 0 18px; }
.pdf-cover-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 4.4vw, 2.4rem); line-height: 1.25; margin: 22px 0 0; color: var(--brown); max-width: 22ch; }
.pdf-cover-rule { width: 64px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--orange), var(--gold)); margin: 16px 0; }
.pdf-cover-count { color: var(--brown-soft); font-weight: 700; margin-bottom: 6px; }
.pdf-cover-brand { font-family: var(--font-body); font-weight: 700; color: var(--brown-soft); letter-spacing: .04em; }

/* ── Scene page ─────────────────────────────────────────────────────────── */
.pdf-scene { display: flex; flex-direction: column; }
.pdf-kicker { align-self: center; margin-bottom: 14px; font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: var(--orange-dark); background: var(--orange-soft); padding: 5px 16px; border-radius: 999px; }
.pdf-illus { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 0; margin-bottom: 18px; }
.pdf-illus img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 16px; box-shadow: 0 12px 28px rgba(74, 55, 40, .18); background: var(--cream-2); }
.pdf-caption { position: relative; text-align: center; background: var(--cream); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; margin: 0 auto; max-width: 56ch; }
.pdf-caption p { margin: 0; font-family: var(--font-body); font-weight: 600; font-size: 1.18rem; line-height: 1.9; color: var(--brown); }
.pdf-caption::before { content: "\201D"; position: absolute; top: -10px; inset-inline-start: 20px; color: var(--pdf-gold); font-size: 2rem; line-height: 1; }
.pdf-textonly .pdf-illus { display: none; }
.pdf-textonly { justify-content: center; }
.pdf-textonly .pdf-caption { background: transparent; border: 0; }
.pdf-textonly .pdf-caption p { font-size: 1.5rem; line-height: 2.1; }
.pdf-folio { align-self: center; margin-top: 16px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-body); font-weight: 700; font-size: .9rem; color: var(--orange-dark); background: #fff; border: 1.5px solid var(--pdf-gold); }

/* ── Lessons page ───────────────────────────────────────────────────────── */
.pdf-lessons { display: flex; flex-direction: column; }
.pdf-lessons-head { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 2px; }
.pdf-lessons-orb { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: linear-gradient(145deg, var(--orange), var(--gold)); }
.pdf-lessons-head h2 { margin: 0; font-size: clamp(1.4rem, 3.4vw, 1.9rem); color: var(--brown); }
.pdf-lessons-sub { text-align: center; color: var(--brown-soft); margin: 0 0 22px; }
.pdf-lessons-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 60ch; width: 100%; align-self: center; }
.pdf-lessons-list li { display: flex; gap: 14px; align-items: flex-start; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; font-weight: 600; line-height: 1.8; color: var(--brown); }
.pdf-li-dot { flex: 0 0 auto; width: 12px; height: 12px; margin-top: 8px; border-radius: 50%; background: linear-gradient(145deg, var(--orange), var(--gold)); }

/* ── Closing page ───────────────────────────────────────────────────────── */
.pdf-end { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; background: radial-gradient(60% 50% at 50% 40%, var(--orange-soft) 0%, transparent 70%), var(--cream); }
.pdf-end h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; }
.pdf-end p { margin: 2px 0; color: var(--brown-soft); }

/* ── Print → real PDF (the browser's "Save as PDF"). ────────────────────── */
@media print {
  @page { size: A4 portrait; margin: 0; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body { display: block !important; } /* drop the sticky-footer flex so pages paginate as normal block flow */
  main, .container { max-width: none !important; margin: 0 !important; padding: 0 !important; }

  /* Hide all site chrome + the interactive (screen) views. */
  .topbar, .site-footer, footer.site, .fab-feedback, .toast, .modal-overlay,
  #loading, #errorView, #bookErr, .back-btn, .head-actions, .book-head,
  #storyTitle, #playerShell, .story-extras, #audio { display: none !important; }

  /* Reveal the printable book (player.php #printDoc + book.php #book). */
  .print-only, .pdf-book { display: block !important; }

  .pdf-page {
    width: 210mm; height: 296mm;
    margin: 0; padding: 16mm 15mm;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    break-after: page; page-break-after: always; break-inside: avoid;
  }
  .pdf-page:last-child { break-after: auto; page-break-after: auto; }
  .pdf-page::after { inset: 8mm; }

  .pdf-cover, .pdf-end { display: flex !important; flex-direction: column; align-items: center; justify-content: center; }
  .pdf-scene, .pdf-lessons { display: flex !important; flex-direction: column; }

  /* Print typography (pt) + sizes tuned for A4. */
  .pdf-cover-frame { width: 92mm; }
  .pdf-cover-title { font-size: 26pt; }
  .pdf-caption p { font-size: 15pt; line-height: 1.85; }
  .pdf-textonly .pdf-caption p { font-size: 19pt; }
  .pdf-lessons-head h2 { font-size: 20pt; }
  .pdf-lessons-list li { font-size: 12.5pt; }
  a { color: inherit; text-decoration: none; }
}
