/* =========================================================================
 * AB - Boutique Magazine : couvertures en portrait, feuilletage, bas de page.
 * Autonome (chargé aussi sur les articles et pages, où boutique.css est absent).
 * ========================================================================= */

.ab-bas,.ab-feuilletage,.ab-produit-couv{
  --ab-encre:#1c1d1f; --ab-rouge:#CC0000; --ab-rouge-fonce:#A30000; --ab-gris:#4a4c45;
  --ab-filet:#d3d5cb; --ab-filet-doux:#e7e8e1; --ab-sauge:#dcdfc9; --ab-fond:#fff;
  --ab-serif:'Barlow Semi Condensed','Barlow Condensed',Helvetica,Arial,sans-serif;
  --ab-sans:'Helvetica Neue',Helvetica,Arial,sans-serif;
}

/* ---------- 1. Couvertures en portrait (21 x 29,7), jamais recadrées en carré ---------- */

.ab-couv{ display:block; width:100%; height:auto !important; aspect-ratio:21/29.7; object-fit:contain; contain-intrinsic-size:none; }
li.product.ab-produit-couv a.woocommerce-LoopProduct-link img,
li.product.ab-produit-couv img.attachment-woocommerce_thumbnail{
  width:100% !important; height:auto !important; aspect-ratio:21/29.7 !important; object-fit:contain !important;
  box-shadow:0 10px 24px rgba(28,29,31,.18);
}
/* Fiche produit : la couverture entière, sans cadre carré imposé par le thème.
   Seule l'image principale (la couverture) est contrainte ; les autres images de la galerie gardent leur format. */
body.ab-fiche-couv div.images img.wp-post-image,
body.ab-fiche-couv .woocommerce-product-gallery__image:first-child img{
  width:100% !important; height:auto !important; aspect-ratio:21/29.7 !important; object-fit:contain !important;
}
body.ab-fiche-couv .woocommerce-product-gallery{ max-width:420px; }
body.ab-fiche-couv .woocommerce-product-gallery__wrapper{ margin:0; }
body.ab-fiche-couv .flex-control-thumbs img{ aspect-ratio:auto; object-fit:contain; height:auto; }

/* ---------- 2. Feuilletage ---------- */

.ab-feuilletage{ margin:26px 0; font-family:var(--ab-sans); color:var(--ab-encre); }
.ab-feuilletage-aide{ margin:6px 0 18px; font-size:14px; color:var(--ab-gris); }
.ab-rappel-admin{ margin:24px 0; padding:12px 14px; border:1px dashed var(--ab-rouge); font:400 14px/1.5 var(--ab-sans); }

/* Sans JavaScript : pages à la suite, défilement horizontal. */
.ab-livre-liste{ display:flex; gap:14px; overflow-x:auto; margin:0; padding:0 0 12px; list-style:none; scroll-snap-type:x mandatory; }
.ab-livre-liste li{ flex:0 0 min(70%,300px); scroll-snap-align:start; margin:0; }
.ab-livre-liste img{ display:block; width:100%; height:auto; box-shadow:0 8px 22px rgba(28,29,31,.2); }

