/* Seasonal site themes (includes/site-theme.php + assets/js/festive.js).
   Everything here is decoration: it never takes clicks except the small
   hide/show toggle and the greeting pill. */

.fx-root {
    --fx-h: clamp(64px, 10vw, 118px);   /* base height of the corner artwork */
    --fx-left-h: var(--fx-h);           /* height of the left group (toggle sits above it) */
    --fx-left-x: 10px;
    position: fixed;
    inset: 0;
    z-index: 1050;                      /* above page chrome, below suggest-book tab (1100), shelf sheet (1200), toasts */
    pointer-events: none;
    overflow: hidden;
}
.fx-root.fx-in-admin { --fx-left-x: calc(var(--sidebar-width, 260px) + 10px); }
.fx-deco { transition: opacity .4s ease; }
.fx-root.fx-hidden .fx-deco { opacity: 0; visibility: hidden; }

/* ---------- Top strip (scrolls away after the first screenful) ---------- */
.fx-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    transition: transform .45s ease, opacity .45s ease;
}
.fx-root.fx-scrolled .fx-top { transform: translateY(-110%); opacity: 0; }

.fx-top-toran {
    height: 40px;
    background: url(../img/festive/toran.svg) repeat-x 0 0 / 124px 40px;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3));
}
.fx-top-lights {
    height: 36px;
    background: url(../img/festive/lights.svg) repeat-x 0 0 / 130px 36px;
}
.fx-top-halloween { height: 0; }
.fx-top-halloween::before,
.fx-top-halloween::after {
    content: "";
    position: absolute;
    top: 0;
    background-repeat: no-repeat;
    background-size: contain;
}
.fx-top-halloween::before {                 /* cobweb, top-left */
    left: 0;
    width: clamp(90px, 13vw, 170px);
    height: clamp(90px, 13vw, 170px);
    background-image: url(../img/festive/cobweb.svg);
}
.fx-top-halloween::after {                  /* spider, top-right */
    right: clamp(40px, 9vw, 140px);
    width: 50px;
    height: 184px;
    background-image: url(../img/festive/spider.svg);
}
.fx-in-admin .fx-top-halloween::before { left: var(--sidebar-width, 260px); }

/* ---------- Corner artwork ---------- */
.fx-corner {
    position: fixed;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    transition: opacity .4s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35));
}
.fx-left { left: var(--fx-left-x); }
.fx-right { right: 10px; }
.fx-art { display: block; height: var(--fx-h); width: auto; user-select: none; -webkit-user-drag: none; }
.fx-root.fx-at-end .fx-corner { opacity: .18; }   /* let the footer breathe */

.fx-diya    { height: calc(var(--fx-h) * .95); }
.fx-sweets  { height: calc(var(--fx-h) * .8); margin-left: -8px; }
.fx-anar    { height: calc(var(--fx-h) * 1.55); }
.fx-pumpkin { height: var(--fx-h); }
.fx-ghost   { height: calc(var(--fx-h) * 1.15); }
.fx-tree    { height: calc(var(--fx-h) * 1.4); }
.fx-snowman { height: calc(var(--fx-h) * 1.2); }

.fx-diwali    { --fx-left-h: calc(var(--fx-h) * .95); }
.fx-christmas { --fx-left-h: calc(var(--fx-h) * 1.4); }

/* ---------- Effects canvas + flying bats ---------- */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-bat {
    position: absolute;
    top: 0; left: 0;
    width: 64px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
    will-change: transform;
}

/* ---------- Hide / show toggle ---------- */
.fx-toggle {
    position: fixed;
    left: var(--fx-left-x);
    bottom: calc(var(--fx-left-h) + 8px);
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 14px;
    background: rgba(20, 14, 10, .55);
    color: #fff;
    font: 600 11.5px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    cursor: pointer;
    opacity: .55;
    backdrop-filter: blur(4px);
    transition: opacity .2s ease, bottom .4s ease;
}
.fx-toggle:hover, .fx-toggle:focus-visible { opacity: 1; outline: none; box-shadow: 0 0 0 2px rgba(255, 213, 79, .7); }
.fx-toggle span { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .25s ease; }
.fx-toggle:hover span, .fx-toggle:focus-visible span { max-width: 140px; }
.fx-root.fx-hidden .fx-toggle { bottom: 10px; }

/* ---------- Greeting pill ---------- */
.fx-greet {
    position: fixed;
    top: 48px;
    left: 50%;
    max-width: min(560px, calc(100vw - 32px));
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    font: 600 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    pointer-events: auto;
    cursor: pointer;
    transform: translate(-50%, -16px);
    opacity: 0;
    transition: transform .5s cubic-bezier(.2, .9, .3, 1.2), opacity .4s ease;
}
.fx-greet.show { transform: translate(-50%, 0); opacity: 1; }
.fx-diwali .fx-greet    { background: linear-gradient(135deg, #b23a12, #e8890c); border: 1px solid #ffd27a; }
.fx-halloween .fx-greet { background: linear-gradient(135deg, #2b1b3d, #e65100); border: 1px solid #ffb74d; }
.fx-christmas .fx-greet { background: linear-gradient(135deg, #b71c1c, #1b5e20); border: 1px solid #fff; }

/* ---------- Small screens: lighter touch ---------- */
@media (max-width: 575.98px) {
    .fx-root { --fx-h: 58px; --fx-left-x: 6px; }
    .fx-right { display: none; }
    .fx-root.fx-in-admin { --fx-left-x: 6px; }
    .fx-in-admin .fx-top-halloween::before { left: 0; }
    .fx-greet { top: 40px; left: 16px; right: 16px; max-width: none; font-size: 13px; border-radius: 18px; transform: translateY(-16px); }
    .fx-greet.show { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .fx-canvas, .fx-bat { display: none; }
    .fx-top, .fx-greet, .fx-toggle { transition: none; }
}

@media print {
    .fx-root { display: none !important; }
}
