/* ============================================================
   المعرض الدولي للقهوة والشوكولاتة — نظام التصميم
   الرموز اللونيّة والمقاسات تُحقن من إعدادات المظهر في <head>،
   فما هنا افتراضات فقط يستطيع المستخدم تجاوزها من لوحة التحكّم.
   ============================================================ */

:root {
  --coffee: #3e2723;
  --gold: #c9a961;
  --cocoa: #6d4c2c;
  --cream: #faf6f0;

  --coffee-900: #2a1a17;
  --coffee-700: #4e332c;
  --gold-soft: #e3cd9c;
  --ink: #23140f;
  --muted: #7c6a60;
  --line: rgba(62, 39, 35, 0.12);
  --white: #fff;

  --font-ar: "Tajawal", system-ui, sans-serif;
  --font-en: "Poppins", system-ui, sans-serif;
  --font-base: 16px;

  --container: 1200px;
  --section-y: clamp(4rem, 8vw, 7.5rem);
  --radius-card: 20px;
  --radius-btn: 999px;

  --shadow-sm: 0 1px 2px rgba(42, 26, 23, 0.06), 0 2px 8px rgba(42, 26, 23, 0.04);
  --shadow-md: 0 4px 12px rgba(42, 26, 23, 0.08), 0 12px 32px rgba(42, 26, 23, 0.08);
  --shadow-lg: 0 12px 28px rgba(42, 26, 23, 0.12), 0 32px 64px rgba(42, 26, 23, 0.12);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── الأساسيّات ───────────────────────────────────────────── */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: var(--font-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ar);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body[dir="ltr"] { font-family: var(--font-en); }

img,
video { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }

p { margin: 0 0 1rem; }

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

/* يحترم تفضيل تقليل الحركة على مستوى النظام */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── التخطيط ──────────────────────────────────────────────── */

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--section-y); position: relative; }

.section--cream { background: var(--cream); }
.section--white { background: var(--white); }
.section--coffee {
  background: var(--coffee-900);
  color: var(--cream);
}
.section--coffee .section-title__lead,
.section--coffee .muted { color: rgba(250, 246, 240, 0.72); }

.stack > * + * { margin-top: var(--gap, 1rem); }

.grid { display: grid; gap: clamp(1rem, 2vw, 1.75rem); }

/* شبكة bento غير متماثلة — تُكسر إلى عمود واحد على الجوّال */
.grid--bento {
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(180px, auto);
}
.grid--bento > .cell-lg { grid-column: span 4; grid-row: span 2; }
.grid--bento > .cell-md { grid-column: span 2; grid-row: span 1; }
.grid--bento > .cell-sm { grid-column: span 2; grid-row: span 1; }
.grid--bento > .cell-wide { grid-column: span 3; }

.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

@media (max-width: 860px) {
  .grid--bento { grid-template-columns: 1fr 1fr; }
  .grid--bento > .cell-lg,
  .grid--bento > .cell-wide { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 560px) {
  .grid--bento { grid-template-columns: 1fr; }
  .grid--bento > * { grid-column: span 1 !important; }
}

/* ── عناوين الأقسام ───────────────────────────────────────── */

.section-title { max-width: 62ch; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-title--center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 36px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.section-title__lead {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: var(--muted);
  margin-top: 0.75rem;
}

.gold { color: var(--gold); }
.muted { color: var(--muted); }

/* ── الأزرار ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  font: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
              background-color 0.25s, color 0.25s, border-color 0.25s;
}

.btn:hover { transform: translateY(-3px); }

.btn--primary {
  background: var(--gold);
  color: var(--coffee-900);
  box-shadow: 0 6px 20px rgba(201, 169, 97, 0.34);
}
.btn--primary:hover { box-shadow: 0 12px 30px rgba(201, 169, 97, 0.45); }

.btn--dark { background: var(--coffee-900); color: var(--cream); }

.btn--ghost {
  border-color: currentColor;
  background: transparent;
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.75rem;
}

/* ── البطاقات ─────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(1.4rem, 2.4vw, 2rem);
  box-shadow: var(--shadow-sm);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
  overflow: hidden;
  height: 100%;
}

.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }

.card__icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(201, 169, 97, 0.2), rgba(201, 169, 97, 0.06));
  color: var(--cocoa);
  margin-bottom: 1.1rem;
}
.card__icon svg { width: 26px; height: 26px; }

.card__title { font-size: 1.2rem; margin-bottom: 0.4rem; }
.card__text { color: var(--muted); font-size: 0.97rem; margin: 0; }

/* بطاقة بخلفيّة صورة — تُستخدم في شبكات bento */
.card--image {
  padding: 0;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  color: var(--white);
  border: none;
}
.card--image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease);
}
.card--image:hover img { transform: scale(1.06); }
.card--image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(24, 14, 11, 0.88) 0%, rgba(24, 14, 11, 0.25) 55%, transparent 100%);
}
.card--image > .card__body {
  position: relative;
  z-index: 1;
  padding: clamp(1.25rem, 2.2vw, 1.9rem);
}
.card--image .card__text { color: rgba(255, 255, 255, 0.82); }

/* زجاجيّة — فوق الصور الداكنة */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ── ظهور تدريجي عند التمرير ──────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

/* تأخير متدرّج لعناصر الشبكة الواحدة */
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal[data-delay="5"] { transition-delay: 0.4s; }

/* ── فواصل زخرفيّة ────────────────────────────────────────── */

.wave {
  position: absolute;
  inset-inline: 0;
  line-height: 0;
  pointer-events: none;
  color: var(--cream);
}
.wave--top { top: -1px; }
.wave--bottom { bottom: -1px; transform: scaleY(-1); }
.wave svg { width: 100%; height: clamp(40px, 5vw, 80px); display: block; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* ── الشريط المتحرّك ──────────────────────────────────────── */

.marquee {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  gap: clamp(2rem, 5vw, 4.5rem);
  width: max-content;
  animation: marquee-scroll var(--duration, 38s) linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
/* في RTL يسير الشريط بالاتجاه المعاكس بصريّاً */
[dir="rtl"] .marquee__track { animation-name: marquee-scroll-rtl; }
@keyframes marquee-scroll-rtl {
  from { transform: translateX(0); }
  to { transform: translateX(50%); }
}

/* ── أدوات مساعدة ─────────────────────────────────────────── */

.visually-hidden {
  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: 1rem;
  top: -100px;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: var(--coffee-900);
  color: var(--cream);
  border-radius: 0 0 12px 12px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }
