/* =========================================================
   DESIGN TOKENS
   Visual identity: "illuminated manuscript meets modern classroom"
   Palette drawn from aged parchment, walnut ink, antique gold leaf,
   and a single deep Coptic red used only as a spark, not a base.
   ========================================================= */
:root {
  --color-parchment: #f2e8d3;
  --color-parchment-deep: #e8dabb;
  --color-card: #fbf5e7;
  --color-card-raised: #fffdf7;
  --color-ink: #3a2a1c;
  --color-ink-soft: #6e5a44;
  --color-ink-faint: #9c8a72;
  --color-gold: #a9802f;
  --color-gold-deep: #7d5e21;
  --color-gold-pale: #e8d5a3;
  --color-red: #7a2318;
  --color-red-soft: #f3ddd6;
  --color-success: #3f6b4a;
  --color-success-soft: #dbe8dc;
  --color-line: #d8c6a0;

  --font-display: "Amiri", "Traditional Arabic", serif;
  --font-body: "Cairo", "Segoe UI", Tahoma, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 10px 30px -12px rgba(58, 42, 28, 0.28);
  --shadow-soft: 0 4px 14px -6px rgba(58, 42, 28, 0.18);
  --max-width: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  direction: rtl;
  background: var(--color-parchment);
  color: var(--color-ink);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(169, 128, 47, 0.05), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(122, 35, 24, 0.04), transparent 45%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-ink);
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; color: var(--color-ink-soft); }
a { color: var(--color-gold-deep); }
img, video { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 14px 30px;
  border-radius: 999px;
  border: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-deep) 100%);
  color: var(--color-card-raised);
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover {
  box-shadow: 0 10px 22px -8px rgba(125, 94, 33, 0.55);
  transform: translateY(-2px);
}
.btn-secondary {
  background: transparent;
  color: var(--color-ink);
  border: 1.5px solid var(--color-line);
}
.btn-secondary:hover { border-color: var(--color-gold); color: var(--color-gold-deep); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-gold-deep);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.eyebrow::before {
  content: "";
  width: 20px; height: 1.5px;
  background: var(--color-gold);
  display: inline-block;
}

/* Animations ------------------------------------------------ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.5s ease both; }
.animate-slide-up { animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   NAVBAR
   ========================================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(242, 232, 211, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.navbar__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.navbar__brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
}
.navbar__brand-mark { color: var(--color-red); font-size: 1.4rem; }
.navbar__links--desktop { display: flex; gap: 6px; }
.navbar__link {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--color-ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.navbar__link:hover { background: var(--color-gold-pale); color: var(--color-ink); }
.navbar__link.is-active { background: var(--color-gold); color: var(--color-card-raised); }
.navbar__toggle { display: none; background: none; border: none; width: 44px; height: 44px; }
.navbar__burger, .navbar__burger::before, .navbar__burger::after {
  display: block; width: 24px; height: 2px;
  background: var(--color-ink); border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  position: relative; margin: 0 auto;
}
.navbar__burger::before, .navbar__burger::after { content: ""; position: absolute; }
.navbar__burger::before { top: -7px; }
.navbar__burger::after { top: 7px; }
.navbar__burger.is-open { background: transparent; }
.navbar__burger.is-open::before { transform: rotate(45deg); top: 0; }
.navbar__burger.is-open::after { transform: rotate(-45deg); top: 0; }
.navbar__links--mobile {
  display: none;
  flex-direction: column;
  padding: 10px 20px 20px;
  gap: 4px;
  border-top: 1px solid var(--color-line);
}
.navbar__links--mobile.is-open { display: flex; }
@media (max-width: 860px) {
  .navbar__brand {
    font-size: 1.28rem;
    gap: 8px;
  }
  .navbar__brand-mark {
    font-size: 1.55rem;
  }
  .navbar__links--desktop { display: none; }
  .navbar__toggle { display: block; }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 90px;
  background: linear-gradient(180deg, var(--color-parchment) 0%, var(--color-parchment-deep) 100%);
  border-bottom: 1px solid var(--color-line);
}
.hero__ornament { position: absolute; top: 20px; right: 24px; transform: scaleX(-1); opacity: 0.85; }
.hero__inner { display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 48px; }
.hero__title { font-size: clamp(2.4rem, 4.5vw, 3.6rem); line-height: 1.15; margin-bottom: 0.4em; }
.hero__subtitle { font-size: 1.15rem; max-width: 46ch; margin-bottom: 1.8em; }
.hero__cta { font-size: 1.05rem; }
.hero__illustration { display: flex; justify-content: center; }
.hero__illustration-frame {
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--color-card-raised), var(--color-gold-pale));
  border: 3px solid var(--color-gold);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
}
.hero__illustration-image { width: 72%; height: 72%; object-fit: contain; display: block; }
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__subtitle { margin-inline: auto; }
  .hero__illustration { order: -1; }
  .hero__illustration-frame { width: 200px; height: 200px; }
  .hero__illustration-image { width: 76%; height: 76%; }
  .hero__ornament { display: none; }
}

/* =========================================================
   HOW IT WORKS
   ========================================================= */
