@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&family=Palanquin:wght@100;200;300;400;500;600;700&display=swap');

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lato', sans-serif;
    color: #ffffff;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.6;
    position: relative;
    padding-top: 60px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
body::-webkit-scrollbar {
    display: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-image: url('images/sky.png');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: -1;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    z-index: 1000;
    padding: 1rem 2rem;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.nav-links {
    display: flex;
    gap: 3rem;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.1rem;
    transition: color 0.3s ease;
    font-size: 14px;
}

.nav-link:hover {
    color: #F64128;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: #131313;
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: #131313;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.mobile-link {
    color: #131313;
    text-decoration: none;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0.1rem;
    transition: all 0.3s ease;
}

.mobile-link:hover {
    color: #F64128;
    transform: scale(1.05);
}

/* Hero Section */
.hero {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 2rem;
    margin-top: -60px;
    padding-top: calc(4rem + 60px);
}

.hero-content {
    text-align: center;
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Fade in animation for hero elements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.museo-title {
    font-family: 'Palanquin', sans-serif;
    font-size: 18px;
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.3s forwards;
    background: none;
}

.ritorno-logo {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto 2rem;
    display: block;
    filter: drop-shadow(0 10px 30px rgba(246, 65, 40, 0.3));
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.6s forwards;
}

.subtitle {
    font-family: 'Palanquin', sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #ffffff;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.9s forwards;
}

.subtitle-main,
.subtitle-curator {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.08rem;
    color: #F64128;
    text-transform: none;
}

.video-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: transparent;
    border: 2px solid #F64128;
    color: #F64128;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeInUp 1s ease-out 1.2s forwards;
    text-decoration: none;
}

.video-btn:hover {
    background: #F64128;
    color: #ffffff;
    transform: translateY(-2px);
}

.video-btn svg {
    width: 24px;
    height: 24px;
}

/* Sections */
.opere,
.critica {
    padding: 5rem 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    position: relative;
    z-index: 1;
    overflow: visible !important;
    clip: unset;
    clip-path: none;
}

.opere {
    padding: 80px 0;
    background: transparent;
    overflow: visible !important;
    width: 100%;
    position: relative;
    z-index: 1;
}

.critica {
    padding-top: 5rem;
    padding-bottom: 5rem;
    background: transparent;
}

.opere.visible,
.critica.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-family: 'Palanquin', sans-serif;
    font-size: 2.5rem;
    font-weight: 500;
    text-align: center;
    color: #ffffff;
    margin-bottom: 3rem;
    letter-spacing: 0.2rem;
}

