/* ==========================================================================
   Patient reviews
   Header (RTL): [heading] | [intro], then a carousel of the (anonymised)
   WhatsApp screenshots in white cards. The carousel shell, track and arrows
   are shared with the team section (.team-carousel in css/team.css,
   js/scroll-carousel.js). Clicking a screenshot opens the lightbox.
   ========================================================================== */

.reviews {
  --reviews-gutter: var(--space-4);
  --cards-visible: 4;
  --card-gap: var(--space-3);       /* 24px */
  --nav-size: var(--space-7);       /* 56px arrows (used by .team-carousel__nav) */

  padding-block: var(--space-8);
  background: color-mix(in srgb, var(--color-primary-100) 18%, #ffffff);
  scroll-margin-top: var(--header-height, 0px);
}

.reviews__inner {
  margin-left: var(--nav-edge-left, var(--reviews-gutter));
  margin-right: var(--nav-edge-right, var(--reviews-gutter));
}

/* ---- Header (same rhythm as the team section) ---- */
.reviews__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.reviews__title {
  margin: 0;
  color: var(--color-primary-700);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-h4);
}

.reviews__title-accent {
  color: var(--color-primary);
}

.reviews__intro {
  max-width: 36em;
  margin: 0;
  justify-self: end; /* RTL: hugs the left edge */
  color: var(--color-neutral-900);
  font-size: var(--font-size-b1);
  line-height: var(--line-height-b1);
}

/* ---- Card ---- */
.review-card {
  flex: 0 0 calc((100% - var(--card-gap) * (var(--cards-visible) - 1)) / var(--cards-visible));
  padding: var(--space-2);
  border-radius: var(--radius-panel); /* 32px */
  background: var(--color-neutral-100);
  box-shadow: 0 2px 4px rgb(19 61 63 / 0.04), 0 12px 32px rgb(19 61 63 / 0.08);
  scroll-snap-align: start;
}

/* The whole screenshot is the button; its frame keeps the original 576:970 ratio (no crop) */
.review-card__frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 576 / 970;
  padding: 0;
  border: 0;
  border-radius: var(--space-2); /* 16px, nested in the 32px card */
  background: #0b141a;           /* WhatsApp dark backdrop while the image loads */
  overflow: hidden;              /* keeps the hover zoom inside the frame */
  cursor: zoom-in;
}

.review-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.review-card__zoom {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  display: grid;
  place-items: center;
  width: var(--space-5);  /* 40px */
  height: var(--space-5);
  border-radius: var(--radius-circle);
  background: rgb(255 255 255 / 0.92);
  color: var(--color-primary-700);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity var(--duration-base) ease,
    transform var(--duration-base) var(--ease-smooth);
}

@media (hover: hover) {
  .review-card__frame:hover .review-card__image {
    transform: scale(1.04);
  }

  .review-card__frame:hover .review-card__zoom {
    opacity: 1;
    transform: none;
  }
}

/* Touch: no hover → keep the "tap to enlarge" hint visible */
@media (hover: none) {
  .review-card__zoom {
    opacity: 1;
    transform: none;
  }
}

.review-card__frame:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.review-card__frame:focus-visible .review-card__zoom {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: var(--space-3);
  border: 0;
  background: transparent;
  color: var(--color-text-on-brand);
  overflow: hidden;
}

.lightbox[open] {
  display: grid;
  place-items: center;
  animation: lightbox-in var(--duration-slow) var(--ease-smooth);
}

.lightbox::backdrop {
  background: rgb(19 61 63 / 0.94); /* dark teal; literal, see booking-drawer.css */
}

.lightbox__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
}

.lightbox__image {
  display: block;
  width: auto;
  max-width: min(576px, 100%);
  max-height: calc(100dvh - var(--space-8) - var(--space-6)); /* room for counter + padding */
  border-radius: var(--space-3);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.35);
}

.lightbox__counter {
  margin: 0;
  color: rgb(255 255 255 / 0.85);
  font-size: var(--font-size-b3);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-b3);
  font-variant-numeric: tabular-nums;
}

.lightbox__close {
  position: absolute;
  top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  right: calc(var(--space-3) + env(safe-area-inset-right, 0px)); /* RTL start corner */
  display: grid;
  place-items: center;
  width: var(--space-6);  /* 48px */
  height: var(--space-6);
  padding: 0;
  border: 0;
  border-radius: var(--radius-circle);
  background: var(--color-neutral-100);
  color: var(--color-primary-700);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-smooth);
}

.lightbox__close:active {
  transform: scale(0.94);
}

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  outline: 2px solid var(--color-neutral-100);
  outline-offset: 3px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__nav:active {
  transform: translateY(-50%) scale(0.94);
}

.lightbox__nav--prev { right: calc(var(--space-4) + env(safe-area-inset-right, 0px)); }
.lightbox__nav--next { left: calc(var(--space-4) + env(safe-area-inset-left, 0px)); }

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .review-card__image,
  .review-card__zoom {
    transition: none;
  }

  .lightbox[open] {
    animation: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1599.98px) {
  .reviews {
    --reviews-gutter: var(--space-3);
  }
}

@media (max-width: 1439.98px) {
  .reviews__title {
    font-size: var(--font-size-h5);
    line-height: var(--line-height-h5);
  }

  .reviews__intro {
    font-size: var(--font-size-b2);
    line-height: var(--line-height-b2);
  }
}

@media (max-width: 1279.98px) {
  .reviews {
    --cards-visible: 3;
  }
}

@media (max-width: 1023.98px) {
  .reviews {
    --cards-visible: 2.4; /* the next screenshot peeks in */
    --card-gap: var(--space-2);
  }

  .reviews__header {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
  }

  .reviews__intro {
    justify-self: start;
  }
}

@media (max-width: 767.98px) {
  .reviews {
    --reviews-gutter: var(--space-2);
    --cards-visible: 1.35;
    --nav-size: var(--space-6);

    padding-block: var(--space-6);
  }

  .reviews__title {
    font-size: var(--font-size-h6);
    line-height: var(--line-height-h6);
  }

  .review-card {
    padding: var(--space-1);
    border-radius: var(--space-3);
  }

  .lightbox {
    /* bottom: a reserved row for the arrows, so they never cover the counter */
    padding:
      calc(var(--space-8) + var(--space-1) + env(safe-area-inset-top, 0px))   /* clears the close button */
      var(--space-2)
      calc(var(--space-6) + var(--space-3) * 2 + env(safe-area-inset-bottom, 0px));
  }

  .lightbox__image {
    max-height: calc(100dvh - var(--space-8) * 3 - var(--space-3) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  /* Arrows move under the image on phones (swipe also works) */
  .lightbox__nav {
    top: auto;
    bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    transform: none;
  }

  .lightbox__nav:active {
    transform: scale(0.94);
  }

  .lightbox__nav--prev { right: calc(50% + var(--space-1)); }
  .lightbox__nav--next { left: calc(50% + var(--space-1)); }
}
