/* Font imports moved to HTML <link> tags for non-blocking loading */

:root {
    /* Brand Colors */
    --primary-color: #EB5B00;
    --primary-hover: #c94e00;
    --accent-teal: #30c4b6;
    --accent-yellow: #ffc100;
    --accent-color: #EB5B00;

    /* Theme Variables - Default (Dark) */
    --color-bg-main: #252525;
    --color-bg-alt: #252525;
    --color-nav-bg: rgba(26, 26, 26, 0.95);
    --color-card-bg: #1a1a1a;
    --color-footer-bg: #1a1a1a;

    --color-text-primary: #ffffff;
    /* High contrast white for dark mode */
    --color-text-secondary: rgba(255, 255, 255, 0.85);
    --color-heading: #EB5B00;
    /* Orange Titles for dark mode */
    --color-border: rgba(255, 255, 255, 0.1);

    --font-decor: 'Outfit', sans-serif;
    --font-modern: 'Outfit', sans-serif;
    --font-body: 'Work Sans', sans-serif;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    --transition-fast: 0.3s ease;
    --white: #ffffff;
}

/* --- Light Theme Variables --- */
[data-theme="light"] {
    --color-bg-main: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-nav-bg: rgba(255, 255, 255, 0.95);
    --color-card-bg: #ffffff;
    --color-footer-bg: #f8f9fa;

    --color-text-primary: #1a1a1a;
    --color-text-secondary: #444444;
    --color-heading: #EB5B00;
    --color-border: rgba(0, 0, 0, 0.08);
}

/* --- Fixed Dark Sections (Default/Dark Theme behavior) --- */
.hero,
.mood-dark-fixed {
    --color-text-primary: #ffffff !important;
    --color-text-secondary: rgba(255, 255, 255, 0.85) !important;
}

[data-theme="dark"] footer {
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.85);
}

.hero h1,
.hero h2,
.hero h3,
.hero p,
.hero span {
    color: #ffffff !important;
}

.hero .text-primary,
.hero .accent-color {
    color: var(--primary-color) !important;
}


/* Reset & Base */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-primary);
    background-color: var(--color-bg-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%A6%86%3C/text%3E%3C/svg%3E"), auto;
}


body.cursor-camera {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%93%B8%3C/text%3E%3C/svg%3E"), auto;
}

body.cursor-horse {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%8E%A0%3C/text%3E%3C/svg%3E"), auto;
}

/* Ensure links and interactive elements retain the custom cursor, defaulting to pointer if unavailable */
a,
button,
.btn {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%A6%86%3C/text%3E%3C/svg%3E"), pointer;
}

body.cursor-camera a,
body.cursor-camera button,
body.cursor-camera .btn {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%93%B8%3C/text%3E%3C/svg%3E"), pointer;
}

body.cursor-horse a,
body.cursor-horse button,
body.cursor-horse .btn {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'%3E%3Ctext y='24'%3E%F0%9F%8E%A0%3C/text%3E%3C/svg%3E"), pointer;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
    color: var(--color-heading);
}

p,
span,
li {
    color: var(--color-text-primary);
}

.text-secondary {
    color: var(--color-text-secondary);
}

h1,
h2 {
    font-family: var(--font-decor);
}

h3,
h4 {
    font-family: var(--font-modern);
    font-weight: 700;
}

.text-primary {
    color: var(--primary-color);
}

.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 35px;
    border-radius: 50px;
    font-weight: 700;
    font-family: var(--font-modern);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    background: var(--primary-color);
    color: var(--white) !important;
    border: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-decoration: none;
    text-align: center;
}

/* Hero and Cookie Banner Buttons get the premium gradient */
.hero .btn,
.hero-content .btn,
#cookie-banner .btn {
    background: linear-gradient(90deg, #eb5b00, #f30000);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(235, 91, 0, 0.3);
    color: var(--white) !important;
    background: var(--primary-hover);
}

.hero .btn:hover,
#cookie-banner .btn:hover {
    background: linear-gradient(90deg, #f30000, #eb5b00);
}

.btn-outline {
    background: transparent !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
}

.btn-outline:hover {
    background: var(--primary-color) !important;
    color: var(--white) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(235, 91, 0, 0.2);
}

/* Layout Utilities */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.section {
    padding: 6rem 0;
}

.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .section {
        padding: var(--spacing-lg) 0;
    }
}

/* Newsletter Popup */
#newsletter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 22, 39, 0.85);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

#newsletter-popup {
    background: var(--color-bg-alt);
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.popup-image-header {
    width: 100%;
    height: 220px;
    background-image: url('assets/images/villexpo-2025/luna-park/DSC_0439.webp');
    background-size: cover;
    background-position: center;
    position: relative;
}

#close-popup {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(1, 22, 39, 0.6);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 100;
}

