/* ============================================================
   AR-RAHMANI — Design System
   Ultra-Premium Luxury Perfume House
   Fonts loaded via <link> in HTML head for non-blocking fetch
   ============================================================ */

/* ============================================================
   CSS Custom Properties (Design Tokens)
   ============================================================ */
:root {
  /* --- Color Palette --- */
  --color-bg-primary: #050505;
  --color-bg-secondary: #0E0E0E;
  --color-bg-tertiary: #141414;
  --color-bg-card: rgba(14, 14, 14, 0.6);

  --color-gold: #D4AF37;
  --color-gold-soft: #F5E6A3;
  --color-gold-dark: #B8960C;
  --color-gold-glow: rgba(212, 175, 55, 0.3);
  --color-gold-subtle: rgba(212, 175, 55, 0.08);
  --color-gold-border: rgba(212, 175, 55, 0.15);
  --color-gold-border-hover: rgba(212, 175, 55, 0.4);

  --color-text-primary: #FFFFFF;
  --color-text-secondary: #C8C8C8;
  --color-text-muted: #888888;
  --color-text-gold: #D4AF37;

  /* --- Typography --- */
  --font-heading: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Font Sizes — fluid scale */
  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.3vw, 0.9rem);
  --text-base: clamp(0.9rem, 0.85rem + 0.3vw, 1rem);
  --text-md: clamp(1rem, 0.9rem + 0.5vw, 1.15rem);
  --text-lg: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --text-xl: clamp(1.3rem, 1.1rem + 0.8vw, 1.75rem);
  --text-2xl: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
  --text-3xl: clamp(2rem, 1.5rem + 2vw, 3rem);
  --text-4xl: clamp(2.5rem, 1.8rem + 3vw, 4rem);
  --text-5xl: clamp(3rem, 2rem + 4vw, 5.5rem);
  --text-6xl: clamp(3.5rem, 2.2rem + 5vw, 7rem);
  --text-hero: clamp(3.5rem, 2rem + 6vw, 8.5rem);

  /* Font Weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;
  --leading-loose: 2;

  /* Letter Spacing */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.08em;
  --tracking-wider: 0.15em;
  --tracking-widest: 0.25em;
  --tracking-luxury: 0.35em;

  /* --- Spacing Scale (8px base) --- */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 2.5rem;    /* 40px */
  --space-8: 3rem;      /* 48px */
  --space-9: 4rem;      /* 64px */
  --space-10: 5rem;     /* 80px */
  --space-11: 6rem;     /* 96px */
  --space-12: 8rem;     /* 128px */
  --space-13: 10rem;    /* 160px */
  --space-14: 12rem;    /* 192px */
  --space-section: clamp(5rem, 4rem + 6vw, 12rem);

  /* --- Borders & Radii --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  --border-gold: 1px solid var(--color-gold-border);
  --border-gold-hover: 1px solid var(--color-gold-border-hover);

  /* --- Shadows --- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
  --shadow-gold-sm: 0 2px 12px rgba(212, 175, 55, 0.1);
  --shadow-gold-md: 0 4px 24px rgba(212, 175, 55, 0.15);
  --shadow-gold-lg: 0 8px 48px rgba(212, 175, 55, 0.2);
  --shadow-gold-glow: 0 0 30px rgba(212, 175, 55, 0.15), 0 0 60px rgba(212, 175, 55, 0.08);

  /* --- Glass Effect --- */
  --glass-bg: rgba(14, 14, 14, 0.4);
  --glass-bg-hover: rgba(14, 14, 14, 0.6);
  --glass-blur: blur(20px);
  --glass-blur-heavy: blur(40px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.06);

  /* --- Gradients --- */
  --gradient-gold: linear-gradient(135deg, #D4AF37 0%, #F5E6A3 50%, #D4AF37 100%);
  --gradient-gold-text: linear-gradient(135deg, #D4AF37 0%, #F5E6A3 40%, #D4AF37 80%);
  --gradient-gold-subtle: linear-gradient(135deg, rgba(212,175,55,0.1) 0%, rgba(245,230,163,0.05) 100%);
  --gradient-dark: linear-gradient(180deg, #050505 0%, #0E0E0E 100%);
  --gradient-dark-reverse: linear-gradient(180deg, #0E0E0E 0%, #050505 100%);
  --gradient-radial-gold: radial-gradient(ellipse at center, rgba(212,175,55,0.08) 0%, transparent 70%);
  --gradient-hero: radial-gradient(ellipse at 50% 40%, rgba(212,175,55,0.06) 0%, transparent 60%);
  --gradient-vignette: radial-gradient(ellipse at center, transparent 50%, rgba(5,5,5,0.8) 100%);
  --gradient-fade-bottom: linear-gradient(to bottom, transparent 0%, var(--color-bg-primary) 100%);

  /* --- Transitions --- */
  --ease-luxury: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 600ms;
  --duration-slower: 800ms;
  --duration-slowest: 1200ms;

  /* --- Z-Index Scale --- */
  --z-behind: -1;
  --z-base: 1;
  --z-above: 10;
  --z-nav: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-loader: 10000;
  --z-cursor: 9999999;
}

/* ============================================================
   Global Reset & Base Styles
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  overflow-x: clip;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  cursor: none;
}

/* Restore default cursor on mobile/touch */
@media (hover: none) {
  body { cursor: auto; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

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

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

button {
  font-family: inherit;
  cursor: none;
  border: none;
  background: none;
  color: inherit;
}

@media (hover: none) {
  button { cursor: pointer; }
}

ul, ol {
  list-style: none;
}

::selection {
  background: rgba(212, 175, 55, 0.3);
  color: var(--color-text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.4);
}

/* ============================================================
   Typography Utilities
   ============================================================ */
.heading-hero {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}

.heading-1 {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}

.heading-2 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--weight-light);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
  color: var(--color-text-primary);
}

.heading-3 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

.heading-4 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

.subheading {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-secondary);
}

.label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-luxury);
  text-transform: uppercase;
  color: var(--color-text-gold);
}

