/* CSS Reset & Variable Definitions */
:root {
  --bg-color: #0a0a0a;
  --bg-loader: #050505;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --accent-color: #6366f1;
  --gradient-accent: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  scroll-behavior: auto; /* Ensure manual scrolling is precise */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip; /* Modern CSS standard: hides 100vw horizontal overflow without breaking position: sticky */
}

/* Hide scrollbar for standard premium view, but keep functionality */
body::-webkit-scrollbar {
  width: 8px;
}
body::-webkit-scrollbar-track {
  background: var(--bg-color);
}
body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Premium Preloader Overlay */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-loader);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s;
  opacity: 1;
  visibility: visible;
}

.loader-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 85%;
  max-width: 320px;
}

/* Elegant Thin Spinner */
.loader-spinner {
  width: 70px;
  height: 70px;
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  margin-bottom: 24px;
  position: relative;
}

.loader-spinner::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid transparent;
  border-bottom: 2px solid #a855f7;
  border-radius: 50%;
  animation: spin-reverse 2.4s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

.loader-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

/* Gradient Percentage */
.loader-percentage {
  font-size: 3.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.loader-subtext {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Progress bar container */
.loader-progress-bar {
  width: 100%;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

/* Progress bar fill */
.loader-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-accent);
  transition: width 0.3s cubic-bezier(0.1, 0.8, 0.25, 1);
}

/* Scroll Pinning Mechanics */
.scroll-container {
  position: relative;
  /* Scroll track length. Adjust in JS or keep here.
     400vh is optimal for 40 frames (~100px scroll per frame). */
  height: 400vh;
  background-color: var(--bg-color);
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  box-sizing: border-box;
}

.sticky-container {
  position: sticky;
  /* Support offsetting the top of the container if the parent website has a sticky/fixed header.
     Defaults to 0px, but can be easily overridden in CSS. */
  top: var(--navigation-header-height, 0px);
  height: calc(100vh - var(--navigation-header-height, 0px));
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-color);
  box-sizing: border-box;
}

#animation-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the container fully (Zero black margins, touches edges) */
}

/* Elegant touch response for mobile devices */
@media (hover: none) {
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* Text Overlay Container */
.overlay-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Allows scrolling through text */
  z-index: 10;
}

/* Base style for individual slides */
.text-slide {
  position: absolute;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 90%;
  padding: 24px 32px;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  will-change: transform, opacity; /* Performance optimization */
}

/* Layout Types */
.text-slide.type-center {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  align-items: center;
  max-width: 680px;
  background: rgba(10, 10, 10, 0.55);
}

.text-slide.type-left {
  left: 8vw;
  top: 50%;
  transform: translateY(-50%);
  text-align: left;
  align-items: flex-start;
  max-width: 380px;
  background: rgba(10, 10, 10, 0.35); /* More transparent to keep products visible */
}

.text-slide.type-right {
  right: 8vw;
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
  align-items: flex-end;
  max-width: 380px;
  background: rgba(10, 10, 10, 0.35);
}

.text-slide.type-bottom-center {
  left: 50%;
  bottom: 8vh;
  transform: translateX(-50%);
  text-align: center;
  align-items: center;
  max-width: 620px;
  background: rgba(10, 10, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Typography Details */
.slide-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: rgba(255, 255, 255, 0.9);
}

.slide-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.25;
}

.slide-desc {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Welcome Screen Full-Screen Banner Layout */
#slide-0.type-center {
  left: 50% !important;
  top: 50% !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-sizing: border-box;
}

.welcome-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Brand Finale Logo Styling */
.finale-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  margin: 4px auto 12px auto;
  /* Shows original full logo colors */
}

.brand-subtext {
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

/* Light Glassmorphic Panel for Slide 6 to support full color brand logo */
#slide-6.type-bottom-center {
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

#slide-6 .brand-subtext {
  color: #1c2b46 !important;
  font-weight: 500 !important;
}

/* Scroll Indicator Overlay */
.scroll-indicator-overlay {
  position: absolute;
  bottom: 15vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 15;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s;
  opacity: 1;
  visibility: visible;
}

.scroll-text {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #1c2b46; /* Deep navy matching the brand logo for high visibility on light banner */
  font-weight: 600;
}

.scroll-mouse {
  width: 22px;
  height: 36px;
  border: 2px solid rgba(28, 43, 70, 0.65); /* Deep navy matching the brand logo */
  border-radius: 11px;
  position: relative;
}

.scroll-wheel {
  width: 4px;
  height: 8px;
  background-color: #1c2b46; /* Deep navy matching the brand logo */
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scroll-wheel-anim 1.6s ease-in-out infinite;
}

@keyframes scroll-wheel-anim {
  0% {
    top: 6px;
    opacity: 1;
  }
  50% {
    top: 18px;
    opacity: 0;
  }
  100% {
    top: 6px;
    opacity: 0;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .text-slide {
    padding: 18px 24px;
    border-radius: 16px;
    left: 50% !important;
    right: auto !important;
    width: 90% !important;
    max-width: 90% !important;
    text-align: center !important;
    align-items: center !important;
    background: rgba(10, 10, 10, 0.6) !important;
  }

  /* Position bottom slides on mobile */
  .text-slide.type-left, 
  .text-slide.type-right, 
  .text-slide.type-bottom-center {
    top: auto !important;
    bottom: 6vh !important;
  }

  /* Position welcome slide on mobile */
  .text-slide.type-center {
    top: 50% !important;
  }

  .slide-title {
    font-size: 1.4rem;
  }
  
  .slide-desc {
    font-size: 0.85rem;
  }
  
  .brand-welcome-title {
    font-size: 2.2rem;
  }

  .welcome-logo {
    max-width: 220px !important;
    margin: 8px auto 12px auto !important;
  }

  .finale-logo {
    max-width: 130px !important;
    margin: 4px auto 8px auto !important;
  }
  
  .brand-subtext {
    font-size: 0.95rem;
  }

  .scroll-indicator-overlay {
    bottom: 3vh;
  }
}