#close-popup:hover {
    background: var(--primary-color);
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer Styling */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-text-primary);
    padding: var(--spacing-lg) 0 var(--spacing-sm);
    text-align: center;
}

.footer-content p {
    margin-bottom: var(--spacing-xs);
    font-size: 0.95rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-modern);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.footer-logo span:last-child {
    color: var(--primary-color);
    margin-left: 0.3rem;
}

.footer-email {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    transition: var(--transition-fast);
}

.footer-email:hover {
    color: #ff7b2e;
}

.footer-legal-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-primary);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0;
}

.social-links a {
    font-size: 1.8rem;
    color: var(--color-text-primary);
    transition: var(--transition-fast);
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

footer p,
footer span,
footer li {
    color: var(--color-text-primary);
}

footer a {
    color: var(--color-text-primary) !important;
    text-decoration: underline;
    transition: var(--transition-fast);
}

footer a:hover {
    color: var(--primary-color) !important;
}

.legal-links a {
    color: var(--color-text-primary) !important;
    text-decoration: none !important;
}

.legal-links a:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

/* Villexpo Palette Implementation */
.villexpo-page {
    --vx-primary: #ed5000;
    --vx-bg: #fefffb;
    --vx-dark: #011627;
}

/* Light theme adjustments for villexpo */
[data-theme="light"] .villexpo-page {
    --vx-bg: #f8f9fa;
    --vx-dark: #1a1a1a;
}

/* Hero video overlay theme support */
.hero-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Default dark theme: Gradient fades from semi-transparent top to solid #252525 bottom */
    background: linear-gradient(to bottom,
            rgba(37, 37, 37, 0.3) 0%,
            rgba(37, 37, 37, 0.6) 50%,
            #252525 100%);
    z-index: -1;
}

/* Light theme: clean cut, remove the gradient fade to dark */
[data-theme="light"] .hero-video-overlay {
    background: rgba(0, 0, 0, 0.2);
    /* Subtle dimming to keep text readable */
}

/* Force dark text for specific elements in light theme even if they have inline whites */
[data-theme="light"] .mood-dark p,
[data-theme="light"] .mood-dark li,
[data-theme="light"] .mood-dark .lead-text {
    color: var(--color-text-primary) !important;
}

[data-theme="light"] .mood-dark .section-title {
    color: var(--primary-color) !important;
}

/* Fix cart summary contrast in both themes */
.cart-section {
    background: #ffffff;
    /* Always white */
    border: 1px solid var(--color-border);
    color: #1a1a1a;
}

.cart-item {
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.cart-item-name {
    color: var(--color-text-primary);
}

.cart-qty-num {
    color: var(--color-text-primary);
}

.cart-total-label,
.cart-total-amount,
.cart-total-label *,
.cart-total-amount * {
    color: #1a1a1a !important;
    /* Force black for total text in both themes */
}

[data-theme="dark"] .cart-section,
[data-theme="dark"] .cart-item,
[data-theme="dark"] .cart-item-name,
[data-theme="dark"] .cart-qty-num {
    color: #1a1a1a;
    /* Keep it visible on white background */
}

/* App Banner Multi-theme Support */
.app-banner {
    background: rgba(255, 255, 255, 0.05);
    /* For dark theme */
    backdrop-filter: blur(10px);
}

[data-theme="light"] .app-banner {
    background: rgba(0, 0, 0, 0.03);
    /* Subtle for light theme */
}

[data-theme="light"] .app-banner p,
[data-theme="light"] .app-banner h4 {
    color: #1a1a1a !important;
}

.app-banner .btn-store {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 16px;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

[data-theme="light"] .app-banner .btn-store {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

[data-theme="light"] .app-banner .btn-store i {
    color: var(--accent-yellow) !important;
}

/* Villexpo main hero - compact, fits in viewport */
.villexpo-hero-main .hero-content {
    padding: 0 1rem;
}

.villexpo-hero-main .countdown-wrapper {
    gap: 12px;
}

.villexpo-hero-main .cd-item {
    min-width: 70px;
    padding: 8px 12px;
}

.villexpo-hero-main .cd-item span {
    font-size: 1.8rem;
}

@media (max-width: 768px) {
    .villexpo-hero-main {
        height: 100vh !important;
        min-height: 100vh !important;
        padding-top: 60px !important;
    }

    .villexpo-hero-main .hero-logo-placeholder {
        max-width: 280px !important;
        margin-bottom: 1rem !important;
    }

    .villexpo-hero-main .date-bubble-style {
        font-size: 0.9rem !important;
        padding: 8px 20px !important;
        margin-bottom: 1rem !important;
    }

    .villexpo-hero-main .hero-lead {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .villexpo-hero-main .hero-lead strong {
        font-size: 1.2rem !important;
    }

    .villexpo-hero-main .countdown-wrapper {
        gap: 6px !important;
        margin: 1rem 0 !important;
    }

    .villexpo-hero-main .cd-item {
        min-width: 55px !important;
        padding: 6px 8px !important;
    }

    .villexpo-hero-main .cd-item span {
        font-size: 1.3rem !important;
    }

    .villexpo-hero-main .cd-item small {
        font-size: 0.65rem !important;
    }

    .villexpo-hero-main .btn-large {
        padding: 12px 24px !important;
        font-size: 0.9rem !important;
    }
}

/* Newsletter section overlay theme support - stays dark in both themes */
.newsletter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(37, 37, 37, 0.9);
    z-index: 0;
}

.villexpo-page .page-header {
    background-color: var(--vx-dark);
}

.villexpo-page .section-title {
    color: var(--vx-primary);
}

.villexpo-page .feature-card {
    background: var(--vx-bg);
    border-top: 4px solid var(--vx-primary);
    color: var(--vx-dark);
}

.villexpo-page .program-day {
    background: var(--vx-bg);
    border-left: 5px solid var(--vx-primary);
}

.villexpo-page .btn {
    background: var(--vx-primary);
    color: var(--vx-bg);
}

.villexpo-page .btn-white {
    background: var(--vx-bg);
    color: var(--vx-primary);
    border: 2px solid var(--vx-primary);
}

.grecaptcha-badge {
    left: 0px !important;
    right: auto !important;
    bottom: 80px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* WhatsApp Float Fix */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    color: #fff;
}

/* Cookie Banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(1, 22, 39, 0.95);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

#cookie-banner a {
    color: var(--primary-color);
    text-decoration: underline;
}

@media (max-width: 768px) {
    #cookie-banner {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 5%;
    background-color: var(--color-nav-bg);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s ease;
}

.logo {
    font-family: var(--font-modern);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo:hover {
    color: var(--color-text-primary);
    text-decoration: none;
}

.logo span {
    color: var(--primary-color);
}

/* Logo image — preserve natural aspect ratio, avoid squishing */
.logo img {
    display: block;
    height: 35px;
    width: auto;          /* Let width scale naturally from height */
    margin-right: 12px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
}

.nav-links a {
    font-family: var(--font-modern);
    font-weight: 500;
    font-size: 1rem;
}

.nav-links a.active {
    color: var(--primary-color);
}

.burger {
    display: none;
    cursor: pointer;
}

.burger div {
    width: 25px;
    height: 3px;
    background-color: var(--color-text-primary);
    margin: 5px;
    transition: var(--transition-fast);
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--color-bg-main);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        transform: translateY(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        padding: 2rem;
    }

    .nav-links.nav-active {
        transform: translateY(0%);
    }

    .nav-links li {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .nav-links.nav-active li {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.nav-active li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-links.nav-active li:nth-child(2) {
        transition-delay: 0.15s;
    }

    .nav-links.nav-active li:nth-child(3) {
        transition-delay: 0.2s;
    }

    .nav-links.nav-active li:nth-child(4) {
        transition-delay: 0.25s;
    }

    .nav-links.nav-active li:nth-child(5) {
        transition-delay: 0.3s;
    }

    .nav-links.nav-active li:nth-child(6) {
        transition-delay: 0.35s;
    }

    .nav-links.nav-active li.mobile-nav-social {
        transition-delay: 0.4s;
    }

    .nav-links a {
        color: var(--color-text-primary) !important;
        font-size: 1.8rem;
        font-weight: 700;
        letter-spacing: 2px;
        text-transform: uppercase;
        padding: 0.8rem 0;
        display: block;
        transition: transform 0.3s ease;
    }

    .nav-links a:hover {
        transform: scale(1.1);
    }

    .mobile-nav-social {
        display: flex;
        gap: 20px;
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid var(--color-border);
    }

    .mobile-nav-social i {
        font-size: 1.5rem;
        color: var(--color-text-primary);
    }

    .nav-links a:hover,
    .nav-links a.active {
        color: var(--primary-color) !important;
    }

    .burger {
        display: block;
        z-index: 1001;
    }

    .burger.toggle .line1 {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .burger.toggle .line2 {
        opacity: 0;
    }

    .burger.toggle .line3 {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Social links inside mobile nav - horizontal and centered */
    .mobile-nav-social {
        display: flex !important;
        gap: 1.5rem;
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        justify-content: center;
        align-items: center;
    }

    .mobile-nav-social a {
        font-size: 1.5rem !important;
        color: white !important;
        padding: 0 !important;
        letter-spacing: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav-social a:hover {
        color: var(--primary-color) !important;
    }
}

.mobile-nav-social {
    display: none;
}

/* Footer */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-text-primary);
    padding: var(--spacing-lg) 0 var(--spacing-md);
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

.footer-content .logo {
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Home Page Specific Styles --- */

/* Gallery section: reduce title-to-subtitle spacing on desktop */
.gallery-section .section-subtitle {
    margin-top: -0.8rem;
}

/* Mobile: reduce hero-to-press spacing */
@media (max-width: 768px) {
    .press-section {
        padding-top: 1.5rem !important;
        margin-top: 0 !important;
    }

    /* Mobile: swap order so gallery photos come before title in passione section */
    .expo-block-inner {
        flex-direction: column-reverse !important;
    }

    .expo-gallery {
        order: -1 !important;
        margin-bottom: 2rem;
    }
}

.hero {
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.5)), url('assets/images/Inaugurazione Villexpo 2025/DSC_0323.jpg') no-repeat center center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    padding-top: 60px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    font-weight: 300;
}

.d-block {
    display: block;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
    position: relative;
    display: inline-block;
}

.event-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-fast);
}

.event-card:hover {
    transform: translateY(-5px);
}

.event-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}


.container {
    padding: 0 1.5rem;
    max-width: 1200px;
}

.event-date {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: var(--white);
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-family: var(--font-modern);
}

.event-details {
    padding: var(--spacing-md);
}

.event-details h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
    color: var(--text-dark) !important;
}

.event-details p {
    color: #666;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

.text-small {
    font-size: 0.8rem;
    padding: 8px 20px;
}

.welcome-section {
    background-color: var(--bg-light);
}

.lead-text {
    max-width: 800px;
    margin: 0 auto var(--spacing-lg);
    font-size: 1.2rem;
    color: #555;
}

.icon-box {
    padding: var(--spacing-md);
    background: var(--white);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    color: #333 !important;
}

.icon-box i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.membership-banner {
    background: var(--primary-color);
    color: var(--white);
    padding: var(--spacing-lg) 0;
    text-align: center;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.banner-text {
    text-align: left;
    flex: 1;
}

.banner-text h2 {
    color: var(--white);
    margin-bottom: var(--spacing-xs);
}

.btn-white {
    background: var(--white);
    color: var(--primary-color);
    border-color: var(--white);
}

.btn-white:hover {
    background: transparent;
    color: var(--white);
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .banner-content {
        flex-direction: column;
        text-align: center;
    }

    .banner-text {
        text-align: center;
    }
}

/* --- Inner Pages --- */

/* Page Headers */
.page-header {
    height: 50vh;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    position: relative;
    padding-top: 60px;
}

.page-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
}

.header-content h1 {
    font-size: 3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

/* --- Force white text on dark hero headers & promo banners (all themes) --- */
.page-header .header-content,
.page-header .header-content h1,
.page-header .header-content h2,
.page-header .header-content p,
.page-header .header-content span {
    color: #ffffff !important;
}

.page-header .header-content p {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.villexpo-promo-banner,
.villexpo-promo-banner p,
.villexpo-promo-banner span {
    color: #ffffff !important;
}

.villexpo-promo-banner h2 {
    color: var(--primary-color) !important;
}

/* Blog Cards (Events) */
.blog-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.blog-image {
    height: 250px;
    background-size: cover;
    background-position: center;
}

.blog-content {
    padding: var(--spacing-md);
}

.blog-content .meta {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
}

.blog-content h3 {
    margin-bottom: var(--spacing-xs);
}

.blog-content p {
    color: #666;
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.read-more:hover {
    text-decoration: underline;
}

/* Hero Responsive Optimization */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding-top: 80px;
    /* Navbar space */
}

@media (max-width: 768px) {
    .hero {
        min-height: 80vh;
        /* Better for mobile viewport */
        padding: 60px 20px 40px;
        /* Reduced top padding to raise logo */
    }

    .hero-content h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .hero-content .btn-container {
        display: flex !important;
        /* Force visibility */
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .page-header {
        height: 350px;
        padding: 100px 20px 40px;
    }

    .page-header h1 {
        font-size: 2.2rem;
    }
}

/* Gallery UI Improvement - Mobile First & Ordered */
.gallery-container {
    padding: var(--spacing-lg) 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Mobile first: 2 columns */
    gap: 10px;
    padding: 10px;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 0;
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    background: var(--grey-100);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(1, 22, 39, 0.4));
    opacity: 0;
    transition: var(--transition-fast);
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Forms */
.contact-form-container {
    padding: var(--spacing-md);
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.contact-form-container.bg-light {
    background: var(--bg-light);
    border: 1px solid var(--grey-200);
}

.styled-form .form-group {
    margin-bottom: 1.5rem;
}

.styled-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-family: var(--font-modern);
}

.styled-form input,
.styled-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--grey-200);
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.styled-form input:focus,
.styled-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* WhatsApp Widget */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #999;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: #20BA5A;
}

/* Newsletter Popup */
.newsletter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.newsletter-popup.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-content {
    background: var(--white);
    padding: 3rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    background-image: linear-gradient(135deg, #fff 0%, #fdfbf7 100%);
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.popup-content h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.popup-content input {
    width: 100%;
    padding: 12px;
    margin: 1rem 0;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* --- Villexpo 2026 Specific Styles --- */

.btn-large {
    padding: 15px 40px;
    font-size: 1.2rem;
}

/* Scrolling Galleries */
.scrolling-container,
.scrolling-sponsors {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    padding: 1rem 0;
}

.scrolling-track {
    display: inline-flex;
    gap: 15px;
    animation: scroll-left 30s linear infinite;
    padding-left: 15px;
}

.scrolling-container.reverse .scrolling-track {
    animation-direction: reverse;
}


.scrolling-track a {
    display: inline-block;
    height: 250px;
    flex-shrink: 0;
}

.scrolling-track a img {
    height: 100%;
    width: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.scrolling-track img.old {
    height: 250px;
    width: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    flex-shrink: 0;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-50% - 20px));
    }
}

/* Sponsors Marquee Theme Logic */
.sponsors-track.track-light {
    display: none;
}

[data-theme="light"] .sponsors-track.track-dark {
    display: none;
}

[data-theme="light"] .sponsors-track.track-light {
    display: inline-flex;
}

.gallery-scroll,
.scrolling-container,
.scrolling-sponsors {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}

.sponsors-track,
.scroll-track,
.scrolling-track {
    display: inline-flex;
    gap: 40px;
    width: max-content;
    animation: scroll-left 25s linear infinite;
    align-items: center;
}

.sponsor-item {
    flex: 0 0 auto;
    width: 180px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sponsor-item img {
    max-width: 100%;
    max-height: 80%;
    object-fit: contain;
    filter: invert(0) grayscale(1);
    opacity: 0.7;
    transition: var(--transition-fast);
}

/* Ensure logos without transparent bg look good or use the theme-specific sets */
[data-theme="dark"] .track-dark .sponsor-item img {
    filter: grayscale(1) brightness(1.5);
}

.sponsor-item:hover img {
    filter: grayscale(0) brightness(1);
    opacity: 1;
    transform: scale(1.05);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-dark);
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-modern);
    font-weight: 600;
    transition: var(--transition-fast);
}

.mood-dark .filter-btn {
    color: var(--white);
    border-color: var(--white);
}

.filter-btn:hover,
.filter-btn.active,
.mood-dark .filter-btn:hover,
.mood-dark .filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* --- Improved Card Styling --- */
.event-card,
.blog-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    margin-bottom: 20px;
}

.event-details,
.blog-content {
    padding: 1.5rem;
}

.event-details h3,
.blog-content h3 {
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
    color: var(--color-heading) !important;
}

.event-details p,
.blog-content p {
    color: var(--color-text-secondary) !important;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* High Contrast Subtitles for Dark Sections */
.section-title {
    color: var(--color-heading) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lead-text,
.section-subtitle {
    color: var(--color-text-primary) !important;
    opacity: 1 !important;
}

/* Specific Dark Mood container for Video/Hero sections */
.mood-dark {
    background-color: #252525;
    color: var(--color-text-primary);
    position: relative;
}

/* Black-to-fade effect for mood-dark sections */
.mood-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, #252525, transparent);
    z-index: 1;
    pointer-events: none;
}

.mood-dark::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to top, #252525, transparent);
    z-index: 1;
    pointer-events: none;
}

.mood-dark>*:not(.hero-video-overlay):not(.newsletter-overlay) {
    position: relative;
    z-index: 2;
}

/* Hide fades in light mode */
[data-theme="light"] .mood-dark::before,
[data-theme="light"] .mood-dark::after {
    display: none !important;
}

[data-theme="dark"] .section-subtitle,
[data-theme="dark"] .lead-text {
    color: #ffffff !important;
    /* Force pure white for subtitles in dark mode */
}



.btn-large {
    padding: 14px 35px;
    font-size: 1.1rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #ffffff;
}

/* Events Grid Animation */
.event-card.filter-item {
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: flex;
    flex-direction: column;
}

.event-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.event-details>div:last-child {
    margin-top: auto;
}

/* Fix card heights and enable Masonry Layout via CSS columns */
.events-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .events-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .events-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Ensure cards do not break across columns and remain flex columns internally */
.events-grid .event-card.filter-item {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    vertical-align: top;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.event-card.filter-item.hide {
    display: none;
}

/* --- Scroll Reveal Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.visible,
.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Mobile-specific styles for new sections --- */

/* Maps section mobile */
.mood-dark {
    background-color: #0f0f0f;
    color: var(--white);
}

.maps-section iframe {
    max-width: 100%;
}

/* Passione section mobile reorder */
@media (max-width: 768px) {
    .expo-block-inner {
        flex-direction: column-reverse;
        padding-top: 2rem;
    }

    .expo-block-inner h2 {
        color: var(--primary-color) !important;
        font-size: 2.2rem !important;
        margin-top: 2rem;
    }
}

.date-bubble-style {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #eb5b00;
    background: rgba(235, 91, 0, 0.1);
    color: #eb5b00;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    font-family: var(--font-modern);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(5px);
}

/* Utility classes */
.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-5 {
    margin-top: 3rem;
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

.mb-5 {
    margin-bottom: 3rem;
}

.overflow-hidden {
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero h2 {
        font-size: 1.8rem !important;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .hero-logo-placeholder {
        max-width: 380px !important;
    }

    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }

    .filter-btn {
        width: 100%;
        max-width: 350px;
    }

    /* Timeline mobile */
    .timeline-line {
        display: none !important;
    }

    .timeline-dot {
        display: none !important;
    }

    .timeline-item {
        margin-bottom: 2rem !important;
    }

    /* Ristorante images */
    .image-content {
        height: 250px !important;
    }

    /* Menu mobile */
    .menu-container {
        padding: 1.5rem !important;
    }

    .menu-name {
        font-size: 0.85rem;
    }

    .menu-price {
        font-size: 0.85rem;
    }

    /* Gallery scroll */

    .scrolling-track a {
        display: inline-block;
        height: 250px;
        flex-shrink: 0;
    }

    .scrolling-track a img {
        height: 100%;
        width: auto;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        object-fit: cover;
    }

    .scrolling-track img.old {
        height: 180px;
    }

    /* Section titles */
    .section-title {
        font-size: 2.5rem !important;
        /* Increased for better mobile impact */
        line-height: 1.1;
        margin-bottom: 2rem;
        letter-spacing: -1px;
    }

    .section-subtitle {
        font-size: 1.2rem !important;
        margin-top: 0.5rem;
        opacity: 0.9;
    }

    .btn-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
        width: 100%;
    }

    .btn-container .btn {
        width: 100% !important;
        max-width: 320px;
        font-size: 1rem !important;
        padding: 15px 30px !important;
    }

    /* Footer map */
    .footer-map iframe {
        height: 180px !important;
    }
}

/* --- Countdown Widget --- */
.countdown-wrapper {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.cd-item {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px 15px;
    text-align: center;
    min-width: 80px;
}

.cd-item span {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    font-family: var(--font-modern);
}

.cd-item small {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--white);
}

@media (max-width: 480px) {
    .countdown-wrapper {
        gap: 8px;
    }

    .cd-item {
        min-width: 65px;
        padding: 8px 10px;
    }

    .cd-item span {
        font-size: 1.5rem;
    }

    .cd-item small {
        font-size: 0.75rem;
    }
}

/* --- Mobile Gallery Segments --- */
.mobile-gallery-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .mobile-gallery-row {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 20px;
        gap: 15px;
    }

    .mobile-gallery-row .gallery-item {
        flex: 0 0 85%;
        scroll-snap-align: center;
    }

    /* Gallery archive mobile fix */
    .gallery-archive-section .gallery-macro-section {
        padding: 1.5rem 1rem !important;
    }

    .gallery-archive-section .gallery-category {
        margin-bottom: 2rem !important;
    }

    .gallery-archive-section .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Mobile: show toggle buttons below each gallery, stack vertically */
    .gallery-archive-section .gallery-toggle-btn {
        width: 100% !important;
        display: block !important;
    }
}

/* Gallery archive: light mode button text visibility */
[data-theme="light"] .gallery-archive-section .btn-outline {
    border-color: var(--primary-color) !important;
}

[data-theme="light"] .gallery-archive-section .btn-outline:hover {
    background: var(--primary-color) !important;
    color: #fff !important;
}

/* Navbar Logo — link styling reset */
.navbar .logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-primary);
}

.navbar .logo img {
    display: block;
    height: 35px;
    width: auto;          /* Preserve natural aspect ratio of logoproloco.webp */
    flex-shrink: 0;
    margin-right: 12px;
}

/* --- Timeline Pulse Animation --- */
@keyframes timelinePulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(235, 91, 0, 0.7);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 0 10px rgba(235, 91, 0, 0);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(235, 91, 0, 0);
    }
}

