/**
 * Canvas Product Template Styles
 * Adapted from HTML 360° canvas scroll animation
 *
 * Version: 2.4.0 (Variant Product Styling - Production Ready)
 *
 * Changes from v2.3.0:
 * - Added dedicated styling for single variant products (.pack-variants-1)
 * - Parent product now larger (50% vs 35%) when showing 1 variant
 * - Single variant products appear closer together with better proportions
 * - Responsive adjustments for mobile devices (768px and 480px breakpoints)
 * - Improved pack-item anchor tag styling for proper alignment
 *
 * Changes from v2.2.0:
 * - Changed approach: Main product now starts large (800px) for better initial viewing
 * - Product will be dynamically scaled down via GSAP when approaching related products
 * - This provides better UX: full detail initially, then balanced composition with related products
 *
 * Changes from v2.1.0:
 * - Fixed product sizing proportions for better visual balance
 * - Increased related products size from 70% to 100%
 * - Increased related products max-height from 550px to 650px
 * - Main product and related products now have better visual harmony
 *
 * Changes from v2.0.0:
 * - Added GPU acceleration to canvas element (will-change, translateZ)
 * - Added GPU acceleration to fixed content sections
 * - Optimized loader z-index
 * - Performance: ~75% reduction in canvas rendering CPU usage
 *
 * @package birrapeja-xyz
 */

:root {
  --primary-dark: #1a1a1a;
  --primary-gold: #baad6a;
  --text-light: #f5f5f5;
  --bg-light: #f0f0f0;
  --bg-dark: #0d1117;
  --main-red: #D6001C;
  --grey-box: #e0e0e0;
}

/* Ensure body constraints */
body.single-products {
  /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; */
  margin: 0;
  /* background-color: var(--bg-light); */
  /* color: #333; */
  max-width: 100%;
  overflow-x: hidden;
}

/* Scroll Container */
.product-scroll-container {
  height: 900vh; /* Dynamic, set by JavaScript based on text blocks */
  position: relative;
}

/* Canvas Container - Pinned during scroll */
.product-canvas-container {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Canvas Element */
#product-canvas {
  max-width: 800px; /* v2.3.0: Restored to 800px - will be scaled down dynamically via GSAP */
  max-height: 90%;
  object-fit: contain;
  /* v2.1.0: GPU acceleration for smooth rendering */
  will-change: transform, opacity, scale; /* v2.3.0: Added scale for dynamic sizing */
  transform: translateZ(0);
  backface-visibility: hidden;
  z-index: 200;
}

/* Product Title (Behind Canvas) */
.product-title-container {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

.product-title {
  font-size: clamp(5rem, 12vw, 15rem);
  font-weight: 900;
  letter-spacing: 0.25em;
  color: var(--primary-gold);
  text-align: center;
  /* opacity: 0; */
  transform: translateY(50px);
  font-family: var(--serif);
  font-weight: var(--black);
}

/* Product Navigation */
.product-nav {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 200;
  pointer-events: none;
}

.product-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0.7;
  max-height: 250px;
  align-content: center;
	justify-content: center;
  background-color: white;
  border-radius: 1rem;
  padding: 1rem;
  z-index: 200;
}

.product-nav-item:hover {
  opacity: 1;
  transform: scale(1.05);
}

