/* =====================================================
   MONDO SENZA TEMPO — Tema Halloween 🎃
   -----------------------------------------------------
   Tutte le regole sono scoped su `html.theme-halloween`:
   a tema spento questo file NON ha alcun effetto.
   La classe viene aggiunta/rimossa da js/halloween-theme.js
   in base a site_settings (tema_halloween_attivo + scadenza).
   ===================================================== */

html.theme-halloween {
    --hw-bg:        #140a1e;
    --hw-bg-2:      #1d1030;
    --hw-bg-3:      #251540;
    --hw-orange:    #ff7a1a;
    --hw-orange-2:  #ffa040;
    --hw-orange-d:  #d85f00;
    --hw-purple:    #8e44ad;
    --hw-purple-l:  #c084fc;
    --hw-text:      #f6ecff;
    --hw-muted:     #c9b8de;
    --hw-border:    rgba(255, 122, 26, 0.35);
    --hw-glow:      0 0 24px rgba(255, 122, 26, 0.45);

    /* Rimappa le variabili oro del tema base sull'arancio zucca */
    --gold:        var(--hw-orange);
    --gold-light:  var(--hw-orange-2);
    --gold-dark:   var(--hw-orange-d);
    --border-gold: var(--hw-border);
    --shadow-gold: var(--hw-glow);
    --shadow-green: 0 8px 32px rgba(142, 68, 173, 0.35);
}

/* ===== BASE ===== */
html.theme-halloween body {
    background-color: var(--hw-bg);
    color: var(--hw-text);
}
html.theme-halloween ::-webkit-scrollbar-track { background: var(--hw-bg); }
html.theme-halloween ::-webkit-scrollbar-thumb { background: var(--hw-orange-d); }

html.theme-halloween .gold-text {
    color: var(--hw-orange);
    text-shadow: 0 0 18px rgba(255, 122, 26, 0.55);
}

/* ===== NAVBAR ===== */
html.theme-halloween #navbar,
html.theme-halloween #navbar.scrolled {
    background: rgba(20, 10, 30, 0.94);
    border-bottom: 1px solid var(--hw-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 122, 26, 0.25);
}
html.theme-halloween .nav-link { color: var(--hw-text) !important; }
html.theme-halloween .nav-link:hover {
    color: var(--hw-orange) !important;
    background: rgba(255, 122, 26, 0.12);
}
html.theme-halloween .nav-logo { color: var(--hw-orange); }
html.theme-halloween .nav-logo-img {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    padding: 4px;
}
html.theme-halloween .nav-btn-register {
    background: var(--hw-orange);
    border-color: var(--hw-orange);
    color: #1a0b00 !important;
}
html.theme-halloween .nav-btn-register:hover { background: var(--hw-orange-2); }
html.theme-halloween .nav-toggle,
html.theme-halloween .nav-toggle span { color: var(--hw-text); background-color: var(--hw-text); }
html.theme-halloween .nav-links.active,
html.theme-halloween .nav-links.open {
    background: rgba(20, 10, 30, 0.98);
}