.timeline-dot {
    animation: timelinePulse 2s infinite;
}

/* Timeline Layout Alternate */
.timeline-item .feature-row {
    flex-direction: row;
}

.timeline-item .feature-text {
    text-align: right;
    padding-right: 3rem;
    padding-left: 0;
}

.timeline-item:nth-child(odd) .feature-row {
    flex-direction: row-reverse;
}

.timeline-item:nth-child(odd) .feature-text {
    text-align: left;
    padding-left: 3rem;
    padding-right: 0;
}

@media (max-width: 768px) {

    .timeline-item .feature-row,
    .timeline-item:nth-child(odd) .feature-row {
        flex-direction: column !important;
        gap: 2rem;
    }

    .timeline-item .feature-text,
    .timeline-item:nth-child(odd) .feature-text {
        text-align: center !important;
        padding: 0 !important;
    }
}

/* --- Stacked Gallery ("Giro Pagina" Effect) --- */
.stacked-gallery {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 350px;
    perspective: 1000px;
    transform-style: preserve-3d;
    cursor: pointer;
}

.stacked-card {
    position: absolute;
    width: 65%;
    height: 90%;
    top: 5%;
    left: 17.5%;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
}

.stacked-card.active {
    transform: translateZ(0px) translateY(0) scale(1);
    z-index: 3;
    opacity: 1;
    visibility: visible;
}

