/*
===========================================
MAIN.CSS - WEDDING WEB
===========================================
File ini berisi:
1. Root Variables untuk kemudahan maintenance
2. Inisialisasi AOS dan library lainnya
3. Base setup dan konfigurasi dasar
4. Performance optimizations
===========================================
*/

/*FONT INSTALL*/
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap');
@import url('../css/fonts/e111viva/styles.css');

/* ===== ROOT VARIABLES ===== */
:root {
  /* Primary Colors */
  --primary-gradient-start: var(--text-primary);
  --primary-gradient-end: #d9f5d6;
  --primary-color: #667eea;
  --primary-dark: #5a6fd8;
  --primary-light: #7b8ceb;
  
  /* Secondary Colors */
  --secondary-color: #d4af37;
  --secondary-dark: #b8941f;
  --secondary-light: #e0c55a;
  
  /* Neutral Colors */
  --white: #ffffff;
  --black: #000000;
  --gray-50: #fafafa;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  
  /* Text Colors */
  --text-primary: #9ba498;
  --text-secondary: #555555;
  --text-muted: rgba(255, 255, 255, 0.9);
  --text-light: rgba(255, 255, 255, 0.8);
  
  /* Background Colors */
  --bg-primary: #9ba498;
  --bg-tertiary: #93b886;
  --bg-secondary: var(--gray-100);
  --bg-light-primary: #e5ede3;
  --bg-gradient: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
  --bg-gradient-light: linear-gradient(45deg, var(--gray-100), var(--gray-200));
  
  /* Typography */
  --font-base: "EB Garamond", serif;
  --font-latin: "English111 Vivace BT", cursive;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */
  --font-size-5-5xl: 3.2rem;  /* 52px */
  --font-size-6xl: 3.75rem;   /* 60px */
  --font-size-7xl: 4.5rem;    /* 72px */
  --font-size-8xl: 6rem;      /* 96px */
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  --line-height-loose: 1.8;
  
  /* Spacing */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
  --spacing-3xl: 4rem;     /* 64px */
  --spacing-4xl: 5rem;     /* 80px */
  
  /* Border Radius */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-custom: 0 8px 25px rgba(0, 0, 0, 0.1);
  --shadow-custom-hover: 0 15px 35px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-transform: transform 0.3s ease;
  --transition-all: all 0.3s ease;
  --transition-colors: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* Layout Breakpoints (for reference in JS) */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  --breakpoint-2xl: 1400px;
  
  /* Custom Wedding Variables */
  --left-side-width: 60%;
  --right-side-width: 40%;
  --mobile-breakpoint: 960px;
  
  /* Performance Variables */
  --gpu-acceleration: translateZ(0);
  --backface-visibility: hidden;
  --perspective: 1000px;

  /* other variables */
  --body-height: 100vh;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* 
Hardware Acceleration untuk elemen yang sering beranimasi
Menggunakan will-change untuk memberitahu browser elemen mana yang akan berubah
*/
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.will-change-scroll {
  will-change: scroll-position;
}

.will-change-auto {
  will-change: auto;
}

/* 
GPU Acceleration untuk smooth animations
Menggunakan transform3d untuk memaksa hardware acceleration
*/
.gpu-accelerated {
  transform: var(--gpu-acceleration);
  backface-visibility: var(--backface-visibility);
}

/* 
Optimasi untuk elemen yang sering beranimasi
Mengurangi repaint dan reflow
*/
.optimized-animation {
  transform: var(--gpu-acceleration);
  backface-visibility: var(--backface-visibility);
  will-change: transform, opacity;
}

/* ===== AOS INITIALIZATION & CUSTOMIZATION ===== */

/* 
AOS Base Setup
Mengoptimalkan performa AOS dengan custom timing dan easing
*/
[data-aos] {
  pointer-events: none;
  transition-property: transform, opacity;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-aos].aos-animate {
  pointer-events: auto;
}

/* 
Custom AOS Animations dengan Hardware Acceleration
Semua animasi menggunakan transform untuk performa optimal
*/

/* Custom Fade Animations */
[data-aos="fade-up-optimized"] {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition-property: opacity, transform;
}

[data-aos="fade-up-optimized"].aos-animate {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

[data-aos="fade-left-optimized"] {
  opacity: 0;
  transform: translate3d(-30px, 0, 0);
  transition-property: opacity, transform;
}

[data-aos="fade-left-optimized"].aos-animate {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

[data-aos="fade-right-optimized"] {
  opacity: 0;
  transform: translate3d(30px, 0, 0);
  transition-property: opacity, transform;
}

[data-aos="fade-right-optimized"].aos-animate {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Custom Scale Animations */
[data-aos="scale-up-optimized"] {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale3d(0.8, 0.8, 1);
  transition-property: opacity, transform;
}

[data-aos="scale-up-optimized"].aos-animate {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
}

/* Custom Slide Animations */
[data-aos="slide-up-optimized"] {
  transform: translate3d(0, 100%, 0);
  transition-property: transform;
}

[data-aos="slide-up-optimized"].aos-animate {
  transform: translate3d(0, 0, 0);
}

/* ===== SMOOTH SCROLLING OPTIMIZATIONS ===== */

/* 
Smooth Scrolling dengan optimasi performa
Menggunakan scroll-behavior dan optimasi untuk browser yang mendukung
*/
html {
  scroll-behavior: smooth;
  /* Optimasi untuk smooth scrolling */
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

/* 
Optimasi scrollbar untuk performa yang lebih baik
Custom scrollbar yang ringan dan smooth
*/
/* ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--radius-lg);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-gradient);
  border-radius: var(--radius-lg);
  transition: var(--transition-colors);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--text-primary), #d9f5d6);
} */

/* ===== LOADING STATES ===== */

/* 
Loading animations yang optimal
Menggunakan CSS animations yang ringan
*/
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.loading-spin {
  animation: spin 1s linear infinite;
  transform-origin: center;
}

.loading-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

/* ===== UTILITY CLASSES ===== */

/* 
Utility classes untuk optimasi performa
Classes yang sering digunakan untuk menghindari inline styles
*/

/* Display */
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }

/* Flexbox */
.flex-row { flex-direction: row !important; }
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }

/* Text */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

/* Colors */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-white { color: var(--white) !important; }
.text-gold { color: var(--secondary-color) !important; }

/* Backgrounds */
.bg-white { background-color: var(--white) !important; }
.bg-primary { background: var(--bg-gradient) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }

/* Spacing */
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }
.mt-auto { margin-top: auto !important; }
.mb-auto { margin-bottom: auto !important; }

/* Border Radius */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-2xl { border-radius: var(--radius-2xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Shadows */
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }
.shadow-custom { box-shadow: var(--shadow-custom) !important; }

/* Transitions */
.transition { transition: var(--transition-all) !important; }
.transition-fast { transition: var(--transition-fast) !important; }
.transition-colors { transition: var(--transition-colors) !important; }
.transition-transform { transition: var(--transition-transform) !important; }

/* ===== RESPONSIVE UTILITIES ===== */

/* 
Media queries menggunakan CSS custom properties
Untuk konsistensi dengan JavaScript breakpoints
PENTING: Left-side tetap fixed di semua breakpoint
*/
@media (max-width: 960px) {
  :root {
    --left-side-width: 0%;
    --right-side-width: 100%;
  }
  
  /* Left side disembunyikan di mobile tapi tetap fixed */
  .left-side {
    position: fixed !important;
    transform: translateX(-100%) !important;
    overflow: hidden !important;
  }
  
  .hidden-mobile { display: none !important; }
  .block-mobile { display: block !important; }
}

@media (min-width: 961px) {
  /* Pastikan left-side tetap fixed di desktop */
  .left-side {
    position: fixed !important;
    transform: translateX(0) !important;
    overflow: hidden !important;
  }
  
  .hidden-desktop { display: none !important; }
  .block-desktop { display: block !important; }
}

/* ===== PRINT STYLES ===== */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  .no-print {
    display: none !important;
  }
}

/* ===== ACCESSIBILITY ===== */

/* 
Reduced motion untuk users yang prefer reduced motion
Menghormati preferensi accessibility user
*/
@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;
  }
  
  [data-aos] {
    animation: none !important;
    transition: none !important;
  }
}

/* Focus styles untuk keyboard navigation */
.focus-visible:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== PERFORMANCE MONITORING ===== */

/* 
Classes untuk monitoring performa
Dapat digunakan untuk debugging dan optimasi
*/
.perf-critical {
  /* Elemen yang critical untuk performa */
  contain: layout style paint;
}

.perf-isolated {
  /* Elemen yang di-isolate untuk menghindari reflow */
  contain: layout;
}

.perf-paint-only {
  /* Elemen yang hanya mempengaruhi paint */
  contain: paint;
}