/* خط محلي احتياطي (DejaVu Sans — ترخيصه حر، النص الكامل بـ fonts/DejaVu-LICENSE.txt) */
@font-face {
  font-family: "RehlatiLocal";
  src: url("../fonts/DejaVuSans.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   رحلتي بالعراق — دليل سياحي
   الألوان مأخوذة من بوابة عشتار: أزرق اللازورد + ذهبي + لون الطابوق والرمل
   ========================================================= */

:root {
  --bg: #f7f2e9;            /* رملي فاتح */
  --surface: #ffffff;
  --surface-2: #f0e8db;
  --text: #1f1a14;
  --muted: #6b6152;
  --border: #e4d8c4;
  --primary: #1b4aa0;       /* لازوردي — الإجراء الرئيسي */
  --primary-dark: #133a82;
  --primary-soft: #e3eafa;
  --gold: #b9832a;
  --gold-soft: #f7ead2;
  --brick: #a8532f;
  --success: #1c7a4e;
  --success-soft: #dff2e7;
  --danger: #b3261e;
  --danger-soft: #fbe3e1;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(60, 40, 10, .10);
  /* خطوط النظام العربية أولاً (Segoe UI و Tahoma موجودة بويندوز)،
     وإذا ما موجودة نستخدم خط DejaVu Sans المحلي داخل مجلد fonts */
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", "RehlatiLocal", sans-serif;
}

/* الوضع الليلي: JavaScript يضيف class="dark" على body (نفس مثال المحاضرة) */
body.dark {
  --bg: #0f1420;
  --surface: #171e2d;
  --surface-2: #202a3d;
  --text: #ece6da;
  --muted: #a39b8c;
  --border: #2c3850;
  --primary: #6e9bff;
  --primary-dark: #94b6ff;
  --primary-soft: #1f2f55;
  --gold: #e4b25c;
  --gold-soft: #3a2f1a;
  --brick: #e08a61;
  --success: #4ccf91;
  --success-soft: #173a2b;
  --danger: #ff7b72;
  --danger-soft: #45201f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

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

/* الخط: مستقيم، وزن واحد، بدون ميلان */
html { font-synthesis: none; scroll-padding-top: 80px; }
body, h1, h2, h3, b, strong, th, legend, summary, label, button, input, select, em, i {
  font-family: var(--font); font-weight: 400; font-style: normal;
}

body {
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-size: 17px; line-height: 1.8;
  color: var(--text); background: var(--bg);
  overflow-x: clip;
  transition: background .3s, color .3s;
}
main { flex-grow: 1; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
strong { color: var(--primary); }
img { max-width: 100%; display: block; }

.container { width: min(1200px, 100% - 2rem); margin-inline: auto; }
.container.narrow { width: min(760px, 100% - 2rem); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 200; background: var(--primary); color: #fff; padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.view { display: none; padding-bottom: 3.5rem; animation: viewIn .35s ease both; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =========================================================
   الهيدر
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.logo { display: flex; align-items: center; gap: .55rem; font-size: 1.3rem; color: var(--text); text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #0d2a66); color: #f5d28a; font-size: 1.2rem;
  box-shadow: inset 0 -3px 0 var(--gold);
}
.global-nav ul { display: flex; gap: .2rem; list-style: none; margin: 0; padding: 0; }
.global-nav a {
  display: flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .4rem .9rem; border-radius: 10px;
  color: var(--muted); text-decoration: none; transition: background .15s, color .15s;
}
.global-nav a:hover { background: var(--surface-2); color: var(--text); }
.global-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.count-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 99px; background: var(--gold); color: #fff; font-size: .78rem;
}
.count-badge.pop { animation: pop .35s ease; }
.utility-nav { display: flex; gap: .5rem; }
.utility-btn {
  min-height: 42px; padding: .3rem .9rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .95rem; cursor: pointer;
}
.utility-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }

/* =========================================================
   الأزرار وحالاتها
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 46px; padding: 10px 22px; border-radius: 12px; border: 2px solid transparent;
  font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: background .15s, transform .08s, border-color .15s, color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
body.dark .btn-primary { color: #0b1226; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--danger-soft); color: var(--danger); }
.btn-glass { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255,255,255,.24); }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 1.07rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.added { background: var(--success-soft); color: var(--success); border-color: var(--success); }

/* =========================================================
   الرئيسية: عرض صور متحرك
   ========================================================= */
.hero { position: relative; min-height: min(78vh, 640px); display: flex; align-items: flex-end; color: #fff; overflow: hidden; background: #0d1830; }
.hero-slides { position: absolute; inset: 0; }
.hero-slides img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06); transition: opacity 1.2s ease, transform 7s ease;
}
.hero-slides img.on { opacity: 1; transform: scale(1); }
.hero::after {                      /* الشكل والخلفية: تدرج حتى يبقى النص واضح */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8, 14, 30, .92) 8%, rgba(8, 14, 30, .45) 50%, rgba(8, 14, 30, .15));
}
.hero-content { position: relative; z-index: 1; padding-block: 3rem 1.5rem; }
.hero-kicker { color: #f5d28a; margin-bottom: .4rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 18ch; line-height: 1.25; }
.hero-sub { color: rgba(255,255,255,.88); max-width: 52ch; font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 2rem; }
.hero-caption {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8); font-size: .92rem;
}
.hero-caption #heroCaption { flex: 1; min-width: 180px; }
.hero-dots { display: flex; gap: .35rem; }
.hero-dots button {
  width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
}
.hero-dots button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.45); transition: width .2s; }
.hero-dots button[aria-current="true"]::before { width: 22px; border-radius: 99px; background: #f5d28a; }
.hero-pause { min-width: 40px; min-height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: -2rem 0 2.5rem; position: relative; z-index: 2; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 2rem; color: var(--primary); line-height: 1.2; }
.stats span { color: var(--muted); font-size: .95rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; }
.section-head h2 { margin: 0; }

.region-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.region-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 230px; padding: 1.25rem; border-radius: var(--radius); overflow: hidden;
  color: #fff; text-decoration: none; isolation: isolate;
}
.region-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .5s; }
.region-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(0,0,0,.8), transparent 65%); }
.region-card:hover img { transform: scale(1.06); }
.region-card h3 { margin: 0; font-size: 1.5rem; }
.region-card span { color: rgba(255,255,255,.85); font-size: .92rem; }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.how li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.how li > span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: 1.3rem; margin-bottom: .6rem; }
.how h3 { margin: 0 0 .2rem; }
.how p { margin: 0; color: var(--muted); font-size: .95rem; }

