/* ===== MEDICAL PAGE 2 ===== */
.elec-description {
  padding: 50px 0;
  text-align: center;
}

.elec-description p {
  font-size: 1.8rem;
  line-height: 1.8;
  color: var(--color-text);
  max-width: 800px;
  margin: 0 auto;
}

/* ===== HEADER PUSH-OUT WHEN STORY IS FOCUSED ===== */
/*
  When the story section is in view, slide the fixed header and
  global nav fully off the top of the screen so the story can
  occupy the entire viewport.

  NOTE: .ly_globalNav has `top: 110px / 70px` set by common.css,
  so we use a fixed -200px translate (larger than header+nav combined
  height) to guarantee both elements clear the top edge regardless
  of their `top` offset.
*/
@media (min-width: 577px) {
  body.is-story-focused .ly_header,
  body.is-story-focused .ly_globalNav {
    transform: translateY(-200px);
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
  }
}

/* Smooth slide-back when the user scrolls away */
.ly_header,
.ly_globalNav {
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== STORY SECTION STYLES ===== */
:root {
  color-scheme: light;

  /* --- CORE PALETTE --- */
  /* Main theme colors used throughout the interface */
  --color-paper: #C0B4AC;           /* Silver */
  --color-ink: #2F2E1F;             /* Charcoal Brown */
  --color-muted: #B6A9A2;           /* Silver */
  --color-line: rgba(47, 46, 31, 0.28);

  /* --- BRAND COLORS --- */
  --color-accent: #83786F;          /* Grey */
  --color-accent-dark: #2F2E1F;     /* Charcoal Brown */
  --color-accent-light: #C0B4AC;    /* Silver */
  --color-accent-alpha: rgba(131, 120, 111, 0.22);

  /* --- DARK INTERFACE --- */
  --color-story-bg: #0E0E0D;        /* Onyx */
  --color-ui-bg: rgba(14, 14, 13, 0.84);
  --color-ui-text: #ECE7E7;         /* Alabaster Grey */
  --color-ui-text-muted: rgba(236, 231, 231, 0.84);
  --color-ui-border: rgba(236, 231, 231, 0.28);
  --color-ui-border-soft: rgba(236, 231, 231, 0.1);
  --color-ui-border-medium: rgba(236, 231, 231, 0.4);
  --color-ui-border-strong: rgba(236, 231, 231, 0.68);

  /* --- OVERLAYS & GRADIENTS --- */
  /* Used to enhance image readability and depth */
  --gradient-panel-overlay: none;

  /* --- SHADOWS --- */
  /* Depth effects for various components */
  --shadow-panel: rgba(14, 14, 13, 0.24);      /* Soft shadow for containers */
  --shadow-ui: 0 1.5rem 4rem rgba(0, 0, 0, 0.36); /* Strong shadow for floating overlays */
  --shadow-text: 0 1px 16px rgba(0, 0, 0, 0.45);  /* Text shadow for legibility */
  --shadow-hotspot: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.34);
  --shadow-hotspot-selected: 0 0.75rem 2rem rgba(0, 0, 0, 0.4);
  --shadow-marker: 0 0.75rem 2rem var(--shadow-panel);

  /* --- NAVIGATION --- */
  /* Specific colors for the progress rail and markers */
  --color-nav-rail: rgba(236, 231, 231, 0.55);
  --color-nav-marker-bg: rgba(255, 255, 255, 0.95);
  --color-nav-marker-border: #ffffff;
  --color-nav-hotspot-bg: rgba(255, 255, 255, 0.85);
  --color-nav-hotspot-border: #ffffff;
}

.story *,
.story *::before,
.story *::after {
  box-sizing: border-box;
}

.story button {
  font: inherit;
}

.story {
  position: relative;
  height: auto;
  overflow-x: hidden;
}

.story__sticky {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--color-story-bg);
}

.story__sticky::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.story__track {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
}

.panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  perspective: 1200px; /* Establishes the 3D depth field */
  transform-style: preserve-3d;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.panel.is-active {
  opacity: 1;
  pointer-events: auto;
}

.panel-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
  transform-style: preserve-3d;
  width: 100%;
  height: 100%;
  aspect-ratio: 16/9;
}

.panel-scroll {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Aspect ratio cover logic for desktop */
@media (min-aspect-ratio: 16/9) {
  .panel-inner {
    width: 100%;
    height: auto;
  }
}
@media (max-aspect-ratio: 16/9) {
  .panel-inner {
    width: auto;
    height: 100%;
  }
}

/* Aspect ratio cover logic for mobile: 16:9 aspect ratio with horizontal scrolling */
@media (max-width: 1024px) {
  .story__sticky {
    min-height: 100vh;
  }

  .story__track {
    height: 100vh;
    min-height: 100vh;
  }

  .panel {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    transform: translateY(-50%);
  }

  .panel-scroll {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
  }
  
  .panel-scroll::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari/Edge */
  }

  .panel-inner {
    position: relative;
    top: 0;
    left: 0;
    transform: none !important;
    height: 100% !important;
    width: auto !important;
    transform-origin: 50% 50%;
  }
}

