.hero{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:18px;
  padding: 0; /* on enlève l’ancien padding */
}


:root{
  --bg:#0b1220;
  --card:#0f172a;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --primary:#6366f1;
  --border:rgba(255,255,255,.08);
  --shadow:0 18px 40px rgba(0,0,0,.35);
}

body[data-theme="light"]{
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --border:rgba(15,23,42,.10);
  --shadow:0 18px 40px rgba(15,23,42,.10);
}

*{box-sizing:border-box;}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* HERO */

/* ==========================
   HOME = MÊME LAYOUT QUE READER
   ========================== */

/* le container global doit être comme .reader */
.hero{
  min-height: 100vh;
  max-width: 860px;     /* ✅ identique au reader */
  margin: 0 auto;       /* ✅ centré */
  padding: 16px;        /* ✅ identique au reader */
  display: flex;
  flex-direction: column;
  gap: 14px;            /* ✅ comme margin-bottom des cards */
  align-items: stretch; /* ✅ les cartes prennent toute la largeur */
  justify-content: flex-start;
}

/* même style que .chapter / .toc / .comments */
.hero-card,
.newsletter{
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;   /* ✅ identique */
  padding: 16px;         /* ✅ identique */
  box-shadow: var(--shadow);
  margin: 0;             /* important pour éviter différences */
  max-width:860px;
}

/* cover comme avant mais cohérent */
.cover{
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  max-height:340px;
  object-fit:cover;
  aspect-ratio:16/9;
}

@media (min-width:992px){
  .cover{
    max-height: 420px;
  }
}

/* actions comme avant */
.hero-actions{
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* sur mobile, les boutons passent en colonne */
@media (max-width: 520px){
  .hero-actions{
    flex-direction: column;
  }
}



/* section partage */
.share{
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}


.share{
  margin-top:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.share-btn{
  text-decoration:none;
  background: rgba(99,102,241,.16);
  border:1px solid rgba(99,102,241,.35);
  padding:10px 14px;
  border-radius:14px;
  color:var(--text);
  font-weight:800;
}

/* TOPBAR */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  background: rgba(15,23,42,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

body[data-theme="light"] .topbar{
  background: rgba(255,255,255,.75);
}

.brand{display:flex;align-items:center;gap:10px;}
.logo{font-size:18px;}
.brand-title{font-weight:800;}

.topbar-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}

.icon-btn{
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
}

.lang-switch{display:flex;gap:6px;}

.lang-btn{
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 700;
  text-decoration:none;
}

.lang-btn.active{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* READER */
.reader{
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

.chapter, .comments, .toc{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.chapter-meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}

.pill{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
}

.chapter-title{
  font-size: calc(22px * var(--font-scale));
  margin: 6px 0 12px;
}

.chapter-content{
  line-height: 1.85;
  font-size: calc(16px * var(--font-scale));
}

.nav{
  display:flex;
  gap: 10px;
  margin-top: 14px;
}

.btn, .btn-outline{
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  border: 1px solid var(--border);
}

.btn{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-outline{
  background: transparent;
  color: var(--text);
}

.section-title{margin:0 0 12px;}

.input, .textarea{
  width:100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  outline: none;
}

.textarea{min-height: 110px; resize: vertical;}

.hint{
  margin:0;
  color:var(--muted);
  font-size:12px;
}

/* TOC */
.toc-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.toc-body{display:none; margin-top:12px;}
.toc-body.open{display:block;}

.searchbar{
  display:flex;
  align-items:center;
  gap:10px;
}

.searchwrap{
  position: relative;
  width: 100%;
  flex: 1;
}

.searchwrap .input{
  width: 100%;
  padding-right: 40px; /* place pour le bouton ✕ */
}

/* bouton ✕ */
.clear-btn{ 
  position: absolute;
  right: 10px; /* ajuste selon la largeur du bouton Rechercher */
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #ff3b3b;   /* rouge normal */
  opacity: .9;
  display: none;    /* affiché seulement si texte saisi (via JS) */
}

.clear-btn:hover{
  opacity: 1;
  color: #ff1f1f;   /* rouge plus fort */
}



.toc-list{display:flex; flex-direction:column; gap:10px;}

.toc-item{
  display:flex;
  gap:12px;
  align-items:center;
  text-align:left;
  width:100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.toc-num{
  width:34px;
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 12px;
  background: rgba(99,102,241,.16);
  border: 1px solid rgba(99,102,241,.35);
  font-weight: 900;
}

.toc-title{font-weight: 800;}

.newsletter-form{
  display:flex;
  gap:10px;
  margin-top:10px;
}
.newsletter-form .input{flex:1;}


@media (min-width: 768px){
  .reader{padding: 24px;}

  /* ✅ garder le scaling même sur desktop */
  .chapter-title{
    font-size: calc(28px * var(--font-scale));
  }

  .chapter-content{
    font-size: calc(17px * var(--font-scale));
  }
}



:root{ --font-scale: 1; }

mark.hl{
  background: rgba(255, 230, 0, 0.35);
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 230, 0, 0.35);
}

.lang-switch{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:36px;
  height:36px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: inherit;
  font-weight: 900;
  cursor:pointer;
}

.icon-btn:active{
  transform: scale(0.97);
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

mark.hl{
  background: #ffe600;
  color: #000;
  padding: 1px 4px;
  border-radius: 6px;
}

.findbar{
  position: sticky;
  bottom: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  margin-top: 14px;
  z-index: 20;
}

.find-count{
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
}

mark.hl{
  background: rgba(255, 230, 0, 0.55);
  color: #000;
  padding: 1px 4px;
  border-radius: 6px;
}

mark.hl.active{
  outline: 2px solid rgba(255,255,255,0.8);
  background: rgba(255, 160, 0, 0.85);
}

.progress-crumb{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.pc-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.9;
  margin-bottom: 8px;
}

.pc-step{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}

.pc-step.active{
  transform: scale(1.02);
  opacity: 1;
}

.pc-bar{
  width:100%;
  height:10px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,0.12);
}

.pc-fill{
  height:100%;
  width:0%;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  transition: width 250ms ease;
}

.toc-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.toc-collapse-btn{
  padding: 6px 10px;
  font-weight: 900;
}

/* Animation slide TOC */
.toc-body{
  overflow: hidden;
  max-height: 900px; /* valeur assez grande */
  opacity: 1;
  transform: translateY(0);
  transition: max-height 280ms ease, opacity 220ms ease, transform 220ms ease;
}



.toc-body.collapsed{
  max-height: 0px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.searchwrap{
  position: relative;
  width: 100%;
}

.searchwrap .input{
  padding-right: 40px;
}

#searchResults{
  color: #ff3b3b;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 9999;
}

.topbar-actions,
.lang-switch{
  position: relative;
  z-index: 10000;
}

.icon-btn,
.lang-btn{
  position: relative;
  z-index: 10001;
  pointer-events: auto;
}

/* ============================
   BADGE "REPRENDRE LA LECTURE"
   ============================ */

#resumeBadge{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 14px;
  border-radius: 16px;

  cursor: pointer;
  user-select: none;

  /* glass + premium */
  background: linear-gradient(
    135deg,
    rgba(99,102,241,.22),
    rgba(99,102,241,.10)
  );

  border: 1px solid rgba(99,102,241,.35);
  box-shadow: 0 12px 28px rgba(0,0,0,.25);

  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* petit effet "lift" au hover */
#resumeBadge:hover{
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0,0,0,.32);
  border-color: rgba(99,102,241,.55);
}

/* effet press */
#resumeBadge:active{
  transform: translateY(0px) scale(0.99);
}

/* Contenu à gauche (num + texte) */
#resumeBadge .toc-title{
  font-weight: 900;
  letter-spacing: .2px;
}

/* le numéro (toc-num) devient plus premium */
#resumeBadge .toc-num{
  width: 38px;
  height: 38px;
  border-radius: 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 900;

  background: rgba(99,102,241,.22);
  border: 1px solid rgba(99,102,241,.55);
}

