/* ===========================================================
   Triveni Power - Aftermarket / Any Brand. Any Make. Anywhere.
   Bechtel-style split layout with looping video background:
     · LHS - headline + body + locations line
     · RHS - Services carousel: ONE white card visible at a time
             stacked-card depth behind, prev/next side arrows,
             dots + CTA arrow inside the card footer.
   =========================================================== */

.aftermarket {
  position: relative;
  width: 100%;
  background: #0A0809;
  color: #FFFFFF;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(72px, 9vw, 140px) 0;
}

/* =========================================================
   BACKGROUND - looping video + dark tint
   ========================================================= */
.aftermarket__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.aftermarket__bg video,
.aftermarket__bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.02);
}
.aftermarket__tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.87) 0%,
    rgba(0, 0, 0, 0.65) 38%,
    rgba(0, 0, 0, 0.45) 70%,
    rgba(0, 0, 0, 0.65) 100%);
}

/* =========================================================
   CONTAINER - 2-col grid (logo-aligned via container)
   ========================================================= */
.aftermarket__container {
  position: relative;
  z-index: 2;
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--s-3);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 5vw, 72px);
  align-items: center;
}
@media (min-width: 768px) {
  .aftermarket__container {
    padding-left: var(--s-4);
    padding-right: var(--s-4);
  }
}
@media (min-width: 1024px) {
  .aftermarket__container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: clamp(48px, 5vw, 96px);
  }
}
@media (min-width: 1280px) {
  .aftermarket__container {
    padding-left: var(--s-5);
    padding-right: var(--s-5);
  }
}

/* =========================================================
   LHS INTRO - headline / body / locations
   ========================================================= */
.aftermarket__intro {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2vw, 28px);
  max-width: 560px;
}

.aftermarket__title {
  font-family: var(--font-display);
  font-size: var(--fs-l);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #FFFFFF;
  margin: 0;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.40);
}
.aftermarket__title em {
  font-style: normal;
  color: var(--accent);
}

.aftermarket__body {
  font-family: var(--font-display);
  font-size: var(--fs-m);
  line-height: 1.65;
  color: #FFFFFF;
  margin: 0;
  max-width: 52ch;
}
.aftermarket__body strong {
  font-weight: 400;
  color: #FFFFFF;
}

/* CTA sits in the intro flex column - align left, spacing from body copy */
.aftermarket__cta {
  align-self: flex-start;
  margin-top: clamp(4px, 0.5vw, 8px);
}

/* =========================================================
   RHS - Services label
   ========================================================= */
.aftermarket__cards {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 1.8vw, 24px);
}

/* =========================================================
   CAROUSEL - side arrows + stacked card area
   ========================================================= */
.aftermarket__carousel {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(10px, 1vw, 18px);
}

.aftermarket__nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
          backdrop-filter: blur(10px) saturate(160%);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 280ms var(--ease-out),
    border-color 280ms var(--ease-out),
    transform 280ms var(--ease-out);
  flex-shrink: 0;
}
.aftermarket__nav svg { width: 18px; height: 18px; }
.aftermarket__nav:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.aftermarket__nav:active { transform: translateY(0); }
.aftermarket__nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =========================================================
   STACK - absolute-positioned cards, only one visible
   Stacked depth shadow gives "card behind" illusion
   ========================================================= */
.aftermarket__stack {
  position: relative;
  width: 100%;
  min-height: clamp(420px, 32vw, 480px);
  isolation: isolate;
}
/* Two stacked-shadow ghosts behind the active card */
.aftermarket__stack::before,
.aftermarket__stack::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: calc(100% - 24px);
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  transform: translateX(-50%) translateY(0);
  z-index: 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  transition: transform 380ms var(--ease-out), opacity 380ms var(--ease-out);
}
.aftermarket__stack::before {
  transform: translateX(-50%) translateY(-14px) scale(0.96);
  opacity: 0.55;
}
.aftermarket__stack::after {
  transform: translateX(-50%) translateY(-7px) scale(0.98);
  opacity: 0.78;
}

/* =========================================================
   CARD - white panel, image on top, content below
   ========================================================= */
.aftermarket__card {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #FFFFFF;
  color: #231F20;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 1.6vw, 24px);

  opacity: 0;
  transform: translateY(12px) scale(0.985);
  pointer-events: none;
  transition:
    opacity 480ms var(--ease-out),
    transform 480ms var(--ease-out);
}
.aftermarket__card[aria-hidden="false"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  z-index: 2;
}

.aftermarket__card-media {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1a1718;
  border-radius: 8px;
  flex-shrink: 0;
}
.aftermarket__card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform 700ms var(--ease-out);
}
.aftermarket__card[aria-hidden="false"]:hover .aftermarket__card-media img {
  transform: scale(1.06);
}

.aftermarket__card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(16px, 1.4vw, 20px) clamp(4px, 0.6vw, 8px) clamp(4px, 0.4vw, 6px);
  flex: 1;
}

.aftermarket__card-title {
  font-family: var(--font-display);
  font-size: 24px;          /* card titles sit between M and L */
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: #231F20;
  margin: 0;
}

.aftermarket__card-desc {
  font-family: var(--font-display);
  font-size: var(--fs-m);
  line-height: 1.55;
  color: rgba(35, 31, 32, 0.8);
  margin: 0;
}

/* =========================================================
   CARD FOOTER - dots + CTA arrow
   ========================================================= */
.aftermarket__card-footer {
  margin-top: auto;
  padding-top: clamp(14px, 1.4vw, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aftermarket__dots {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aftermarket__dot {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: rgba(35, 31, 32, 0.18);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition:
    background 280ms var(--ease-out),
    width 280ms var(--ease-out);
}
.aftermarket__dot:hover { background: rgba(35, 31, 32, 0.42); }
.aftermarket__dot[aria-current="true"] {
  background: var(--accent);
  width: 32px;
}
.aftermarket__dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* .aftermarket__card-cta removed — dead CSS (display:none, no
   markup references found). If reinstated, use .btn--icon canonical. */

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 767px) {
  .aftermarket__nav { width: 38px; height: 38px; }
  .aftermarket__nav svg { width: 14px; height: 14px; }
  /* Tall image on mobile - matches desktop 4/3 ratio */
  .aftermarket__card-media { aspect-ratio: 4 / 3; }
  .aftermarket__stack { min-height: clamp(400px, 96vw, 460px); }
  .aftermarket__stack::before,
  .aftermarket__stack::after { display: none; }
}

/* Tablet - single-column layout makes the card span full width, so the
   16:9 image alone is 300–520px tall depending on viewport. The default
   420px stack clipped the title/dots/CTA. Give it room. */
@media (min-width: 768px) and (max-width: 1023px) {
  .aftermarket__stack { min-height: clamp(560px, 76vw, 740px); }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .aftermarket__bg video { display: none; }
  .aftermarket__card,
  .aftermarket__card-media img,
  .aftermarket__stack::before,
  .aftermarket__stack::after {
    transition: none !important;
    transform: none !important;
  }
}
