/* ==========================================================================
   Homepage sections: two-pane FAQ · review carousel · gallery
   ========================================================================== */

/* --- Two-pane FAQ ---------------------------------------------------------
   Numbered question index on one side, the selected answer on the other.

   The panes only split once faq-tabs.js has run (`.is-enhanced`). Without it
   every question and answer stays visible and readable as an ordinary list,
   so a script failure degrades instead of hiding the content.
   ------------------------------------------------------------------------ */

.faq-panes {
  display: grid;
  gap: var(--space-5);
  align-items: start;
}

@media (min-width: 900px) {
  .faq-panes {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 44px);
  }
}

.faq-index {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.faq-index__item + .faq-index__item {
  border-block-start: 1px solid var(--color-border);
}

.faq-index__button {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: 56px;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.faq-index__button:hover {
  background: var(--color-surface-muted);
}

.faq-index__button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* The accent bar marking the selected row scales from the top rather than
   appearing, so moving between rows reads as movement. */
.faq-index__button::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: 3px;
  background: var(--color-accent-strong);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform var(--transition-normal);
}

.faq-index__button.is-active {
  background: var(--color-surface-muted);
}

.faq-index__button.is-active::before {
  transform: scaleY(1);
}

.faq-index__number {
  color: var(--color-text-muted);
  font-size: var(--fs-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.faq-index__button.is-active .faq-index__number {
  color: var(--color-accent-strong);
}

.faq-index__label {
  min-inline-size: 0;
  text-wrap: pretty;
}

.faq-index__arrow {
  inline-size: 8px;
  block-size: 8px;
  border-block-start: 2px solid currentColor;
  border-inline-end: 2px solid currentColor;
  transform: rotate(45deg) translateX(-4px);
  opacity: 0;
  color: var(--color-accent-strong);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.faq-index__button.is-active .faq-index__arrow,
.faq-index__button:hover .faq-index__arrow {
  opacity: 1;
  transform: rotate(45deg) translateX(0);
}

.faq-answers {
  display: grid;
}

.faq-answer {
  padding: clamp(22px, 2.6vw, 34px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

/* Unenhanced, the answers stack as a normal list. Enhanced, they share one
   grid cell and only the selected one is shown. */
.faq-answer + .faq-answer {
  margin-block-start: var(--space-4);
}

.faq-panes.is-enhanced .faq-answer {
  grid-area: 1 / 1;
  margin-block-start: 0;
}

.faq-panes.is-enhanced .faq-answer.is-active {
  animation: swl-faq-swap var(--transition-normal) both;
}

@keyframes swl-faq-swap {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
}

.faq-answer__title {
  margin-block-end: var(--space-3);
  font-size: var(--fs-h4);
  text-wrap: balance;
}

.faq-answer__body {
  color: var(--color-text-muted);
  max-inline-size: var(--measure);
}

@media (min-width: 900px) {
  .faq-answers {
    position: sticky;
    /* Clears the sticky header so the answer never sits behind it. */
    top: calc(72px + var(--space-5));
  }
}

/* --- Reviews --------------------------------------------------------------
   Testimonial cards, carried by the shared carousel.
   ------------------------------------------------------------------------ */

.review {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  block-size: 100%;
  padding: clamp(20px, 2.2vw, 28px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.review__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* An initial, not a portrait. We do not publish patients' faces, and a stock
   face under a real patient's name would be a fabrication. */
.review__avatar {
  display: grid;
  place-items: center;
  inline-size: 42px;
  block-size: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-text-invert);
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: 1;
}

.review__who {
  display: grid;
  gap: 1px;
  min-inline-size: 0;
}

.review__name {
  font-weight: 700;
}

.review__place {
  color: var(--color-text-muted);
  font-size: var(--fs-caption);
}

.review__stars {
  color: #d98c0a;
  font-size: var(--fs-small);
  letter-spacing: 0.12em;
}

.review__quote {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-small);
}

.review__treatment {
  margin-block-start: auto;
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--color-border);
  color: var(--color-accent-strong);
  font-size: var(--fs-caption);
  font-weight: 600;
}

/* --- Gallery --------------------------------------------------------------
   A UNIFORM grid.

   The previous version spanned every third tile across two columns, which
   left ragged holes wherever a row could not be completed — the empty space
   in the places section. Equal tiles cannot leave a hole.
   ------------------------------------------------------------------------ */

.gallery {
  display: grid;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
  list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  isolation: isolate;
}

.gallery__media .record-image__img {
  aspect-ratio: 4 / 3;
}

/* The licence credit belongs on record pages, not stamped across a tile that
   already carries a caption — the two were overlapping. */
.gallery__media .record-image__credit {
  display: none;
}

.gallery__caption {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  padding: var(--space-5) var(--space-3) var(--space-2);
  color: var(--color-text-invert);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1.3;
  background: linear-gradient(to top, rgb(11 22 33 / 0.88), transparent);
}

.gallery__item:hover .record-image__img {
  transform: scale(1.06);
}

.section--ink .gallery__item {
  border: 1px solid rgb(255 255 255 / 0.10);
}

@media (prefers-reduced-motion: reduce) {
  .faq-index__button::before,
  .faq-index__arrow,
  .gallery__item .record-image__img {
    transition: none;
  }

  .faq-panes.is-enhanced .faq-answer.is-active {
    animation: none;
  }
}