/* =========================================================
   مسار التنقل والأدوات
   ========================================================= */
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 1.25rem 0 .75rem; font-size: .92rem; color: var(--muted); }
.breadcrumb li + li::before { content: "‹"; margin-inline-end: .4rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb [aria-current] { color: var(--text); }
.page-head p { color: var(--muted); max-width: 70ch; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }
.search { display: flex; align-items: center; gap: .5rem; min-width: min(360px, 100%); padding: 0 .9rem; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); }
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; min-height: 46px; border: 0; background: transparent; color: var(--text); font-size: 1rem; outline: none; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.5rem; margin-bottom: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  min-height: 42px; padding: .2rem 1rem; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .95rem; cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
body.dark .chip[aria-pressed="true"] { color: #0b1226; }
.fav-only { display: flex; align-items: center; gap: .4rem; min-height: 42px; cursor: pointer; color: var(--muted); }
.fav-only input { width: 20px; height: 20px; accent-color: var(--danger); }
.result-note { color: var(--muted); font-size: .92rem; margin-bottom: 1rem; }

/* =========================================================
   كروت الأماكن
   ========================================================= */
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.25rem; }
.place-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.place-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.photo-btn { display: block; width: 100%; height: 100%; padding: 0; border: 0; cursor: zoom-in; background: none; }
.place-card:hover .photo img { transform: scale(1.05); }
.photo .no-img {                     /* إذا الصورة ما تحمّلت */
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem;
  background: linear-gradient(135deg, var(--primary), #0d2a66); color: #f5d28a; font-size: 1.1rem;
}
.type-tag {
  position: absolute; top: .75rem; inset-inline-start: .75rem;
  padding: 0 .7rem; border-radius: 99px; font-size: .82rem; color: #fff; backdrop-filter: blur(6px);
}
.type-tag.heritage { background: rgba(168, 83, 47, .85); }
.type-tag.nature { background: rgba(28, 122, 78, .85); }
.type-tag.modern { background: rgba(27, 74, 160, .85); }
.fav-btn {
  position: absolute; top: .6rem; inset-inline-end: .6rem;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.9); color: #9a8f80; font-size: 1.25rem; display: grid; place-items: center;
  transition: transform .15s;
}
.fav-btn:hover { transform: scale(1.1); }
.fav-btn[aria-pressed="true"] { color: #e0245e; animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }

.place-body { display: flex; flex-direction: column; gap: .4rem; padding: 1rem 1.1rem 1.1rem; flex: 1; }
.place-body h3 { margin: 0; }
.place-meta { display: flex; flex-wrap: wrap; gap: .2rem .9rem; color: var(--muted); font-size: .88rem; }
.place-body p { margin: 0; color: var(--muted); font-size: .95rem; }
.place-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .6rem; }
.place-actions .btn { flex: 1; padding-inline: .8rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty > span { display: block; font-size: 3rem; }

/* =========================================================
   نافذة التفاصيل
   ========================================================= */
.modal {
  width: min(860px, 100% - 1.5rem); max-height: calc(100vh - 2rem); padding: 0;
  border: 0; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: auto;
}
.modal::backdrop { background: rgba(5, 10, 25, .7); backdrop-filter: blur(4px); }
.modal[open] { animation: viewIn .25s ease both; }
.modal-close {
  position: sticky; top: .75rem; float: left; margin: .75rem; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem;
}
.pd-photo { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); margin-top: -68px; }
.pd-photo img { width: 100%; height: 100%; object-fit: cover; }
.pd-photo figcaption { position: absolute; bottom: 0; inset-inline: 0; padding: .4rem .9rem; background: linear-gradient(to top, rgba(0,0,0,.7), transparent); color: rgba(255,255,255,.85); font-size: .78rem; }
.pd-content { padding: 1.4rem 1.6rem 1.6rem; }
.pd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }
.pd-facts div { padding: .6rem .9rem; border-radius: 12px; background: var(--surface-2); }
.pd-facts span { display: block; color: var(--muted); font-size: .82rem; }
.tip { padding: .8rem 1rem; border-radius: 12px; background: var(--gold-soft); color: var(--text); border-inline-start: 4px solid var(--gold); }
.pd-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.related { margin-top: 1.5rem; }
.related h3 { font-size: 1rem; color: var(--muted); }
.related-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.related-list button {
  display: flex; align-items: center; gap: .5rem; padding: .3rem .8rem .3rem .3rem; min-height: 44px;
  border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); cursor: pointer;
}
.related-list button:hover { border-color: var(--primary); }
.related-list img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