.panel::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background: var(--gradient-panel-overlay);
  pointer-events: none;
}

@media (min-width: 768px) and (max-width: 1024px) {
  .panel{
    top:45%;
  }
  .panel-scroll {
    aspect-ratio: 1 / 1;
  }
}

.panel img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  transform-origin: 50% 50%; /* pan is handled via translateX/Y before scale */
  /* Default unzoomed transition (used when returning from zoom) */
  transition: transform 600ms cubic-bezier(0.25, 1, 0.5, 1),
              filter 600ms ease;
  will-change: transform;
}

/* Panel 1 image: crop from bottom and right side (anchor top-left) */
.panel:nth-of-type(1) img {
  object-position: left top;
}

/* Panel 2 image: crop from left and bottom side (anchor top-right) */
.panel:nth-of-type(2) img {
  object-position: right top;
}

/* Zoomed State: transform is driven by JS for continuous curved motion */
.panel.is-zoomed img {
  filter: brightness(0.85) contrast(1.05);
  transition: filter 900ms ease;
}

.hotspots {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transition: transform 600ms cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Background focus mask: creates a spotlight effect around the hotspot point when zoomed */
.hotspots::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--zoom-x, 50%) var(--zoom-y, 50%),
    transparent 0%,
    rgba(0, 0, 0, 0.25) 35%,
    rgba(0, 0, 0, 0.60) 100%
  );
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  z-index: -1; /* Place behind hotspot buttons but above the panel image */
}

.panel.is-zoomed .hotspots::before {
  opacity: 1;
  transition-delay: 450ms; /* Starts after the zoom animation completes */
}

/* .panel.is-zoomed .hotspots transform is set by JS */

.hotspot-group {
  position: absolute;
  top: var(--hotspot-y);
  left: var(--hotspot-x);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  z-index: 4;
}

.hotspot {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.85rem;
  aspect-ratio: 1;
  border: 2px solid var(--color-ui-text);
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-ui-text);
  cursor: pointer;
  pointer-events: auto;
  transform: scale(1);
  box-shadow:
    0 0 0 0.55rem var(--color-accent-alpha),
    var(--shadow-hotspot);
  transition:
    background 300ms ease,
    box-shadow 300ms ease,
    transform 500ms cubic-bezier(0.25, 1, 0.5, 1),
    opacity 300ms ease;
}

/* Fade out other hotspots during zoom; counter-scale to keep visual size */
.panel.is-zoomed .hotspot:not(.is-selected) {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.4);
}

/* Float the selected hotspot towards the viewer; counter-scale (0.4 = 1/2.5) to keep visual size */
.panel.is-zoomed .hotspot.is-selected {
  background: var(--color-ui-text);
  color: var(--color-accent-dark);
  transform: translate3d(0, 0, 48px) scale(0.54); /* 0.4 base × 1.35 emphasis = 0.54 */
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.55),
    0 0 35px var(--color-accent);
}

.hotspot::before {
  position: absolute;
  inset: -0.65rem;
  border: 1px solid var(--color-ui-border-strong);
  border-radius: inherit;
  content: "";
  animation: hotspot-pulse 1800ms ease-out infinite;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.is-selected {
  background: var(--color-ui-text);
  color: var(--color-accent-dark);
  outline: none;
  transform: scale(1.12);
}

.panel.is-zoomed .hotspot:hover,
.panel.is-zoomed .hotspot:focus-visible,
.panel.is-zoomed .hotspot.is-selected {
  transform: translate3d(0, 0, 48px) scale(0.54);
}

.hotspot.is-selected {
  box-shadow:
    0 0 0 0.65rem rgba(255, 250, 242, 0.22),
    var(--shadow-hotspot-selected);
}

.hotspot__tooltip {
  position: absolute;
  bottom: calc(100% + 0.85rem);
  left: 50%;
  width: max-content;
  max-width: min(18rem, 65vw);
  padding: 0.65rem 0.95rem;
  border-radius: 0.5rem;
  background: var(--color-ui-bg);
  color: var(--color-ui-text);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 0.35rem);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

@media (hover: hover) {
  .hotspot:hover .hotspot__tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.hotspot:focus .hotspot__tooltip,
.hotspot:focus-visible .hotspot__tooltip {
  opacity: 0;
  pointer-events: none;
}

.hotspot-detail {
  position: absolute;
  left: var(--detail-x, 2.5rem);
  top: var(--detail-y, -2rem);
  z-index: 10;
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.75rem;
  color: #fff;
  background: rgba(14, 14, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.2) translateY(0.5rem);
  transform-origin: left center;
  transition:
    opacity 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.panel.is-zoomed .hotspot-detail[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  /* Counter-scale by 0.4 to keep layout readable and sharp at standard screen size */
  transform: scale(0.4) translateY(0);
}

.hotspot-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.hotspot-detail__close {
  display: flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid var(--color-ui-border-medium);
  border-radius: 50%;
  background: var(--color-ui-border-soft);
  color: var(--color-ui-text);
  cursor: pointer;
  font-size: 2rem !important;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.hotspot-detail__close:hover,
.hotspot-detail__close:focus-visible {
  background: var(--color-ui-text);
  color: var(--color-accent-dark);
  outline: none;
}

.hotspot-detail h3 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hotspot-detail__subtitle {
  margin: 0.25rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hotspot-detail p:last-child {
  margin: 0.2rem 0 0;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--color-ui-text); /* Silver */
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.hotspot-detail .product-link {
  color: #c0c0c0;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration 0.2s ease;
  display: inline;
}

.hotspot-detail .product-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.hotspot-detail .product-link:active {
  color: #a0a0a0;
}

@keyframes hotspot-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.72);
  }

  100% {
    opacity: 0;
    transform: scale(1.7);
  }
}


.story-nav {
  position: absolute;
  top: 50%;
  left: clamp(1rem, 3vw, 3rem);
  z-index: 10;
  width: auto;
  height: min(40rem, 70vh);
  opacity: 0;
  pointer-events: none;
  transform: translate(-1rem, -50%);
  transition:
    opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 0;
}

.story-nav.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%);
}

