/* Adapted from prototype/css/style.css — see document/data-and-layout-model.md for the
   layout rules this implements. Everything is scoped under .profilm-slider so it can't
   leak into the theme or other plugins on a real WordPress site (the prototype didn't need
   this since it was a standalone page). Colour variables (and --column-translate-y, below)
   are scoped here too, not on :root, for the same reason. */

.profilm-slider {
  --profilm-bright-green: #00af62;
  --profilm-charcoal-blue: #22343b;
  --profilm-white: #ffffff;
  --profilm-black: #000000;
  /* Shared by .left-column and .right-column so they use the exact same
     numbers and stay level with each other. Both anchor at top: 50% (the
     stage's vertical center) and shift up by this amount — -17% at desktop
     width, per live testing on the actual WP site (see columnsHeight.png;
     the car in the reference photography sits in the upper-middle of the
     frame, not centered, so the columns needed to sit higher than true
     -50% centering). Below 1670px viewport width this eases toward 0%
     (same flow/shape as the earlier -50%-to-0% version, just scaled to the
     new -17% starting point), reaching 0% at 1300px where the mobile stack
     takes over. */
  --column-translate-y: clamp(-17%, calc(((100vw - 1300px) / 370px) * -17%), 0%);
}

.profilm-slider,
.profilm-slider * {
  box-sizing: border-box;
}

.profilm-slider {
  position: relative;
  max-width: 1920px;
  margin: 0 auto;
}

/* Top nav — layered over the image like the left/right columns, not a separate
   section above it (the reference screenshots show the image extending up behind it). */

.profilm-slider .top-nav {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0 40px;
}

.profilm-slider .top-nav-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Single-pill pager (mobile only, see breakpoint below) — same current-series state
   as .top-nav-buttons, just shown as one pill + prev/next arrows instead of a full
   row, since a row of 5-8 buttons doesn't fit a phone width. Wraps at the ends. */
.profilm-slider .top-nav-pager {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.profilm-slider .pager-arrow {
  border: none;
  background: transparent;
  color: var(--profilm-charcoal-blue);
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
}

.profilm-slider .pager-label {
  flex: 1;
  max-width: 220px;
  text-align: center;
  cursor: default;
}

.profilm-slider .tab {
  padding: 14px 26px;
  border: none;
  border-radius: 6px;
  background: var(--profilm-charcoal-blue);
  color: var(--profilm-white);
  cursor: pointer;
}

.profilm-slider .tab.active {
  background: var(--profilm-bright-green);
}

/* Stage: the full-bleed image area. Left column, right column, divider and
   bottom text are all layered on top of it via z-index, not laid out beside it. */

.profilm-slider .stage {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: #f4f5f6;
}

/* Both images are always exactly the same size (100% of the stage) — revealing more or
   less of the overlay is done with clip-path on the image itself (set via JS), not by
   resizing a wrapping container. That way neither image's rendered size ever depends on
   a JS-measured pixel value, which the theme/Elementor's own "img { max-width: 100% }"
   reset could otherwise silently override — which is exactly what was happening before. */
.profilm-slider .default-image,
.profilm-slider .overlay-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.profilm-slider .default-image {
  z-index: 1;
}

.profilm-slider .overlay-image {
  z-index: 2;
}

/* Draggable hit-area, scoped to the divider's actual travel range on both axes — left/width
   set via JS from the same DIVIDER_MIN_PERCENT/MAX_PERCENT constants (so it never overlaps
   the left/right column buttons), and top/bottom matching the divider line's own vertical
   inset (so it never overlaps the top-nav or bottom-text either). */
.profilm-slider .drag-zone {
  position: absolute;
  top: 15%;
  bottom: 15%;
  z-index: 3;
  cursor: ew-resize;
  touch-action: none;
}

.profilm-slider .left-column {
  position: absolute;
  /* See --column-translate-y — anchored at the stage's vertical center,
     shifted up by that shared amount so it matches the right column. */
  top: 50%;
  transform: translateY(var(--column-translate-y));
  left: clamp(1.5rem, 2.1vw, 2.5rem);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 0.9vw, 0.75rem);
  width: clamp(13.75rem, 14.6vw, 17.5rem);
}

