/* ==========================================================
   MOSTRA FOTOGRAFICA DIGITALE "CAMERA LUCIS"
   Concorso & Progetto "Ti Racconto Francesco"
   Realizzato per IIS Della Corte - Vanvitelli & Fondazione ACRAB
   ========================================================== */

/* 1. TYPOGRAPHY & DESIGN TOKENS D'AUTORE */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Syne:wght@500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    /* Palette Colori Francescana Museale: Ossidiana, Oro Caldo & Luce Chiara */
    --lux-bg-deep: #07080a;
    --lux-surface-dark: #0f1117;
    --lux-surface-card: #151821;
    --lux-gold-primary: #d4af37;
    --lux-gold-bright: #fbbf24;
    --lux-gold-glow: rgba(212, 175, 55, 0.35);
    --lux-gold-subtle: rgba(212, 175, 55, 0.12);
    --lux-amber: #f59e0b;
    --lux-text-primary: #f8fafc;
    --lux-text-muted: #94a3b8;
    --lux-text-gold: #fef08a;
    --lux-border-gold: rgba(212, 175, 55, 0.35);
    --lux-border-glass: rgba(255, 255, 255, 0.12);
    --lux-glass-bg: rgba(15, 17, 23, 0.82);
    
    /* Ombre volumetriche realistiche */
    --lux-shadow-floating: 
        0 14px 34px -10px rgba(0, 0, 0, 0.85),
        0 24px 48px -18px rgba(0, 0, 0, 0.75),
        0 0 0 1px rgba(255, 255, 255, 0.08);
        
    --lux-shadow-hover: 
        0 25px 65px -12px rgba(0, 0, 0, 0.95),
        0 0 45px rgba(212, 175, 55, 0.35),
        0 0 0 1.5px rgba(251, 191, 36, 0.8);
}

/* ==========================================================
   SCROLLBAR MUSEALE PERSONALIZZATA IN ORO SATINATO
   ========================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 12, 18, 0.7);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    border-radius: 9999px;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lux-gold-bright);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--lux-gold-primary) rgba(10, 12, 18, 0.7);
}

/* Sfondo Immersivo: Luce radiale da abside/navata e grana pellicola */
body:has(.gallery) {
    background-color: var(--lux-bg-deep);
    background-image: 
        /* Cono di luce superiore / Faro museale */
        radial-gradient(circle at 50% -15%, rgba(212, 175, 55, 0.22) 0%, transparent 60%),
        /* Sfumature organiche di penombra */
        radial-gradient(ellipse 80% 50% at 85% 30%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 70% 60% at 15% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #0d0f15 0%, var(--lux-bg-deep) 100%);
    background-attachment: fixed;
    color: var(--lux-text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    position: relative;
}

/* Trama a microsfere / grana materica */
body:has(.gallery)::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

/* ==========================================================
   MODALITÀ GALLERIA 3D NATIVA CON THREE.JS
   ========================================================== */
#three-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    outline: none;
    transition: opacity 0.4s ease;
}

/* Quando la galleria 3D è attiva, il canvas riceve gli eventi del mouse/touch ed è visibile */
body.mode-3d #three-canvas {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: grab;
    z-index: 20 !important;
}

body.mode-3d #three-canvas:active {
    cursor: grabbing;
}

/* Nascondi la griglia HTML statica quando è attiva la modalità 3D */
body.mode-3d .gallery {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Quando NON è in modalità 3D (visualizzazione Griglia), nascondi tutto il carosello 3D */
body:not(.mode-3d) #three-canvas,
body:not(.mode-3d) .gallery-3d-console,
body:not(.mode-3d) #three-tooltip {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body:not(.mode-3d) .gallery {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.mode-3d {
    overflow: hidden !important;
    height: 100vh !important;
}

/* ==========================================================
   INTERFACCIA D'ECCELLENZA 3D: PODIUM, TIMELINE & TOOLTIP
   ========================================================== */

/* ==========================================================
   CONSOLE 3D INTEGRATA A BASSO PROFILO (NON COPRE LE IMMAGINI)
   ========================================================== */
