/* ============================================================
   HXS Seasonal: Halloween
   Loaded by includes/hooks/seasonal_theme.php only while the theme is live.
   Everything is scoped to html.hxs-halloween so removing the class removes it all.
   ============================================================ */

/* Pumpkin orange accent, purple to orange gradient. Only the theme tokens change,
   so every component that already reads them follows along. */
html.hxs-halloween-recolor {
    --hxs-accent-primary:  #f97316;
    --hxs-accent-hover:    #fb923c;
    --hxs-border-solid:    #4a2f63;
    --hxs-accent-gradient: linear-gradient(135deg, #7c3aed 0%, #9333ea 30%, #f97316 78%, #ef4444 100%);
}
html.hxs-halloween-recolor .form-control:focus,
html.hxs-halloween-recolor select:focus,
html.hxs-halloween-recolor input:focus,
html.hxs-halloween-recolor textarea:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22) !important;
}
html.hxs-halloween-recolor ::selection {
    background: rgba(147, 51, 234, 0.45);
    color: #fff;
}

/* A low harvest moon behind the page: a violet haze top right, an ember glow
   bottom left. Painted on a fixed layer so it does not fight the body gradient. */
html.hxs-halloween body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 55% 45% at 88% 4%, rgba(124, 58, 237, 0.16), transparent 70%),
        radial-gradient(ellipse 50% 40% at 6% 100%, rgba(249, 115, 22, 0.09), transparent 70%);
}

/* Cobwebs hang in the top corners of the page and scroll away with it. They
   live in the page layer below, so cards cover them like everything else. */
.hxs-hw-web {
    position: absolute;
    top: 0;
    width: 220px;
    height: 220px;
    opacity: 0.55;
}
.hxs-hw-web--left  { left: 0; }
.hxs-hw-web--right { right: 0; transform: scaleX(-1); }

/* Jack-o-lanterns resting on the top edge of the footer, sunk a few pixels so
   they sit on it rather than hover above it. */
.hxs-hw-patch {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 0;
    pointer-events: none;
}
.hxs-hw-group {
    position: absolute;
    bottom: -9px;
    display: flex;
    align-items: flex-end;
}
.hxs-hw-group--left  { left: max(16px, 5vw); }
.hxs-hw-group--right { right: max(16px, 5vw); }
.hxs-hw-pumpkin {
    display: block;
    position: relative;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45));
}
.hxs-hw-pumpkin svg { display: block; width: 100%; height: auto; }
.hxs-hw-pumpkin--lg { width: 78px; }
.hxs-hw-pumpkin--md { width: 58px; margin-right: -10px; }
.hxs-hw-pumpkin--sm { width: 42px; margin-left: -12px; }
.hxs-hw-fallen {
    width: 17px;
    height: 17px;
    margin: 0 2px 3px;
    flex: none;
    opacity: 0.9;
}

/* Candlelight spilling onto the footer under each group. */
.hxs-hw-candlelight {
    position: absolute;
    left: 50%;
    top: calc(100% - 22px);
    width: 260px;
    height: 90px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse 50% 50% at 50% 30%, rgba(251, 146, 60, 0.26), rgba(251, 146, 60, 0.08) 55%, transparent 75%);
    animation: hxs-hw-candle 3.1s ease-in-out infinite;
}
.hxs-hw-flame { animation: hxs-hw-flicker 2.4s linear infinite; }
.hxs-hw-group--right .hxs-hw-flame { animation-duration: 2.9s; animation-delay: -1.1s; }
.hxs-hw-group--right .hxs-hw-candlelight { animation-delay: -1.6s; }

/* Irregular steps so it reads as a flame and not as a pulse. */
@keyframes hxs-hw-flicker {
    0%, 100% { opacity: 1; }
    9%  { opacity: 0.82; }
    14% { opacity: 0.97; }
    31% { opacity: 0.88; }
    38% { opacity: 1; }
    56% { opacity: 0.78; }
    61% { opacity: 0.95; }
    79% { opacity: 0.86; }
}
@keyframes hxs-hw-candle {
    0%, 100% { opacity: 0.85; }
    23% { opacity: 1; }
    47% { opacity: 0.7; }
    68% { opacity: 0.95; }
}

/* The page layer: the first thing in <body>, zero height and in normal flow,
   so it scrolls with the content (this theme scrolls <body>, not the window).
   z-index 1 puts it over the section backgrounds; the script raises cards,
   buttons and text to z-index 1 as well, and being later in the page they paint
   over it, so the critters pass behind them. The footer, sticky order bar and
   navbar are higher still. Never takes a click. */
.hxs-hw-layer {
    position: relative;
    height: 0;
    z-index: 1;
    pointer-events: none;
}
.hxs-hw-clip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
}
.hxs-hw-layer.is-still .hxs-hw-sprite,
.hxs-hw-layer.is-still .hxs-hw-thread { display: none; }

/* A raised card is its own stacking level, so a dropdown opened inside it would
   slide under the next card. Bring the card forward while anything in it is
   open or focused. */
[data-hxs-hw-lift]:focus-within,
[data-hxs-hw-lift]:has(.show) {
    z-index: 5 !important;
}

.hxs-hw-sprite {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
}
.hxs-hw-leaf { overflow: visible; }
.hxs-hw-thread {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    will-change: transform, height;
    background: linear-gradient(to bottom, rgba(226, 220, 240, 0), rgba(226, 220, 240, 0.45) 80px);
}

/* The spider toggle. Bottom left, clear of the live chat launcher (bottom right). */
.hxs-hw-toggle {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 1031;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 10px;
    border-radius: 20px;
    border: 1px solid rgba(249, 115, 22, 0.35);
    background: rgba(18, 13, 26, 0.88);
    color: #f3e8ff;
    font: 600 12.5px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(249, 115, 22, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, bottom 0.28s cubic-bezier(.22, .61, .36, 1);
}
.hxs-hw-toggle.is-lifted { bottom: calc(var(--hxs-hw-lift, 0px) + 12px); }
.hxs-hw-toggle:hover {
    border-color: rgba(249, 115, 22, 0.7);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 22px rgba(249, 115, 22, 0.25);
}
.hxs-hw-toggle:focus-visible {
    outline: 2px solid #fb923c;
    outline-offset: 3px;
}
.hxs-hw-toggle svg {
    width: 20px;
    height: 20px;
    flex: none;
}
.hxs-hw-toggle[aria-pressed="false"] svg { opacity: 0.45; }

/* Collapse to the icon on narrow screens and sit above the sticky order bar. */
@media (max-width: 782px) {
    .hxs-hw-toggle {
        bottom: 96px;
        left: 12px;
        width: 40px;
        padding: 0;
        justify-content: center;
    }
    .hxs-hw-toggle.is-lifted { bottom: max(96px, calc(var(--hxs-hw-lift, 0px) + 12px)); }
    .hxs-hw-toggle span { display: none; }
    .hxs-hw-web { width: 140px; height: 140px; }
    .hxs-hw-pumpkin--lg { width: 60px; }
    .hxs-hw-pumpkin--md { width: 46px; }
    .hxs-hw-pumpkin--sm { width: 34px; }
}
/* On a phone one group is plenty, and the left one would sit under the toggle. */
@media (max-width: 520px) {
    .hxs-hw-group--left { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hxs-hw-flame, .hxs-hw-candlelight { animation: none; }
}

@media print {
    .hxs-hw-web, .hxs-hw-layer, .hxs-hw-toggle, .hxs-hw-patch { display: none !important; }
}
