/* =====================================================================================
   THE HALLOWEEN DESIGN (theme envelope_style "fire"), loaded only for it (views/guest.ejs).
   Ported 21 Sep 2026 from the test page Gary approved (previews/halloween-smoke-scroll-review):
   the burning envelope at the top (views/partials/fire-stage.ejs, public/js/halloween-fire.js), then the
   ordinary scroll sections restyled to that page's look, with one real object per section lighting up
   as it arrives (public/js/halloween-decor.js), smoke drifting up out of the letter, and one bat.
   ===================================================================================== */

/* the letter is painted on a canvas in Creepster; a canvas never asks for a font by itself, so it is here */
@font-face { font-family: 'Creepster'; src: url('/themes/halloween/assets/fire/Creepster-Regular.ttf') format('truetype'); font-display: swap; }

/* ---- locking: until the letter is open the page is just the stage ----
   guest.js locks every scroll design with body.gf-locked (a fixed body). This design keeps the stage in the
   page, so it uses its own lock, .fire-sealed, set and cleared by halloween-fire.js: if that script never
   loads, the page is simply readable. */
.fire-page.gf-locked { position: static; height: auto; overflow: visible; }
.fire-page.gf-locked .stage-scroll { pointer-events: auto; }
body.fire-sealed { overflow: hidden; overscroll-behavior: none; }
.fire-sealed .sc-flow, .fire-sealed .sc-music, .fire-sealed .fire-bats { display: none !important; }
/* the letter already carries the name, the date and the place, so the usual top of the page is not shown
   (save-the-date keeps it: that one is all about the calendar button) */
.fire-page:not(.fire-std) .sc-hero { display: none; }

