/* CSS Variables */
:root {
    --bg-color: #080808;
    --surface-color: #121212;
    --text-primary: #f5f5f5;
    --text-secondary: #999999;
    --accent-color: #cda434; /* Soft gold accent */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 400;
}

/* Header & Nav */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(8,8,8,0.9) 0%, rgba(8,8,8,0) 100%);
    transition: var(--transition);
}

.header.scrolled {
    padding: 1rem 5%;
    background: rgba(8, 8, 8, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-container .logo {
    height: 4.5rem;
    object-fit: contain;
    filter: brightness(0) invert(1); /* Assumes logo is black on transparent, this makes it white */
    transition: var(--transition);
}

.header.scrolled .logo-container .logo {
    height: 3rem;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

.nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: var(--transition);
    position: relative;
    opacity: 0.8;
}

.nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    transition: var(--transition);
}

.nav a:hover::after {
    width: 100%;
}

.nav a:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background-color: var(--bg-color);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('../media/opere/webp/Golden Game copia.webp') no-repeat center center/cover;
    opacity: 0.15;
    filter: grayscale(100%);
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 56.25rem;
    padding: 0 2rem;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 2px;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 1.2s ease forwards 0.2s;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-weight: 300;
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeInUp 1.2s ease forwards 0.6s;
}

.btn {
    display: inline-block;
    padding: 1.2rem 3rem;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    background: transparent;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    transition: var(--transition);
    opacity: 0;
    animation: fadeInUp 1.2s ease forwards 1s;
    border-radius: 2px;
}

.btn:hover {
    border-color: var(--accent-color);
    background-color: var(--accent-color);
    color: var(--bg-color);
}

/* Gallery Section */
.gallery-section {
    padding: 8rem 5%;
    background-color: var(--bg-color);
    position: relative;
    z-index: 2;
}

.section-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 5rem;
    position: relative;
    letter-spacing: 2px;
}

.section-title::after {
    content: '';
    display: block;
    width: 2.5rem;
    height: 1px;
    background-color: var(--accent-color);
    margin: 2rem auto 0;
}

/* Masonry Grid */
.gallery-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding-bottom: 2rem;
}

@media (min-width: 600px) {
    .gallery-grid { 
        display: block; 
        columns: 2; 
        column-gap: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .gallery-grid { columns: 3; }
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--surface-color);
    opacity: 0;
    transform: translateY(2.5rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
    border-radius: 4px;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s ease;
    will-change: transform;
    filter: brightness(0.9);
}

.gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(1);
}

.gallery-item-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.5rem 2rem;
}

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

.gallery-item-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #fff;
    transform: translateY(20px);
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover .gallery-item-title {
    transform: translateY(0);
}

.gallery-item-details {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    transform: translateY(20px);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s;
    opacity: 0;
}

.gallery-item:hover .gallery-item-details {
    transform: translateY(0);
    opacity: 1;
}

/* Video Section */
.video-section {
    padding: 8rem 5% 4rem;
    background-color: var(--bg-color);
    position: relative;
    z-index: 2;
}

.video-grid {
    columns: 1;
    column-gap: 2.5rem;
    padding-bottom: 2rem;
    max-width: 75rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .video-grid {
        columns: 2;
    }
}

.video-item {
    break-inside: avoid;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--surface-color);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.video-item video {
    width: 100%;
    height: auto;
    display: block;
    outline: none;
    border: none;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s ease;
    filter: brightness(0.9);
}

.video-item:hover video {
    transform: scale(1.03);
    filter: brightness(1);
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2;
}

.video-item:hover .video-play-overlay {
    background-color: var(--accent-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-triangle {
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid white;
    margin-left: 5px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content {
    max-width: 100%;
    max-height: 85vh;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}

.lightbox-caption {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 1px;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    line-height: 1;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1010;
    opacity: 0.5;
}

.lightbox-close:hover {
    color: var(--accent-color);
    opacity: 1;
    transform: rotate(90deg);
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    z-index: 1001;
    display: none;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 60px;
    font-weight: 300;
    cursor: pointer;
    user-select: none;
    z-index: 1010;
    transition: all 0.3s ease;
    padding: 20px;
    line-height: 1;
}

.lightbox-nav:hover {
    color: var(--accent-color);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

img.zoomable {
    cursor: zoom-in;
    transition: transform 0.3s ease-out;
}

img.zoomable.zoomed {
    cursor: grab;
}

img.zoomable.zoomed:active {
    cursor: grabbing;
}

/* Footer */
.footer {
    text-align: center;
    padding: 4rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 1px;
    background-color: var(--bg-color);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 101;
}

.menu-toggle .bar {
    height: 2px;
    width: 100%;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.video-single {
    max-width: 50rem;
    margin: 0 auto;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .header { padding: 1.5rem; }
    .menu-toggle { display: flex; }
    
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background-color: rgba(8, 8, 8, 0.98);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        z-index: 100;
        backdrop-filter: blur(10px);
    }
    
    .nav.active {
        right: 0;
    }
    
    .nav ul {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
    }
    
    .nav a {
        font-size: 1.5rem;
    }
    
    /* Hamburger animation */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(9.5px) rotate(45deg);
    }
    
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-9.5px) rotate(-45deg);
    }

    .hero {
        height: auto;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 35vh;
        padding-bottom: 4rem;
        overflow: visible;
    }

    .hero-title {
        margin-bottom: 10vh;
    }

    .hero-subtitle {
        margin-bottom: 2rem !important;
        padding: 0 1rem;
    }

    .gallery-item-overlay { 
        position: static;
        opacity: 1; 
        background: transparent; 
        padding: 1rem 0.5rem 0.5rem 0.5rem; 
    }
    .gallery-item-title { transform: translateY(0); font-size: 1.2rem; }
    .gallery-item-details { transform: translateY(0); opacity: 1; }

    .lightbox-nav {
        display: none;
    }
}

/* 4K and Ultrawide Scaling */
@media (min-width: 1921px) {
    html {
        /* Base font-size scales proportionally with viewport width above 1920px. 
           1920px / 16px (default browser font size) = 120 */
        font-size: calc(100vw / 120);
    }
}
