/* Stili delle singole pagine del vecchio sito (blocchi <style> in pagina), isolati per classe del body con :where() (stessa specificità degli originali). */

/* ===== Home: modali e caroselli ===== */
:where(.home-page) {
    /* Public Modals Styles */
        .modal-overlay {
          position: fixed;
          top: 0; 
          left: 0;
          width: 100%;
          height: 100%;
          background: rgba(0, 0, 0, 0.8);
          z-index: 9999;
          display: none;
          justify-content: center;
          align-items: center;
          backdrop-filter: blur(5px);
          opacity: 0;
          transition: opacity 0.3s ease;
        }

        .modal-overlay.active {
          display: flex;
          opacity: 1;
        }

        .modal-content {
          background: white;
          border-radius: var(--radius-lg);
          max-width: 800px;
          width: 90%;
          max-height: 90vh;
          overflow-y: auto;
          position: relative;
          box-shadow: 0 20px 50px rgba(0,0,0,0.3);
          transform: translateY(20px);
          transition: transform 0.3s ease;
        }

        .modal-overlay.active .modal-content {
          transform: translateY(0);
        }

        .modal-close {
          position: absolute;
          top: 15px;
          right: 15px;
          background: rgba(0,0,0,0.1);
          border: none;
          border-radius: 50%;
          width: 32px;
          height: 32px;
          cursor: pointer;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 1.2rem;
          transition: background 0.2s;
          z-index: 10;
        }

        .modal-close:hover {
          background: rgba(0,0,0,0.2);
        }

        /* Gallery Modal Specifics */
        #galleryModal .modal-content {
          background: transparent;
          box-shadow: none;
          width: 100%;
          height: 100%;
          max-width: none;
          max-height: none;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
        }

        #galleryModal img {
          max-width: 90%;
          max-height: 85vh;
          border-radius: var(--radius-md);
          box-shadow: 0 10px 40px rgba(0,0,0,0.5);
        }

        #galleryModal .modal-close {
          top: 30px;
          right: 30px;
          background: rgba(255,255,255,0.2);
          color: white;
        }

        #galleryModal .modal-close:hover {
          background: rgba(255,255,255,0.4);
        }

    /* Home carousels: cinematic on desktop, native swipe on mobile */
        .carousel-wrapper {
            position: relative;
            overflow: hidden;
            padding: 18px 0 24px;
            border-radius: 28px;
        }

        .carousel-track {
            display: flex;
            gap: var(--space-lg, 24px);
            transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
            width: max-content;
            will-change: transform;
        }

        .carousel-item {
            width: min(380px, 82vw);
            flex: 0 0 auto;
        }

        .carousel-controls {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: 24px;
        }

        .carousel-btn {
            background: rgba(255, 255, 255, 0.78);
            border: 1px solid rgba(255, 255, 255, 0.65);
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.25s ease;
            font-size: 1.2rem;
            color: var(--color-text-main, #333);
            box-shadow: 0 14px 36px rgba(50, 30, 20, 0.12);
            backdrop-filter: blur(14px);
        }

        .carousel-btn:hover {
            background: var(--color-primary, #E63946);
            border-color: var(--color-primary, #E63946);
            color: var(--color-primary, #E63946);
            color: white;
            transform: scale(1.1);
        }

        /* Mobile: scroll-snap nativo, card centrate */
        @media (max-width: 768px) {
            .carousel-wrapper {
                overflow-x: auto;
                overflow-y: hidden;
                scroll-snap-type: x mandatory;
                scroll-behavior: smooth;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                padding: 16px 0 20px;
                padding-left: 16px;
                padding-right: 16px;
            }
            .carousel-wrapper::-webkit-scrollbar { display: none; }

            .carousel-track {
                transform: none !important;
                width: max-content;
                gap: 16px;
                padding-right: 16px;
            }

            .carousel-item {
                width: calc(100vw - 56px);
                max-width: 340px;
                scroll-snap-align: center;
                flex-shrink: 0;
            }

            .carousel-controls {
                display: none;
            }
        }
}

/* ===== Eventi: filtri ===== */
:where(.events-page.archive-page) {
    /* ── Filter Chips (uguale a rassegna stampa) ── */
            .press-filter-bar { margin-bottom: 16px; }
            .press-filter-scroll {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
                align-items: center;
            }
            .filter-chip {
                display: inline-flex;
                align-items: center;
                gap: 5px;
                padding: 7px 16px;
                border: 1.5px solid #d1d5db;
                border-radius: 999px;
                background: white;
                color: #555;
                font-size: 0.85rem;
                font-weight: 500;
                cursor: pointer;
                transition: all 0.18s ease;
                white-space: nowrap;
                line-height: 1;
            }
            .filter-chip:hover {
                border-color: var(--color-primary, #E63946);
                color: var(--color-primary, #E63946);
                background: rgba(230,57,70,0.04);
            }
            .filter-chip.active {
                background: var(--color-primary, #E63946);
                border-color: var(--color-primary, #E63946);
                color: white;
                box-shadow: 0 2px 10px rgba(230,57,70,0.28);
            }
            .events-sort-select {
                appearance: none;
                -webkit-appearance: none;
                padding: 7px 32px 7px 12px;
                border: 1.5px solid #d1d5db;
                border-radius: 999px;
                background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M7 7l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center/14px;
                font-size: 0.85rem;
                font-weight: 500;
                color: #555;
                cursor: pointer;
                outline: none;
                transition: border-color 0.18s;
            }
            .events-sort-select:hover,
            .events-sort-select:focus { border-color: var(--color-primary, #E63946); }
}

/* ===== Dettaglio evento ===== */
:where(.events-page.detail-page) {
    .detail-hero {
                position: relative;
                height: 60vh;
                min-height: 400px;
                background-color: var(--color-bg-elevated);
                overflow: hidden;
                display: flex;
                align-items: flex-end;
            }

            .detail-hero img {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                object-fit: cover;
                z-index: 1;
            }

            .detail-hero-overlay {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: linear-gradient(to top, rgba(0,0,0,0.8), transparent 60%);
                z-index: 2;
            }

            .detail-hero-content {
                position: relative;
                z-index: 3;
                width: 100%;
                padding-bottom: var(--space-xl);
                color: white;
            }

            .detail-content {
                max-width: 800px;
                margin: 0 auto;
                padding: var(--space-2xl) var(--space-md);
                font-size: var(--text-lg);
                line-height: 1.8;
            }

            .detail-meta {
                display: flex;
                gap: var(--space-lg);
                margin-bottom: var(--space-lg);
                font-size: var(--text-base);
                opacity: 0.9;
            }

            .detail-meta-item {
                display: flex;
                align-items: center;
                gap: var(--space-xs);
            }

            /* Gallery Grid if needed */
            .detail-gallery {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
                gap: var(--space-md);
                margin-top: var(--space-xl);
            }

            .detail-gallery img {
                width: 100%;
                height: 200px;
                object-fit: cover;
                border-radius: var(--radius-md);
                transition: transform 0.3s;
                cursor: pointer;
            }

            .detail-gallery img:hover {
                transform: scale(1.02);
            }
}

/* ===== Dettaglio galleria ===== */
:where(.galleries-page.detail-page) {
    .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-lg); margin-top: var(--space-xl); }
            .gallery-item { cursor: pointer; border-radius: var(--radius-md); overflow: hidden; transition: transform var(--transition-base); position: relative; aspect-ratio: 1; border: 1px solid var(--color-border); }
            .gallery-item:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }
            .gallery-item img { width: 100%; height: 100%; object-fit: cover; }

            /* Titolo galleria — scala fluida */
            #galleryTitle {
                font-size: clamp(1.4rem, 5vw, 2.5rem);
                line-height: 1.2;
            }

            .gallery-detail-header {
                text-align: center;
                padding: var(--space-lg) 0 var(--space-md);
            }

            .gallery-back-link {
                font-size: 0.9rem;
                text-decoration: none;
                border-bottom: 1px solid transparent;
                transition: all 0.2s;
            }

            #galleryDescription {
                max-width: 760px;
                margin: 0 auto;
                line-height: 1.65;
            }

            .gallery-description.collapsed {
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 6;
                overflow: hidden;
            }

            .gallery-description-toggle {
                margin-top: var(--space-sm);
            }

            /* Lightbox */
            .lightbox-overlay { 
                display: none; position: fixed; inset: 0; width: 100%; height: 100%; min-height: 100dvh;
                background: rgba(0,0,0,0.95); z-index: 2000; align-items: center; justify-content: center; 
                overscroll-behavior: contain; touch-action: none;
            }
            .lightbox-content { position: relative; max-width: 95vw; max-height: 95vh; }
            .lightbox-img { max-width: 100%; max-height: 90vh; box-shadow: 0 0 20px rgba(0,0,0,0.5); border-radius: 4px; touch-action: none; user-select: none; }
            .lightbox-close { position: absolute; top: 20px; right: 20px; color: white; font-size: 3rem; cursor: pointer; z-index: 2001; }
            .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 3rem; cursor: pointer; padding: 20px; z-index: 2001; background: rgba(0,0,0,0.2); border-radius: 50%; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; }
            .lightbox-nav:hover { background: rgba(255,255,255,0.2); }
            .lightbox-prev { left: 20px; }
            .lightbox-next { right: 20px; }
            .lightbox-caption { position: absolute; bottom: 20px; left: 0; width: 100%; text-align: center; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.8); background: rgba(0,0,0,0.5); padding: 10px; }

            /* Mobile */
            @media (max-width: 768px) {
                .gallery-detail-header {
                    text-align: left;
                    padding: var(--space-sm) 0 var(--space-sm);
                }
                #galleryDescription {
                    text-align: left;
                    margin: 0;
                    font-size: 0.97rem;
                    line-height: 1.6;
                }
                #galleryTitle {
                    font-size: clamp(1.35rem, 7.2vw, 2rem);
                }
                .gallery-grid {
                    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                    gap: var(--space-sm);
                }
                .lightbox-nav {
                    width: 44px;
                    height: 44px;
                    font-size: 1.5rem;
                    padding: 10px;
                }
                .lightbox-prev { left: 8px; }
                .lightbox-next { right: 8px; }
            }
}