/* ---- the stage: the flight, the room, the envelope and the letter ---- */
.fire-scene {
  position: relative; display: block; width: min(100%, 520px); height: 100vh; height: 100svh; max-height: 925px;
  margin: 0 auto; overflow: hidden; background: #030508; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.fire-scene > video, .fire-scene > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#fire-video { z-index: 0; background: #030508; }
#fire-picture { z-index: 1; pointer-events: none; }
/* the held room is the flight's last frame at the same zoom (no jump when the flight ends) */
#fire-room { z-index: 2; transform: translateY(-5%) scale(1.4625); transform-origin: 50% 58%; }
#fire-canvas { z-index: 3; cursor: pointer; touch-action: manipulation; }
#fire-canvas:focus:not(:focus-visible) { outline: none; }
.fire-off { display: none !important; }
/* the bottom of the stage melts into the page, the smoke rises out of it */
.fire-scene::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: 4; pointer-events: none;
  background: linear-gradient(rgba(9,11,12,0), var(--brand-navy-dark));
}
.fire-start {
  position: absolute; z-index: 5; inset: 0; border: 0; margin: 0; background: linear-gradient(#05070a22, #05070aaa);
  display: grid; place-items: center; padding: 24px; color: #fff; font: 700 21px/1.2 system-ui, -apple-system, sans-serif; cursor: pointer;
}
.fire-start span { display: inline-block; border: 1px solid #d28a48; border-radius: 999px; padding: 14px 24px; background: #23140ddf; box-shadow: 0 5px 24px #000; }
.fire-replay {
  position: absolute; z-index: 6; top: 10px; left: 10px; border: 1px solid #bd7a3e; border-radius: 999px; padding: 8px 12px;
  background: #160f0bcc; color: #ffe7c4; font: 600 14px system-ui, -apple-system, sans-serif; cursor: pointer;
}
.fire-skip {
  position: absolute; z-index: 6; bottom: 70px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: #14110bd9; color: #dfc29a; border: 1px solid #8f704c; padding: 10px 15px; border-radius: 30px;
  font: 14px system-ui, -apple-system, sans-serif; cursor: pointer;
}
.fire-hint {
  position: absolute; left: 0; right: 0; top: calc(100% - 52px); z-index: 7; margin: 0; min-height: 1.5em; padding: 0 12px;
  text-align: center; color: #e9c99f; font: 15px/1.5 system-ui, -apple-system, sans-serif; text-shadow: 0 2px 8px #000; pointer-events: none;
}
/* sound for the opening (flight, fire, sting); once the page is open the music button takes over */
.fire-sound {
  position: fixed; z-index: 41; right: 12px; top: 12px; border: 1px solid #a08054; background: #0c0c0dd9; color: #eed5b3;
  border-radius: 20px; padding: 9px 13px; font: 11px system-ui, -apple-system, sans-serif; cursor: pointer;
}
body:not(.fire-sealed) .fire-sound { display: none; }
.edit-mode .fire-replay, .edit-mode .fire-skip, .edit-mode .fire-start, .edit-mode .fire-hint, .edit-mode .fire-sound { display: none !important; }

/* ---- the page below: the test page's look ---- */
.fire-page #card-stage.stage-scroll { background: radial-gradient(ellipse at 50% 0, #29211955, transparent 55%), var(--brand-navy-dark); }
.fire-page .sc-flow { position: relative; }
.fire-page .sc-flow > .sc-section, .fire-page .sc-flow > .sc-footer { position: relative; }
.fire-page .sc-section { max-width: 640px; padding: 30px 22px; border-bottom: 0; text-align: center; }
.fire-page .sc-countdown-wrap { padding-top: 24px; padding-bottom: 24px; }
.fire-page .sc-h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 7vw, 46px); line-height: 1.15; color: #e0b985; margin: 0 0 22px; }
.fire-page .sc-rule, .fire-page .sc-rule-sm { display: none; }
.fire-page .sc-lead { font-size: 17px; line-height: 1.8; color: #c5bfb3; }
.fire-page .sc-script { font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 7vw, 46px); line-height: 1.15; color: #e0b985; margin: 0 0 18px; }
.fire-page .sc-signature { font-family: var(--font-display); font-style: italic; font-size: 27px; line-height: 1.5; color: #eac494; margin-top: 10px; }
.fire-page #dresscode .sc-lead { font-family: var(--font-display); font-style: italic; font-size: 27px; line-height: 1.5; color: #eac494; }

/* the details: each line a small label over its words, as on the test page */
.fire-page .sc-detail { display: block; padding: 0; margin: 0 0 26px; border: 0; }
.fire-page .sc-detail:last-child { margin-bottom: 0; }
.fire-page .sc-label { display: block; padding: 0; margin: 0 0 9px; font-family: var(--font-ui); font-size: 10px; letter-spacing: .2em; color: #a88d65; }
.fire-page .sc-value { font-family: var(--font-display); font-size: 20px; line-height: 1.5; color: #eee0ca; }
.fire-page #details .sc-hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }

/* the countdown: plain numbers, no box */
.fire-page .countdown-bar { display: flex; justify-content: center; gap: clamp(17px, 5vw, 38px); margin: 0; padding: 18px 0 6px; background: none; border: 0; border-radius: 0; }
.fire-page .countdown-val { font-family: var(--font-display); font-size: 32px; color: #e9bd7e; }
.fire-page .countdown-lbl { font-family: var(--font-ui); font-size: 10px; letter-spacing: .16em; color: #a9987e; margin-top: 6px; }

/* the running order */
.fire-page .sc-timeline { text-align: left; }
.fire-page .sc-timeline li { grid-template-columns: 76px 1fr; gap: 22px; padding: 11px 0; border-bottom: 0; }
.fire-page .sc-timeline .sc-dot { display: none; }
.fire-page .sc-time { font-family: var(--font-display); font-weight: 400; letter-spacing: 0; color: #dfb980; }
.fire-page .sc-what { font-size: 18px; line-height: 1.5; color: #d3cabb; }

/* the map in an old wooden frame, sepia */
.fire-page .sc-map { position: relative; padding: 9px; border: 0; border-radius: 6px; overflow: visible;
  background: linear-gradient(135deg, #6b4a26, #3a2714 45%, #7a5530); box-shadow: 0 12px 30px #000c, inset 0 0 0 1px #c9a15d88; }
.fire-page .sc-map iframe { border-radius: 3px; height: 300px; filter: sepia(.62) saturate(1.2) contrast(1.05) brightness(.88); }
.fire-page .sc-map::after { content: ""; position: absolute; inset: 9px; border-radius: 3px; pointer-events: none; box-shadow: inset 0 0 38px #2a1a0acc; }
.fire-page .sc-travel-note, .fire-page #travel .sc-value { font-size: 17px; }

/* buttons: square-ish, like the test page */
.fire-page .sc-btn { border-radius: 4px; padding: 15px 22px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: .06em; min-height: 46px; }
.fire-page .sc-btn-ghost { border-color: #b9894e; color: #edcda5; background: transparent; }
.fire-page .sc-btn-solid { border-color: #ffcf87; box-shadow: 0 4px 0 #805021, 0 8px 28px #d8943e35; }
.fire-page .sc-btn-solid:active { transform: translateY(2px); box-shadow: 0 2px 0 #805021; }

/* the reply form */
.fire-page .sc-form { text-align: left; }
.fire-page .sc-form label, .fire-page .sc-legend { font-size: 11px; letter-spacing: .1em; color: #bbaa8f; }
.fire-page .sc-form input[type="text"], .fire-page .sc-form select, .fire-page .sc-form textarea { background: #121516; border-color: #65543b; border-radius: 3px; color: #f2e6d2; }
.fire-page .sc-choice span {
  display: flex; align-items: center; justify-content: center; min-height: 64px; border: 2px solid #c39a62; border-radius: 9px;
  padding: 16px 10px; background: #29221a; color: #fff0d9; font-weight: 750; font-size: 16px; letter-spacing: 0; text-transform: none;
  box-shadow: 0 3px 0 #080807;
}
.fire-page .sc-choice input:checked + span { border-color: #ffd89b; box-shadow: 0 3px 0 #805021, 0 0 18px #d8943e25; }
.fire-page .sc-thanks { border-left: 2px solid #d9b27b; padding-left: 15px; text-align: left; }

/* the closing words, with smoke rising behind them */
.fire-page .sc-footer { position: relative; overflow: hidden; padding: 60px 24px 70px; }
.fire-page .sc-footer .sc-script { font-family: var(--font-display); font-size: 25px; color: #c2a078; }
.fire-page .sc-footer::before {
  content: ""; position: absolute; left: -15%; right: -15%; bottom: -35%; height: 125%; pointer-events: none; z-index: 0;
  background: url('/themes/halloween/assets/fire/smoke-real.webp') center bottom / cover no-repeat;
  opacity: .3; mix-blend-mode: screen; animation: fire-smokeup 10s ease-in-out infinite alternate;
}
.fire-page .sc-footer > * { position: relative; z-index: 1; }
@keyframes fire-smokeup { from { transform: translateY(14%) scale(1); } to { transform: translateY(-6%) scale(1.14); } }
.fire-page .fire-again { margin-top: 22px; }

/* ---- the smoke that drifts up out of the letter as you scroll (halloween-decor.js draws it) ---- */
.fire-fog {
  position: absolute; left: 0; top: -90px; width: 100%; height: 400px; pointer-events: none; opacity: 0;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 78%, transparent);
          mask-image: linear-gradient(transparent, #000 16%, #000 78%, transparent);
}

/* ---- one real object per section, shot on black so it melts into the page; it lights up as the section arrives ---- */
.fire-page .sc-section.reveal > .fire-relic { opacity: 1; transform: none; transition: none; }
.relic {
  display: block; margin: 0 auto 16px; width: auto; max-width: min(72%, 280px); max-height: 220px; height: auto; mix-blend-mode: lighten;
  -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent); mask-image: radial-gradient(closest-side, #000 70%, transparent);
  filter: brightness(.14) saturate(.45); transition: filter 1.8s ease;
}
.relic.lit { filter: brightness(1) saturate(1); }
canvas.cine { max-height: 210px; }
/* the pumpkin is a real cut-out with its own glow layer (the carved face), which breathes like a candle */
.jack-wrap { position: relative; width: 112px; margin: 0 auto 12px; }
.jack-wrap .relic { display: block; width: 100%; max-width: none; max-height: none; margin: 0; mix-blend-mode: normal; -webkit-mask-image: none; mask-image: none; }
.jack-wrap .relic.lit { filter: none; }
.jack-glow { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: screen; opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
.relic.lit + .jack-glow { opacity: .9; animation: fire-jackglow 2.9s ease-in-out infinite; }
@keyframes fire-jackglow { 0%, 100% { opacity: .9; } 33% { opacity: .6; } 50% { opacity: 1; } 68% { opacity: .72; } 84% { opacity: .95; } }
/* the candelabra: tap a candle to blow it out */
.candle-wrap { margin: 0 auto 10px; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.candle-wrap canvas.candles {
  width: 100%; max-width: 560px; max-height: none; cursor: pointer; touch-action: manipulation;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 80%, transparent); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 80%, transparent);
}
canvas.candles:focus:not(:focus-visible) { outline: none; }
.candle-hint { margin: 2px 0 18px; font: italic 14px Georgia, serif; color: #bca77e; letter-spacing: .02em; min-height: 1.4em; }

/* one bat, once */
.fire-bats { position: fixed; inset: 0; pointer-events: none; z-index: 26; overflow: hidden; }
.fire-bat { position: absolute; left: 0; top: 0; width: 60px; height: 30px; opacity: 0; }
.fire-bat svg { display: block; width: 100%; height: 100%; fill: #2a1826; filter: drop-shadow(0 0 1.5px #ffbe6e) drop-shadow(0 0 7px #ff7a1acc) drop-shadow(0 0 18px #ff5a0066); }
.fire-bat.fly { animation: fire-batfly 3.8s cubic-bezier(.45,.05,.55,.95) forwards; }
.fire-bat.fly svg { animation: fire-flap .16s ease-in-out infinite alternate; transform-origin: 50% 45%; }
@keyframes fire-flap { from { transform: scaleY(1); } to { transform: scaleY(.32); } }
@keyframes fire-batfly {
  0% { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(var(--s)); }
  10% { opacity: .95; }
  50% { transform: translate(var(--xm), var(--ym)) scale(var(--s)); }
  90% { opacity: .95; }
  100% { opacity: 0; transform: translate(var(--x1), var(--y1)) scale(var(--s)); }
}

/* the page only ever moves up and down */
html:has(body.fire-page), body.fire-page { overflow-x: hidden; }
.fire-page .sc-flow { overflow-x: clip; }

@media (prefers-reduced-motion: reduce) {
  .relic.lit + .jack-glow, .fire-page .sc-footer::before { animation: none; }
  .fire-bats { display: none; }
}