.story-nav__rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
  background: linear-gradient(to bottom, transparent 0%, var(--color-ui-text) 10%, var(--color-ui-text) 90%, transparent 100%);
  border-radius: 0;
  height: auto;
  opacity: 0.4;
}

.story-nav__rail::after {
  display: none; /* Removed the moving progress dot to match automotive style */
}

.story-nav__progress {
  display: none; /* Removed the rail progress filling to match automotive style */
}

.story-nav__hotspots {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 400ms ease;
}

.story-nav.is-visible .story-nav__hotspots {
  opacity: 1;
}

.story-nav__hotspot {
  position: absolute;
  top: calc(var(--hotspot-progress, 0) * 100%);
  left: 7px;
  display: flex;
  align-items: center;
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-ui-text);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.story-nav__hotspot::before {
  display: none;
}

.story-nav__hotspot:hover,
.story-nav__hotspot:focus-visible {
  background: var(--color-white);
  transform: translate(-50%, -50%) scale(1.2);
  outline: none;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.story-nav__hotspot.is-active {
  width: 14px;
  height: 14px;
  background: var(--color-white);
  box-shadow: 0 0 0 4px var(--color-story-bg), 0 0 0 6px var(--color-white), 0 0 20px rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
}

/* Label style matching automotive tl-label */
.story-nav__hotspot-label {
  position: absolute;
  top: 50%;
  left: 24px;
  width: max-content;
  max-width: 25rem;
  color: var(--color-ui-text);
  font-size: 1.4rem;
  font-weight: 500;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
  transform-origin: left center;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  border: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 1);
}

.story-nav__hotspot:hover .story-nav__hotspot-label,
.story-nav__hotspot:focus-visible .story-nav__hotspot-label {
  color: var(--color-white);
  transform: translateY(-50%) translateX(2px);
}

.story-nav__hotspot.is-active .story-nav__hotspot-label {
  color: var(--color-white);
  font-weight: 700;
  transform: translateY(-50%) scale(1.05);
}

@media (max-width: 1024px){
  .story-nav {
    display: none;
  }

  /* Zoom transforms on mobile are handled by JS — no CSS animation needed */

  /* Counter-scale by 0.625 (1 / 1.6) to keep text sharp and standard size */
  .panel.is-zoomed .hotspot:not(.is-selected) {
    transform: scale(0.3);
  }

  .panel.is-zoomed .hotspot.is-selected {
    transform: translate3d(0, 0, 24px) scale(0.78); /* 0.625 base * 1.25 */
  }

  .hotspot {
    width: 1.35rem;
  }

    .hotspot-detail {
    position: absolute;
    left: var(--detail-x, 2.5rem) !important;
    top: var(--detail-y, -2rem) !important;
    right: auto !important;
    bottom: auto !important;
    width: min-content;
    min-width: 23rem;
    padding: 1.1rem !important;
    border-radius: 0.9rem !important;
    background: rgba(14, 14, 13, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
    transform-origin: left center !important;
    transform: scale(0.2) translateY(0.5rem) !important;
  }

  .hotspot-detail__header {
    white-space: nowrap;
    gap: 5rem;
  }

  .hotspot-detail h3,
  .hotspot-detail__close {
    white-space: nowrap;
  }

  .panel.is-zoomed .hotspot-detail[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
    transform: scale(0.625) translateY(0) !important;
  }

}



@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
