/* 
  Updated styling for Crymare Gallery layout.
  - Maintains dark theme as requested
  - Uses Cinzel Decorative for header/logo
  - Uses Roboto Condensed for body text  
  - Simplified header layout (no search/cart)
  - Hero section with clean slideshow (no text overlay)
  - Featured Artworks as 4-column grid (no horizontal scrolling)
  - Multi-column footer layout
  - Responsive design throughout
*/

@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');

:root {
    --primary-bg-color: #1a1a1a;
    --secondary-bg-color: #2c2c2c;
    --tertiary-bg-color: #3a3a3a;
    --text-color: #e0e0e0;
    --text-secondary: #b3b3b3;
    --accent-color: #C9A96E;
    --accent-hover: #D4B578;
    --border-color: #444444;
    --overlay-dark: rgba(0, 0, 0, 0.7);
    --header-font: 'Cinzel Decorative', serif;
    --body-font: 'Roboto Condensed', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--body-font);
    background-color: var(--primary-bg-color);
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.6;
    font-weight: 300;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #d1b3ff;
}

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

/* Header */
.main-header {
    position: relative;
    background-color: #111;
}

.banner {
    height: 400px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.logo a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    text-decoration: none;
}

.logo-main {
    font-family: var(--header-font);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.logo-sub {
    font-family: var(--body-font);
    font-size: 1rem;
    letter-spacing: 5px; /* Wide letter spacing */
    text-transform: uppercase;
    margin-top: 0.5rem;
    font-weight: 300;
}

/* Home Separator */
.home-separator {
    text-align: center;
    padding: 2rem 0;
}

.home-separator a {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    color: white;
    text-decoration: none;
}

/* Featured Artworks Section */
.featured-artworks {
    padding: 4rem 0;
}

.section-intro {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: 2.5rem;
    margin: 0;
    font-family: var(--header-font);
    font-weight: 400;
    color: var(--text-color);
}

.section-subtitle {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-family: var(--body-font);
    font-weight: 300;
}

.section-description {
    margin-top: 2rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.artwork-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Desktop Grid Layout */
.artwork-card[data-artwork="1"] { grid-column: 1 / 2; grid-row: 1 / 2; }
.artwork-card[data-artwork="2"] { grid-column: 2 / 3; grid-row: 1 / 2; }
.artwork-card[data-artwork="3"] { grid-column: 3 / 5; grid-row: 1 / 2; }
.artwork-card[data-artwork="4"] { grid-column: 1 / 3; grid-row: 2 / 3; }
.artwork-card[data-artwork="5"] { grid-column: 3 / 4; grid-row: 2 / 3; }
.artwork-card[data-artwork="6"] { grid-column: 4 / 5; grid-row: 2 / 3; }


.artwork-card {
    background-color: transparent;
    border-radius: 16px;
    overflow: visible;
    width: 100%;
    perspective: 1000px;
    transition: transform 0.3s ease;
}

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

.artwork-image-container {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: visible;
    transform-style: preserve-3d;
    background: transparent; /* Removes the gray box */
}

.artwork-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.artwork-card:hover img {
    transform: scale(1.08) translateZ(40px) rotateY(-5deg) rotateX(5deg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

/* Styles for Stacked Scrolling Animation (Desktop) */
.artwork-grid-stacked {
    position: relative;
    height: 100vh; /* Changed from 600vh */
    margin-top: 0;
}

.artwork-card-stacked {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Prevent click until visible */
}

.artwork-card-stacked .artwork-image-container {
    width: 70%;
    max-width: 700px;
    max-height: 80vh; /* Add this - prevents vertical overflow */
    height: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    pointer-events: auto; /* Re-enable clicks on visible images */
    display: flex; /* Add this */
    align-items: center; /* Add this */
    justify-content: center; /* Add this */
}

.artwork-card-stacked img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Change from 'cover' to 'contain' */
    border-radius: 16px;
    max-height: 80vh; /* Add this constraint */
}

.artwork-overlay {
    display: none;
}

/* View Toggle Styles */
.view-toggle {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 40px 0;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: 2px solid #333;
    border-radius: 8px;
    color: #ccc; /* Changed for better visibility on dark background */
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: #222;
    border-color: #555;
}

.view-btn.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

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

/* Bottom toggle specific styles */
.view-toggle-bottom {
    margin-top: 80px; /* Space after gallery */
    margin-bottom: 40px;
}

/* Ensure bottom toggle hidden when grid view is active */
.grid-active .view-toggle-bottom {
    display: none;
}

/* Ensure stacked view hidden when grid view is active */
.grid-active .artwork-grid-stacked {
    display: none !important;
}

@media (max-width: 1200px) {
    .artwork-grid-normal {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .artwork-grid-normal {
        grid-template-columns: repeat(2, 1fr);
    }

    .artwork-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "gallery-a gallery-b"
            "gallery-c gallery-c"
            "gallery-d gallery-d"
            "gallery-e gallery-f";
        gap: 20px;
    }

    .artwork-card[data-artwork="1"] { grid-area: gallery-a; grid-column: auto; grid-row: auto; }
    .artwork-card[data-artwork="2"] { grid-area: gallery-b; grid-column: auto; grid-row: auto; }
    .artwork-card[data-artwork="3"] { grid-area: gallery-c; grid-column: auto; grid-row: auto; }
    .artwork-card[data-artwork="4"] { grid-area: gallery-d; grid-column: auto; grid-row: auto; }
    .artwork-card[data-artwork="5"] { grid-area: gallery-e; grid-column: auto; grid-row: auto; }
    .artwork-card[data-artwork="6"] { grid-area: gallery-f; grid-column: auto; grid-row: auto; }
}

@media (max-width: 768px) {
    .artwork-grid-normal {
        display: grid; /* Ensure it's a grid */
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 20px; /* Add gap between items */
        padding: 20px 16px;
    }

    .artwork-grid-normal .grid-item {
        width: 100%;
        height: auto; /* Let height be automatic */
        grid-column: span 1 !important; /* Ensure it spans only one column */
    }

    .artwork-grid-normal .grid-item img {
        width: 100%;
        height: auto; /* Maintain aspect ratio */
        object-fit: contain; /* Prevent cropping */
    }

    .artwork-grid-normal {
        grid-template-columns: 1fr; /* Single column on mobile */
        padding: 20px 16px;
    }

    .grid-item {
        margin-bottom: 20px;
        break-inside: avoid; /* Prevents items from breaking across columns */
    }

    .grid-item.horizontal,
    .grid-item.portrait {
        grid-column: span 1; /* All items take one column on mobile */
    }

    /* Responsive GSAP Animation */
    .artwork-card-stacked .artwork-image-container {
        width: 90%; /* More screen usage on mobile */
        max-width: none;
        max-height: 70vh; /* Ensure fits in viewport */
    }

    /* Mobile View Toggle */
    .view-toggle {
        position: sticky;
        top: 0;
        background: var(--primary-bg-color);
        z-index: 100;
        padding: 16px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        margin: 0;
    }

    .view-btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 14px;
    }

    .view-btn svg {
        width: 20px;
        height: 20px;
    }

    .artwork-grid-stacked {
        min-height: 100vh; /* Ensure proper height on mobile */
    }
    
    /* Hide any overflow that might show duplicate content */
    .featured-artworks {
        overflow: hidden;
    }
}

/* Universal Mobile Gallery Grid Fix */
@media (max-width: 768px) {
    /* Target all possible gallery containers to enforce a single-column layout */
    .artwork-grid,
    .gallery-grid,
    .grid,
    [class*="gallery-container"],
    [class*="gallery"] .grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    /* Ensure all gallery items and their containers take up full width */
    .artwork-grid .artwork-card,
    .gallery-grid .gallery-item,
    .grid-item,
    .artwork-card,
    .artwork-image-container,
    [class*="image-container"] {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        flex: none !important;
        padding-bottom: 0 !important; /* Override aspect ratio hacks */
    }

    /* Ensure images display correctly without cropping */
    .artwork-grid img,
    .gallery-grid img,
    .grid img,
    [class*="gallery"] img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important; /* Use contain to prevent cropping */
        max-height: 80vh !important; /* Prevent overly tall images */
        border-radius: 8px; /* Consistent rounding */
    }
}

/* Universal mobile gallery fix */
@media (max-width: 768px) {
    /* Target all possible gallery containers that are not the main homepage grid */
    main [class*="grid"]:not(.artwork-grid-stacked):not(.artwork-grid-normal),
    .gallery-grid,
    .artwork-grid:not(.artwork-grid-stacked):not(.artwork-grid-normal) {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    /* Ensure no image cropping in these galleries */
    main [class*="grid"]:not(.artwork-grid-stacked):not(.artwork-grid-normal) img,
    .gallery-grid img,
    .artwork-grid:not(.artwork-grid-stacked):not(.artwork-grid-normal) img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

@media (max-width: 768px) {
    .banner {
        height: 300px; /* Reduce banner height on mobile */
        background-attachment: scroll; /* Improve mobile performance */
    }
}

/* Gallery Divider */
.gallery-divider {
    text-align: center;
    margin: 60px 0 30px;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.gallery-divider::before {
    content: '';
    display: block;
    width: 100px;
    height: 1px;
    background: #ddd;
    margin: 0 auto 20px;
}

/* Footer */
.main-footer {
    background-color: var(--secondary-bg-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-secondary);
    margin: 0 1rem;
    font-size: 0.9rem;
}

.social-links a {
    color: var(--text-secondary);
    margin: 0 0.75rem;
    font-size: 1.2rem;
}

.footer-bottom {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .artwork-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 0.6rem 0;
    }
    
    .main-header .container {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.2rem;
    }
    
    .main-nav a {
        font-size: 0.95rem;
        padding: 0.4rem 0;
    }
    
    .logo a {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 2.2rem;
        margin-bottom: 1.5rem;
    }
    
    .artwork-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .artwork-card {
        border-radius: 8px;
    }
    
    .artwork-info h3 {
        font-size: 1.2rem;
    }
    
    .artwork-info p {
        font-size: 0.9rem;
    }
    
    .view-series {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .subscription-form {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .subscription-form input,
    .subscription-form button {
        padding: 0.9rem;
        font-size: 0.95rem;
    }
    
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .cta-button {
        padding: 0.9rem 2rem;
        font-size: 0.95rem;
    }
    
    .ready-to-hang h2,
    .gallery-description h2,
    .email-subscription h2 {
        font-size: 2rem;
    }
    
    .footer-sections {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo a {
        font-size: 1.6rem;
    }
    
    .main-nav ul {
        gap: 1rem;
    }
    
    .main-nav a {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .artwork-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .artwork-info h3 {
        font-size: 1.1rem;
    }
    
    .view-series {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .theme-card h3 {
        font-size: 1rem;
    }
    
    .ready-to-hang h2,
    .gallery-description h2,
    .email-subscription h2 {
        font-size: 1.6rem;
    }
    
    .ready-to-hang p,
    .gallery-description p,
    .email-subscription p {
        font-size: 1rem;
    }
    
    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .footer-sections {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .banner {
        height: 300px; /* Reduce banner height on mobile */
        background-attachment: scroll; /* Improve mobile performance */
    }
}