/* ─── Variables ───────────────────────────────────────────────────── */
:root {
  --background: #FAF8F6;
  --foreground: #1A1714;
  --card: #F2EDE9;
  --primary: #B07080;
  --primary-foreground: #FFFFFF;
  --muted-foreground: #8C7B72;
  --border: #E0D5CF;
  --input: #E0D5CF;
  --ring: #B07080;
  --radius: 0.5rem;
}

/* ─── Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: 'Tajawal', 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Arabic body uses Tajawal; English falls back to DM Sans */
html[lang="en"] body { font-family: 'DM Sans', sans-serif; }
html[lang="ar"] body { font-family: 'Tajawal', sans-serif; }

.font-serif { font-family: 'Playfair Display', serif; }
html[lang="ar"] .font-serif { font-family: 'Tajawal', serif; }

/* ─── Utilities ───────────────────────────────────────────────────── */
.boty-shadow {
  box-shadow: rgba(176,112,128,0.08) 0px 8px 40px, rgba(26,23,20,0.04) 0px 1px 2px;
}
.boty-transition {
  transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.brand-script {
  display: inline-block;
  font-family: 'Cormorant Garamond', 'Playfair Display', serif;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary);
  text-shadow: 0 10px 30px rgba(176, 112, 128, 0.18);
  transform: translateY(0.04em);
}

/* ─── Animations ──────────────────────────────────────────────────── */
@keyframes blur-in {
  0%   { opacity: 0; filter: blur(8px); transform: translateY(12px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}
@keyframes scale-fade-in {
  0%   { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes scroll-down {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
@keyframes scroll-up {
  0%   { transform: translateY(-50%); }
  100% { transform: translateY(0); }
}
@keyframes community-scroll-left  { from { transform: translateX(0); }   to { transform: translateX(-50%); } }
@keyframes community-scroll-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

.animate-blur-in       { animation: blur-in 0.7s ease forwards; }
.animate-scale-fade-in { animation: scale-fade-in 0.6s ease forwards; }
.animate-scroll-down   { animation: scroll-down 30s linear infinite; }
.animate-scroll-up     { animation: scroll-up 30s linear infinite; }
.animate-scroll-down:hover { animation-duration: 60s; }
.animate-scroll-up:hover   { animation-duration: 60s; }

.community-row-left  { animation: community-scroll-left  40s linear infinite; }
.community-row-right { animation: community-scroll-right 40s linear infinite; }
.community-feed:hover .community-row-left,
.community-feed:hover .community-row-right { animation-play-state: paused; }

/* ─── Scroll reveal ───────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Image containers — fade without the vertical shift */
.story-media.reveal { transform: none; }
.story-media.reveal.visible { transform: none; }

.navigation-step {
  scroll-margin-top: 7rem;
}
.navigation-step.reveal {
  transform: translateY(36px);
}
.navigation-step.reveal.visible {
  transform: translateY(0);
}
.navigation-step-visual img {
  transform: scale(1.04);
}
.navigation-step.visible .navigation-step-visual img {
  transform: scale(1);
}

/* Bento grid — fixed row heights only on desktop */
@media (min-width: 768px) {
  .bento-grid { grid-template-rows: 300px 300px; }
}

/* ─── Cart drawer ─────────────────────────────────────────────────── */
#cart-drawer {
  right: 0;
  left: auto;
  transform: translateX(100%);
  transition: transform 0.35s ease;
}

#cart-drawer.cart-drawer-open { transform: translateX(0); }

/* RTL: cart slides from left */
html[dir="rtl"] #cart-drawer {
  right: auto !important;
  left: 0 !important;
  transform: translateX(-100%);
}
html[dir="rtl"] #cart-drawer.cart-drawer-open { transform: translateX(0); }

/* ─── Forms ───────────────────────────────────────────────────────── */
input, textarea, select { outline: none; }

/* ─── Django messages ─────────────────────────────────────────────── */
.django-messages {
  position: fixed; top: 90px; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
html[dir="rtl"] .django-messages { right: auto; left: 1rem; }

.django-message {
  padding: 0.75rem 1.25rem; border-radius: 0.5rem;
  font-size: 0.875rem; max-width: 360px;
  box-shadow: rgba(0,0,0,0.08) 0 4px 12px;
  animation: blur-in 0.4s ease forwards;
}
.django-message.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.django-message.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.django-message.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Mobile: general spacing fixes ──────────────────────────────── */
@media (max-width: 640px) {
  /* Hero text smaller on tiny screens */
  .hero-line2 { font-size: clamp(3.5rem, 18vw, 7rem) !important; }

  /* Bento grid: single column, reasonable heights */
  .bento-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
  .bento-grid > div { height: 260px !important; }
  .bento-large { height: 320px !important; }

  /* Community: disable marquee mask on mobile so cards are fully visible */
  .community-feed {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  /* CTA banner: stack columns */
  .cta-grid { grid-template-columns: 1fr !important; }

  /* Products: single column on tiny screens */
  .product-grid-inner { grid-template-columns: 1fr !important; }
}

/* ─── Mobile: 375–640px tweaks ────────────────────────────────────── */
@media (max-width: 767px) {
  /* Ensure sections have decent horizontal padding */
  section > .max-w-7xl { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }

  /* Testimonial columns: single on mobile */
  .testimonial-cols { display: flex !important; flex-direction: column !important; height: auto !important; }
  .testimonial-cols > div { height: 480px !important; }

  /* Community section: keep equal padding on mobile */
  .community-left { padding-left: 1.25rem; padding-right: 1.25rem; }
}

/* ─── RTL layout overrides ────────────────────────────────────────── */
html[dir="rtl"] {
  /* Flip logo watermark in hero */
  .hero-watermark { right: auto; left: 2rem; }

  /* Hero label: slightly larger in Arabic for visual balance */
  [data-i18n="hero.label"] { font-size: 13px; letter-spacing: 0.3em; }

  /* Scroll indicator: stays centered — no change needed */

  /* Shop dropdown: flip to right */
  #shop-dropdown { left: auto; right: 0; }

  /* Mobile menu border */
  #mobile-menu .border-t { }

  /* Community RTL: keep cards LTR so layout is identical to EN */
  .community-feed,
  .community-row-left,
  .community-row-right,
  .community-card { direction: ltr; }

  /* Community text panel: right-align text and mirror padding */
  .community-left {
    text-align: right;
    padding-right: 4rem;
    padding-left: 3rem;
  }

  /* Community CTA: arrow appended by CSS, not in text */
  .community-cta::after { content: ' ←'; }
}

@media (min-width: 1280px) {
  html[dir="rtl"] .community-left {
    padding-right: 6rem;
  }
}

/* ─── Language toggle button ──────────────────────────────────────── */
#lang-label {
  font-family: 'DM Sans', 'Tajawal', sans-serif;
  letter-spacing: 0.05em;
  font-size: 11px;
  font-weight: 600;
}