.how { padding: 56px 0; }
.how__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.how__step {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  text-align: center;
}
.how__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--color-gold-pale); color: var(--color-gold-deep);
  font-size: 1.4rem; margin-bottom: 16px;
}
.how__title { font-size: 1.2rem; margin-bottom: 0.35em; }
.how__text { margin: 0; font-size: 0.95rem; }
@media (max-width: 760px) { .how__grid { grid-template-columns: 1fr; } }

/* =========================================================
   PROGRESS BAR
   ========================================================= */
.progress-bar { display: flex; align-items: center; gap: 10px; }
.progress-bar__track { flex: 1; height: 8px; border-radius: 999px; background: var(--color-gold-pale); overflow: hidden; }
.progress-bar__fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-gold-deep) 100%);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-bar__label { font-size: 0.85rem; font-weight: 700; color: var(--color-ink-soft); white-space: nowrap; }

/* =========================================================
   DASHBOARD + SAINT CARD
   ========================================================= */
.dashboard { padding: 30px 0 90px; }
.dashboard__header { text-align: center; max-width: 560px; margin: 0 auto 40px; }
.dashboard__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
@media (max-width: 980px) { .dashboard__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .dashboard__grid { grid-template-columns: 1fr; } }

.saint-card {
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex; flex-direction: column;
}
.saint-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card); }
.saint-card__image-wrap { position: relative; aspect-ratio: 4 / 3; background: var(--color-gold-pale); }
.saint-card__image { width: 100%; height: 100%; object-fit: cover; }
.saint-card__image-fallback {
  display: none; position: absolute; inset: 0;
  align-items: center; justify-content: center;
  font-size: 3rem; color: var(--color-gold-deep);
}
.saint-card__badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--color-success); color: #fff;
  font-size: 0.78rem; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
}
.saint-card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.saint-card__name { font-size: 1.2rem; margin: 0; }
.saint-card__title { margin: -6px 0 4px; font-size: 0.9rem; color: var(--color-gold-deep); font-weight: 600; }
.saint-card__meta { margin: 0; font-size: 0.82rem; color: var(--color-ink-faint); }
.saint-card__cta { margin-top: 8px; width: 100%; }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer { border-top: 1px solid var(--color-line); padding: 32px 0; text-align: center; background: var(--color-parchment-deep); }
.site-footer__inner p { margin: 0 0 4px; font-weight: 600; color: var(--color-ink-soft); }
.site-footer__muted { font-size: 0.85rem; color: var(--color-ink-faint); font-weight: 400 !important; }

/* =========================================================
   SAINT PAGE HEADER
   ========================================================= */
