/* العيينة · uyayna.basem.ai
 * Heritage Najdi palette: mud-brick terracotta, sand cream, palm green, ink dark.
 * RTL throughout. Mobile-first.
 */

:root {
  --ink:        #2a1810;
  --ink-soft:   #4a3528;
  --ink-mute:   #7a604f;
  --sand:       #f4ead7;
  --sand-2:     #ede0c5;
  --sand-3:     #e1cfaa;
  --paper:      #fbf6ec;
  --brick:      #8b3a1f;
  --brick-2:    #6e2d18;
  --terra:      #b8714a;
  --gold:       #c9a961;
  --gold-soft:  #e6d49a;
  --palm:       #2f5132;
  --palm-2:     #3d6b41;
  --line:       rgba(42, 24, 16, 0.14);
  --line-soft:  rgba(42, 24, 16, 0.07);
  --shadow-sm:  0 1px 2px rgba(42, 24, 16, 0.07);
  --shadow:     0 6px 24px rgba(42, 24, 16, 0.10);
  --shadow-lg:  0 18px 60px rgba(42, 24, 16, 0.18);
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --maxw: 1180px;
  --display: 'Reem Kufi', 'Amiri', serif;
  --body:    'Tajawal', system-ui, sans-serif;
  --serif:   'Amiri', serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(201,169,97,0.10), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(139,58,31,0.06), transparent 40%);
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--brick); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brick-2); }

p { margin: 0 0 1em; }
strong { color: var(--ink); font-weight: 700; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 9999;
}
.skip:focus { inset-inline-start: 8px; }

/* ─────── topbar ─────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 246, 236, 0.86);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-block-end: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brick), var(--terra));
  color: var(--paper);
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}
.brand-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.nav { display: flex; gap: clamp(8px, 2vw, 22px); flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 4px;
  position: relative;
}
.nav a:hover { color: var(--brick); }
.nav a::after {
  content: '';
  position: absolute;
  inset-inline: 4px;
  bottom: 0;
  height: 2px;
  background: var(--brick);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform .25s;
}
.nav a:hover::after { transform: scaleX(1); }

@media (max-width: 760px) {
  .nav { display: none; }
  .topbar-inner { height: 58px; }
}

/* ─────── hero ─────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(60px, 10vh, 120px) 0 clamp(80px, 14vh, 160px);
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(139, 58, 31, 0.10), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--sand) 60%, var(--sand-2) 100%);
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(139, 58, 31, 0.025) 0 2px,
      transparent 2px 14px
    );
  opacity: .8;
}
.hero-bg::after {
  /* abstract palm/dome silhouettes via SVG data URI */
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 180px;
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: cover;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 200' preserveAspectRatio='none'><path d='M0 200 L0 140 L60 140 L80 110 L100 140 L160 140 L180 90 L200 140 L300 140 L320 100 L340 140 L450 140 L470 80 L490 140 L600 140 L620 110 L640 140 L760 140 L780 70 L800 140 L900 140 L920 110 L940 140 L1080 140 L1100 90 L1120 140 L1240 140 L1260 100 L1280 140 L1380 140 L1400 110 L1420 140 L1440 140 L1440 200 Z' fill='%238b3a1f' opacity='0.18'/></svg>");
}

.eyebrow {
  font-size: 13.5px;
  letter-spacing: 0.05em;
  color: var(--brick);
  font-weight: 500;
  margin-bottom: 20px;
  text-transform: none;
}
.title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(72px, 13vw, 168px);
  line-height: 0.95;
  margin: 0 0 24px;
  letter-spacing: -0.01em;
  background: linear-gradient(160deg, var(--ink) 0%, var(--brick-2) 60%, var(--brick) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0,0,0,0.02);
}
.kicker {
  font-size: clamp(17px, 1.6vw, 22px);
  line-height: 1.85;
  color: var(--ink-soft);
  max-width: 760px;
  margin-bottom: 56px;
}
.hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(20px, 3vw, 48px);
  padding-block: 28px;
  border-block-start: 1px solid var(--line);
  border-block-end: 1px solid var(--line);
  max-width: 1000px;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 6px; }
.hero-meta-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 36px;
  color: var(--brick-2);
  line-height: 1;
}
.hero-meta-lbl {
  font-size: 13.5px;
  color: var(--ink-mute);
  line-height: 1.5;
}

