/* Halloween theme (24 Oct - 1 Nov). Switched on by halloween.js via html.halloween. */

html.halloween {
  --accent: #ff7518;
  --pumpkin: #ff7518;
  --pumpkin-light: #ffa24d;
  --witch: #a35bff;
  --slime: #8dff3a;
}

/* ---- dark theme ---- */
html.halloween,
html.halloween body {
  background: radial-gradient(circle at 50% 35%, #2b1049, #0e0519 55%, #050209 100%);
}

html.halloween h1,
html.halloween .consent-card h2,
html.halloween .names {
  font-family: "Creepster", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .04em;
  font-weight: 400;
}
html.halloween h1 { font-size: 28px; text-wrap: balance; text-shadow: 0 0 14px #ff751866; }
html.halloween .names { font-size: 24px; }

html.halloween input[type="date"] { border-color: #ff751866; background: #ff75181a; }
html.halloween .btn { color: #1a0a00; box-shadow: 0 0 18px #ff751855; }
html.halloween .btn.ghost { background: #ffffff1f; color: #fff; box-shadow: none; }
html.halloween .error { color: #ffb066; }

/* tab bar, cards, dialogs */
html.halloween #tabbar { background: #0b0414d9; border-top-color: #a35bff33; }
html.halloween .tab.active { background: #a35bff33; }
html.halloween .tab.alert::after { background: var(--pumpkin); box-shadow: 0 0 10px var(--pumpkin); }
html.halloween .card,
html.halloween .cal,
html.halloween .gamecard { background: #a35bff14; box-shadow: inset 0 0 0 1px #a35bff22; }
html.halloween .card.next b { color: var(--pumpkin-light); }
html.halloween .big span { background: linear-gradient(180deg, #ffe3b8, var(--pumpkin)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px #ff751866); }
html.halloween .status { background: #a35bff22; }
html.halloween .consent-card { background: #1a0b2a; border-color: #ff751855; }
html.halloween #adult-note { border-color: #ff751888; }
html.halloween #adult-btn.glow { background: #ff751866; }
html.halloween .o-pick.active { background: #ff751866; }

/* calendar */
html.halloween .day.past { background: #ff751822; }
html.halloween .day.start { background: var(--pumpkin); color: #1a0a00; }
html.halloween .day.start::after { content: "🎃"; }
html.halloween .day.mark::after { background: var(--pumpkin-light); }

/* the hearts are still the kiss feedback, just not pink any more */
html.halloween .heart:nth-child(3n + 1) { color: var(--pumpkin); }
html.halloween .heart:nth-child(3n + 2) { color: var(--witch); }
html.halloween .heart:nth-child(3n) { color: var(--slime); }

/* lips: glow like embers, and grow fangs (injected by halloween.js) */
html.halloween #lips.level-1 { filter: drop-shadow(0 0 18px #ff751888); }
html.halloween #lips.level-2 { filter: drop-shadow(0 0 40px var(--pumpkin)) brightness(1.15); }
html.halloween #lips .fangs { fill: #f6f1e4; stroke: #c9c0a8; stroke-width: 1; stroke-linejoin: round; }

/* ---- scenery behind the app ---- */
#spooky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sp-moon {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  right: 8%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, #d9cfa6 0 7px, transparent 8px),
    radial-gradient(circle at 66% 30%, #d9cfa6 0 4px, transparent 5px),
    radial-gradient(circle at 58% 68%, #d9cfa6 0 9px, transparent 10px),
    radial-gradient(circle at 35% 30%, #fff8d8, #f1e3a1 60%, #d7c377);
  box-shadow: 0 0 30px 8px #f6e9a855, 0 0 90px 30px #a35bff33;
  opacity: .85;
}

.sp-web {
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  height: 110px;
  color: #ffffff55;
}
.sp-web svg { display: block; width: 100%; height: 100%; }

.sp-fog {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 34vh;
  background: radial-gradient(ellipse at 50% 100%, #b79be866, transparent 68%) 0 0 / 50% 100% repeat-x;
  opacity: .5;
  animation: fogdrift 40s linear infinite;
}
.sp-fog.f2 { height: 26vh; opacity: .4; animation-duration: 62s; animation-direction: reverse; }
@keyframes fogdrift {
  from { background-position-x: 0; }
  to   { background-position-x: -100vw; }
}

.sp-spider {
  position: absolute;
  top: -60px; /* the extra thread length hides above the screen while the spider bobs */
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: dangle 5s ease-in-out var(--delay) infinite;
}
.sp-spider .thread {
  display: block;
  width: 1px;
  height: calc(var(--len) + 60px);
  background: #ffffff88;
}
.sp-spider span { font-size: 26px; line-height: 1; margin-top: -2px; }
@keyframes dangle {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 50px); }
}

/* emoji drifting up the background, like the hearts */
.floater {
  position: absolute;
  bottom: -40px;
  font-size: var(--size);
  line-height: 1;
  opacity: 0;
  animation: spookfloat var(--dur) ease-in forwards;
}
@keyframes spookfloat {
  0%   { transform: translate(0, 0) rotate(-8deg) scale(.7); opacity: 0; }
  15%  { opacity: .4; }
  100% { transform: translate(var(--drift), -110vh) rotate(12deg) scale(1.1); opacity: 0; }
}

/* ---- bats ---- */
#spooky-fly {
  position: fixed;
  inset: 0;
  z-index: 2; /* over the screens, under the game, tab bar and 18+ overlay */
  overflow: hidden;
  pointer-events: none;
}
.bat {
  position: absolute;
  left: -90px;
  width: var(--size);
  animation: batfly var(--dur) linear forwards;
}
.bat.rtl { animation-name: batflyback; }
@keyframes batfly     { from { transform: translateX(0); }              to { transform: translateX(calc(100vw + 180px)); } }
@keyframes batflyback { from { transform: translateX(calc(100vw + 180px)); } to { transform: translateX(0); } }

.bat-bob { animation: batbob var(--bob-dur) ease-in-out infinite alternate; }
.bat.rtl .bat-bob svg { transform: scaleX(-1); }
@keyframes batbob { from { transform: translateY(calc(var(--bob) * -1)); } to { transform: translateY(var(--bob)); } }

.bat svg { display: block; width: 100%; overflow: visible; fill: #07020d; stroke: #8a4fd6; stroke-width: .9; stroke-linejoin: round; }
.bat svg .eye { fill: var(--pumpkin); stroke: none; }
.bat svg .wing { transform-box: fill-box; transform-origin: 50% 80%; animation: flap var(--flap) ease-in-out infinite alternate; }
.bat svg .wl { transform-origin: 100% 80%; }
.bat svg .wr { transform-origin: 0% 80%; }
@keyframes flap { from { transform: scaleY(1) rotate(0); } to { transform: scaleY(.25) rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  .sp-fog, .sp-spider { animation: none; }
  .sp-spider { transform: translateX(-50%); }
}