.gallery-3d-console {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 840px);
    background: rgba(12, 14, 20, 0.88);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 18px;
    padding: 10px 18px;
    display: none;
    flex-direction: column;
    gap: 8px;
    box-shadow: 
        0 16px 40px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(212, 175, 55, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    z-index: 100;
    pointer-events: auto;
    animation: luxury-console-appear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.mode-3d .gallery-3d-console {
    display: flex;
}

@keyframes luxury-console-appear {
    0% { opacity: 0; transform: translate(-50%, 20px) scale(0.97); }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Riga Superiore: Metadati e Azioni */
.console-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
}

.console-meta-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.console-badge {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(245, 158, 11, 0.15) 100%);
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: var(--lux-text-gold);
    font-family: 'Fira Code', monospace;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    letter-spacing: 0.8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.console-titles {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.console-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.4px;
}

.console-author {
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.console-author i {
    color: var(--lux-gold-bright);
    margin-right: 3px;
}

.console-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.console-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    white-space: nowrap;
}

.console-btn.primary {
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    color: #07080a;
    border: 1px solid var(--lux-gold-bright);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}

.console-btn.primary:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.55);
}

.console-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.console-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
    color: var(--lux-text-gold);
    transform: translateY(-1px);
}

/* Riga Inferiore: Scrubber Timeline e Step */
.console-nav-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.console-nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.25s ease;
}

.console-nav-btn:hover {
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    color: #07080a;
    border-color: var(--lux-gold-bright);
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
}

.console-slider-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 120px;
}

.timeline-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

.timeline-range:hover {
    background: rgba(212, 175, 55, 0.25);
}

.timeline-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, var(--lux-gold-bright) 100%);
    border: 2px solid #07080a;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-range::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    box-shadow: 0 0 16px rgba(251, 191, 36, 1);
}

.console-tour-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--lux-border-gold);
    color: var(--lux-text-gold);
    padding: 5px 12px;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.console-tour-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--lux-gold-bright);
    color: #ffffff;
    transform: scale(1.05);
}

.console-tour-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border-color: #f87171;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
}

/* 3. TOOLTIP OPERA 3D */
#three-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -125%);
    background: rgba(12, 14, 20, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--lux-border-gold);
    border-radius: 12px;
    padding: 9px 16px;
    color: #ffffff;
    pointer-events: none;
    z-index: 500;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.15s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 18px rgba(212, 175, 55, 0.25);
    white-space: nowrap;
    text-align: center;
}

#three-tooltip.visible {
    opacity: 1;
}

/* Mai mostrare il tooltip 3D se una modale o lightbox è aperta */
body:has(.carousel-desc-modal.active) #three-tooltip,
body:has(.lightbox.active) #three-tooltip,
.carousel-desc-modal.active ~ #three-tooltip {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#three-tooltip .tt-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
}

#three-tooltip .tt-author {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.74rem;
    color: var(--lux-text-gold);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

#three-tooltip .tt-hint {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
    font-style: italic;
}

/* SCHEDA DIDASCALIA & DESCRIZIONE FLUTTUANTE CAROSELLO 3D  */
.carousel-desc-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-desc-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.desc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 5, 8, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.desc-modal-card {
    position: relative;
    width: min(92vw, 580px);
    max-height: 85vh;
    background: linear-gradient(160deg, #151824 0%, #0d0f16 100%);
    border: 1.5px solid var(--lux-border-gold);
    border-radius: 20px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.95), 
        0 0 35px rgba(212, 175, 55, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.carousel-desc-modal.active .desc-modal-card {
    transform: scale(1) translateY(0);
}

.desc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
    background: rgba(255, 255, 255, 0.02);
}

.desc-modal-tag {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--lux-gold-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}

.desc-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    transform: none !important;
    animation: none !important;
}

.desc-modal-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ffffff;
    transform: none !important;
}

.desc-modal-content {
    padding: 22px 24px;
    overflow-y: auto;
    overflow-x: hidden !important;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(85vh - 72px);
    box-sizing: border-box;
}

.desc-modal-content::-webkit-scrollbar {
    width: 6px;
}

.desc-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 9999px;
    margin: 8px 0;
}

.desc-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.desc-modal-content::-webkit-scrollbar-thumb:hover {
    background: #ffffff;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.85);
}

.desc-modal-badge {
    align-self: flex-start;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: var(--lux-text-gold);
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 9999px;
    letter-spacing: 0.8px;
}

.desc-modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.25;
}

.desc-modal-author {
    color: #cbd5e1;
    font-size: 0.98rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.desc-modal-author i {
    color: var(--lux-gold-bright);
}

.desc-modal-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.35) 0%, transparent 100%);
    margin: 4px 0;
}

.desc-modal-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desc-modal-section-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--lux-gold-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.desc-modal-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    line-height: 1.65;
    color: #f8fafc;
    margin: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 18px;
    border-radius: 12px;
    white-space: pre-line;
}

