/*
 * Homepage Hero Slider — zt-puppet-v2
 * All rules are scoped under .zt-slider to avoid collisions.
 *
 * CSS custom properties:
 *   --slide-image-ratio   (default 0.6) — fraction of slot for image vs. content.
 *                         Not exposed in admin yet; change here to adjust 60/40 split.
 *   --btn-text            Per-slide button text color (set inline in PHP).
 *   --btn-bg              Per-slide primary button background (set inline in PHP).
 */

/* ═══════════════════════════════════════════════════
   1. SLOT GEOMETRY
═══════════════════════════════════════════════════ */

.zt-slider {
  --slide-image-ratio: 0.6;
  position: relative;
  display: block;
  width: 100%;
  color: #fff;
  overflow: hidden;
  outline: none; /* focus handled on controls */
}

/* ≥ 1920px (2K and up) */
@media (min-width: 1920px) {
  .zt-slider {
    width: 1350px;
    height: 880px;
    margin-top: 140px;
    margin-inline: auto;
  }
}

/* 1440–1919px */
@media (min-width: 1440px) and (max-width: 1919px) {
  .zt-slider {
    width: min(90vw, 1300px);
    aspect-ratio: 3 / 2;
    margin-top: 100px;
    margin-inline: auto;
  }
}

/* 1024–1439px */
@media (min-width: 1024px) and (max-width: 1439px) {
  .zt-slider {
    width: 92vw;
    aspect-ratio: 16 / 10;
    margin-top: 80px;
    margin-inline: auto;
  }
}

/* 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .zt-slider {
    width: 94vw;
    aspect-ratio: 4 / 3;
    margin-top: 60px;
    margin-inline: auto;
  }
}

/* < 768px */
@media (max-width: 767px) {
  .zt-slider {
    width: calc(100% - 24px);
    aspect-ratio: 4 / 5;
    margin-top: 32px;
    margin-inline: auto;
  }
}

/* The slider keeps this slot geometry inside #fp-hero-stage as well. */

/* ═══════════════════════════════════════════════════
   2. SLIDE TRACK & SLIDES — CROSSFADE (default)
═══════════════════════════════════════════════════ */

.zt-slider__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.zt-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.zt-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* Micro-zoom: outgoing/incoming image subtly scales */
.zt-slide__image-wrap {
  transform: scale(1.02);
  transition: transform 600ms ease-out;
  overflow: hidden;
  flex-shrink: 0;
}

.zt-slide.is-active .zt-slide__image-wrap {
  transform: scale(1);
}

/* ═══════════════════════════════════════════════════
   3. HORIZONTAL SLIDE TRANSITION
═══════════════════════════════════════════════════ */

.zt-slider--slide .zt-slider__track {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.zt-slider--slide .zt-slider__track.no-transition {
  transition: none !important;
}

.zt-slider--slide .zt-slide {
  position: relative;
  inset: auto;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: auto;
  transition: none;
}

/* Active/inactive handled by JS translateX on the track, not opacity */
.zt-slider--slide .zt-slide__image-wrap {
  transform: none;
  transition: none;
}

/* ═══════════════════════════════════════════════════
   4. KEN BURNS ANIMATIONS
═══════════════════════════════════════════════════ */

@keyframes kb-0 {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.08) translate(0, 0);
  }
}

@keyframes kb-1 {
  from {
    transform: scale(1.05) translate(0, 0);
  }
  to {
    transform: scale(1) translate(0, -2%);
  }
}

@keyframes kb-2 {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.06) translate(2%, 0);
  }
}

@keyframes kb-3 {
  from {
    transform: scale(1.04) translate(0, 0);
  }
  to {
    transform: scale(1) translate(-2%, -2%);
  }
}

.zt-slider--ken-burns .ken-burns-0 {
  animation: kb-0 8s linear infinite alternate;
}
.zt-slider--ken-burns .ken-burns-1 {
  animation: kb-1 8s linear infinite alternate;
}
.zt-slider--ken-burns .ken-burns-2 {
  animation: kb-2 8s linear infinite alternate;
}
.zt-slider--ken-burns .ken-burns-3 {
  animation: kb-3 8s linear infinite alternate;
}

/* Pause KB animation while autoplay is paused */
.zt-slider--ken-burns:not(.is-playing) .zt-slide__image-wrap,
.zt-slider--ken-burns.is-reduced-motion .zt-slide__image-wrap {
  animation-play-state: paused;
}

/* ═══════════════════════════════════════════════════
   5. IMAGE & CONTENT LAYOUT — POSITION VARIANTS
═══════════════════════════════════════════════════ */

/* --- top: image+content group v-centered; image h-centered --- */
.zt-slide--top {
  flex-direction: column;
  justify-content: center; /* v-center the image+content group */
  align-items: center;
}

.zt-slide--top .zt-slide__image-wrap {
  width: 100%;
  height: auto;
  max-height: 60%;
  flex-shrink: 0;
  display: flex;
  justify-content: center; /* h-center image within its row */
  align-items: flex-end;
}

