/*
 * Rayflections Masterclass — vague 7, alignement Formules + Logbook.
 * DRAFT LOCAL UNIQUEMENT · non charge tant que le script Wave 7 n'est pas applique.
 *
 * Principes :
 * - les huit zones des trois cartes Formules partagent leurs lignes sur desktop ;
 * - le bloc Resultat devient un repere visuel explicite ;
 * - sur mobile/tablette, aucune hauteur de contenu n'est imposee ;
 * - le cadre Logbook externe reste large, ses contenus retrouvent une largeur compacte.
 */

/* ---------- Formules : resultat visible sur tous les formats ---------- */
html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small {
  display: flex !important;
  align-items: center !important;
  align-self: stretch !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: clamp(0.9rem, 1.15vw, 1.08rem) !important;
  border: 1px solid rgba(199, 164, 88, 0.5) !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, rgba(199, 164, 88, 0.13), rgba(7, 27, 51, 0.06)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.18) !important;
  font-size: clamp(0.9rem, 0.32vw + 0.82rem, 0.98rem) !important;
  font-weight: 600 !important;
  line-height: 1.48 !important;
  text-align: left !important;
}

html body.production-v2.theme-day.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small,
html[data-theme="day"] body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small {
  border-color: rgba(126, 92, 31, 0.34) !important;
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.78), rgba(225, 202, 145, 0.2)) !important;
  color: #172437 !important;
  -webkit-text-fill-color: #172437 !important;
}

html body.production-v2.theme-night.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small,
html[data-theme="night"] body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small {
  border-color: rgba(240, 212, 138, 0.42) !important;
  background: linear-gradient(135deg, rgba(240, 212, 138, 0.12), rgba(7, 27, 51, 0.48)) !important;
  color: #fffaf0 !important;
  -webkit-text-fill-color: #fffaf0 !important;
}

/* Desktop : les huit zones media / titre / statut / prix / description /
   inclusions / resultat / CTA sont synchronisees entre les trois cartes. */
@media (min-width: 1025px) {
  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-formats__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: auto !important;
    grid-auto-flow: row !important;
    column-gap: clamp(1.1rem, 2vw, 1.8rem) !important;
    row-gap: 0 !important;
    align-items: stretch !important;
  }

  @supports (grid-template-rows: subgrid) {
    html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-formats__grid {
      grid-template-rows: repeat(8, auto) !important;
      row-gap: clamp(0.58rem, 0.9vw, 0.82rem) !important;
    }

    html body.production-v2.masterclass-v2 #formats.masterclass-formats .masterclass-formats__grid > .masterclass-format-card,
    html[data-theme] body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-relationnel-v2 #formats-relationnel.masterclass-formats .masterclass-formats__grid > .masterclass-format-card {
      grid-row: 1 / span 8 !important;
      display: grid !important;
      grid-template-rows: subgrid !important;
      align-items: stretch !important;
      align-content: stretch !important;
      row-gap: clamp(0.58rem, 0.9vw, 0.82rem) !important;
    }
  }

  @supports not (grid-template-rows: subgrid) {
    html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card {
      display: grid !important;
      grid-template-rows:
        auto
        minmax(4.7rem, auto)
        minmax(4.4rem, auto)
        minmax(4.4rem, auto)
        minmax(8rem, auto)
        minmax(15rem, 1fr)
        minmax(7.4rem, auto)
        auto !important;
      align-items: stretch !important;
      align-content: stretch !important;
    }
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > :is(h3, .masterclass-format-card__status, .masterclass-format-card__price, p, ul, small, .masterclass-format-card__cta) {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > .masterclass-format-card__list[data-formula-inclusions] {
    align-self: stretch !important;
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > .masterclass-format-card__list[data-formula-inclusions] > li:first-child {
    font-weight: 700 !important;
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > .masterclass-format-card__cta {
    align-self: end !important;
  }
}

/* Mobile/tablette : retour au flux naturel, sans min-height de synchronisation. */
@media (max-width: 1024px) {
  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card {
    grid-row: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > :is(h3, .masterclass-format-card__status, .masterclass-format-card__price, p, ul, small) {
    height: auto !important;
    min-height: 0 !important;
  }

  html body.production-v2.masterclass-v2 :is(#formats, #formats-relationnel) .masterclass-format-card > small {
    min-height: 0 !important;
    height: auto !important;
    padding: 0.88rem !important;
  }
}

/* ---------- Logbook : cadre large, contenu compact ---------- */
html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels > .container {
  width: 100% !important;
  max-width: 1280px !important;
  padding-inline: clamp(1rem, 2vw, 1.5rem) !important;
}

/* Le script ajoute le meme shell aux pages Relationnel et Professionnel :
   le cadre externe est ainsi strictement homogene sur les trois pages. */
html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell {
  width: 100% !important;
  max-width: 1232px !important;
  margin-inline: auto !important;
  padding: clamp(1.2rem, 2.35vw, 2rem) !important;
  border-radius: 28px !important;
  backdrop-filter: blur(10px) saturate(1.04) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.04) !important;
}

html body.production-v2.theme-day.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell,
html[data-theme="day"] body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell {
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.32), rgba(255, 250, 240, 0.14)) !important;
  border: 1px solid rgba(255, 250, 240, 0.68) !important;
  box-shadow: inset 0 0 0 1px rgba(240, 212, 138, 0.08), 0 24px 64px rgba(7, 24, 42, 0.09) !important;
}

html body.production-v2.theme-night.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell,
html[data-theme="night"] body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell {
  background: linear-gradient(135deg, rgba(7, 16, 29, 0.46), rgba(7, 16, 29, 0.28)) !important;
  border: 1px solid rgba(240, 212, 138, 0.32) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 240, 0.05), 0 24px 64px rgba(0, 0, 0, 0.2) !important;
}