.hero-scroll {
  position: absolute;
  inset-inline: 0;
  bottom: 26px;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.hero-scroll span {
  display: block;
  width: 1px; height: 36px;
  background: linear-gradient(180deg, transparent, var(--ink-mute) 50%, transparent);
  animation: scroll-pulse 2.4s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%,100% { opacity: 0.2; transform: translateY(-4px); }
  50% { opacity: 1; transform: translateY(4px); }
}

/* ─────── sections ─────── */
.section {
  padding-block: clamp(70px, 10vh, 130px);
  position: relative;
}
.section + .section { border-top: 1px solid var(--line-soft); }
.section-eyebrow {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--brick);
  font-weight: 500;
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.18;
  margin: 0 0 32px;
  color: var(--ink);
  letter-spacing: -0.005em;
  max-width: 22ch;
}
.lede {
  font-size: clamp(17px, 1.4vw, 20px);
  color: var(--ink-soft);
  line-height: 1.85;
  max-width: 70ch;
  margin-bottom: 40px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.two-col.reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 880px) {
  .two-col, .two-col.reverse { grid-template-columns: 1fr; }
}

.col-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 84px;
}
.col-card h3 {
  font-family: var(--display);
  margin: 0 0 18px;
  font-size: 19px;
  color: var(--brick-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.data {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  margin: 0;
  font-size: 14.5px;
}
.data dt {
  color: var(--ink-mute);
  font-weight: 500;
  white-space: nowrap;
}
.data dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

/* ─────── grids ─────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(20px, 2.5vw, 32px);
  margin-top: 8px;
}
.grid-3 article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 28px 26px;
  position: relative;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.grid-3 article:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: var(--shadow);
}
.grid-3 article.featured {
  background: linear-gradient(160deg, var(--ink) 0%, #3a2418 100%);
  color: var(--sand);
  border-color: var(--ink);
}
.grid-3 article.featured h3 { color: var(--gold-soft); }
.grid-3 article.featured strong { color: var(--paper); }
.grid-3 h3 {
  font-family: var(--display);
  font-size: 20px;
  margin: 0 0 14px;
  color: var(--brick-2);
  font-weight: 600;
}
.grid-3 p { margin: 0; font-size: 15.5px; line-height: 1.85; color: inherit; opacity: 0.92; }

/* quote */
.quote {
  margin: 0;
  background:
    linear-gradient(160deg, var(--sand-2), var(--sand-3));
  border-radius: var(--r-lg);
  padding: 40px 44px;
  position: relative;
  font-family: var(--serif);
  box-shadow: var(--shadow-sm);
}
.quote::before {
  content: '\201D';
  position: absolute;
  top: 8px;
  inset-inline-start: 22px;
  font-size: 80px;
  color: var(--brick);
  opacity: 0.25;
  font-family: serif;
  line-height: 1;
}
.quote p {
  font-size: clamp(18px, 1.7vw, 24px);
  line-height: 1.95;
  color: var(--ink);
  margin: 0 0 18px;
  font-style: italic;
}
.quote cite {
  font-style: normal;
  font-family: var(--body);
  color: var(--ink-mute);
  font-size: 14px;
}

/* ─────── steps (sheikh section) ─────── */
.steps {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 18px;
  counter-reset: step;
}
.steps li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 30px 24px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px 26px;
  align-items: start;
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.steps li:hover {
  border-color: var(--terra);
  transform: translateX(-4px);
  box-shadow: var(--shadow-sm);
}
.step-num {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  background: linear-gradient(160deg, var(--brick), var(--terra));
  color: var(--paper);
  box-shadow: 0 4px 14px rgba(139, 58, 31, 0.30);
}
.steps h3 {
  margin: 6px 0 4px;
  font-family: var(--display);
  font-size: 21px;
  color: var(--ink);
  font-weight: 600;
}
.steps p { margin: 0; color: var(--ink-soft); font-size: 15.5px; line-height: 1.9; }

/* ─────── stats ─────── */
.col-stat {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 22px;
  text-align: center;
  transition: border-color .25s, transform .25s;
}
.stat:hover { border-color: var(--gold); transform: translateY(-2px); }
.stat-n {
  display: block;
  font-family: var(--display);
  font-size: 42px;
  font-weight: 700;
  color: var(--brick-2);
  line-height: 1;
  margin-bottom: 10px;
}
.stat-l {
  display: block;
  font-size: 13.5px;
  color: var(--ink-mute);
  line-height: 1.5;
}

/* ─────── heritage cards ─────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 28px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform .3s, box-shadow .3s, border-color .3s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(201,169,97,0.10));
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--gold);
}
.card:hover::before { opacity: 1; }
.card-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--sand-2);
  color: var(--brick-2);
  font-size: 24px;
  font-weight: 700;
}
.card h3 {
  font-family: var(--display);
  margin: 0;
  font-size: 19px;
  color: var(--ink);
  font-weight: 600;
}
.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
}
.card-meta {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--ink-mute);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  letter-spacing: 0.02em;
}
.card-jubayla { background: linear-gradient(160deg, var(--paper) 0%, var(--sand) 100%); }

/* ─────── timeline ─────── */
.timeline {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  inset-inline-end: 22px;
  inset-block: 12px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--line) 8%, var(--line) 92%, transparent);
}
.timeline li {
  position: relative;
  padding-inline-end: 56px;
  padding-inline-start: 0;
  padding-block: 14px;
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: 12px 28px;
  align-items: baseline;
}
.t-dot {
  position: absolute;
  inset-inline-end: 14px;
  top: 24px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--terra);
  box-shadow: 0 0 0 4px rgba(184, 113, 74, 0.10);
  z-index: 1;
}
.t-pivot .t-dot {
  background: linear-gradient(160deg, var(--brick), var(--terra));
  border-color: var(--brick-2);
  box-shadow: 0 0 0 6px rgba(139, 58, 31, 0.18);
  width: 22px; height: 22px;
  inset-inline-end: 12px;
  top: 22px;
}
.t-era .t-dot {
  background: var(--sand-3);
  border-color: var(--ink-mute);
}
.t-date {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  color: var(--brick-2);
  line-height: 1.5;
  text-align: end;
  padding-top: 4px;
}
.t-pivot .t-date { color: var(--brick); font-size: 16px; }
.t-body {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 26px;
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.timeline li:hover .t-body {
  border-color: var(--terra);
  transform: translateX(-3px);
  box-shadow: var(--shadow-sm);
}
.t-pivot .t-body {
  background: linear-gradient(160deg, var(--paper), var(--sand));
  border-color: var(--gold);
}
.t-body h3 {
  font-family: var(--display);
  margin: 0 0 8px;
  font-size: 19px;
  color: var(--ink);
  font-weight: 600;
}
.t-body p {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.85;
}

@media (max-width: 720px) {
  .timeline li {
    grid-template-columns: 1fr;
    padding-inline-end: 42px;
  }
  .t-date { text-align: start; padding-top: 0; font-size: 14px; }
  .t-dot { top: 20px; inset-inline-end: 6px; }
  .timeline::before { inset-inline-end: 14px; }
}

/* ─────── footer ─────── */
.footer {
  background: linear-gradient(180deg, var(--ink) 0%, #1d100a 100%);
  color: var(--sand);
  margin-top: 80px;
}
.footer h3 {
  font-family: var(--display);
  font-size: 17px;
  margin: 0 0 16px;
  color: var(--gold-soft);
  font-weight: 600;
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px;
  padding-block: 60px;
}
.footer p, .footer li { color: rgba(244, 234, 215, 0.78); font-size: 14.5px; line-height: 1.8; }
.footer a { color: var(--gold-soft); }
.footer a:hover { color: var(--paper); }
.sources {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-block: 22px;
  border-top: 1px solid rgba(244, 234, 215, 0.14);
  font-size: 13px;
  color: rgba(244, 234, 215, 0.55);
}

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

/* ═════════════════════════════════════════════════════════════
   Interactive features — appended in v2
   1. date toggle  2. era filter  3. map  4. glossary
   5. progress bar  6. theme  7. quiz  8. since  9. trivia
   ═════════════════════════════════════════════════════════════ */

/* ───── feature 5: scroll progress bar ───── */
.progress {
  position: fixed;
  top: 0; inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brick), var(--terra), var(--gold));
  transform: scaleX(0);
  transform-origin: 100% 50%;          /* RTL: grows from right (start of reading) */
  z-index: 100;
  transition: transform .12s linear;
  pointer-events: none;
}