.stacked-card.next1 {
    transform: translateZ(-50px) translateY(20px) scale(0.9);
    z-index: 2;
    opacity: 0.8;
    visibility: visible;
}

.stacked-card.next2 {
    transform: translateZ(-100px) translateY(40px) scale(0.8);
    z-index: 1;
    opacity: 0.6;
    visibility: visible;
}

.stacked-card.hidden {
    transform: translateZ(-150px) translateY(60px) scale(0.7);
    z-index: 0;
    opacity: 0;
    visibility: hidden;
}

.stacked-gallery:hover .stacked-card.active {
    transform: translateZ(0px) translateY(-10px) scale(1.05);
}

.stacked-gallery:hover .stacked-card.next1 {
    transform: translateZ(-50px) translateY(10px) scale(0.95);
    opacity: 0.9;
}

.stacked-gallery:hover .stacked-card.next2 {
    transform: translateZ(-100px) translateY(30px) scale(0.85);
    opacity: 0.7;
}

/* App Store Buttons Hover Effect */
.btn-store:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* --- Expo Block Layout (Villexpo "Cosa aspettarsi") --- */
.expo-block {
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.expo-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.expo-block-inner {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.expo-block-inner.reverse {
    flex-direction: row-reverse;
}

.expo-text {
    flex: 1;
    min-width: 0;
}

.expo-text p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

[data-theme="light"] .expo-text p {
    color: var(--color-text-secondary);
}

[data-theme="light"] .expo-block {
    border-bottom-color: var(--color-border);
}

.expo-gallery {
    flex: 1;
    min-width: 0;
    min-height: 350px;
    position: relative;
}

.expo-gallery .stacked-gallery {
    min-height: 350px;
}

.expo-gallery .stacked-card {
    width: 75%;
    left: 12.5%;
}

@media (max-width: 768px) {

    .expo-block-inner,
    .expo-block-inner.reverse {
        flex-direction: column !important;
        gap: 2rem;
        text-align: center;
    }

    .expo-gallery {
        width: 100%;
        min-height: 300px;
    }

    .expo-gallery .stacked-card {
        width: 85%;
        left: 7.5%;
    }

    .expo-gallery .stacked-gallery {
        min-height: 300px;
    }

    .expo-text .btn {
        display: inline-block;
    }

    .app-banner {
        align-items: center !important;
        text-align: center;
        border-left: none !important;
        border-top: 4px solid #ff9800;
    }

    .app-banner>div:last-child {
        justify-content: center;
    }

    .villexpo-hero h1 {
        font-size: 2.5rem !important;
        letter-spacing: 2px !important;
    }

    .villexpo-hero {
        height: auto !important;
        min-height: 60vh;
        padding: 6rem 1rem 3rem !important;
    }

    .villexpo-hero .countdown-wrapper {
        transform: scale(0.75) !important;
    }

    .stacked-card {
        width: 80%;
        left: 10%;
    }
}

/* Swipeable scrolling containers on mobile */
@media (max-width: 768px) {
    .scrolling-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .scrolling-container .scrolling-track {
        animation: none !important;
    }

    .scrolling-container .scrolling-track a,
    .scrolling-container .scrolling-track img {
        scroll-snap-align: start;
    }

    /* Villexpo cosa aspettarsi mobile carousel */
    .expo-carousel-mobile {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
        padding-bottom: 1rem;
    }

    .expo-carousel-mobile .expo-block {
        flex: 0 0 85vw;
        scroll-snap-align: start;
    }
}

/* Accordion for legenda */
.map-legend-accordion summary::-webkit-details-marker {
    display: none;
}

.map-legend-accordion[open] summary i {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .gallery-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 1rem;
        gap: 1rem !important;
    }

    .gallery-grid .gallery-item {
        flex: 0 0 80vw;
        scroll-snap-align: center;
    }

    .gallery-hidden {
        display: none !important;
        /* Ensure hidden stays hidden despite flex override */
    }
}


@media (max-width: 768px) {

    /* Responsive Typogaphy Overrides */
    h1 {
        font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
    }

    h2 {
        font-size: clamp(1.3rem, 5vw, 1.8rem) !important;
    }

    h3 {
        font-size: clamp(1.1rem, 4vw, 1.5rem) !important;
    }

    .hero h1,
    .hero h2 {
        font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
        line-height: 1.2 !important;
    }

    .logo img {
        height: 28px !important;
        margin-right: 8px !important;
    }

    .navbar {
        padding: 0.5rem 1rem !important;
    }

    p {
        font-size: 1rem;
    }

    .section {
        padding: 3rem 0;
        /* Reduce padding on mobile */
    }

    .btn {
        padding: 10px 24px;
        font-size: 0.95rem;
    }

    .sponsors-track {
        animation: scroll-left 10s linear infinite;
    }
}

/* --- reCAPTCHA Privacy & Global Fixes --- */
.grecaptcha-badge {
    visibility: hidden !important;
}

.captcha-notice {
    font-size: 11px;
    color: var(--color-text-secondary);
    opacity: 0.7;
    margin-top: 15px;
    line-height: 1.4;
    text-align: left;
}

.captcha-notice a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- Theme Toggle Widget --- */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(235, 91, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle i {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle.rotating i {
    transform: rotate(360deg);
}

.theme-toggle:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(235, 91, 0, 0.6);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Dark theme (default): show sun icon (to switch to light) */
.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Light theme: show moon icon (to switch to dark) */
[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* --- Cookie Banner Mobile Responsive --- */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a1a;
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2001;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    gap: 1rem;
}

#cookie-banner a {
    color: var(--primary-color);
    text-decoration: underline;
}

@media (max-width: 768px) {
    #cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.2rem 1rem;
        gap: 0.8rem;
    }

    #cookie-banner .btn {
        width: 100%;
        max-width: 280px;
    }
}