/* Opere Grid */
.opere-grid {
    position: relative;
    width: 100%;
    height: 600px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.opere-grid::-webkit-scrollbar {
    display: none;
}

.opere-grid-inner {
    display: flex;
    gap: 50px;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 50px;
    height: 100%;
    align-items: center;
}



.opera-item {
    position: relative;
    flex: 0 0 auto;
    width: 300px;
    height: 420px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: leafSway 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.opera-item:hover {
    /* Remove zoom effect */
    transform: none;
    z-index: 10;
}

/* Opera number overlay */
.opera-numero {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(246, 65, 40, 0.9);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Palanquin', sans-serif;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.opera-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: transparent;
}

/* Subtle leaf animation */
@keyframes leafSway {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    25% { transform: rotate(0.5deg) translateY(-1px); }
    75% { transform: rotate(-0.5deg) translateY(1px); }
}

/* Stagger animations for opera items */
.opera-item:nth-child(odd) {
    animation-duration: 4.5s;
    animation-delay: 0.2s;
}

.opera-item:nth-child(even) {
    animation-duration: 5s;
    animation-delay: 0.8s;
}

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

/* Stagger animations for cards */
.card.visible:nth-child(1) { transition-delay: 0.1s; }
.card.visible:nth-child(2) { transition-delay: 0.2s; }
.card.visible:nth-child(3) { transition-delay: 0.3s; }

.load-more {
    display: block;
    margin: 0 auto;
    padding: 1rem 2rem;
    background: transparent;
    border: 2px solid #F64128;
    color: #F64128;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more:hover {
    background: #F64128;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.card {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    height: auto;
    min-height: 180px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    position: relative;
    justify-content: center;
    align-items: center;
}

.card:hover {
    border-color: rgba(246, 65, 40, 0.3);
}

.card-content {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

.card-title {
    font-family: 'Palanquin', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: #F64128;
    margin-bottom: 0.3rem;
}

.card-text {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 1rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.card-author {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-image {
    width: 250px;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-image img {
    /* Transform removed */
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2000;
}

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

.modal.active .text-modal-content {
    animation: modalFadeIn 0.4s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: transparent;
    border-radius: 16px;
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-content video,
.modal-content iframe {
    width: 100%;
    max-width: 1200px;
    height: auto;
    min-height: 500px;
    display: block;
    border-radius: 16px;
}

.text-modal-content {
    padding: 4rem;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.text-modal-content::-webkit-scrollbar {
    display: none;
}

.text-modal-content h2 {
    font-family: 'Palanquin', sans-serif;
    font-size: 2rem;
    color: #131313;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.text-modal-content #modalAuthor {
    color: rgba(19, 19, 19, 0.6);
    font-style: italic;
    margin-bottom: 2rem;
}

.text-modal-content #modalText {
    color: rgba(19, 19, 19, 0.8);
    line-height: 1.8;
    font-size: 1rem;
}

.text-modal-content #modalText p {
    margin-bottom: 1.5rem;
}

.modal .close {
    position: fixed;
    top: max(2rem, env(safe-area-inset-top) + 1rem);
    right: max(2rem, env(safe-area-inset-right) + 1rem);
    font-size: 1.5rem;
    color: rgba(19, 19, 19, 0.5);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2010;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(19, 19, 19, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.close:hover {
    color: rgba(19, 19, 19, 0.8);
    background: rgba(19, 19, 19, 0.1);
    transform: rotate(90deg);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2000;
    padding: 2rem;
}

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

.lightbox-container {
    position: relative;
    max-width: 100%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.swipe-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 25px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.lightbox .close {
    position: fixed;
    top: max(2rem, env(safe-area-inset-top) + 1rem);
    right: max(2rem, env(safe-area-inset-right) + 1rem);
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2010;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.lightbox .close:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.9);
    transform: rotate(90deg);
    border-color: #ffffff;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: #F64128;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #d63515;
    transform: translateY(-3px);
}

/* Footer Credit */
.footer-credit {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-style: italic;
    letter-spacing: 0.05em;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s ease;
    z-index: 0;
}

.footer-credit.visible {
    opacity: 1;
    visibility: visible;
}

/* Responsive */
/* Stronger leaf animation for mobile */
@keyframes leafSwayMobile {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    25% { transform: rotate(1.5deg) translateY(-3px); }
    75% { transform: rotate(-1.5deg) translateY(3px); }
}

@media (max-width: 768px) {
    /* Force opere section to be visible on mobile */
    .opere {
        min-height: 500px;
    }
    /* Disable hover effects on mobile */
    .card:hover {
        border-color: rgba(255, 255, 255, 0.1);
        transform: none;
    }
    .navbar {
        padding: 1rem;
    }
    
    .nav-container {
        position: relative;
        justify-content: flex-start;
    }
    
    .nav-links {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .hero {
        padding: 4rem 1rem;
    }
    
    .museo-title {
        font-size: 16px;
    }
    
    .ritorno-logo {
        max-width: 80%;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .video-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    
    .opere,
    .critica {
        padding: 3rem 1rem;
    }
    
    .opere {
        padding: 3rem 1rem;
    }
    
    .opere-grid {
        /* Reset all desktop styles */
        position: static;
        height: auto;
        overflow: visible;
        margin: 0;
        width: 100%;
    }
    
    .opere-grid-inner {
        /* Reset all desktop styles */
        position: static;
        transform: none;
        display: block;
        padding: 0;
        height: auto;
        left: auto;
        top: auto;
    }
    
    .opera-item {
        /* Simple mobile layout */
        width: 100%;
        height: 350px;
        display: block;
        margin-bottom: 2rem;
        opacity: 1;
        position: relative;
        animation: leafSwayMobile 4s ease-in-out infinite;
    }
    
    .opera-item img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }
    
    .card {
        flex-direction: column;
        height: auto;
        transition: opacity 0.6s ease-out;
    }
    
    .card-content {
        padding: 2rem;
        order: 2;
    }
    
    .card-image {
        width: 100%;
        height: 250px;
        order: 1;
        overflow: visible;
        padding: 1rem;
    }
    
    .card-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        transform: none;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    .modal {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
        max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 4rem);
    }
    
    .text-modal-content {
        padding: 2rem;
        max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 6rem);
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    
    .text-modal-content h2 {
        font-size: 1.5rem;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        bottom: 1rem;
        right: 1rem;
    }
    
    .lightbox {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.8rem 1rem;
    }
    
    .hero {
        padding: 3rem 1rem;
    }
    
    .museo-title {
        font-size: 14px;
    }
    
    .ritorno-logo {
        max-width: 90%;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .opere,
    .critica {
        padding: 2rem 1rem;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
    
    .text-modal-content {
        padding: 1.5rem;
        max-height: calc(100vh - 100px);
        margin: 20px 10px;
    }
    
    .text-modal-content h2 {
        font-size: 1.3rem;
    }
}