/* ========================================
   WORKS - CSS DEDICATO
   Galleria fotografica minimalista
======================================== */

/* === SCROLLBAR PERSONALIZZATA WORKS - NERA ULTRA-MINIMAL === */
/* Webkit browsers (Chrome, Safari, Edge) - Forzato con !important */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 2px !important;
    height: 2px !important;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: transparent !important;
    border-radius: 0 !important;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 1px !important;
    border: none !important;
    box-shadow: none !important;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.9) !important;
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: transparent !important;
}

/* Firefox - Forzato */
html,
body,
* {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 0, 0, 0.6) transparent !important;
}

/* Works page specific */
body.works-page,
body.works-page *,
.works-page,
.works-page * {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 0, 0, 0.6) transparent !important;
}

/* === LOADING SCREEN === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-logo {
    width: 200px;
    height: auto;
    animation: logoFade 2s ease-in-out infinite;
}

@keyframes logoFade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.15em;
    color: rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    margin: 0;
}

/* === RESET E BASE === */
body.works-page {
    margin: 0;
    padding: 0;
    background: #ffffff;
    color: #000000;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* === HEADER E LOGO === */
/* Nascondi logo mobile su desktop */
@media (min-width: 769px) {
    body.works-page .mobile-logo-container {
        display: none !important;
    }
}

/* Mostra logo mobile solo su mobile */
@media (max-width: 768px) {
    body.works-page .mobile-logo-container {
        display: block !important;
        opacity: 1 !important;
    }

    body.works-page .mobile-logo {
        opacity: 1 !important;
        visibility: visible !important;
        filter: none !important;
    }

    body.works-page .desktop-logo-container {
        display: none !important;
    }
}

/* === HERO SECTION === */
.works-hero {
    min-height: 75vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    padding: 2rem;
    margin-bottom: -7rem;
}

.works-title {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 5rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #000000;
    margin: 0;
    margin-bottom: 1rem;
    text-align: center;
}

.works-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    letter-spacing: 0.15em;
    color: rgba(0, 0, 0, 0.6);
    margin: 0;
    text-align: center;
}

/* === WORKS GALLERY === */
.works-gallery {
    padding: 0 6rem 6rem 6rem;
    background: #ffffff;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: 1600px;
    margin: 0 auto;
}

.work-item {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-item:hover {
    transform: translateY(-8px);
}

.work-image-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    animation: shimmer 2s infinite;
}

