/* Seasonal Halloween decoration – loaded only between 1 Oct and 1 Nov */

/* Cobwebs on photos */
.theme-halloween .sb-photo, .theme-halloween .sb-inspiration-tile { position: relative; }
.theme-halloween .sb-photo::before, .theme-halloween .sb-inspiration-tile::before {
    content: ''; position: absolute; top: 0; right: 0; z-index: 1; pointer-events: none;
    width: 34%; max-width: 130px; aspect-ratio: 1;
    background: url(/images/halloween/web-corner.svg) no-repeat top right / contain;
}
.theme-halloween .sb-photo > span, .theme-halloween .sb-photo > button { z-index: 2; }
.theme-halloween .sb-photo > .absolute.bottom-0, .theme-halloween .sb-inspiration-tile > .sb-tile-label { z-index: 2; }

/* A spider dangling on some cards */
.theme-halloween .space-y-5 > article:nth-child(odd) .sb-photo::after,
.theme-halloween .grid > :nth-child(3n+2) .sb-photo::after,
.theme-halloween .grid > :nth-child(3n+2).sb-photo::after,
.theme-halloween .grid > :nth-child(3n+2).sb-inspiration-tile::after {
    content: ''; position: absolute; top: 0; right: 18%; z-index: 1; pointer-events: none;
    width: 22px; height: 66px;
    background: url(/images/halloween/spider.svg) no-repeat bottom center / contain;
    transform-origin: top center; animation: sb-spider-bob 4.5s ease-in-out infinite;
}
@keyframes sb-spider-bob {
    0%, 100% { transform: translateY(-8px) rotate(-3deg); }
    50% { transform: translateY(6px) rotate(3deg); }
}

/* Bats over the search heroes (wing flap is animated inside the SVG) */
.sb-bats { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.sb-bat {
    position: absolute; left: 0; top: var(--y, 15%); width: 64px; height: 32px; will-change: transform;
    background: url(/images/halloween/bat-slow-v2.svg) no-repeat center / contain;
    animation: sb-swoop-ltr 16s linear infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.15));
}
.sb-bat.is-fast { background-image: url(/images/halloween/bat-fast-v2.svg); }
.sb-bat--3, .sb-bat--5 { background-image: url(/images/halloween/bat-v2.svg); }
.sb-bat--1 { --y: 14%; --s: 1; animation-duration: 15s; }
.sb-bat--2 { --y: 30%; --s: .6; animation-name: sb-swoop-rtl; animation-duration: 19s; animation-delay: -7s; opacity: .8; }
.sb-bat--3 { --y: 8%;  --s: .75; animation-duration: 23s; animation-delay: -15s; opacity: .9; }
.sb-bat--4 { --y: 48%; --s: .45; animation-name: sb-swoop-rtl; animation-duration: 27s; animation-delay: -3s; opacity: .55; }
.sb-bat--5 { --y: 22%; --s: 1.25; animation-duration: 21s; animation-delay: -11s; }
.sb-bat--loop { left: auto; right: 12%; top: 10%; --s: .7; animation: sb-loop 7s ease-in-out infinite; }
@keyframes sb-swoop-ltr {
    0%   { transform: translate(-12vw, 0) scale(var(--s)) rotate(8deg); }
    20%  { transform: translate(14vw, 40px) scale(var(--s)) rotate(-6deg); }
    40%  { transform: translate(38vw, -10px) scale(calc(var(--s) * 1.1)) rotate(5deg); }
    60%  { transform: translate(62vw, 30px) scale(var(--s)) rotate(-8deg); }
    80%  { transform: translate(86vw, -20px) scale(calc(var(--s) * .9)) rotate(4deg); }
    100% { transform: translate(112vw, 0) scale(var(--s)) rotate(0); }
}
@keyframes sb-swoop-rtl {
    0%   { transform: translate(112vw, 0) scale(var(--s)) rotate(-8deg); }
    25%  { transform: translate(80vw, 36px) scale(var(--s)) rotate(6deg); }
    50%  { transform: translate(50vw, -14px) scale(var(--s)) rotate(-4deg); }
    75%  { transform: translate(20vw, 24px) scale(var(--s)) rotate(7deg); }
    100% { transform: translate(-12vw, 0) scale(var(--s)) rotate(0); }
}
@keyframes sb-loop {
    0%   { transform: translate(0, 0) scale(var(--s)) rotate(0); }
    25%  { transform: translate(-60px, 26px) scale(calc(var(--s) * 1.1)) rotate(-12deg); }
    50%  { transform: translate(-10px, 46px) scale(var(--s)) rotate(6deg); }
    75%  { transform: translate(44px, 18px) scale(calc(var(--s) * .9)) rotate(12deg); }
    100% { transform: translate(0, 0) scale(var(--s)) rotate(0); }
}