/* ───── topbar control cluster ───── */
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ───── feature 1: date toggle (segmented control) ───── */
.date-toggle {
  display: inline-flex;
  background: var(--sand-2);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--line);
}
.date-toggle button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  border-radius: 999px;
  transition: background .2s, color .2s, transform .15s;
  line-height: 1;
}
.date-toggle button:hover { color: var(--ink); }
.date-toggle button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--brick-2);
  box-shadow: var(--shadow-sm);
}

/* ───── feature 6: theme toggle ───── */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background .2s, color .2s, transform .2s;
  flex: 0 0 36px;
}
.theme-toggle:hover { color: var(--brick); transform: rotate(15deg); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.theme-icon.theme-moon { fill: currentColor; stroke: none; }
.theme-icon.theme-sun  { fill: none; }
[data-theme="light"] .theme-moon { display: none; }
[data-theme="dark"]  .theme-sun  { display: none; }
:root:not([data-theme]) .theme-moon { display: none; }

@media (max-width: 760px) {
  .topbar-controls { gap: 6px; }
  .date-toggle button { padding: 5px 8px; font-size: 11.5px; }
}

/* ───── scroll-spy active nav link ───── */
.nav a.current { color: var(--brick); }
.nav a.current::after { transform: scaleX(1); }

/* ───── feature 2: era filter chips ───── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 8px 0 36px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: sticky;
  top: 70px;
  z-index: 30;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--terra); color: var(--brick); }
.chip.active {
  background: linear-gradient(160deg, var(--brick), var(--terra));
  color: var(--paper);
  border-color: var(--brick-2);
  box-shadow: 0 4px 14px rgba(139, 58, 31, 0.30);
}
.timeline > li { transition: opacity .35s, filter .35s; }
.timeline > li.faded {
  opacity: 0.18;
  filter: grayscale(0.6);
  pointer-events: none;
}

/* ───── feature 3: map ───── */
.section-map { background: linear-gradient(180deg, var(--paper) 0%, var(--sand) 100%); }
.map-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: stretch;
  margin-top: 32px;
}
@media (max-width: 880px) {
  .map-stage { grid-template-columns: 1fr; }
}
.map-svg {
  width: 100%;
  max-height: 720px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.map-svg .compass circle { fill: var(--paper); stroke: var(--line); stroke-width: 1.2; }
.map-svg .compass text   { fill: var(--ink-mute); font-size: 11px; font-family: var(--body); font-weight: 500; }
.map-svg .compass path   { fill: var(--brick); }
.map-svg .side-label text { fill: var(--ink-mute); font-size: 13px; font-family: var(--body); font-weight: 500; }
.map-svg .wadi-line {
  fill: none;
  stroke: rgba(47, 81, 50, 0.28);
  stroke-width: 22;
  stroke-linecap: round;
}
.map-svg .wadi-label {
  fill: var(--palm);
  font-size: 13px;
  font-family: var(--body);
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.map-svg .walk-line {
  fill: none;
  stroke: var(--brick);
  stroke-width: 2.2;
  stroke-dasharray: 5 5;
  opacity: 0.75;
}
.map-svg .walk-label {
  fill: var(--brick);
  font-size: 11.5px;
  font-family: var(--body);
  font-weight: 500;
}
.map-svg .pin { cursor: pointer; outline: none; }
.map-svg .pin circle {
  fill: var(--paper);
  stroke: var(--terra);
  stroke-width: 2;
  transition: stroke .2s, fill .2s, r .2s;
}
.map-svg .pin text {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.map-svg .pin .pin-sub {
  font-family: var(--body);
  font-size: 10.5px;
  font-weight: 400;
  fill: var(--ink-mute);
}
.map-svg .pin:hover circle,
.map-svg .pin:focus circle {
  fill: var(--gold-soft);
  stroke: var(--brick);
}
.map-svg .pin.pin-active circle {
  fill: var(--brick);
  stroke: var(--brick-2);
}
.map-svg .pin.pin-uyayna circle { stroke-width: 2.5; }
.map-svg .pin.pin-uyayna .pin-name { font-size: 18px; }

.map-info {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.map-info::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--brick), var(--terra));
}
.map-info-title {
  font-family: var(--display);
  font-size: 28px;
  margin: 0 0 14px;
  color: var(--brick-2);
}
.map-info-fact {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.85;
  margin: 0;
}
.map-info-hint {
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
}

/* ───── feature 4: glossary ───── */
.g {
  border-bottom: 1.5px dotted var(--brick);
  cursor: help;
  position: relative;
  outline: none;
  transition: color .2s, border-color .2s;
  padding-bottom: 1px;
}
.g:hover, .g:focus {
  color: var(--brick);
  border-color: var(--brick-2);
  border-bottom-style: solid;
}

#glossary-pop {
  position: absolute;
  top: -9999px; left: -9999px;
  width: min(320px, calc(100vw - 24px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}
#glossary-pop.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.gp-title {
  font-family: var(--display);
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--brick-2);
  font-weight: 600;
}
.gp-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--ink-soft);
}
.gp-arrow {
  position: absolute;
  top: -7px;
  inset-inline-start: 50%;
  transform: translateX(50%) rotate(45deg);
  width: 12px; height: 12px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
}
#glossary-pop.above .gp-arrow {
  top: auto;
  bottom: -7px;
  border-top: 0; border-inline-start: 0;
  border-bottom: 1px solid var(--line);
  border-inline-end: 1px solid var(--line);
}

