/* =====================================================================
   Thème saisonnier « Forêt d'érables » — automne 2026
   ---------------------------------------------------------------------
   Tout le thème vit dans ce fichier et dans automne.js. Rien ne
   s'applique tant que <html> n'a pas la classe .theme-automne, que
   automne.js pose jusqu'au 21 décembre 2026 inclusivement (heure de
   Terrebonne), ou sur demande avec ?automne=1 (?automne=0 le retire).

   Pour retirer le thème : supprimer la ligne
     <link rel="stylesheet" href="/automne.css"><script src="/automne.js"></script>
   dans chaque page publique, puis ces deux fichiers.

   Règles : les couleurs de la marque restent (vert pâle, crème, violet
   prune pour le texte et les boutons) ; l'automne n'ajoute que des
   accents et des éléments décoratifs en position absolue — aucune
   taille ni marge de mise en page ne change (pas de décalage). Avec
   prefers-reduced-motion, le décor reste visible mais immobile.
   ===================================================================== */

html.theme-automne {
  --au-maple: #B8402A;   /* rouge érable */
  --au-amber: #D9862B;   /* ambre */
  --au-ochre: #C9A13B;   /* ocre */
  --au-rust: #8A3B1C;    /* rouille (texte du souhait) */
  --au-honey: #FFD99A;   /* lumière de fin d'après-midi */
  --au-dog: #1B1F1C;     /* même encre que le logo */
}

.au-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- En-tête : un seul accent de saison ---------- */
.theme-automne .site-nav a[aria-current="page"]::after,
.theme-automne .site-nav a.is-active::after { background: var(--au-maple); height: 2px; }

/* ---------- Haut de page : lumière de fin d'après-midi ---------- */
.theme-automne main > :is(.hero, .shop-hero):first-child { position: relative; }
.theme-automne main > :is(.hero, .shop-hero):first-child .hero-copy,
.theme-automne main > :is(.hero, .shop-hero):first-child .shop-hero-inner { position: relative; z-index: 2; }
.theme-automne main > :is(.hero, .shop-hero):first-child .hero-visual { z-index: 0; }

/* Un soleil bas, doré, qui entre par le coin haut-droit et traverse le
   pastel de la marque en longs rais obliques — comme à travers les
   érables. Calque statique : aucun coût d'animation. */
.au-light {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 68% at 92% -6%, rgba(255, 217, 154, 0.62), rgba(255, 217, 154, 0.18) 48%, transparent 72%),
    linear-gradient(0deg, rgba(201, 161, 59, 0.16), transparent 34%);
}
.au-light::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, transparent 0 41%, rgba(255, 232, 186, 0.42) 41% 45.5%, transparent 45.5% 52%, rgba(255, 232, 186, 0.3) 52% 54.5%, transparent 54.5% 61%, rgba(255, 232, 186, 0.38) 61% 67%, transparent 67%);
  -webkit-mask-image: radial-gradient(ellipse 85% 95% at 100% 0%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 85% 95% at 100% 0%, #000 10%, transparent 75%);
  filter: blur(6px);
}

/* Médaillon de l'accueil et petites cartes du haut : liseré ambre. */
.theme-automne main > .hero:first-child .ribbon { border-color: #F6DDAE; }
.theme-automne main > :is(.hero, .shop-hero):first-child .stamp-badge { border-color: rgba(217, 134, 43, 0.6); }
.theme-automne main > :is(.hero, .shop-hero):first-child .permit-card,
.theme-automne main > :is(.hero, .shop-hero):first-child .loyalty-card { border-color: rgba(217, 134, 43, 0.5); }

/* ---------- Feuilles qui tombent (injectées par automne.js) ---------- */
.au-fall {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.au-fall svg, .au-scene svg, .au-greeting svg, .au-tuck svg { display: block; max-width: none; }
.au-drop {
  position: absolute;
  top: -70px;
  left: var(--x);
  width: var(--s);
  height: calc(100% + 70px);
  animation: au-fall var(--d, 12s) linear var(--dl, 0s) infinite;
  will-change: transform;
}
.au-sway {
  display: block;
  width: var(--s);
  animation: au-sway var(--sd, 3s) ease-in-out infinite alternate;
}
.au-sway--r { animation-direction: alternate-reverse; }
.au-tumble {
  width: var(--s);
  height: var(--s);
  animation: au-tumble var(--td, 4s) ease-in-out infinite alternate;
  filter: drop-shadow(0 3px 2px rgba(90, 46, 22, 0.16));
}
.au-tumble--r { animation-direction: alternate-reverse; }
@keyframes au-fall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, 100%, 0); }
}
@keyframes au-sway {
  from { transform: translateX(calc(var(--sw, 24px) * -1)); }
  to { transform: translateX(var(--sw, 24px)); }
}
@keyframes au-tumble {
  0% { transform: rotate(-38deg) rotate3d(1, 0.4, 0, 0deg); }
  50% { transform: rotate(12deg) rotate3d(1, 0.4, 0, 58deg); }
  100% { transform: rotate(64deg) rotate3d(0.3, 1, 0, 24deg); }
}

