/* =========================================================
   V7.47 — Text overflow / roman title safe fix
   ---------------------------------------------------------
   Correction ciblée :
   1) libellé au hover des étoiles : retour à la ligne
   2) popup roman : aucun débordement de titre/texte
   3) pages roman : titre descendu et non coupé sous le header
========================================================= */

/* 1) Hover étoile : largeur limitée + retour ligne propre */
.star-book-label{
  min-width:0 !important;
  width:min(360px, calc(100vw - 48px)) !important;
  max-width:min(360px, calc(100vw - 48px)) !important;
  white-space:normal !important;
  overflow:visible !important;
}

.star-book-label strong{
  display:block !important;
  width:100% !important;
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:normal !important;
  hyphens:auto !important;
  text-wrap:balance;
  line-height:.92 !important;
  font-size:clamp(1.35rem, 2.05vw, 2.15rem) !important;
}

/* 2) Popup roman : le texte ne sort jamais du cadre */
.content-panel{
  box-sizing:border-box !important;
  width:min(520px, calc(100vw - 48px)) !important;
  max-width:min(520px, calc(100vw - 48px)) !important;
  max-height:calc(100dvh - 150px) !important;
  overflow:hidden !important;
  overflow-wrap:anywhere !important;
}

.content-panel .panel-title,
.content-panel h2,
.panel-title{
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:normal !important;
  hyphens:auto !important;
  text-wrap:balance;
  line-height:.88 !important;
  font-size:clamp(3.1rem, 5.8vw, 6.4rem) !important;
  letter-spacing:-.06em !important;
}

.content-panel .panel-text,
.panel-text{
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:break-word !important;
}

.content-panel .panel-meta,
.panel-meta{
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:break-word !important;
  line-height:1.6 !important;
}

@media(max-width:720px){
  .content-panel{
    width:calc(100vw - 32px) !important;
    max-width:calc(100vw - 32px) !important;
    max-height:calc(100dvh - 120px) !important;
  }
  .content-panel .panel-title,
  .panel-title{
    font-size:clamp(2.55rem, 15vw, 4.7rem) !important;
  }
}

/* 3) Pages roman : zone titre sécurisée sous le header */
body.is-book-page .roman-master-hero{
  min-height:100dvh !important;
  height:auto !important;
  padding-top:var(--safe-roman-header, 104px) !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
}

body.is-book-page .roman-master-copy{
  top:clamp(132px, 16vh, 190px) !important;
  bottom:auto !important;
  left:clamp(28px, 6.4vw, 112px) !important;
  right:clamp(24px, 8vw, 128px) !important;
  width:auto !important;
  max-width:min(980px, calc(100vw - 180px)) !important;
  transform:none !important;
}

body.is-book-page .roman-master-title{
  max-width:100% !important;
  white-space:normal !important;
  overflow-wrap:normal !important;
  word-break:normal !important;
  hyphens:none !important;
  text-wrap:balance;
  font-size:clamp(3.5rem, 7.2vw, 9.3rem) !important;
  line-height:.86 !important;
  letter-spacing:-.07em !important;
  padding-top:.08em !important;
  padding-bottom:.08em !important;
  overflow:visible !important;
}

body.is-book-page .roman-master-summary{
  max-width:min(660px, 92vw) !important;
}

/* Titres très longs : on réduit un peu pour éviter la coupe */
body[data-active-book="elle-m-appellera-monsieur"] .roman-master-title,
body[data-active-book="vrai-gentil-faux-mechant"] .roman-master-title{
  font-size:clamp(3rem, 6.1vw, 7.6rem) !important;
  line-height:.9 !important;
  letter-spacing:-.055em !important;
}

@media(max-width:1040px){
  body.is-book-page .roman-master-copy{
    top:clamp(112px, 14vh, 150px) !important;
    left:24px !important;
    right:24px !important;
    max-width:none !important;
  }
  body.is-book-page .roman-master-title{
    font-size:clamp(2.9rem, 11.5vw, 6rem) !important;
    line-height:.9 !important;
  }
}

@media(max-width:640px){
  body.is-book-page .roman-master-copy{
    top:110px !important;
    left:18px !important;
    right:18px !important;
  }
  body.is-book-page .roman-master-title,
  body[data-active-book="elle-m-appellera-monsieur"] .roman-master-title,
  body[data-active-book="vrai-gentil-faux-mechant"] .roman-master-title{
    font-size:clamp(2.45rem, 13vw, 4.15rem) !important;
    line-height:.94 !important;
    letter-spacing:-.045em !important;
  }
  body.is-book-page .roman-master-summary{
    font-size:.98rem !important;
    line-height:1.7 !important;
    max-height:32vh !important;
    overflow:hidden !important;
  }
}
