/* ═══ TREE BACKGROUND — canvas global fixe ════════════════════════ */

#tree-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
  will-change: transform;
}

/* Couches de contenu au-dessus du canvas (z-index:0) */
main   { position: relative; z-index: 1; }
footer { position: relative; z-index: 1; }

/* Navbar et menus toujours au premier plan */
.navbar,
.mobile-menu,
#mobile-menu { z-index: 200; }

/* ═══ SECTION REVEAL — fenêtre transparente sur l'arbre ════════════ */

.scroll-tree-section {
  position: relative;
  height: 260vh;
  background: transparent; /* le canvas fixe est visible ici */
  z-index: 2;
}

.scroll-tree-wrapper {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  /* Pas de background → le canvas se voit en dessous */
}

/* ─── Panels texte ────────────────────────────────────────────────── */
.scroll-tree-panels {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.scroll-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 20px)) scale(0.97);
  width: min(540px, 88vw);
  text-align: center;
  opacity: 0;
  /* Sortie rapide (0.2s) pour éviter tout chevauchement */
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  will-change: opacity, transform;
  pointer-events: none;
}

.scroll-panel.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  /* Entrée plus douce */
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-panel__inner {
  display: inline-block;
  padding: 38px 48px;
  background: rgba(247, 243, 236, 0.78);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow: 0 10px 48px rgba(42, 59, 47, 0.1),
              0 2px 8px rgba(42, 59, 47, 0.06);
}

.scroll-panel__eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.scroll-panel__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
}

.scroll-panel__text {
  font-size: 0.95rem;
  color: var(--ink-mid);
  line-height: 1.78;
  margin: 0;
}

/* ─── Barre de progression ────────────────────────────────────────── */
.scroll-tree-progress {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.4s;
}

.scroll-tree-section:has(.scroll-panel.is-visible) .scroll-tree-progress {
  opacity: 1;
}

.scroll-tree-progress__bar {
  width: 80px;
  height: 2px;
  background: rgba(80, 50, 22, 0.18);
  border-radius: 2px;
  overflow: hidden;
}

.scroll-tree-progress__fill {
  width: 100%;
  height: 100%;
  background: var(--sage);
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: 2px;
}

.scroll-tree-progress__label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ═══ TICKER AVIS GOOGLE ══════════════════════════════════════════ */
.reviews-ticker {
  background: var(--forest, #2a3b2f);
  overflow: hidden;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.reviews-ticker__track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: reviews-scroll 100s linear infinite;
}

.reviews-ticker:hover .reviews-ticker__track {
  animation-play-state: paused;
}

@keyframes reviews-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.reviews-ticker__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  flex-shrink: 0;
  white-space: nowrap;
}

.reviews-ticker__stars {
  color: #D4A847;
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: 2px;
}

.reviews-ticker__quote {
  font-size: 0.82rem;
  color: rgba(247, 243, 236, 0.88);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reviews-ticker__author {
  font-size: 0.72rem;
  color: rgba(247, 243, 236, 0.52);
  font-weight: 600;
  flex-shrink: 0;
}

.reviews-ticker__sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

/* ═══ SECTIONS SEMI-TRANSPARENTES — arbre visible sur tout le site ═══
   Le canvas fixe (z-index:0) passe à travers les sections rendues
   semi-opaques via rgba. backdrop-filter: blur crée l'effet givre.       */

.hero,
.page-hero {
  background: rgba(247, 243, 236, 0.78) !important;
  backdrop-filter: blur(5px) saturate(1.15);
  -webkit-backdrop-filter: blur(5px) saturate(1.15);
}

.section--cream {
  background: rgba(247, 243, 236, 0.80) !important;
  backdrop-filter: blur(4px) saturate(1.1);
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
}

.section--cream-dark {
  background: rgba(237, 231, 218, 0.82) !important;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.section--sage,
.marquee {
  background: rgba(61, 90, 74, 0.84) !important;
}

/* Footer — arbre visible en arrière-plan */
.footer {
  background: rgba(28, 37, 32, 0.86) !important;
}

.cta-final {
  background: rgba(240, 228, 204, 0.80) !important;
  backdrop-filter: blur(4px) saturate(1.1);
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .scroll-tree-section { height: 220vh; }
  .scroll-panel__inner { padding: 24px 28px; }
  .scroll-panel__title { font-size: clamp(1.7rem, 7vw, 2.4rem); }
  .reviews-ticker__quote { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  #tree-bg-canvas { display: none; }

  /* Remettre les fonds solides (canvas caché, rgba inutile) */
  .hero, .page-hero                         { background: var(--cream)     !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .section--cream                           { background: var(--cream)     !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .section--cream-dark                      { background: var(--cream-dark)!important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .section--sage, .marquee                  { background: var(--sage)      !important; }
  .footer                                   { background: var(--ink)       !important; }
  .cta-final                                { background: var(--gold-pale) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

  .scroll-tree-section {
    height: auto;
    background: var(--cream);
    padding: 60px 0;
  }
  .scroll-tree-wrapper { position: relative; height: auto; }
  .scroll-panel {
    position: relative;
    top: auto; left: auto;
    transform: none;
    opacity: 1;
    margin: 32px auto;
    transition: none;
  }
  .reviews-ticker__track { animation: none; }
}
