/* ===================================================================
   Home Page Styles
   Loaded only on the home page via {% block extra_css %}.
   Page-scoped to avoid conflicts with global .modal / .gallery-container
   in main.css. (.modal and .modal-close overrides apply only here.)
   =================================================================== */

/* Home hero section */
.home-hero {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    max-width: 700px;
    margin: 0 auto;
}

.home-hero h1 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.home-hero .subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    line-height: 1.6;
}

.start-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    background: var(--color-accent);
    color: var(--text-on-accent);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.start-button:hover {
    background: var(--color-accent-light);
    transform: translateY(-1px);
}

.start-button svg {
    width: 18px;
    height: 18px;
}

/* Gallery section (home-page masonry, distinct from .my-gallery) */
.gallery-section {
    margin-top: var(--space-4);
}

.gallery-section .gallery-header {
    text-align: center;
    margin-bottom: var(--space-5);
}

.gallery-section .gallery-header h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
}

.gallery-section .gallery-header p {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* Masonry grid container (overrides main.css .gallery-container, home only) */
.home-container .gallery-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 320px);
    overflow-y: auto;
    overflow-x: hidden;
}

.gallery-grid {
    columns: 2;
    column-gap: 12px;
    padding: 0 var(--space-4) var(--space-12);
}

@media (min-width: 768px) {
    .gallery-grid { columns: 3; column-gap: 16px; }
}

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

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

/* Scrollbar */
.home-container .gallery-container::-webkit-scrollbar {
    width: 6px;
}

.home-container .gallery-container::-webkit-scrollbar-track {
    background: transparent;
}

.home-container .gallery-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.home-container .gallery-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Gallery items */
.gallery-item {
    break-inside: avoid;
    margin-bottom: 12px;
}

.gallery-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    background: var(--color-gray-200);
    text-decoration: none;
    cursor: pointer;
}

.gallery-card--static {
    cursor: default;
}

.gallery-card--clickable {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    width: 100%;
}

.gallery-card--clickable .gallery-card-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-card--clickable:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, opacity 0.4s ease;
    opacity: 0;
    background: linear-gradient(135deg, var(--color-gray-200) 0%, var(--color-gray-300) 100%);
}

.gallery-card img.loaded { opacity: 1; }
.gallery-card img.error  { opacity: 0.3; }

.gallery-card:hover img             { transform: scale(1.05); }
.gallery-card--static:hover img     { transform: none; }
.gallery-card--clickable:hover img  { transform: scale(1.05); }

.gallery-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.gallery-card-title {
    font-size: 12px;
    font-weight: 500;
    color: white;
    margin-bottom: 4px;
}

.gallery-card-creator {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* Bottom fade */
.gallery-fade {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
    background: linear-gradient(to top, var(--color-background) 0%, transparent 100%);
    z-index: 10;
}

/* Empty state */
.gallery-empty {
    text-align: center;
    padding: var(--space-12) var(--space-4);
}

.gallery-empty svg {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    opacity: 0.3;
}

.gallery-empty h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.gallery-empty p {
    color: var(--text-secondary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .home-container .gallery-container {
        height: calc(100vh - 280px);
    }

    .gallery-grid {
        columns: 2;
        column-gap: 8px;
        padding: 0 var(--space-3) var(--space-8);
    }

    .gallery-item {
        margin-bottom: 8px;
    }
}

/* Image modal (home-page only — overrides main.css generic .modal opacity) */
.home-image-modal {
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.home-image-modal.show {
    opacity: 1;
}

.home-image-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.home-image-modal .image-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.home-image-modal .modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    z-index: 2;
}

.home-image-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.home-image-modal .modal-image-container {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-image-modal .modal-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.home-image-modal .modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-8);
    color: white;
}

/* Circular CSS-only loading spinner (distinct from icon-spin in main.css) */
.home-image-modal .modal-loading .modal-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.home-image-modal .modal-info {
    margin-top: var(--space-4);
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
}

.home-image-modal .modal-info h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.home-image-modal .modal-info p {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .home-image-modal .modal-close {
        top: 10px;
        right: 10px;
    }

    .home-image-modal .modal-image {
        max-height: 70vh;
    }

    .home-image-modal .modal-info {
        font-size: var(--text-sm);
    }
}
