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

html {
    /* Instant scrolling for best performance */
    scroll-behavior: auto;
    /* Critical: Prevent white flash on page load */
    background-color: #f5f5f5;
}

/* Critical: Prevent any white backgrounds that could cause flashing */
* {
    /* Override any potential white backgrounds */
    --safe-bg-color: #f5f5f5;
}

/* Critical: Ensure dropdown content is hidden by default - must load early */
.dropdown-content {
    display: none;
    position: absolute;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-image: url('../paintbackground.jpg');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-color: #f5f5f5; /* Fallback to prevent white flash */
    color: #000000;
    line-height: 1.4;
    overflow-x: hidden;
    /* Fast fade-in for initial load */
    transition: opacity 0.15s ease;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(15px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.logo:hover {
    opacity: 0.6;
}

.nav-links {
    display: flex;
    gap: 40px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: #000;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: opacity 0.15s ease;
    cursor: pointer;
}

.nav-links a:hover {
    opacity: 0.6;
}

.nav-links a.active {
    opacity: 0.6;
}

/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Prevent dropdown content from affecting layout when hidden */
.dropdown-content a {
    /* These styles only apply when dropdown is visible */
}

/* Dropdown arrow styles removed as requested */

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    min-width: 120px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.dropdown-content a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #000;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    opacity: 0.8;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Main Content */
main {
    margin-top: 100px;
    min-height: calc(100vh - 100px);
}

/* Section Management - Fast transitions */
.section {
    display: none;
    opacity: 0;
    background-color: transparent;
    transition: opacity 0.1s ease;
}

.section.active {
    display: block;
    opacity: 1;
}

/* Gallery Grid */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 50px;
}

.artwork-card {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.artwork-card:hover {
    transform: translateY(-5px);
}

.artwork-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    overflow: hidden;
    background-color: #f5f5f5; /* Soft gray instead of white */
    transition: background-color 0.3s ease;
}

.artwork-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.artwork-card:hover .artwork-image {
    transform: scale(1.05);
}

.artwork-info {
    padding: 20px 0;
}

.artwork-title {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.artwork-year {
    font-size: 14px;
    color: #666;
    letter-spacing: 0.3px;
}

/* Detail View - Fast transitions */
.artwork-detail {
    display: none;
    opacity: 0;
    background-color: transparent;
    transition: opacity 0.1s ease;
}

.artwork-detail.active {
    display: block;
    opacity: 1;
}

.detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.detail-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background-color: #f5f5f5; /* Soft gray to prevent flash */
    transition: background-color 0.3s ease;
}

.detail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-info {
    padding-top: 40px;
}

.detail-title {
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.detail-year {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    letter-spacing: 0.3px;
}

.detail-specs {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.detail-spec {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
    letter-spacing: 0.3px;
    line-height: 1.6;
}

.detail-description {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    letter-spacing: 0.2px;
}

.back-button {
    display: inline-block;
    margin-bottom: 40px;
    padding: 12px 30px;
    background-color: transparent;
    border: 1px solid #000;
    color: #000;
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background-color: #000;
    color: #fff;
}

/* About Section */
.about-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 40px;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.about-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.about-content h1 {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.about-content p {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 25px;
    color: #333;
    letter-spacing: 0.2px;
}

.about-statement {
    border-left: 3px solid #000;
    padding-left: 30px;
    margin: 40px 0;
}

.about-statement h2 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.about-statement p {
    font-style: italic;
    color: #555;
}

/* About Contact Section */
.about-contact {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.contact-section h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 40px;
    text-align: center;
    letter-spacing: 0.5px;
}

.contact-info-single {
    text-align: center;
    margin-bottom: 30px;
}

.contact-info-single p {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 0;
    letter-spacing: 0.2px;
}

.contact-info-single a {
    color: #000;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.contact-info-single a:hover {
    opacity: 0.6;
}

.contact-note {
    text-align: center;
    font-size: 15px;
    color: #666;
    font-style: italic;
    margin-top: 40px;
    letter-spacing: 0.2px;
}

/* Collections Section */
.collections-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
}

.collections-header {
    text-align: center;
    margin-bottom: 60px;
}

.collections-header h1 {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.collections-header p {
    font-size: 16px;
    color: #666;
    letter-spacing: 0.3px;
}

.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 60px;
}

.collection-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.collection-item:hover {
    transform: translateY(-5px);
}

.collection-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    margin-bottom: 20px;
    transition: opacity 0.3s ease;
}

.collection-item:hover .collection-image {
    opacity: 0.8;
}

.collection-title {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.collection-year {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.collection-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    letter-spacing: 0.2px;
}

/* Collection Detail View - Fast transitions */
.collection-detail {
    display: none;
    opacity: 0;
    background-color: transparent;
    transition: opacity 0.1s ease;
}

.collection-detail.active {
    display: block;
    opacity: 1;
}

.collection-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
}

.collection-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
    margin-bottom: 80px;
}

.collection-hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.collection-hero-info h1 {
    font-size: 36px;
    font-weight: 300;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.collection-hero-info .collection-year {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    letter-spacing: 0.3px;
}

.collection-hero-info .collection-long-description {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    letter-spacing: 0.2px;
}

.collection-artworks {
    margin-top: 80px;
}

.collection-artworks h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 40px;
    text-align: center;
    letter-spacing: 0.5px;
}

.collection-artworks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

/* Footer */
footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 40px;
    text-align: center;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #666;
}

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

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: #000;
    margin: 3px 0;
    transition: 0.3s;
}

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

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

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

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 100px;
    left: 0;
    width: 100%;
    height: calc(100vh - 100px);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    z-index: 999;
    padding: 40px 20px;
}

