/* ==========================================================================
   Hero unique : photo aléatoire (ou fond bleu marine) + dégradé sombre,
   texte à gauche, logo PAPCO animé à droite. Accueil : carrousel de messages.
   ========================================================================== */

/* --papco-hero-height = partie visible sous le header. Le hero remonte sous le header fixe.
   Plancher : 18 rem ; en dessous, la page défile. */
.papco-hero {
  --papco-hero-height: clamp(18rem, 23.6vw, 36rem);
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  height: calc(var(--papco-hero-height) + var(--papco-header-height, 4.75rem));
  margin-top: calc(var(--papco-header-height, 4.75rem) * -1);
  overflow: hidden;
  background: var(--papco-navy, #0f1d3a);
  color: var(--papco-white, #fff);
}

/* Accueil, grand écran : le hero s'adapte pour que tout tienne dans la première fenêtre
   (chiffres, expertises, certifications, footer). --papco-below-hero = hauteur de tout ce qui
   est sous le hero ; la valeur ci-dessous est une estimation, affinée par assets/js/footer-scroll.js.
   Plafond : 23,6 vw (proportions du mockup). Plancher : 18 rem. */
@media (min-width: 64rem) and (min-height: 40rem) {
  .papco-home .papco-hero--home {
    --papco-hero-height: clamp(18rem, calc(100vh - var(--papco-below-hero, 35rem) - var(--papco-header-height, 4.75rem)), 23.6vw);
  }
}

/* --- Accueil : logo animé seul. Les photos défilent rapidement pendant les 4/5 de
   l'animation du logo (2,8 s), puis le fond blanc reste. --papco-intro-step = durée
   d'une photo (calculée dans template-parts/hero.php), --i = rang de la photo.
   Avec JavaScript (classe papco-js), le départ attend que les photos soient chargées
   (assets/js/hero-intro.js, classe is-playing), en même temps que le logo. --- */
.papco-hero--intro {
  background: var(--papco-white, #fff);
}

.papco-hero-flash {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.papco-hero-flash .papco-hero-img {
  animation: papco-intro-hide 0.12s linear forwards;
  animation-delay: calc(var(--papco-intro-step, 0.56s) * (var(--i, 0) + 1) - 0.12s);
}

.papco-js .papco-hero--intro .papco-hero-flash .papco-hero-img {
  animation-play-state: paused;
}

.papco-hero--intro.is-playing .papco-hero-flash .papco-hero-img {
  animation-play-state: running;
}

@keyframes papco-intro-hide {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.papco-hero--intro .papco-hero-inner {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.papco-hero--intro .papco-hero-logo-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Logo centré, aussi grand que la hauteur le permet (ratio 1000 × 290). */
.papco-hero--intro .papco-hero-logo {
  width: min(100%, 62.5rem, 260cqh);
}

/* --- Fond --- */
.papco-hero-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--papco-hero-pos-y, 62%);
}

/* Dégradé noir de gauche à droite : texte blanc lisible même sur une photo claire. */
.papco-hero--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg,
    rgb(0 0 0 / 0.75) 0%,
    rgb(0 0 0 / 0.45) 40%,
    rgb(0 0 0 / 0) 75%);
}

/* --- Conteneur : 87,5 rem comme le reste du site, deux colonnes --- */
.papco-hero-inner {
  position: absolute;
  top: var(--papco-header-height, 4.75rem);
  right: 0;
  bottom: 0;
  left: 0;
  container-type: size;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40%;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  max-width: 87.5rem;
  margin: 0 auto;
  padding: 0 var(--papco-page-padding, 2rem);
}

.papco-hero-text {
  min-width: 0;
}

/* --- Textes : tailles liées à la hauteur visible du hero (cqh) --- */
.papco-hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 clamp(0.5rem, 3.5cqh, 1.25rem);
  color: rgb(255 255 255 / 0.9);
  font-size: clamp(0.6875rem, 3.8cqh, 0.875rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.papco-hero-kicker::before {
  content: "";
  flex: none;
  width: 2.5rem;
  height: 0.125rem;
  background: var(--papco-red, #b41412);
}

.papco-hero-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--papco-white, #fff);
  font-size: clamp(1.5rem, min(11cqh, 5.4cqw), 4.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.papco-hero-lead {
  display: -webkit-box;
  max-width: 36rem;
  margin: clamp(0.5rem, 3.5cqh, 1.25rem) 0 0;
  overflow: hidden;
  color: rgb(255 255 255 / 0.88);
  font-size: clamp(0.875rem, 4.6cqh, 1.25rem);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* Bouton : balayage d'un rouge plus foncé (classes papco-wipe, style.css).
   Les marges intérieures sont portées par les deux couches de texte. */
.papco-hero-btn {
  margin-top: clamp(0.75rem, 5cqh, 2rem);
  border-radius: 0.125rem;
  background: var(--papco-red, #b41412);
  color: var(--papco-white, #fff);
  font-size: clamp(0.75rem, 3.6cqh, 0.875rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.papco-hero-btn .papco-wipe__base,
.papco-hero-btn .papco-wipe__over {
  padding: clamp(0.625rem, 3.4cqh, 1rem) clamp(1.25rem, 3cqw, 1.75rem);
}

.papco-hero-btn .papco-wipe__over {
  background: #8f0f0e;
}

.papco-hero-btn:focus-visible,
.papco-hero-pause:focus-visible,
.papco-hero-dot:focus-visible {
  outline: 0.125rem solid var(--papco-white, #fff);
  outline-offset: 0.1875rem;
}

.papco-hero-btn-arrow {
  flex: none;
}

/* --- Carrousel : fondu enchaîné sur le texte seulement --- */
.papco-hero-slides {
  display: grid;
}

.papco-hero-slide {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

.papco-hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease, visibility 0s linear 0s;
}

.papco-hero-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: clamp(0.75rem, 5cqh, 1.75rem);
}

.papco-hero-pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 50%;
  background: transparent;
  color: var(--papco-white, #fff);
  cursor: pointer;
}

.papco-hero-pause:hover {
  border-color: var(--papco-white, #fff);
}

.papco-hero-pause .papco-icon-play,
.papco-hero-pause[aria-pressed="true"] .papco-icon-pause {
  display: none;
}

.papco-hero-pause[aria-pressed="true"] .papco-icon-play {
  display: block;
}

.papco-hero-dots {
  display: flex;
  gap: 0.25rem;
}

/* Zone cliquable de 1,5 rem, point visible de 0,625 rem. */
.papco-hero-dot {
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.papco-hero-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 0.625rem;
  height: 0.625rem;
  margin: auto;
  border: 1px solid rgb(255 255 255 / 0.8);
  border-radius: 50%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.papco-hero-dot:hover::before {
  background: rgb(255 255 255 / 0.6);
}

.papco-hero-dot[aria-current="true"]::before {
  border-color: var(--papco-red, #b41412);
  background: var(--papco-red, #b41412);
}

/* --- Logo animé, colonne droite --- */
.papco-hero-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
}

/* Ratio du logo : 1000 × 290. Largeur limitée pour que le logo ne dépasse pas 72 % de la hauteur. */
.papco-hero-logo {
  display: block;
  width: min(100%, 248cqh);
  height: auto;
}

/* --- Tablette : logo plus petit --- */
@media (max-width: 64rem) {
  .papco-hero-inner {
    grid-template-columns: minmax(0, 1fr) 28%;
  }
}

/* --- Mobile (moins de 48 rem) : une colonne, logo masqué --- */
@media (max-width: 47.99rem) {
  .papco-hero {
    --papco-hero-height: 20rem;
  }

  .papco-hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .papco-hero-logo-wrap {
    display: none;
  }

  .papco-hero-title {
    font-size: clamp(1.5rem, min(10cqh, 8cqw), 2.5rem);
  }
}
