/* ── ROOT VARIABLES ── */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #111111;
    --text-primary: #ffffff;
    --accent-gold: #d4a373;
    --text-muted: #888888;
}

/* ── BASE & RESETS ── */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Oswald', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body { 
    height: 100%; 
}

/* ── NAVIGATION ── */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-gold);
    transition: width 0.3s ease;
}

.nav-link:hover::after { 
    width: 100%; 
}

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

/* ── PHOTO CARD - IMPROVED HOVER ── */
.photo-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transform: translateZ(0);
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    opacity: 1;
    border-radius: 8px;
}

.photo-card img {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: opacity, transform;
    transform-origin: center center;
}

.photo-card img.loaded {
    opacity: 1;
}

.photo-card:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(212, 163, 115, 0.2), 0 0 0 2px var(--accent-gold);
    z-index: 50 !important;
}

.photo-card:hover img { 
    transform: scale(1.08); 
}

/* ── VIDEO CARD ── */
.video-card {
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    transform: translateZ(0);
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(212, 163, 115, 0.15);
}

/* ── VIDEO THUMBNAIL ── */
.video-thumbnail {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── CUSTOM PLAY BUTTON ── */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
}

.play-button:hover { 
    background: rgba(0,0,0,0.7); 
    transform: translate(-50%, -50%) scale(1.1);
}

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

/* ── VIEW MORE LINK ── */
.view-more {
    transition: all 0.3s ease;
}

.view-more:hover { 
    letter-spacing: 2px; 
}

/* ── HERO GRADIENT ── */
.hero-gradient {
    background: linear-gradient(135deg,
        rgba(15,15,15,0.15) 0%,
        rgba(15,15,15,0.35) 50%,
        rgba(15,15,15,0.65) 100%
    );
}

/* ── FLOATING ARROW ANIMATION ── */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.float-arrow { 
    animation: float 2s ease-in-out infinite; 
}

/* ── HERO VIDEO - OPTIMIZED WITH SMOOTH FADE ── */
.hero-video-wrapper {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #0f0f0f !important;
}

.hero-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center !important;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.hero-video-wrapper video.playing { 
    opacity: 1;
}

/* Video loading overlay */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0f0f;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    will-change: opacity;
}

.video-loading-overlay.fade-out {
    opacity: 0;
}

/* Hero text container - FIXED */
.hero-text-container {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s, 
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

.hero-text-container.show {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile video fallback */
@media (max-width: 768px) {
    .hero-video-wrapper video {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
}

/* ── LIGHTBOX ── */
.lightbox {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: none;
}

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

/* LIGHTBOX CONTENT */
#lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    padding: 20px;
}

/* Big horizontal photo container */
.lightbox-photo-container {
    width: 100%;
    max-width: calc(100vw - 120px);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 60px;
}

.lightbox-photo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.3s ease-in-out;
}

/* YouTube iframe styling */
#lightbox-content iframe {
    width: 75vw !important;
    max-width: 1300px;
    height: 42vw !important;
    max-height: 82vh;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    background: transparent;
    border: none;
}

/* Phone-specific */
@media (max-width: 768px) {
    #lightbox-content iframe {
        width: 88vw !important;
        height: 49vw !important;
        max-height: 88vh;
    }
    .lightbox-photo-container {
        max-width: calc(100vw - 80px);
        margin: 0 40px;
    }
}

/* LIGHTBOX ARROWS & CLOSE */
.lightbox-content-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Arrow buttons */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    padding: 0;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    user-select: none;
    transition: all 0.3s;
    line-height: 1;
    z-index: 60;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
}

.lightbox-arrow span {
    display: block;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: relative;
    top: -1px;
}

