/* ============================================================
   style.css — Visionneuse Formo
   ressource.formo.fr
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;600&display=swap');

/* ── Reset minimal ────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Variables ────────────────────────────────────────────── */
:root {
    --bg:           #1a1a1a;
    --bg-thumb:     #242424;
    --bg-card:      #1f1f1f;
    --separator:    #2e2e2e;
    --text:         #e0e0e0;
    --text-mid:     #888888;
    --text-dim:     #555555;
    --accent:       #ffffff;
    --font:         'IBM Plex Mono', 'Courier New', monospace;
    --max-width:    1400px;
    --px:           24px;
    --radius:       2px;
}

/* ── Base ─────────────────────────────────────────────────── */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-weight: 300;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

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

ul, ol {
    list-style: none;
}

/* ── Layout ───────────────────────────────────────────────── */
.main-content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px var(--px) 64px;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px var(--px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--separator);
}

.logo-link {
    display: inline-flex;
    align-items: center;
}

.logo {
    height: 32px;
    width: auto;
}

.logout-link {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-mid);
    letter-spacing: 0.04em;
    transition: color 0.15s;
}
.logout-link:hover {
    color: var(--accent);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px var(--px);
    border-top: 1px solid var(--separator);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-back {
    color: var(--text-mid);
    transition: color 0.15s;
}
.footer-back:hover {
    color: var(--accent);
}

/* ── Page index ───────────────────────────────────────────── */
.page-intro {
    margin-bottom: 40px;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state {
    color: var(--text-mid);
    font-size: 0.875rem;
}

/* ── Gallery list (index) ─────────────────────────────────── */
.gallery-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gallery-item {
    border-top: 1px solid var(--separator);
}
.gallery-item:last-child {
    border-bottom: 1px solid var(--separator);
}

.gallery-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 0;
    transition: color 0.15s;
}
.gallery-link:hover {
    color: var(--accent);
}
.gallery-link:hover .gallery-title {
    color: var(--accent);
}

.gallery-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gallery-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    transition: color 0.15s;
}

.gallery-desc {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-mid);
    white-space: nowrap;
}

.gallery-date {}
.gallery-count {}

.gallery-lock {
    display: inline-flex;
    align-items: center;
    color: var(--text-dim);
}

/* ── Gallery header ───────────────────────────────────────── */
.gallery-header {
    width: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--separator);
    position: sticky;
    top: 0;
    z-index: 10;
}

.gallery-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px var(--px) 16px;
}

.gallery-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text);
    margin-bottom: 6px;
}

.gallery-header-meta {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-mid);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-header-meta .separator {
    color: var(--text-dim);
}

.gallery-header-desc {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-mid);
    margin-top: 6px;
}

/* ── Series nav ───────────────────────────────────────────── */
.series-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--px) 12px;
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.series-nav::-webkit-scrollbar { display: none; }

.series-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 0;
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--text-mid);
    white-space: nowrap;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.series-nav-item:first-child {
    padding-left: 0;
}
.series-nav-item:hover {
    color: var(--text);
}
.series-nav-item.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.series-nav-count {
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--bg-thumb);
    padding: 1px 6px;
    border-radius: var(--radius);
}

/* ── Photo sections ───────────────────────────────────────── */
.photo-section {
    margin-bottom: 56px;
}
.photo-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mid);
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.section-count {
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--text-dim);
    letter-spacing: 0;
    text-transform: none;
}

.section-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s;
}
.section-download:hover {
    color: var(--text);
}

/* ── Justified Gallery ────────────────────────────────────── */
.justified-gallery {
    width: 100%;
}

.justified-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}
.justified-row:last-child {
    margin-bottom: 0;
}

.justified-row--last {
    justify-content: flex-start;
}

/* ── Photo figure ─────────────────────────────────────────── */
.photo-figure {
    flex-shrink: 0;
    cursor: pointer;
}

.photo-thumb-wrap {
    overflow: hidden;
    background: var(--bg-thumb);
    display: block;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: filter 0.2s;
}
.photo-figure:hover .photo-thumb {
    filter: brightness(1.08);
}

.photo-caption {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 0 2px;
    font-size: 0.68rem;
    font-weight: 300;
    min-width: 0;
    overflow: hidden;
}

.photo-name {
    color: var(--text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.photo-caption .sep {
    color: var(--text-dim);
    flex-shrink: 0;
}

.photo-dims {
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.photo-size {
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.lightbox.is-open {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 60px 80px 90px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    opacity: 0.6;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover {
    opacity: 1;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 20px 16px;
    opacity: 0.5;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.lightbox-arrow:hover {
    opacity: 1;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px var(--px);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.75rem;
    font-weight: 300;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
}

.lightbox-name {
    color: var(--text-mid);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox-size {
    color: var(--text-dim);
    white-space: nowrap;
}

.lightbox-counter {
    color: var(--text-dim);
    white-space: nowrap;
    margin-left: auto;
}

/* ── Auth page ────────────────────────────────────────────── */
body.auth-page {
    justify-content: center;
    align-items: center;
}

body.auth-page .main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px var(--px);
}

.auth-wrapper {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.auth-logo-link {
    display: inline-flex;
}

.auth-logo {
    height: 36px;
}

.auth-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: 0.02em;
}

.auth-desc {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-mid);
}

.auth-error {
    font-size: 0.8rem;
    font-weight: 300;
    color: #e07070;
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input {
    width: 100%;
    background: var(--bg-thumb);
    border: 1px solid var(--separator);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 300;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.15s;
    border-radius: var(--radius);
}
.auth-input:focus {
    border-color: var(--text-mid);
}
.auth-input::placeholder {
    color: var(--text-dim);
}

.auth-btn {
    width: 100%;
    background: var(--text);
    color: var(--bg);
    border: none;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 12px 16px;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.15s;
    border-radius: var(--radius);
}
.auth-btn:hover {
    background: var(--accent);
}

.auth-back {
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--text-dim);
    transition: color 0.15s;
}
.auth-back:hover {
    color: var(--text-mid);
}

/* ── Admin page ───────────────────────────────────────────── */
.admin-wrapper {
    max-width: 600px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 32px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-mid);
    letter-spacing: 0.03em;
}

.form-group label small {
    color: var(--text-dim);
}

.form-input {
    background: var(--bg-thumb);
    border: 1px solid var(--separator);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 300;
    padding: 10px 14px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
    border-radius: var(--radius);
}
.form-input:focus {
    border-color: var(--text-mid);
}
.form-input::placeholder {
    color: var(--text-dim);
}

.form-hint {
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--text-dim);
}

.admin-success {
    background: #1a2a1a;
    border: 1px solid #2e4a2e;
    color: #7ec87e;
    padding: 16px;
    font-size: 0.8rem;
    font-weight: 300;
    line-height: 1.6;
    margin-top: 16px;
    border-radius: var(--radius);
}
.admin-success a {
    color: #7ec87e;
    text-decoration: underline;
}

.admin-divider {
    border: none;
    border-top: 1px solid var(--separator);
    margin: 40px 0 24px;
}

.admin-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 16px;
    letter-spacing: 0.04em;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --px: 16px;
    }

    .gallery-link {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .gallery-meta {
        flex-wrap: wrap;
        gap: 10px;
    }

    .lightbox-img-wrap {
        padding: 48px 48px 80px;
    }

    .lightbox-arrow {
        padding: 14px 10px;
    }

    .gallery-header-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .lightbox-img-wrap {
        padding: 40px 40px 72px;
    }

    .lightbox-caption {
        flex-wrap: wrap;
        gap: 4px 12px;
    }
}