/* ───── hero "since" counters ───── */
.hero-meta-since {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-mute);
  font-style: italic;
}
.hero-meta-since strong {
  color: var(--brick);
  font-style: normal;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
}

/* ───── feature 9: trivia widget ───── */
.section-trivia {
  padding-block: clamp(48px, 7vh, 90px);
  background: linear-gradient(160deg, var(--ink) 0%, #3a2418 100%);
  color: var(--sand);
}
.section-trivia + .section { border-top: 0; }
.trivia-frame {
  text-align: center;
  max-width: 880px;
  margin-inline: auto;
}
.trivia-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 600;
  text-transform: none;
  padding: 4px 14px;
  border: 1px solid rgba(201,169,97,0.32);
  border-radius: 999px;
  margin-bottom: 14px;
}
.trivia-title {
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 32px);
  margin: 0 0 28px;
  color: var(--gold-soft);
  font-weight: 600;
}
.trivia-stage {
  position: relative;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}
.trivia-fact {
  font-family: var(--serif);
  font-size: clamp(17px, 1.7vw, 22px);
  line-height: 1.95;
  color: var(--sand);
  margin: 0;
  max-width: 820px;
  transition: opacity .22s, transform .22s;
  font-style: italic;
}
.trivia-fact.out { opacity: 0; transform: translateY(6px); }
.trivia-controls {
  display: flex;
  align-items: center;
  gap: 22px;
}
.trivia-btn {
  appearance: none;
  border: 1px solid rgba(201,169,97,0.32);
  background: transparent;
  color: var(--gold-soft);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  line-height: 1;
}
.trivia-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}
.trivia-dots {
  display: flex;
  gap: 6px;
}
.trivia-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(244, 234, 215, 0.20);
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.trivia-dot:hover { background: rgba(244, 234, 215, 0.55); }
.trivia-dot.active {
  background: var(--gold);
  transform: scale(1.4);
}