/* --- CTA Hover Animation Standard --- */
.btn {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(235, 91, 0, 0.4);
}

.btn-outline:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(235, 91, 0, 0.3);
}

/* --- Newsletter Popup Styles --- */
#newsletter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#newsletter-popup {
    background: #fff;
    border-radius: 15px;
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.popup-image-header {
    background: linear-gradient(135deg, var(--primary-color), #ff8c42);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1rem;
}

#close-popup {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

/* ============================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================ */

/* Defer rendering of below-the-fold sections */
.press-section,
.gallery-section,
section.section:not(:first-of-type) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Pause scroll animations when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {

    .scroll-track,
    .sponsors-track,
    .scrolling-track {
        animation: none;
    }
}

/* Optimize image rendering in galleries */
.gallery-scroll img,
.scroll-track img {
    will-change: auto;
}

/* Performance Optimizations */
.scrolling-sponsors,
.gallery-scroll,
.press-section,
footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

/* ============================================================
   BREVO NEWSLETTER FORM & POPUP OVERRIDES
   Force dark readable text inside the white Brevo card regardless of 
   the surrounding dark/mood-dark-fixed theme context.
   ============================================================ */

/* --- Reset text color inside the white sib-container card --- */
/* These selectors must beat the global p/span/label color:white !important rules */
#sib-container p,
#sib-container span:not(.checkbox),
#sib-container li,
#sib-container label,
#nl-popup #sib-container p,
#nl-popup #sib-container span:not(.checkbox),
#nl-popup #sib-container li,
#nl-popup #sib-container label {
    color: #3C4858 !important;
}

