/* Guppy & Merlin — style "cute pop" (léger, respirant) */

:root{
  --bg: #f9efef;
  --lav: #c9c3ff;
  --lav2:#b5b0ff;
  --ink:#3b2a5a;
  --muted:#6c5b86;
  --card:#ffffff;
  --stroke: rgba(136, 106, 185, .35);
  --shadow: 0 12px 28px rgba(40, 20, 60, .12);
  --shadow2: 0 10px 18px rgba(40, 20, 60, .10);
  --radius: 28px;

  --ui-font: "Fredoka", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* UNIQUEMENT les éléments “UI” du bas */
.btn,
.chip,
.page-indicator,
#btnFirst,
#btnLast,
#btnComment,
.footer,
.footer a{
  font-family: var(--ui-font);
}

/* petits réglages pour coller à l’esthétique “bubble” */
.btn, .chip{
  font-weight: 500;
  letter-spacing: .15px;
}

.page-indicator{
  font-weight: 400;
  letter-spacing: .2px;
}

#btnComment{
  font-weight: 400;
}

.footer{
  font-weight: 400;
  letter-spacing: .1px;
}

*{ box-sizing:border-box; }
html, body{
  height: 100%;
  overflow: hidden; /* <- plus de scroll */
}
body{
  margin:0;
  color:var(--ink);
  font-family: ui-rounded, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  background-image: url("assets/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;

  overflow-x:hidden;
}

/* voile très léger */
body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background: rgba(255,255,255,.10); 
}

.page{
  height: 106dvh;                 /* hauteur fenêtre (stable) */
  padding: 14px 14px 14px;        /* moins de marge = moins de scroll */
  display: grid;
  grid-template-rows: auto 1fr;   /* header prend sa hauteur, lecteur prend le reste */
  gap: 10px;
  align-items: start;
  justify-items: center;
}

/* Le header suit la largeur du cadre : on “scale” en % */
.header{
  width:min(96vw, 980px); /* garde ta contrainte actuelle */
  text-align:center;
}

/* Header : plus compact + têtes plus proches */
.header-inner{
  display:flex;
  align-items:center;
  justify-content:center;     /* au lieu de space-between */
  gap: 18px;                  /* distance entre tête / logo / tête */
  margin-bottom: 6px;
}

/* Logo un peu plus petit + légèrement plus haut */
.logo{
  width: clamp(160px, 22vw, 230px);
  height:auto;
  transform: translateY(-8px);
  filter: drop-shadow(0 6px 10px rgba(40, 20, 60, .12));
}

/* Têtes plus grandes qu’actuellement, mais pas énormes */
.head{
  width: clamp(72px, 12vw, 140px);
  height:auto;
  transform: translateY(-4px);
  filter: drop-shadow(0 6px 10px rgba(40, 20, 60, .10));
  user-select:none;
}

/* Petites corrections de placement gauche/droite */
.head-left{ margin-right: 2px; }
.head-right{ margin-left: 2px; }

.social{
  display:flex;
  justify-content:center;
  gap:10px;
}

.chip{
  font-size: 14px;
  color: var(--muted);
  text-decoration:none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(136, 106, 185, .18);
  backdrop-filter: blur(6px);
}
.chip:hover{ border-color: rgba(136, 106, 185, .35); color: var(--ink); }

.reader{
  width: 100%; /* min(92vw, 760px); */
  height: 100%;
  display: grid;
  place-items: start center; /* on colle en haut de la zone lecteur */
}

.reader-card{
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(136, 106, 185, .20);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 14px;
  backdrop-filter: blur(10px);
}

.reader-top, .reader-bottom{
  display:flex;
  align-items:center;
  gap:12px;
}
.reader-top{ margin-bottom: 10px; }
.reader-bottom{
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto; /* gauche | centre | droite */
  align-items: center;
  gap: 12px;
}

.spacer{ flex:1; }