.lightbox-arrow:hover {
    background: var(--accent-gold);
    color: black;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-arrow.left { left: 20px; }
.lightbox-arrow.right { right: 20px; }

@media (max-width: 768px) {
    .lightbox-arrow {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
    .lightbox-arrow.left { left: 10px; }
    .lightbox-arrow.right { right: 10px; }
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2.5rem;
    color: white;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover {
    background: var(--accent-gold);
    color: black;
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
}

/* PAGE SWITCHING & OTHER ELEMENTS */
.page { 
    display: none; 
    opacity: 0;
    transition: opacity 0.4s ease;
}
.page.active { 
    display: block; 
    opacity: 1;
}

/* ========== OPTIMIZED MASONRY GRID ========== */
.masonry-grid { 
    column-count: 3; 
    column-gap: 20px; 
    position: relative;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 400px;
}

.masonry-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

.masonry-item { 
    break-inside: avoid; 
    margin-bottom: 20px; 
    display: inline-block;
    width: 100%;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* Staggered animations */
.masonry-item:nth-child(3n+1) { animation-delay: 0.1s; }
.masonry-item:nth-child(3n+2) { animation-delay: 0.2s; }
.masonry-item:nth-child(3n+3) { animation-delay: 0.3s; }

/* Image container */
.masonry-image-container {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.masonry-image-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform-origin: center center;
}

.masonry-image-container img.loaded {
    opacity: 1;
}

/* Placeholder for smooth loading */
.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
    transition: opacity 0.5s ease;
    border-radius: 8px;
}

.image-placeholder.fade-out {
    opacity: 0;
}

/* Blur-up technique for smoother loading */
.blur-up {
    filter: blur(10px);
    transform: scale(1.1);
    transition: filter 0.5s ease, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.blur-up.loaded {
    filter: blur(0);
    transform: scale(1);
}

@media (max-width: 1024px) { 
    .masonry-grid { 
        column-count: 2; 
    }
    .masonry-item:nth-child(2n+1) { animation-delay: 0.1s; }
    .masonry-item:nth-child(2n+2) { animation-delay: 0.2s; }
}

@media (max-width: 768px) { 
    .masonry-grid { 
        column-count: 1; 
    }
    .masonry-item { animation-delay: 0.1s !important; }
}

/* SHOP PAGE - FIXED */
#page-shop {
    background: #0f0f0f;
}

.shop-container {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 128px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-title {
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s,
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

#page-shop.active .shop-title {
    opacity: 1;
    transform: translateY(0);
}

/* COMING SOON OVERLAY - COMPLETELY FIXED */
.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(40px);
    background: rgba(15, 15, 15, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.soon-text {
    font-size: 8rem;
    font-weight: bold;
    color: #d4a373;
    text-shadow: 0 0 40px rgba(212,163,115,0.8);
    letter-spacing: 0.5rem;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

/* Shop page animation when active */
#page-shop.active .blur-overlay {
    opacity: 1;
    visibility: visible;
}

#page-shop.active .soon-text {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (max-width: 768px) { 
    .soon-text { 
        font-size: 4rem; 
    } 
}

/* GALLERY FILTER */
.gallery-filter {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-filter.active {
    background-color: var(--accent-gold) !important;
    color: var(--bg-primary) !important;
    box-shadow: 0 0 10px rgba(212,163,115,0.3);
}

.gallery-filter:hover { 
    transform: scale(1.05); 
}

/* Category preloader */
.category-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold) 0%, #ffd89b 50%, var(--accent-gold) 100%);
    background-size: 200% 100%;
    animation: loadingProgress 1s linear infinite;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.category-preloader.active {
    opacity: 1;
}

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

/* Smooth animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Optimizations */
img { 
    max-width: 100%; 
    height: auto; 
    display: block;
}

/* Remove tap highlight on mobile */
a, button { 
    -webkit-tap-highlight-color: transparent; 
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Smooth transitions */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page transition improvements */
.page-transition {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Enhanced loading states */
.loading-shimmer {
    background: linear-gradient(90deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b88c5a;
}

/* Quick loading for initial view */
.quick-load {
    animation: fadeIn 0.3s ease forwards;
}

/* Image preload optimization */
.img-preload {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========== PRINT STYLES ========== */
@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    nav, .video-card, .play-button, .float-arrow,
    .blur-overlay, .lightbox, footer .social-icons,
    .hero-video-wrapper, .video-loading-overlay {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 90%;
    }
    
    .page {
        display: block !important;
        opacity: 1 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    #page-home {
        min-height: auto !important;
    }
    
    .masonry-grid {
        column-count: 2 !important;
    }
    
    .photo-card, .video-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
    }
    
    .photo-card img {
        filter: grayscale(100%) contrast(120%);
    }
    
    .shop-container {
        min-height: auto !important;
    }
    
    .blur-overlay {
        display: none !important;
    }
    
    footer {
        border-top: 1px solid #ccc !important;
    }
    
    footer .copyright {
        color: #666 !important;
    }
    
    @page {
        margin: 0.5cm;
    }
}