/* HOME_DISCOVERY_V2 — home carousels, media card and section rhythm (Julien, 2026-10-08).
   Renderer: components/blocks/editorial-discovery/media-carousel.php. */

/* Every home carousel shows whole cards: 4 on a desktop, 3 on a tablet, one and a peek on a phone; the last card
   ends flush with the container (snap on whole cards, step = one card). */
.wi2-section .wi2-topic-carousel {
  --wi2-rail-gap: 16px;
  gap: var(--wi2-rail-gap);
  grid-auto-columns: calc((100% - 3 * var(--wi2-rail-gap)) / 4);
  padding: 4px 0 16px;
  scroll-padding-inline: 0;
}
@media (max-width: 1099px) {
  .wi2-section .wi2-topic-carousel { grid-auto-columns: calc((100% - 2 * var(--wi2-rail-gap)) / 3); }
}
@media (max-width: 700px) {
  /* CAROUSEL_CENTER_V1: edge to edge, the current card centred between the end of the previous and the next one. */
  .wi2-section .wi2-topic-carousel { grid-auto-columns: 80vw; width: 100vw; max-width: 100vw; margin-inline: calc(50% - 50vw); padding-inline: 10vw; scroll-padding-inline: 10vw; box-sizing: border-box; }
  .wi2-section .wi2-topic-carousel > * { scroll-snap-align: center; }
}
.wi2-section .wi2-topic-carousel > * { min-width: 0; }
@media (min-width: 701px) { .wi2-section .wi2-topic-carousel > * { scroll-snap-align: start; } }

/* Media card: page image, type badge on the image (bottom left), title on 3 lines, short text. */
.wi2-topic-card.wi2-topic-card--media {
  box-shadow: 0 2px 8px rgba(22, 21, 35, .08); /* small enough to stay inside the scrolling rail */
  border-color: color-mix(in srgb, var(--color-text, #20212a) 10%, transparent);
  min-height: 0;
  grid-template-rows: auto auto 1fr;
  padding-bottom: 22px;
}
.wi2-topic-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-accent, #35d6c2) 10%, var(--color-bg, #fff));
}
.wi2-topic-card--media .wi2-topic-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  transition: transform .35s ease;
}
.wi2-topic-card__badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 11px;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background: var(--color-dark-bg, #161523);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  font: 700 12px/1 var(--font-body, system-ui);
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wi2-topic-card.wi2-topic-card--media strong {
  margin-top: 16px;
  font-size: 19px;
  line-height: 1.25;
  -webkit-line-clamp: 3;
}
.wi2-topic-card.wi2-topic-card--media p {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.55;
  -webkit-line-clamp: 3;
}
@media (hover: hover) and (pointer: fine) {
  .wi2-topic-card--media:hover .wi2-topic-card__media img { transform: scale(1.03); }
}


/* Section rhythm (HOME_DISCOVERY_V3), from the hero down: À la une, dark (comparisons), method, dark (guides, the
   categories style), soft (further reading), then tools, resources and the newsletter on the same light grey. */
.page-home .wi2-section--tone-light,
.page-home .wi2-section--intro { background: var(--color-bg, #fff); }
.page-home .wi2-section--tone-soft,
.page-home .wi2-section--posts-secondary { background: color-mix(in srgb, var(--color-accent, #35d6c2) 6%, var(--color-bg, #fff)); }
.page-home .wi2-section--tone-soft .cms-editorial-discovery__controls--light button,
.page-home .wi2-section--tone-light .cms-editorial-discovery__controls--light button {
  border-color: var(--color-border, rgba(22, 21, 35, .15));
  color: var(--color-dark-bg, #161523);
  background: var(--color-bg, #fff);
}

/* Comparisons: the reviews carousel sits under the comparison cards, on the dark section. */
.page-home .cms-section--discovery .cms-editorial-discovery__reviews .wi2-media-carousel { margin-top: 18px; }

/* Fewer than 4 cards: the row is centred (same card width). */
@media (min-width: 701px) {
  .wi2-section .wi2-topic-carousel.wi2-media-carousel--few { justify-content: center; }
}



/* Tools, resources and the newsletter share the same light grey. */
.page-home .wi2-section--newsletter { background: var(--color-bg, #fff); }

/* Topic card, named variant « long-title »: the same card as the blog categories for titles that are sentences
   (guides): 3 lines at 22 px instead of 2 at 28 px. */
.wi2-topic-card.wi2-topic-card--long-title { min-height: 0; padding-bottom: 22px; }
.wi2-topic-card.wi2-topic-card--long-title strong { font-size: 22px; line-height: 1.18; -webkit-line-clamp: 3; }
.wi2-topic-card.wi2-topic-card--long-title p { margin-top: 10px; -webkit-line-clamp: 3; }

/* Comparisons and reviews: no rule between the comparison cards and the reviews (Julien 2026-10-08). */
.cms-section--discovery .cms-editorial-discovery__reviews { margin-top: clamp(20px, 3vw, 36px); padding-top: 0; border-top: 0; }
