/* ============================================================
   ALSALAHY PERFUME — Enhancements Layer
   Loaded AFTER style.css — overrides & extends the base theme.

   Table of Contents:
   01 · Global polish (mobile-first defaults)
   02 · Buttons — tactile press & shine feedback
   03 · Reveal-on-scroll system v2 (variants + stagger)
   04 · Hero upgrades (orbs, metallic title, float)
   05 · Section headers & ornaments
   06 · Category tabs (pill switch)
   07 · Product cards & loading skeletons
   08 · About / Contact / Footer polish
   09 · Mobile menu choreography
   10 · Mobile bottom navigation
   11 · Mobile refinements (≤ 768px)
   12 · Accessibility — reduced motion
   ============================================================ */

/* ============================================
   01 · GLOBAL POLISH
   ============================================ */
::selection {
  background: rgba(180, 106, 58, 0.25);
  color: var(--deep-brown);
}

* {
  -webkit-tap-highlight-color: transparent;
}

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

html {
  /* Prevents the fixed header from covering anchored sections */
  scroll-padding-top: calc(var(--header-h) + 12px);
}

/* ============================================
   02 · BUTTONS — tactile feedback
   ============================================ */
.btn-hero,
.btn-add-cart,
.btn-checkout,
.btn-auth-submit,
.btn-contact-submit,
.modal-add-cart-btn,
.btn-back-home {
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.btn-hero:active,
.btn-add-cart:active,
.btn-checkout:active,
.btn-auth-submit:active,
.btn-contact-submit:active,
.modal-add-cart-btn:active,
.btn-back-home:active,
.payment-method-btn:active,
.icon-btn:active,
.category-tab:active {
  transform: scale(0.96);
}

/* Travelling shine sweep on primary CTAs */
.btn-checkout::after,
.btn-auth-submit::after,
.btn-contact-submit::after,
.modal-add-cart-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  inset-inline-start: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-20deg);
  animation: btnShine 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0%, 60% { inset-inline-start: -60%; }
  100% { inset-inline-start: 130%; }
}

/* ============================================
   03 · REVEAL SYSTEM v2
   Usage: class="reveal-on-scroll" + optional
   data-reveal="zoom|left|right" · JS auto-staggers siblings
   via the --reveal-delay custom property.
   ============================================ */
.reveal-on-scroll {
  transition:
    opacity 0.7s var(--ease-out-expo),
    transform 0.7s var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

.reveal-on-scroll[data-reveal="zoom"] {
  transform: scale(0.92);
}

.reveal-on-scroll[data-reveal="left"] {
  transform: translateX(-40px);
}

.reveal-on-scroll[data-reveal="right"] {
  transform: translateX(40px);
}

/* RTL mirrors horizontal reveals */
[dir="rtl"] .reveal-on-scroll[data-reveal="left"] { transform: translateX(40px); }
[dir="rtl"] .reveal-on-scroll[data-reveal="right"] { transform: translateX(-40px); }

.reveal-on-scroll.revealed,
.reveal-on-scroll[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* ============================================
   04 · HERO UPGRADES
   ============================================ */
.hero {
  min-height: 100svh;
}

/* Floating ambient glow orbs */
.hero-orbs {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  animation: orbFloat 14s ease-in-out infinite;
}

.orb-1 {
  width: 300px;
  height: 300px;
  background: #b46a3a;
  top: -70px;
  inset-inline-start: -50px;
}

.orb-2 {
  width: 220px;
  height: 220px;
  background: #d9a05b;
  bottom: 8%;
  inset-inline-end: -40px;
  animation-delay: -5s;
}

.orb-3 {
  width: 150px;
  height: 150px;
  background: #f3d9a4;
  opacity: 0.22;
  top: 42%;
  inset-inline-start: 58%;
  animation-delay: -9s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -34px) scale(1.1); }
}

/* Metallic gold shimmer on the main title */
.hero-title {
  background: var(--gold-metallic);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation:
    heroTitleIn 1s 0.3s var(--ease-out-expo) forwards,
    metallicShine 7s linear 1.6s infinite;
}

@keyframes metallicShine {
  to { background-position: 220% center; }
}

