/* ===== Featured Insights carousel (homepage only) ===== */

.insights-carousel {
  --carousel-gap: 1.5rem;
  --carousel-cards: 3;
  position: relative;
}

/* Horizontal, snap-scrolling track — scrollable/swipeable without JS */
.carousel-track {
  display: flex;
  gap: var(--carousel-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0 1.25rem;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* Individual slide */
.insight-card {
  flex: 0 0 calc((100% - (var(--carousel-cards) - 1) * var(--carousel-gap)) / var(--carousel-cards));
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--text-white, #fff);
  border-radius: 8px;
  border: 1px solid #ececec;
  border-top: 4px solid var(--primary-dark-blue, #002B54);
  box-shadow: 0 2px 10px rgba(0, 43, 84, 0.06);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.insight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 43, 84, 0.1);
}

/* Media area (fixed aspect ratio) */
.insight-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--primary-light-sand, #F5F2ED);
  overflow: hidden;
}

.insight-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Branded sand/teal panel for items with no screenshot */
.insight-media--branded {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5EFE7 0%, #E6DED1 100%);
}

.insight-media--branded::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../images/asiamap.png') center / 78% auto no-repeat;
  opacity: 0.12;
  pointer-events: none;
}

/* Yuan watermark behind the RMB label */
.insight-media--branded::after {
  content: '\00a5';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 8rem;
  line-height: 1;
  color: var(--primary-dark-blue, #002B54);
  opacity: 0.1;
  pointer-events: none;
}

.insight-media-badge {
  position: relative;
  z-index: 1;
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 2rem;
  letter-spacing: 0.06em;
  color: var(--primary-dark-blue, #002B54);
  border-bottom: 3px solid var(--primary-dark-blue, #002B54);
  padding-bottom: 0.35rem;
}

/* Card body */
.insight-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1.5rem;
}

.insight-tag {
  display: inline-block;
  font-family: 'Public Sans', 'Open Sans', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-dark-blue, #002B54);
  margin-bottom: 0.6rem;
}

.insight-title {
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--primary-dark-blue, #002B54);
  margin: 0 0 0.65rem 0;
}

.insight-desc {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-medium, #666);
  margin: 0 0 1.1rem 0;
}

.insight-link {
  margin-top: auto;
  align-self: flex-start;
  font-family: 'Public Sans', 'Open Sans', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary-dark-blue, #002B54);
  border-bottom: 2px solid var(--primary-dark-blue, #002B54);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.insight-link::after {
  content: ' \2192';
}

.insight-link:hover,
.insight-link:focus {
  color: #174B7C;
  border-color: #174B7C;
}

/* Prev / next arrows overlaid on the track */
.carousel-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.carousel-arrow {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background: rgba(255, 255, 255, 0.94);
  color: var(--primary-dark-blue, #002B54);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 43, 84, 0.12);
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.carousel-arrow:first-child {
  margin-left: -18px;
}

.carousel-arrow:last-child {
  margin-right: -18px;
}

.carousel-arrow:hover,
.carousel-arrow:focus {
  background: var(--primary-dark-blue, #002B54);
  color: var(--text-white, #fff);
}

.carousel-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Dot indicators */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: #cfd6dd;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dot:hover,
.carousel-dot:focus {
  background: var(--primary-light-blue, #4A7BA7);
}

.carousel-dot[aria-current="true"] {
  background: var(--primary-dark-blue, #002B54);
  transform: scale(1.25);
}

/* Tablet: 2 cards */
@media (max-width: 992px) {
  .insights-carousel {
    --carousel-cards: 2;
  }
}

/* Mobile: 1 card, no overlay arrows (swipe + dots) */
@media (max-width: 600px) {
  .insights-carousel {
    --carousel-cards: 1;
    --carousel-gap: 1rem;
  }

  .carousel-nav {
    display: none;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    scroll-behavior: auto;
  }

  .insight-card,
  .insight-link,
  .carousel-arrow,
  .carousel-dot {
    transition: none;
  }
}

/* ===== Hero carousel variant: single-card spotlight over the hero backdrop ===== */
.hero-carousel {
  --carousel-cards: 1;
  width: 100%;
}

/* Frosted glass so the cityscape backdrop reads through the card */
.hero-carousel .insight-card {
  flex-direction: row;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-top: 4px solid var(--primary-dark-blue, #002B54);
  box-shadow: 0 14px 40px rgba(0, 43, 84, 0.18);
}

/* Framed landscape screenshot — avoids cropping a wide image into a portrait sliver */
.hero-carousel .insight-media {
  flex: 0 0 54%;
  aspect-ratio: 16 / 10;
  align-self: center;
  min-height: 0;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 43, 84, 0.12);
}

/* Very wide images (e.g. the briefing collage) fit fully instead of being cropped */
.hero-carousel .insight-media--wide {
  background: #ffffff;
}

.hero-carousel .insight-media--wide img {
  object-fit: contain;
}

.hero-carousel .insight-body {
  padding: 0;
}

/* Keep dots legible over the cityscape */
.hero-carousel .carousel-dot {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 3px rgba(0, 43, 84, 0.2);
}

.hero-carousel .carousel-dot[aria-current="true"] {
  background: var(--primary-dark-blue, #002B54);
}

@media (max-width: 600px) {
  /* Mobile mode: banner cards — short full-bleed media strip on top,
     compact clamped text below. Avoids letterboxed contain-fit images
     that render as tiny thumbnails on a beige background. */
  .hero-carousel .insight-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
    padding: 0.9rem;
  }

  .hero-carousel .insight-media {
    flex: 0 0 auto;
    aspect-ratio: auto;
    height: 148px;
    align-self: stretch;
    min-height: 0;
    border-radius: 6px;
    overflow: hidden;
  }

  .hero-carousel .insight-media img {
    object-fit: cover;
    object-position: center;
  }

  .hero-carousel .insight-body {
    padding: 0;
  }

  .hero-carousel .insight-title {
    font-size: 1.05rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .hero-carousel .insight-desc {
    font-size: 0.88rem;
    margin: 0 0 0.9rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Tool screenshot keeps its native aspect so the chart and side panels are never cropped */
.hero-carousel .insight-media--shot {
  aspect-ratio: 2036 / 1174;
}

.hero-carousel .insight-media--photo {
  aspect-ratio: 3 / 2;
}

/* Mobile: the branded panel (RMB dashboard) has no screenshot —
   it gets a shorter banner and scaled-down watermark/badge so the
   strip stays compact like the photo slides. */
@media (max-width: 600px) {
  .hero-carousel .insight-media--branded {
    aspect-ratio: auto;
    height: 108px;
    min-height: 0;
  }

  .hero-carousel .insight-media--branded::after {
    font-size: 4.5rem;
  }

  .hero-carousel .insight-media-badge {
    font-size: 1.5rem;
    padding-bottom: 0.3rem;
    border-bottom-width: 2px;
  }
}