/* ===== Invia le tue foto ===== */
:where(.upload-page) {
    .upload-wrap { max-width: 920px; margin: 0 auto; }
        .upload-card { background:rgba(255,255,255,.72); border:1px solid rgba(255,255,255,.72); border-radius:28px; padding:clamp(18px, 3vw, 30px); box-shadow:0 22px 58px rgba(67,42,28,.10); backdrop-filter:blur(16px); }
        .upload-hero { margin-bottom:18px; padding:18px; border-radius:22px; background:linear-gradient(135deg, rgba(230,57,70,.12), rgba(42,157,143,.12)); border:1px solid rgba(255,255,255,.68); }
        .upload-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
        .upload-grid .full { grid-column:1 / -1; }
        .terms-box { margin-top:16px; border:1px solid rgba(80,54,40,.12); border-radius:18px; background:rgba(255,255,255,.58); padding:14px; font-size:14px; line-height:1.6; }
        .form-note { font-size:13px; color:#666; margin-top:8px; }
        .upload-progress { display:none; margin-top:16px; padding:14px; border:1px solid rgba(42,157,143,.22); border-radius:18px; background:rgba(255,255,255,.66); box-shadow:inset 0 1px 0 rgba(255,255,255,.8); }
        .upload-progress.is-visible { display:block; }
        .upload-progress-top { display:flex; justify-content:space-between; gap:12px; align-items:center; font-size:14px; font-weight:700; color:#3f3028; }
        .upload-progress-percent { color:#2A9D8F; white-space:nowrap; }
        .upload-progress-track { margin-top:10px; height:10px; overflow:hidden; border-radius:999px; background:rgba(80,54,40,.12); }
        .upload-progress-bar { width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg, #2A9D8F, #E9C46A, #E63946); transition:width .22s ease; }
        .upload-progress-detail { margin:8px 0 0; font-size:13px; line-height:1.5; color:#666; }
        @media (max-width: 768px) {
          .upload-grid { grid-template-columns:1fr; }
        }
}

/* ===== Rassegna stampa ===== */
:where(.press-page) {
    /* ── Filter Buttons ── */
            .press-filter-bar {
                margin-bottom: 16px;
            }
            .press-filter-scroll {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
                align-items: center;
            }
            .filter-chip {
                display: inline-flex;
                align-items: center;
                gap: 5px;
                padding: 7px 16px;
                border: 1.5px solid #d1d5db;
                border-radius: 999px;
                background: white;
                color: #555;
                font-size: 0.85rem;
                font-weight: 500;
                cursor: pointer;
                transition: all 0.18s ease;
                white-space: nowrap;
                line-height: 1;
                letter-spacing: 0.01em;
            }
            .filter-chip:hover {
                border-color: var(--color-primary, #E63946);
                color: var(--color-primary, #E63946);
                background: rgba(230,57,70,0.04);
            }
            .filter-chip.active {
                background: var(--color-primary, #E63946);
                border-color: var(--color-primary, #E63946);
                color: white;
                box-shadow: 0 2px 10px rgba(230,57,70,0.28);
            }
            .press-year-select {
                appearance: none;
                -webkit-appearance: none;
                padding: 7px 32px 7px 12px;
                border: 1.5px solid #d1d5db;
                border-radius: 999px;
                background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M7 7l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center/14px;
                font-size: 0.85rem;
                font-weight: 500;
                color: #555;
                cursor: pointer;
                outline: none;
                transition: border-color 0.18s;
            }
            .press-year-select:hover,
            .press-year-select:focus {
                border-color: var(--color-primary, #E63946);
            }

            /* ── Social embeds (Instagram/Reel) ── */
            .social-embed,
            .social-embed-placeholder {
                width: min(100%, 540px);
                margin: 0 auto;
            }
            .social-embed-frame {
                display: block;
                width: 100%;
                min-height: 640px;
                border: 0;
                border-radius: 12px;
                background: #fff;
                box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
            }
            .social-embed-placeholder {
                padding: 24px;
                border: 1px solid rgba(230, 57, 70, 0.18);
                border-radius: 12px;
                background: linear-gradient(135deg, rgba(230, 57, 70, 0.08), rgba(42, 157, 143, 0.08));
                text-align: center;
                color: #333;
            }
            .social-embed-placeholder-icon {
                width: 56px;
                height: 56px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 999px;
                margin-bottom: 12px;
                background: #fff;
                box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
                font-size: 1.6rem;
            }
            .social-embed-actions {
                display: flex;
                justify-content: center;
                flex-wrap: wrap;
                gap: 10px;
                margin-top: 16px;
            }
            .social-card-placeholder {
                background: linear-gradient(135deg, #833AB4, #E1306C 50%, #FCAF45);
                color: #fff;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 8px;
                text-align: center;
                font-weight: 700;
            }
            .social-card-placeholder .social-card-icon {
                font-size: 3rem;
                line-height: 1;
            }
            .social-card-placeholder .social-card-label {
                font-size: 0.95rem;
                letter-spacing: 0.01em;
            }
            .social-source-badge {
                background: rgba(225, 48, 108, 0.12);
                color: #b91d55;
            }
            @media (max-width: 520px) {
                .social-embed-frame {
                    min-height: 560px;
                }
                .social-embed-placeholder {
                    padding: 18px;
                }
            }
}

/* ===== Chi siamo ===== */
:where(.about-page) {
    /* ── Chi Siamo – Mobile-first redesign ── */

            /* Lead intro */
            .chi-intro {
                padding: 36px 20px 28px;
                background: #fff;
            }
            .chi-intro p {
                font-size: 1.13rem;
                line-height: 1.75;
                color: #2d2d2d;
                border-left: 3px solid var(--color-primary, #E63946);
                padding-left: 16px;
                margin: 0;
            }

            /* Section titles */
            .chi-section {
                padding: 32px 20px;
            }
            .chi-section + .chi-section {
                border-top: 1px solid #f0ebe5;
            }
            .chi-section-label {
                font-size: 0.72rem;
                font-weight: 700;
                letter-spacing: 0.15em;
                text-transform: uppercase;
                color: var(--color-primary, #E63946);
                margin-bottom: 8px;
            }
            .chi-section h2 {
                font-family: var(--font-serif, Georgia, serif);
                font-size: clamp(1.5rem, 5vw, 2rem);
                font-weight: 700;
                color: #1a1a1a;
                margin: 0 0 16px;
                line-height: 1.2;
            }
            .chi-section p {
                font-size: 0.97rem;
                line-height: 1.75;
                color: #444;
                margin: 0 0 16px;
            }

            /* Mission list */
            .mission-list {
                list-style: none;
                padding: 0;
                margin: 0;
                display: flex;
                flex-direction: column;
                gap: 10px;
            }
            .mission-list li {
                display: flex;
                align-items: flex-start;
                gap: 12px;
                background: #fdf9f7;
                border-radius: 10px;
                padding: 12px 14px;
                font-size: 0.93rem;
                line-height: 1.55;
                color: #333;
            }
            .mission-list li::before {
                content: '';
                flex-shrink: 0;
                width: 1.15em;
                height: 1.15em;
                margin-top: 0.2em;
                background-color: var(--color-primary, #E63946);
                -webkit-mask: var(--pi) center / contain no-repeat;
                mask: var(--pi) center / contain no-repeat;
            }

            /* Value cards */
            .values-grid {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 12px;
                margin-top: 4px;
            }
            .value-card {
                background: #fff;
                border: 1.5px solid #f0ebe5;
                border-radius: 12px;
                padding: 16px 14px;
                text-align: center;
            }
            .value-card-icon {
                font-size: 1.8rem;
                margin-bottom: 8px;
            }
            .value-card-title {
                font-weight: 700;
                font-size: 0.88rem;
                color: #1a1a1a;
                margin-bottom: 6px;
            }
            .value-card-desc {
                font-size: 0.8rem;
                color: #666;
                line-height: 1.5;
            }

            /* Events list */
            .events-list {
                list-style: none;
                padding: 0;
                margin: 0;
                display: flex;
                flex-direction: column;
                gap: 8px;
            }
            .events-list li {
                display: flex;
                gap: 12px;
                align-items: flex-start;
                font-size: 0.93rem;
                color: #333;
                line-height: 1.55;
            }
            .events-list li strong {
                color: #1a1a1a;
            }
            .event-dot {
                width: 8px;
                height: 8px;
                border-radius: 50%;
                background: var(--color-primary, #E63946);
                flex-shrink: 0;
                margin-top: 6px;
            }

            /* CTA strip */
            .chi-cta {
                background: linear-gradient(135deg, #E63946 0%, #c1121f 100%);
                padding: 32px 20px;
                text-align: center;
                color: white;
            }
            .chi-cta h3 {
                font-size: 1.25rem;
                font-weight: 700;
                margin: 0 0 8px;
            }
            .chi-cta p {
                font-size: 0.9rem;
                opacity: 0.88;
                margin: 0 0 20px;
            }
            .chi-cta a {
                display: inline-block;
                background: white;
                color: #c1121f;
                font-weight: 700;
                font-size: 0.9rem;
                padding: 11px 28px;
                border-radius: 999px;
                text-decoration: none;
            }

            @media (min-width: 640px) {
                .chi-intro { padding: 48px 40px 36px; }
                .chi-section { padding: 40px 40px; }
                .values-grid { grid-template-columns: repeat(4, 1fr); }
            }
}

/* ===== Area riservata ===== */
:where(.reserved-page) {
    .dashboard-container {
                padding: var(--space-3xl) 0;
                min-height: 80vh;
            }

            .welcome-card {
                background: var(--color-primary);
                color: white;
                padding: var(--space-xl);
                border-radius: var(--radius-lg);
                margin-bottom: var(--space-2xl);
                display: flex;
                align-items: center;
                justify-content: space-between;
                flex-wrap: wrap;
                gap: var(--space-md);
            }

            .calendar-container {
                background: var(--color-bg-elevated);
                padding: var(--space-xl);
                border-radius: var(--radius-lg);
                box-shadow: var(--shadow-md);
            }

            .fc-header-toolbar {
                flex-wrap: wrap;
                gap: var(--space-sm);
            }

            .fc-button-primary {
                background-color: var(--color-primary) !important;
                border-color: var(--color-primary) !important;
            }

            .fc-event {
                cursor: pointer;
            }
}