.mobile-nav-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.mobile-nav-links li {
    margin: 30px 0;
}

.mobile-nav-links a {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.mobile-nav-links a:hover {
    opacity: 0.6;
}

.mobile-submenu {
    margin-left: 20px;
}

.mobile-submenu a {
    font-size: 20px !important;
    color: #666 !important;
    font-weight: 200 !important;
}

/* Touch Interactions */
.artwork-card, .collection-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Touch-friendly dropdown for tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .dropdown:hover .dropdown-content,
    .dropdown:focus-within .dropdown-content,
    .dropdown.active .dropdown-content {
        display: block;
    }
    
    .dropdown-content {
        position: absolute;
        z-index: 1002;
    }
}

/* Responsive Design */
@media (max-width: 968px) {
    /* Typography adjustments */
    .logo {
        font-size: 16px;
    }

    /* Navigation */
    nav {
        padding: 20px;
    }

    /* Gallery adjustments */
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 30px;
    }

    .artwork-card:hover {
        transform: translateY(-3px);
    }

    /* Detail views */
    .detail-container {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 40px 20px;
    }

    .detail-info {
        padding-top: 0;
    }

    .detail-title {
        font-size: 24px;
    }

    /* About section */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-content h1 {
        font-size: 28px;
    }

    /* Collections */
    .collection-hero {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .collection-hero-info h1 {
        font-size: 28px;
    }

    .collections-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 40px;
    }

    .collection-artworks-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 30px;
    }

    /* About contact section remains centered */

    /* Container padding */
    .gallery-container, .about-container, .collections-container, 
    .collection-detail-container {
        padding: 40px 20px;
    }
}

@media (max-width: 768px) {
    /* Show mobile menu */
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
    }

    /* Hide desktop dropdown on mobile */
    .dropdown-content {
        display: none !important;
    }

    /* Adjust header spacing */
    header {
        position: fixed;
        top: 0;
    }

    main {
        margin-top: 80px;
    }

    .mobile-nav-overlay {
        top: 80px;
        height: calc(100vh - 80px);
    }

    /* Typography for mobile */
    .detail-title {
        font-size: 22px;
    }

    .detail-year {
        font-size: 16px;
    }

    .about-content h1, .collection-hero-info h1 {
        font-size: 24px;
    }

    .contact-section h2 {
        font-size: 20px;
    }

    .collections-header h1 {
        font-size: 24px;
    }

    /* Improve button sizing for touch */
    .back-button {
        padding: 14px 32px;
        font-size: 14px;
        margin-bottom: 30px;
    }

    /* Image sizing */
    .artwork-image-container {
        padding-bottom: 80%;
    }

    .collection-image {
        height: 250px;
    }

    .collection-hero-image {
        height: 300px;
    }
}

@media (max-width: 640px) {
    /* Single column layouts */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .collections-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .collection-artworks-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* Smaller text on very small screens */
    .logo {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .mobile-nav-links a {
        font-size: 20px;
    }

    /* Reduce padding on small screens */
    .gallery-container, .about-container, .collections-container,
    .collection-detail-container {
        padding: 30px 16px;
    }

    .detail-container {
        padding: 30px 16px;
    }

    /* Adjust collection hero on small screens */
    .collection-hero {
        gap: 30px;
    }

    .collection-hero-image {
        height: 250px;
    }

    /* Footer adjustments */
    footer {
        padding: 30px 16px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    /* Very small screen optimizations */
    nav {
        padding: 16px;
    }

    main {
        margin-top: 70px;
    }

    .mobile-nav-overlay {
        top: 70px;
        height: calc(100vh - 70px);
        padding: 30px 16px;
    }

    .mobile-nav-links li {
        margin: 25px 0;
    }

    .artwork-image-container {
        padding-bottom: 85%;
    }

    .detail-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .about-content h1, .collection-hero-info h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .about-content p {
        font-size: 14px;
        line-height: 1.7;
    }

    .contact-section h2 {
        font-size: 18px;
        margin-bottom: 30px;
    }

    .contact-info-single p {
        font-size: 14px;
    }

    .contact-note {
        font-size: 14px;
        margin-top: 30px;
    }
}