/* ───── feature 7: quiz ───── */
.section-quiz { background: var(--sand); }
.quiz { margin-top: 32px; }
.quiz-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 22px;
  counter-reset: qnum;
}
.q {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 28px;
  position: relative;
  counter-increment: qnum;
  transition: border-color .25s, box-shadow .25s;
}
.q::before {
  content: counter(qnum, arabic-indic) ".";
  position: absolute;
  top: 22px;
  inset-inline-start: 28px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  color: var(--brick);
  opacity: 0.5;
}
.q-text {
  margin: 0 0 18px;
  padding-inline-start: 32px;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.7;
}
.q-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.q-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  cursor: pointer;
  transition: all .2s;
  background: var(--paper);
}
.q-options label:hover {
  border-color: var(--terra);
  background: var(--sand);
}
.q-options input[type="radio"] {
  accent-color: var(--brick);
  flex: 0 0 auto;
}
.q-options input[type="radio"]:checked + span { color: var(--brick-2); font-weight: 500; }

.q.q-correct { border-color: var(--palm); box-shadow: 0 0 0 2px rgba(47,81,50,0.10); }
.q.q-wrong   { border-color: var(--brick); box-shadow: 0 0 0 2px rgba(139,58,31,0.10); }
.q.q-empty   { border-color: var(--gold); }
.q-options label.opt-correct {
  border-color: var(--palm);
  background: rgba(47,81,50,0.08);
  color: var(--palm-2);
}
.q-options label.opt-correct::after {
  content: '✓';
  margin-inline-start: auto;
  color: var(--palm-2);
  font-weight: 700;
}
.q-options label.opt-wrong {
  border-color: var(--brick);
  background: rgba(139,58,31,0.06);
}
.q-options label.opt-wrong::after {
  content: '✕';
  margin-inline-start: auto;
  color: var(--brick);
  font-weight: 700;
}