.desc-modal-note {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #cbd5e1;
    font-style: italic;
    margin: 0;
    padding: 12px 16px;
    border-left: 3px solid var(--lux-gold-primary);
    background: rgba(212, 175, 55, 0.06);
    border-radius: 0 8px 8px 0;
    white-space: pre-line;
}

.desc-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.desc-modal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.desc-modal-action-btn {
    padding: 8px 16px;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
}

.desc-modal-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
    color: var(--lux-text-gold);
}

.desc-modal-action-btn.primary {
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    border: 1px solid var(--lux-gold-bright);
    color: #07080a;
}

.desc-modal-action-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.55);
}


/* ==========================================================
   2. HEADER ESPOSITIVO D'ALTO PROFILO (TESTATA MONUMENTALE)
   ========================================================== */
.gallery-header {
    max-width: 1320px;
    margin: 16px auto 16px auto;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(12, 14, 20, 0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 9999px;
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.75),
        0 0 20px rgba(212, 175, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    position: relative;
    box-sizing: border-box;
    z-index: 100;
}

/* Titolo Monumentale con Finitura Oro e Riflessi di Luce */
.gallery-header h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, #fef08a 40%, #d4af37 80%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.3));
    margin: 0;
    text-align: center;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
    transition: filter 0.4s ease;
}

.gallery-header h2:hover {
    filter: drop-shadow(0 4px 16px rgba(251, 191, 36, 0.6));
}



/* Switcher Modalità Vista (Capsula Satinata Proporzionata) */
.view-toggle-container {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    padding: 2.5px;
    gap: 3px;
    height: 32px;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.view-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0 12px;
    height: 26px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    white-space: nowrap;
}

.view-btn i {
    font-size: 0.75rem;
}

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

.view-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.view-btn.active {
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    color: #0b0c10;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.4);
}

/* Azioni a Destra dell'Header */
.header-right-actions {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-tool-btn,
.gallery-header .close-btn {
    position: static;
    transform: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--lux-text-gold);
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-size: 13px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
}

.header-tool-btn:hover {
    background: rgba(212, 175, 55, 0.22);
    border-color: var(--lux-gold-bright);
    color: #ffffff;
    transform: translateY(-1px) scale(1.08);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
}

.header-tool-btn.muted {
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.2);
}


.gallery-header .close-btn:hover {
    background: rgba(225, 29, 72, 0.3);
    border-color: #f43f5e;
    color: #ffffff;
    transform: none !important;
    box-shadow: none !important;
}

/* Posizionamento Floating dell'Header in modalità 3D */
body.mode-3d .gallery-header {
    position: fixed;
    top: 14px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    margin: 0;
    width: min(94vw, 1320px);
    max-width: 1320px;
    z-index: 100;
}

/* ==========================================================
   3. GRIGLIA ESPOSITIVA SCULTOREA ("GALLERY RUNWAY")
   ========================================================== */
.gallery {
    max-width: 1440px;
    margin: 20px auto 90px auto;
    padding: 20px 36px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 46px 36px;
    align-items: start;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    z-index: 10;
}

/* ==========================================================
   4. FRAME CONTAINER & FLIP CARD 3D D'AVANGUARDIA
   ========================================================== */
.frame-container {
    perspective: 1600px;
    position: relative;
    width: 100%;
    opacity: 0;
    transform: translateY(35px) scale(0.96);
    animation: luxury-reveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animazione di apparizione a cascata (Staggered Entrance) */
.frame-container:nth-child(1) { animation-delay: 0.08s; }
.frame-container:nth-child(2) { animation-delay: 0.16s; }
.frame-container:nth-child(3) { animation-delay: 0.24s; }
.frame-container:nth-child(4) { animation-delay: 0.32s; }
.frame-container:nth-child(5) { animation-delay: 0.40s; }
.frame-container:nth-child(6) { animation-delay: 0.48s; }
.frame-container:nth-child(7) { animation-delay: 0.56s; }
.frame-container:nth-child(8) { animation-delay: 0.64s; }
.frame-container:nth-child(n+9) { animation-delay: 0.72s; }

@keyframes luxury-reveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card Flipper 3D */
.frame-flipper {
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.34, 1.45, 0.7, 1);
}

.frame-flipper.flipped {
    transform: rotateY(180deg);
}

/* ==========================================================
   5. L'OPERA FRONTALE: CORNICE MUSEALE D'ORO & ELEVAZIONE
   ========================================================== */
