/* ============================================================
   AIDE.CSS - Aide, visite guidée, téléchargement, couverture,
   thèmes et styles d'affichage choisis par le studio.
   Chargé après style.css et henzo.css.
   ============================================================ */

/* ---------- Thèmes au choix (réglés par le studio) ---------- */
[data-galtheme="clair"]{
  --bg:#fafafa; --bg-soft:#f0f0f0; --bg-card:#ffffff; --bg-input:#f4f4f4; --bg-input-focus:#fff;
  --border:rgba(0,0,0,.08); --border-strong:rgba(0,0,0,.16);
  --text:#151515; --text-soft:rgba(21,21,21,.65); --text-dim:rgba(21,21,21,.4);
  --accent:#151515; --accent-contrast:#fff; --header-bg:rgba(250,250,250,.88);
  --henzo-mint:#151515; --henzo-green:#151515; --henzo-hero-1:#151515; --henzo-hero-2:#333;
}
[data-galtheme="creme"]{
  --bg:#f6f0e6; --bg-soft:#efe6d8; --bg-card:#fffaf2; --bg-input:#f3ebde; --bg-input-focus:#fffaf2;
  --border:rgba(70,50,20,.10); --border-strong:rgba(70,50,20,.2);
  --text:#2b2216; --text-soft:rgba(43,34,22,.68); --text-dim:rgba(43,34,22,.42);
  --accent:#9a7231; --accent-contrast:#fff; --header-bg:rgba(246,240,230,.9);
  --henzo-mint:#9a7231; --henzo-green:#9a7231; --henzo-hero-1:#9a7231; --henzo-hero-2:#6e5021;
}
[data-galtheme="nuit"]{
  --bg:#07070a; --bg-soft:#111116; --bg-card:#15151b; --bg-input:#0e0e13; --bg-input-focus:#15151b;
  --border:rgba(232,199,122,.10); --border-strong:rgba(232,199,122,.22);
  --text:#f6f1e6; --text-soft:rgba(246,241,230,.68); --text-dim:rgba(246,241,230,.4);
  --accent:#e8c77a; --accent-contrast:#07070a; --header-bg:rgba(7,7,10,.85);
  --henzo-mint:#e8c77a; --henzo-green:#c9a24f; --henzo-hero-1:#2a2214; --henzo-hero-2:#15110a; --henzo-glow:#e8c77a;
}
[data-galtheme="rose"]{
  --bg:#fbf3f3; --bg-soft:#f5e7e7; --bg-card:#fffafa; --bg-input:#f7eded; --bg-input-focus:#fffafa;
  --border:rgba(120,40,60,.09); --border-strong:rgba(120,40,60,.18);
  --text:#3a1f27; --text-soft:rgba(58,31,39,.68); --text-dim:rgba(58,31,39,.42);
  --accent:#b4536b; --accent-contrast:#fff; --header-bg:rgba(251,243,243,.9);
  --henzo-mint:#b4536b; --henzo-green:#b4536b; --henzo-hero-1:#b4536b; --henzo-hero-2:#83384b;
}
[data-galtheme="vert"]{
  --bg:#f5f3ee; --bg-soft:#eae7df; --bg-card:#faf9f6; --bg-input:#eae7df; --bg-input-focus:#faf9f6;
  --border:rgba(19,21,15,.10); --border-strong:rgba(19,21,15,.2);
  --text:#13150f; --text-soft:rgba(19,21,15,.68); --text-dim:rgba(19,21,15,.42);
  --accent:#5f6e3a; --accent-contrast:#faf9f6; --header-bg:rgba(245,243,238,.9);
  --henzo-mint:#5f6e3a; --henzo-green:#748549; --henzo-hero-1:#5f6e3a; --henzo-hero-2:#4a572c;
}
[data-galtheme] body::before{opacity:.35}

