/* ============================================================
   Qera — Hover Card Stack Styles
   Block 3: What Battery Intelligence does for your fleet
   ============================================================ */

{% scope_css %}
.qera-hover-stack {
  position: relative;
  width: 100%;
  background-color: var(--color-bg-canvas-50);
  padding-block: var(--spacing-4xl, 96px);
  overflow: hidden;
}

.qera-hover-stack__inner {
  display: flex;
  flex-direction: column;
}

.qera-hover-stack__header {
  text-align: center;
  max-width: 780px;
  margin-inline: auto;
  margin-bottom: var(--spacing-4xl, 80px);
}

.qera-hover-stack__heading {
  font-family: var(--typography-family-primary, 'Sora', sans-serif);
  font-weight: var(--typography-weight-bold, 700);
  font-size: var(--typography-size-h2, 36px);
  line-height: var(--typography-line-height-h2, 44px);
  letter-spacing: var(--typography-letter-spacing-h2, -0.01em);
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-md, 16px) 0;
  text-align: center;
}

.qera-hover-stack__intro {
  font-family: var(--typography-family-primary, 'Sora', sans-serif);
  font-size: var(--typography-size-body-lg, 18px);
  line-height: var(--typography-line-height-body-lg, 27px);
  color: var(--color-text-secondary);
  text-align: center;
}

.qera-hover-stack__intro p {
  margin: 0;
}

.qera-hover-stack__body {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4xl, 96px);
  position: relative;
  width: 100%;
}

/* ==================== LEFT COLUMN: CONTENT ==================== */

.qera-hover-stack__content {
  flex: 0 0 var(--col-left-width, 45%);
  max-width: var(--col-left-width, 45%);
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.qera-hover-stack__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl, 48px);
}

.qera-hover-stack__item {
  display: block;
  position: relative;
  cursor: pointer;
  opacity: var(--inactive-opacity, 0.5);
  transition: opacity var(--motion-duration-fast, 150ms) ease;
}

.qera-hover-stack__item.is-active {
  opacity: 1;
}

.qera-hover-stack__item-title {
  font-family: var(--typography-family-primary, 'Sora', sans-serif);
  font-weight: var(--typography-weight-semibold, 600);
  font-size: var(--typography-size-h3, 28px);
  line-height: var(--typography-line-height-h3, 36px);
  letter-spacing: var(--typography-letter-spacing-h3, -0.005em);
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-sm, 8px) 0;
}

.qera-hover-stack__item-desc {
  font-family: var(--typography-family-primary, 'Sora', sans-serif);
  font-size: var(--typography-size-body-reg, 16px);
  line-height: var(--typography-line-height-body, 25px);
  letter-spacing: var(--typography-letter-spacing-body, 0);
  color: var(--color-text-body-copy);
  margin: 0 0 var(--spacing-md, 16px) 0;
}

.qera-hover-stack__item-desc p {
  margin: 0;
}

.qera-hover-stack__item-action {
  display: flex;
  align-items: center;
}

.qera-hover-stack__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--typography-family-primary, 'Sora', sans-serif);
  font-weight: var(--typography-weight-semibold, 600);
  font-size: var(--typography-size-body-reg, 16px);
  line-height: var(--typography-line-height-body, 25px);
  color: var(--color-text-accent);
  text-decoration: none;
  border-radius: var(--radius-sm, 2px);
  padding: 2px 4px;
  margin-left: -4px;
  transition: color var(--motion-duration-instant, 100ms) ease, outline var(--motion-duration-instant, 100ms) ease;
}

.qera-hover-stack__link:hover {
  color: var(--color-text-accent);
}

.qera-hover-stack__link:focus-visible {
  outline: 2px solid var(--color-border-accent);
  outline-offset: 4px;
}

.qera-hover-stack__link-arrow {
  display: inline-block;
  transition: transform var(--motion-duration-fast, 150ms) var(--motion-easing-enter);
}

.qera-hover-stack__item:hover .qera-hover-stack__link-arrow,
.qera-hover-stack__link:focus-visible .qera-hover-stack__link-arrow {
  transform: translateX(4px);
}

/* Mobile inline media wrapper (hidden on desktop) */
.qera-hover-stack__mobile-card {
  display: none;
}

/* ==================== RIGHT COLUMN: DESKTOP STACK ==================== */