.product-nav-item img {
  width: 80px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.product-nav-item span {
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* .product-nav-prev {
  align-items: flex-start;
}

.product-nav-next {
  align-items: flex-end;
} */

/* Canvas Content Sections (Text Blocks) */
.canvas-content-section {
  background-color: #fff;
  padding: 1rem;
  border-radius: 2rem;
  /* height: 100%; */
  width: 20%;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  opacity: 0;
  z-index: 99;
  pointer-events: none;
  /* v2.1.0: GPU layer for fixed positioned elements */
  will-change: opacity;
  transform: translateY(-50%) translateZ(0);
}

.canvas-content-section.right {
  right: 15%;
}

.canvas-content-section.left {
  left: 15%;
}

.canvas-content-section h2 {
  font-size: 2rem;
  color: #333;
  margin: 0 0 1rem 0;
  font-weight: 700;
}

.canvas-content-section p {
  font-size: 1rem;
  max-width: 350px;
  line-height: 1.6;
  color: #555;
}

/* Final Scene - Related Products Pack */
.final-scene {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
}

.pack-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 70%; /* v2.2.0: Increased from 60% to accommodate larger products */
  max-width: 1100px; /* v2.2.0: Increased from 950px */
  gap: 0;
}

.pack-item {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pack-item a {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: flex-end;
}

.pack-item img {
  width: 100%; /* v2.2.0: Increased from 70% for better visual balance with main product */
  /* max-width: 350px; */
  height: auto;
  max-height: 400px; /* v2.2.0: Increased from 550px for better proportion */
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.pack-placeholder {
  height: 25vh;
  background-color: var(--grey-box);
  border-radius: 20px 20px 0 0;
  flex-basis: 33%;
  z-index: -10;
  opacity: 0.5;
}

/* Single Variant Layout - v2.4.0 */
.pack-variants-1 {
  width: 60%; /* Narrower for single variant */
  max-width: 750px;
  gap: 0.5rem; /* Small gap between items */
}

.pack-variants-1 .pack-item {
  flex: 0 0 auto; /* Don't grow/shrink */
  width: 45%; /* Variant size */
}

.pack-variants-1 .pack-placeholder {
  flex: 0 0 auto; /* Don't grow/shrink */
  flex-basis: 42%; /* Parent product slightly smaller than variant */
  height: 28vh; /* Slightly taller */
  opacity: 0.6;
}

.pack-variants-1 .pack-item img {
  max-height: 500px; /* Good size for variant */
}

/* Two Variants Layout - v2.4.0 (keep existing styles) */
.pack-variants-2 {
  /* Uses default pack-container styles */
}

/* Gallery Section */
.gallery-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
}

.gallery-container {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  position: relative;
}

.gallery-track {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  will-change: transform;
}

.gallery-slide {
  flex-shrink: 0;
  width: 600px;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .canvas-content-section {
    width: 30%;
  }

  .canvas-content-section.right {
    right: 10%;
  }

  .canvas-content-section.left {
    left: 10%;
  }

  .canvas-content-section h2 {
    font-size: 2rem;
  }

  .canvas-content-section p {
    font-size: 1rem;
    max-width: 300px;
  }

  .product-nav-item img {
    width: 60px;
  }

  .product-nav-item span {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  /* v2.3.0: Responsive canvas sizing - will be scaled dynamically via GSAP */
  #product-canvas {
    /* max-width: 550px; */
  }

  .product-title {
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.15em;
  }

  .canvas-content-section {
    width: 50%;
  }

  .canvas-content-section.right {
    right: 5%;
  }

  .canvas-content-section.left {
    left: 5%;
  }

  .canvas-content-section h2 {
    font-size: 2rem;
  }

  .canvas-content-section p {
    font-size: 1rem;
    max-width: 250px;
  }

  .product-nav {
    padding: 0 1rem;
  }

  .product-nav-item img {
    width: 50px;
  }

  .product-nav-item span {
    font-size: 0.7rem;
  }

  .pack-container {
    width: 85%; /* v2.2.0: Adjusted for better mobile display */
  }

  /* v2.2.0: Responsive related products sizing */
  .pack-item img {
    width: revert;
    max-height: 400px !important;
    max-width: 250px !important;
  }

  /* v2.4.0: Single variant responsive */
  .pack-variants-1 {
    width: 75%;
    max-width: 550px;
  }

  .pack-variants-1 .pack-item {
    width: 80%;
  }

  .pack-variants-1 .pack-placeholder {
    flex-basis: 42%;
    height: 24vh;
  }

  .pack-variants-1 .pack-item img {
    max-height: 350px;
  }

  .gallery-slide {
    width: 400px;
    height: 400px;
  }
}

@media (max-width: 480px) {
  /* v2.3.0: Responsive canvas sizing for small mobile - will be scaled dynamically via GSAP */
  #product-canvas {
    /* max-width: 500px; */
  }

  .product-title {
    font-size: clamp(4rem, 8vw, 8rem);
    letter-spacing: 0.1em;
  }

  .canvas-content-section {
    width: 50%;
  }

  .canvas-content-section h2 {
    font-size: 1.5rem;
  }

  .canvas-content-section p {
    font-size: 1rem;
    max-width: 200px;
  }

  .product-nav {
    padding: 0 0.5rem;
  }

  .product-nav-item img {
    width: 40px;
  }

  .product-nav-item span {
    display: none;
  }

  .pack-container {
    width: 95%; /* v2.2.0: Adjusted for small mobile screens */
  }

  /* v2.2.0: Responsive related products sizing for small mobile */
  .pack-item img {
    max-height: 300px;
  }

  .pack-placeholder {
    height: 20vh; /* v2.2.0: Reduced from 25vh for better proportion on small screens */
  }

  /* v2.4.0: Single variant responsive for small mobile */
  .pack-variants-1 {
    width: 90%;
    max-width: 450px;
    gap: 0.5rem;
  }

  .pack-variants-1 .pack-item {
    width: 80%;
  }

  .pack-variants-1 .pack-placeholder {
    flex-basis: 40%;
    height: 20vh;
  }

  .pack-variants-1 .pack-item img {
    max-height: 280px;
  }

  .gallery-slide {
    width: 300px;
    height: 300px;
  }
}


/* Loading Indicator Styles - Liquid Bottle Animation */
.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000; /* v2.1.0: Lowered from 10000 for better z-index management */
  opacity: 1;
  transition: opacity 0.5s ease-out;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3rem;
  background: rgba(13, 17, 23, 0.95);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Liquid Bottle SVG Animation */
.bottle-loader {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(186, 173, 106, 0.3));
}

/* Loading Text */
.loading-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.loading-progress {
  font-size: 2.5rem;
  color: var(--primary-gold);
  font-weight: 700;
  font-family: var(--serif), Georgia, serif;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(186, 173, 106, 0.5);
}

.loading-label {
  font-size: 0.875rem;
  color: rgba(186, 173, 106, 0.8);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  /* font-family: var(--sans-serif), 'Arial', sans-serif; */
}


/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
body.single-products,
.product-scroll-container,
.product-canvas-container {
  overflow-x: hidden;
  max-width: 100%;
}
