/* ===== AUTOMOTIVES PAGE ===== */

/* Hide header while pinned car section is active (mirrors electronics page behavior) */
@media (min-width: 577px) {
  body.is-car-focused .ly_header,
  body.is-car-focused .ly_globalNav {
    transform: translateY(-200px);
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
  }
}

.ly_header,
.ly_globalNav {
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}


.auto-description {
  padding: 60px 0;
  text-align: center;
}

.auto-description p {
  max-width: 1000px;
  margin: 0 auto;
}

/* ===== INTERACTIVE CAR SECTION ===== */
.car-interactive {
  /*padding: 30px 0 60px;*/
  background: linear-gradient(to bottom, #f0f2f5 0%, #e8eaed 100%);
  position: relative;
}

.car-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  align-items: center;
  width: 100%;
  /*max-width: 1200px;*/
  margin: 0 auto;
  padding: 0;
  min-height: 500px;
  position: relative;
  /*height: 500px;*/
}

/* ===== TIMELINE PARTS LIST ===== */
.car-parts-timeline-wrapper {
  position: absolute;
  left: 10px;
  height: fit-content;
  /*overflow: hidden;*/
  z-index: 1;
  padding: 30px 0;
}
.car-parts-timeline-wrapper::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 10px;
  background: rgb(255, 255, 255, 0.3);
  filter: blur(4px);
  z-index: -1;
}
.car-parts-timeline {
  position: relative;
  left: 0;
  height: calc(60px * 5 + 0px * 2); /*how many item u wan to show, 30 is half of it prepad*/
  overflow: auto;
  z-index: 1;
  
  /* Hide scrollbar for Chrome, Safari and Opera */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.car-parts-timeline::-webkit-scrollbar {
  display: none;
}

/* Fade masks top and bottom */
.car-parts-timeline-wrapper::before {
  content: '';
  position: absolute;
  height: 100%;
  width: 2px;
  background: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  top: 0;
  left: 24px;
}

/* .car-parts-timeline-wrapper::before,
.car-parts-timeline-wrapper::after {
  content: '';
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 3;
  pointer-events: none;
} */

/* .car-parts-timeline-wrapper::before {
  top: 0;
  background: linear-gradient(to bottom, #f0f2f5 0%, transparent 100%);
} */

/* .car-parts-timeline-wrapper::after {
  bottom: 0;
  background: linear-gradient(to top, #e8eaed 0%, transparent 100%);
} */

.timeline-scroll {
  position: relative;
  padding: 0px 20px; /*prepad - half of single item*/
  /* Removed transform - using native scroll instead */
}

.timeline-line {
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  /**background: #000;**/
  background: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
  display: none;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 500;
  /*color: var(--color-text-light);*/
  text-align: left;
  position: relative;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  height: 60px; /*single item high, make sure update js file*/
  flex-shrink: 0;
  transform: scale(1);
}

.timeline-item:hover {
  color: var(--color-dark);
  opacity: 1;
  transform: scale(1.02);
  margin-left: 1px;
}

.timeline-item.active {
  color: var(--color-dark);
  font-weight: bold;
  margin-left: 0px;
  opacity: 1;
  transform: scale(1.05);
}

/* Auto-play progress indicator */
.timeline-item.active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 100%;
  background: var(--color-dark);
  animation: growHeight 3.5s ease-in-out;
}

@keyframes growHeight {
  0% { height: 0; }
  100% { height: 100%; }
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-dark);
  flex-shrink: 0;
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item:not(.active) .tl-dot {
  width: 10px;
  height: 10px;
  background: var(--color-dark);
}

.timeline-item.active .tl-dot {
  width: 14px;
  height: 14px;
  background: var(--color-dark);
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--color-dark);
  opacity: 1;
}

.tl-label {
  white-space: nowrap;
}

/* ===== 3D CAR CONTAINER ===== */
.car-3d-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
}

#carCanvas {
  width: 100%;
  height: 100vh;
  display: block;
  transition: opacity 0.5s ease;
}

@media (max-width: 767px) {
  #carCanvas {
    height: 400px;
  }
}

@media (max-width: 374px) {
  #carCanvas {
    height: 250px;
  }
}

.car-3d-container.is-interior #carCanvas {
  opacity: 0;
}

/* ===== PART INFO ===== */
.car-part-info {
  padding: 25px 15px;
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: right;
  position: absolute;
  right: 10px;
  border-radius: 10px;
  z-index: 1;
  color: #000;
}
.car-part-info::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 10px;
  background: rgb(255, 255, 255, 0.3);
  filter: blur(4px);
  z-index: -1;
}

.car-part-info.transitioning {
  opacity: 0;
}

.car-part-info h3 {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-dark);
  margin-bottom: 24px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.car-part-info:not(.transitioning) h3 {
  transform: translateY(0);
}

.car-part-info.transitioning h3 {
  transform: translateY(-10px);
}

.part-detail {
  margin-bottom: 24px;
}

.part-detail h4 {
  font-weight: bold;
  color: var(--color-dark);
  margin-bottom: 0px;
}

.part-detail p {
  color: #000;
  line-height: 1.6;
}

.part-detail .product-link {
  color: #000;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration 0.2s ease;
  display: inline;
}

.part-detail .product-link:hover {
  color: #808080;
  text-decoration: underline;
}

.part-detail .product-link:active {
  color: #000;
}

/* ===== RESPONSIVE STYLES ===== */

