/* سَفَرُ السَّنَا — التصميم
   الفكرة: الصفحة نفسها فجرٌ يطلع. تبدأ بليل أزرق في الأعلى، وتنتهي بنهار كريمي في الأسفل،
   كأن القارئ يسافر من الليل إلى النور. ألوان «فجر» وخطوط الهوية من الجلسة 2. */
:root {
  --night: #1E2A4A;      /* أزرق ليلي */
  --night-2: #273760;    /* ليل يقترب من الفجر */
  --dusk: #3B4672;       /* أول ضوء */
  --dawn: #F4A259;       /* برتقالي الفجر */
  --peach: #F7C6A3;      /* خوخي */
  --cream: #FFF4E6;      /* كريمي */
  --sand: #F2B587;       /* رمل الغلاف، يصل الصورة بما تحتها */
  --teal: #2A9D8F;       /* فيروزي */
  --teal-ink: #1E7369;   /* فيروزي للنص على الفاتح */
  --on-night: #FFF4E6;
  --on-night-soft: rgba(255, 244, 230, 0.78);
  --ink: #1E2A4A;
  --ink-soft: #4A557A;

  --f-display: "Baloo Bhaijaan 2", "Tajawal", "Nunito", system-ui, sans-serif;
  --f-body-ar: "Tajawal", "Baloo Bhaijaan 2", system-ui, sans-serif;
  --f-body-la: "Nunito", "Baloo Bhaijaan 2", system-ui, sans-serif;

  --step--1: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --step-0: clamp(1.05rem, 1rem + 0.25vw, 1.18rem);
  --step-1: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  --step-2: clamp(1.7rem, 1.4rem + 1.3vw, 2.4rem);
  --step-3: clamp(2.6rem, 1.9rem + 3.4vw, 5rem);

  --wrap: 72rem;
  --radius: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--on-night);
  font-family: var(--f-body-ar);
  font-size: var(--step-0);
  line-height: 1.7;
  overflow-x: hidden;
}
html:not([lang="ar"]) body { font-family: var(--f-body-la); line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.2; margin: 0; text-wrap: balance; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--dawn); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px;
  background: var(--dawn); color: var(--night); padding: 8px 14px; border-radius: 10px; z-index: 50;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- الرأس ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--night);
}
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(30, 42, 74, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(247, 198, 163, 0.18);
}
.header-in {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding-block: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-ar { font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--cream); }
.brand-la { font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 600; font-size: 0.85rem; color: var(--dawn); letter-spacing: 0.02em; }

.main-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.main-nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  font-weight: 600; color: var(--on-night-soft);
}
.main-nav a:hover { color: var(--cream); background: rgba(255, 244, 230, 0.08); }
.main-nav a[aria-current="page"] { color: var(--night); background: var(--peach); }

.lang-switch {
  display: flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(255, 244, 230, 0.08); border: 1px solid rgba(247, 198, 163, 0.25);
}
.lang-switch button {
  font: 700 0.85rem/1 var(--f-body-la); color: var(--on-night-soft);
  background: none; border: 0; padding: 8px 10px; border-radius: 999px; cursor: pointer; min-width: 38px;
}
.lang-switch button[lang="ar"] { font-family: var(--f-body-ar); font-size: 1rem; }
.lang-switch button[aria-pressed="true"] { background: var(--dawn); color: var(--night); }

@media (max-width: 720px) {
  .main-nav { order: 3; width: 100%; margin-inline-start: 0; justify-content: center; }
  .main-nav a { padding: 6px 12px; font-size: 0.95rem; }
  .lang-switch { margin-inline-start: auto; }
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-display); font-weight: 700; font-size: 1.08rem;
  padding: 12px 26px; border-radius: 999px; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-dawn { background: var(--dawn); color: var(--night); }
