/* Jewellery Retouch Section Styles */
.jewellery-section {
  height: 200vh; /* Extended height for scroll-based card stacking */
  display: block;
  /* Luxurious gold/amber gradient for jewellery theme */
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 0 clamp(20px, 5vw, 80px);
  position: relative;
  overflow: visible;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: layout style;
  content-visibility: auto;
  contain-intrinsic-size: auto 200vh;
}

/* Subtle sparkle overlay effect */
.jewellery-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(212, 175, 55, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.jewellery-wrapper {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  pointer-events: none;
  padding: clamp(60px, 8vh, 100px) 0;
  box-sizing: border-box;
  gap: clamp(30px, 4vw, 60px);
}

.jewellery-wrapper * {
  pointer-events: auto;
}

/* Comparison Cards - Left Side */
.jewellery-comparison-wrapper {
  position: relative;
  width: clamp(300px, 35vw, 550px);
  height: clamp(400px, 55vh, 700px);
  flex-shrink: 0;
  opacity: 0;
  transform: translate3d(0, 100%, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.jewellery-comparison-wrapper.rocket-enter {
  animation: jewelleryRocketEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes jewelleryRocketEntrance {
  0% {
    opacity: 0;
    transform: translate3d(0, 100%, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.jewellery-comparison-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: clamp(12px, 1.5vw, 20px);
  overflow: hidden;
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(212, 175, 55, 0.1);
  opacity: 0;
  transform: translate3d(0, 100px, 0);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: strict;
  will-change: transform, opacity;
}

.jewellery-comparison-card.active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  z-index: 3;
  pointer-events: auto;
}

.jewellery-comparison-card.prev {
  opacity: 0.5;
  transform: translate3d(0, -30px, 0);
  z-index: 2;
  pointer-events: none;
}

.jewellery-comparison-card.next {
  opacity: 0;
  transform: translate3d(0, 50px, 0);
  z-index: 1;
  pointer-events: none;
}

.jewellery-comparison-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: ew-resize;
}

.jewellery-comparison-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.jewellery-comparison-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.jewellery-comparison-image.before {
  z-index: 1;
  clip-path: inset(0 50% 0 0);
  backface-visibility: hidden;
}

/* Only animate the active card */
.jewellery-comparison-card.active .jewellery-comparison-image.before {
  animation: jewellerySliderReveal 6s linear infinite;
  will-change: clip-path;
}

.jewellery-comparison-container.user-interacting .jewellery-comparison-image.before {
  animation: none !important;
  will-change: auto;
}

@keyframes jewellerySliderReveal {
  0% { clip-path: inset(0 95% 0 0); }
  50% { clip-path: inset(0 5% 0 0); }
  100% { clip-path: inset(0 95% 0 0); }
}

.jewellery-comparison-image.after {
  z-index: 0;
}

/* Jewellery Slider */
.jewellery-comparison-slider {
  position: absolute;
  top: 0;
  width: 44px;
  background: transparent;
  left: 50%;
  width: 4px;
  height: 100%;
  z-index: 10;
  transform: translateX(-50%);
  cursor: ew-resize;
}

/* Only animate the active card's slider */
.jewellery-comparison-card.active .jewellery-comparison-slider {
  animation: jewellerySliderMove 6s linear infinite;
  will-change: left;
}

.jewellery-comparison-container.user-interacting .jewellery-comparison-slider {
  animation: none !important;
  will-change: auto;
}

@keyframes jewellerySliderMove {
  0% { left: 5%; }
  50% { left: 95%; }
  100% { left: 5%; }
}

.jewellery-slider-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, #d4af37, #ffffff, #d4af37);
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.jewellery-slider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(36px, 3vw, 44px);
  height: clamp(36px, 3vw, 44px);
  background: linear-gradient(135deg, #d4af37, #f4e4bc);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  cursor: ew-resize;
}

.jewellery-slider-handle span {
  width: clamp(14px, 1.5vw, 20px);
  height: 2px;
  background: #1a1a2e;
  border-radius: 1px;
}

/* Text Content - Right Side */
.jewellery-container {
  max-width: clamp(300px, 40vw, 550px);
  flex-shrink: 0;
  text-align: right;
}

.jewellery-content {
  text-align: right;
}

.jewellery-heading {
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 700;
  margin-bottom: clamp(1rem, 2vh, 2rem);
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3em;
  line-height: 1.2;
  /* Gold shimmer effect */
  text-shadow: 
    0 0 10px rgba(212, 175, 55, 0.3),
    2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Word animation */
.jewellery-heading .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(50px) scale(0.8);
  transform-origin: center bottom;
}

.jewellery-heading.in-view .word {
  animation: jewelleryWordRise 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jewellery-heading.in-view .word:nth-child(1) { animation-delay: 0s; }
.jewellery-heading.in-view .word:nth-child(2) { animation-delay: 0.15s; }

@keyframes jewelleryWordRise {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Gold gradient on first word */
.jewellery-heading .word:first-child {
  background: linear-gradient(90deg, #d4af37, #f4e4bc, #d4af37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.jewellery-text {
  font-family: 'Space Mono', monospace;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
  font-weight: 400;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.01em;
  min-height: clamp(100px, 15vh, 150px);
}

/* Falling word animation */
.jewellery-text .word {
  display: inline-block;
  opacity: 1;
  transform: translateY(0);
  margin-right: 0.35em;
}

.jewellery-text .word.animate {
  opacity: 0;
  transform: translateY(-40px);
  animation: jewelleryWordFall 0.5s ease-out forwards;
}

@keyframes jewelleryWordFall {
  0% {
    opacity: 0;
    transform: translateY(-40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Responsive - Large Desktop
   ======================================== */
@media (min-width: 1920px) {
  .jewellery-comparison-wrapper {
    width: min(600px, 30vw);
    height: min(750px, 60vh);
  }
  
  .jewellery-container {
    max-width: min(600px, 35vw);
  }
}

/* Ultra-wide screens */
@media (min-width: 2560px) {
  .jewellery-wrapper {
    max-width: 2200px;
    margin: 0 auto;
  }
}

/* ========================================
   Responsive - Large Tablet / iPad Landscape
   ======================================== */
@media (max-width: 1366px) {
  .jewellery-comparison-wrapper {
    width: clamp(350px, 38vw, 450px);
    height: clamp(450px, 50vh, 600px);
  }
  
  .jewellery-container {
    max-width: clamp(350px, 38vw, 450px);
  }
}

/* ========================================
   Responsive - Desktop / iPad Pro Portrait
   ======================================== */
@media (max-width: 1200px) {
  .jewellery-wrapper {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .jewellery-container {
    max-width: 100%;
    text-align: center;
    margin-top: clamp(20px, 3vh, 40px);
  }
  
  .jewellery-content {
    text-align: center;
  }
  
  .jewellery-heading {
    justify-content: center;
  }
  
  .jewellery-comparison-wrapper {
    width: clamp(350px, 50vw, 420px);
    height: clamp(400px, 45vh, 550px);
    max-width: 90vw;
  }
}

/* ========================================
   Responsive - Tablet / iPad Portrait
   ======================================== */
@media (max-width: 1024px) {
  .jewellery-heading {
    font-size: clamp(1.8rem, 4vw, 3rem);
  }
  
  .jewellery-text {
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  }
  
  .jewellery-comparison-wrapper {
    width: clamp(320px, 55vw, 380px);
    height: clamp(380px, 42vh, 500px);
    max-width: 85vw;
  }
}

/* ========================================
   Responsive - Mobile
   ======================================== */
@media (max-width: 768px) {
  .jewellery-section {
    padding: 60px 20px;
    height: auto;
    min-height: 100vh;
  }
  
  .jewellery-wrapper {
    padding: 20px 0;
    gap: 30px;
    height: auto;
    min-height: auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
  
  .jewellery-container {
    position: relative;
    z-index: 10;
    max-width: 100%;
    text-align: center;
  }
  
  .jewellery-content {
    text-align: center;
  }
  
  .jewellery-heading {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
  }
  
  /* Force heading words to be visible on mobile */
  .jewellery-heading .word {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    animation: none !important;
  }
  
  .jewellery-text {
    font-size: 1rem;
    line-height: 1.7;
    min-height: auto;
    opacity: 1 !important;
    margin-bottom: 30px;
  }
  
  /* Force falling text words to be visible */
  .jewellery-text .word {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  .jewellery-comparison-wrapper {
    position: relative !important;
    transform: none !important;
    opacity: 1 !important;
    width: 100%;
    max-width: 320px;
    height: 420px;
    margin: 0 auto;
  }
  
  .jewellery-comparison-wrapper.rocket-enter {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  
  /* GPU optimization for mobile */
  .jewellery-comparison-card {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  
  .jewellery-comparison-image.before {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  
  /* Enable auto slider animation on mobile */
  .jewellery-comparison-card.active .jewellery-comparison-image.before {
    animation: jewellerySliderReveal 5s linear infinite !important;
  }
  
  .jewellery-comparison-card.active .jewellery-comparison-slider {
    animation: jewellerySliderMove 5s linear infinite !important;
  }
  
  /* Pause animation when user is interacting */
  .jewellery-comparison-container.user-interacting .jewellery-comparison-image.before,
  .jewellery-comparison-container.user-interacting .jewellery-comparison-slider {
    animation: none !important;
  }
}

/* ========================================
   Responsive - Small Mobile
   ======================================== */
@media (max-width: 480px) {
  .jewellery-section {
    padding: 40px 15px;
  }
  
  .jewellery-heading {
    font-size: 2rem;
  }
  
  .jewellery-text {
    font-size: 0.9rem;
    min-height: auto;
  }
  
  .jewellery-comparison-wrapper {
    max-width: 280px;
    height: 380px;
  }
}
