/**
 * assets/css/results.css
 * CSS riêng cho sections/05-results.php (Real Results - 4 video cards).
 * Desktop: 4 cột grid. Mobile: scroll ngang hiện ~1.5 card.
 */

.section-results {
  padding: clamp(48px, 8vw, 80px) 0;
  background-color: var(--cream);
  overflow: visible;
}

.results-title {
  font-size: clamp(32px, 7vw, 56px);
  color: var(--green-deep);
  text-align: center;
  margin-bottom: clamp(32px, 5vw, 48px);
}

.results-title em {
  color: var(--gold);
}

/* --- Scroll container --- */
.results-scroll {
  display: flex;
  gap: clamp(16px, 2vw, 24px);
  padding: 0 var(--grid-padding);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--grid-padding);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.results-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}
/* Padding cuối scroll bị trình duyệt nuốt khi overflow-x — dùng pseudo-element thay */
.results-scroll::after {
  content: "";
  flex: 0 0 1px;
  padding-right: calc(var(--grid-padding) - 1px);
}

/* --- Card --- */
.result-card {
  flex: 0 0 78%;
  max-width: 78%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card__media {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background: var(--champagne);
  cursor: pointer;
}

/* Thumbnail */
.result-card__thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
  visibility: visible;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

/* Video (ẩn mặc định) */
.result-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  opacity: 0;
  visibility: hidden; /* Thêm dòng này để ép iOS hiểu là đang ẩn */
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

/* Khi video đã kích hoạt (is-active): hiện video, ẩn thumbnail */
.result-card.is-active .result-card__thumb {
  opacity: 0;
  visibility: hidden;
}
.result-card.is-active .result-card__video {
  opacity: 1;
  visibility: visible; /* Thêm dòng này để ép iOS vẽ lại layer video */
}

/* --- Play button (frosted glass, giống hero-btn) --- */
.result-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 8px 20px rgba(0, 0, 0, 0.15);
  color: var(--cream);
  transition:
    transform 0.25s ease,
    background 0.25s ease;
}
.result-card__play svg {
  margin-left: 3px; /* optical center vì icon play lệch phải */
}
.result-card__play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(255, 255, 255, 0.5);
}

/* Ẩn play button to ở giữa */
.result-card.is-active .result-card__play {
  opacity: 0;
  pointer-events: none;
}

/* --- Controls (volume + pause/play nhỏ) — chỉ hiện khi đang play --- */
.result-card__controls {
  position: absolute;
  bottom: 36px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.result-card.is-active .result-card__controls {
  opacity: 1;
  pointer-events: auto;
}

.rc-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  color: var(--cream);
  transition: background 0.2s ease;
}
.rc-btn:hover {
  background: rgba(0, 0, 0, 0.55);
}

/* --- Progress bar (bấm vào để tua) --- */
.result-card__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.25);
  opacity: 0;
  cursor: pointer;
  transition:
    opacity 0.3s ease,
    height 0.15s ease;
}
.result-card.is-active .result-card__progress {
  opacity: 1;
}
.result-card__progress:hover {
  height: 7px;
}

.result-card__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--cream);
  transition: width 0.2s linear;
  pointer-events: none;
}

/* --- Info text below card --- */
.result-card__info {
  padding: 0 4px;
}
.result-card__name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--green-deep);
  margin-bottom: 4px;
}
.result-card__desc {
  font-family: var(--font-body);
  font-size: clamp(13px, 1.6vw, 15px);
  color: var(--ink-soft);
  line-height: 1.4;
}

/* --- Desktop: 4 cột grid, không scroll --- */
@media (min-width: 1024px) {
  .results-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    overflow-x: visible;
    max-width: var(--grid-max-width);
    margin: 0 auto;
  }

  .result-card {
    flex: none;
    max-width: none;
  }

  .result-card__play {
    width: 48px;
    height: 48px;
  }
}

/* --- Tablet: 2.5 cards visible --- */
@media (min-width: 640px) and (max-width: 1023px) {
  .result-card {
    flex: 0 0 42%;
    max-width: 42%;
  }
}