.btn{
  border: 1px solid rgba(136, 106, 185, .25);
  background: rgba(255,255,255,.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  cursor:pointer;
  box-shadow: var(--shadow2);
}
.btn:hover{ border-color: rgba(136, 106, 185, .40); }
.btn:active{ transform: translateY(1px); }
.btn:focus-visible{
  outline: 3px solid rgba(161, 126, 231, .45);
  outline-offset: 2px;
}
.btn-ghost{
  background: rgba(255,255,255,.60);
}

/* Bouton "Première" avec ton visuel (fond image) */
#btnFirst{
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: clamp(150px, 34vw, 240px);
  height: clamp(44px, 8vw, 70px);
  background-image: url("assets/bouton_premiere.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  color: var(--muted);
  font-weight: 470;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
#btnFirst:hover{ filter: brightness(1.02); }
#btnFirst:active{ transform: translateY(1px); }
#btnFirst:focus-visible{
  outline: 3px solid rgba(161, 126, 231, .45);
  outline-offset: 3px;
}

/* Bouton "Dernière" avec ton visuel (fond image) */
#btnLast{
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: clamp(150px, 34vw, 240px);
  height: clamp(44px, 8vw, 70px);

  background-image: url("assets/bouton_derniere.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  color: var(--muted);
  font-weight: 470;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
#btnLast:hover{ filter: brightness(1.02); }
#btnLast:active{ transform: translateY(1px); }
#btnLast:focus-visible{
  outline: 3px solid rgba(161, 126, 231, .45);
  outline-offset: 3px;
}

/* Désactivation visuelle des boutons Première / Dernière */
#btnFirst:disabled,
#btnLast:disabled{
  opacity: .25;                 /* transparence */
  filter: saturate(.75);        /* un poil moins “vif” */
  cursor: default;
  pointer-events: none;
}

/* Empêche les effets hover/active quand disabled */
#btnFirst:disabled:hover,
#btnLast:disabled:hover{
  opacity: .25;
  transform: none;
  box-shadow: none;
}

#btnFirst:disabled:active,
#btnLast:disabled:active{
  transform: none;
}