/* Gentle levitation for the logo after its entrance */
.hero-logo {
  animation:
    heroLogoIn 1.2s var(--ease-out-expo) forwards,
    logoFloat 6s ease-in-out 1.4s infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Parallax hooks (driven by JS, GPU-friendly) */
.hero-content,
.hero-bg img {
  will-change: transform;
}

/* ============================================
   05 · SECTION HEADERS & ORNAMENTS
   ============================================ */
.section-title::before {
  content: "✦";
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  color: var(--caramel);
  font-size: 0.95rem;
  opacity: 0.75;
  transition: transform 0.5s var(--ease-spring) 0.35s;
}

.section-header.revealed .section-title::before {
  transform: translateX(-50%) scale(1);
}

/* Underline grows when the header scrolls into view */
.section-title::after {
  width: 0;
  transition: width 0.8s var(--ease-out-expo) 0.25s;
}

.section-header.revealed .section-title::after {
  width: 70px;
}

/* Animated shimmer on the gold separators */
.gold-separator {
  background: linear-gradient(
    to right,
    transparent,
    var(--taupe),
    var(--caramel),
    #d9a05b,
    var(--caramel),
    var(--taupe),
    transparent
  );
  background-size: 200% 100%;
  animation: separatorFlow 8s linear infinite;
}

@keyframes separatorFlow {
  to { background-position: -200% 0; }
}

/* ============================================
   06 · CATEGORY TABS — pill switch
   ============================================ */
.category-tabs {
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 32px;
  box-shadow: var(--shadow-sm);
}

.category-tab {
  font-size: 1.05rem;
  opacity: 1;
  color: var(--text-secondary);
  padding: 10px 28px;
  border-radius: 999px;
  transition:
    color var(--transition-normal),
    background var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-fast);
  white-space: nowrap;
}

.category-tab::after {
  display: none;
}

.category-tab:hover {
  opacity: 1;
  color: var(--caramel);
}

.category-tab.active {
  background: var(--brand-gradient);
  color: var(--off-white);
  box-shadow: var(--shadow-gold);
}

/* ============================================
   07 · PRODUCT CARDS & SKELETONS
   ============================================ */
.product-card {
  transition:
    transform 0.45s var(--ease-out-expo),
    box-shadow 0.45s var(--ease-out-expo),
    border-color var(--transition-normal),
    opacity 0.7s var(--ease-out-expo);
}

/* Metallic top accent that appears on hover */
.product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold-metallic);
  background-size: 200% auto;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 3;
}

.product-card:hover::before {
  opacity: 1;
  animation: metallicShine 2.5s linear infinite;
}

.product-image-wrapper {
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, var(--sand) 78%);
}

.product-card:hover .product-image {
  transform: scale(1.06) translateY(-4px);
}

/* Lift only on devices with a real hover pointer */
@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-6px);
  }
}

/* Loading skeletons — shown until products render */
.skeleton-card {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow: hidden;
}

.skeleton-img {
  aspect-ratio: 3 / 4;
}

.skeleton-body {
  padding: 18px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
}

.skeleton-line.short { width: 55%; }
.skeleton-line.long { width: 85%; }

