/* ==========================================================================
   Hero mobile + tablette : le burger s'ouvre couche par couche au défilement.
   Séquence d'images dessinée sur canvas (voir js/sequence.js).
   Desktop (>= 960px) : mise en page inchangée, vitrine photos.
   ========================================================================== */

.bs-frame,
.bs-callouts,
.bs-dots,
.bs-end,
.bs-hint,
.bs-skip { display: none; }

@media (max-width: 959px) {
  /* ----- En-tête : transparent au-dessus du burger, verre dépoli après le premier défilement ----- */
  .site-header { transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; }
  .site-header:not(.scrolled) {
    background: linear-gradient(180deg, rgba(8, 8, 8, 0.72), rgba(8, 8, 8, 0));
    border-bottom-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .site-header:not(.scrolled) .cart-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  /* ----- Scène : un grand "scroller" avec une scène collée à l'écran ----- */
  .hero2 {
    --size: min(100vw, 62vh, 760px);   /* côté du carré du burger */
    --seq-len: 460vh;                  /* longueur de défilement de la séquence */
    position: relative;
    margin-top: calc(var(--header) * -1);
    padding: 0;
    background: #080808;
  }
  @supports (height: 1svh) {
    .hero2 { --size: min(100vw, 62svh, 760px); }
  }

  .hero2-scroller { position: relative; height: var(--seq-len); }
  .hero2-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }

  /* ----- Le burger (canvas) ----- */
  .bs-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: block;
    width: var(--size);
    height: var(--size);
    margin-inline: auto;
    /* Le burger descend vers le centre de l'écran pendant l'ouverture (--shift piloté par js/sequence.js). */
    translate: 0 var(--shift, 0px);
    /* Image 1 de la séquence = affiche : visible avant même que le canvas ne dessine. */
    background: #0b0b0b url("../public/frames/sd/001.webp") center / cover no-repeat;
  }
  .bs-frame canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
  }

  /* Fumée légère (dégradés radiaux animés, aucun filtre coûteux) */
  .bs-smoke {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
  }
  .bs-smoke i {
    position: absolute;
    bottom: -32%;
    left: 0;
    width: 62%;
    aspect-ratio: 1;
    border-radius: 50%;
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 244, 214, 0.2) 0%, rgba(255, 244, 214, 0.07) 40%, transparent 68%);
  }
  .bs-smoke i:nth-child(1) { left: -14%; }
  .bs-smoke i:nth-child(2) { left: 30%; width: 72%; }
  .bs-smoke i:nth-child(3) { left: 58%; }

  /* Voile permanent : raccord invisible avec le noir de la page (les bords sont du noir plein), grain fin au centre */
  .bs-veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
      linear-gradient(180deg, #080808 0, #080808 1%, rgba(8, 8, 8, 0.55) 8%, rgba(8, 8, 8, 0) 22%),
      linear-gradient(0deg, #080808 0, #080808 1%, rgba(8, 8, 8, 0) 14%),
      linear-gradient(90deg, #080808 0, #080808 1%, rgba(8, 8, 8, 0.6) 4%, rgba(8, 8, 8, 0) 12%, rgba(8, 8, 8, 0) 88%, rgba(8, 8, 8, 0.6) 96%, #080808 99%, #080808 100%),
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  }
  /* Voile de lisibilité du titre : s'efface quand le titre disparaît, pour libérer le burger */
  .bs-veil-text {
    opacity: var(--intro, 1);
    background:
      linear-gradient(0deg, #080808 0, rgba(8, 8, 8, 0.92) 9%, rgba(8, 8, 8, 0) 48%),
      radial-gradient(70% 38% at 50% 100%, rgba(214, 172, 43, 0.2), transparent 70%);
  }

  /* ----- Titre d'ouverture (posé sur le bas du burger, s'efface au défilement) ----- */
  .hero2-grid {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--size) - 92px);
    z-index: 3;
    display: block;
    will-change: opacity, transform;
  }
  .hero2-copy { position: relative; }
  .hero2 h1 {
    max-width: none;
    font-size: clamp(42px, 12.4vw, 70px);
    line-height: 0.98;
  }
  .hero2 h1 .l { display: block; overflow: hidden; padding-bottom: 0.08em; }
  .hero2 h1 .l > span { display: block; }
  .hero2-lead { max-width: 36ch; margin-top: 16px; font-size: 16px; }
  .hero2 .hero-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 24px; }
  .hero2 .hero-actions .btn { width: 100%; }
  .hero2 .hero-meta { margin-top: 20px; gap: 8px; flex-wrap: nowrap; }
  .hero2 .hero-meta li { padding: 7px 11px; font-size: 11px; letter-spacing: 0.06em; white-space: nowrap; }
  .showcase { display: none; }

  /* ----- Légendes des couches, une à la fois sous le burger ----- */
  .bs-callouts {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    top: calc(var(--size) - 6px);
    height: 110px;
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
    translate: 0 var(--shift, 0px);
  }
  .bs-callouts li {
    position: absolute;
    left: 24px;
    right: 24px;
    top: 0;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .bs-callouts li.current { opacity: 1; transform: none; }
  .bs-callouts b {
    display: block;
    color: var(--text);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.05;
  }
  .bs-callouts span { display: block; margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.4; }

  .bs-dots {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    top: calc(var(--size) + 98px);
    display: flex;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    opacity: 0;
    translate: 0 var(--shift, 0px);
    transition: opacity 0.3s ease;
  }
  .bs-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease, transform 0.3s ease;
  }
  .bs-dots i.on { background: var(--gold); transform: scale(1.3); }
  .hero2-stage.opened .bs-dots { opacity: 1; }
  .hero2-stage.finished .bs-callouts,
  .hero2-stage.finished .bs-dots { opacity: 0; }

  /* ----- Carte de fin : on passe de la découverte à la commande ----- */
  .bs-end {
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    top: calc(var(--size) + 2px);
    display: block;
    padding: 0 24px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s var(--ease), visibility 0.45s;
  }
  .bs-end.on { opacity: 1; visibility: visible; transform: none; }
  .bs-end .hero-kicker { margin-bottom: 8px; }
  .bs-end-desc { max-width: 34ch; margin: 0 auto; color: var(--muted); font-size: 15px; }
  .bs-end-prices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 420px;
    margin: 14px auto 0;
    padding: 12px 0;
    border-block: 1px solid rgba(255, 255, 255, 0.08);
  }
  .bs-end-prices div { display: grid; gap: 2px; }
  .bs-end-prices span { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
  .bs-end-prices b { color: var(--text); font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; font-weight: 600; line-height: 1.1; }
  .bs-end-actions { display: grid; gap: 10px; max-width: 420px; margin: 20px auto 0; }
  .bs-end-actions .btn { width: 100%; }

  /* ----- Invitation à défiler + lien pour passer ----- */
  .bs-hint {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    display: grid;
    justify-items: center;
    gap: 8px;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
  }
  .bs-hint i {
    display: block;
    width: 1px;
    height: 30px;
    background: var(--gold);
    transform-origin: top;
    animation: seqDrip 1.8s ease-in-out infinite;
  }

  .bs-skip {
    position: absolute;
    z-index: 5;
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(10, 10, 10, 0.62);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  }
  .bs-skip.on { opacity: 1; visibility: visible; transform: none; }

  /* Pendant la carte de fin, ses boutons font office de commande : la barre du bas s'efface (le panier reste dans l'en-tête). */
  body.seq-end .cartbar { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .bs-skip::after {
    content: "";
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 0 1.8px 1.8px 0;
    transform: rotate(45deg) translateY(-2px);
  }
}

/* Petits écrans en hauteur : on garde l'essentiel dans la première vue */
@media (max-width: 959px) and (max-height: 800px) {
  .bs-hint { display: none; }
}
@media (max-width: 959px) and (max-height: 740px) {
  .hero2-lead,
  .hero2 .hero-meta,
  .bs-end-desc { display: none; }
}

/* Tablette : texte centré */
@media (min-width: 600px) and (max-width: 959px) {
  .hero2-copy { text-align: center; }
  .hero2-lead { margin-inline: auto; }
  .hero2 .hero-actions { display: flex; justify-content: center; }
  .hero2 .hero-actions .btn { width: auto; }
  .hero2 .hero-meta { justify-content: center; }
  .bs-callouts b { font-size: 38px; }
  .bs-callouts span { font-size: 17px; }
}

/* ----- Choréographie d'entrée (uniquement si les animations sont acceptées) ----- */
@media (max-width: 959px) and (prefers-reduced-motion: no-preference) {
  .bs-frame { animation: seqIn 1.3s var(--ease) both; }

  .bs-smoke i { animation: smokeRise 11s linear infinite; }
  .bs-smoke i:nth-child(2) { animation-duration: 13s; animation-delay: -4s; }
  .bs-smoke i:nth-child(3) { animation-duration: 12s; animation-delay: -8s; }

  .hero2 h1 .l > span { transform: translateY(108%); animation: lineUp 0.95s var(--ease) forwards; }
  .hero2 h1 .l:nth-child(1) > span { animation-delay: 0.45s; }
  .hero2 h1 .l:nth-child(2) > span { animation-delay: 0.6s; }
  .hero2 h1 .l:nth-child(3) > span { animation-delay: 0.75s; }

  .hero2 .hero-kicker,
  .hero2-lead,
  .hero2 .hero-actions,
  .hero2 .hero-meta {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeUp 0.85s var(--ease) forwards;
  }
  .hero2 .hero-kicker { animation-delay: 0.3s; }
  .hero2-lead { animation-delay: 1s; }
  .hero2 .hero-actions { animation-delay: 1.15s; }
  .hero2 .hero-meta { animation-delay: 1.3s; }
  /* La carte de fin réutilise le kicker : pas d'animation d'entrée là-bas */
  .bs-end .hero-kicker { opacity: 1; transform: none; animation: none; }
}

@keyframes seqIn { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
@keyframes lineUp { to { transform: none; } }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@keyframes seqDrip { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes smokeRise {
  0% { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: translate3d(10%, -130%, 0) scale(1.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bs-hint i { animation: none; transform: none; }
  .bs-callouts li, .bs-end, .bs-skip, .bs-dots i { transition: none; }
}