.btn-primary{
  width: 100%;
  margin-top: 18px;
  background: linear-gradient(180deg, #f59ad2 0%, #cf77c8 100%);
  border: 1px solid rgba(197, 84, 168, .35);
  color: white;
  font-weight: 400;
  letter-spacing:.2px;
}

.comic-wrap{
  position:relative;
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(136, 106, 185, .18);
  padding: 12px;
}

.comic-figure{
  margin:0;
  border-radius: 14px;
  overflow:hidden;
  background: white;

  min-height: clamp(280px, 55vh, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.comic-img{
  display:block;
  width:100%;
  height:auto;
  cursor: zoom-in;
  user-select:none;

  max-height: 100%;
  object-fit: contain;
}

.nav-arrow{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(136, 106, 185, .25);
  background: rgba(255,255,255,.78);
  color: var(--ink);
  font-size: 28px;
  line-height: 42px;
  text-align:center;
  cursor:pointer;
  box-shadow: var(--shadow2);
  font-family: var(--ui-font)
}
.nav-left{ left: 10px; }
.nav-right{ right: 10px; }
.nav-arrow:hover{ border-color: rgba(136, 106, 185, .40); }

.page-indicator{
  justify-self: center;

  /* taille “pilule” proche de ta maquette */
  width: clamp(120px, 26vw, 190px);
  height: clamp(34px, 6.5vw, 50px);

  /* 1) On enlève le background direct sur l'élément */
    background-image: none; /* important */
    position: relative;
    z-index: 0;

  /* texte centré par-dessus */
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  font-size: 15px;
  font-weight: 450;
  color: var(--muted);
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}

/* 2) On dessine le PNG derrière le texte et on l'agrandit */
.page-indicator::before{
  content: "";
  position: absolute;
  inset: -15%;                 /* <- augmente/diminue (ex: -12% à -24%) */
  background-image: url("assets/visuel_numero_page.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;    /* garde la forme, pas de crop */
  z-index: -1;
  pointer-events: none;
}

.reader-actions{
  margin-top: 10px;
  display: flex;
  justify-content: center; /* ou flex-end si tu le veux à droite */
}

/* Footer */
.footer{
  margin-top: 12px;
  text-align:center;
  color: var(--muted);
  font-size: 13px;
}
.footer a{
  color: var(--muted);
  text-decoration:none;
}
.footer a:hover{ color: var(--ink); }
.sep{ opacity:.6; margin: 0 6px; }
.footer-small{ margin-top: 6px; }

/* Lightbox */
.lightbox[hidden], .modal[hidden]{ display:none; }
.lightbox, .modal{
  position:fixed;
  inset:0;
  z-index: 50;
}
.lightbox-backdrop, .modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(20, 12, 30, .55);
  backdrop-filter: blur(6px);
}
.lightbox-img{
  position:absolute;
  inset: 6%;
  margin:auto;
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0,0,0,.35);
  background: white;
}

/* Comment modal */
.modal-card{
  position:absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: min(92vw, 560px);
  max-height: min(86vh, 720px);
  overflow:auto;
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(136, 106, 185, .25);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  padding: 14px 14px 16px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.modal-title{
  font-weight: 800;
  letter-spacing:.2px;
}
.hint{
  font-size: 13px;
  color: var(--muted);
  background: rgba(250, 240, 255, .7);
  border: 1px solid rgba(136, 106, 185, .18);
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.comment-form{
  display:grid;
  gap: 10px;
  margin-bottom: 12px;
}
label{ display:grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, textarea{
  font: inherit;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(136, 106, 185, .25);
  background: rgba(255,255,255,.85);
}
input:focus, textarea:focus{
  outline: 3px solid rgba(161, 126, 231, .35);
  border-color: rgba(136, 106, 185, .40);
}
.comment-actions{ display:flex; gap:10px; justify-content:flex-end; }

.comment-list{
  display:grid;
  gap: 10px;
}
.comment{
  border-radius: 16px;
  border: 1px solid rgba(136, 106, 185, .20);
  background: rgba(255,255,255,.82);
  padding: 10px 12px;
}
.comment-meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.comment-text{
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--ink);
}

/* Mobile tweaks */
@media (max-height: 820px){
  .btn{ font-size: 14px; padding: 9px 12px; }
  .nav-arrow{ width: 40px; height: 40px; font-size: 26px; line-height: 38px; }
  /* Header plus compact */
  .logo{ width: clamp(120px, 11vw, 240px); }
  .head{ width: clamp(84px, 8vw, 115px); }

  .header-inner{ gap: 8px; margin-bottom: 6px; }
}

/* =========================
   CADRE (v8.png) AU-DESSUS DU FOND
   ========================= */

.reader-card.frame{
  container-type: size; /* permet d'utiliser cqw/cqh */
  position: relative;

  /* Le cadre doit tenir dans le viewport : on contraint par la hauteur ET la largeur */
  height: 100%;
  max-height: 100%;
  width: min(98vw, 500px);  /* augmente à 1400px si tu veux encore plus large */
  max-width: none;

  /* On retire le ratio pour autoriser l'étirement horizontal */
  aspect-ratio: auto;

  /* le cadre */
  background-image: url("assets/visuel_site_les_chats_v8.png");
  background-repeat: no-repeat;
  background-position: center;
  /* Le fond v8 est étiré pour remplir la boîte (stretch) */
  background-size: 100% 100%;

  /* on neutralise l'ancien "carton" blanc */
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  backdrop-filter: none;

  /* pour que les éléments internes passent devant l'image */
  overflow: visible;

  margin-top: -30px; /* rapproche du header sans casser le "fit" */

  /* Ombre 1 : nette, violette, proche du cadre */
  /* Ombre 2 : floue, plus large, plus douce */
  box-shadow: none; /* important : pas de box-shadow ici */

  --u: min(1cqw, 1cqh);  /* 1% de la plus petite dimension du cadre */
  --gap: calc(1.6 * var(--u)); /* espace constant entre lignes */
}

/* --- CADRE + OMBRES sur un calque derrière, contenu au-dessus --- */
.reader-card.frame{
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}

/* on définit des “hauteurs de ligne” basées sur ton design */
.reader-card.frame{
  --row1h: calc(7.4 * var(--u));   /* hauteur boutons Première/Dernière */
  --row2h: calc(6.0 * var(--u));   /* hauteur chips Partager/Instagram/Autre (approx) */
  --row3h: calc(13.8 * var(--u));  /* hauteur bouton commenter */
}

/* Le cadre image + ombres (derrière tout le contenu) */
.reader-card.frame::before{
  content:"";
  position:absolute;
  inset:0;
  z-index: 0;

  background-image: url("assets/visuel_site_les_chats_v8.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;

  /* 1) ombre nette, + violette + transparente (moins bleue)
     2) ombre floue douce */
  filter:
  drop-shadow(0 5px 0 rgba(170, 95, 225, .17))
  drop-shadow(0 26px 18px rgba(120, 88, 170, .22));

  pointer-events: none;
}

/* Tout le contenu du cadre AU-DESSUS */
.frame-content{
  position:absolute;
  inset:0;
  z-index: 1;
}
.frame .comic-wrap,
.frame .nav-arrow,
.frame .reader-bottom,
.frame .reader-actions,
.frame #btnComment,
.frame .footer{
  z-index: 2;
  position: absolute; /* tu les as déjà en absolute pour plusieurs, ok de laisser */
}

/* En mode cadre, on ne veut aucun min-height qui force la hauteur */
.frame .comic-figure{
  min-height: 0;
}

/* Contenu positionné par-dessus le cadre */
.frame-content{
  position: absolute;
  inset: 0;
}

/* --- Zone BD (dans le grand blanc) --- */
.frame .comic-wrap{
  position: absolute;
  left: 10%;
  right: 10%;
  top: 6%;      /* remonte la BD */
  height: 65.5%;  /* étire la zone BD pour manger le blanc */

  /* on laisse le cadre dessiner le contour,
     donc on enlève nos fonds/bordures */
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.frame .comic-figure{
  height: 100%;
  background: transparent;
  border-radius: 0;
}

.frame .comic-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Tailles basées sur le cadre (plus stable que vw) */
.frame #btnFirst,
.frame #btnLast{
  width: calc(30 * var(--u));     /* ~30% largeur du cadre */
  height: calc(7.4 * var(--u));
  font-size: calc(2.8 * var(--u));
}

.frame .page-indicator{
  width:  calc(22 * var(--u));
  height: calc(6.5 * var(--u));
  font-size: calc(3.3 * var(--u));
}

/* Flèches latérales : on garde le clic,
   mais on rend le bouton visuellement discret si besoin */
.frame .nav-arrow{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  width: calc(7 * var(--u)); /* width: 64px; */
  height: calc(7 * var(--u)); /* height: 64px; */
  min-width: 44px;
  min-height: 44px;

  background: transparent;
  border: none;
  box-shadow: none;

  font-size: calc(7.5 * var(--u));       /* <- REAFFICHE le chevron */
  line-height: 1;
  color: rgba(120, 88, 170, .85); /* violet doux */
  cursor: pointer;
  user-select: none;
}

/* Flèches désactivées (début/fin) : très transparentes */
.nav-arrow:disabled{
  opacity: .14;                 /* “quasi transparente” */
  cursor: default;
  pointer-events: none;         /* évite tout clic */
  box-shadow: none;             /* optionnel : retire le relief */
  background: rgba(255,255,255,.55);
  border-color: rgba(136, 106, 185, .12);
}

/* Optionnel : petite transition agréable */
.nav-arrow{
  transition: opacity .15s ease;
}

.frame .nav-left{ left: -8%; }
.frame .nav-right{ right: -8%; }

/* --- Barre du bas (Première | Page | Dernière) --- */
.frame .reader-bottom{
  position: absolute;
  left: 7%;
  right: 7%;
  top: 70.2cqh; /* ou garde % si tu veux, cqh est plus explicite */
  margin: 0;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.frame .reader-actions .btn,
.frame .reader-actions .chip{
  font-size: calc(2.6 * var(--u));
  padding: calc(1.0 * var(--u)) calc(2.0 * var(--u));
}

/* --- Partager (petit bouton au-dessus du commentaire) --- */
.frame .reader-actions{
  position: absolute;
  left: 0;
  right: 0;
  top: 76.2%;
  margin: 0;
  display: flex;
  justify-content: center;
  /* Dans le cadre : Partager + chips sur la même ligne */
  gap: 10px;
  align-items: center;
}

/* Social inline à côté de Partager */
.social-inline{
  display:flex;
  gap:10px;
}

/* --- Bouton commentaire (grand rose) --- */
.frame #btnComment{
  position: absolute;
  top: 83.6%;
  left: 50%;
  /* left: 7%; */
  right: 7%;
  width: 86%;          /* 100% - 7% - 7% */
  /* width: auto; */     /* annule le width:100% de .btn-primary */
  transform: translateX(-50%);
  margin: 0;

  font-size: 2.8cqw;
  padding: 1.2cqw 3.2cqw;
}

/* --- Bouton commentaire : fond = image (corrigé) --- */
.frame #btnComment{
  /* garde ton placement */
  position: absolute;
  top: 80.2%;
  left: 50%;
  width: 86%;
  transform: translateX(-50%);
  margin: 0;

  /* ✅ clé : on SUPPRIME le min-height fixe qui empêche de réduire */
  height: clamp(14px, calc(13.8 * var(--u)), 84px);
  min-height: 0;

  padding: 0 !important;   /* on enlève le padding qui “fausse” la skin */ 
  /* padding 0 est OK vu que tu “skin” en image */
  display: flex;
  align-items: center;
  justify-content: center;

  /* skin */
  background: url("assets/bouton%20commenter.png") center / contain no-repeat !important;
  border: none !important;
  box-shadow: none !important;

  /* texte */
  font-size: clamp(7px, calc(3.4 * var(--u)), 20px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.10);
}

/* petit feedback au survol/clic (optionnel) */
.frame #btnComment:hover{ filter: brightness(1.02); }
.frame #btnComment:active{ transform: translateX(-50%) translateY(1px); }

/* --- Footer tout en bas --- */
.frame .footer{
  position: absolute;
  left: 7%;
  right: 7%;
  
    /* ✅ placé sous le bouton + gap stable */
  top: calc(80.2% + (9.8 * var(--u)) + (1.8 * var(--u)));
  bottom: auto;
  
  margin: 0;
  text-align: center;
  font-size: calc(2.3 * var(--u));
}

.reader-card.frame{
    /* ratio exact de ton PNG v8 : 832 x 1218 */
  --frameRatio: calc(1232 / 1218);
  
  /* 1) on fixe une hauteur max "dispo" dans le viewport
     ajuste 220px si ton header/marges changent */
  --frameMaxH: calc(100svh - 220px);

    /* 2) on fixe une largeur max (pour éviter que ça devienne énorme sur très grands écrans) */
  --frameMaxW: min(92vw, 500px);

  /* 3) largeur finale = la plus petite entre :
        - la contrainte largeur (92vw / 500px)
        - la largeur déduite de la hauteur dispo (frameMaxH * ratio) */
  width: min(var(--frameMaxW), calc(var(--frameMaxH) * var(--frameRatio)));
}