/* Tablet (< 960px) */
@media (max-width: 959px) {
  .car-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    padding: 90px 20px 20px; /* top offset clears the fixed header (70px) + breathing room */
    font-size: 1.8rem;
  }

  /* Stack timeline horizontally at top */
  .car-parts-timeline-wrapper {
    position: relative;
    left: auto;
    width: 100%;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 20px;
    padding: 5px 0;
  }

  .car-parts-timeline {
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }

  /* Horizontal fade masks */
  .car-parts-timeline-wrapper::before,
  .car-parts-timeline-wrapper::after {
    height: 100%;
    width: 40px;
    top: 0;
    bottom: auto;
  }

  .car-parts-timeline-wrapper::before {
    left: 0;
    right: auto;
    background: linear-gradient(to right, #f0f2f5 0%, transparent 100%);
  }

  .car-parts-timeline-wrapper::after {
    right: 0;
    left: auto;
    background: linear-gradient(to left, #e8eaed 0%, transparent 100%);
  }

  .timeline-scroll {
    display: flex;
    gap: 10px;
    width: fit-content;
  }

  .timeline-line {
    display: none;
  }

  .timeline-item {
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 12px 20px;
    gap: 8px;
    white-space: nowrap;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
  }

  .timeline-item.active {
    background: rgba(255, 255, 255, 0.9);
  }

  .timeline-item.active::before {
    display: none;
  }

  .tl-dot {
    margin: 0 auto;
  }

  /*.tl-label {
    font-size: 0.9rem;
  }*/

  /* 3D Canvas */
  #carCanvas {
    height: 400px;
  }

  /* Part info below canvas */
  .car-part-info {
    position: relative;
    right: auto;
    text-align: center;
    padding: 30px 20px;
  }

  /*.car-part-info h3 {
    font-size: 1.75rem;
  }*/
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  .car-interactive {
    padding: 20px 0 40px;
  }

  .car-layout {
    padding: 60px 10px 10px; /* top offset clears the fixed mobile header (50px) */
  }

  /* Horizontal scrolling timeline */
  .car-parts-timeline-wrapper {
    margin-bottom: 5px;
  }

  .timeline-scroll {
    padding: 0 10px;
    gap: 8px;
  }

  .timeline-item {
    padding: 12px 15px;
    /*font-size: 0.9rem;*/
  }

  .tl-dot {
    width: 10px;
    height: 10px;
  }

  .timeline-item.active .tl-dot {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-dark);
  }

  /*.tl-label {
    font-size: 0.85rem;
  }*/

  /* Smaller canvas on mobile */
  #carCanvas {
    height: 300px;
  }

  /* Compact part info */
  .car-part-info {
    padding: 20px 15px;
  }

  .car-part-info h3 {
    /*font-size: 1.5rem;*/
    margin-bottom: 16px;
  }

  .part-detail {
    margin-bottom: 16px;
  }

  /*.part-detail h4 {
    font-size: 0.95rem;
  }*/

  /*.part-detail p {
    font-size: 0.9rem;
  }*/
}

/* Extra small mobile (< 375px) */
@media (max-width: 374px) {
  #carCanvas {
    height: 250px;
  }

  /*.car-part-info h3 {
    font-size: 1.25rem;
  }*/

  .timeline-item {
    padding: 8px 12px;
  }

  /*.tl-label {
    font-size: 0.8rem;
  }*/
}

/* ===== INTERIOR IMAGE OVERLAY ===== */
.car-interior-overlay {
  position: absolute;
  /* Size by height, maintain 16:9 — matches Car-Interior.jpg (3344×1882) */
  /* This keeps % dot positions stable at every screen size */
  height: 100%;
  width: auto;
  aspect-ratio: 16 / 9;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  background: #111;
}

/* If container is wider than 16:9 — fill width instead, center vertically */
@supports (aspect-ratio: 16/9) {
  @media (min-aspect-ratio: 16/9) {
    .car-interior-overlay {
      width: 100%;
      height: auto;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
    }
  }
}

.car-interior-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.car-interior-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* zoom/pan controlled via JS inline style */
  transform-origin: var(--interior-origin-x, 50%) var(--interior-origin-y, 50%);
  transform: scale(var(--interior-scale, 1));
  transition: transform 900ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  display: block;
}

/* Badge shown on the image indicating interior view */
.car-interior-badge {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.2rem;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
}

/* ===== INDICATOR DOTS ===== */

/* Shared dot style — mirrors electronics hotspot */
.car-indicator-dot {
  position: absolute;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #83786F;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  box-shadow: 0 0 0 0.55rem rgba(131, 120, 111, 0.22),
              0 0.6rem 1.6rem rgba(0, 0, 0, 0.34);
}

/* Exterior dot sits over the canvas */
.car-indicator-dot--exterior {
  will-change: transform;
}

/* Interior dot sits over the interior image */
.car-indicator-dot--interior {
  /* left/top set by JS */
}

.car-indicator-dot.is-visible {
  opacity: 1;
}

/* Pulsing ring — mirrors electronics hotspot::before */
.car-indicator-dot::before {
  content: '';
  position: absolute;
  inset: -0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  animation: hotspot-pulse 1800ms ease-out infinite;
}

/* Only animate when visible */
.car-indicator-dot:not(.is-visible)::before {
  animation: none;
}

@keyframes hotspot-pulse {
  0%   { opacity: 0.9; transform: scale(0.72); }
  100% { opacity: 0;   transform: scale(1.7); }
}