.qera-hover-stack__visual {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  z-index: 1;
}

.qera-hover-stack__deck {
  position: relative;
  width: 100%;
  max-width: 680px;
  aspect-ratio: var(--deck-aspect-ratio, 16 / 10);
  margin: 0;
}

.qera-hover-stack__card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius, 8px);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transform: none;
  transition: 
    opacity var(--motion-duration-base, 250ms) var(--motion-easing-enter),
    box-shadow var(--motion-duration-base, 250ms) var(--motion-easing-enter);
  will-change: opacity;
}

.qera-hover-stack__card-surface {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-elevated-25);
  border: var(--stroke-divider, 1px) solid var(--color-border-default);
  border-radius: inherit;
  overflow: hidden;
  box-sizing: border-box;
}

.qera-hover-stack__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

video.qera-hover-stack__img,
.qera-hover-stack__card--video .qera-hover-stack__img,
video.qera-hover-stack__mobile-img {
  object-fit: var(--item-video-fit, contain);
  object-position: center center;
  background-color: var(--color-bg-elevated-25);
}

/* Single Active Media: only the active card (data-rank="0") is visible */
.qera-hover-stack__card[data-rank="0"] {
  opacity: 1;
  z-index: 2;
  box-shadow: var(--shadow-md, 0px 6px 16px -2px rgba(10, 8, 7, 0.12));
  pointer-events: auto;
}

.qera-hover-stack__card:not([data-rank="0"]) {
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transform: none;
}

/* ==================== RESPONSIVE STYLES ==================== */

/* Tablet */
@media (max-width: 1024px) {
  .qera-hover-stack {
    padding-block: var(--spacing-3xl, 64px);
  }

  .qera-hover-stack__header {
    margin-bottom: var(--spacing-3xl, 64px);
  }

  .qera-hover-stack__body {
    gap: var(--spacing-2xl, 48px);
  }

  .qera-hover-stack__heading {
    font-size: var(--typography-size-h3, 28px);
    line-height: var(--typography-line-height-h3, 36px);
  }

  .qera-hover-stack__item-title {
    font-size: var(--typography-size-h4);
    line-height: var(--typography-line-height-h4);
  }
}

/* Switch to mobile if stack drops below 380px or screen <= 767px */
@media (max-width: 767px) {
  .qera-hover-stack {
    padding-block: var(--spacing-2xl);
  }

  /* Centred header goes left on phones, in line with the list below.
     Heading size comes from the phone type scale in base.css. */
  .qera-hover-stack__header {
    margin-bottom: var(--spacing-xl);
    margin-inline: 0;
    text-align: left;
  }

  .qera-hover-stack__heading,
  .qera-hover-stack__intro {
    text-align: left;
  }

  .qera-hover-stack__intro {
    font-size: var(--typography-size-body-reg, 16px);
    line-height: var(--typography-line-height-body, 25px);
  }

  .qera-hover-stack__body {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-2xl, 48px);
  }

  .qera-hover-stack__content {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .qera-hover-stack__visual {
    display: none !important;
  }

  .qera-hover-stack__list {
    gap: var(--spacing-2xl);
  }

  .qera-hover-stack__item {
    opacity: 1 !important;
    cursor: default;
  }

  .qera-hover-stack__mobile-card {
    display: block;
    margin-top: var(--spacing-lg, 24px);
    border-radius: var(--card-radius, 8px);
    overflow: hidden;
    background-color: var(--color-bg-elevated-25);
    border: var(--stroke-frame, 0.5px) solid var(--color-border-default);
    box-shadow: var(--shadow-sm, 0px 1px 3px 0px rgba(10, 8, 7, 0.08));
    aspect-ratio: var(--deck-aspect-ratio, 16 / 10);
  }

  .qera-hover-stack__mobile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
  }
}

/* ==================== ACCESSIBILITY & REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {
  .qera-hover-stack__card {
    transition: opacity var(--motion-duration-base, 250ms) ease !important;
    transform: none !important;
  }

  .qera-hover-stack__card[data-rank="0"] {
    opacity: 1 !important;
    z-index: 5 !important;
  }

  .qera-hover-stack__card:not([data-rank="0"]) {
    opacity: 0 !important;
    z-index: 1 !important;
  }

  .qera-hover-stack__link-arrow {
    transition: none !important;
  }
}
{% end_scope_css %}