/* Extrait PDF : message d'attente, lien de secours. */
.ab-livre-attente{ display:flex; align-items:center; gap:10px; margin:0 0 14px; font:400 14px/1.4 var(--ab-sans); color:var(--ab-gris); }
.ab-livre-tourne{ flex:0 0 18px; width:18px; height:18px; border:2px solid var(--ab-filet); border-top-color:var(--ab-rouge); border-radius:50%; animation:ab-tourne .8s linear infinite; }
@keyframes ab-tourne{ to{ transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce){ .ab-livre-tourne{ animation:none; } }
.ab-livre-pdf{ margin:10px 0 0; font:400 14px/1.4 var(--ab-sans); }
.ab-livre.est-pret .ab-livre-pdf{ display:none; }

/* Avec JavaScript : le livre. */
.ab-livre.est-pret .ab-livre-liste{ display:none; }
.ab-livre{ position:relative; }
.ab-livre-cadre{ position:relative; margin:0 auto; padding:22px 0 10px; }
.ab-livre-scene{
  position:relative; margin:0 auto; perspective:2600px;
  width:min(100%, calc(76vh * var(--r, 1.414))); aspect-ratio:var(--r, 1.414);
}
.ab-livre.est-simple .ab-livre-scene{ width:min(100%, calc(76vh * var(--r, .707))); perspective:none; overflow:hidden; touch-action:pan-y; }

.ab-pg{
  position:absolute; top:0; width:50%; height:100%; margin:0; overflow:hidden; background:#fff;
  box-shadow:0 12px 34px rgba(28,29,31,.22);
}
.ab-pg.g{ left:0; }
.ab-pg.d{ left:50%; }
.ab-pg img{ display:block; width:100%; height:100%; object-fit:cover; user-select:none; -webkit-user-drag:none; }
.ab-pg.vide{ background:transparent; box-shadow:none; }
.ab-pg.g::after,.ab-pg.d::after{ content:""; position:absolute; top:0; bottom:0; width:12%; pointer-events:none; }
.ab-pg.g::after{ right:0; background:linear-gradient(to left,rgba(0,0,0,.22),transparent); }
.ab-pg.d::after{ left:0; background:linear-gradient(to right,rgba(0,0,0,.22),transparent); }

.ab-feuille{
  position:absolute; top:0; width:50%; height:100%; transform-style:preserve-3d;
  transition:transform .85s cubic-bezier(.45,.05,.25,1); z-index:5;
}
.ab-feuille.suiv{ left:50%; transform-origin:left center; }
.ab-feuille.prec{ left:0; transform-origin:right center; }
.ab-feuille.suiv.tourne{ transform:rotateY(-180deg); }
.ab-feuille.prec.tourne{ transform:rotateY(180deg); }
.ab-face{ position:absolute; inset:0; overflow:hidden; background:#fff; backface-visibility:hidden; -webkit-backface-visibility:hidden; }
.ab-face img{ display:block; width:100%; height:100%; object-fit:cover; }
.ab-face.verso{ transform:rotateY(180deg); }
.ab-face.vide{ background:#f4f4f0; }

/* Mode une page (mobile) : bande de pages qui glisse. */
.ab-piste{ display:flex; height:100%; transition:transform .38s cubic-bezier(.3,.1,.2,1); will-change:transform; }
.ab-piste.glisse{ transition:none; }
.ab-piste .ab-pg{ position:relative; left:0; flex:0 0 100%; width:100%; box-shadow:none; }
.ab-piste .ab-pg::after{ display:none; }
.ab-livre.est-simple .ab-livre-scene{ box-shadow:0 12px 34px rgba(28,29,31,.22); }

.ab-livre-nav{ display:flex; align-items:center; justify-content:center; gap:12px; margin-top:14px; }
.ab-livre-nav button{
  display:inline-flex !important; align-items:center; justify-content:center; box-sizing:border-box;
  min-width:48px; height:48px; padding:0 14px !important; margin:0 !important;
  background:#fff !important; color:var(--ab-encre) !important; border:1px solid var(--ab-encre) !important; border-radius:0 !important;
  font:700 12px/1 var(--ab-sans) !important; letter-spacing:.1em; text-transform:uppercase; cursor:pointer;
  transition:background-color .2s ease,color .2s ease,opacity .2s ease;
}
.ab-livre-nav button:hover:not(:disabled){ background:var(--ab-encre) !important; color:#fff !important; }
.ab-livre-nav button:disabled{ opacity:.35; cursor:default; }
.ab-livre-nav button:focus-visible,.ab-livre:focus-visible{ outline:2px solid var(--ab-rouge); outline-offset:2px; }
.ab-livre-nav svg{ width:18px; height:18px; }
.ab-livre-compte{ min-width:130px; text-align:center; font:400 14px/1.3 var(--ab-sans); color:var(--ab-gris); }
.ab-livre-plein{ margin-left:8px !important; }

/* Couverture seule (ou dernière page seule) : centrée dans le cadre. */
.ab-livre:not(.est-simple) .ab-livre-scene{ transition:transform .6s cubic-bezier(.45,.05,.25,1); }
.ab-livre.est-couverture:not(.est-simple) .ab-livre-scene{ transform:translateX(-25%); }
.ab-livre.est-fin:not(.est-simple) .ab-livre-scene{ transform:translateX(25%); }

/* Plein écran : « Acheter maintenant ». */
.ab-livre-achat{ display:none; }
.ab-livre.est-plein .ab-livre-achat{
  display:inline-flex; align-items:center; gap:8px; position:absolute; top:12px; left:50%; transform:translateX(-50%); z-index:3;
  padding:0 26px; height:48px; background:var(--ab-rouge); color:#fff !important; text-decoration:none !important;
  font:700 12px/1 var(--ab-sans); letter-spacing:.14em; text-transform:uppercase; box-shadow:0 6px 20px rgba(0,0,0,.35);
}
.ab-livre.est-plein .ab-livre-achat::after{ content:"\2192"; font-size:15px; letter-spacing:0; }
.ab-livre.est-plein .ab-livre-achat:hover{ background:#fff; color:var(--ab-encre) !important; }
@media (max-width:600px){ .ab-livre.est-plein .ab-livre-achat{ left:12px; transform:none; padding:0 16px; } }

/* Plein écran (recouvre la page, sans dépendre de l'API plein écran du navigateur). */
.ab-livre.est-plein{
  position:fixed; inset:0; z-index:100000; background:rgba(20,21,23,.96); display:flex; flex-direction:column; justify-content:center;
  padding:16px; box-sizing:border-box;
}
.ab-livre.est-plein .ab-livre-cadre{ width:100%; padding:0; }
.ab-livre.est-plein .ab-livre-scene{ width:min(100%, calc(84vh * var(--r, 1.414))); }
.ab-livre.est-plein.est-simple .ab-livre-scene{ width:min(100%, calc(80vh * var(--r, .707))); }
.ab-livre.est-plein .ab-livre-compte{ color:#fff; }
.ab-livre.est-plein .ab-livre-nav button{ background:transparent !important; color:#fff !important; border-color:#fff !important; }
.ab-livre.est-plein .ab-livre-nav button:hover:not(:disabled){ background:#fff !important; color:var(--ab-encre) !important; }
.ab-livre-ferme{
  display:none !important; position:absolute; top:12px; right:12px; width:48px; height:48px; align-items:center; justify-content:center;
  background:transparent !important; color:#fff !important; border:1px solid #fff !important; border-radius:0 !important; cursor:pointer; padding:0 !important;
}
.ab-livre.est-plein .ab-livre-ferme{ display:flex !important; }
body.ab-livre-ouvert{ overflow:hidden; }

/* ---------- 3. Bas de page : d'autres produits ---------- */

.ab-bas{ box-sizing:border-box; width:100%; margin:30px 0 0; padding:26px 20px 30px; background:#fff; border-top:1px solid var(--ab-filet); font-family:var(--ab-sans); color:var(--ab-encre); clear:both; }
.ab-bas-in{ max-width:1200px; margin:0 auto; }
.ab-bas-tete{ display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:8px 20px; margin-bottom:22px; }
.ab-bas .ab-rubrique{
  position:relative; margin:0; padding-bottom:10px; border-bottom:2px solid var(--ab-encre);
  font:700 24px/1.2 var(--ab-serif); color:var(--ab-encre); text-transform:none; letter-spacing:0;
}
.ab-bas .ab-rubrique::after{ content:""; position:absolute; left:0; bottom:-2px; width:56px; height:2px; background:var(--ab-rouge); }
.ab-bas .ab-lien{ font:700 13px/1.3 var(--ab-sans); color:var(--ab-encre); text-decoration:none; border-bottom:1px solid var(--ab-encre); padding-bottom:1px; }
.ab-bas .ab-lien:hover{ color:var(--ab-rouge); border-color:var(--ab-rouge); }
.ab-bas-grille{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:22px; margin:0; padding:0; list-style:none; }
.ab-bas-grille li{ margin:0; padding:0; }
.ab-bas-carte{ display:flex; flex-direction:column; gap:8px; height:100%; text-decoration:none !important; color:var(--ab-encre) !important; }
.ab-bas-img{ position:relative; display:block; aspect-ratio:3/4; background:#f4f4f0; overflow:hidden; }
.ab-bas-img img,.ab-bas-img img.ab-couv{
  position:absolute !important; top:14px; left:14px; width:calc(100% - 28px) !important; height:calc(100% - 28px) !important; max-width:none !important;
  aspect-ratio:auto !important; object-fit:contain !important; object-position:center; margin:0 !important; box-shadow:none !important; transition:transform .3s ease;
}
.ab-bas-carte:hover .ab-bas-img img{ transform:translateY(-4px); }
.ab-bas-nom{ font:700 15px/1.3 var(--ab-sans); }
.ab-bas-carte:hover .ab-bas-nom{ color:var(--ab-rouge); }
.ab-bas-prix{ font-size:14px; color:var(--ab-gris); }
.ab-bas-carte:focus-visible{ outline:2px solid var(--ab-rouge); outline-offset:3px; }

/* Version intégrée au panier vide et à la page de paiement : dans la colonne, sans bandeau ni filet de séparation. */
.ab-bas-compact{ width:auto; margin:22px 0 0; padding:18px 0 4px; background:transparent; border-top:0; }
.ab-bas-compact .ab-bas-in{ max-width:none; }
.ab-bas-compact .ab-bas-tete{ margin-bottom:14px; }
.ab-bas-compact .ab-rubrique{ font-size:19px; }
.ab-bas-compact .ab-bas-grille{ gap:16px; }
.ab-bas-compact .ab-bas-nom{ font-size:14px; }
.ab-bas-compact .ab-bas-prix{ font-size:13px; }

@media (max-width:921px){ .ab-bas-grille{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; } }
@media (max-width:480px){
  .ab-bas{ padding:24px 16px 28px; }
  .ab-bas-compact{ padding:16px 0 0; }
  .ab-bas-grille{ gap:14px; }
  .ab-livre-nav{ gap:8px; }
  .ab-livre-compte{ min-width:96px; font-size:13px; }
  .ab-livre-plein span{ display:none; }
}
@media (prefers-reduced-motion:reduce){
  .ab-feuille,.ab-piste,.ab-bas-img img{ transition:none !important; }
}
@media print{ .ab-livre-nav,.ab-bas{ display:none !important; } .ab-livre-liste{ display:block !important; } }
