/* Daily Doodles Wall - Instagram Style Grid */

.doodles-page {
    padding-top: 80px;
    min-height: 100vh;
    background: #fafafa;
}

.doodles-header {
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
}

.doodles-title {
    font-family: var(--font-accent);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    color: #262626;
}

.doodles-description {
    color: var(--text-light);
    font-size: 1rem;
    max-width: 700px;
    margin: 0 auto 1rem;
    line-height: 1.6;
}

.doodles-note {
    color: var(--text-light);
    font-size: 0.875rem;
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
}

/* Doodles Container - Full Width */
.doodles-container {
    width: 100vw;
    margin: 0;
    padding: 0;
}

/* Borderless Grid - No Gaps */
.doodles-wall {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 columns on desktop */
    gap: 0; /* No gaps between items */
    width: 100%;
}

/* Doodle Item - Borderless Square Tiles */
.doodle-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.3s ease;
    animation: fade-in 0.6s ease both;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* No hover transform for borderless design */

/* Image Container */
.doodle-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.doodle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.doodle-item:hover .doodle-image img {
    transform: scale(1.03); /* Subtle zoom for borderless design */
}

/* Overlay */
.doodle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

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

.doodle-overlay-content {
    color: var(--white);
    text-align: center;
    padding: 1rem;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.doodle-item:hover .doodle-overlay-content {
    transform: translateY(0);
}

.doodle-overlay-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.doodle-overlay-date {
    font-size: 0.875rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    grid-column: 1 / -1;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #dbdbdb;
    border-top-color: #262626;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Infinite Scroll Loader */
.scroll-loader {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.scroll-loader-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #dbdbdb;
    border-top-color: #262626;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* End of Content */
.end-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
}

.empty-state h3 {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #262626;
}

.empty-state p {
    color: var(--text-light);
}

/* Lightbox Styles */
.doodles-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.doodles-lightbox-content {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    display: flex;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.doodles-lightbox-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.doodles-lightbox-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.doodles-lightbox-info {
    width: 350px;
    padding: 2rem;
    overflow-y: auto;
    background: var(--white);
}

.doodles-lightbox-title {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #262626;
}

.doodles-lightbox-date {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.doodles-lightbox-description {
    color: var(--text-dark);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.doodles-lightbox-note {
    padding: 1rem;
    background: #fafafa;
    border-left: 3px solid var(--primary-blue);
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 2rem;
}

/* Lightbox Navigation */
.doodles-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #262626;
    transition: all 0.2s ease;
    z-index: 10;
}

.doodles-lightbox-nav:hover {
    background: var(--white);
    transform: translateY(-50%) scale(1.1);
}

.doodles-lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.doodles-lightbox-prev {
    left: 1.5rem;
}

.doodles-lightbox-next {
    right: 1.5rem;
}

/* Close Button */
.doodles-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #262626;
    transition: all 0.2s ease;
    z-index: 11;
}

.doodles-lightbox-close:hover {
    transform: rotate(90deg);
    background: #f0f0f0;
}

/* Responsive Design - Borderless Grid */
@media (max-width: 1200px) {
    .doodles-wall {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on medium screens */
    }
}

@media (max-width: 935px) {
    .doodles-wall {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on tablets */
    }
}

@media (max-width: 768px) {
    .doodles-wall {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    }

    .doodles-lightbox-content {
        flex-direction: column;
        height: 95vh;
    }

    .doodles-lightbox-info {
        width: 100%;
        max-height: 40vh;
        padding: 1.5rem;
    }

    .doodles-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .doodles-lightbox-prev {
        left: 1rem;
    }

    .doodles-lightbox-next {
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .doodles-wall {
        grid-template-columns: repeat(2, 1fr); /* Keep 2 columns even on small phones */
    }

    .doodles-header {
        padding: 2rem 1rem;
    }

    .doodles-title {
        font-size: 1.75rem;
    }

    .doodles-description,
    .doodles-note {
        font-size: 0.875rem;
    }

    .doodles-lightbox {
        padding: 0;
    }

    .doodles-lightbox-content {
        border-radius: 0;
        width: 100vw;
        height: 100vh;
    }

    .doodles-lightbox-info {
        padding: 1rem;
    }

    .doodles-lightbox-title {
        font-size: 1.25rem;
    }
}

/* Accessibility */
.doodle-item:focus-visible,
.doodles-lightbox-nav:focus-visible,
.doodles-lightbox-close:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Performance optimizations */
.doodle-image img {
    will-change: transform;
}

.doodles-lightbox {
    will-change: opacity, visibility;
}