.frame {
    position: relative;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
    transform-origin: center center;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transform-style: preserve-3d;
}

.frame-front {
    position: relative;
    width: 100%;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 2;
    transform: rotateY(0deg);
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transition: opacity 0.3s ease;
}

.frame-flipper.flipped .frame-front {
    pointer-events: none !important;
}

/* Rimosso box sheen glare esterno: solo la cornice è visibile */
.frame::after {
    display: none !important;
}

/* Effetto Hover: Bagliore Giallo Caldo / Ambra Raffinato */
@media (hover: hover) {
    .frame-container:hover {
        z-index: 40;
    }
    .frame-container:hover .frame-front {
        box-shadow: none !important;
        border: none !important;
    }
    .frame-container:hover .img-wrapper {
        transform: none !important;
    }
    .frame-container:hover .img-wrapper::after {
        filter: 
            drop-shadow(0 0 3px rgba(255, 220, 50, 1)) 
            drop-shadow(0 0 16px rgba(251, 191, 36, 0.75)) 
            drop-shadow(0 0 28px rgba(245, 158, 11, 0.45)) 
            drop-shadow(0 6px 16px rgba(0, 0, 0, 0.95)) 
            brightness(1.15);
    }
    .frame-container:hover img {
        transform: none !important;
        filter: brightness(1.05) contrast(1.02);
    }
    .frame-container:hover .caption h3 {
        color: #fef08a;
        text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
    }
}

/* Wrapper Immagine con Nuova Cornice Geometrica Artistica */
.img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 560 / 381;
    overflow: visible;
    border-radius: 0;
    background-color: transparent;
    padding: 14px 18px;
    box-sizing: border-box;
    box-shadow: none;
    transition: 
        box-shadow 0.35s ease, 
        aspect-ratio 0.3s ease;
}

/* Nuova Cornice Geometrica con Angoli Artistici Orizzontale (Landscape) con Illuminazione Gialla */
.img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('Img/frames/cornice_landscape.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 5;
    filter: 
        drop-shadow(0 0 1.5px rgba(255, 230, 80, 0.95)) 
        drop-shadow(0 0 8px rgba(251, 191, 36, 0.5)) 
        drop-shadow(0 3px 10px rgba(0, 0, 0, 0.9));
    transition: filter 0.35s ease, background-image 0.3s ease;
}

/* SUPPORTO FOTO VERTICALI (PORTRAIT) */
.frame-container.is-portrait .img-wrapper {
    aspect-ratio: 336 / 555;
    padding: 16px 14px;
}

.frame-container.is-portrait .img-wrapper::after {
    background-image: url('Img/frames/cornice_portrait.png');
}

/* Skeleton Loading Moderno */
.skeleton-loading {
    background: linear-gradient(90deg, #151821 25%, #232734 50%, #151821 75%);
    background-size: 200% 100%;
    animation: lux-shimmer 1.8s infinite;
}

@keyframes lux-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-loading img {
    opacity: 0;
}

/* Immagine Fotografica dell'Opera inserita dentro la cornice geometrica */
.frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.9);
    transition: 
        filter 0.35s ease, 
        opacity 0.4s ease;
    opacity: 1;
}

/* ==========================================================
   6. DIDASCALIA SOTTO LA CORNICE D'ORO (FRONT)
   ========================================================== */
.caption {
    position: relative;
    margin-top: 14px;
    padding: 0 48px 2px 2px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    pointer-events: none;
    z-index: 10;
}

.caption-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    pointer-events: none;
}

/* Titolo dell'Opera */
.caption h3,
.caption-text h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.caption p:first-of-type,
.caption-text p:first-of-type {
    display: none; /* Nascondiamo la descrizione estesa sulla card frontale per pulizia grafica */
}

/* Autore / Studente Creatore */
.caption p:last-of-type,
.caption-text p:last-of-type {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--lux-text-gold);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 4px 0 0 0;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tasto Info e Descrizione Opera (Esclusivo per Vista a Griglia) */
.grid-info-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: rgba(18, 21, 30, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--lux-border-gold);
    color: var(--lux-gold-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer !important;
    pointer-events: auto !important;
    box-shadow: 
        0 4px 14px rgba(0, 0, 0, 0.7), 
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50 !important;
    outline: none;
}

.grid-info-btn * {
    pointer-events: none;
}

.grid-info-btn:hover {
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    border-color: #ffffff;
    color: #07080a;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 
        0 0 22px rgba(251, 191, 36, 0.75), 
        0 8px 20px rgba(0, 0, 0, 0.9);
}