/* Gray for spec/reCAPTCHA notices */
#sib-container .entry__specification,
#sib-container .captcha-notice,
#nl-popup .entry__specification,
#nl-popup .captcha-notice {
    color: #8390A4 !important;
}

/* Orange for all links inside the form */
#sib-container a,
#nl-popup #sib-container a,
.sib-form-container a {
    color: #eb5b00 !important;
    text-decoration: underline !important;
}

/* Error text red */
#sib-container .entry__error {
    color: #661d1d !important;
}

/* --- Checkbox fix --- */
/* Hide the native HTML checkbox (Brevo replaces it with a custom span) */
#sib-container label input[type="checkbox"].input_replaced,
#nl-popup label input[type="checkbox"].input_replaced {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

/* --- Checkbox: Complete reset of Brevo's malicious CSS ---
   Brevo applies text-indent: -1.5em and padding-left: 1.5em to .entry__choice,
   which completely breaks flexbox layouts by pulling the checkbox backwards.
   We explicitly reset this. */

#sib-container .entry__choice,
#nl-popup .entry__choice {
    text-indent: 0 !important;
    padding-left: 0 !important;
    margin-bottom: 10px !important;
    width: 100% !important;
}

#sib-container .entry__choice > div,
#nl-popup .entry__choice > div {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure native checkbox is fully visible and sized correctly */
#sib-container .entry__choice input[type="checkbox"],
#nl-popup .entry__choice input[type="checkbox"] {
    display: block !important;
    opacity: 1 !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    position: static !important;
    accent-color: #eb5b00 !important;
    cursor: pointer !important;
}

/* Prevent Brevo from ruining our text label with padding-left: 28px */
#sib-container .entry__choice label[for],
#nl-popup .entry__choice label[for] {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    text-indent: 0 !important;
    cursor: pointer !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #3C4858 !important;
    font-weight: 400 !important;
}