/* ---------- Couverture ---------- */
.gal-couverture{position:relative;width:100%;height:min(78vh,620px);overflow:hidden;margin-bottom:8px}
.gal-couverture img{width:100%;height:100%;object-fit:cover;display:block;animation:galZoom 14s ease-out both}
@keyframes galZoom{from{transform:scale(1.08)}to{transform:scale(1)}}
.gal-couv-voile{position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.05) 30%,rgba(0,0,0,.72))}
.gal-couv-txt{position:absolute;left:0;right:0;bottom:0;padding:28px 20px 34px;text-align:center;color:#fff}
.gal-couv-txt h2{font-size:clamp(28px,7vw,54px);font-weight:300;letter-spacing:-.02em;line-height:1.05;margin:6px 0 8px}
.gal-couv-info{font-size:12px;letter-spacing:.18em;text-transform:uppercase;opacity:.85}
.gal-couv-sous{font-size:15px;opacity:.9;max-width:560px;margin:0 auto 16px}
.gal-couv-btn{background:rgba(255,255,255,.95);color:#111;border:0;border-radius:999px;padding:12px 22px;font-size:14px;font-weight:500;cursor:pointer}

/* ---------- Styles d'affichage ---------- */
.grille.aff-grille{column-count:initial !important;display:grid !important;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px}
.grille.aff-grille .photo-wrap{aspect-ratio:1/1;overflow:hidden;margin:0 !important}
.grille.aff-grille .photo-wrap img{width:100%;height:100%;object-fit:cover;margin:0 !important}
.grille.aff-grand,.grille.aff-histoire{column-count:1 !important;max-width:900px;margin-left:auto;margin-right:auto}
.grille.aff-grand .photo-wrap{margin-bottom:10px}
.grille.aff-histoire .photo-wrap{margin-bottom:42px}
.grille.aff-histoire .photo-wrap img{border-radius:4px}
@media (max-width:700px){.grille.aff-grille{grid-template-columns:repeat(3,1fr);gap:3px}}

/* ---------- Bouton d'aide flottant ---------- */
.btn-aide{position:fixed;left:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:90;display:flex;align-items:center;gap:8px;
  background:var(--bg-card);color:var(--text);border:1px solid var(--border-strong);border-radius:999px;padding:8px 14px 8px 8px;
  box-shadow:0 8px 24px rgba(0,0,0,.25);cursor:pointer;font-size:14px}
.btn-aide span{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--accent);color:var(--accent-contrast);font-weight:700}
.btn-aide em{font-style:normal}
body[data-ecran="accueil"] .btn-aide{display:none}
#viewer:not(.hidden) ~ .btn-aide{display:none}
.btn-avis{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}

/* ---------- Fenêtres ---------- */
.aide-fond{position:fixed;inset:0;z-index:200;background:rgba(0,0,0,.6);display:flex;align-items:flex-end;justify-content:center;padding:12px;animation:aideFond .2s ease both}
@keyframes aideFond{from{opacity:0}to{opacity:1}}
@media (min-width:700px){.aide-fond{align-items:center}}
.aide-carte{position:relative;width:100%;max-width:440px;max-height:88vh;overflow:auto;background:var(--bg-card);color:var(--text);
  border:1px solid var(--border);border-radius:22px;padding:22px 20px calc(18px + env(safe-area-inset-bottom));box-shadow:0 20px 60px rgba(0,0,0,.4);
  animation:aideMonte .28s cubic-bezier(.16,1,.3,1) both}
.aide-large{max-width:560px}
@keyframes aideMonte{from{transform:translateY(24px);opacity:0}to{transform:none;opacity:1}}
.aide-carte h3{font-size:20px;font-weight:500;margin-bottom:4px}
.aide-carte p{color:var(--text-soft);font-size:14px;line-height:1.55}
.aide-sous{margin-bottom:14px}
.aide-x{position:absolute;top:12px;right:12px;width:34px;height:34px;border-radius:50%;border:1px solid var(--border);background:transparent;color:var(--text);cursor:pointer}
.aide-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:12px 18px;border-radius:14px;border:1px solid transparent;
  background:var(--accent);color:var(--accent-contrast);font-size:14px;font-weight:600;cursor:pointer;text-decoration:none}