/* ===== HERO ===== */
html.theme-halloween .hero-section {
    background:
        radial-gradient(ellipse at 78% 18%, rgba(255, 160, 64, 0.30) 0%, rgba(255, 122, 26, 0.10) 18%, transparent 40%),
        linear-gradient(to bottom, rgba(20, 10, 30, 0.80) 0%, rgba(29, 16, 48, 0.78) 55%, rgba(20, 10, 30, 0.96) 100%),
        url('../images/hero-bg.jpg') center center / cover no-repeat;
}
/* Luna arancione */
html.theme-halloween .hero-section::before {
    content: '';
    position: absolute;
    top: 110px; right: 8%;
    width: 150px; height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #ffd9a8 0%, #ffa040 45%, #ff7a1a 100%);
    box-shadow: 0 0 60px 18px rgba(255, 140, 40, 0.45), 0 0 140px 50px rgba(255, 122, 26, 0.18);
    opacity: 0.92;
    inset: auto;
    z-index: 0;
    pointer-events: none;
}
html.theme-halloween .hero-logo-img {
    filter: drop-shadow(0 8px 32px rgba(255, 122, 26, 0.65));
}
html.theme-halloween .hero-title {
    color: var(--hw-text);
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}
html.theme-halloween .hero-subtitle {
    color: var(--hw-muted) !important;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
html.theme-halloween .hero-badge,
html.theme-halloween .section-badge {
    color: var(--hw-orange-2);
    border-color: rgba(255, 122, 26, 0.55);
    background: rgba(255, 122, 26, 0.12);
}
html.theme-halloween .hw-hero-badge {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffd9a8;
    padding: 8px 22px;
    margin-bottom: 18px;
    border-radius: 50px;
    border: 1px solid rgba(255, 122, 26, 0.6);
    background: linear-gradient(135deg, rgba(255, 122, 26, 0.22), rgba(142, 68, 173, 0.25));
    box-shadow: var(--hw-glow);
    animation: hwPulse 2.6s ease-in-out infinite;
}
/* Barra "Cerca specialista": il contenitore esterno resta trasparente,
   la pillola interna diventa vetro scuro con bordo e bottone arancio */
html.theme-halloween .hero-search-bar { background: transparent; }
html.theme-halloween .hero-search-wrap {
    background: rgba(29, 16, 48, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 122, 26, 0.55);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 122, 26, 0.22);
}
html.theme-halloween .hero-search-wrap:focus-within {
    border-color: var(--hw-orange);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 30px rgba(255, 122, 26, 0.45);
}
html.theme-halloween .hero-search-icon { color: var(--hw-orange-2); }
html.theme-halloween .hero-search-input {
    background: transparent;
    color: var(--hw-text);
}
html.theme-halloween .hero-search-input::placeholder { color: var(--hw-muted); opacity: 1; }
html.theme-halloween .hero-search-btn {
    background: linear-gradient(135deg, var(--hw-orange-d), var(--hw-orange));
    color: #1a0b00;
    box-shadow: 0 4px 14px rgba(255, 122, 26, 0.45);
}
html.theme-halloween .hero-search-btn:hover {
    background: linear-gradient(135deg, var(--hw-orange), var(--hw-orange-2));
}
/* Dropdown risultati: chiaro e leggibile */
html.theme-halloween .hero-search-results {
    background: #fff8f0;
    border-color: var(--hw-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
html.theme-halloween .hero-search-result-item:hover { background: rgba(255, 122, 26, 0.10); }
html.theme-halloween .hero-search-result-nome { color: #1E2D40; }
html.theme-halloween .hero-search-result-spec { color: #6b6b6b; }
html.theme-halloween .hero-search-result-avatar { border-color: rgba(255, 122, 26, 0.5); }
html.theme-halloween .hero-stats,
html.theme-halloween .hero-stat-label { color: var(--hw-muted); }
html.theme-halloween .hero-stat-num { color: var(--hw-orange); }

/* ===== SEZIONI ===== */
html.theme-halloween section {
    background: var(--hw-bg) !important;
}
html.theme-halloween section:nth-of-type(even) {
    background: linear-gradient(180deg, var(--hw-bg-2) 0%, var(--hw-bg) 100%) !important;
}
html.theme-halloween .hero-section { /* la hero mantiene la sua immagine */
    background:
        radial-gradient(ellipse at 78% 18%, rgba(255, 160, 64, 0.30) 0%, rgba(255, 122, 26, 0.10) 18%, transparent 40%),
        linear-gradient(to bottom, rgba(20, 10, 30, 0.80) 0%, rgba(29, 16, 48, 0.78) 55%, rgba(20, 10, 30, 0.96) 100%),
        url('../images/hero-bg.jpg') center center / cover no-repeat !important;
}
html.theme-halloween .section-title {
    color: var(--hw-text);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}
html.theme-halloween .section-subtitle { color: var(--hw-muted); }
/* Testi liberi (fuori dalle card) direttamente su sfondo scuro */
html.theme-halloween .section-header h2,
html.theme-halloween .section-header p,
html.theme-halloween .contact-section > .container > p,
html.theme-halloween .hblog-section > p { color: var(--hw-text); }

/* ===== BOTTONI ===== */
html.theme-halloween .btn-primary,
html.theme-halloween .pcard-btn-main:hover {
    background: linear-gradient(135deg, var(--hw-orange-d), var(--hw-orange), var(--hw-orange-2));
    color: #1a0b00;
    box-shadow: 0 4px 22px rgba(255, 122, 26, 0.45);
}
html.theme-halloween .btn-primary:hover {
    background: linear-gradient(135deg, var(--hw-orange), var(--hw-orange-2), var(--hw-orange));
    box-shadow: 0 8px 32px rgba(255, 122, 26, 0.65);
}
html.theme-halloween .btn-secondary {
    background: rgba(142, 68, 173, 0.25);
    color: var(--hw-text);
    border: 1px solid rgba(192, 132, 252, 0.45);
}
html.theme-halloween .btn-secondary:hover { background: rgba(142, 68, 173, 0.45); }
html.theme-halloween .pcard-btn-main {
    border-color: var(--hw-orange);
    color: var(--hw-orange-d);
}

/* ===== CARD OPERATORI (restano chiare per leggibilità) ===== */
html.theme-halloween .pcard,
html.theme-halloween .psychic-card {
    background: #fff8f0;
    border: 1px solid var(--hw-border);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 122, 26, 0.08);
}
html.theme-halloween .pcard:hover,
html.theme-halloween .psychic-card:hover {
    border-color: var(--hw-orange);
    box-shadow: 0 12px 36px rgba(255, 122, 26, 0.35);
}
html.theme-halloween .psychic-card::before {
    background: linear-gradient(90deg, transparent, var(--hw-orange), var(--hw-purple), transparent);
}
html.theme-halloween .pcard-avatar-wrap {
    background: linear-gradient(180deg, rgba(255, 122, 26, 0.16) 0%, transparent 60%);
}
html.theme-halloween .pcard-avatar {
    border-color: var(--hw-orange) !important;
    box-shadow: 0 4px 18px rgba(255, 122, 26, 0.45);
}
/* Cappello da strega sull'avatar */
html.theme-halloween .pcard-avatar-wrap { position: relative; }
html.theme-halloween .pcard-avatar-wrap::after {
    content: '🎃';
    position: absolute;
    top: 14px;
    left: calc(50% + 34px);
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
    pointer-events: none;
    animation: hwBob 3s ease-in-out infinite;
}

/* Card generiche (corsi, shop, blog, testimonial, contatti) */
html.theme-halloween .course-card,
html.theme-halloween .product-card,
html.theme-halloween .hblog-card,
html.theme-halloween .testimonial-card,
html.theme-halloween .contact-card,
html.theme-halloween .card-reading-box,
html.theme-halloween .libro-card {
    background: #fff8f0;
    border-color: var(--hw-border);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
}

/* Testo SEMPRE scuro dentro le card chiare (recensioni, corsi, shop, blog, libri, contatti) */
html.theme-halloween .testimonial-card,
html.theme-halloween .testimonial-card p,
html.theme-halloween .testimonial-text,
html.theme-halloween .course-card,
html.theme-halloween .course-card p,
html.theme-halloween .product-card,
html.theme-halloween .product-card p,
html.theme-halloween .hblog-card,
html.theme-halloween .hblog-card p,
html.theme-halloween .contact-card,
html.theme-halloween .contact-card p,
html.theme-halloween .libro-card,
html.theme-halloween .libro-card p,
html.theme-halloween .pcard,
html.theme-halloween .pcard p,
html.theme-halloween .psychic-card,
html.theme-halloween .psychic-card p,
html.theme-halloween .card-reading-box,
html.theme-halloween .card-reading-box p {
    color: #3a3a3a;
}
html.theme-halloween .testimonial-card h3,
html.theme-halloween .testimonial-card h4,
html.theme-halloween .testimonial-card strong,
html.theme-halloween .author-info strong,
html.theme-halloween .course-card h3,
html.theme-halloween .product-card h3,
html.theme-halloween .hblog-card h3,
html.theme-halloween .contact-card h3,
html.theme-halloween .libro-card h3,
html.theme-halloween .pcard h3,
html.theme-halloween .psychic-card h3 {
    color: #1E2D40;
}
html.theme-halloween .author-info span,
html.theme-halloween .testimonial-card small,
html.theme-halloween .hblog-card small,
html.theme-halloween .hblog-meta,
html.theme-halloween .course-card small,
html.theme-halloween .product-card small { color: #6b6b6b; }
html.theme-halloween .testimonial-stars { color: var(--hw-orange); }

/* Slider recensioni reali (.testi-*) */
html.theme-halloween .testi-card {
    background: #fff8f0;
    border-color: var(--hw-border);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
    color: #3a3a3a;
}
html.theme-halloween .testi-card:hover { border-color: var(--hw-orange); }
html.theme-halloween .testi-testo,
html.theme-halloween .testi-card p { color: #3a3a3a; }
html.theme-halloween .testi-stelle { color: var(--hw-orange); }
html.theme-halloween .testi-info strong { color: #1E2D40; }
html.theme-halloween .testi-info span { color: #6b6b6b; }
html.theme-halloween .testi-avatar { color: #1a0b00; }
html.theme-halloween .testi-card a,
html.theme-halloween .testi-leggi-tutto,
html.theme-halloween .testi-espandi { color: var(--hw-orange-d); }
html.theme-halloween .testi-risposta {
    background: linear-gradient(135deg, #fff1e3, #fff8f0);
    border-left-color: var(--hw-orange);
    color: #3a3a3a;
}
html.theme-halloween .testi-risposta-label,
html.theme-halloween .testi-risposta-testo { color: #4a4a4a; }
html.theme-halloween .testi-nav-btn,
html.theme-halloween .testi-arrow {
    background: rgba(255, 255, 255, 0.08);
    color: var(--hw-text);
    border-color: var(--hw-border);
}
html.theme-halloween .author-avatar { color: #1a0b00; }
/* Link "Leggi tutto" ecc. dentro card chiare: arancio scuro leggibile */
html.theme-halloween .testimonial-card a,
html.theme-halloween .hblog-card a:not(.btn-primary) { color: var(--hw-orange-d); }

/* Filtri / tab */
html.theme-halloween [data-libri-filter],
html.theme-halloween .filter-btn,
html.theme-halloween .shop-filter {
    background: rgba(255, 255, 255, 0.06);
    color: var(--hw-text);
    border-color: var(--hw-border);
}
html.theme-halloween [data-libri-filter].active,
html.theme-halloween .filter-btn.active,
html.theme-halloween .shop-filter.active {
    background: var(--hw-orange);
    color: #1a0b00;
}

/* Story circles (operatori online) */
html.theme-halloween .story-circle,
html.theme-halloween .story-ring {
    border-color: var(--hw-orange);
    box-shadow: 0 0 14px rgba(255, 122, 26, 0.45);
}
html.theme-halloween .story-name { color: var(--hw-text); }

/* ===== PAGINA OPERATORI (operatori.html) ===== */
html.theme-halloween .ops-page {
    background: linear-gradient(180deg, var(--hw-bg-2) 0%, var(--hw-bg) 100%);
}
html.theme-halloween .ops-hero__overlay {
    background: linear-gradient(180deg, rgba(20, 10, 30, 0.55), rgba(20, 10, 30, 0.85));
}
html.theme-halloween .ops-section-title,
html.theme-halloween .ops-content h2,
html.theme-halloween .ops-content h3:not(.pcard *):not(.ops-card *) { color: var(--hw-text); }
html.theme-halloween .ops-count-badge {
    background: rgba(255, 122, 26, 0.18);
    color: var(--hw-orange-2);
}
html.theme-halloween .ops-loading { color: var(--hw-muted); }

/* ===== PAGINA OPERATORI (operatori.html) ===== */
html.theme-halloween .ops-page {
    background: linear-gradient(180deg, var(--hw-bg-2) 0%, var(--hw-bg) 100%);
}
html.theme-halloween .ops-hero__overlay {
    background: linear-gradient(to bottom, rgba(20, 10, 30, 0.55) 0%, rgba(20, 10, 30, 0.45) 50%, rgba(29, 16, 48, 0.95) 100%);
}
html.theme-halloween .ops-hero__badge {
    color: var(--hw-orange-2);
    border-color: rgba(255, 122, 26, 0.6);
    background: rgba(20, 10, 30, 0.45);
}
html.theme-halloween .ops-section-label { color: var(--hw-text); }
html.theme-halloween .ops-count-badge {
    background: rgba(255, 122, 26, 0.18);
    color: var(--hw-orange-2);
}
html.theme-halloween .ops-section-line {
    background: linear-gradient(90deg, var(--hw-orange) 0%, transparent 100%);
    opacity: 0.6;
}
html.theme-halloween .ops-loading,
html.theme-halloween .ops-empty { color: var(--hw-muted); }
/* Modal "Prenota appuntamento": resta chiaro, accenti arancio */
html.theme-halloween .ops-modal { background: #fff8f0; }
html.theme-halloween .ops-modal input:focus,
html.theme-halloween .ops-modal textarea:focus,
html.theme-halloween .ops-modal select:focus { border-color: var(--hw-orange); }
html.theme-halloween .ops-modal__submit {
    background: linear-gradient(135deg, var(--hw-orange-d), var(--hw-orange));
    color: #1a0b00;
}

/* ===== FOOTER ===== */
html.theme-halloween .site-footer {
    border-top: 1px solid var(--hw-border);
}
html.theme-halloween .site-footer::before {
    background: linear-gradient(180deg, rgba(20, 10, 30, 0.85), rgba(10, 5, 16, 0.96));
}
html.theme-halloween .footer-tagline,
html.theme-halloween .footer-links a,
html.theme-halloween .footer-bottom { color: var(--hw-muted); }
html.theme-halloween .footer-links a:hover { color: var(--hw-orange); }

/* ===== DECORAZIONI (iniettate da JS) ===== */
html.theme-halloween #hwDecor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;           /* sotto la navbar (1000) e sotto modali (>1000) */
    overflow: hidden;
}
.hw-web {
    position: absolute;
    top: 96px;
    font-size: 5.2rem;
    line-height: 1;
    opacity: 0.55;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
}
.hw-web.left  { left: -10px; transform: scaleX(-1); }
.hw-web.right { right: -10px; }

.hw-bat {
    position: absolute;
    top: 0;
    left: -80px;
    font-size: 1.9rem;
    line-height: 1;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: hwFly var(--dur, 22s) linear var(--delay, 0s) infinite;
    will-change: transform;
}
.hw-bat i {
    display: inline-block;
    font-style: normal;
    animation: hwFlap 0.45s ease-in-out infinite alternate;
}

.hw-pumpkin {
    position: absolute;
    bottom: 18px;
    right: 18px;
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(255, 122, 26, 0.75));
    animation: hwBob 3.2s ease-in-out infinite;
}
.hw-ghost {
    position: absolute;
    bottom: 26px;
    left: 18px;
    font-size: 2.4rem;
    line-height: 1;
    opacity: 0.8;
    animation: hwBob 4.1s ease-in-out 0.6s infinite;
}

/* ===== ANIMAZIONI ===== */
@keyframes hwFly {
    0%   { transform: translate(0, var(--y0, 20vh)) rotate(-6deg); }
    25%  { transform: translate(28vw, calc(var(--y0, 20vh) - 8vh)) rotate(4deg); }
    50%  { transform: translate(55vw, calc(var(--y0, 20vh) + 6vh)) rotate(-4deg); }
    75%  { transform: translate(80vw, calc(var(--y0, 20vh) - 10vh)) rotate(6deg); }
    100% { transform: translate(calc(100vw + 120px), var(--y0, 20vh)) rotate(-6deg); }
}
@keyframes hwFlap {
    from { transform: scaleY(1); }
    to   { transform: scaleY(0.72); }
}
@keyframes hwBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}
@keyframes hwPulse {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 122, 26, 0.35); }
    50%      { box-shadow: 0 0 30px rgba(255, 122, 26, 0.75); }
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    html.theme-halloween .hero-section::before {
        width: 96px; height: 96px;
        top: 86px; right: 6%;
    }
    .hw-web { font-size: 3.6rem; top: 78px; }
    .hw-bat { font-size: 1.5rem; }
    .hw-bat:nth-child(n+6) { display: none; }   /* meno pipistrelli su telefono */
    .hw-pumpkin { font-size: 2.2rem; bottom: 84px; } /* sopra eventuali widget chat */
    .hw-ghost   { display: none; }
}

/* ===== ACCESSIBILITÀ ===== */
@media (prefers-reduced-motion: reduce) {
    .hw-bat, .hw-bat i, .hw-pumpkin, .hw-ghost,
    html.theme-halloween .hw-hero-badge,
    html.theme-halloween .pcard-avatar-wrap::after { animation: none !important; }
    .hw-bat { display: none; }
}
