/* ============================================================
   Coastal Photography — Area Subpage Interactive Components
   area-page.css — load after area-showcase.css + areas-map.css

   Shared, template-ready styles for the area subpages:
     1. Service-media carousels (.svc-carousel)
     2. Before / after comparison sliders (.ba-slider)
     3. Matterport 3D-tour embed placeholder (.mp-embed)
     4. Embedded "find your area" search band (.area-search)

   All components live inside .svc-feature__media (position:relative,
   aspect-ratio 4/3, overflow:hidden) unless noted. Tokens only — no
   hardcoded colours beyond the shared frosted-dark control wash.
   ============================================================ */

/* ---------------------------------------------------------------
   1. CAROUSEL — prev/next + dots inside a .svc-feature__media box
--------------------------------------------------------------- */
.svc-carousel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.svc-carousel__track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.5s ease;
  will-change: transform;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.svc-carousel.is-dragging .svc-carousel__track {
  cursor: grabbing;
}

.svc-carousel__slide {
  flex: 0 0 100%;
  min-width: 0;
  height: 100%;
}

.svc-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  /* Override the .svc-feature:hover zoom so it doesn't fight the slide */
  transform: none !important;
}

/* Prev / next controls */
.svc-carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(16, 38, 50, 0.62);
  color: #fff;
  cursor: pointer;
  transition: background 0.18s ease;
}

.svc-carousel__btn:hover {
  background: rgba(16, 38, 50, 0.82);
}

.svc-carousel__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(82, 104, 111, 0.6);
}

.svc-carousel__btn--prev { left: var(--s-3); }
.svc-carousel__btn--next { right: var(--s-3); }

.svc-carousel__btn svg {
  width: 22px;
  height: 22px;
}

/* Dot indicators */
.svc-carousel__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--s-3);
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.svc-carousel__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.svc-carousel__dot:hover { background: rgba(255, 255, 255, 0.85); }

.svc-carousel__dot[aria-selected="true"] {
  background: var(--color-gold);
  transform: scale(1.2);
}

.svc-carousel__dot:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(82, 104, 111, 0.6);
}

#svc-floor-plans .svc-feature__media,
#svc-floor-plans .svc-carousel__slide {
  background: #fff;
}

#svc-floor-plans .svc-carousel__slide img {
  object-fit: contain;
  padding: clamp(0.5rem, 1.5vw, 1rem);
}

/* Screen-reader-only slide-position announcer */
.svc-carousel__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------
   2. BEFORE / AFTER SLIDER — draggable reveal inside a media box
--------------------------------------------------------------- */
.ba-slider {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
  cursor: ew-resize;
  --ba-pos: 50%;
  overflow: hidden;
  isolation: isolate;
}

.ba-slider__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  transform: none !important;
}

/* The "before" layer is clipped without resizing the image. */
.ba-slider__before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}

.ba-slider__before .ba-slider__img {
  width: 100%;
  max-width: none;
  left: 0;
}

/* Vertical handle bar at the seam */
.ba-slider__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos);
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 4;
}

.ba-slider__handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(16, 38, 50, 0.62);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Full-cover transparent range input drives pointer + keyboard */
.ba-slider__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 6;
}

.ba-slider:focus-within .ba-slider__handle::after {
  box-shadow: 0 0 0 3px rgba(82, 104, 111, 0.7);
}

/* Before / after pill labels */
.ba-slider__label {
  position: absolute;
  bottom: var(--s-3);
  z-index: 5;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 38, 50, 0.72);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.ba-slider__label--before { left: var(--s-3); }
.ba-slider__label--after { right: var(--s-3); }

/* ---------------------------------------------------------------
   3. MATTERPORT EMBED — poster + click-to-load placeholder
--------------------------------------------------------------- */
.mp-embed {
  position: absolute;
  inset: 0;
}

.mp-embed__frame,
.mp-embed__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  display: block;
}

.mp-embed__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-pill);
  background: rgba(16, 38, 50, 0.72);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease;
}

.mp-embed__play:not([disabled]):hover {
  background: rgba(16, 38, 50, 0.9);
}

.mp-embed__play:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(82, 104, 111, 0.6);
}

.mp-embed__play[disabled] {
  cursor: default;
  opacity: 0.78;
}

.mp-embed__play-icon {
  display: inline-flex;
}

.mp-embed__play-icon svg {
  width: 18px;
  height: 18px;
}

/* ---------------------------------------------------------------
   4. AREA SEARCH BAND — "find your area" live filter
   Reuses .amap-search / .amap-list from areas-map.css.
--------------------------------------------------------------- */
.area-search {
  padding: clamp(var(--s-10), 5vw, var(--s-16)) var(--container-padding);
  background: var(--slate-light);
  border-top: 1px solid var(--card-border);
}

.area-search__inner {
  max-width: 620px;
  margin: 0 auto;
}

.area-search__head {
  text-align: center;
  margin-bottom: var(--s-6);
}

.area-search__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.15;
  color: var(--charcoal);
  margin: 0;
}

.area-search .amap-search {
  margin-bottom: var(--s-4);
}

.area-search .amap-list {
  max-height: 360px;
}

/* ---------------------------------------------------------------
   REDUCED MOTION — slides/handles jump instantly, still usable
--------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .svc-carousel__track,
  .svc-carousel__dot,
  .svc-carousel__btn,
  .mp-embed__play {
    transition: none;
  }
}