.grid-info-btn:active {
    transform: translateY(-50%) scale(0.94);
}

.frame-container:hover .grid-info-btn {
    border-color: rgba(251, 191, 36, 0.8);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.8),
        0 0 12px rgba(212, 175, 55, 0.35);
}

/* Disattivazione vecchi pulsanti non usati */
.info-flip-btn {
    display: none !important;
}

/* ==========================================================
   7. RETRO CARD: SCHEDA CRITICA MUSEALE (GLASSMORPHISM)
   ========================================================== */
.frame-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    background: #0c0e15 !important;
    background-image: 
        radial-gradient(ellipse 95% 70% at 50% 0%, rgba(212, 175, 55, 0.16) 0%, transparent 65%),
        linear-gradient(155deg, #151926 0%, #090a10 100%) !important;
    padding: 16px 18px 14px 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1.5px solid var(--lux-border-gold);
    border-radius: 12px;
    color: var(--lux-text-primary);
    z-index: 1;
    overflow: hidden;
    box-shadow: 
        0 16px 38px -10px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(212, 175, 55, 0.15),
        inset 0 0 25px rgba(212, 175, 55, 0.08);
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transform-style: preserve-3d;
    pointer-events: none !important;
    cursor: default;
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.frame-flipper.flipped .frame-back {
    pointer-events: auto !important;
    z-index: 25 !important;
}

.frame-back:hover {
    border-color: rgba(251, 191, 36, 0.7);
    box-shadow: 
        0 20px 48px -10px rgba(0, 0, 0, 0.95),
        0 0 28px rgba(251, 191, 36, 0.25),
        inset 0 0 30px rgba(212, 175, 55, 0.12);
}

/* Griglia e ornamenti del retro */
.back-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 5;
    overflow: hidden;
}

/* Intestazione Retro con Badge */
.back-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
    flex-shrink: 0;
}

.back-badge {
    font-family: 'Fira Code', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lux-text-gold);
    background: rgba(212, 175, 55, 0.14);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Titolo Opera Retro */
.back-content h4 {
    font-family: 'Syne', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    line-height: 1.25;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Area Scrollabile Informazioni & Descrizione */
.back-info-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    margin-bottom: 8px;
}

.back-info-scroll::-webkit-scrollbar {
    width: 4px;
}

.back-info-scroll::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.4);
    border-radius: 4px;
}

/* Righe Dati */
.back-row {
    font-size: 0.85rem;
    line-height: 1.45;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.back-row .label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    color: var(--lux-gold-primary);
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.back-row .val {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.86rem;
    color: #f8fafc;
    font-weight: 400;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-line;
}

.back-row.desc-row .val {
    color: #e2e8f0;
}

.back-row.note-row {
    background: rgba(212, 175, 55, 0.06);
    border-left: 2px solid var(--lux-gold-primary);
}

/* Barra Azioni Inferiore */
.back-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.back-zoom-btn {
    padding: 6px 12px;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    border: 1px solid var(--lux-gold-bright);
    color: #07080a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.25s ease;
}

.back-zoom-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.55);
}

.back-flip-btn {
    padding: 6px 12px;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--lux-text-gold);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
}

.back-flip-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--lux-gold-bright);
    color: #ffffff;
}

.flip-hint {
    margin-top: auto;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--lux-text-gold);
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid var(--lux-border-gold);
    border-radius: 9999px;
    padding: 8px 14px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.frame-back:hover .flip-hint {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--lux-gold-bright);
    color: #ffffff;
}

/* ==========================================================
   8. MODALITÀ AMPIA (2 FOTO PER RIGA - TESTO MAI TAGLIATO)
   ========================================================== */
.gallery.compact-view {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 36px 28px !important;
    padding: 20px 36px !important;
}

.gallery.compact-view .frame {
    padding: 0 !important;
}

.gallery.compact-view .caption {
    margin-top: 14px !important;
    padding: 0 48px 2px 2px !important;
}

.gallery.compact-view .caption h3 {
    font-size: 1.25rem !important;
}

.gallery.compact-view .caption p:last-of-type {
    font-size: 0.88rem !important;
    margin-top: 5px !important;
}

.gallery.compact-view .info-flip-btn {
    width: 36px !important;
    height: 36px !important;
    bottom: 2px !important;
    right: 2px !important;
    font-size: 14px !important;
}

