/* Galerie publique v2 — Layout masonry, design immersif */

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

:root {
    --bg-color: #1e1e26;
    --text-color: #e8e8e8;
    --accent-color: #ffffff;
    --secondary-bg: #262630;
    --border-color: #363640;
    --hover-color: rgba(255, 255, 255, 0.06);
    --column-count: 4;
    --gallery-gap: 12px;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Helvetica Neue', Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 39px, rgba(255, 255, 255, 0.025) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 39px, rgba(255, 255, 255, 0.025) 40px);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Blobs animés en arrière-plan */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: 0;
}

body::before {
    width: 500px;
    height: 500px;
    background: rgba(100, 100, 180, 0.08);
    top: -100px;
    left: -100px;
    animation: blob1 24s ease-in-out infinite;
}

body::after {
    width: 400px;
    height: 400px;
    background: rgba(80, 120, 200, 0.06);
    bottom: 10%;
    right: -80px;
    animation: blob2 30s ease-in-out infinite;
}

@keyframes blob1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, 80px) scale(1.05); }
    66% { transform: translate(20px, 140px) scale(0.95); }
}

@keyframes blob2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-50px, -70px) scale(1.08); }
    66% { transform: translate(-100px, 30px) scale(0.95); }
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 39px, rgba(255, 255, 255, 0.025) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 39px, rgba(255, 255, 255, 0.025) 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Sélecteur de langue */
.selecteur-langue {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    z-index: 100;
}

.selecteur-langue-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

.selecteur-langue-btn:hover {
    opacity: 1;
}

.selecteur-langue-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.4rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 160px;
    max-height: 320px;
    overflow-y: auto;
}

.selecteur-langue-menu.visible {
    display: block;
}

.selecteur-langue-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: background 0.15s ease;
    direction: ltr;
    text-align: left;
}

.selecteur-langue-option:hover {
    background: var(--hover-color);
}

.selecteur-langue-option.actif {
    background: var(--hover-color);
}

/* Header — centré et aéré */
header {
    position: relative;
    z-index: 1;
    padding: 3rem 2rem 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    text-align: center;
}

header h1 {
    margin-bottom: 2rem;
    line-height: 1;
}

.site-logo {
    height: 80px;
    width: auto;
}