/* =========================================================
   رحلتي
   ========================================================= */
.trip-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.trip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; counter-reset: stop; }
.trip-item {
  display: flex; align-items: center; gap: .9rem; padding: .7rem; padding-inline-end: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  counter-increment: stop; transition: transform .25s, opacity .25s;
}
.trip-item.leaving { opacity: 0; transform: translateX(-40px); }
.trip-item.moved { animation: flash .6s ease; }
@keyframes flash { 30% { background: var(--primary-soft); } }
.trip-item::before {
  content: counter(stop, arabic-indic); flex-shrink: 0;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
}
body.dark .trip-item::before { color: #0b1226; }
.trip-item img { width: 78px; height: 62px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.trip-info { flex: 1; min-width: 0; }
.trip-info h3 { margin: 0; font-size: 1.02rem; }
.trip-info p { margin: 0; color: var(--muted); font-size: .88rem; }
.trip-controls { display: flex; gap: .3rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.remove:hover { background: var(--danger-soft); color: var(--danger); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.trip-summary { position: sticky; top: 88px; }
.trip-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.trip-stats div { text-align: center; padding: .7rem .3rem; border-radius: 12px; background: var(--surface-2); }
.trip-stats b { display: block; font-size: 1.6rem; color: var(--primary); line-height: 1.3; }
.trip-stats span { font-size: .82rem; color: var(--muted); }
.field-inline { display: flex; flex-direction: column; gap: .3rem; font-size: .92rem; color: var(--muted); }
.field-inline select { min-height: 46px; padding: 0 .7rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem; }
.day-plan { margin: 1rem 0; display: flex; flex-direction: column; gap: .6rem; }
.day-block { padding: .7rem .9rem; border-radius: 12px; border: 1px dashed var(--border); }
.day-block h3 { margin: 0 0 .2rem; font-size: .95rem; color: var(--gold); }
.day-block p { margin: 0; font-size: .92rem; }
.trip-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.trip-actions .btn-primary { flex: 1; }

/* =========================================================
   الاختبار
   ========================================================= */
.quiz-card { padding: 1.5rem; }
.quiz-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.quiz-top h1 { font-size: 1.6rem; margin: 0; }
.quiz-progress { color: var(--muted); }
.progress-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin: .8rem 0 1.2rem; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width .4s; }
.quiz-photo { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--surface-2); margin-bottom: 1rem; }
.quiz-photo img { width: 100%; height: 100%; object-fit: cover; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.quiz-option {
  min-height: 54px; padding: .5rem 1rem; border-radius: 12px; text-align: start;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); }
.quiz-option.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); animation: shake .35s; }
.quiz-option:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.quiz-feedback { margin: 1rem 0 0; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); }
.quiz-next { display: flex; justify-content: flex-end; margin-top: 1rem; }
.quiz-end { text-align: center; padding: 1rem 0; }
.quiz-end .big { font-size: 4rem; line-height: 1.2; }
.quiz-end .score { font-size: 2.4rem; color: var(--primary); }