.zt-slide--top .zt-slide__image-wrap img {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.zt-slide--top .zt-slide__content {
  height: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- left: image v-centered in its column, pair h-centered --- */
.zt-slide--left {
  flex-direction: row;
  align-items: center; /* v-center both columns */
  justify-content: center;
}

.zt-slide--left .zt-slide__image-wrap {
  width: calc(var(--slide-image-ratio) * 100%);
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center; /* v-center image within its column */
  justify-content: center; /* h-center image within its column */
}

.zt-slide--left .zt-slide__image-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.zt-slide--left .zt-slide__content {
  width: calc((1 - var(--slide-image-ratio)) * 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- right: image v-centered in its column, pair h-centered --- */
.zt-slide--right {
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
}

.zt-slide--right .zt-slide__image-wrap {
  width: calc(var(--slide-image-ratio) * 100%);
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zt-slide--right .zt-slide__image-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.zt-slide--right .zt-slide__content {
  width: calc((1 - var(--slide-image-ratio)) * 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- No image: content fills slot --- */
.zt-slide:not(:has(.zt-slide__image-wrap)) .zt-slide__content,
.zt-slide--no-image .zt-slide__content {
  width: 100%;
  height: 100%;
  max-width: 720px;
  margin-inline: auto;
  justify-content: center;
  align-items: flex-start;
}

/* Mobile: force top layout regardless of saved position */
@media (max-width: 767px) {
  .zt-slide--left,
  .zt-slide--right {
    flex-direction: column;
    align-items: center;
  }

  .zt-slide--left .zt-slide__image-wrap,
  .zt-slide--right .zt-slide__image-wrap {
    width: 100%;
    height: auto;
    max-height: 55%;
  }

  .zt-slide--left .zt-slide__content,
  .zt-slide--right .zt-slide__content {
    width: 100%;
    height: auto;
  }
}

/* ═══════════════════════════════════════════════════
   6. CONTENT AREA INNER LAYOUT
═══════════════════════════════════════════════════ */

.zt-slide__content {
  padding: 1.5rem 2rem;
  box-sizing: border-box;
  max-width: 640px;
}

.zt-slide__text-blocks {
  display: flex;
  flex-direction: column;
}

.zt-tb {
  margin: 0;
  line-height: inherit;
}

/* 1rem gap between same-size adjacent blocks */
.zt-tb + .zt-tb {
  margin-top: 1rem;
}

/* 1.5rem gap when size changes */
.zt-tb + .zt-tb--gap-change {
  margin-top: 1.5rem;
}

/* 2rem gap from text blocks to buttons */
.zt-slide__buttons {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 767px) {
  .zt-slide__buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ═══════════════════════════════════════════════════
   7. TEXT SIZE SCALE
═══════════════════════════════════════════════════ */

.zt-tb--small {
  font-size: clamp(18px, 2.5vw, 30px);
  line-height: 1.55;
}

.zt-tb--medium {
  font-size: clamp(26px, 3.75vw, 45px);
  line-height: 1.35;
}

.zt-tb--large {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.05;
  font-weight: 600;
  font-family: "Playfair Display", serif;
}

/* ═══════════════════════════════════════════════════
   8. SLIDE BUTTONS
   Visual tokens copied verbatim from existing slider
   (border-radius:0, uppercase, letter-spacing, padding, font-weight 600).
   Colors come from per-slide inline CSS variables.
═══════════════════════════════════════════════════ */

.zt-slide__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.5rem 2rem; /* matches old px-8 py-4 */
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em; /* matches old tracking-widest */
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms ease;
  white-space: nowrap;
  color: var(--btn-text, #ffffff);
}

.zt-slide__btn--primary {
  background-color: var(--btn-bg, #420101);
}

.zt-slide__btn--secondary {
  background-color: transparent;
}

.zt-slide__btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.zt-slide__btn--primary:hover {
  /* Overlay 10% white on top of the colored background */
  background-color: color-mix(in srgb, var(--btn-bg, #420101) 90%, white);
}

.zt-slide__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════
   9. CONTROLS WRAPPER
═══════════════════════════════════════════════════ */

.zt-slider__controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.zt-slider__controls > * {
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════
   10. PAGINATION DOTS
   Style copied verbatim from existing slider:
   rectangular bars, border-radius:0, same colors.
═══════════════════════════════════════════════════ */

.zt-slider__bottom {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 11;
}

.zt-slider__dots {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.zt-slider__dot {
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.3s,
    width 0.3s;
}

.zt-slider__dot.is-active {
  background: #f6f4ee;
  width: 44px;
}

.zt-slider__dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════
   11. ARROWS
   Style copied verbatim from existing slider buttons.
═══════════════════════════════════════════════════ */

.zt-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 11;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  color: white;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background 0.2s;
}

.zt-slider__arrow--prev {
  left: 1.5rem;
}
.zt-slider__arrow--next {
  right: 1.5rem;
}

.zt-slider__arrow:hover {
  background: rgba(255, 255, 255, 0.2);
}

.zt-slider__arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.zt-slider__arrow svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ═══════════════════════════════════════════════════
   12. PLAY / PAUSE BUTTON
═══════════════════════════════════════════════════ */

.zt-slider__playpause {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.zt-slider__playpause:hover {
  background: rgba(255, 255, 255, 0.2);
}

.zt-slider__playpause:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.zt-slider__icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* ═══════════════════════════════════════════════════
   13. PROGRESS BAR
═══════════════════════════════════════════════════ */

.zt-slider__progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
}

@keyframes zt-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.zt-slider__progress {
  height: 100%;
  background: #7a1e2a; /* burgundy; --accent fallback */
  transform-origin: left center;
  transform: scaleX(0);
  animation: zt-progress linear forwards;
  animation-play-state: paused;
}

.zt-slider__progress.is-active {
  animation-play-state: running;
}

/* ═══════════════════════════════════════════════════
   14. LIVE REGION (visually hidden)
═══════════════════════════════════════════════════ */

.zt-slider__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   15. REDUCED MOTION
═══════════════════════════════════════════════════ */

.zt-slider.is-reduced-motion .zt-slide,
.zt-slider.is-reduced-motion .zt-slide__image-wrap {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .zt-slider .zt-slide,
  .zt-slider .zt-slide__image-wrap,
  .zt-slider .zt-slider__track,
  .zt-slider .zt-slider__dot,
  .zt-slider .zt-slider__progress {
    transition: none !important;
    animation: none !important;
  }
}