/* la flèche ↩ à droite */
#resumeBadge span:last-child{
  font-size: 16px;
  font-weight: 900;
  opacity: .95;

  padding: 6px 10px;
  border-radius: 999px;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);

  transition: transform .18s ease, opacity .18s ease;
}

#resumeBadge:hover span:last-child{
  transform: translateX(2px);
  opacity: 1;
}

/* Light mode : rendu propre aussi */
body[data-theme="light"] #resumeBadge{
  background: linear-gradient(
    135deg,
    rgba(99,102,241,.16),
    rgba(99,102,241,.08)
  );

  border: 1px solid rgba(99,102,241,.25);
  box-shadow: 0 14px 30px rgba(15,23,42,.12);
}

body[data-theme="light"] #resumeBadge:hover{
  box-shadow: 0 18px 40px rgba(15,23,42,.16);
}


#resumeBadge{
  margin-top: 20px; /* espace entre la recherche et le badge */
}

.share-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-end;
}

.share-btn{
  display:inline-flex;
  align-items:center;
  gap:10px;

  padding:10px 14px;
  border-radius:16px;

  border:1px solid var(--border);
  background: rgba(99,102,241,.16);

  color: var(--text);
  text-decoration:none;
  font-weight:900;
  font-size:13px;

  cursor:pointer;
  transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
}

.share-btn:hover{
  transform: translateY(-1px);
  opacity:.98;
  border-color: rgba(99,102,241,.45);
}

.share-btn:active{
  transform: translateY(0px) scale(.98);
}

.share-btn .ico{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.share-btn .ico svg{
  width:18px;
  height:18px;
  display:block;
  fill: currentColor;
}

.share-btn .label{
  display:inline-block;
  line-height:1;
}

/* Version mini (si tu veux plus compact sur mobile) */
@media (max-width: 480px){
  .share-btn{
    padding:10px 12px;
    border-radius:14px;
    font-size:12px;
  }
}

/* ===========================
   SHARE GRID PREMIUM
   =========================== */
.share-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.share-item{
  display:flex;
  align-items:center;
  gap:10px;

  padding:10px 12px;
  border-radius:14px;

  border:1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-decoration:none;
  font-weight:900;

  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
}

.share-item:hover{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
  animation: sharePulse .7s ease-in-out infinite;
}

@keyframes sharePulse{
  0%{ transform: scale(1); }
  50%{ transform: scale(1.03); }
  100%{ transform: scale(1); }
}

.share-ico{
  width:18px;
  height:18px;
  display:inline-flex;
}
.share-ico svg{
  width:18px;
  height:18px;
}

/* icônes seules sur mobile */
@media (max-width: 520px){
  .share-txt{ display:none; }
  .share-item{ padding:10px; }
}

/* Copy tooltip premium */
.share-item .copy-tip{
  position:absolute;
  top:-38px;
  left:50%;
  transform: translateX(-50%) translateY(6px);
  opacity:0;

  padding:6px 10px;
  border-radius:999px;

  font-size:12px;
  font-weight:900;

  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.14);
  color:#fff;

  backdrop-filter: blur(10px);

  transition: opacity .18s ease, transform .18s ease;
  pointer-events:none;
  white-space:nowrap;
}

.share-item .copy-tip.show{
  opacity:1;
  transform: translateX(-50%) translateY(0px);
}