.saint-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--color-parchment-deep) 0%, var(--color-parchment) 100%);
  border-bottom: 1px solid var(--color-line);
  padding: 30px 0 40px;
}
.saint-header__ornament { position: absolute; top: 14px; right: 20px; transform: scaleX(-1); opacity: 0.8; }
.saint-header__back { display: inline-block; color: var(--color-ink-soft); text-decoration: none; font-weight: 600; font-size: 0.9rem; margin-bottom: 20px; }
.saint-header__back:hover { color: var(--color-gold-deep); }
.saint-header__content { display: flex; align-items: center; gap: 26px; margin-bottom: 26px; }
.saint-header__portrait {
  position: relative; width: 110px; height: 110px; border-radius: 50%;
  overflow: hidden; border: 3px solid var(--color-gold); flex-shrink: 0;
  box-shadow: var(--shadow-soft);
}
.saint-header__portrait img { width: 100%; height: 100%; object-fit: cover; }
.saint-header__portrait-fallback {
  display: none; position: absolute; inset: 0;
  align-items: center; justify-content: center;
  font-size: 2.4rem; color: var(--color-gold-deep); background: var(--color-gold-pale);
}
.saint-header__name { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 0.25em; }
.saint-header__description { margin: 0; max-width: 62ch; }
.saint-header__progress { max-width: 460px; }
.saint-header__progress-label { display: block; font-weight: 700; font-size: 0.9rem; color: var(--color-gold-deep); margin-bottom: 8px; }

.saint-main { padding: 40px 0 90px; max-width: 760px; }
.saint-notice {
  background: var(--color-gold-pale); color: var(--color-ink);
  border-radius: var(--radius-md); padding: 12px 18px;
  font-size: 0.9rem; font-weight: 600; margin-bottom: 22px;
}
.saint-notice--warning { background: var(--color-red-soft); color: var(--color-red); }

