/* =========================================================
   FH9 – Bloc Univers (v1.0.9)
   Fixes:
   - Prevent oversized univers images/cards (desktop + mobile)
   - Ensure titles are integrated on-card (bottom overlay)
   - Keep a noscript-only <img> fallback (no layout regression)
   ========================================================= */

:root{
  --fh9-gold: #f0c23a;
  --fh9-gold-soft: rgba(240,194,58,.18);
  --fh9-line: rgba(255,255,255,.06);
  --fh9-card-line: rgba(218,165,32,.18);
  --fh9-shadow: 0 16px 40px rgba(0,0,0,.35);
  --fh9-radius-xl: 22px;

  --fh9-univers-h: 235px;
  --fh9-univers-h-md: 220px;
  --fh9-univers-h-sm: 175px;
}

section.fh9-univers{
  position: relative;
  padding-top: 10px;
  padding-bottom: 10px;
}

section.fh9-univers::before{
  content: "";
  position: absolute;
  top: -55px;
  left: 0;
  right: 0;
  height: 55px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.72));
  opacity: .9;
  filter: blur(2px);
}

section.fh9-univers .fh9-univers__header{
  max-width: 1200px;
  margin: 0 auto 12px auto;
}

section.fh9-univers .fh9-univers__title{
  margin: 0;
  font-size: 1.55rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fh9-gold);
}

section.fh9-univers .fh9-univers__grid{
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.22));
  border: 1px solid var(--fh9-line);
}

section.fh9-univers.is-count-1 .fh9-univers__grid{
  grid-template-columns: minmax(320px, 620px);
  justify-content: center;
}

/* Hard constraint: card size */
section.fh9-univers .fh9-univers__card{
  position: relative !important;
  display: block !important;
  height: var(--fh9-univers-h) !important;
  min-height: var(--fh9-univers-h) !important;
  border-radius: var(--fh9-radius-xl) !important;
  overflow: hidden !important;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--fh9-card-line);
  box-shadow: var(--fh9-shadow);
}

section.fh9-univers .fh9-univers__card.is-link{
  text-decoration: none !important;
  color: inherit !important;
}

/* Background layers */
section.fh9-univers .fh9-univers__bg{
  position: absolute !important;
  inset: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  transform: scale(1.04);
  filter: saturate(.96) contrast(1.05);
  transition: transform .28s ease, filter .28s ease;
}

section.fh9-univers .fh9-univers__overlay{
  position: absolute !important;
  inset: 0 !important;
  background:
    radial-gradient(900px 240px at 15% 18%, var(--fh9-gold-soft), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.72)),
    linear-gradient(0deg, rgba(0,0,0,.62), transparent 48%);
}

/* Content pinned to bottom for proper title integration */
section.fh9-univers .fh9-univers__content{
  position: absolute !important;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 16px 16px 14px 16px;
}

section.fh9-univers .fh9-univers__name{
  font-size: 1.16rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}

section.fh9-univers .fh9-univers__subtitle{
  margin-top: 6px;
  font-size: .92rem;
  opacity: .92;
  color: rgba(255,255,255,.92);
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}

@media (hover:hover){
  section.fh9-univers .fh9-univers__card.is-link:hover{
    border-color: rgba(240,194,58,.35);
    box-shadow: 0 18px 46px rgba(0,0,0,.42);
  }
  section.fh9-univers .fh9-univers__card.is-link:hover .fh9-univers__bg{
    transform: scale(1.07);
    filter: saturate(1.02) contrast(1.10);
  }
  section.fh9-univers .fh9-univers__card.is-link:hover .fh9-univers__name{
    letter-spacing: .08em;
    transition: letter-spacing .18s ease;
  }
}



@media (min-width: 1200px){
  section.fh9-univers.is-count-5 .fh9-univers__grid{
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: 1440px;
    gap: 14px;
  }

  section.fh9-univers.is-count-5 .fh9-univers__card{
    height: 210px !important;
    min-height: 210px !important;
  }

  section.fh9-univers.is-count-5 .fh9-univers__content{
    padding: 14px 14px 12px 14px;
  }

  section.fh9-univers.is-count-5 .fh9-univers__name{
    font-size: 1rem;
    line-height: 1.12;
  }

  section.fh9-univers.is-count-5 .fh9-univers__subtitle{
    margin-top: 4px;
    font-size: .84rem;
    line-height: 1.2;
  }
}

@media (max-width: 992px){
  section.fh9-univers .fh9-univers__grid{
    gap: 14px;
    padding: 12px;
    border-radius: 20px;
  }
  section.fh9-univers .fh9-univers__card{
    height: var(--fh9-univers-h-md) !important;
    min-height: var(--fh9-univers-h-md) !important;
  }
}

@media (max-width: 576px){
  section.fh9-univers .fh9-univers__title{
    font-size: 1.35rem;
  }

  section.fh9-univers .fh9-univers__grid{
    grid-template-columns: 1fr;
    overflow-x: visible;
    scroll-snap-type: none;
  }

  section.fh9-univers .fh9-univers__card{
    height: var(--fh9-univers-h-sm) !important;
    min-height: var(--fh9-univers-h-sm) !important;
  }

  section.fh9-univers.is-count-4plus .fh9-univers__grid{
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-right: 18px;
    -webkit-overflow-scrolling: touch;
  }

  section.fh9-univers.is-count-4plus .fh9-univers__card{
    scroll-snap-align: start;
  }

  section.fh9-univers.is-count-4plus::after{
    content:"";
    position:absolute;
    right:0;
    top:0;
    bottom:0;
    width: 28px;
    pointer-events:none;
    background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.65));
  }
}