/* ---------- Souhait de l'équipe ---------- */
.au-greeting {
  position: absolute;
  z-index: 3;
  top: clamp(8px, 1.6vw, 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--wrap));
  margin: 0;
  padding: 0 0 0 1.75rem;
  pointer-events: none;
}
.au-greeting > span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.16rem 0.9rem 0.16rem 0.45rem;
  border-radius: 999px;
  background: rgba(251, 249, 242, 0.82);
  border: 1px solid rgba(184, 64, 42, 0.28);
  box-shadow: 0 6px 14px -10px rgba(138, 59, 28, 0.45);
  font-family: var(--font-script);
  font-size: 1.08rem;
  line-height: 1.5;
  color: var(--au-rust);
  white-space: nowrap;
}
.au-greeting svg { width: 20px; height: 20px; flex-shrink: 0; transform: rotate(-14deg); }

/* ---------- Signature : le tas de feuilles et le chien ----------
   Le tas est posé à cheval sur le bas du haut de page, à droite. Le
   chien des Petits Poilus y plonge (une fois par visite), une gerbe de
   feuilles s'envole, puis il ressort la tête, une feuille sur le crâne,
   et remue la queue. */
.au-scene {
  position: absolute;
  z-index: 1;
  right: clamp(10px, 5vw, 96px);
  bottom: -14px;
  width: clamp(150px, 17vw, 236px);
  aspect-ratio: 200 / 90;
  pointer-events: none;
  color: var(--au-dog);
}
.au-pile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 94%;
}
.au-pile--front { filter: drop-shadow(0 -1px 0 rgba(255, 236, 200, 0.25)); }

/* Le chien en vol */
.au-leap {
  position: absolute;
  left: -6%;
  bottom: 26%;
  width: 82%;
  opacity: 0;
}
.au-leap-arc { display: block; transform-origin: 70% 50%; }
.au-leap svg { width: 100%; height: auto; overflow: visible; }

/* La tête qui sort du tas : découpée au ras des feuilles (clip-path),
   pour qu'elle monte depuis l'intérieur du tas. */
.au-peek {
  position: absolute;
  left: 24%;
  bottom: 36%;
  width: 36%;
  aspect-ratio: 1;
  clip-path: inset(-60% -40% 0 -40%);
}
.au-peek svg { width: 100%; height: 100%; overflow: visible; transform: translateY(102%); }
.au-head { transform-box: view-box; transform-origin: 50% 88%; }
.au-ear { transform-box: fill-box; transform-origin: 50% 10%; }
.au-hat { opacity: 0; }

.au-tail {
  position: absolute;
  left: 76%;
  bottom: 38%;
  width: 11%;
  aspect-ratio: 30 / 46;
  clip-path: inset(-80% -120% 0 -120%);
}
.au-tail-wag { display: block; transform: translateY(105%); }
.au-tail svg { width: 100%; height: auto; overflow: visible; transform-origin: 40% 100%; }

/* Gerbe de feuilles : cachées dans le tas tant que rien ne se passe. */
.au-b { opacity: 0; transform-box: fill-box; transform-origin: center; }

/* --- Séquence complète (première page vue) --- */
.au-scene { --t: 0s; }
.au-scene.is-pop { --t: -0.8s; }
.au-scene.is-play .au-leap { animation: au-leap-x 1.05s linear 0.25s both; }
.au-scene.is-play .au-leap-arc { animation: au-leap-y 1.05s cubic-bezier(0.3, 0, 0.7, 1) 0.25s both; }
.au-scene:is(.is-play, .is-pop) .au-pile { animation: au-squash 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) calc(1.2s + var(--t)) both; }
.au-scene:is(.is-play, .is-pop) .au-b { animation: au-burst var(--bt, 2.1s) cubic-bezier(0.25, 0.7, 0.35, 1) calc(1.2s + var(--t) + var(--bd)) both; }
.au-scene:is(.is-play, .is-pop) .au-peek svg { animation: au-peek 0.75s cubic-bezier(0.34, 1.5, 0.5, 1) calc(1.75s + var(--t)) both; }
.au-scene:is(.is-play, .is-pop) .au-ear { animation: au-ear 0.9s ease-out calc(2.2s + var(--t)) both; }
.au-scene:is(.is-play, .is-pop) .au-hat { animation: au-hat 1.3s cubic-bezier(0.3, 0.6, 0.4, 1) calc(2.5s + var(--t)) both; }
.au-scene:is(.is-play, .is-pop) .au-head { animation: au-look 9s ease-in-out calc(4.6s + var(--t)) infinite; }
.au-scene:is(.is-play, .is-pop) .au-tail-wag { animation: au-tail-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) calc(2.1s + var(--t)) both; }
.au-scene:is(.is-play, .is-pop) .au-tail svg { animation: au-wag 2.6s ease-in-out calc(2.6s + var(--t)) infinite; }