/* Barre de recherche — centrée, double bordure */
.search-container {
    position: relative;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    max-width: 500px;
    background-color: var(--bg-color);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    padding: 0 1.25rem;
    cursor: text;
    box-shadow:
        0 0 0 8px var(--bg-color),
        0 0 0 9px rgba(255, 255, 255, 0.35);
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

.search-container:focus-within {
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 0 0 8px var(--bg-color),
        0 0 0 9px transparent;
}

/* Placeholder animé avec slide */
.search-placeholder {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    pointer-events: none;
    opacity: 0.35;
    white-space: nowrap;
    overflow: hidden;
    z-index: 1;
}

.search-placeholder-rotate {
    display: inline-block;
}

.search-placeholder-rotate.slide-out {
    animation: slideOutRotate 0.4s ease forwards;
}

.search-placeholder-rotate.slide-in {
    animation: slideInRotate 0.5s ease forwards;
}

@keyframes slideOutRotate {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes slideInRotate {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.search-input:not(:placeholder-shown) ~ .search-placeholder {
    opacity: 0;
}

.search-suggestion {
    position: absolute;
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 0;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    position: relative;
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 0;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    z-index: 2;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--text-color);
    opacity: 0.35;
}

.search-clear {
    position: absolute;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: opacity 0.2s ease;
    opacity: 0.4;
    z-index: 3;
}

.search-clear:hover {
    opacity: 1;
}

/* Statistiques */
.stats {
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.55;
    letter-spacing: 0.05em;
}

.last-update {
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-color);
    opacity: 0.4;
}

/* Navigation filtres — pilules */
nav {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-primary {
    margin-bottom: 0;
}

.nav-secondary {
    margin-top: 0.6rem;
}

.filter-btn {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
    border-radius: 0;
    text-transform: none;
}

.filter-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: var(--hover-color);
}

.filter-btn.active {
    background-color: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* Contenu principal */
main {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 1rem 2rem 2rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

/* Galerie grille régulière — CSS Grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(var(--column-count), 1fr);
    gap: var(--gallery-gap);
    opacity: 1;
    transition: opacity 0.2s ease;
}

.gallery.fade-out {
    opacity: 0;
}

.photo-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    break-inside: avoid;
    background-color: var(--secondary-bg);
    border-radius: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.photo-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.photo-card.visible:hover {
    opacity: 0.88;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Info au survol — overlay subtil */
.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
    padding: 2.5rem 0.75rem 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-card:hover .photo-info {
    opacity: 1;
}

.photo-location {
    font-size: 0.78rem;
    font-weight: 400;
    margin-bottom: 0.15rem;
    letter-spacing: 0.03em;
}

.photo-film {
    font-size: 0.7rem;
    opacity: 0.6;
    font-style: italic;
}

/* Footer */
footer {
    position: relative;
    z-index: 1;
    padding: 2rem;
    text-align: center;
    font-size: 0.75rem;
    opacity: 0.3;
    letter-spacing: 0.05em;
}

/* Footer Vibe Studio */
.vs-footer {
    background: transparent;
    padding: 0 0 2rem;
    opacity: 0.75;
}

.vs-footer-inner {
    text-align: center;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.vs-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #9ca3af;
    text-decoration: none;
    transition: opacity 0.2s;
}

.vs-footer-brand:hover {
    opacity: 0.7;
}

.vs-footer-brand span {
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1400px) {
    :root { --column-count: 4; }
}

@media (max-width: 1100px) {
    :root { --column-count: 3; }
}

@media (max-width: 768px) {
    :root {
        --column-count: 2;
        --gallery-gap: 8px;
    }

    body::before {
        width: 300px;
        height: 300px;
        top: -50px;
        left: -50px;
    }

    body::after {
        width: 250px;
        height: 250px;
        right: -40px;
    }

    header {
        padding: 1.5rem 1rem 1rem;
    }

    .selecteur-langue {
        top: 0.75rem;
        right: 0.75rem;
    }

    .selecteur-langue-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }

    header h1 {
        margin-bottom: 1rem;
    }

    .site-logo {
        height: 65px;
    }

    .search-container {
        max-width: calc(100% - 2rem);
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
        border-radius: 10px;
        box-shadow:
            0 0 0 5px var(--bg-color),
            0 0 0 6px rgba(255, 255, 255, 0.35);
    }

    .search-container:focus-within {
        box-shadow:
            0 0 0 5px var(--bg-color),
            0 0 0 6px transparent;
    }

    /* iOS Safari : font-size >= 16px pour éviter le zoom auto au focus */
    .search-input,
    .search-suggestion {
        padding: 0.7rem 2rem 0.7rem 0;
        font-size: 16px;
    }

    .search-placeholder {
        font-size: 16px;
        left: 1rem;
    }

    /* Filtres : scroll horizontal au lieu de wrap */
    nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding: 0 1rem;
        margin: 0 -1rem;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
    }

    /* Infos photo toujours visibles (pas de hover sur tactile) */
    .photo-info {
        opacity: 1;
        padding: 1.5rem 0.5rem 0.5rem;
    }

    .photo-location {
        font-size: 0.72rem;
    }

    .photo-film {
        font-size: 0.65rem;
    }

    main {
        padding: 0.5rem 1rem 1rem;
    }

    footer {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    :root {
        --column-count: 2;
        --gallery-gap: 6px;
    }

    header {
        padding: 1rem 0.75rem 0.75rem;
    }

    header h1 {
        margin-bottom: 0.75rem;
    }

    .site-logo {
        height: 55px;
    }

    nav {
        padding: 0 0.75rem;
        margin: 0 -0.75rem;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }

    main {
        padding: 0.25rem 0.75rem 1rem;
    }
}