/* Jack-o'-lanterns (flicker is animated inside the SVG) */
.sb-pumpkins { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.sb-pumpkin { position: absolute; height: auto; filter: drop-shadow(0 10px 14px rgba(0,0,0,.18)); }
.sb-pumpkins--home .sb-pumpkin--l1 { left: 3%; bottom: 14px; width: clamp(80px, 11vw, 150px); }
.sb-pumpkins--home .sb-pumpkin--l2 { left: calc(3% + clamp(62px, 8.5vw, 118px)); bottom: 10px; width: clamp(48px, 6vw, 86px); }
.sb-pumpkins--home .sb-pumpkin--r1 { right: 4%; bottom: 12px; width: clamp(70px, 9vw, 128px); transform: scaleX(-1); }
.sb-pumpkins--search { display: none; }
@media (min-width: 768px) {
    .sb-pumpkins--search { display: block; }
    .sb-pumpkins--search .sb-pumpkin--s1 { right: 6%; top: 196px; width: 112px; }
    .sb-pumpkins--search .sb-pumpkin--s2 { right: calc(6% + 92px); top: 232px; width: 68px; transform: scaleX(-1); }
}
.sb-halloween-banner .sb-banner-pumpkin { width: 46px; height: auto; flex-shrink: 0; margin: -6px 0; }

.theme-halloween #sbHero > .sb-container, .theme-halloween .sb-hero-content { position: relative; z-index: 1; }

/* Halloween banner on search pages */
.sb-halloween-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px;
    padding: 12px 16px; border-radius: 16px; background: #1c2a24; color: #fff;
    font-size: 14px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.4);
}
.sb-halloween-banner > span { flex: 1 1 220px; min-width: 0; color: rgba(255,255,255,.85) !important; }
.sb-halloween-banner strong { color: #fff; }
.sb-halloween-banner a {
    margin-left: auto; border-radius: 999px; background: #f28c28; color: #1c2a24 !important;
    padding: 8px 16px; font-weight: 700; text-decoration: none !important; white-space: nowrap;
}
.sb-halloween-banner a:hover { background: #ffa347; }
.sb-fp-preset.is-halloween { background: #1c2a24; border-color: #1c2a24; color: #fff; }
.sb-fp-preset.is-halloween:hover { background: #f28c28; color: #1c2a24; }

@media (prefers-reduced-motion: reduce) {
    .sb-bat, .theme-halloween .sb-photo::after, .theme-halloween .sb-inspiration-tile::after { animation: none !important; }
    .sb-bat { left: auto; right: 10%; top: 12%; transform: none; }
    .sb-bat:not(.sb-bat--1) { display: none; }
}

/* Little ghosts that pop up now and then (js/halloween.js) */
.hw-ghost {
    position: fixed; z-index: 9000; width: 52px; height: 62px; padding: 0; border: 0; cursor: pointer;
    background: url(/images/halloween/ghost.svg) no-repeat center / contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18));
    opacity: 0; transition: transform .7s cubic-bezier(.3,1.4,.5,1), opacity .4s ease;
}
.hw-ghost:focus-visible { outline: 3px solid #f28c28; outline-offset: 4px; border-radius: 12px; }
.hw-ghost--bottom { bottom: -64px; transform: translateY(0); }
.hw-ghost--bottom.is-in { opacity: 1; transform: translateY(-58px); animation: hw-bob 1.6s .7s ease-in-out infinite; }
.hw-ghost--left { left: -40px; transform: translateX(0) rotate(30deg); }
.hw-ghost--left.is-in { opacity: 1; transform: translateX(34px) rotate(18deg); }
.hw-ghost--right { right: -40px; transform: translateX(0) rotate(-30deg) scaleX(-1); }
.hw-ghost--right.is-in { opacity: 1; transform: translateX(-34px) rotate(-18deg) scaleX(-1); }
.hw-ghost--photo { position: absolute; z-index: 3; bottom: -8px; left: 14%; width: 46px; height: 56px; transform: translateY(100%); }
.hw-ghost--photo.is-in { opacity: 1; transform: translateY(8%); }
.hw-ghost.is-scared { opacity: 0 !important; transform: scale(1.5) translateY(-30px) !important; transition: transform .45s ease-out, opacity .45s ease-out; }
.hw-ghost.is-scared::after {
    content: 'Boo!'; position: absolute; left: 50%; top: -18px; transform: translateX(-50%);
    font: 800 14px/1 Poppins, system-ui, sans-serif; color: #f28c28; text-shadow: 0 1px 0 #fff;
}
@keyframes hw-bob { 0%, 100% { margin-bottom: 0; } 50% { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) {
    .hw-ghost, .hw-ghost.is-in { transition: opacity .4s ease; animation: none !important; }
    .hw-ghost--bottom, .hw-ghost--bottom.is-in { transform: translateY(-58px); }
    .hw-ghost--left, .hw-ghost--left.is-in { transform: translateX(34px) rotate(18deg); }
    .hw-ghost--right, .hw-ghost--right.is-in { transform: translateX(-34px) rotate(-18deg) scaleX(-1); }
    .hw-ghost--photo, .hw-ghost--photo.is-in { transform: translateY(8%); }
}
.sb-inspiration-tile .hw-ghost--photo { z-index: 1; left: auto; right: 12%; }

/* Pumpkin hunt */
.hw-hunt-pumpkin {
    display: inline-block; width: 30px; height: 26px; margin: 0 0 0 10px; padding: 0; border: 0; vertical-align: middle;
    background: url(/images/halloween/pumpkin.svg) no-repeat center / contain; cursor: pointer;
    animation: hw-wobble 3.2s ease-in-out infinite; transform-origin: 50% 100%;
}
.hw-hunt-pumpkin:hover { transform: scale(1.15); }
.hw-hunt-pumpkin:focus-visible { outline: 3px solid #f28c28; outline-offset: 3px; border-radius: 8px; }
.hw-hunt-pumpkin.is-collected { animation: hw-collect .8s ease-in forwards; }
@keyframes hw-wobble { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-12deg); } 94% { transform: rotate(10deg); } 97% { transform: rotate(-5deg); } }
@keyframes hw-collect { 30% { transform: translateY(-14px) scale(1.4); } 100% { transform: translateY(-60px) scale(.2); opacity: 0; } }

.hw-toasts { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 9995; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; }
.hw-toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; max-width: 420px;
    background: #1c2a24; color: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.45);
    font: 14px/1.45 Lato, system-ui, sans-serif; opacity: 0; transform: translateY(16px); transition: opacity .3s ease, transform .3s ease;
}
.hw-toast.is-in { opacity: 1; transform: none; }
.hw-toast strong { color: #fff; }
.hw-toast a { color: #f7a24b !important; font-weight: 700; text-decoration: underline; }
.hw-toast__icon { width: 38px; height: auto; flex-shrink: 0; }
.hw-toast__body { flex: 1; min-width: 0; color: rgba(255,255,255,.88); }
.hw-toast__parks { display: block; margin-top: 4px; font-size: 13px; }
.hw-toast__close { flex-shrink: 0; border: 0; background: none; color: rgba(255,255,255,.7); font-size: 22px; line-height: 1; padding: 0 2px; cursor: pointer; }

.hw-confetti { position: fixed; inset: 0; z-index: 9994; pointer-events: none; overflow: hidden; }
.hw-confetti span { position: absolute; top: -60px; background: no-repeat center / contain; animation: hw-fall linear forwards; }
@keyframes hw-fall { to { transform: translateY(115vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
    .hw-hunt-pumpkin, .hw-hunt-pumpkin.is-collected { animation: none; }
    .hw-hunt-pumpkin.is-collected { opacity: 0; transition: opacity .4s; }
    .hw-toast { transition: opacity .3s ease; transform: none; }
}

/* Pumpkin hunt levels 2 and 3 */
.hw-hunt-pumpkin--l2 { width: 20px; height: 17px; margin-left: 6px; opacity: .55; animation: none; }
.hw-hunt-pumpkin--l2:hover { opacity: 1; }
.hw-hunt-pumpkin--l3 { position: absolute; z-index: 3; width: 16px; height: 14px; margin: 0; opacity: .7; animation: none; }
.hw-hunt-pumpkin--l3:hover { opacity: 1; transform: scale(1.3); }
.hw-corner-tl { top: 8px; left: 8px; } .hw-corner-tr { top: 8px; right: 8px; }
.hw-corner-bl { bottom: 8px; left: 8px; } .hw-corner-br { bottom: 8px; right: 8px; }

/* Hunt tracker */
.hw-tracker {
    position: fixed; left: 16px; bottom: 16px; z-index: 9993; display: inline-flex; align-items: center; gap: 8px;
    border: 0; border-radius: 999px; background: #1c2a24; color: #fff; padding: 6px 14px 6px 8px; cursor: pointer;
    font: 700 12px/1 Lato, system-ui, sans-serif; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5);
}
.hw-tracker img { width: 26px; height: auto; }
.hw-tracker:hover { background: #2a3d35; }
.hw-tracker:focus-visible { outline: 3px solid #f28c28; outline-offset: 3px; }
html.hw-has-tracker .hw-toasts { bottom: 64px; }
html.sb-drawer-open .hw-tracker, html.sb-picker-open .hw-tracker { display: none; }
.hw-tracker span { color: #fff !important; }

/* Bigger invisible tap areas (~44px) without changing how big the pumpkins look */
.hw-hunt-pumpkin { box-sizing: content-box; padding: 9px; margin: -9px -9px -9px 1px; background-origin: content-box; background-clip: content-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hw-hunt-pumpkin--l2 { padding: 13px 12px; margin: -13px -12px -13px -6px; }
.hw-hunt-pumpkin--l3 { padding: 14px; margin: 0; }
.hw-corner-tl { top: 0; left: 0; } .hw-corner-tr { top: 0; right: 0; }
.hw-corner-bl { bottom: 0; left: 0; } .hw-corner-br { bottom: 0; right: 0; }
.hw-hunt-pumpkin--l3:hover { transform: none; }
.hw-hunt-pumpkin--l3:hover, .hw-hunt-pumpkin--l3:active { opacity: 1; }

/* Sit above card link overlays and gallery chrome */
.hw-hunt-pumpkin { position: relative; z-index: 20; }
.hw-hunt-pumpkin--l3 { position: absolute; z-index: 20; }

.hw-clues { margin: 6px 0 0; padding-left: 18px; list-style: disc; }
.hw-clues li { margin: 3px 0; color: rgba(255,255,255,.9); }
.hw-clues strong { color: #f7a24b !important; }
.hw-toast { max-height: 70vh; overflow-y: auto; }
.hw-corner-tl { top: 6px; left: 12px; } .hw-corner-tr { top: 6px; right: 12px; }
.hw-corner-bl { bottom: 6px; left: 12px; } .hw-corner-br { bottom: 6px; right: 12px; }
