/* =========================================================
   Breadcrumb
   ========================================================= */

.stories-breadcrumb {
  border-top: 1px solid #f1f1f1;
  background: #ffffff;
}

.stories-breadcrumb__container {
  display: flex;
  width: min(
    calc(100% - 48px),
    var(--container-width, 1140px)
  );
  min-height: 58px;
  align-items: center;
  gap: 6px;
  margin-inline: auto;
  font-size: 12px;
  line-height: 1;
}

.stories-breadcrumb__home,
.stories-breadcrumb__separator {
  color: #777777;
  font-family: var(--font-brand);
  font-weight: 400;
  text-decoration: none;
}

.stories-breadcrumb__separator {
  color: #404040;
}

.stories-breadcrumb__home:hover,
.stories-breadcrumb__home:focus-visible {
  color: #0098dc;
}

.stories-breadcrumb__current {
  color: #0098dc;
  font-family: var(--font-brand-medium);
  font-weight: 400;
}

/* =========================================================
   Page section
   ========================================================= */

.customer-stories-page {
  --stories-primary: #0098dc;
  --stories-primary-hover: #0070c0;
  --stories-yellow: #fff03d;
  --stories-line: #dedede;
  --stories-card-gap: 20px;

  min-height: 100vh;
  padding: 42px 0 90px;
  background: #f6f6f6;
}

.customer-stories-page__container {
  width: min(
    calc(100% - 48px),
    1100px
  );
  margin-inline: auto;
}

/* =========================================================
   Heading
   ========================================================= */

.customer-stories-page__heading {
  display: flex;
  align-items: center;
  gap: 22px;
}

.customer-stories-page__heading h1 {
  flex: 0 0 auto;
  margin: 0;
  color: var(--stories-primary);
  font-family: var(--font-brand);
  font-size: clamp(36px, 2.35vw, 45px);
  font-weight: 400;
  line-height: 1;
}

.customer-stories-page__heading-line {
  position: relative;
  display: block;
  min-width: 40px;
  height: 1px;
  flex: 1 1 auto;
  background: var(--stories-line);
  transform: translateY(6px);
}

.customer-stories-page__heading-line::before,
.customer-stories-page__heading-line::after {
  position: absolute;
  top: 50%;
  width: 5.6px;
  height: 5.6px;
  content: "";
  background: var(--stories-line);
  border-radius: 50%;
  transform: translateY(-50%);
}

.customer-stories-page__heading-line::before {
  left: 0;
}

.customer-stories-page__heading-line::after {
  right: 0;
}

.customer-stories-page__feedback-button {
  display: inline-flex;
  min-width: 148px;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-inline: 16px;
  color: #ffffff;
  background: var(--stories-primary);
  border-radius: 5px;
  font-family: var(--font-brand);
  font-size: 14.4px;
  line-height: 1;
  transform: translateY(6px);
  transition: background-color 250ms ease;
}

.customer-stories-page__feedback-button img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.customer-stories-page__feedback-button:hover,
.customer-stories-page__feedback-button:focus-visible {
  background: var(--stories-primary-hover);
}

/* =========================================================
   Cards grid
   ========================================================= */

.customer-stories-page__grid {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  grid-auto-rows: 365px;
  gap: 32px var(--stories-card-gap);
  margin-top: 70px;
  font-family: var(--font-text);
}

/*
 * ฟอนต์ข้อความภายในการ์ดสรุปคะแนน
 */

/* “ดีมาก” — MuangthaicapModern-Medium.ttf */

.customer-stories-page
  .review-summary__grade {
  font-family: var(--font-brand-medium);
  font-weight: 400;
}

/* “จาก 5” — MuangthaicapModern-Regular.ttf */

.customer-stories-page
  .review-summary__maximum {
  font-family: var(--font-brand);
  font-weight: 400;
}

/* “รีวิวทั้งหมด 225 รีวิว” — MuangthaicapModern-Medium.ttf */

.customer-stories-page
  .review-summary__total {
  font-family: var(--font-brand-medium);
  font-weight: 400;
}

/*
 * ใช้รูปแบบการ์ดจาก site.css
 * และกำหนดให้การ์ดทุกใบเต็มความสูงของ Grid
 */

