/* =========================================================
   Window Tech Section (FIXED: labels not clipped + better right label)
   File: assets/css/window-animation.css
========================================================= */

.window-tech-section{
  padding: 6rem 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fb 100%);
  /* ✅ important: keep animations clean without clipping labels */
  overflow-x: clip;
  overflow-y: visible;
}

.window-tech-container{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.window-animation-wrapper{
  position: relative;
  perspective: 1500px;
  min-height: 500px;
}

.window-cross-section{
  position: relative;
  width: 100%;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 3D Frame --- */
.window-frame{
  position: relative;
  width: 350px;
  height: 450px;
  transform-style: preserve-3d;
  animation: rotateWindow 20s ease-in-out infinite;
}

@keyframes rotateWindow{
  0%,100%{ transform: rotateY(-25deg) rotateX(5deg); }
  50%{ transform: rotateY(25deg) rotateX(-5deg); }
}

.glass-layers{
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

/* --- Glass panes --- */
.glass-pane{
  position: absolute;
  width: 280px;
  height: 380px;
  left: 50%;
  top: 50%;
  margin-left: -140px;
  margin-top: -190px;
  background: linear-gradient(135deg,
    rgba(173, 216, 250, 0.15) 0%,
    rgba(135, 206, 250, 0.25) 50%,
    rgba(173, 216, 250, 0.15) 100%
  );
  border: 3px solid rgba(255,255,255,.6);
  border-radius: 8px;
  box-shadow:
    inset 0 0 30px rgba(255,255,255,.4),
    0 8px 32px rgba(0,0,0,.15),
    0 0 0 1px rgba(100,150,200,.2);
  backdrop-filter: blur(2px);
  transform-style: preserve-3d;
}

.glass-pane::before{
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 30%;
  height: 40%;
  background: linear-gradient(135deg, rgba(255,255,255,.6), transparent);
  border-radius: 50%;
  filter: blur(20px);
}

.glass-pane:nth-child(1){
  transform: translateZ(-60px);
  background: linear-gradient(135deg,
    rgba(173,216,250,.20) 0%,
    rgba(135,206,250,.30) 50%,
    rgba(173,216,250,.20) 100%
  );
}

.glass-pane:nth-child(2){
  transform: translateZ(0px);
  background: linear-gradient(135deg,
    rgba(173,216,250,.25) 0%,
    rgba(135,206,250,.35) 50%,
    rgba(173,216,250,.25) 100%
  );
}

.glass-pane:nth-child(3){
  transform: translateZ(60px);
  background: linear-gradient(135deg,
    rgba(173,216,250,.30) 0%,
    rgba(135,206,250,.40) 50%,
    rgba(173,216,250,.30) 100%
  );
}

/* --- Gas layers --- */
.gas-layer{
  position: absolute;
  width: 280px;
  height: 380px;
  left: 50%;
  top: 50%;
  margin-left: -140px;
  margin-top: -190px;
  background: radial-gradient(ellipse at center,
    rgba(135,206,250,.15) 0%,
    rgba(100,180,230,.08) 50%,
    transparent 80%
  );
  border-radius: 8px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.gas-layer:nth-child(4){ transform: translateZ(-30px); }
.gas-layer:nth-child(5){ transform: translateZ(30px); }

/* =========================================================
   Labels (FIXED: right label not clipped + can wrap)
========================================================= */
.glass-label{
  position: absolute;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 10;
}

.label-line{
  position: absolute;
  height: 2px;
  background: var(--primary);
  transform-origin: left center;
  animation: drawLine 2s ease-out;
}

@keyframes drawLine{
  from{ width: 0; opacity: 0; }
  to{ width: 100%; opacity: 1; }
}

.label-text{
  position: absolute;
  background: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  border: 2px solid var(--primary);
  white-space: nowrap; /* left labels stay compact */
  animation: fadeInLabel 2s ease-out 0.3s both;
}

.label-text small{
  display: block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 0.68rem;
  opacity: 0.8;
}

@keyframes fadeInLabel{
  from{ opacity: 0; transform: translateY(-10px); }
  to{ opacity: 1; transform: translateY(0); }
}

.label-left{
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 0.5rem;
}

.label-right{
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.5rem;
}

/* --- Left labels (outside / middle) --- */
.label-outer{
  left: -120px;
  top: 30%;
}
.label-outer .label-line{
  width: 100px;
  left: 0;
  top: 50%;
}

.label-middle{
  left: -120px;
  top: 50%;
}
.label-middle .label-line{
  width: 100px;
  left: 0;
  top: 50%;
}

/* --- Right label (inner) FIXED --- */
.label-inner{
  right: -135px; /* ✅ slightly more room */
  top: 70%;
}

.label-inner .label-line{
  width: 110px;
  right: 0;
  top: 50%;
  transform-origin: right center;
}

/* ✅ allow wrap + prevent cut on the RIGHT label box */
.label-inner .label-text{
  right: 0;
  left: auto;
  white-space: normal;
  max-width: 170px;
  text-align: left;
  line-height: 1.2;
}

/* =========================================================
   Spacing indicators
========================================================= */
.spacing-indicator{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 40px;
  background: var(--primary);
  margin-left: -1px;
  margin-top: -20px;
  transform-style: preserve-3d;
  opacity: 0.6;
}

.spacing-indicator::before,
.spacing-indicator::after{
  content: '';
  position: absolute;
  width: 12px;
  height: 2px;
  background: var(--primary);
  left: -5px;
}

.spacing-indicator::before{ top: 0; }
.spacing-indicator::after{ bottom: 0; }

.spacing-1{ transform: translateZ(-45px); }
.spacing-2{ transform: translateZ(45px); }

/* =========================================================
   Steps indicator
========================================================= */
.repair-steps-indicator{
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  z-index: 10;
}

.step-dot{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.step-dot.active{
  background: var(--primary);
  transform: scale(1.3);
}

.step-dot::after{
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.step-dot.active::after{
  opacity: 1;
  animation: ripple 1.5s ease-out infinite;
}

@keyframes ripple{
  0%{ transform: scale(1); opacity: 1; }
  100%{ transform: scale(1.8); opacity: 0; }
}

/* =========================================================
   Content (right side)
========================================================= */
.window-tech-content h2{
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.window-tech-content .subtitle{
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.tech-feature{
  display: flex;
  gap: 1rem;
  align-items: start;
  padding: 1.5rem;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.tech-feature:hover{
  transform: translateX(8px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

.tech-icon{
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), .3);
}

.tech-feature-content h3{
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.tech-feature-content p{
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.tech-stats{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #e2e8f0;
}

.tech-stat{ text-align: center; }

.tech-stat-number{
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.tech-stat-label{
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* =========================================================
   Responsive
========================================================= */
@media (max-width: 968px){
  .window-tech-container{
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .window-animation-wrapper{ min-height: 400px; }

  .window-frame{
    width: 280px;
    height: 380px;
  }

  .glass-pane,
  .gas-layer{
    width: 220px;
    height: 320px;
    margin-left: -110px;
    margin-top: -160px;
  }

  .label-outer,
  .label-middle{ left: -100px; }

  .label-inner{ right: -110px; }

  .label-outer .label-line,
  .label-middle .label-line{ width: 80px; }

  .label-inner .label-line{ width: 90px; }

  .label-inner .label-text{
    max-width: 160px;
  }

  .window-tech-content h2{ font-size: 2rem; }

  .tech-stats{
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 640px){
  .window-tech-section{ padding: 4rem 0; }
  .window-tech-container{ padding: 0 1rem; }

  .window-frame{
    width: 240px;
    height: 320px;
  }

  .glass-pane,
  .gas-layer{
    width: 180px;
    height: 260px;
    margin-left: -90px;
    margin-top: -130px;
  }

  /* keep it clean on mobile */
  .glass-label,
  .spacing-indicator{ display: none; }

  .tech-feature{ padding: 1rem; }

  .tech-icon{
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}
