/* ============================================
   TESTIMONIALS – VIDEO & TEXT — Mixed video + text testimonial scroller
   Two card morphologies share an exact row height; widths differ.
   Swiss-Grid Editorial × Mediterranean warmth.
   ============================================ */

.rtmx {
  position: relative;
  overflow: hidden;
  /* Card height tokens — referenced by both card types so the row
     reads as a single composition. */
  --rtmx-card-h: 380px;
}

@media (min-width: 600px) {
  .rtmx { --rtmx-card-h: 440px; }
}

@media (min-width: 1024px) {
  .rtmx { --rtmx-card-h: 500px; }
}

/* ─── Header — left-aligned to the container's left margin ─── */
.rtmx__header {
  text-align: left;
  margin: 0 0 var(--space-2xl);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  max-width: none;
}

@media (min-width: 1024px) {
  .rtmx__header { margin-bottom: var(--space-3xl); }
}

.rtmx__eyebrow {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--clr-primary);
  line-height: 1.4;
}

.rtmx__heading {
  margin: 0;
  font-size: clamp(2rem, 5vw + 0.5rem, 4rem);
  line-height: 0.98;
  letter-spacing: 0.015em;
  color: var(--clr-primary);
  display: flex;
  flex-direction: column;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.rtmx__heading-line1 {
  display: block;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--clr-primary);
}

.rtmx__heading-line2 {
  display: block;
  font-weight: 400;
  /* Upright Cormorant — never italic per design guide §5 */
  color: var(--clr-primary);
  letter-spacing: 0;
  font-size: 0.92em;
  line-height: 1.05;
  margin-top: var(--space-xs);
}

/* ============================================
   Mixed carousel track
   Flex (not grid) because each card type takes a different width.
   Cards share an exact height so the row composition is tidy.
   ============================================ */
.rtmx__track {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-sm);
  /* Single text cards (shorter than videos) center vertically against
     the video columns. Stacks and videos take the full row height. */
  align-items: center;
}

.rtmx__track::-webkit-scrollbar { display: none; }

@media (min-width: 600px) {
  .rtmx__track { gap: var(--space-lg); }
}

/* ─── Common card baseline ──────────────────────────────── */
.rtmx__card {
  flex-shrink: 0;
  scroll-snap-align: start;
  min-width: 0;
  position: relative;
}

/* ============================================
   Video card — 9:16 portrait, full-bleed video.
   Height fixed to row token; width derives from aspect.
   ============================================ */
.rtmx__card--video {
  height: var(--rtmx-card-h);
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Dark fallback while the widget loads. The card itself must NOT
     use `isolation: isolate` — that creates a stacking context that
     conflicts with the widget's internal z-10 play overlay. */
  background: #0a0a0a;
}

.rtmx__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0a0a;
  border: none;
}

/* Fluid media widget (popout) fills the card edge-to-edge. */
.rtmx__card--video fluid-media-widget {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Native <video> (direct URL) and <img> poster fallback fill the card
   edge-to-edge, cropping to cover. */
.rtmx__card--video > .rtmx__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #0a0a0a;
  border: none;
  cursor: pointer;
}

/* Centered play button — hides once the video starts. */
.rtmx__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  color: var(--clr-text-inverse, #fff);
  cursor: pointer;
  padding: 0;
  z-index: 2;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (min-width: 768px) {
  .rtmx__play {
    width: 72px;
    height: 72px;
  }
}

.rtmx__play svg {
  margin-left: 3px;
}

.rtmx__play:hover {
  transform: translate(-50%, -50%) scale(1.05);
  background: rgba(0, 0, 0, 0.65);
}

.rtmx__play:focus-visible {
  outline: 2px solid var(--clr-brand-accent, #B5A882);
  outline-offset: 4px;
}

.rtmx__card--video.is-playing .rtmx__play {
  opacity: 0;
  pointer-events: none;
}

.rtmx__placeholder {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 25%, rgba(181, 168, 130, 0.22), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(242, 223, 207, 0.10), transparent 55%),
    linear-gradient(160deg, #2d3122 0%, #3c422e 100%);
  position: relative;
}

.rtmx__placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(253, 252, 250, 0.04) 0 1px, transparent 1px 14px);
  pointer-events: none;
}