/* =========================================================
   عن المشروع
   ========================================================= */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.note h2 { color: var(--primary); font-size: 1.15rem; }
.note ul { margin: 0; padding-inline-start: 1.2rem; }
.note li { margin-bottom: .45rem; }
.note code { background: var(--surface-2); padding: 0 .35rem; border-radius: 5px; font-size: .88em; direction: ltr; unicode-bidi: isolate; }
.credits-title { margin-top: 2.5rem; }
.credits { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .6rem; }
.credits li { display: flex; gap: .8rem; align-items: center; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-size: .9rem; }
.credits img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--surface-2); }
.credits span { color: var(--muted); display: block; }
.hint { color: var(--muted); font-size: .92rem; }

/* =========================================================
   الرسائل والفوتر
   ========================================================= */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; z-index: 100;
  display: flex; align-items: center; gap: 1rem; max-width: calc(100% - 2rem);
  padding: .7rem 1.1rem; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  transform: translate(-50%, 150%); opacity: 0; transition: transform .3s, opacity .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast button { border: 0; background: none; color: #f5d28a; text-decoration: underline; cursor: pointer; font-size: 1rem; min-height: 36px; }
body.dark .toast button { color: var(--primary); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 1.25rem 0; color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 1.25rem; }
.footer-inner a { color: var(--muted); }

/* =========================================================
   التجاوب
   ========================================================= */
/* =========================================================
   الآثار 3D — المعرض
   ========================================================= */
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); }
body.dark .btn-gold { color: #1a1206; }

.ruins-hero {
  position: relative; overflow: hidden; color: #fff; margin-bottom: 2rem;
  padding: 1rem 0 3rem;
  background:
    radial-gradient(ellipse at 80% 120%, rgba(217, 164, 65, .45), transparent 55%),
    radial-gradient(ellipse at 10% -20%, rgba(35, 87, 179, .55), transparent 60%),
    linear-gradient(160deg, #0d1733, #2a1a14 85%);
}
.ruins-hero::after {                  /* طبقات زقّورة خفيفة بالخلفية — حركة بطيئة */
  content: ""; position: absolute; inset-inline-start: 4%; bottom: -10px; width: 360px; height: 190px; opacity: .14;
  background:
    linear-gradient(#f5d28a, #f5d28a) 50% 100% / 100% 34% no-repeat,
    linear-gradient(#f5d28a, #f5d28a) 50% 55% / 68% 30% no-repeat,
    linear-gradient(#f5d28a, #f5d28a) 50% 18% / 36% 26% no-repeat;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translateX(-30px) translateY(-6px); } }
.ruins-hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); max-width: 20ch; color: #fff; }
.ruins-sub { color: rgba(255,255,255,.85); max-width: 56ch; font-size: 1.08rem; }
.approx-note { display: inline-block; margin: .5rem 0 0; padding: .45rem .9rem; border-radius: 10px; background: rgba(255,255,255,.1); color: #f5d28a; font-size: .95rem; }
.approx-note strong { color: #fff; }
.breadcrumb.on-dark ol, .breadcrumb.on-dark a { color: rgba(255,255,255,.7); }
.breadcrumb.on-dark [aria-current] { color: #fff; }

.ruin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.ruin-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .25s, box-shadow .25s;
}
.ruin-card:hover { transform: translateY(-4px) rotateX(2deg); box-shadow: var(--shadow); }
.ruin-card:hover .photo img { transform: scale(1.06); }
.badge-3d {
  position: absolute; top: .75rem; inset-inline-start: .75rem;
  padding: 0 .7rem; border-radius: 8px; background: rgba(13, 23, 51, .8); color: #f5d28a; font-size: .9rem; letter-spacing: .05em;
}

/* =========================================================
   الآثار 3D — العارض
   ========================================================= */
.model-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.viewer-stage {
  position: relative; overflow: hidden; border-radius: 20px;
  height: min(72vh, 640px); min-height: 380px;
  background:
    radial-gradient(ellipse at 50% 115%, #5a3a26 0%, #2a1c16 45%, transparent 70%),
    radial-gradient(circle at 78% 18%, rgba(255, 214, 140, .35), transparent 30%),
    linear-gradient(180deg, #101a3a 0%, #3a2a3e 48%, #7a4a34 78%, #2a1c16 100%);
  box-shadow: var(--shadow);
}
.viewer-stage:fullscreen { height: 100vh; border-radius: 0; }
.viewer-stage::before {               /* نجوم خفيفة */
  content: ""; position: absolute; inset: 0 0 50% 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 8%, #fff, transparent),
    radial-gradient(1px 1px at 55% 25%, #fff, transparent), radial-gradient(1.5px 1.5px at 68% 12%, #fff, transparent),
    radial-gradient(1px 1px at 88% 30%, #fff, transparent), radial-gradient(1px 1px at 42% 35%, #fff, transparent);
}
.ruin-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.ruin-canvas.grabbing { cursor: grabbing; }
.ruin-canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.model-badge {
  position: absolute; top: 1rem; inset-inline-start: 1rem; z-index: 2;
  padding: .15rem .8rem; border-radius: 99px; background: rgba(13, 23, 51, .75); color: #f5d28a; font-size: .9rem;
  border: 1px solid rgba(245, 210, 138, .4); pointer-events: none;
}
.model-badge.is-file { color: #9ee6c0; border-color: rgba(158, 230, 192, .4); }
.viewer-loading {
  position: absolute; inset: auto 15% 45% 15%; z-index: 3; text-align: center; color: #fff;
  padding: .8rem 1rem; border-radius: 14px; background: rgba(13, 18, 35, .7); backdrop-filter: blur(6px);
}
.load-track { height: 8px; margin-top: .5rem; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.load-track span { display: block; height: 100%; width: 0; background: #f5d28a; border-radius: 99px; transition: width .2s; }
.model-source span, .model-source a { display: block; }
.fix-steps { margin: .4rem 0 0; padding-inline-start: 1.3rem; }
.ruin-card.no-model .photo img { filter: saturate(.75); }
.model-credit { color: var(--success) !important; font-size: .9rem !important; }
.model-missing { font-size: .9rem !important; }
.model-missing span { display: block; color: var(--brick); }
.viewer-hint { position: absolute; top: 1rem; inset-inline-end: 1rem; margin: 0; color: rgba(255,255,255,.7); font-size: .85rem; pointer-events: none; }
.viewer-toolbar {
  position: absolute; bottom: 1rem; inset-inline: 1rem; z-index: 2;
  display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem;
}
.tool-btn {
  min-height: 44px; min-width: 44px; padding: .3rem .9rem; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(13, 18, 35, .62); color: #fff;
  font-size: .95rem; cursor: pointer; backdrop-filter: blur(6px); transition: background .15s;
}
.tool-btn:hover:not(:disabled) { background: rgba(13, 18, 35, .85); }
.tool-btn[aria-pressed="true"] { border-color: #f5d28a; }
.tool-btn:disabled { opacity: .4; cursor: not-allowed; }
.viewer-fallback {
  position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; color: #fff; background: #1b1410;
}
.viewer-fallback img { width: 100%; height: 100%; min-height: 0; object-fit: cover; opacity: .85; }
.viewer-fallback:not([hidden]) ~ .viewer-hint,
.viewer-fallback:not([hidden]) ~ .model-badge { display: none; }
.viewer-fallback > div { padding: 1rem 1.25rem; background: rgba(0,0,0,.7); }
.viewer-fallback h2 { font-size: 1.15rem; margin: 0 0 .3rem; }
.viewer-fallback p { margin: 0 0 .3rem; }
.viewer-fallback .hint { color: rgba(255,255,255,.7); }

.model-info h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.model-info .place-meta { margin-bottom: .8rem; }
.model-info > p { color: var(--muted); }
.approx-box { margin: 1rem 0; padding: .9rem 1rem; border-radius: 12px; background: var(--gold-soft); border-inline-start: 4px solid var(--gold); }
.approx-box h2 { font-size: 1rem; margin: 0 0 .3rem; color: var(--gold); }
.approx-box p { margin: 0 0 .3rem; }
.model-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.model-actions .btn { flex: 1; }
.model-pager { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .92rem; }
.model-pager a { min-height: 44px; display: inline-flex; align-items: center; }
.keys-help { margin-top: .8rem; font-size: .92rem; color: var(--muted); }
.keys-help summary { cursor: pointer; color: var(--primary); min-height: 36px; }
.keys-help ul { margin: .3rem 0 0; padding-inline-start: 1.2rem; }

@media (max-width: 960px) {
  .model-layout { grid-template-columns: minmax(0, 1fr); }
  .viewer-stage { height: 62vh; min-height: 340px; }
}
@media (max-width: 600px) {
  .viewer-hint { display: none; }
  .tool-btn { padding: .3rem .6rem; font-size: .88rem; }
  .ruins-hero::after { width: 220px; height: 120px; }
}

@media (max-width: 960px) {
  .trip-layout { grid-template-columns: minmax(0, 1fr); }
  .trip-summary { position: static; }
  .region-grid, .how { grid-template-columns: 1fr; }
  .region-card { min-height: 170px; }
}
@media (max-width: 820px) {
  .menu-btn { display: inline-block; }
  .header-inner { flex-wrap: wrap; }
  .global-nav { display: none; width: 100%; order: 3; padding-bottom: .75rem; }
  .global-nav.open { display: block; }
  .global-nav ul { flex-direction: column; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr; margin-top: -1.25rem; }
  .stats div { display: flex; align-items: baseline; gap: .75rem; }
  .quiz-options { grid-template-columns: 1fr; }
  .trip-item { flex-wrap: wrap; }
  .trip-item img { width: 64px; height: 52px; }
  .trip-controls { width: 100%; justify-content: flex-end; }
  .hero { min-height: 82vh; }
  .pd-content { padding: 1.1rem; }
  .place-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   الآثار: شارات نوع المجسم، الفلاتر، التبويبات، الخريطة، الخط الزمني، صفحة الأثر
   ========================================================= */
.kind-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 400; line-height: 1.5; border: 1px solid transparent; }
.kind-chip.k-scan { background: #dff2e7; color: #145c3a; border-color: #9fd4b7; }
.kind-chip.k-recon { background: #f7ead2; color: #7a5212; border-color: #e2c38a; }
body.dark .kind-chip.k-scan { background: #173a2a; color: #a6e3c3; border-color: #2c6b4d; }
body.dark .kind-chip.k-recon { background: #3b2e17; color: #f2d398; border-color: #6e5426; }
.kind-chip.on-photo { position: absolute; top: .6rem; inset-inline-start: .6rem; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ruin-card .photo { position: relative; display: block; }
.ruin-card h3 a { color: inherit; text-decoration: none; }
.ruin-card h3 a:hover { text-decoration: underline; }
.ruin-period { margin: .2rem 0 .4rem; color: var(--muted); font-size: .92rem; }
.model-badge.kind-chip { position: absolute; }

.ruin-filters { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: end; margin: 1.25rem 0 1rem; }
.ruin-filters label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); flex: 1 1 170px; }
.ruin-filters select { font: inherit; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 44px; }
.filter-count { margin: 0; color: var(--muted); flex-basis: 100%; }

.ruin-tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.ruin-tabs button { font: inherit; font-weight: 400; background: none; border: 0; border-bottom: 3px solid transparent; padding: .7rem 1rem; color: var(--muted); cursor: pointer; min-height: 44px; white-space: nowrap; }
.ruin-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
body.dark .ruin-tabs button[aria-selected="true"] { color: #9dbbff; border-bottom-color: #9dbbff; }
.ruin-tabs button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.empty-state { padding: 2rem; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.link-btn { font: inherit; background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; }

.map-wrap { position: relative; padding: .5rem; max-width: 640px; margin-inline: auto; }
.iraq-map { width: 100%; height: auto; display: block; overflow: visible; }
.iraq-shape { fill: var(--surface-2); stroke: var(--gold); stroke-width: 2; }
.map-city circle { fill: var(--muted); }
.map-city text { font-size: 13px; fill: var(--muted); font-family: var(--font); }
.map-pin { cursor: pointer; outline: none; }
.map-pin .hit { fill: transparent; }
.map-pin .dot { stroke: #fff; stroke-width: 3; transition: r .15s; }
.map-pin.k-scan .dot { fill: #1c7a4e; }
.map-pin.k-recon .dot { fill: #b9832a; }
.map-pin text { font-size: 15px; text-anchor: middle; fill: var(--text); font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.map-pin:hover .dot, .map-pin:focus-visible .dot { r: 11; }
.map-pin:focus-visible .hit { stroke: var(--primary); stroke-width: 3; }
.map-pin.dim { opacity: .25; cursor: default; }
.map-pop { position: absolute; transform: translate(-50%, calc(-100% - 18px)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .7rem .9rem; display: grid; gap: .35rem; min-width: 190px; z-index: 3; }
.map-pop.below { transform: translate(-50%, 18px); }
.map-pop span { color: var(--muted); font-size: .9rem; }
.map-pop .kind-chip { justify-self: start; }
.pop-close { position: absolute; top: .3rem; inset-inline-end: .3rem; background: none; border: 0; font-size: 1rem; cursor: pointer; color: var(--muted); width: 32px; height: 32px; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 7.2rem; width: 3px; background: var(--border); }
.timeline li { display: grid; grid-template-columns: 6.6rem 1fr; gap: 1.6rem; margin-bottom: 1rem; position: relative; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: calc(7.2rem - 6px); top: 1rem; width: 15px; height: 15px; border-radius: 50%; background: var(--gold); border: 3px solid var(--surface); }
.tl-year { padding-top: .75rem; color: var(--gold); font-size: .95rem; text-align: end; }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.tl-card h3 { margin: 0 0 .2rem; font-size: 1.1rem; font-weight: 400; }
.tl-card h3 a { color: var(--primary); }
body.dark .tl-card h3 a { color: #9dbbff; }
.tl-card p { margin: .2rem 0; }
.tl-civ { color: var(--muted); }
.tl-src { font-size: .85rem; color: var(--muted); }

.kind-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.approx-warn { background: var(--surface); border-radius: 8px; padding: .5rem .7rem; font-size: .92rem; }
.model-extra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
.model-extra h2 { font-size: 1.2rem; font-weight: 400; margin: 0 0 .5rem; }
.gallery-panel { grid-column: 1 / -1; }
.parts-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.part-btn { width: 100%; text-align: start; font: inherit; font-weight: 400; display: grid; gap: .15rem; padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.part-btn.static { cursor: default; }
.part-btn strong { font-weight: 400; color: var(--primary); }
body.dark .part-btn strong { color: #9dbbff; }
.part-btn span { color: var(--muted); font-size: .93rem; }
.part-btn em { font-style: normal; font-size: .85rem; color: var(--gold); }
button.part-btn:hover, .part-btn.on { border-color: var(--gold); background: var(--gold-soft); }
body.dark button.part-btn:hover, body.dark .part-btn.on { background: #3b2e17; }
.src-list { padding-inline-start: 1.2rem; margin: .5rem 0 0; font-size: .92rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; background: var(--surface-2); border-radius: 12px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery figcaption { padding: .5rem .7rem; font-size: .9rem; display: grid; gap: .2rem; }
.gallery small { color: var(--muted); font-size: .8rem; }
.old-tag { font-weight: 400; background: #4a3b2a; color: #f3e2c0; border-radius: 6px; padding: 0 .4rem; font-size: .8rem; }
.compare { position: relative; max-width: 720px; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; margin-top: .5rem; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-old { position: absolute; inset: 0; clip-path: inset(0 0 0 calc(100% - var(--pos))); }
.compare-old img { filter: sepia(.25); }
.compare::after { content: ""; position: absolute; top: 0; bottom: 0; right: var(--pos); width: 3px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.5); pointer-events: none; }
.compare input { position: absolute; inset: auto 0 .6rem 0; width: 90%; margin: 0 auto; direction: rtl; }
.cmp-lbl { position: absolute; top: .6rem; background: rgba(0,0,0,.6); color: #fff; padding: .1rem .55rem; border-radius: 6px; font-size: .85rem; }
.l-old { right: .6rem; } .l-now { left: .6rem; }
.model-extra h3 { font-weight: 400; font-size: 1.05rem; margin: 1.2rem 0 .3rem; }

@media (max-width: 760px) {
  .model-extra { grid-template-columns: minmax(0, 1fr); }
  .timeline::before { inset-inline-start: 4.6rem; }
  .timeline li { grid-template-columns: 4rem 1fr; gap: 1.4rem; }
  .timeline li::after { inset-inline-start: calc(4.6rem - 6px); }
  .tl-year { font-size: .82rem; }
  .map-pop { min-width: 160px; }
}
.model-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.model-actions > * { flex: 1 1 140px; justify-content: center; text-align: center; }
.illus-tag { position: absolute; bottom: .6rem; inset-inline-end: .6rem; background: rgba(20, 16, 10, .78); color: #fff; font-size: .8rem; padding: .15rem .55rem; border-radius: 6px; pointer-events: none; }
/* صفحة الأثر بالترتيب: صور ← نبذة ← مجسم وأجزاء ← زيارة ← حقوق */
.site-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; justify-content: space-between; margin: .5rem 0 1rem; }
.site-head h1 { margin: 0 0 .3rem; font-weight: 400; }
.site-head .model-actions { flex: 1 1 320px; max-width: 520px; }
.site-steps { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem; }
.site-steps a { display: inline-block; padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.site-steps a:hover, .site-steps a:focus-visible { border-color: var(--gold); background: var(--gold-soft); }
body.dark .site-steps a:hover { background: #3b2e17; }
.site-sec { margin-bottom: 1.25rem; scroll-margin-top: 80px; }
.site-sec:focus { outline: none; }
.site-sec h2, .sec-title { font-size: 1.25rem; font-weight: 400; margin: 0 0 .7rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.site-sec h3 { font-weight: 400; font-size: 1.05rem; margin: .8rem 0 .4rem; }
.model-info h3 { font-weight: 400; font-size: 1.1rem; margin: 0 0 .3rem; }
.model-info .parts-list { max-height: 460px; overflow: auto; }
.pd-facts small { color: var(--muted); font-size: .8rem; }
#s-visit .pd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