@keyframes au-leap-x {
  0% { transform: translateX(-165%); opacity: 0; }
  8% { opacity: 1; }
  86% { opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes au-leap-y {
  0% { transform: translateY(20%) rotate(-24deg); }
  42% { transform: translateY(-58%) rotate(-4deg); }
  100% { transform: translateY(58%) rotate(34deg); }
}
@keyframes au-squash {
  0% { transform: scale(1, 1); }
  22% { transform: scale(1.07, 0.84); }
  55% { transform: scale(0.98, 1.05); }
  100% { transform: scale(1, 1); }
}
@keyframes au-burst {
  0% { transform: translate(0, 12px) rotate(0) scale(0.6); opacity: 0; }
  6% { opacity: 1; }
  26% { transform: translate(var(--px), var(--py)) rotate(var(--pr)) scale(1); }
  58% { transform: translate(calc((var(--px) + var(--fx)) / 2 + 10px), calc(var(--py) * 0.55)) rotate(calc(var(--pr) * 1.4)) scale(1); }
  80% { transform: translate(calc((var(--px) + 3 * var(--fx)) / 4 - 6px), calc(var(--fy) - 14px)) rotate(calc(var(--fr) * 0.8)) scale(1); }
  100% { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(1); opacity: 1; }
}
@keyframes au-peek {
  from { transform: translateY(102%); }
  to { transform: translateY(0); }
}
@keyframes au-ear {
  0% { transform: rotate(0); }
  30% { transform: rotate(-14deg); }
  65% { transform: rotate(6deg); }
  100% { transform: rotate(0); }
}
@keyframes au-hat {
  0% { transform: translate(-6px, -46px) rotate(-70deg); opacity: 0; }
  12% { opacity: 1; }
  45% { transform: translate(8px, -22px) rotate(10deg); }
  100% { transform: translate(0, 0) rotate(0); opacity: 1; }
}
/* De temps en temps, il penche la tête pour suivre une feuille. */
@keyframes au-look {
  0%, 62%, 100% { transform: rotate(0); }
  70%, 84% { transform: rotate(-9deg); }
}
@keyframes au-tail-up {
  from { transform: translateY(105%); }
  to { transform: translateY(0); }
}
@keyframes au-wag {
  0%, 46%, 100% { transform: rotate(0); }
  8%, 24% { transform: rotate(-18deg); }
  16%, 32% { transform: rotate(14deg); }
  40% { transform: rotate(-6deg); }
}

/* Pas la place pour le chien (contenu très bas) : le tas seul. */
.au-scene--tuck :is(.au-leap, .au-peek, .au-tail) { display: none; }

/* --- Mouvement réduit : la scène finale, posée et immobile --- */
.au-scene.is-still .au-peek svg,
.au-scene.is-still .au-tail-wag { transform: none; }
.au-scene.is-still .au-hat,
.au-scene.is-still .au-b { opacity: 1; }
.au-scene.is-still .au-b { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)); }

/* ---------- Une feuille sous la punaise d'une carte ---------- */
.au-tuck {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 4px 3px rgba(90, 46, 22, 0.2));
}
.au-tuck svg { width: 100%; height: 100%; }
.theme-automne .corkboard .pin { z-index: 2; }
.theme-automne .corkboard .washi-tape {
  background: repeating-linear-gradient(45deg, rgba(217, 134, 43, 0.5), rgba(217, 134, 43, 0.5) 8px, rgba(201, 161, 59, 0.36) 8px, rgba(201, 161, 59, 0.36) 16px);
}
.au-tuck--cork { top: -8px; right: 2px; transform: rotate(32deg); }
.theme-automne .carte-ticket,
.theme-automne .hours-feature { position: relative; }
.au-tuck--card { top: -16px; right: 18px; transform: rotate(24deg); }
/* La punaise qui la retient */
.au-tuck--card::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--plum);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.28), inset 0 -2px 2px rgba(0, 0, 0, 0.18);
}

/* ---------- Hors de l'écran : tout se met en pause ---------- */
.au-idle .au-drop,
.au-idle .au-sway,
.au-idle .au-tumble,
.au-idle .au-head,
.au-idle .au-tail svg { animation-play-state: paused; }

/* ---------- Mouvement réduit : décor visible, immobile ---------- */
@media (prefers-reduced-motion: reduce) {
  .au-drop, .au-sway, .au-tumble { animation: none; }
  .au-drop { transform: translateY(var(--rest, 30%)); }
  .au-tumble { transform: rotate(var(--rr, 0deg)); }
  .au-scene .au-leap { display: none; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 560px) {
  .au-greeting > span { font-size: 1rem; }
  .au-scene { width: 140px; right: 8px; bottom: -18px; }
  .au-tuck { width: 44px; height: 44px; }
}