/* Empty State della Galleria */
.gallery-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.gallery-empty-state i {
    font-size: 3.5rem;
    color: var(--lux-gold-primary);
    margin-bottom: 20px;
    opacity: 0.85;
}

.gallery-empty-state h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.8rem;
    color: #ffffff;
    margin: 0 0 10px 0;
}

.gallery-empty-state p {
    color: #94a3b8;
    font-size: 1rem;
    max-width: 450px;
    margin: 0 0 25px 0;
}

.empty-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--lux-gold-bright) 0%, var(--lux-gold-primary) 100%);
    color: #0b0c10;
    text-decoration: none;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 9999px;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
}

.empty-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(251, 191, 36, 0.6);
}

/* ==========================================================
   9. LIGHTBOX CINEMATOGRAFICO AD ALTA FEDELTÀ ("LUX THEATER")
   ========================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 8, 0.95);
    backdrop-filter: blur(35px) saturate(180%);
    -webkit-backdrop-filter: blur(35px) saturate(180%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 24px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    z-index: 99999;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
    user-select: none;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Barra superiore Lightbox */
.lightbox-topbar {
    position: absolute;
    top: 24px;
    left: 36px;
    right: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100002;
}

.lightbox-counter {
    background: rgba(18, 20, 28, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--lux-border-gold);
    color: var(--lux-text-gold);
    font-family: 'Fira Code', monospace;
    font-size: 0.90rem;
    font-weight: 600;
    padding: 8px 24px;
    border-radius: 9999px;
    letter-spacing: 2px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-action-btn {
    background: rgba(18, 20, 28, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--lux-border-glass);
    color: #cbd5e1;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.lb-action-btn:hover, .lb-action-btn.active {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--lux-gold-bright);
    color: var(--lux-gold-bright);
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.45);
}

.lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 92vw;
    max-height: 88vh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

/* Immagine Ingrandita con Cornice e Proporzioni Intatte */
.lightbox img {
    max-width: min(88vw, 1200px);
    max-height: min(63vh, calc(100vh - 230px));
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 25px 80px -10px rgba(0, 0, 0, 0.98),
        0 0 50px rgba(212, 175, 55, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.9);
    transition: transform 0.25s ease-out, opacity 0.4s ease;
    opacity: 0;
}

.lightbox.active img {
    opacity: 1;
}

/* Scheda d'Autore Museale nel Lightbox ("Artwork Card") */
.lightbox figcaption.lb-artwork-card {
    position: relative;
    width: 100%;
    max-width: min(740px, 90vw);
    margin-top: 16px;
    padding: 0;
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(18, 22, 32, 0.92) 0%, rgba(10, 12, 18, 0.96) 100%);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--lux-border-gold);
    border-radius: 18px;
    box-shadow: 
        0 18px 45px -8px rgba(0, 0, 0, 0.95), 
        0 0 30px rgba(212, 175, 55, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow: hidden;
    text-align: left;
}

.lightbox.active figcaption.lb-artwork-card {
    opacity: 1;
    transform: translateY(0);
}

.lightbox figcaption.lb-artwork-card:hover {
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 
        0 24px 60px -8px rgba(0, 0, 0, 0.98), 
        0 0 40px rgba(212, 175, 55, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Contenitore interno con padding */
.lb-card-inner {
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: all 0.3s ease;
}

/* Header con chip d'autore, contatore e toggle */
.lb-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lb-header-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Chip Autore */
.lb-tag-author {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(212, 175, 55, 0.08) 100%);
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: var(--lux-gold-bright);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 5px 13px;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.lb-tag-author i {
    font-size: 0.95rem;
    color: var(--lux-gold-bright);
}

/* Chip Numero Foto */
.lb-tag-index {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 9999px;
}

.lb-tag-index i {
    font-size: 0.82rem;
    color: rgba(212, 175, 55, 0.8);
}

/* Bottone per ridurre/espandere scheda */
.lb-card-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.25s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.lb-card-toggle:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--lux-gold-bright);
    color: var(--lux-gold-bright);
    transform: scale(1.08);
}

/* Sezione Testo (Titolo + Descrizione) */
.lb-card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.3s ease;
}

