/* ── 🎃 Halloween look ─────────────────────────────────────────────────────────
   Only applies while <html> has the "halloween" class (set by halloween.js when the
   server says the event is on, or with ?halloween in the URL for a preview). */

html.halloween {
  --bg: #08050d; --panel: #150e1d; --panel-2: #1c1325; --raised: #100a17;
  --line: #2c1e33; --line-2: #3e2a45;
  --red: #ff7a1a; --violet: #9d4dff; --green: #9bff5c;
  --grad: linear-gradient(90deg, #ff7a1a, #9d4dff);
  --pumpkin: #ff7a1a; --witch: #9d4dff; --slime: #9bff5c;
}
html.halloween body { background: radial-gradient(1200px 700px at 80% -10%, #2a123a 0%, transparent 60%), var(--bg); }
html.halloween .grad-anim { background-image: linear-gradient(90deg, #ff7a1a, #9d4dff, #9bff5c, #ff7a1a); background-size: 300% auto; }
html.halloween .glow-a { background: #ff7a1a; opacity: .13; }
html.halloween .glow-b { background: #9d4dff; opacity: .2; }
html.halloween .btn-primary { box-shadow: 0 10px 32px #ff7a1a40; }
html.halloween .btn-primary:hover { box-shadow: 0 16px 44px #ff7a1a66, 0 0 0 1px #ffb36b55; }
html.halloween .btn-ghost:hover { border-color: #9d4dff; }
html.halloween .logo { box-shadow: 0 0 22px #ff7a1a66; position: relative; }
/* Pulse logo tiles: night tile + ember-orange glowing heartbeat (same as the app's Halloween icon) */
html.halloween .logo, html.halloween .mini-logo { background: linear-gradient(135deg, #3a145e 0%, #1a0b2c 55%, #07030c 100%) !important;
  box-shadow: inset 0 0 0 1px #ff8a2a88, 0 0 22px #ff7a1a66 !important; }
html.halloween .logo svg path, html.halloween .mini-logo svg path { filter: drop-shadow(0 0 2px #ff7a1a) drop-shadow(0 0 6px #ff7a1aaa); }
html.halloween .beat path { filter: drop-shadow(0 0 8px #ff7a1aaa); }
html.halloween .feature:hover { border-color: #ff7a1a77; }
html.halloween .feature::before { background: radial-gradient(400px circle at 0% 0%, #ff7a1a1f, transparent 60%); }
html.halloween .release.latest { border-color: #ff7a1a66; box-shadow: 0 0 50px #ff7a1a1a; }
html.halloween ::selection { background: #ff7a1a66; }
html.halloween .nav { background: #08050dcc; }

/* Witch hat on the logo: the brim rests on the top edge of the icon */
html.halloween .brand .logo { overflow: visible; }
.hw-hat { position: absolute; width: 112%; aspect-ratio: 40 / 32; left: -10%; top: -62%; transform: rotate(-12deg); transform-origin: 50% 85%;
  pointer-events: none; z-index: 2; filter: drop-shadow(0 2px 2px #000a) drop-shadow(0 0 6px #9d4dff55); }
.hw-hat svg { width: 100%; height: 100%; display: block; overflow: visible; fill: none; stroke: none; stroke-width: 1; }
.brand:hover .hw-hat { animation: hw-tip .6s ease-in-out; }
@keyframes hw-tip { 40% { transform: rotate(-20deg) translateY(-3px); } 100% { transform: rotate(-12deg); } }

/* ── Banner under the nav ── */
.hw-banner { position: relative; z-index: 5; display: flex; justify-content: center; padding: 12px clamp(16px, 5vw, 64px) 0; }
.hw-banner-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 1180px; width: fit-content;
  padding: 10px 18px; border-radius: 16px; border: 1px solid transparent;
  background: linear-gradient(#120b19f2, #120b19f2) padding-box, linear-gradient(90deg, #ff7a1a, #9d4dff 60%, #9bff5c) border-box;
  box-shadow: 0 10px 40px #ff7a1a1f, 0 0 60px #9d4dff1a; font-size: 14px; color: var(--muted); text-align: center; }
.hw-banner b { color: var(--text); font-family: var(--display); letter-spacing: .3px; }
.hw-pumpkin { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 0 10px #ff8a2a88); animation: hw-glow 2.6s ease-in-out infinite; }
.hw-count { font: 700 13px var(--mono); color: #ffd2a8; padding: 4px 10px; border-radius: 999px; background: #ff7a1a1c; border: 1px solid #ff7a1a55; white-space: nowrap; }
.hw-banner a { color: #c9a2ff; font-weight: 600; white-space: nowrap; }
.hw-banner a:hover { color: #fff; }
@keyframes hw-glow { 50% { filter: drop-shadow(0 0 18px #ffb020cc); } }

/* ── Harvest moon ── */
.hw-moon { position: fixed; top: 64px; right: clamp(-40px, 4vw, 80px); width: 300px; height: 300px; z-index: -1; pointer-events: none;
  background: url("/assets/halloween-moon.webp") center / contain no-repeat; opacity: .9; }

/* ── Cobweb in the corner ── */
.hw-web { position: fixed; top: 64px; right: 0; width: 170px; height: 170px; pointer-events: none; z-index: 0; opacity: .5; }
.hw-web path { fill: none; stroke: #ffffff26; stroke-width: 1; }
.hw-spider { transform-origin: 50% 0; animation: hw-dangle 5s ease-in-out infinite; }
@keyframes hw-dangle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(26px); } }

/* ── Graveyard + tree along the bottom ── */
.hw-horizon { position: fixed; left: 0; right: 0; bottom: 0; height: 340px; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 90% at 50% 100%, #ff7a1a3d 0%, #b0305a26 35%, #9d4dff14 60%, transparent 80%); }
.hw-tree { position: fixed; right: 0; bottom: 60px; height: min(460px, 52vh); width: auto; pointer-events: none; z-index: -1; overflow: visible; }
.hw-graveyard { position: fixed; left: 0; right: 0; bottom: 0; height: clamp(150px, 16.67vw, 340px); pointer-events: none; z-index: -1;
  background: url("/assets/halloween-graveyard.webp") center bottom / cover no-repeat; }
.hw-sil { fill: #07040b; }
@media (max-width: 720px) { .hw-tree { height: 240px; bottom: 40px; } .hw-horizon { height: 200px; } }

/* ── Fog ── */
.hw-fog { position: fixed; left: 0; right: 0; bottom: -60px; height: 300px; pointer-events: none; z-index: 0; overflow: hidden; }
.hw-fog i { position: absolute; bottom: 0; width: 70vw; height: 220px; border-radius: 50%; filter: blur(40px); opacity: .22; }
.hw-fog i:nth-child(1) { left: -15vw; background: #b9a6d8; animation: hw-drift 26s ease-in-out infinite alternate; }
.hw-fog i:nth-child(2) { right: -20vw; background: #9d4dff; opacity: .16; bottom: 20px; animation: hw-drift 32s ease-in-out infinite alternate-reverse; }
.hw-fog i:nth-child(3) { left: 20vw; width: 60vw; height: 160px; background: #ff7a1a; opacity: .1; animation: hw-drift 21s ease-in-out infinite alternate; }
@keyframes hw-drift { to { transform: translateX(12vw); } }

/* ── Bats ── */
.hw-bat, .hw-chaser { position: fixed; left: 0; top: 0; width: 64px; height: 34px; margin: -17px 0 0 -32px; pointer-events: none; z-index: 1;
  will-change: transform; transition: opacity .4s; }
.hw-chaser { z-index: 60; width: 40px; height: 21px; margin: -10px 0 0 -20px; }
.hw-bat svg, .hw-chaser svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 0 5px #9d4dff66); }
.hw-bat path, .hw-chaser path { fill: #0b0612; stroke: #b98bff99; stroke-width: .55; stroke-linejoin: round; }
.hw-bat .bone, .hw-chaser .bone { fill: none; stroke: #5b3a86; stroke-width: .7; stroke-linecap: round; }
.hw-bat .body, .hw-chaser .body { fill: #120a1c; }
.hw-bat .eye, .hw-chaser .eye { fill: #ffae4a; filter: drop-shadow(0 0 1.5px #ff8a1a); }
/* each wing swings from its shoulder: up, then a strong downstroke that folds slightly (perspective) */
.hw-bat .w, .hw-chaser .w { transform-box: view-box; animation: hw-wing-l var(--flap, .24s) cubic-bezier(.45,0,.55,1) infinite alternate; }
.hw-bat .w.l, .hw-chaser .w.l { transform-origin: 30px 15px; }
.hw-bat .w.r, .hw-chaser .w.r { transform-origin: 34px 15px; animation-name: hw-wing-r; }
@keyframes hw-wing-l { from { transform: rotate(28deg) scaleY(1); } to { transform: rotate(-38deg) scaleY(.55); } }
@keyframes hw-wing-r { from { transform: rotate(-28deg) scaleY(1); } to { transform: rotate(38deg) scaleY(.55); } }

/* ── Changelog: Halloween tag on the newest release ── */
.hw-tag { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 2px 10px; border-radius: 999px; font: 700 11px var(--display);
  letter-spacing: .5px; color: #ffd2a8; background: linear-gradient(90deg, #ff7a1a2a, #9d4dff2a); border: 1px solid #ff7a1a66; vertical-align: middle; }

@media (max-width: 720px) {
  .hw-web, .hw-moon { display: none; }
  .hw-banner-inner { font-size: 13px; padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hw-bat, .hw-chaser { display: none; }
  .hw-fog i, .hw-spider, .hw-pumpkin { animation: none; }
}

/* ── Teaser countdown (before the event; shown without the Halloween theme) ── */
.hw-teaser { position: relative; z-index: 5; display: flex; justify-content: center; padding: 12px clamp(16px, 5vw, 64px) 0; }
.hw-teaser-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 10px 18px;
  border-radius: 16px; border: 1px solid transparent; color: #e9dcff;
  background: linear-gradient(#0d0814f2, #0d0814f2) padding-box, linear-gradient(90deg, #ff7a1a, #9d4dff) border-box;
  box-shadow: 0 10px 40px #ff7a1a1a, 0 0 60px #9d4dff1f; }
.hw-teaser-text { font: 700 15px var(--display); letter-spacing: .4px; }
.hw-clock { display: inline-flex; gap: 8px; }
.hw-unit { display: inline-flex; flex-direction: column; align-items: center; min-width: 50px; padding: 5px 8px 4px; border-radius: 10px;
  background: #ff7a1a14; border: 1px solid #ff7a1a40; }
.hw-unit b { font: 700 20px/1.1 var(--mono); color: #ffb36b; text-shadow: 0 0 12px #ff7a1a99; }
.hw-unit i { font: 600 10px var(--display); font-style: normal; letter-spacing: 1px; text-transform: uppercase; color: #b9a6d8; }
@media (max-width: 720px) { .hw-teaser-inner { gap: 10px; padding: 10px 12px; } .hw-unit { min-width: 42px; } .hw-unit b { font-size: 17px; } }

/* ── Docked countdown (appears on the side once the bar scrolls away) ── */
.hw-dock { position: fixed; left: clamp(14px, 2vw, 28px); top: 50%; z-index: 8; pointer-events: none;
  transform: translate(calc(-100% - 40px), -50%) rotate(-6deg); opacity: 0;
  transition: transform .55s cubic-bezier(.2, 1.25, .35, 1), opacity .35s ease; }
.hw-dock.show { transform: translate(0, -50%) rotate(0); opacity: 1; pointer-events: auto; }
.hw-dock-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 132px; padding: 14px 10px 12px;
  border-radius: 20px; cursor: pointer; color: #e9dcff; font: inherit; border: 1px solid transparent; isolation: isolate;
  background: linear-gradient(#0d0814f0, #0d0814f0) padding-box, linear-gradient(160deg, #ff7a1a, #9d4dff 70%, #9bff5c) border-box;
  box-shadow: 0 18px 50px #000a, 0 0 40px #ff7a1a26; backdrop-filter: blur(10px);
  animation: hw-float 5s ease-in-out infinite; transition: box-shadow .2s ease; }
.hw-dock-card:hover { box-shadow: 0 18px 50px #000a, 0 0 60px #ff7a1a55; }
.hw-dock-card:focus-visible, .hw-dock-close:focus-visible { outline: 2px solid #ffb36b; outline-offset: 3px; }
.hw-dock-card .hw-pumpkin { width: 34px; height: 34px; }
.hw-dock-kicker { font: 700 11px var(--display); letter-spacing: 2px; text-transform: uppercase; color: #ffb36b; }
.hw-dock-rows { display: grid; gap: 4px; width: 100%; }
.hw-dock-row { display: flex; align-items: baseline; justify-content: space-between; padding: 3px 10px; border-radius: 9px;
  background: #ff7a1a10; border: 1px solid #ff7a1a2e; }
.hw-dock-row b { font: 700 19px/1.15 var(--mono); color: #ffb36b; text-shadow: 0 0 12px #ff7a1a88; }
.hw-dock-row i { font: 600 10px var(--display); font-style: normal; letter-spacing: 1px; text-transform: uppercase; color: #b9a6d8; }
.hw-dock-mini { display: none; }
.hw-dock-close { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #3e2a45;
  background: #150e1d; color: #b9a6d8; font: 700 15px/1 system-ui, sans-serif; cursor: pointer; opacity: 0; transition: opacity .2s; }
.hw-dock:hover .hw-dock-close, .hw-dock:focus-within .hw-dock-close { opacity: 1; }
.hw-dock.soon .hw-dock-card { box-shadow: 0 18px 50px #000a, 0 0 70px #ff7a1a66; }
@keyframes hw-float { 50% { translate: 0 -6px; } }

/* Bubble mode (not enough empty space beside the content): a small pumpkin in the bottom-left corner */
.hw-dock.bubble { top: auto; bottom: 22px; transform: translate(calc(-100% - 30px), 0) scale(.6); }
.hw-dock.bubble.show { transform: none; }
.hw-dock.bubble .hw-dock-card { width: 56px; height: 56px; padding: 0; justify-content: center; gap: 0; border-radius: 18px; animation: none; }
.hw-dock.bubble .hw-dock-card .hw-pumpkin { width: 28px; height: 28px; margin-top: -6px; }
.hw-dock.bubble .hw-dock-kicker, .hw-dock.bubble .hw-dock-rows { display: none; }
.hw-dock.bubble .hw-dock-mini { display: block; position: absolute; bottom: 4px; font: 700 11px var(--mono); color: #ffb36b; }
.hw-dock.bubble .hw-dock-close { display: none; }
.hw-dock.bubble.open .hw-dock-card { width: 132px; height: auto; padding: 14px 10px 12px; gap: 6px; border-radius: 20px; }
.hw-dock.bubble.open .hw-dock-card .hw-pumpkin { margin-top: 0; }
.hw-dock.bubble.open .hw-dock-kicker, .hw-dock.bubble.open .hw-dock-rows { display: grid; }
.hw-dock.bubble.open .hw-dock-kicker { display: block; }
.hw-dock.bubble.open .hw-dock-mini { display: none; }

@media (prefers-reduced-motion: reduce) {
  .hw-dock, .hw-dock-card { transition: opacity .2s; animation: none; }
}