.btn-dawn:hover { background: #F7B373; }
.btn-ghost { border-color: rgba(255, 244, 230, 0.6); color: var(--cream); }
.btn-ghost:hover { background: rgba(255, 244, 230, 0.1); }
.btn-ink { background: var(--night); color: var(--cream); }

/* ---------- البطل ---------- */
.hero { position: relative; background: var(--night); overflow: hidden; }
.hero picture img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-content {
  position: absolute; inset: 0 0 auto; text-align: center;
  padding-top: clamp(28px, 5vw, 72px);
}
.hero-content .wrap { display: grid; justify-items: center; gap: 10px; }
.hero-name {
  font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 800;
  font-size: var(--step-3); line-height: 1; color: var(--cream);
  text-shadow: 0 4px 30px rgba(30, 42, 74, 0.6);
}
.hero-latin {
  font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 700; color: var(--dawn);
  font-size: var(--step-1); line-height: 1;
}
.hero-slogan { font-family: var(--f-display); font-size: var(--step-1); color: var(--cream); font-weight: 600; }
.hero-below { background: var(--sand); color: var(--ink); }
.hero-below .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
  padding-block: 22px;
}
.hero-lead { max-width: 44ch; font-size: var(--step-0); font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-below .btn-ghost { border-color: var(--night); color: var(--night); }
.hero-below .btn-ghost:hover { background: rgba(30, 42, 74, 0.08); }

@media (max-width: 720px) {
  .hero picture img { aspect-ratio: 900 / 1178; }
  .hero-content { padding-top: 32px; }
  .hero-below .wrap { flex-direction: column; align-items: stretch; text-align: center; }
  .hero-lead { max-width: none; }
  .hero-actions { justify-content: center; }
}

/* ---------- الأقسام: من الليل إلى النهار ---------- */
.band { padding-block: clamp(56px, 8vw, 104px); }
.band-night { background: var(--night); color: var(--on-night); }
.band-dusk { background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 55%, var(--dusk) 100%); color: var(--on-night); }
.band-sunrise { background: linear-gradient(180deg, var(--dusk) 0%, #8A5E6B 38%, #E08E5A 72%, var(--dawn) 100%); color: var(--on-night); }
.band-day { background: linear-gradient(180deg, var(--dawn) 0%, var(--peach) 22%, var(--cream) 100%); color: var(--ink); }
.band h2 { font-size: var(--step-2); margin-bottom: 14px; }
.band .lead { max-width: 60ch; color: inherit; opacity: .9; }

/* الرحلة: ثلاث خطوات حقيقية بالترتيب */
.journey { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: step; }
.journey li { position: relative; padding-top: 6px; min-width: 0; }
.journey .step-icon { width: 64px; height: 64px; margin-bottom: 14px; }
.journey .step-num {
  font-family: var(--f-display); font-weight: 800; color: var(--dawn); font-size: 1rem;
  display: block; margin-bottom: 2px;
}
.journey h3 { font-size: var(--step-1); margin-bottom: 6px; }
.journey p { color: var(--on-night-soft); max-width: 34ch; }
.journey li + li::before {
  content: ""; position: absolute; top: 38px; inset-inline-start: -14px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--dawn); opacity: .6;
}
@media (max-width: 760px) {
  .journey { grid-template-columns: 1fr; gap: 28px; }
  .journey li + li::before { display: none; }
}

/* سنا وبدر */
.meet { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; margin-top: 32px; }
.meet-art { border-radius: var(--radius); overflow: hidden; box-shadow: 0 20px 50px rgba(10, 16, 34, 0.45); }
.meet-art img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.meet-list { display: grid; gap: 28px; }
.kid { display: grid; gap: 6px; min-width: 0; }
.kid-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.kid h3 { font-size: var(--step-2); }
.kid-age { font-weight: 700; color: var(--dawn); }
.kid p { color: var(--on-night-soft); max-width: 46ch; }
@media (max-width: 760px) { .meet { grid-template-columns: 1fr; } }

/* العشرة */
.ten-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.badge-soon {
  display: inline-block; font-family: var(--f-display); font-weight: 700; font-size: .95rem;
  padding: 4px 14px; border-radius: 999px; background: rgba(255, 244, 230, 0.16);
  border: 1px solid rgba(255, 244, 230, 0.45); color: var(--cream);
}
.ten-list {
  list-style: none; padding: 0; margin: 36px 0 18px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px;
}
.ten-item {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 6px;
  padding: 18px 10px 16px; border-radius: 18px;
  background: rgba(30, 42, 74, 0.32); border: 1px solid rgba(255, 244, 230, 0.18); min-width: 0;
}
.ten-item svg { width: 34px; height: 34px; fill: var(--peach); }
.ten-item.is-first { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.ten-item.is-first svg { fill: var(--dawn); }
.ten-num { font-family: var(--f-display); font-weight: 800; font-size: .9rem; opacity: .7; }
.ten-name { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.ten-tag { font-size: .8rem; font-weight: 700; color: var(--teal-ink); }
.ten-source { font-size: var(--step--1); opacity: .85; }
@media (max-width: 900px) { .ten-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* الوعد */
.promise { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; }
.promise li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: start; }
.promise svg { width: 48px; height: 48px; }
.promise h3 { font-size: var(--step-1); margin-bottom: 4px; }
.promise p { color: var(--ink-soft); max-width: 44ch; }
@media (max-width: 760px) { .promise { grid-template-columns: 1fr; } }

/* ---------- التذييل ---------- */
.site-footer { background: var(--cream); color: var(--ink); border-top: 1px solid rgba(30, 42, 74, 0.1); }
.footer-in {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px 40px; align-items: center;
  padding-block: 36px 28px;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-name { font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 800; font-size: 1.3rem; line-height: 1.1; }
.footer-slogan { color: var(--teal-ink); font-weight: 600; font-size: .95rem; }
.footer-mission { color: var(--ink-soft); max-width: 52ch; font-size: var(--step--1); }
.footer-contact p:first-child { font-weight: 700; font-size: var(--step--1); }
.email { font-family: var(--f-body-la); font-weight: 700; color: var(--teal-ink); user-select: all; }
.footer-copy { grid-column: 1 / -1; font-size: .85rem; color: var(--ink-soft); }
@media (max-width: 820px) { .footer-in { grid-template-columns: 1fr; } }

/* ---------- رأس الصفحات الداخلية ---------- */
.page-head { background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%); padding-block: clamp(40px, 6vw, 72px) clamp(32px, 5vw, 56px); }
.page-head h1 { font-size: var(--step-3); color: var(--cream); }
.page-head p { color: var(--on-night-soft); margin-top: 10px; max-width: 56ch; }
.page-body { background: linear-gradient(180deg, var(--peach) 0%, var(--cream) 320px); color: var(--ink); padding-block: clamp(36px, 5vw, 64px); }

/* ---------- المكتبة ---------- */
.series + .series { margin-top: 56px; }
.series-head h2 { font-size: var(--step-2); }
.series-head p { color: var(--ink-soft); margin-top: 6px; max-width: 60ch; }
.story-grid { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 22px; }
.story-card {
  display: flex; flex-direction: column; background: #FFFBF5; border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(30, 42, 74, 0.1); box-shadow: 0 12px 30px rgba(30, 42, 74, 0.12); min-width: 0;
}
.story-cover { background: var(--night); }
.story-cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cover-soon { aspect-ratio: 4 / 3; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, var(--dusk), var(--night) 70%); }
.cover-soon svg { width: 72px; height: 72px; fill: var(--dawn); opacity: .85; }
.story-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.story-body h3 { font-size: var(--step-1); }
.story-body > p:not(.story-meta) { color: var(--ink-soft); }
.story-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-soft); font-weight: 600; }
.story-meta span { background: rgba(42, 157, 143, 0.12); color: var(--teal-ink); padding: 2px 10px; border-radius: 999px; }
.story-body .btn, .story-body .badge-soon { margin-top: auto; align-self: flex-start; }
.story-card.is-soon .badge-soon { background: rgba(30, 42, 74, 0.08); border-color: rgba(30, 42, 74, 0.25); color: var(--ink); }
.story-card.is-soon .story-body h3 { color: var(--ink-soft); }