.skeleton-img,
.skeleton-line {
  background: linear-gradient(90deg, var(--sand) 25%, #ffffff 50%, var(--sand) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  to { background-position: -200% 0; }
}

/* ============================================
   08 · ABOUT / CONTACT / FOOTER POLISH
   ============================================ */
.about-feature {
  position: relative;
  overflow: hidden;
}

.about-feature-icon {
  transition:
    transform 0.35s var(--ease-spring),
    background var(--transition-normal);
}

.about-feature:hover .about-feature-icon {
  transform: rotate(-8deg) scale(1.12);
  background: var(--brand-gradient);
}

.about-feature:hover .about-feature-icon svg {
  color: var(--off-white);
}

.contact-info-icon {
  transition:
    transform 0.35s var(--ease-spring),
    background var(--transition-normal);
}

.contact-info-item:hover .contact-info-icon {
  transform: scale(1.1);
  background: var(--brand-gradient);
}

.contact-info-item:hover .contact-info-icon svg {
  color: var(--off-white);
}

.footer-social a {
  transition:
    transform 0.3s var(--ease-spring),
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.footer-social a:hover {
  transform: translateY(-4px);
}

/* Scroll-spy highlight for the desktop nav */
.nav-desktop .nav-link {
  transition: color var(--transition-fast);
}

.nav-desktop .nav-link.nav-active {
  color: var(--caramel);
}

/* ============================================
   09 · MOBILE MENU CHOREOGRAPHY
   Links cascade in when the menu opens.
   ============================================ */
.mobile-menu .nav-link,
.mobile-menu .mobile-orders-btn {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.45s var(--ease-out-expo),
    transform 0.45s var(--ease-out-expo),
    color var(--transition-fast);
}

.mobile-menu.mobile-menu-open .nav-link,
.mobile-menu.mobile-menu-open .mobile-orders-btn {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu.mobile-menu-open .nav-link:nth-child(1) { transition-delay: 0.08s; }
.mobile-menu.mobile-menu-open .nav-link:nth-child(2) { transition-delay: 0.16s; }
.mobile-menu.mobile-menu-open .nav-link:nth-child(3) { transition-delay: 0.24s; }
.mobile-menu.mobile-menu-open .nav-link:nth-child(4) { transition-delay: 0.32s; }
.mobile-menu.mobile-menu-open .mobile-orders-btn { transition-delay: 0.4s; }

/* ============================================
   10 · MOBILE BOTTOM NAVIGATION
   Thumb-friendly quick nav — the primary
   navigation pattern on phones.
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: none;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 24px rgba(44, 29, 18, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--bottom-nav-h);
  padding: 7px 4px 5px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  position: relative;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.3s var(--ease-spring);
}

/* Active indicator bar */
.bottom-nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 28px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--brand-gradient);
  transition: transform 0.3s var(--ease-spring);
}

.bottom-nav-item.active {
  color: var(--caramel);
}

.bottom-nav-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.bottom-nav-item.active svg {
  transform: translateY(-2px) scale(1.12);
}

.bottom-nav-item:active svg {
  transform: scale(0.88);
}

.bottom-nav-badge {
  position: absolute;
  top: 5px;
  inset-inline-end: calc(50% - 24px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: var(--off-white);
  font-size: 0.62rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ============================================
   11 · MOBILE REFINEMENTS (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
  :root {
    --section-padding: 68px 0;
  }

  .bottom-nav {
    display: flex;
  }

  /* Keep footer content clear of the bottom nav */
  .main-footer {
    padding-bottom: calc(24px + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  /* Lift the scroll-to-top button above the bottom nav */
  .scroll-top-btn {
    bottom: calc(var(--bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  }

  .hero {
    min-height: 94svh;
  }

  .hero-logo {
    width: 150px;
    margin-bottom: 22px;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.15rem;
  }

  .hero-tagline {
    font-size: 0.95rem;
    margin-bottom: 32px;
  }

  .btn-hero {
    width: min(320px, 84vw);
    justify-content: center;
  }

  .hero-scroll-indicator {
    bottom: calc(var(--bottom-nav-h) + 20px);
  }

  /* Sticky pill tabs — switching category stays one tap away */
  .category-tabs {
    position: sticky;
    top: calc(var(--header-h) + 8px);
    z-index: 50;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .category-tab {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    padding: 10px 8px;
  }

  .products-grid {
    gap: 16px;
  }

  .about-features {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 36px;
  }

  /* Horizontal feature rows read better on narrow screens */
  .about-feature {
    display: flex;
    align-items: center;
    text-align: start;
    gap: 16px;
    padding: 18px 20px;
  }

  .about-feature-icon {
    margin: 0;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
  }

  .about-feature h3 {
    margin-bottom: 4px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* Bottom-sheet feel for modals on phones */
  .product-modal,
  .order-modal,
  .auth-modal,
  .orders-modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.05rem;
  }

  .hero-logo {
    width: 128px;
  }

  .section-title {
    font-size: 1.7rem;
  }

  /* Two-column product grid with tighter, balanced cards */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .product-image-wrapper {
    padding: 10px;
  }
}

/* ============================================
   12 · ACCESSIBILITY — REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}