.customer-stories-page__grid
  > .review-summary,
.customer-stories-page__grid
  > .customer-review-card {
  width: 100%;
  height: 100%;
}

/*
 * ป้องกัน CSS responsive ของหน้าแรก
 * ทำให้ Summary มีความสูงเกิน Grid
 */

.customer-stories-page
  .review-summary {
  min-height: 0;
}

.customer-stories-page
  .customer-review-card {
  min-height: 0;
}

/*
 * จำกัด testimonial_text ไม่เกิน 3 บรรทัด
 * หากยาวกว่านั้น Browser จะแสดง … ต่อท้าย
 */

.customer-stories-page
  .customer-review-card__message {
  display: -webkit-box;
  max-height: calc(1.45em * 3);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/*
 * คงพื้นที่ส่วนตอบกลับไว้ทุกการ์ด
 * แม้ไม่มีข้อความ staff_reply
 */

.customer-stories-page
  .customer-review-card__reply {
  box-sizing: border-box;
  min-height: 105px;
  flex: 0 0 105px;
}

/*
 * จำกัด staff_reply ไม่เกิน 2 บรรทัด
 * แต่ไม่กระทบชื่อผู้ตอบและ staff_reply_at
 */

.customer-stories-page
  .customer-review-card__reply
  p {
  display: -webkit-box;
  max-height: calc(1.45em * 2);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.customer-stories-page
  .customer-review-card__reply--empty
  strong {
  display: block;
}

/* =========================================================
   Pagination
   ========================================================= */

.stories-pagination {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 58px;
  font-family: var(--font-brand);
}

.stories-pagination__page,
.stories-pagination__arrow,
.stories-pagination__ellipsis {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  color: #b8bbc1;
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
}

.stories-pagination__page {
  border-radius: 50%;
  font-size: 15px;
  transition:
    color 200ms ease,
    background-color 200ms ease;
}

.stories-pagination__page:hover,
.stories-pagination__page:focus-visible {
  color: #0098dc;
}

.stories-pagination__page.is-active {
  color: #ffffff;
  background: #0098dc;
}

.stories-pagination__arrow {
  color: #0098dc;
  transition:
    color 200ms ease,
    transform 200ms ease;
}

.stories-pagination__arrow span {
  display: block;
  width: 9px;
  height: 9px;
  border-top: 2px solid currentcolor;
  border-right: 2px solid currentcolor;
}

.stories-pagination__arrow--next span {
  transform: rotate(45deg);
}

.stories-pagination__arrow--previous span {
  transform: rotate(-135deg);
}

.stories-pagination__arrow:hover,
.stories-pagination__arrow:focus-visible {
  color: #0070c0;
  transform: translateX(2px);
}

.stories-pagination__arrow--previous:hover,
.stories-pagination__arrow--previous:focus-visible {
  transform: translateX(-2px);
}

.stories-pagination__ellipsis {
  color: #b8bbc1;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1024px) {
  .customer-stories-page__grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    grid-auto-rows: 390px;
  }

  .customer-stories-page
    .review-summary,
  .customer-stories-page
    .customer-review-card {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .stories-breadcrumb__container,
  .customer-stories-page__container {
    width: calc(100% - 32px);
  }

  .customer-stories-page {
    padding-top: 32px;
    padding-bottom: 64px;
  }

  .customer-stories-page__heading {
    flex-wrap: wrap;
  }

  .customer-stories-page__heading h1 {
    width: 100%;
    font-size: 36px;
  }

  .customer-stories-page__heading-line {
    display: none;
  }

  .customer-stories-page__feedback-button {
    min-width: 128px;
    height: 37px;
    margin-left: auto;
    font-size: 12.6px;
    transform: none;
  }

  .customer-stories-page__grid {
    grid-template-columns:
      minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: 24px;
    margin-top: 40px;
  }

  .customer-stories-page
    .review-summary {
    min-height: 400px;
  }

  .customer-stories-page
    .customer-review-card {
    min-height: 390px;
  }

  .stories-pagination {
    gap: 8px;
    margin-top: 42px;
  }

  .stories-pagination__page,
  .stories-pagination__arrow,
  .stories-pagination__ellipsis {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    font-size: 14px;
  }
}