.profilm-slider .left-column-list {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 0.9vw, 0.75rem);
}

/* Single-card pager (mobile only, "list" type series — see breakpoint below), same
   pattern as the top-nav pager: one active card + prev/next arrows, wrapping at the
   ends, instead of every child shown at once. */
.profilm-slider .left-column-pager {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0 auto;
}

.profilm-slider .left-column-pager .left-item-wrapper {
  flex: 1;
}

.profilm-slider .left-column-pager .left-item {
  text-align: center;
}

/* The card's background/padding live on the wrapper, not the button — so a nested-children
   row (appended after the button, inside the same wrapper) renders as part of the same
   colored card instead of sitting outside it on the page background. */
.profilm-slider .left-item-wrapper {
  width: 100%;
  padding: clamp(0.75rem, 1.1vw, 1rem) clamp(1rem, 1.4vw, 1.25rem);
  border-radius: 6px;
  background: var(--profilm-charcoal-blue);
}

.profilm-slider .left-item-wrapper.active {
  background: var(--profilm-bright-green);
}

.profilm-slider .left-item {
  width: 100%;
  text-align: left;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--profilm-white);
  cursor: pointer;
}

.profilm-slider .left-item .eyebrow {
  display: block;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 4px;
  overflow-wrap: break-word;
}

/* A long single word (e.g. Accent's "Smoke Headlight") or a size/viewport
   combination where the card is narrower than text-h2 expects (e.g.
   "Ultra Clear Pro" at a mid-width viewport) can't wrap at a space, so
   without this it overflows past the card's edge instead of staying
   contained within it. */
.profilm-slider .left-item .label {
  display: block;
  overflow-wrap: break-word;
}

/* Smoke Headlight-style nested children: pill buttons inside a left-column row.
   Selecting one changes the slider image only — the right column stays bound to
   the parent row, per the confirmed data model.
   Inactive: transparent fill, white outline, white text (shows the parent row's own
   background — grey when the row itself isn't active, green when it is).
   Active: solid Profilm Charcoal Blue fill, white text, regardless of the parent
   row's own active state. */