.saint-steps { display: flex; gap: 10px; list-style: none; margin: 0 0 26px; padding: 0; }
.saint-steps__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; opacity: 0.55; }
.saint-steps__item.is-current, .saint-steps__item.is-done { opacity: 1; }
.saint-steps__dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  background: var(--color-gold-pale); color: var(--color-gold-deep);
}
.saint-steps__item.is-current .saint-steps__dot { background: var(--color-gold); color: var(--color-card-raised); }
.saint-steps__item.is-done .saint-steps__dot { background: var(--color-success); color: #fff; }
.saint-steps__label { font-size: 0.78rem; font-weight: 600; color: var(--color-ink-soft); display: none; }
.saint-flow__quiz-cta { display: block; margin: 24px auto 0; }
@media (min-width: 640px) { .saint-steps__label { display: block; } }
@media (max-width: 560px) {
  .saint-header__content { flex-direction: column; text-align: center; }
  .saint-header__progress { margin: 0 auto; }
}

/* =========================================================
   VIDEO PLAYER
   ========================================================= */
.video-player { background: var(--color-card); border: 1px solid var(--color-line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
.video-player__frame { aspect-ratio: 16 / 9; background: #1c140c; display: flex; align-items: center; justify-content: center; }
.video-player__video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-player__error { color: #f2e8d3; text-align: center; padding: 24px; }
.video-player__error-icon { font-size: 2rem; color: var(--color-red); display: block; margin-bottom: 10px; }
.video-player__error-hint { font-size: 0.8rem; opacity: 0.75; word-break: break-all; }
.video-player__info { padding: 22px 26px 26px; }
.video-player__title { font-size: 1.3rem; margin-bottom: 0.3em; }
.video-player__description { margin-bottom: 0; }
.video-player__hint { margin: 12px 0 0; font-size: 0.85rem; color: var(--color-gold-deep); font-weight: 600; }
.video-player__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.video-player__nav { min-width: 140px; }
.video-player__nav:disabled { opacity: 0.45; cursor: not-allowed; }

/* =========================================================
   QUIZ + QUESTION
   ========================================================= */
.quiz { background: var(--color-card); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: 28px 30px 32px; box-shadow: var(--shadow-soft); }
.quiz--empty { text-align: center; color: var(--color-ink-faint); }
.quiz__progress { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 0.85rem; font-weight: 700; color: var(--color-ink-soft); }
.quiz__dots { display: flex; gap: 6px; }
.quiz__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-gold-pale); }
.quiz__dot.is-filled { background: var(--color-gold); }
.quiz__next { margin-top: 22px; width: 100%; }
.quiz__summary { text-align: center; padding: 20px 10px; }
.quiz__summary-title { font-size: 1.6rem; margin-bottom: 0.2em; }
.quiz__summary-score { font-size: 2rem; font-weight: 800; color: var(--color-gold-deep); margin-bottom: 0.2em; }
.quiz__summary-sub { margin-bottom: 22px; color: var(--color-ink-soft); }

.question { padding: 4px 0; }
.question__text { font-size: 1.15rem; font-weight: 700; color: var(--color-ink); margin-bottom: 18px; }
.question__options { display: flex; flex-direction: column; gap: 12px; }
.question__option {
  display: flex; align-items: center; gap: 10px; text-align: right;
  padding: 14px 18px; border: 1.5px solid var(--color-line); border-radius: var(--radius-md);
  background: var(--color-card-raised); font-size: 1rem; color: var(--color-ink);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.question__option--idle:hover { border-color: var(--color-gold); background: var(--color-gold-pale); }
.question__option--idle:active { transform: scale(0.99); }
.question__option-marker { font-weight: 800; width: 18px; flex-shrink: 0; }
.question__option--correct { border-color: var(--color-success); background: var(--color-success-soft); color: var(--color-success); font-weight: 700; }
.question__option--wrong { border-color: var(--color-red); background: var(--color-red-soft); color: var(--color-red); font-weight: 700; }
.question__option--disabled { opacity: 0.55; }
.question__option:disabled { cursor: not-allowed; }
.question__feedback { margin-top: 18px; padding: 16px 20px; border-radius: var(--radius-md); font-weight: 600; }
.question__feedback p { margin: 0 0 4px; color: inherit; }
.question__feedback p:last-child { margin-bottom: 0; }
.question__feedback--correct { background: var(--color-success-soft); color: var(--color-success); }
.question__feedback--wrong { background: var(--color-red-soft); color: var(--color-red); }

/* =========================================================
   COMPLETION SCREEN
   ========================================================= */
.completion {
  position: relative; text-align: center;
  background: var(--color-card); border: 1px solid var(--color-gold-pale);
  border-radius: var(--radius-lg); padding: 60px 30px; overflow: hidden;
  box-shadow: var(--shadow-card);
}
.completion__ornament { position: absolute; top: 18px; }
.completion__ornament--right { right: 18px; transform: scaleX(-1); }
.completion__ornament--left { left: 18px; }
.completion__emoji { font-size: 3rem; display: block; margin-bottom: 16px; }
.completion__title { font-size: 1.8rem; max-width: 30ch; margin: 0 auto 0.3em; }
.completion__text { margin-bottom: 4px; }
.completion__keepsake { font-weight: 700; color: var(--color-gold-deep); margin-bottom: 28px; }
.completion__download { font-size: 1.05rem; }
.completion__error { margin-top: 16px; font-size: 0.85rem; color: var(--color-red); }
@media (max-width: 600px) {
  .completion { padding: 46px 20px; }
  .completion__ornament { display: none; }
}

/* =========================================================
   PAGE LOGOS (left / right)
   Positioned inside the header so they stay visible with the navbar.
   ========================================================= */
.page-logo {
  position: absolute;
  top: 8px;
  width: 200px;
  height: 60px;
  object-fit: contain;
  z-index: 60;
  pointer-events: none;
}
.page-logo--left { left: 16px; }
.page-logo--right { right: 16px; }

@media (max-width: 860px) {
  .page-logo {
    display: block;
    width: 128px;
    height: 40px;
    top: 12px;
  }

  .page-logo--left { left: 10px; }
  .page-logo--right { right: 10px; }
}