/* Le layout est volontairement plus etroit que le shell pour laisser voir
   ses contours lateraux. Les anciens fonds lourds Relationnel sont neutralises. */
html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__layout {
  width: 100% !important;
  max-width: 1040px !important;
  margin-inline: auto !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

@media (min-width: 981px) {
  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__layout {
    grid-template-columns: minmax(0, 520px) minmax(320px, 410px) !important;
    grid-template-areas:
      "intro intro"
      "copy video"
      "offer offer"
      "cta cta" !important;
    justify-content: center !important;
    align-items: start !important;
    gap: clamp(1rem, 1.7vw, 1.45rem) !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__intro {
    width: min(100%, 900px) !important;
    justify-self: center !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__copy {
    width: 100% !important;
    max-width: 520px !important;
    justify-self: end !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video-stack {
    width: min(100%, 410px) !important;
    max-width: 410px !important;
    justify-self: start !important;
    align-self: start !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video-stack .relationnel-logbook__video {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video video.relationnel-logbook__media {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__layout > .relationnel-logbook__offer {
    width: min(100%, 880px) !important;
  }

  /* Professionnel : annule le verrou V2 a 460 px, source de cadres surdimensionnes. */
  html body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-professionnel-silver-metal-v2 #livrables-relationnels .relationnel-logbook__video-stack {
    width: min(100%, 390px) !important;
    max-width: 390px !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-professionnel-silver-metal-v2 #livrables-relationnels .relationnel-logbook__contents {
    padding: clamp(1rem, 1.35vw, 1.3rem) !important;
  }

  /* Les anciennes feuilles V2 imposaient encore des cadres vidéo carrés et
     des hauteurs minimales de 340 à 460 px. Ce ciblage volontairement précis
     rétablit un média 16:9 compact tout en conservant sa légende. */
  html[data-theme] body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-relationnel-v2 #livrables-relationnels .relationnel-logbook__layout > div.relationnel-logbook__video-stack {
    width: min(100%, 410px) !important;
    max-width: 410px !important;
    justify-self: start !important;
    align-self: start !important;
  }

  html[data-theme] body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-relationnel-v2 #livrables-relationnels .relationnel-logbook__layout > .relationnel-logbook__video-stack .relationnel-logbook__video {
    display: grid !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    align-self: start !important;
  }

  html[data-theme] body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-relationnel-v2 #livrables-relationnels .relationnel-logbook__layout > .relationnel-logbook__video-stack .relationnel-logbook__video > video.relationnel-logbook__media {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }

  html[data-theme] body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-relationnel-v2.masterclass-professionnel-silver-metal-v2 #livrables-relationnels .relationnel-logbook__layout > div.relationnel-logbook__video-stack {
    width: min(100%, 390px) !important;
    max-width: 390px !important;
  }
}

@media (max-width: 980px) {
  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels > .container {
    max-width: 100% !important;
    padding-inline: clamp(0.9rem, 3.4vw, 1.25rem) !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__shell {
    max-width: 100% !important;
    padding: clamp(0.85rem, 3.4vw, 1.15rem) !important;
    border-radius: 22px !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__layout {
    max-width: 100% !important;
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "intro"
      "video"
      "copy"
      "offer"
      "cta" !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video-stack,
  html body.production-v2.masterclass-v2.masterclass-detail-v2.masterclass-professionnel-silver-metal-v2 #livrables-relationnels .relationnel-logbook__video-stack {
    width: min(100%, 420px) !important;
    max-width: 420px !important;
    justify-self: center !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video-stack .relationnel-logbook__video,
  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video video.relationnel-logbook__media {
    height: auto !important;
    min-height: 0 !important;
  }

  html body.production-v2.masterclass-v2.masterclass-detail-v2 #livrables-relationnels .relationnel-logbook__video video.relationnel-logbook__media {
    aspect-ratio: 16 / 9 !important;
  }
}