/* ============================================
   Text review card — fixed width, height driven by content.
   White card with hairline olive-tinted border.
   - Single (between two videos): centers vertically against videos.
   - Stacked (paired between two videos): two cards split video height.
   ============================================ */
.rtmx__card--text {
  width: 280px;
  background: var(--clr-white, #fff);
  border: 1px solid rgba(60, 66, 46, 0.12);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

@media (min-width: 600px) {
  .rtmx__card--text {
    width: 300px;
    padding: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .rtmx__card--text {
    width: 340px;
  }
}

/* ─── Text stack — two reviews stacked to match a video column ─── */
.rtmx__text-stack {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  height: var(--rtmx-card-h);
  width: 280px;
  align-self: stretch;
}

@media (min-width: 600px) {
  .rtmx__text-stack {
    width: 300px;
  }
}

@media (min-width: 1024px) {
  .rtmx__text-stack {
    width: 340px;
  }
}

/* Stacked text cards: split the column evenly, fill width, allow
   the quote to truncate gracefully if it overflows. */
.rtmx__card--text-stack {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  /* Tighter padding inside stacked cards since each is half-height */
  padding: var(--space-md) var(--space-lg);
}

@media (min-width: 600px) {
  .rtmx__card--text-stack {
    padding: var(--space-md) var(--space-lg);
  }
}

.rtmx__card--text-stack .rtmx__quote {
  font-size: clamp(0.95rem, 0.4vw + 0.85rem, 1.0625rem);
  line-height: 1.4;
  /* Prevent quote from forcing the card taller than half of stack */
  overflow: hidden;
}

.rtmx__stars {
  display: flex;
  gap: 2px;
  font-size: 18px;
  line-height: 1;
  color: var(--clr-brand-accent);
}

.rtmx__quote {
  margin: 0;
  font-family: var(--font-serif);
  /* Upright Cormorant per design guide §5 — never italic */
  font-size: clamp(1.0625rem, 0.6vw + 0.875rem, 1.25rem);
  font-weight: 400;
  line-height: 1.45;
  color: var(--clr-primary);
  text-wrap: pretty;
  flex: 1;
  /* Cap quote line length for readable rhythm in a narrow card */
  overflow-wrap: break-word;
}

.rtmx__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(60, 66, 46, 0.08);
  margin-top: auto;
}

.rtmx__author {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-primary);
  line-height: 1.35;
}

.rtmx__verified {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

/* ============================================
   DARK BACKGROUND VARIANT — bg-accent-dark
   ============================================ */
.rtmx.bg-accent-dark .rtmx__eyebrow {
  color: var(--clr-brand-accent);
}

.rtmx.bg-accent-dark .rtmx__heading-line1 {
  color: var(--clr-text-inverse);
}

.rtmx.bg-accent-dark .rtmx__heading-line2 {
  color: var(--clr-brand-accent);
}

/* Text card on dark sections — subtle inverse fill so it still reads as a card */
.rtmx.bg-accent-dark .rtmx__card--text {
  background: rgba(253, 252, 250, 0.04);
  border-color: rgba(253, 252, 250, 0.15);
}

.rtmx.bg-accent-dark .rtmx__quote,
.rtmx.bg-accent-dark .rtmx__author {
  color: var(--clr-text-inverse);
}

.rtmx.bg-accent-dark .rtmx__verified {
  color: var(--clr-text-inverse);
  opacity: 0.6;
}

.rtmx.bg-accent-dark .rtmx__meta {
  border-top-color: rgba(253, 252, 250, 0.1);
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .rtmx__track {
    scroll-behavior: auto;
  }
}