/* ---------- من نحن ---------- */
.about { display: grid; gap: 48px; max-width: 46rem; }
.about h2 { font-size: var(--step-2); margin-bottom: 10px; }
.about p { color: var(--ink-soft); }
.about .mission { font-family: var(--f-display); font-size: var(--step-1); line-height: 1.55; color: var(--ink); font-weight: 600; }
.about ol { margin: 0; padding-inline-start: 1.4em; display: grid; gap: 10px; color: var(--ink-soft); }
.about ol li::marker { font-family: var(--f-display); font-weight: 800; color: var(--teal-ink); }
.contact-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 14px; padding: 16px 20px; border-radius: 18px; background: #FFFBF5; border: 1px solid rgba(30, 42, 74, 0.12); }
.contact-box .email { font-size: 1.15rem; }
.contact-box .btn { padding: 8px 18px; font-size: .95rem; }

/* ---------- القارئ ---------- */
.reader-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--night); }
.reader-bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--night);
  border-bottom: 1px solid rgba(247, 198, 163, 0.18);
}
.reader-bar .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; color: var(--on-night-soft); padding: 6px 10px; border-radius: 999px; }
.back-link:hover { color: var(--cream); background: rgba(255, 244, 230, 0.08); }
.back-link svg, .ctrl svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .back-link svg, [dir="rtl"] .ctrl svg { transform: scaleX(-1); }
.reader-title { font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; color: var(--cream); flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reader { flex: 1; display: flex; flex-direction: column; }
#page-view { display: grid; gap: 16px; }
@media (max-width: 560px) {
  .reader-bar .wrap { flex-wrap: wrap; }
  .reader-bar .lang-switch { margin-inline-start: auto; }
  .reader-title { order: 3; flex-basis: 100%; white-space: normal; }
}
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; padding-block: 18px 8px; }
.stage .wrap { width: 100%; max-width: 60rem; display: grid; gap: 16px; }
.page-figure { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--night-2); box-shadow: 0 24px 60px rgba(5, 10, 25, 0.55); }
.page-figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; max-height: 62vh; }
.page-text {
  background: var(--cream); color: var(--ink); border-radius: var(--radius);
  padding: clamp(16px, 3vw, 26px) clamp(18px, 3.4vw, 32px);
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.45rem); line-height: 1.75; font-weight: 500;
}
html:not([lang="ar"]) .page-text { line-height: 1.6; }
.end-view { text-align: center; display: grid; justify-items: center; gap: 14px; padding-block: 40px; }
.end-view svg { width: 72px; height: 72px; fill: var(--dawn); }
.end-view h2 { font-size: var(--step-2); color: var(--cream); }
.end-view p { color: var(--on-night-soft); max-width: 40ch; }
.end-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px; }
.controls { padding-block: 12px calc(16px + env(safe-area-inset-bottom, 0px)); }
.controls .wrap { max-width: 60rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ctrl {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--dawn); color: var(--night);
}
.ctrl:disabled { background: rgba(255, 244, 230, 0.12); color: rgba(255, 244, 230, 0.35); cursor: default; }
.mid { display: grid; justify-items: center; gap: 8px; }
.counter { font-family: var(--f-display); font-weight: 700; color: var(--on-night-soft); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.dots { display: flex; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 244, 230, 0.25); }
.dot.done { background: var(--peach); }
.dot.on { background: var(--dawn); transform: scale(1.3); }
.reader-missing { text-align: center; display: grid; justify-items: center; gap: 18px; padding: 80px 16px; color: var(--on-night-soft); }

/* ---------- 404 ---------- */
.nf { text-align: center; display: grid; justify-items: center; gap: 14px; padding-block: 96px; }
.nf svg { width: 80px; height: 80px; fill: var(--dawn); }
.nf h1 { font-size: var(--step-2); color: var(--cream); }
.nf p { color: var(--on-night-soft); }

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