/**
 * EXFM homepage reviews section.
 *
 * Review records remain PremiumBox-owned; this file only controls their
 * frontend presentation and the horizontal navigation surface.
 */

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section {
  background: var(--fm-neutral-50);
  color: var(--fm-neutral-900);
  padding: 90px 0 90px 0;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section > .fm-container {
  width: calc(100% - clamp(48px, 10.6vw, 130px));
  max-width: var(--fm-container);
  margin-inline: auto;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__heading {
  min-width: 0;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--fm-neutral-0);
  color: var(--fm-neutral-700);
  font: var(--fm-type-interface-xs);
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__badge-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--fm-primary-500);
  box-shadow: 0 0 0 3px var(--fm-primary-50);
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__title {
  margin: 12px 0 0;
  color: var(--fm-neutral-900);
  font: var(--fm-type-heading-h1);
  letter-spacing: -0.02em;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__controls {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control {
  display: inline-flex;
  width: 72px;
  height: 60px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--fm-neutral-0);
  cursor: pointer;
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control img {
  display: block;
  width: 24px;
  height: 24px;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control[disabled] {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport {
  width: 100%;
  margin-top: 36px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport::-webkit-scrollbar {
  display: none;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport:focus-visible {
  outline: 2px solid var(--fm-primary-500);
  outline-offset: 6px;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__track {
  display: grid;
  min-width: max-content;
  overflow: visible;
  width: max-content;
  grid-auto-columns: 305px;
  grid-auto-flow: column;
  gap: 20px;
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card {
  position: relative;
  visibility: visible;
  opacity: 1;
  display: flex;
  min-height: 300px;
  flex-direction: column;
  padding: 24px;
  border-radius: var(--fm-radius-lg);
  background: var(--fm-neutral-0);
  box-shadow: none;
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card__quote {
  display: block;
  width: 27px;
  height: 24px;
  flex: 0 0 auto;
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card__body {
  margin-top: 24px;
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card__author {
  margin: 0;
  color: var(--fm-neutral-500);
  font: var(--fm-type-caption-regular);
  word-spacing: var(--fm-type-caption-xs-regular-letter-spacing);
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card__text {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--fm-neutral-900);
  font: var(--fm-type-interface-l-regular);
  word-spacing: var(--fm-type-interface-l-letter-spacing);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

:is(body.home, body.fm-exchange-page-template) .fm-review-card__meta {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  margin: 0;
  color: var(--fm-neutral-500);
  font: var(--fm-type-caption-regular);
  letter-spacing: -2%;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta {
  display: inline-flex;
  height: var(--fm-button-cta-icon-l-height);
  align-items: center;
  gap: 24px;
  margin-top: 36px;
  padding: 0 20px;
  border-radius: var(--fm-button-cta-icon-l-radius);
  background: var(--fm-button-dark-bg-default);
  color: var(--fm-neutral-0);
  font: var(--fm-type-interface-l);
  word-spacing: var(--fm-type-interface-l-letter-spacing);
  text-decoration: none;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

:is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta img {
  display: block;
  width: 24px;
  height: 24px;
}

@media (max-width: 767px) {
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section {
    margin: 90px 0 0 0;
    padding: 44px 0 44px 0;
  }


  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section > .fm-container {
    width: 100%;
    padding-inline: 20px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__title {
    font: var(--fm-type-heading-h1);
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__controls {
    display: none;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport {
    margin-top: 36px;
    margin-inline: -20px;
    padding-inline: 20px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__track {
    grid-auto-columns: min(calc(100vw - 36px), 240px);
    gap: 24px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-review-card {
    height: 300px;
    max-width: 241px;
    padding: 24px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-review-card__meta {
    right: 24px;
    bottom: 24px;
    left: 24px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta {
    width: 80%;
    justify-content: space-between;
    margin-top: 36px;
    padding: 0 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport {
    scroll-behavior: auto;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control,
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta {
    transition: none;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control:hover,
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__control:focus-visible,
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta:hover,
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__cta:focus-visible {
    transform: none;
  }
}

/* Figma card visibility and desktop four-card viewport. */
@media (min-width: 768px) {
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__viewport {
    width: calc(100% + 40px);
    max-width: none;
    box-sizing: border-box;
    margin-right: -20px;
    margin-left: -20px;
    padding-right: 0;
    padding-left: 20px;
    scroll-padding-left: 20px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-reviews-section__track {
    grid-auto-columns: min(244px, calc(100vw - 56px));
    gap: 22px;
  }

  :is(body.home, body.fm-exchange-page-template) .fm-review-card {
    width: 100%;
    max-width: none;
    padding: 24px;
  }
}
