/* ============================================================
   layout.css
   الشريط العلوي، واجهة الهيرو، الشبكات، واجهة تواصل معنا
   ============================================================ */

/* ===== الشريط العلوي ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #171008, #0c0803 88%, #0a0602);
  border-bottom: 1px solid rgba(212, 175, 55, .35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .55);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  min-height: var(--topbar-h);
  flex-wrap: nowrap;
}

.mini-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.mini-crest__img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(212, 175, 55, .7));
}

.mini-logo b {
  color: var(--gold-light);
  font-family: 'Reem Kufi', 'Amiri', 'Cairo', serif;
  font-size: 19px;
  letter-spacing: normal;
}

.mini-logo {
  border-radius: 10px;
  transition: filter .2s ease;
}

.mini-logo:hover {
  filter: brightness(1.15);
}

nav.menu {
  display: flex;
  flex: 1;
}

.menu__head {
  display: none;
}

.menu__links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-evenly;
}

nav.menu a {
  padding: 8px 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--cream);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color .2s, background .2s, border-color .2s;
}

nav.menu a:hover {
  color: var(--gold-light);
  background: rgba(212, 175, 55, .12);
}

nav.menu a.active {
  color: var(--gold);
  background: rgba(212, 175, 55, .10);
  border-color: var(--gold-deep);
}

.nav-overlay {
  display: none;
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 42px;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, .08);
  border: 1px solid var(--gold-deep);
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s ease;
}

.menu-toggle:hover {
  background: rgba(212, 175, 55, .18);
}

/* أيقونة الخطوط الثلاثة (همبرغر) */
.menu-toggle__bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu-toggle__bars span {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--gold-light);
  transition: transform .25s ease, opacity .2s ease;
}

/* تتحوّل الخطوط إلى علامة × عند فتح القائمة */
body.menu-open .menu-toggle__bars span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

body.menu-open .menu-toggle__bars span:nth-child(2) {
  opacity: 0;
}

body.menu-open .menu-toggle__bars span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* ===== الواجهة الأولى: الهيرو =====
   البانر جزء من تشكيل الصفحة نفسه: الصورة ذاتها أُعيد تشكيلها ليمتد
   زخرفها الذهبي وخلفيتها الدمشقية على عرض أوسع من العمل الفني الأصلي،
   فتمتلئ الشاشة حافةً إلى حافة بلا أي فراغ أو إطار أو صورة "مضافة". */
.hero {
  position: relative;
  scroll-margin-top: var(--topbar-h);
}

.hero-stage {
  width: 100%;
  overflow: hidden;
  background: var(--ink);
  aspect-ratio: 2268 / 592;
}

.hero-banner {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* واجهة البانر موحّدة على كل الصفحات: تمتد على عرض الصفحة كاملةً
   في الرئيسية والصفحات الفرعية على حدٍّ سواء. */

/* ===== الشريط الذهبي المتحرّك ===== */
.hero-marquee {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(212, 175, 55, .20), rgba(168, 127, 36, .12));
  border-top: 2px solid var(--gold-deep);
  border-bottom: 2px solid var(--gold-deep);
  padding: 9px 0;
}

.hero-marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 26s linear infinite;
  will-change: transform;
}

.hero-marquee__item {
  padding-inline: 3.2rem;
  color: var(--gold-light);
  font-family: 'Reem Kufi', 'Amiri', 'Cairo', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .55);
}

/* في العربية يسير الشريط من اليسار إلى اليمين */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(50%); }
}

/* الشريط لا يتوقف عند مرور المؤشر — يبقى متحركاً دائماً.
   انسيابية الحلقة مضمونة عبر setupMarquee في main.js الذي يملأ
   المسار بنسخ كافية مهما اتسعت الشاشة. */

/* ===== التخطيط العام ===== */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 16px 50px;
}