/* Info container - estensione del box foto */
.work-info {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-item:hover .work-info {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Titolo */
.work-title {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: #000000;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.work-item:hover .work-title {
    color: rgba(0, 0, 0, 0.8);
}

/* Descrizione */
.work-description {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    color: rgba(0, 0, 0, 0.6);
    margin: 0;
    line-height: 1.5;
    transition: color 0.3s ease;
}

.work-item:hover .work-description {
    color: rgba(0, 0, 0, 0.7);
}

/* Animazione shimmer per loading */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.work-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.4s ease, opacity 0.5s ease, filter 0.5s ease;
    opacity: 0;
    will-change: transform, opacity, filter;
}

/* Immagine caricata */
.work-image.loaded {
    opacity: 1;
}

/* Stato blur per thumbnail */
.work-image[src*="thumbnails"] {
    filter: blur(10px);
    transform: scale(1.1);
}

.work-item:hover .work-image {
    transform: scale(1.02);
}

.work-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.work-item:hover .work-placeholder {
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
}

.placeholder-text {
    font-family: 'Inter', sans-serif;
    font-weight: 200;
    font-size: 4rem;
    letter-spacing: 0.2em;
    color: rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.work-item:hover .placeholder-text {
    color: rgba(0, 0, 0, 0.25);
    transform: scale(1.1);
}

/* Quando ci sarà un'immagine */
.work-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.work-item:hover img {
    transform: scale(1.05);
}

/* === MENU PERSONALIZZATO === */
@media (min-width: 769px) {
    body.works-page .slide-menu {
        top: 7rem !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
}

@media (max-width: 768px) {
    body.works-page .slide-menu {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
}

/* Menu items con colori distintivi */
body.works-page .menu-item {
    color: rgba(0, 0, 0, 0.7) !important;
    font-weight: 400 !important;
    transition: all 0.3s ease !important;
}

body.works-page .menu-item:hover {
    color: #000000 !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

body.works-page .menu-item.active {
    color: #ffffff !important;
    background: #000000 !important;
    font-weight: 500 !important;
}

/* === FOOTER === */
body.works-page .main-footer {
    position: relative !important;
    z-index: 250 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.5rem 1rem !important;
    background: transparent !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.works-page .footer-link {
    color: rgba(0, 0, 0, 0.7) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 300 !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    cursor: none !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

body.works-page .footer-link:hover {
    color: rgba(0, 0, 0, 1) !important;
}

body.works-page .footer-credit-link {
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 0.3rem !important;
    color: rgba(0, 0, 0, 1) !important;
    text-decoration: none !important;
    font-family: 'Inter', sans-serif !important;
    text-transform: uppercase !important;
    cursor: none !important;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    transform-style: preserve-3d !important;
    perspective: 1000px !important;
}

body.works-page .footer-credit-link:hover {
    transform: rotateY(360deg) rotateX(15deg) !important;
}

body.works-page .credit-by {
    font-weight: 200 !important;
    font-size: 0.6rem !important;
    letter-spacing: 0.1em !important;
    opacity: 0.8 !important;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
}

body.works-page .credit-twh {
    font-weight: 400 !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.2em !important;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
}

body.works-page .footer-credit-link:hover .credit-twh {
    transform: rotateY(720deg) !important;
}

/* Footer mobile - solo policy e terms al centro */
@media (max-width: 768px) {
    body.works-page .main-footer {
        justify-content: center !important;
    }
    
    body.works-page .footer-left,
    body.works-page .footer-right {
        display: none !important;
    }
    
    body.works-page .footer-center {
        display: flex !important;
        gap: 1rem !important;
        align-items: center !important;
    }
}

/* === MODAL === */
#fullscreenModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#fullscreenModal.active {
    opacity: 1;
    visibility: visible;
}



.modal-content {
    max-width: 95%;
    max-height: 95%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#fullscreenImage {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* === RESPONSIVE: MOBILE === */
@media (max-width: 768px) {
    .works-hero {
        min-height: 50vh;
        margin-bottom: 2rem;
        padding: 1rem;
    }

    .works-title {
        font-size: 2.5rem;
        letter-spacing: 0.25em;
    }

    .works-subtitle {
        font-size: 1rem;
        letter-spacing: 0.1em;
    }

    .works-gallery {
        padding: 0 5% 4rem 5%;
    }

    .works-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .work-item {
        aspect-ratio: auto !important;
        max-height: none !important;
        /* Ottimizzazioni performance mobile */
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;
    }
    
    /* Disabilita hover su mobile per performance */
    .work-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .work-item:hover .work-image {
        transform: none;
    }
    
    .work-image {
        object-fit: contain !important;
        width: 100% !important;
        height: auto !important;
        /* Ottimizzazioni rendering mobile */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Rimuovi animazione shimmer su mobile per risparmiare risorse */
    .work-image-container {
        animation: none;
        background: #f0f0f0;
        border-radius: 8px 8px 0 0;
    }
    
    /* Info box su mobile */
    .work-info {
        padding: 1rem 1rem 1.25rem 1rem;
        border-radius: 0 0 8px 8px;
    }
    
    .work-item:hover .work-info {
        background: #ffffff;
        box-shadow: none;
    }
    
    .work-title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    .work-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .placeholder-text {
        font-size: 3rem;
    }



    #fullscreenImage {
        max-height: 70vh;
    }
}

/* === TABLET === */
@media (min-width: 769px) and (max-width: 1024px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }

    .works-gallery {
        padding: 0 4rem 5rem 4rem;
    }
}

/* === INSTAGRAM ICON === */
body.works-page .menu-instagram svg {
    stroke: #000000 !important;
    color: #000000 !important;
}

body.works-page .menu-instagram:hover svg {
    stroke: #000000 !important;
    color: #000000 !important;
}

/* === LARGE SCREENS === */
@media (min-width: 1600px) {
    .works-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4rem;
    }
}

/* === MOBILE TOUCH EFFECTS === */
@media (max-width: 768px) {
    /* Touch-friendly 3D effects for mobile footer in works */
    body.works-page .footer-credit-link:active {
        transform: rotateY(360deg) rotateX(15deg) !important;
    }
    
    body.works-page .footer-credit-link:active .credit-twh {
        transform: rotateY(720deg) !important;
    }
}
