/* ==========================================================================
   المتحف الوطني الموريتاني — نموذج تجريبي
   الألوان مأخوذة من الهوية الرقمية لوزارة الثقافة (culture.gov.mr)
   وألوان العلم من موقعي الوزارة الأولى ورئاسة الجمهورية.
   ========================================================================== */

:root {
  --green: #07563D;
  --green-dark: #06432F;
  --green-deep: #04301F;
  --green-50: #E9F3ED;
  --green-100: #D3E6DA;
  --gold: #D8B45A;
  --gold-deep: #A9862F;
  --gold-soft: rgba(216, 180, 90, .16);
  --ink: #19322A;
  --muted: #60736B;
  --paper: #F4F7F4;
  --paper-warm: #F7F5EE;
  --white: #FFFFFF;
  --flag-green: #00A95C;
  --flag-red: #D64042;
  --line: rgba(25, 50, 42, .12);
  --line-strong: rgba(25, 50, 42, .22);
  --shadow-sm: 0 1px 2px rgba(7, 86, 61, .06), 0 2px 8px rgba(7, 86, 61, .06);
  --shadow-md: 0 10px 30px rgba(7, 86, 61, .10);
  --shadow-lg: 0 24px 60px rgba(6, 67, 47, .16);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --container: 1240px;
  --gutter: clamp(18px, 4vw, 40px);
  --header-h: 72px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font-display: "Amiri", "Cormorant Garamond", serif;
  --font-body: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
}

:lang(fr) {
  --font-display: "Cormorant Garamond", "Amiri", serif;
  --font-body: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  border-top: 3px solid var(--flag-red);
}
:lang(fr) body, body:lang(fr) { line-height: 1.65; font-size: 16.5px; }