.lb-card-title {
    font-family: 'Syne', 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(1.05rem, 1.4vw, 1.25rem);
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.2px;
    line-height: 1.35;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.lb-card-desc {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(0.85rem, 1.05vw, 0.94rem);
    color: #cbd5e1;
    line-height: 1.48;
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.15px;
}

/* Stato Minimizzato della Scheda */
.lightbox figcaption.lb-artwork-card.minimized {
    max-width: fit-content;
    border-radius: 9999px;
    background: rgba(14, 17, 24, 0.88);
    cursor: pointer;
}

.lightbox figcaption.lb-artwork-card.minimized .lb-card-inner {
    padding: 6px 14px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.lightbox figcaption.lb-artwork-card.minimized .lb-card-content {
    display: none !important;
}

.lightbox figcaption.lb-artwork-card.minimized .lb-tag-index {
    display: none !important;
}

.lightbox figcaption.lb-artwork-card.minimized .lb-tag-author {
    padding: 2px 8px;
    font-size: 0.78rem;
    border: none;
    background: transparent;
}

/* Frecce Fluttuanti del Lightbox */
.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #f8fafc;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    background: rgba(18, 20, 28, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--lux-border-glass);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100000;
    touch-action: manipulation;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    font-size: 24px;
}

.prev {
    left: 40px;
}

.next {
    right: 40px;
}

.prev:hover, .next:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--lux-gold-bright);
    color: var(--lux-gold-bright);
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

/* Pulsante Close dentro Lightbox */
.lightbox-actions .close {
    background: rgba(18, 20, 28, 0.85);
    border: 1px solid var(--lux-border-glass);
    color: #cbd5e1;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.lightbox-actions .close:hover {
    background: rgba(225, 29, 72, 0.3);
    border-color: #f43f5e;
    color: #ffffff;
    transform: none !important;
}

/* Disattivazione assoluta di rotazioni e animazioni sui pulsanti X di chiusura */
.desc-modal-close,
.desc-modal-close:hover,
.desc-modal-close i,
.desc-modal-close:hover i,
.gallery-header .close-btn,
.gallery-header .close-btn:hover,
.gallery-header .close-btn i,
.gallery-header .close-btn:hover i,
.lightbox-actions .close,
.lightbox-actions .close:hover,
.lightbox-actions .close i,
.lightbox-actions .close:hover i {
    transform: none !important;
    animation: none !important;
}

/* Clone per transizione zoom naturale alla chiusura */
.zoom-clone {
    position: fixed;
    z-index: 9999;
    object-fit: cover;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

/* ==========================================================
   10. PULSANTE FILM BUTTON (PER LA COMPATIBILITÀ DEL PROGETTO)
   ========================================================== */
.film-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: #111319;
  color: var(--lux-gold-bright);
  text-decoration: none;
  font-family: 'Fira Code', monospace;
  font-weight: bold;
  padding: 6px 0;
  border-radius: 6px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--lux-border-gold);
  width: 210px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.sprockets {
  width: 100%;
  height: 10px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 40%, transparent 40%);
  background-size: 20px 10px;
  background-repeat: repeat-x;
  opacity: 0.85;
}

.btn-text {
  padding: 14px 0;
  letter-spacing: 3px;
  font-size: 1.1rem;
}

.film-button:hover {
  background-color: #1a1d26;
  color: #ffffff;
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.35);
  border-color: var(--lux-gold-bright);
}

.film-button:hover .sprockets {
  background-image: radial-gradient(circle, var(--lux-gold-bright) 40%, transparent 40%);
  animation: slide-film 1s linear infinite;
}

@keyframes slide-film {
  from { background-position: 0 0; }
  to { background-position: 40px 0; }
}

/* ==========================================================
   11. RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================== */
@media (max-width: 992px) {
    .gallery-header {
        padding: 0 24px;
        margin: 25px auto 20px auto;
    }
    .view-toggle-container {
        left: 24px;
    }
    .gallery-header .close-btn {
        right: 24px;
    }
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 32px 24px;
        padding: 16px 24px;
    }
}