.body-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

/* Gold gradient text */
.text-gold-gradient {
  background: var(--gradient-gold-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Italic accent */
.text-italic {
  font-style: italic;
}

/* ============================================================
   Layout Utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-wide {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-section) 0;
  position: relative;
}

/* Gold divider line */
.divider {
  width: 60px;
  height: 1px;
  background: var(--gradient-gold);
  margin: var(--space-6) auto;
  opacity: 0.6;
}

.divider-wide {
  width: 120px;
}

/* Visually hidden (screen reader only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   PERFORMANCE — Content Visibility & GPU Containment
   Skips layout/paint for offscreen sections to reduce
   initial render cost. contain-intrinsic-size prevents
   layout shifts when sections enter viewport.
   ============================================================ */
.story,
.ingredients,
.why-us,
.catalogue,
.footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 800px;
}

@media (max-width: 768px) {
  .story,
  .ingredients,
  .why-us,
  .catalogue,
  .footer {
    content-visibility: visible !important;
  }
}

/* Craftsmanship uses GSAP pin: true — content-visibility breaks pinning */

/* GPU layer promotion for heavy animation containers */
.hero-canvas,
.hero-particles-canvas,
.catalogue-dust-canvas {
  will-change: transform;
  contain: strict;
}

/* Smooth image rendering for all product images */
img {
  content-visibility: auto;
}

/* Optimize backdrop-filter rendering */
.navbar-inner,
.showcase-container {
  contain: layout style;
}

/* ============================================================
   MOBILE RESOLUTIONS — DISABLE ALL HOVER ANIMATIONS & TRANSFORMS
   Disables sticky hover states, scale shifts, image swapping, 
   and hover glows across all elements on mobile viewports.
   ============================================================ */
@media (max-width: 992px), (hover: none) {
  .btn:hover,
  .btn-primary:hover,
  .btn-ghost:hover,
  .btn-add-bag:hover,
  .cat-card:hover,
  .feature-card:hover,
  .ingredient-card:hover,
  .product-card:hover,
  .signature-card:hover,
  .testimonial-card:hover,
  .showcase-nav-group:hover,
  .arrow-btn-standalone:hover,
  .preview-card-box:hover,
  .size-btn:hover,
  .btn-wishlist:hover,
  .catalogue-chip:hover,
  .catalogue-search:hover,
  .cat-btn-cart:hover,
  .cat-btn-details:hover,
  .navbar-links a:hover,
  .nav-cart-btn:hover,
  .instagram-item:hover {
    transform: none !important;
    box-shadow: none !important;
    filter: none !important;
  }

  .cat-card:hover img,
  .product-card:hover img,
  .ingredient-card:hover img,
  .signature-card:hover img,
  .instagram-item:hover img,
  .feature-card:hover .feature-card-icon,
  .feature-card:hover .feature-card-icon svg {
    transform: none !important;
    filter: none !important;
  }

  /* Prevent image swap on mobile hover for product cards */
  .cat-card:hover .cat-card-bottle--primary {
    opacity: 1 !important;
  }
  .cat-card:hover .cat-card-bottle--hover {
    opacity: 0 !important;
  }
}

/* ============================================================
   MOBILE PERFORMANCE OVERHAUL (≤768px Only — 60 FPS Target)
   ============================================================ */
@media (max-width: 768px) {
  /* 1. GPU Acceleration & Repaint Prevention */
  .reveal,
  .reveal-up,
  .reveal-down,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .cat-card,
  .feature-card,
  .ingredient-card,
  .product-card {
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  /* 2. 70% Blur Reduction — Replace heavy backdrop-filters with translucent dark backgrounds */
  *, *::before, *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .navbar-inner,
  .cat-modal-overlay,
  .cat-modal,
  .cat-card,
  .product-card,
  .glass-card,
  .feature-card,
  .ingredient-card,
  .showcase-container,
  .cart-drawer,
  .cart-drawer-footer,
  .preview-card-box {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-color: rgba(10, 10, 10, 0.94) !important;
  }

  /* 3. Disable Heavy Filter Blurs & Glowing Shadows on Mobile */
  .craft-bg-layer.smoke,
  .craft-bg-layer.light,
  .craft-bg-layer.dust,
  .showcase-glow,
  .showcase-smoke,
  .hero-glow,
  .hero-smoke-overlay,
  .hero-vignette {
    filter: none !important;
    box-shadow: none !important;
    opacity: 0.12 !important;
  }

  /* 4. Requirement 9: Pure CSS Sticky Navigation for Mobile Header */
  .navbar {
    position: sticky !important;
    top: 0 !important;
    transform: none !important;
    transition: background-color 0.3s ease !important;
  }

  /* 5. Requirement 5: Section Rendering Containment */
  section {
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
  }

  .hero {
    contain: layout paint style;
    content-visibility: visible !important;
  }
}