.quiz-foot {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.btn-primary {
  appearance: none;
  border: 0;
  background: linear-gradient(160deg, var(--brick), var(--terra));
  color: var(--paper);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(139, 58, 31, 0.28);
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(139, 58, 31, 0.36); }
.btn-ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
}
.btn-ghost:hover { border-color: var(--brick); color: var(--brick); }

.quiz-score {
  font-size: 15px;
  color: var(--ink);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s, transform .25s;
  flex: 1 1 200px;
  min-width: 200px;
}
.quiz-score.visible { opacity: 1; transform: translateY(0); }
.quiz-score strong {
  font-family: var(--display);
  color: var(--brick-2);
  font-size: 17px;
}

/* ───── feature 6: dark theme overrides ───── */
[data-theme="dark"] {
  --ink:        #ede0c5;
  --ink-soft:   #d8c4a3;
  --ink-mute:   #9f8869;
  --paper:      #1c0f08;
  --sand:       #271710;
  --sand-2:     #311c12;
  --sand-3:     #422518;
  --brick:      #d27a4f;
  --brick-2:    #e89164;
  --terra:      #c98e6a;
  --gold:       #d9b56b;
  --gold-soft:  #f0d59a;
  --line:       rgba(244, 234, 215, 0.12);
  --line-soft:  rgba(244, 234, 215, 0.05);
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:     0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 18px 60px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(217, 181, 107, 0.06), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(210, 122, 79, 0.05), transparent 40%);
}
[data-theme="dark"] .topbar {
  background: rgba(28, 15, 8, 0.86);
  border-block-end-color: var(--line);
}
[data-theme="dark"] .hero-bg {
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(210, 122, 79, 0.10), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--sand) 60%, var(--sand-2) 100%);
}
[data-theme="dark"] .hero-bg::after { opacity: 0.5; filter: brightness(1.4); }
[data-theme="dark"] .title {
  background: linear-gradient(160deg, var(--ink) 0%, var(--gold) 60%, var(--brick) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="dark"] .grid-3 article.featured {
  background: linear-gradient(160deg, #2c1810 0%, #422518 100%);
  border-color: var(--brick);
}
[data-theme="dark"] .grid-3 article.featured h3 { color: var(--gold-soft); }
[data-theme="dark"] .quote { background: linear-gradient(160deg, var(--sand-2), var(--sand-3)); }
[data-theme="dark"] .quote p { color: var(--ink); }
[data-theme="dark"] .footer { background: linear-gradient(180deg, #0f0805 0%, #050302 100%); }
[data-theme="dark"] .card-jubayla,
[data-theme="dark"] .section-map { background: linear-gradient(160deg, var(--paper) 0%, var(--sand) 100%); }
[data-theme="dark"] .section-quiz { background: var(--sand); }
[data-theme="dark"] .section-trivia { background: linear-gradient(160deg, #0f0805 0%, var(--sand) 100%); }
[data-theme="dark"] .map-svg { background: var(--paper); }
[data-theme="dark"] .map-svg .pin circle { fill: var(--paper); }
[data-theme="dark"] .map-svg .wadi-line { stroke: rgba(122, 168, 130, 0.30); }
[data-theme="dark"] .map-svg .wadi-label { fill: rgba(122, 168, 130, 0.65); }
[data-theme="dark"] .map-svg .compass circle { fill: var(--paper); }
[data-theme="dark"] .filters {
  background: rgba(28, 15, 8, 0.92);
  backdrop-filter: blur(8px);
}

/* ───── responsive tweaks ───── */
@media (max-width: 760px) {
  .filters { top: 60px; padding: 12px; gap: 6px; }
  .chip { padding: 7px 13px; font-size: 13px; }
  .map-info { padding: 24px 22px; }
  .map-info-title { font-size: 22px; }
  .quiz-foot { gap: 12px; }
  .btn-primary { padding: 11px 22px; font-size: 14.5px; }
}