img, svg, video { max-width: 100%; display: block; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, h4 { overflow-wrap: break-word; font-family: var(--font-display); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; color: var(--ink); letter-spacing: 0; }
:lang(fr) h1, :lang(fr) h2, :lang(fr) h3 { font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5.2vw, 4.1rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.7rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
p { margin: 0 0 1em; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.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; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--green); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

/* ---------- الترويسة (خضراء بلون وزارة الثقافة) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: #E6EFE9;
  background:
    radial-gradient(700px 180px at 85% 0, rgba(216, 180, 90, .14), transparent 70%),
    linear-gradient(90deg, var(--green-deep), var(--green-dark));
  box-shadow: 0 1px 0 rgba(216, 180, 90, .45);
  transition: box-shadow .3s var(--ease);
}
[dir="rtl"] .site-header {
  background:
    radial-gradient(700px 180px at 15% 0, rgba(216, 180, 90, .14), transparent 70%),
    linear-gradient(-90deg, var(--green-deep), var(--green-dark));
}
.site-header.is-scrolled { box-shadow: 0 1px 0 rgba(216, 180, 90, .45), 0 10px 30px rgba(4, 48, 31, .25); }
.site-header__inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand__mark { width: 42px; height: 42px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; color: var(--green); }
:lang(fr) .brand__name { font-size: 1.38rem; font-weight: 600; }
.brand__sub { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.brand--light .brand__name, .site-header .brand__name { color: #fff; }
.brand--light .brand__sub { color: rgba(255, 255, 255, .65); }
.site-header .brand__sub { color: var(--gold); }
.site-header .brand__mark, .brand--light .brand__mark { border-radius: 13px; box-shadow: 0 0 0 1px rgba(216, 180, 90, .55); }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav > a {
  text-decoration: none;
  color: #E6EFE9;
  font-weight: 500;
  font-size: .95rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.site-nav > a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.site-nav > a[aria-current="page"] { color: var(--green-deep); background: var(--gold); font-weight: 600; }
.site-nav__lang { display: inline-flex; gap: 4px; margin-inline-start: 10px; padding: 3px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; background: rgba(255, 255, 255, .06); }
.lang-pill { min-width: 38px; height: 32px; display: inline-grid; place-items: center; border-radius: 999px; font-size: .82rem; font-weight: 600; text-decoration: none; color: rgba(230, 239, 233, .8); padding: 0 8px; }
.lang-pill:hover { color: #fff; }
.lang-pill.is-active { background: #fff; color: var(--green-deep); }

.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px; background: rgba(255, 255, 255, .06); padding: 0; cursor: pointer; }
.nav-toggle__bar { display: block; width: 18px; height: 2px; margin: 5px auto; background: #fff; border-radius: 2px; transition: transform .3s var(--ease); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:first-of-type { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-of-type(2) { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed;
    inset: calc(var(--header-h) + 3px) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px var(--gutter) 22px;
    background: var(--green-deep);
    border-bottom: 2px solid var(--gold);
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s var(--ease), transform .3s var(--ease), visibility .3s;
  }
  .site-nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .site-nav > a { padding: 12px 14px; font-size: 1.05rem; }
  .site-nav__lang { align-self: flex-start; margin: 10px 0 0; }
}

/* ---------- أزرار وعناصر عامة ---------- */
.btn {
  --btn-bg: var(--green);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1.5px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
  white-space: nowrap;
}
.btn:hover { color: var(--btn-fg); background: var(--green-dark); border-color: var(--green-dark); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(7, 86, 61, .22); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--green); border-color: var(--green); }
.btn--ghost:hover { --btn-fg: #fff; }
.btn--gold { --btn-bg: var(--gold); --btn-fg: var(--green-deep); }
.btn--gold:hover { background: #E3C474; border-color: #E3C474; --btn-fg: var(--green-deep); }
.btn--light { --btn-bg: #fff; --btn-fg: var(--green); border-color: #fff; }
.btn--light:hover { background: var(--green-50); border-color: var(--green-50); --btn-fg: var(--green); }
.btn--small { min-height: 40px; padding: 0 16px; font-size: .9rem; }
.link-button { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
:where(.btn-icon) svg { transform: scaleX(var(--flip, 1)); }
[dir="rtl"] .btn-icon--flip svg { transform: scaleX(-1); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--gold-deep);
  letter-spacing: .02em;
  margin-bottom: 14px;
}
:lang(fr) .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; }
.eyebrow::before { content: ""; width: 28px; height: 1.5px; background: var(--gold); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--green-50);
  color: var(--green);
  white-space: nowrap;
}
.badge--3d { background: var(--green); color: #fff; }
.badge--3d::before { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: url("../img/cube.2d8ae1cea37a.svg") center / contain no-repeat; mask: url("../img/cube.2d8ae1cea37a.svg") center / contain no-repeat; }
.badge--image { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.badge--pending { background: var(--gold-soft); color: #7A5F1C; }
.badge--synthetic { background: #FFF6E0; color: #7A5F1C; }

.section { padding-block: clamp(64px, 9vw, 120px); }
.section--tight { padding-block: clamp(40px, 6vw, 72px); }
.section--green { background: var(--green); color: #E6EFE9; }
.section--green h2, .section--green h3 { color: #fff; }
.section--deep { background: var(--green-deep); color: #DCE9E1; }
.section--deep h2, .section--deep h3 { color: #fff; }
.section--white { background: #fff; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: clamp(28px, 4vw, 48px); flex-wrap: wrap; }
.section__head h2 { margin: 0; }
.section__lead { max-width: 640px; color: var(--muted); font-size: 1.08rem; margin: 10px 0 0; }
.section--green .section__lead, .section--deep .section__lead { color: rgba(230, 239, 233, .82); }

.gold-rule { width: 72px; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); border: 0; margin: 0 0 22px; }
[dir="rtl"] .gold-rule { background: linear-gradient(-90deg, var(--gold), transparent); }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(216, 180, 90, .45);
  color: #5D4A16;
  font-size: .92rem;
  line-height: 1.6;
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* ---------- ظهور تدريجي ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ==========================================================================
   الصفحة الرئيسية: العرض القصصي
   ========================================================================== */
.story { position: relative; background:
  radial-gradient(1200px 700px at 72% 30%, #FFFFFF 0%, rgba(255,255,255,0) 60%),
  linear-gradient(180deg, var(--paper) 0%, #EEF3EF 100%); }
[dir="rtl"] .story { background:
  radial-gradient(1200px 700px at 28% 30%, #FFFFFF 0%, rgba(255,255,255,0) 60%),
  linear-gradient(180deg, var(--paper) 0%, #EEF3EF 100%); }
.story__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(20px, 4vw, 56px); }
.story__stage { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--header-h) + 3px); height: calc(100svh - var(--header-h) - 3px); display: grid; place-items: center; }
.story__steps { grid-column: 1; grid-row: 1; }
.story__step { min-height: calc(100svh - var(--header-h)); display: flex; flex-direction: column; justify-content: center; padding-block: 48px; }
.story__step--intro { min-height: calc(100svh - var(--header-h) - 40px); }
.story__step h1 { margin-bottom: 18px; }
.story__motto { font-family: var(--font-display); font-size: clamp(1.15rem, 1.6vw, 1.4rem); color: var(--green); margin-bottom: 22px; }
.story__lead { font-size: 1.12rem; color: var(--muted); max-width: 520px; margin-bottom: 30px; }
.story__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.story__stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--line); }
.stat__num { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--green); display: block; }
.stat__label { font-size: .85rem; color: var(--muted); }
.story__chapter { max-width: 460px; padding: 30px 32px; background: rgba(255, 255, 255, .78); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); opacity: .35; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.story__step.is-active .story__chapter { opacity: 1; transform: none; }
.story__chapter-num { font-family: var(--font-display); color: var(--gold-deep); font-size: 1rem; margin-bottom: 6px; display: block; }
.story__chapter h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.story__chapter p { color: var(--muted); margin: 0; }
.story__chapter .btn { margin-top: 20px; }
.story__scroll { display: inline-flex; align-items: center; gap: 10px; margin-top: 34px; font-size: .85rem; color: var(--muted); }
.story__scroll i { width: 22px; height: 34px; border: 1.5px solid var(--line-strong); border-radius: 12px; position: relative; }
.story__scroll i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; border-radius: 3px; background: var(--green); transform: translateX(-50%); animation: scrollcue 1.8s infinite var(--ease); }
@keyframes scrollcue { 0% { opacity: 0; transform: translate(-50%, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 10px); } }

.stage-viewer { width: 100%; height: 100%; position: relative; }
.stage-viewer model-viewer { width: 100%; height: 100%; --poster-color: transparent; --progress-bar-color: var(--gold); background: transparent; }
.stage-viewer__plinth { position: absolute; inset-inline: 18%; bottom: 7%; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(7, 86, 61, .18), transparent); filter: blur(6px); pointer-events: none; }
.stage-viewer__label { position: absolute; bottom: 4%; inset-inline: 0; text-align: center; font-size: .82rem; color: var(--muted); }
.stage-viewer__label strong { color: var(--ink); font-family: var(--font-display); font-size: 1.05rem; display: block; }

@media (max-width: 900px) {
  .story__grid { grid-template-columns: minmax(0, 1fr); }
  .story__stage { grid-column: 1; height: 40svh; top: calc(var(--header-h) + 3px); z-index: 1; }
  .story__steps { grid-column: 1; grid-row: 2; position: relative; z-index: 2; margin-top: -2svh; }
  .story__step { min-height: 62svh; padding-block: 24px; justify-content: flex-end; }
  .story__step--intro { min-height: auto; padding-top: 18px; padding-bottom: 40px; background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -12px 30px rgba(7, 86, 61, .05); }
  .story__step--intro h1 { font-size: 2.15rem; }
  .story__motto { margin-bottom: 10px; }
  .story__lead { font-size: 1rem; margin-bottom: 22px; }
  .story__stats { margin-top: 26px; padding-top: 18px; gap: 20px; }
  .stat__num { font-size: 1.8rem; }
  .story__chapter { max-width: none; }
  .stage-viewer__label { display: none; }
}

/* ---------- عن المتحف ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.about__text p { font-size: 1.1rem; }
.about__mission { padding: 34px; border-radius: var(--radius-lg); background: var(--green); color: #E6EFE9; position: relative; overflow: hidden; }
.about__mission h3 { color: #fff; }
.about__mission > * { position: relative; z-index: 1; }
.about__mission::after { content: ""; position: absolute; inset-inline-end: -70px; top: -70px; width: 220px; height: 220px; background: url("../img/pattern-gold.c805f14fd837.svg") center / contain no-repeat; opacity: .14; z-index: 0; }
.proposal-tag { display: inline-flex; gap: 8px; align-items: center; font-size: .8rem; color: #7A5F1C; background: var(--gold-soft); border-radius: 999px; padding: 4px 12px; margin-bottom: 18px; }
.proposal-tag svg { width: 14px; height: 14px; flex: none; }
.about__mission .proposal-tag { color: var(--gold); background: rgba(216, 180, 90, .14); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- بطاقات القطع ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 30px); }
@media (max-width: 980px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; color: var(--ink); }
.card__media { position: relative; aspect-ratio: 4 / 3.4; background: radial-gradient(circle at 50% 42%, #FFFFFF 0%, #EEF3EF 70%); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: contain; padding: 6%; transition: transform .8s var(--ease-out); }
.card__media--photo img { object-fit: cover; padding: 0; }
.card:hover .card__media img { transform: scale(1.05); }
.card__badges { position: absolute; top: 14px; inset-inline-start: 14px; display: flex; gap: 6px; }
.card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__cat { font-size: .8rem; color: var(--gold-deep); font-weight: 600; }
.card__title { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.25; margin: 0; font-weight: 700; }
:lang(fr) .card__title { font-weight: 600; font-size: 1.55rem; }
.card__summary { color: var(--muted); font-size: .94rem; line-height: 1.6; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__meta { margin-top: auto; padding-top: 12px; font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card__meta span + span::before { content: "·"; margin-inline-end: 8px; color: var(--gold-deep); }
.card[hidden] { display: none; }

/* ---------- الدليل الصوتي ---------- */
.audio-intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lang-tile { padding: 16px 18px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); }
.lang-tile__native { font-family: var(--font-display); font-size: 1.35rem; color: #fff; display: block; line-height: 1.3; }
.lang-tile__label { font-size: .8rem; color: rgba(230, 239, 233, .7); }
.lang-tile__state { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .75rem; font-weight: 600; }
.lang-tile__state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lang-tile.is-ready .lang-tile__state { color: #7EE2AE; }
.lang-tile.is-pending .lang-tile__state { color: var(--gold); }
.lang-tile.is-national { border-color: rgba(216, 180, 90, .45); }
@media (max-width: 860px) { .audio-intro { grid-template-columns: 1fr; } }

/* ---------- التذييل ---------- */
.site-footer { background: var(--green-deep); color: #C9DBD0; font-size: .92rem; }
.flag-rule { height: 6px; background: linear-gradient(180deg, var(--flag-red) 0 33%, var(--flag-green) 33% 67%, var(--flag-red) 67% 100%); }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 40px; padding-block: 56px 48px; }
.site-footer__motto { margin-top: 18px; font-family: var(--font-display); font-size: 1.15rem; color: var(--gold); max-width: 340px; }
.site-footer__links { display: grid; gap: 10px; align-content: start; }
.site-footer__links a { color: #E6EFE9; text-decoration: none; }
.site-footer__links a:hover { color: var(--gold); }
.site-footer__note p { color: rgba(201, 219, 208, .78); }
@media (max-width: 860px) { .site-footer__grid { grid-template-columns: 1fr; gap: 28px; } }

/* ==========================================================================
   صفحات داخلية: رأس الصفحة
   ========================================================================== */
.page-head { padding-block: clamp(48px, 7vw, 92px) clamp(28px, 4vw, 44px); background: linear-gradient(180deg, #EEF3EF, var(--paper)); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); margin-bottom: 12px; }
.page-head p { color: var(--muted); font-size: 1.1rem; max-width: 720px; margin: 0; }
.page-head .notice { margin-top: 26px; max-width: 860px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 34px 30px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink);
  font-weight: 500; font-size: .92rem; cursor: pointer; text-decoration: none;
  transition: all .25s var(--ease);
}
.chip:hover { border-color: var(--green); color: var(--green); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.chip__count { font-size: .75rem; opacity: .7; }

/* ==========================================================================
   صفحة القطعة
   ========================================================================== */
.piece { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr); gap: 0; align-items: start; }
.piece__stage { position: sticky; top: calc(var(--header-h) + 3px); height: calc(100svh - var(--header-h) - 3px); padding: 18px; padding-inline-end: 0; }
.piece__panel { padding: clamp(24px, 3vw, 44px); padding-bottom: 80px; min-width: 0; }

.viewer {
  position: relative; width: 100%; height: 100%;
  border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #FFFFFF 0%, #EAF1EC 62%, #DCE8E0 100%);
  border: 1px solid var(--line);
  isolation: isolate;
}
/* العارض يحسب مواضع النقاط من اليسار: نثبّت اتجاهه حتى في الصفحات العربية */
model-viewer { direction: ltr; }
.viewer model-viewer { width: 100%; height: 100%; --poster-color: transparent; --progress-bar-color: transparent; outline: none; }
.viewer__osd { position: absolute; inset: 0; }
.viewer__poster { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .6s var(--ease); pointer-events: none; z-index: 1; }
.viewer__poster img { max-width: 78%; max-height: 78%; object-fit: contain; filter: drop-shadow(0 20px 30px rgba(7, 86, 61, .18)); }
.viewer.is-loaded .viewer__poster { opacity: 0; }
.viewer__progress { position: absolute; inset-inline: 22%; bottom: 46px; height: 3px; border-radius: 3px; background: rgba(7, 86, 61, .12); overflow: hidden; z-index: 2; transition: opacity .4s; }
.viewer__progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s linear; }
.viewer.is-loaded .viewer__progress { opacity: 0; }
.viewer__loading { position: absolute; inset-inline: 0; bottom: 18px; text-align: center; font-size: .8rem; color: var(--muted); z-index: 2; transition: opacity .4s; }
.viewer.is-loaded .viewer__loading { opacity: 0; }

.viewer__toolbar { position: absolute; z-index: 5; top: 16px; inset-inline-end: 16px; display: flex; flex-direction: column; gap: 8px; }
.tool {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .2s, color .2s, transform .2s;
}
.tool:hover { background: #fff; color: var(--green); transform: translateY(-1px); }
.tool[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }
.tool svg { width: 21px; height: 21px; }
.viewer__hint { position: absolute; z-index: 3; top: 18px; inset-inline-start: 18px; display: flex; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); background: rgba(255, 255, 255, .85); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); transition: opacity .5s; }
.viewer__hint svg { width: 16px; height: 16px; }
.viewer.has-interacted .viewer__hint { opacity: 0; }

.viewer:fullscreen { border-radius: 0; border: 0; }
.viewer.is-pseudo-fs { position: fixed; inset: 0; z-index: 200; border-radius: 0; border: 0; height: 100svh; }
body.has-pseudo-fs { overflow: hidden; }

.ar-button { position: absolute; z-index: 5; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); }
[dir="rtl"] .ar-button { transform: translateX(50%); }

/* النقاط التفاعلية */
.hotspot {
  --size: 34px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--green);
  color: #fff;
  font-weight: 700; font-size: .85rem;
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
  box-shadow: 0 0 0 4px rgba(216, 180, 90, .45), 0 6px 16px rgba(4, 48, 31, .35);
  transition: transform .25s var(--ease), background .25s, box-shadow .25s, opacity .3s;
  font-family: var(--font-body);
}
.hotspot:hover { transform: scale(1.12); }
.hotspot.is-active { background: var(--gold); color: var(--green-deep); box-shadow: 0 0 0 6px rgba(216, 180, 90, .35), 0 8px 22px rgba(4, 48, 31, .4); transform: scale(1.15); }
.hotspot[data-visible="false"] { opacity: .25; }
.hotspot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0; animation: pulse 2.6s infinite var(--ease); pointer-events: none; }
.hotspot.is-active::after { animation: none; }
@keyframes pulse { 0% { transform: scale(.85); opacity: .9; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
.viewer.hide-hotspots .hotspot { opacity: 0; pointer-events: none; }

.annotation {
  position: absolute; z-index: 6;
  inset-inline-start: 18px; bottom: 82px;
  width: min(380px, calc(100% - 36px));
  padding: 20px 22px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0; visibility: hidden;
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s;
}
.annotation.is-open { opacity: 1; transform: none; visibility: visible; }
.annotation__num { font-size: .78rem; font-weight: 700; color: var(--gold-deep); }
.annotation h3 { font-size: 1.3rem; margin: 2px 0 6px; }
.annotation p { font-size: .93rem; color: var(--muted); margin: 0; line-height: 1.65; }
.annotation__close { position: absolute; top: 10px; inset-inline-end: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.annotation__close svg { width: 16px; height: 16px; }
.annotation__nav { display: flex; gap: 8px; margin-top: 14px; }

/* اللوحة الجانبية */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--green); }
.piece__head { margin-bottom: 26px; }
.piece__badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.piece__title { font-size: clamp(2rem, 3.4vw, 2.9rem); margin-bottom: 6px; }
.piece__local { font-family: var(--font-display); color: var(--gold-deep); font-size: 1.2rem; font-style: italic; margin-bottom: 14px; display: block; }
.piece__summary { font-size: 1.1rem; color: var(--muted); }

.panel-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.panel-card__title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-card__title h2 { font-size: 1.35rem; margin: 0; }
.panel-section { margin-top: 40px; }
.panel-section > h2 { font-size: 1.6rem; display: flex; align-items: center; gap: 12px; }
.panel-section > h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* مشغّل الصوت */
.audio-card { position: relative; }
.audio-langs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.audio-lang {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 7px 12px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; line-height: 1.25; min-width: 82px;
  transition: all .2s var(--ease); text-align: start;
}
.audio-lang__native { font-weight: 600; font-size: .9rem; }
.audio-lang__state { font-size: .75rem; color: var(--muted); }
.audio-lang:hover:not(:disabled) { border-color: var(--green); }
.audio-lang[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.audio-lang[aria-pressed="true"] .audio-lang__state { color: rgba(255, 255, 255, .75); }
.audio-lang:disabled { cursor: not-allowed; background: var(--paper); border-style: dashed; color: var(--muted); }
.audio-lang:disabled .audio-lang__state { color: #8D7429; }

.player { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.player__play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--green); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(7, 86, 61, .3);
  transition: transform .2s var(--ease), background .2s;
}
.player__play:hover { background: var(--green-dark); transform: scale(1.04); }
.player__play svg { width: 26px; height: 26px; }
.player__play .icon-pause { display: none; }
.player.is-playing .player__play .icon-play { display: none; }
.player.is-playing .player__play .icon-pause { display: block; }
.player__body { min-width: 0; }
.player__meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.player__now { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__bar { position: relative; height: 26px; cursor: pointer; touch-action: none; }
.player__track { position: absolute; inset-inline: 0; top: 11px; height: 4px; border-radius: 4px; background: var(--green-100); overflow: hidden; }
.player__fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: var(--green); border-radius: 4px; }
.player__tick { position: absolute; top: 8px; width: 2px; height: 10px; background: rgba(216, 180, 90, .9); border-radius: 2px; }
.player__knob { position: absolute; top: 5px; width: 16px; height: 16px; margin-inline-start: -8px; border-radius: 50%; background: #fff; border: 3px solid var(--green); box-shadow: var(--shadow-sm); inset-inline-start: 0; }
.player__controls { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.player__btn { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.player__btn:hover { border-color: var(--green); color: var(--green); }
.player__btn[aria-pressed="true"] { background: var(--green-50); border-color: var(--green); color: var(--green); }
.player__btn svg { width: 16px; height: 16px; }
.player__time { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted); direction: ltr; }
.player-empty { padding: 18px; border-radius: 14px; background: var(--paper); border: 1px dashed var(--line-strong); color: var(--muted); font-size: .92rem; }
.player-empty strong { color: var(--ink); display: block; margin-bottom: 4px; }

.transcript { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); max-height: 300px; overflow: auto; scroll-behavior: smooth; }
.transcript__seg { display: inline; cursor: pointer; border-radius: 4px; padding: 1px 2px; transition: background .25s, color .25s; color: var(--muted); }
.transcript__seg:hover { color: var(--ink); }
.transcript__seg.is-past { color: var(--ink); }
.transcript__seg.is-active { background: var(--gold-soft); color: var(--green-deep); box-shadow: 0 0 0 2px var(--gold-soft); }
.transcript[dir="rtl"] { font-family: "IBM Plex Sans Arabic", sans-serif; }
.transcript[dir="ltr"] { font-family: "Inter", sans-serif; }

.story-text p { font-size: 1.06rem; }
.story-text p:first-child::first-letter { }

.hotspot-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: hs; }
.hotspot-list button {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: center;
  text-align: start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.hotspot-list button:hover, .hotspot-list button.is-active { border-color: var(--green); background: var(--green-50); }
.hotspot-list__num { width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.hotspot-list__title { font-weight: 600; display: block; line-height: 1.4; }
.hotspot-list__text { font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hotspot-list svg { width: 18px; height: 18px; color: var(--muted); }
[dir="rtl"] .hotspot-list svg { transform: scaleX(-1); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.facts dt, .facts dd { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.facts dt { color: var(--muted); font-size: .88rem; padding-inline-end: 24px; }
.facts dd { font-weight: 500; }
.source-box { margin-top: 18px; font-size: .86rem; color: var(--muted); line-height: 1.6; }
.source-box a { word-break: break-word; }

.share { display: grid; grid-template-columns: 1fr 132px; gap: 18px; align-items: center; }
.share__qr { background: #fff; border-radius: 14px; padding: 8px; border: 1px solid var(--line); }
.share__qr svg { width: 100%; height: auto; }
.share__qr svg path { fill: var(--green-deep); }
.share__actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.share__url { font-size: .82rem; color: var(--muted); direction: ltr; word-break: break-all; }

.neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.neighbour { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); }
.neighbour:hover { border-color: var(--green); color: var(--ink); }
.neighbour img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: var(--paper); flex: none; }
.neighbour small { display: block; color: var(--muted); font-size: .75rem; }
.neighbour strong { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.3; }
.neighbour--next { flex-direction: row-reverse; text-align: end; }

.preview-bar { position: fixed; z-index: 60; bottom: 16px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--gold); color: var(--green-deep); font-weight: 600; padding: 10px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); font-size: .9rem; }
[dir="rtl"] .preview-bar { transform: translateX(50%); }

/* المشغّل المصغّر على الهاتف */
.mini-player { display: none; }

@media (max-width: 1020px) {
  .piece { grid-template-columns: 1fr; }
  .piece__stage { position: sticky; top: calc(var(--header-h) + 3px); z-index: 10; height: 48svh; padding: 10px; background: var(--paper); }
  .viewer { border-radius: var(--radius); }
  .piece__panel { padding-top: 20px; }
  .viewer__toolbar { top: 10px; inset-inline-end: 10px; gap: 6px; }
  .tool { width: 38px; height: 38px; border-radius: 11px; }
  .tool[data-action="zoom-in"], .tool[data-action="zoom-out"] { display: none; }
  .viewer__hint { display: none; }
  .annotation { inset-inline-start: 10px; bottom: 64px; width: calc(100% - 20px); padding: 16px 18px; }
  .annotation h3 { font-size: 1.1rem; }
  .annotation p { font-size: .86rem; -webkit-line-clamp: 4; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .ar-button { bottom: 12px; }
  .ar-button .btn { min-height: 42px; padding: 0 16px; font-size: .88rem; }
  .mini-player {
    display: flex; position: fixed; z-index: 50; inset-inline: 10px; bottom: 10px;
    align-items: center; gap: 12px; padding: 8px 10px; padding-inline-end: 16px;
    background: var(--green-deep); color: #fff; border-radius: 999px; box-shadow: var(--shadow-lg);
    transform: translateY(140%); transition: transform .4s var(--ease-out);
  }
  .mini-player.is-visible { transform: none; }
  .mini-player__play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--gold); color: var(--green-deep); display: grid; place-items: center; flex: none; cursor: pointer; }
  .mini-player__play svg { width: 20px; height: 20px; }
  .mini-player__play .icon-pause { display: none; }
  .mini-player.is-playing .icon-play { display: none; }
  .mini-player.is-playing .icon-pause { display: block; }
  .mini-player__text { font-size: .82rem; line-height: 1.35; min-width: 0; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mini-player__lang { font-size: .7rem; color: var(--gold); flex: none; }
  .share { grid-template-columns: 1fr 110px; }
}

/* ==========================================================================
   صفحة المشروع (الرؤية)
   ========================================================================== */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; counter-reset: step; }
.step-card { padding: 28px 24px; border-radius: var(--radius); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); position: relative; }
.step-card::before { counter-increment: step; content: counter(step, arabic-indic); font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--gold); display: block; margin-bottom: 16px; }
:lang(fr) .step-card::before { content: "0" counter(step); }
.step-card h3 { font-size: 1.3rem; }
.step-card p { color: rgba(230, 239, 233, .78); font-size: .94rem; margin: 0; }
@media (max-width: 980px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature { padding: 26px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.feature__icon { width: 46px; height: 46px; border-radius: 14px; background: var(--green-50); color: var(--green); display: grid; place-items: center; margin-bottom: 16px; }
.feature__icon svg { width: 24px; height: 24px; }
.feature h3 { font-size: 1.25rem; }
.feature p { color: var(--muted); font-size: .94rem; margin: 0; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }

.phase-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.phase-list li { display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding: 18px 20px; border-radius: 14px; background: #fff; border: 1px solid var(--line); align-items: start; }
.phase-list li > span { width: 40px; height: 40px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-deep); display: grid; place-items: center; font-weight: 700; }
.phase-list strong { display: block; font-size: 1.05rem; }
.phase-list p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }


/* 404 */
.not-found { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 5rem; color: var(--gold); margin: 0; }