.aide-btn.ghost{background:transparent;color:var(--text);border-color:var(--border-strong);font-weight:500}
.aide-btn.grand{width:100%;padding:15px;font-size:15px;margin:6px 0 10px}
.aide-btn.petit{padding:8px 12px;font-size:13px;border-radius:11px}
.aide-boutons{display:flex;gap:8px;justify-content:flex-end;margin-top:16px;flex-wrap:wrap}
.aide-boutons.col{flex-direction:column}
.aide-boutons.col .aide-btn{width:100%}
.aide-encart{background:var(--bg-soft);border:1px solid var(--border);border-radius:14px;padding:12px 14px;font-size:14px;line-height:1.55;color:var(--text);margin-top:12px}
.aide-petit{font-size:12px;color:var(--text-dim)}
.aide-liste{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.aide-sec{border:1px solid var(--border);border-radius:14px;background:var(--bg-soft);overflow:hidden}
.aide-sec summary{list-style:none;display:flex;align-items:center;gap:10px;padding:13px 14px;cursor:pointer;font-size:15px;font-weight:500}
.aide-sec summary::-webkit-details-marker{display:none}
.aide-sec summary::after{content:'+';margin-left:auto;font-size:20px;color:var(--text-dim)}
.aide-sec[open] summary::after{content:'−'}
.aide-num{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;font-size:12px;background:var(--border-strong);color:var(--text)}
.aide-ic{width:20px;text-align:center}
.aide-txt{padding:0 14px 14px 46px;font-size:14px;line-height:1.6;color:var(--text-soft)}
.aide-txt b{color:var(--text)}
.aide-txt .aide-btn{margin-top:6px}

/* ---------- Téléchargement ---------- */
.dl-tete{display:flex;gap:12px;align-items:center;margin-bottom:14px}
.dl-icone{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:var(--accent);color:var(--accent-contrast);font-size:20px;flex:none}
.dl-sous{font-size:13px !important}
.dl-pct{font-size:40px;font-weight:300;letter-spacing:-.02em;text-align:center;margin:6px 0}
.dl-piste{height:10px;border-radius:999px;background:var(--bg-soft);border:1px solid var(--border);overflow:hidden}
.dl-piste i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--henzo-green,#48A89A),var(--henzo-glow,#3ff0cf));border-radius:999px;transition:width .25s ease}
.dl-detail{text-align:center;margin-top:8px}
.dl-vignettes{display:flex;gap:6px;overflow:hidden;margin:12px 0 4px;min-height:48px}
.dl-vignettes img{width:48px;height:48px;object-fit:cover;border-radius:8px;flex:none;animation:aideMonte .3s ease both}
.dl-astuce{font-size:12px !important;text-align:center;color:var(--text-dim) !important;margin-top:6px}
.dl-alerte{background:rgba(224,69,69,.12);border:1px solid rgba(224,69,69,.3);border-radius:12px;padding:10px 12px;color:var(--text) !important;margin-top:10px}
.dl-fin-ok{width:64px;height:64px;border-radius:50%;margin:4px auto 10px;display:grid;place-items:center;font-size:30px;background:var(--henzo-green,#48A89A);color:#fff}

/* ---------- Visite guidée ---------- */
#visite{position:fixed;inset:0;z-index:250}
.visite-trou{position:fixed;border-radius:14px;box-shadow:0 0 0 9999px rgba(0,0,0,.72);transition:all .3s cubic-bezier(.16,1,.3,1);pointer-events:none;outline:2px solid rgba(255,255,255,.8)}
.visite-bulle{position:fixed;background:var(--bg-card);color:var(--text);border:1px solid var(--border-strong);border-radius:18px;padding:16px;box-shadow:0 16px 40px rgba(0,0,0,.45);max-width:340px;transition:all .3s ease}
.visite-bulle h4{font-size:17px;font-weight:600;margin:4px 0 6px}
.visite-bulle p{font-size:14px;line-height:1.55;color:var(--text-soft)}
.visite-bulle p b{color:var(--text)}
.visite-n{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--text-dim)}
.visite-btns{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:14px}
.visite-btns span{display:flex;gap:6px}
#visite-propose{position:fixed;left:12px;right:12px;bottom:calc(72px + env(safe-area-inset-bottom));z-index:95;max-width:460px;margin:0 auto;display:flex;flex-direction:column;gap:10px;
  background:var(--bg-card);border:1px solid var(--border-strong);border-radius:18px;padding:14px;box-shadow:0 14px 40px rgba(0,0,0,.35);font-size:14px;animation:aideMonte .35s ease both}
#visite-propose div{display:flex;gap:8px}

/* ---------- Écran du code ---------- */
.login-aide{font-size:13px;color:var(--text-soft);line-height:1.55;max-width:360px;margin:14px auto 0;text-align:center}
.lien-aide{background:none;border:0;color:var(--text);text-decoration:underline;cursor:pointer;font-size:13px;padding:0}
.menu-qualite .menu-qualite-aide{border-top:1px solid var(--border) !important;opacity:.85}
.menu-qualite .menu-qualite-aide span{font-size:13px}

/* Pas d'espace vide quand il n'y a pas de petit mot */
#message:empty{display:none}
#gal-couverture ~ .entete{padding-top:28px !important}
/* Menus de qualité "tout" et "favoris" : ils s'ouvrent vers le bas (avant, ils passaient sous le bandeau de date) */
.entete{position:relative;z-index:6}
.barre-actions .menu-qualite,.menu-qualite-wrap-favoris .menu-qualite{bottom:auto !important;top:calc(100% + 10px) !important;z-index:60}

/* Chargement progressif de la grille : aperçu flou (< 1 Ko) puis miniature nette en fondu.
   La case réserve déjà la bonne place (ratio de la photo) pour éviter que la page saute. */
.grille .photo-wrap{position:relative}
.grille .photo-wrap>img{position:relative;z-index:1}
.grille .photo-wrap .photo-fav{z-index:2}
.grille .photo-wrap.ph-attente{background:rgba(127,127,127,.10);border-radius:6px;overflow:hidden}
.grille:not(.aff-grille) .photo-wrap.ph-attente{aspect-ratio:var(--ratio,3/2)}
.grille .photo-wrap.ph-attente::before{content:"";position:absolute;inset:0;background:var(--lqip,none) center/cover no-repeat;filter:blur(12px);transform:scale(1.1)}
