/* ============================================
   FULL WIDTH MEDIA SLIDER (.fwms)
   Edge-to-edge crossfading slides. Each slide owns
   its media (image or video, desktop + mobile), its
   gradient, its heading/body text and its buttons.
   Modeled on Full Width Image Header (.fwih).
   Mobile breakpoint: max-width 767px (theme standard).
   ============================================ */

.fwms {
  position: relative;
  width: 100%;
  overflow: hidden;
  isolation: isolate;

  --fwms-h-mobile:  clamp(420px, 70vh, 540px);
  --fwms-h-tablet:  clamp(480px, 65vh, 600px);
  --fwms-h-desktop: clamp(540px, 60vh, 640px);
  --fwms-controls-space: 0px;
}

.fwms[data-height="compact"] {
  --fwms-h-mobile:  clamp(320px, 55vh, 400px);
  --fwms-h-tablet:  clamp(380px, 50vh, 460px);
  --fwms-h-desktop: clamp(420px, 50vh, 480px);
}

.fwms[data-height="tall"] {
  --fwms-h-mobile:  clamp(480px, 80vh, 620px);
  --fwms-h-tablet:  clamp(560px, 75vh, 680px);
  --fwms-h-desktop: clamp(620px, 75vh, 760px);
}

/* Reserve a strip at the bottom for dots + pause so they never sit on text/buttons */
.fwms[data-has-controls="true"] {
  --fwms-controls-space: 56px;
}

/* All slides share one grid cell, so the tallest slide's
   content sets the height and long copy never clips. */
.fwms__slides {
  position: relative;
  display: grid;
  width: 100%;
  min-height: var(--fwms-h-mobile);
  background-color: var(--clr-neutral-light, #DDE0D5);
}

@media (min-width: 768px) {
  .fwms__slides { min-height: var(--fwms-h-tablet); }
}

@media (min-width: 1024px) {
  .fwms__slides { min-height: var(--fwms-h-desktop); }
}

.fwms__slide {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  min-height: inherit;
  opacity: 0;
  visibility: hidden;
  z-index: 0;
  pointer-events: none;
  transition: opacity 1s ease-in-out, visibility 0s linear 1s;
}

.fwms__slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
  pointer-events: auto;
  transition: opacity 1s ease-in-out, visibility 0s linear 0s;
}

/* ============================================
   Media layer
   ============================================ */
.fwms__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.fwms__media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.fwms__image,
.fwms__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fwms-focal, center);
}

/* media_tag may add intrinsic width/height (or a wrapper) — always fill the frame */
.fwms__media video,
.fwms__media img {
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  object-fit: cover !important;
  object-position: var(--fwms-focal, center) !important;
}

/* Desktop/mobile video pair — only the visible one is played by JS */
.fwms__video--mobile { display: none; }

@media (max-width: 767px) {
  .fwms__video--desktop { display: none; }
  .fwms__video--mobile  { display: block; }
}

.fwms__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8d9c9 0%, #d4ccbb 45%, #c9bfaa 100%);
}

/* ============================================
   Gradient — between media & content (per slide)
   ============================================ */
.fwms__gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-color: var(--fwms-gradient-color, #000);
  opacity: var(--fwms-gradient-strength, 0.55);
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 82%);
          mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 82%);
}

/* ============================================
   Content layer
   ============================================ */
.fwms__content {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: var(--space-xl) var(--space-lg) calc(var(--space-xl) + var(--fwms-controls-space));
}

@media (min-width: 1024px) {
  .fwms__content {
    padding: var(--space-2xl) var(--space-xl) calc(var(--space-2xl) + var(--fwms-controls-space));
  }
}

/* Edge arrows (tablet+): keep text clear of the chevrons */
@media (min-width: 768px) {
  .fwms[data-arrows="true"] .fwms__content {
    padding-left: calc(var(--space-lg) + 44px);
    padding-right: calc(var(--space-lg) + 44px);
  }
}

@media (min-width: 1024px) {
  .fwms[data-arrows="true"] .fwms__content {
    padding-left: calc(var(--space-xl) + 44px);
    padding-right: calc(var(--space-xl) + 44px);
  }
}

.fwms__inner {
  width: 100%;
  max-width: 1600px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-lg);
}

.fwms__inner[data-position="top"]    .fwms__text { margin-bottom: auto; }
.fwms__inner[data-position="middle"] .fwms__text { margin-top: auto; margin-bottom: auto; }

.fwms__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 720px;
  min-width: 0;
}