@media (max-width: 680px) {
    .gallery-header {
        flex-direction: column;
        gap: 16px;
        padding: 0 16px;
        margin: 20px auto 14px auto;
    }
    .gallery-header h2 {
        font-size: 1.75rem;
        letter-spacing: 2px;
        margin-top: 10px;
    }
    .gallery-header h2::after {
        letter-spacing: 2px;
        font-size: 0.68rem;
    }
    .view-toggle-container {
        position: static;
        transform: none;
        order: 2;
    }
    .gallery-header .close-btn {
        position: absolute;
        top: 0;
        right: 16px;
        transform: none;
        width: 40px;
        height: 40px;
    }
    .gallery {
        grid-template-columns: 1fr;
        gap: 28px 16px;
        padding: 16px;
    }
    .gallery.compact-view {
        grid-template-columns: 1fr !important;
        gap: 28px 16px !important;
        padding: 16px !important;
    }
    .frame {
        padding: 0 !important;
    }
    .caption h3 {
        font-size: 1.05rem;
    }
    .lightbox {
        padding: 16px 10px;
    }
    .lightbox-topbar {
        top: 14px;
        left: 14px;
        right: 14px;
    }
    .lightbox-counter {
        font-size: 0.8rem;
        padding: 6px 14px;
    }
    .lb-action-btn {
        width: 42px;
        height: 42px;
        font-size: 15px;
    }
    .lightbox img {
        max-height: 56vh;
    }
    .lightbox figcaption.lb-artwork-card {
        max-width: 94vw;
        margin-top: 12px;
        border-radius: 14px;
    }
    .lb-card-inner {
        padding: 10px 14px;
        gap: 6px;
    }
    .lb-card-title {
        font-size: 0.98rem;
    }
    .lb-card-desc {
        font-size: 0.82rem;
        line-height: 1.4;
    }
    .lb-tag-author {
        font-size: 0.76rem;
        padding: 4px 10px;
    }
    .lb-tag-index {
        font-size: 0.72rem;
        padding: 4px 8px;
    }
    .prev, .next {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .prev { left: 10px; }
    .next { right: 10px; }

    /* Adattamento Mobile Console 3D */
    .gallery-3d-console {
        bottom: 8px;
        padding: 8px 12px;
        width: 95vw;
        border-radius: 14px;
        gap: 6px;
    }
    .console-title {
        font-size: 0.95rem;
    }
    .console-author {
        display: none;
    }
    .console-btn .btn-label {
        display: none;
    }
    .console-btn {
        padding: 6px 10px;
    }
    .console-tour-btn .tour-text {
        display: none;
    }
    .view-btn .btn-text {
        display: none;
    }
    .view-btn {
        padding: 4px 6px;
    }
}

/* ==========================================================
   PULSANTE VISTA CAROSELLO (GRIGLIA -> CAROSELLO 3D)
   Stile Glassmorphism & Accenti Oro Coordinati
   ========================================================== */
.grid-back-to-3d-bar {
    position: sticky;
    top: 20px;
    z-index: 80;
    display: flex;
    justify-content: flex-start;
    padding: 16px 28px 24px;
    pointer-events: none;
}

.back-to-3d-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px 10px 14px;
    background: rgba(18, 22, 30, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    color: #f8fafc;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: 
        0 14px 35px -8px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.back-to-3d-btn .btn-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(212, 175, 55, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

.back-to-3d-btn .btn-primary-label {
    color: #f8fafc;
    letter-spacing: -0.01em;
    transition: color 0.25s ease;
}

.back-to-3d-btn .btn-arrow {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-left: 2px;
    transition: transform 0.25s ease, color 0.25s ease;
}

.back-to-3d-btn:hover {
    background: rgba(26, 32, 44, 0.88);
    border-color: rgba(251, 191, 36, 0.55);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 
        0 20px 45px -10px rgba(0, 0, 0, 0.85),
        0 0 24px rgba(212, 175, 55, 0.3),
        0 0 0 1.5px rgba(251, 191, 36, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.back-to-3d-btn:hover .btn-icon-wrap {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.4), rgba(212, 175, 55, 0.2));
    border-color: rgba(251, 191, 36, 0.9);
    color: #fef08a;
    transform: scale(1.08) rotate(12deg);
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.5);
}

.back-to-3d-btn:hover .btn-primary-label {
    color: #ffffff;
}

.back-to-3d-btn:hover .btn-arrow {
    color: #fbbf24;
    transform: translateX(3px);
}

.back-to-3d-btn:active {
    transform: translateY(0) scale(0.98);
}

@media (max-width: 768px) {
    .grid-back-to-3d-bar {
        top: 12px;
        padding: 12px 16px 16px;
    }
    .back-to-3d-btn {
        padding: 8px 18px 8px 12px;
        font-size: 12.5px;
    }
    .back-to-3d-btn .btn-icon-wrap {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ==========================================================
   BLOCCO SCORRIMENTO SFONDO CON LIGHTBOX / MODALI APERTE
   ========================================================== */
html.modal-open,
body.modal-open,
body.has-lightbox-open {
    overflow: hidden !important;
    height: 100vh !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
}

body.has-lightbox-open #gallery-view-container,
body.has-lightbox-open #gallery {
    pointer-events: none !important;
    user-select: none !important;
}