.view {
  animation: fade .4s ease;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* أقسام الصفحة الرئيسية */
.panel {
  scroll-margin-top: calc(var(--topbar-h) + 12px);
  padding-top: 6px;
}

.panel + .panel {
  margin-top: 46px;
}

/* قسم بعرض الصفحة كاملةً (شريط لوحة الشرف) */
.panel--wide {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.panel--wide .panel__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 27px;
  color: var(--gold-light);
  margin: 8px 0 10px;
}

.section-title::before,
.section-title::after {
  content: "";
  height: 2px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
}

.section-title span {
  flex: none;
}

.view-lead {
  text-align: center;
  color: var(--cream);
  opacity: .8;
  font-size: 15px;
  margin: 0 0 18px;
}

/* ===== شبكة بطاقات المواضيع: موضوعان متجاوران في كل صف ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.cards.two-cols {
  grid-template-columns: repeat(2, 1fr);
}

/* ===== شبكة التصنيفات ===== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ===== واجهة تواصل معنا (تذييل ثابت) ===== */
.contact {
  background: linear-gradient(180deg, var(--maroon-dark), #160303);
  border-top: 4px solid var(--gold-deep);
  text-align: center;
  padding: 34px 16px 26px;
  scroll-margin-top: var(--topbar-h);
}

.contact__title {
  font-size: 26px;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.contact__lead {
  color: var(--cream);
  opacity: .8;
  font-size: 15px;
  margin-bottom: 16px;
}

.contact__crest {
  display: inline-block;
  margin-bottom: 12px;
}

.contact__crest img {
  width: 130px;
  height: auto;
  filter: drop-shadow(0 0 14px rgba(212, 175, 55, .45));
  transition: transform .25s ease, filter .25s ease;
}

.contact__crest:hover img {
  transform: scale(1.05);
  filter: drop-shadow(0 0 22px rgba(212, 175, 55, .8));
}

.contact__social {
  margin-bottom: 18px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-light);
  border: 1px solid var(--gold-deep);
  background: rgba(212, 175, 55, .07);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 15px;
  transition: background .2s, color .2s, transform .2s;
}

.social-btn svg {
  display: block;
}

.social-btn:hover {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--maroon-darkest);
  transform: translateY(-2px);
}

.contact__rights {
  border-top: 1px solid rgba(212, 175, 55, .28);
  padding-top: 16px;
  margin-top: 4px;
  color: #d9c7a8;
  font-size: 14.5px;
}

.contact__note {
  opacity: .55;
  font-size: 12.5px;
  margin-top: 4px;
}

/* ============================================================
   الاستجابة للشاشات
   ============================================================ */

@media (max-width: 900px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  /* ===== القائمة الجانبية على الهاتف ===== */
  .menu-toggle {
    display: flex;
    margin-inline-start: auto;
  }

  nav.menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    width: min(76vw, 300px);
    flex-direction: column;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, var(--maroon-dark), var(--maroon-darkest));
    border-inline-start: 2px solid var(--gold-deep);
    box-shadow: -14px 0 34px rgba(0, 0, 0, .55);
    transform: translateX(105%);
    transition: transform .28s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  nav.menu.show {
    transform: translateX(0);
  }

  .menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--gold-deep);
  }

  .menu__title {
    color: var(--gold-light);
    font-family: 'Reem Kufi', 'Amiri', 'Cairo', serif;
    font-size: 19px;
    font-weight: 700;
  }

  .menu__close {
    background: none;
    border: 1px solid var(--gold-deep);
    color: var(--gold-light);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .menu__links {
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    justify-content: flex-start;
  }

  nav.menu a {
    display: block;
    padding: 13px 14px;
    font-size: 16px;
    border: 1px solid rgba(212, 175, 55, .28);
    border-radius: 10px;
    background: rgba(212, 175, 55, .05);
  }

  nav.menu a.active {
    background: rgba(212, 175, 55, .16);
    border-color: var(--gold);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
  }

  body.menu-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.menu-open {
    overflow: hidden;
  }

  /* ===== شعار واسم القبيلة في الشريط العلوي ===== */
  .mini-crest__img {
    width: 52px;
    height: 52px;
  }

  .mini-logo b {
    font-size: 23px;
  }

  .topbar-inner {
    padding: 10px 14px;
  }

  .section-title {
    font-size: 22px;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .hero-stage {
    aspect-ratio: 996 / 498;
  }

  .hero-marquee {
    padding: 7px 0;
  }

  .hero-marquee__item {
    font-size: 15px;
    padding-inline: 2.2rem;
  }

  main {
    padding: 20px 12px 40px;
  }

  .panel + .panel {
    margin-top: 34px;
  }

  .cards,
  .cards.two-cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .view-lead {
    font-size: 13.5px;
    margin-bottom: 14px;
  }

  .contact {
    padding: 26px 14px 22px;
  }

  .contact__title {
    font-size: 22px;
  }

  .contact__crest img {
    width: 104px;
  }
}

@media (max-width: 380px) {
  .mini-logo b {
    font-size: 20px;
  }

  .mini-crest__img {
    width: 46px;
    height: 46px;
  }

  .menu-toggle {
    width: 42px;
    height: 38px;
  }
}