.profilm-slider .nested-children {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.profilm-slider .nested-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--profilm-white);
  background: transparent;
  color: var(--profilm-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.profilm-slider .nested-pill.active {
  background: var(--profilm-charcoal-blue);
  color: var(--profilm-white);
  border-color: var(--profilm-charcoal-blue);
}

/* Swatch-style left column (ProColor, Solid): small colour circles instead of a
   stacked list, wrapped into rows rather than one column. */

.profilm-slider .left-column.type-swatches {
  flex-direction: row;
  flex-wrap: wrap;
  width: 180px;
  gap: 14px;
}

.profilm-slider .swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.profilm-slider .swatch.active {
  border-color: var(--profilm-white);
  box-shadow: 0 0 0 2px var(--profilm-charcoal-blue);
}

/* Flat, top-level numbered circles (e.g. Window Film's TRU: 05/15/35/50) — these float
   directly over the photo with no parent card behind them, so unlike .nested-pill they
   need their own solid fill. Same charcoal/green convention as the top nav and left-item
   cards: charcoal when inactive, green when active. */
.profilm-slider .pill {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--profilm-charcoal-blue);
  color: var(--profilm-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.profilm-slider .pill.active {
  background: var(--profilm-bright-green);
}

/* Sits above or below the swatch grid depending on the series (ProColor: below,
   Solid: above) — flex-basis: 100% forces it onto its own row within the wrapping
   swatch grid rather than sitting beside a swatch. */
.profilm-slider .swatch-helper {
  flex-basis: 100%;
  background: rgba(34, 52, 59, 0.55);
  color: var(--profilm-white);
  text-align: center;
  padding: 10px 14px;
  border-radius: 6px;
}

/* Outer positioning container — vertically centered as one unit so the badge and the
   colored content box move together, stacked with a gap between them. No background
   of its own; that lives on .right-column-content so the badge sits above the box
   rather than inside its background. */
.profilm-slider .right-column {
  position: absolute;
  /* Same --column-translate-y as .left-column, so both stay level with
     each other at every width. */
  top: 50%;
  right: clamp(1.5rem, 2.1vw, 2.5rem);
  transform: translateY(var(--column-translate-y));
  z-index: 3;
  width: clamp(17.5rem, 18vw, 21.25rem);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Optional, e.g. SKN/EVO's certification badges. Hidden via JS when the active
   child/nested child has none, per the "exists everywhere, renders only if populated"
   rule. Centered within the column, sitting just above the content box. */
.profilm-slider .badge-image {
  align-self: center;
  max-width: 60px;
  height: auto;
  display: none;
}

.profilm-slider .right-column-content {
  --content-padding: clamp(1.25rem, 1.5vw, 1.75rem);
  background: var(--profilm-charcoal-blue);
  color: var(--profilm-white);
  border-radius: 8px;
  padding: var(--content-padding);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 260px;
}

.profilm-slider .right-column-content .description,
.profilm-slider .right-column-content .spec {
  margin: 0;
}

/* Bound-to-Tab mode (Window Film, e.g. TRU): eyebrow + title + auto-generated variant
   list, above the description. Wrapped in its own block so the eyebrow-to-title gap
   can be tight, independent of .right-column-content's larger gap between sections. */
.profilm-slider .title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profilm-slider .right-column-content .eyebrow {
  display: block;
  text-transform: uppercase;
  opacity: 0.7;
  overflow-wrap: break-word;
}

.profilm-slider .right-column-content .title {
  display: block;
  overflow-wrap: break-word;
}

.profilm-slider .right-column-content .variant-list {
  margin: 0;
}

/* Datasheet-only mode (Solid): just the button, no description/spec/warranty, so the
   box shrinks to fit it instead of using the full-size layout's height. */

.profilm-slider .right-column-content.compact {
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 20px 28px;
}

.profilm-slider .right-column-content.compact .datasheet-btn {
  width: auto;
  margin-top: 0;
  padding-left: 32px;
  padding-right: 32px;
}

/* ProColor-style independent right-column tabs: their own selection state,
   decoupled from the left-column swatch selection. */

.profilm-slider .right-tabs {
  display: flex;
  gap: 4px;
  margin: calc(-1 * var(--content-padding)) calc(-1 * var(--content-padding)) 4px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.profilm-slider .right-tab {
  padding: 14px 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.profilm-slider .right-tab.active {
  color: var(--profilm-white);
  border-bottom-color: var(--profilm-bright-green);
}

.profilm-slider .right-column-content .warranty {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  border-radius: 6px;
}

.profilm-slider .datasheet-btn {
  margin-top: auto;
  background: var(--profilm-bright-green);
  color: var(--profilm-white);
  text-decoration: none;
  padding: 14px 20px;
  border-radius: 6px;
  text-align: center;
}

.profilm-slider .divider {
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 50%;
  width: 2px;
  background: var(--profilm-white);
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
}

.profilm-slider .handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--profilm-bright-green);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}

.profilm-slider .arrow {
  color: var(--profilm-white);
  font-size: 0.625rem;
  line-height: 1;
  display: inline-block;
  animation: profilm-slider-pulse-left 1.8s ease-in-out infinite;
}

.profilm-slider .arrow-right {
  animation-name: profilm-slider-pulse-right;
}

@keyframes profilm-slider-pulse-left {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

@keyframes profilm-slider-pulse-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* Sits within the same vertical range as the divider/drag-zone (15% inset from the
   stage's bottom), and is clipped in sync with the overlay reveal (set via JS) so the
   tagline/colour-name only becomes visible as the slider reveals it — not visible outright. */
.profilm-slider .bottom-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  z-index: 3;
  margin: 0;
  color: var(--profilm-charcoal-blue);
  text-align: center;
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
}

/* ============================================================
   Mid-width (≤1300px, above the mobile stack breakpoint)
   ============================================================
   Column width/inset/padding scale continuously via clamp() in their base
   rules, so there's no snap as the stage narrows (vertical position eases
   continuously too, via --column-translate-y — see the .left-column/
   .right-column rules above). ProColor's Info/Car Owners/PPF
   Installers row stays a row (not stacked) — shrinking the font instead is
   enough to keep it inside the narrower column. The .text-h9 compound
   selector is needed to win over typography.css's !important at equal
   specificity. */
@media (max-width: 1300px) {
  .profilm-slider .right-tab.text-h9 {
    font-size: 0.75rem !important;
  }

  .profilm-slider .right-tab {
    padding: 14px 6px;
  }
}

/* ============================================================
   Narrow desktop-overlay range (1025px–1300px)
   ============================================================
   A long list (Accent's 6 items, one with nested pills) is simply taller
   than the stage at this width — no amount of repositioning fixes an
   element taller than its own container, it has to actually get smaller.
   Scaled down uniformly (padding/gap/font-size) rather than only for long
   lists specifically, per accentScale.png.

   Bounded with min-width: 1025px, NOT just max-width: 1300px, because
   buildListItemCard()/buildLeftColumnPager() in slider.js reuse this same
   markup for the ≤1024px mobile single-card pager (see the mobile block
   below) — that view only ever shows one card at a time, so it never has
   this overflow problem and shouldn't be shrunk by it. The
   .text-h2/.text-h5/.text-h9 compound selectors are needed to win over
   typography.css's !important at equal specificity. */
@media (max-width: 1300px) and (min-width: 1025px) {
  .profilm-slider .left-column-list {
    gap: 0.375rem;
  }

  .profilm-slider .left-item-wrapper {
    padding: 0.5rem 0.625rem;
  }

  .profilm-slider .left-item .eyebrow.text-h5 {
    font-size: 0.6875rem !important;
  }

  .profilm-slider .left-item .label.text-h2 {
    font-size: 1.125rem !important;
    line-height: 1.2 !important;
  }

  .profilm-slider .nested-children {
    gap: 4px;
    margin-top: 6px;
  }

  .profilm-slider .nested-pill {
    width: 24px;
    height: 24px;
  }

  .profilm-slider .nested-pill.text-h9 {
    font-size: 0.625rem !important;
  }
}

/* ============================================================
   Mobile (≤1024px, matching Elementor's own tablet breakpoint)
   ============================================================
   Structural rebuild only — top-nav/left-column/right-column stop overlaying the
   image and become stacked, full-width sections instead (image → columns → info
   box, same order as desktop, just not layered). The slider itself (image pair,
   drag-zone, divider, bottom-text) is untouched — it's self-contained inside
   .stage and doesn't care what .stage's position in the page flow is.

   Interaction stays as today (all buttons visible, wrapped) for now — the
   swipeable single-item + arrows + dot-pagination behavior from the reference
   screenshots is a separate, follow-up pass on top of this structural one. */
@media (max-width: 1024px) {
  .profilm-slider {
    display: flex;
    flex-direction: column;
  }

  .profilm-slider .top-nav {
    position: static;
    order: 1;
    padding: 16px;
  }

  .profilm-slider .top-nav-buttons {
    display: none;
  }

  .profilm-slider .top-nav-pager {
    display: flex;
  }

  .profilm-slider .left-column {
    position: static;
    order: 2;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    padding: 0 16px 16px;
  }

  .profilm-slider .left-column-list {
    display: none;
  }

  .profilm-slider .left-column-pager {
    display: flex;
  }

  .profilm-slider .nested-children {
    justify-content: center;
  }

  /* Swatches (ProColor/Solid) render as a full grid rather than a single collapsed
     "current item" pill, so — unlike the list/pills types — they read better below
     the image alongside their title/helper text, not above it. */
  .profilm-slider .left-column.type-swatches {
    order: 4;
    width: 100%;
    justify-content: center;
  }

  .profilm-slider .stage {
    order: 3;
    aspect-ratio: 1 / 1;
    margin-bottom: 16px;
  }

  .profilm-slider .right-column {
    position: static;
    order: 5;
    top: auto;
    right: auto;
    transform: none;
    width: 100%;
    padding: 16px;
  }
}