.fwms__inner[data-text-align="center"] { align-items: center; text-align: center; }
.fwms__inner[data-text-align="center"] .fwms__text { align-items: center; }
.fwms__inner[data-text-align="right"]  { align-items: flex-end; text-align: right; }
.fwms__inner[data-text-align="right"]  .fwms__text { align-items: flex-end; }

/* Heading — same two-line pattern & fonts as .fwih */
.fwms__heading {
  margin: 0;
  line-height: 0.98;
  letter-spacing: 0.01em;
  font-size: clamp(2.25rem, 6.5vw, 5rem);
  overflow-wrap: break-word;
  text-wrap: balance;
  color: var(--clr-text-inverse, #FDFCFA);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

.fwms__heading-line1 {
  display: block;
  text-transform: uppercase;
  font-family: var(--fwms-l1-font, var(--font-primary));
  font-weight: var(--fwms-l1-weight, 600);
}

.fwms__heading-line2 {
  display: block;
  font-family: var(--fwms-l2-font, var(--font-serif));
  font-weight: var(--fwms-l2-weight, 400);
  letter-spacing: 0;
  font-size: 0.9em;
  line-height: 1.05;
  margin-top: var(--space-xs);
  color: var(--clr-brand-accent, #B5A882);
}

.fwms__subtext {
  margin: 0;
  font-size: clamp(15px, 1.4vw, 18px);
  font-family: var(--fwms-body-font, var(--font-body));
  font-weight: var(--fwms-body-weight, 300);
  line-height: 1.6;
  color: var(--clr-text-inverse, #FDFCFA);
  opacity: 0.92;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.22);
  text-wrap: pretty;
  max-width: 60ch;
}
.fwms__subtext > :first-child { margin-top: 0; }
.fwms__subtext > :last-child  { margin-bottom: 0; }

/* Buttons */
.fwms__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}
.fwms__inner[data-text-align="center"] .fwms__ctas { justify-content: center; }
.fwms__inner[data-text-align="right"]  .fwms__ctas { justify-content: flex-end; }

.fwms__btn-primary,
.fwms__btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 14px var(--space-xl);
  border-radius: var(--radius-md, 6px);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.fwms__btn-primary {
  background: var(--clr-text-inverse, #FDFCFA);
  color: var(--clr-primary, #3c422e);
  border: 1px solid transparent;
}
.fwms__btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }

.fwms__btn-secondary {
  background: transparent;
  color: var(--clr-text-inverse, #FDFCFA);
  border: 1px solid var(--clr-text-inverse, #FDFCFA);
}
.fwms__btn-secondary:hover {
  background: var(--clr-text-inverse, #FDFCFA);
  color: var(--clr-primary, #3c422e);
}

.fwms__btn-primary svg,
.fwms__btn-secondary svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.fwms__btn-primary:hover svg,
.fwms__btn-secondary:hover svg { transform: translateX(2px); }

.fwms__btn-primary:focus-visible,
.fwms__btn-secondary:focus-visible {
  outline: 2px solid var(--clr-text-inverse, #FDFCFA);
  outline-offset: 3px;
}

@media (max-width: 767px) {
  .fwms__btn-primary,
  .fwms__btn-secondary { white-space: normal; text-align: center; }
}

/* ============================================
   Controls — subtle edge chevrons, small dots,
   quiet pause icon in a bottom corner.
   Icons use a soft drop shadow (not a backing
   circle) so they stay legible on bright photos.
   ============================================ */

/* Edge chevrons — tablet and up (phones use swipe + dots) */
.fwms__arrow {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--clr-text-inverse, #FDFCFA);
  cursor: pointer;
  opacity: 0.6;
  transform: translateY(-50%);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  transition: opacity 0.2s ease;
}

.fwms__arrow--prev { left: 4px; }
.fwms__arrow--next { right: 4px; }

.fwms__arrow svg { width: 24px; height: 24px; }

@media (min-width: 768px) {
  .fwms__arrow { display: inline-flex; }
}

.fwms__arrow:hover,
.fwms__arrow:focus-visible { opacity: 1; }

/* Dots — centered along the bottom */
.fwms__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

@media (min-width: 1024px) {
  .fwms__controls { bottom: 10px; }
}

.fwms__controls-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fwms__dots {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fwms__dots > li {
  display: flex;
  margin: 0;
  padding: 0;
}

/* 20x44 tap target, 7px visual dot */
.fwms__dot {
  position: relative;
  display: block;
  width: 20px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.fwms__dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(253, 252, 250, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  transition: background-color 0.2s ease, width 0.2s ease;
}

.fwms__dot:hover::before { background: rgba(253, 252, 250, 0.85); }

.fwms__dot[aria-current="true"]::before {
  width: 18px;
  background: var(--clr-text-inverse, #FDFCFA);
}

/* Pause / play — quiet icon in a bottom corner, always findable */
.fwms__pause {
  position: absolute;
  bottom: 6px;
  right: 8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--clr-text-inverse, #FDFCFA);
  cursor: pointer;
  opacity: 0.65;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  transition: opacity 0.2s ease;
}

.fwms__pause[hidden] { display: none; }

.fwms__pause--left { right: auto; left: 8px; }

@media (min-width: 1024px) {
  .fwms__pause { bottom: 10px; right: var(--space-lg, 24px); }
  .fwms__pause--left { right: auto; left: var(--space-lg, 24px); }
}

.fwms__pause svg { width: 16px; height: 16px; }

.fwms__pause:hover,
.fwms__pause:focus-visible { opacity: 1; }

.fwms__pause .fwms__icon-play { display: none; }
.fwms__pause[aria-pressed="true"] .fwms__icon-play  { display: block; }
.fwms__pause[aria-pressed="true"] .fwms__icon-pause { display: none; }

/* Touch devices have no hover — keep icons a little stronger */
@media (hover: none) {
  .fwms__arrow,
  .fwms__pause { opacity: 0.85; }
}

.fwms__arrow:focus-visible,
.fwms__pause:focus-visible,
.fwms__dot:focus-visible {
  outline: 2px solid var(--clr-text-inverse, #FDFCFA);
  outline-offset: 2px;
}

.fwms__sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Text tone — dark text + buttons for light media
   ============================================ */
.fwms__slide[data-text-tone="dark"] .fwms__heading {
  color: #1f2418;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.45);
}

.fwms__slide[data-text-tone="dark"] .fwms__heading-line2 {
  color: var(--clr-primary, #3c422e);
}

.fwms__slide[data-text-tone="dark"] .fwms__subtext {
  color: #1f2418;
  opacity: 1;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.4);
}

.fwms__slide[data-text-tone="dark"] .fwms__btn-primary {
  background: var(--clr-primary, #3c422e);
  color: var(--clr-text-inverse, #FDFCFA);
}

.fwms__slide[data-text-tone="dark"] .fwms__btn-secondary {
  color: #1f2418;
  border-color: #1f2418;
}

.fwms__slide[data-text-tone="dark"] .fwms__btn-secondary:hover {
  background: #1f2418;
  color: var(--clr-text-inverse, #FDFCFA);
}

.fwms__slide[data-text-tone="dark"] .fwms__btn-primary:focus-visible,
.fwms__slide[data-text-tone="dark"] .fwms__btn-secondary:focus-visible {
  outline-color: #1f2418;
}

/* Phones: pause icon a bit larger and stronger (no hover, bright photos) */
@media (max-width: 767px) {
  .fwms__pause { opacity: 0.85; }
  .fwms__pause svg { width: 20px; height: 20px; }
}

/* ============================================
   Control tone — dark controls for light media.
   Set per section (Control Color) and optionally per slide;
   the JS swaps data-controls-tone as slides change.
   ============================================ */
.fwms[data-controls-tone="dark"] .fwms__arrow,
.fwms[data-controls-tone="dark"] .fwms__pause {
  color: #1f2418;
  filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.65));
}

.fwms[data-controls-tone="dark"] .fwms__dot::before {
  background: rgba(31, 36, 24, 0.45);
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
}

.fwms[data-controls-tone="dark"] .fwms__dot:hover::before { background: rgba(31, 36, 24, 0.8); }

.fwms[data-controls-tone="dark"] .fwms__dot[aria-current="true"]::before {
  background: #1f2418;
}

.fwms[data-controls-tone="dark"] .fwms__arrow:focus-visible,
.fwms[data-controls-tone="dark"] .fwms__pause:focus-visible,
.fwms[data-controls-tone="dark"] .fwms__dot:focus-visible {
  outline-color: #1f2418;
}

.fwms__arrow,
.fwms__pause,
.fwms__dot::before { transition-property: opacity, color, background-color, width; }

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .fwms__slide,
  .fwms__slide.is-active { transition: none; }
  .fwms__btn-primary:hover { transform: none; }
  .fwms__arrow,
  .fwms__pause { transition: none; }
}
