/* Halloween decoration of one blog post (posts.mjs, deco: "halloween"), loaded on that page only.
   A real jack-o'-lantern (photo: Alabama Extension, CC0) whose candle flickers, a night sky of real bats behind the page
   and wrapped candy falling at the end (js/halloween.js). All decorative (aria-hidden); still under reduced motion. */

.deco-halloween { position: relative; }

/* Jack-o'-lantern: beside the title on wide screens, under the date on phones. Edges fade into the night. */
.hw-citrouille { margin: 0; pointer-events: none; }
.hw-citrouille img {
  display: block; width: 100%; height: auto;
  mix-blend-mode: lighten; /* the dark porch behind the pumpkin gives way to the page's night blue */
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 92%);
          mask-image: radial-gradient(closest-side, #000 55%, transparent 92%);
}
.hw-citrouille::after { /* candle glow, over the carved face */
  content: ""; position: absolute; left: 50%; top: 56%; width: 70%; height: 46%; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 176, 60, .55), rgba(255, 120, 20, 0) 100%);
  mix-blend-mode: screen; opacity: .5;
}
@media (min-width: 1100px) {
  .hw-citrouille { position: absolute; top: -1.5rem; right: 1rem; width: 14rem; }
}
@media (max-width: 1099px) {
  .hw-citrouille { position: relative; width: min(46vw, 11rem); margin: 0 auto .5rem; }
}

/* Night sky behind the whole page: real footage of bats at dusk (Pexels, video 8294047, "Traveling on the Go",
   Pexels licence), looped without a visible cut. Darkened and turned night blue; darker behind the text column. */
html.hw-nuit { background: #05070b; }
html.hw-nuit body, html.hw-nuit .page { background: transparent; }
.hw-fond { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: #05070b; }
.hw-fond video, .hw-fond img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(.3) brightness(.95) contrast(1.35); }
.hw-fond::after { content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 7, 14, 0), rgba(4, 7, 14, .84) 27%, rgba(4, 7, 14, .84) 73%, rgba(4, 7, 14, 0)),
    linear-gradient(180deg, rgba(10, 22, 52, .3), rgba(4, 6, 10, .45)); }
@media (max-width: 1099px) {
  .hw-fond::after { background: linear-gradient(180deg, rgba(4, 7, 14, .35), rgba(4, 7, 14, .8) 45%); }
}

/* Candy: fixed layer above the page, never in the way of a click */
.hw-ciel { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.hw-bonbon { position: absolute; top: -40px; width: 34px; }
.hw-bonbon svg { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: no-preference) {
  .hw-citrouille img { animation: hw-vacille 3.2s steps(1, end) infinite; }
  .hw-citrouille::after { animation: hw-lueur 2.3s ease-in-out infinite alternate; }
  .hw-bonbon { animation: hw-chute var(--duree, 5s) cubic-bezier(.35, .1, .7, 1) forwards; }
}

/* Candle: uneven little dips in brightness, as a real flame does */
@keyframes hw-vacille {
  0%, 100% { filter: brightness(1); }
  9% { filter: brightness(.93); }
  13% { filter: brightness(1.05); }
  41% { filter: brightness(.97); }
  44% { filter: brightness(1.08); }
  70% { filter: brightness(.9); }
  74% { filter: brightness(1.02); }
}
@keyframes hw-lueur { from { opacity: .35; } to { opacity: .7; } }
@keyframes hw-chute {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(var(--dx, 0), 110vh) rotate(var(--tour, 360deg)); opacity: 0; }
}
