/* ---------------------------------------------------------------------------
   beaumier.me — feuille de style
   Design clair/sombre, responsive, orienté album photo personnel.
--------------------------------------------------------------------------- */

:root {
    --bg: #f7f5f2;
    --surface: #ffffff;
    --text: #2b2622;
    --muted: #8a8178;
    --line: #e7e2db;
    --accent: #b5835a;      /* brun chaud */
    --accent-ink: #ffffff;
    --shadow: 0 6px 24px rgba(60, 45, 30, .10);
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1714;
        --surface: #241f1b;
        --text: #efe9e2;
        --muted: #a89e93;
        --line: #362f28;
        --accent: #cd9d70;
        --accent-ink: #1a1714;
        --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- En-tête / pied --- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 28px 0;
    margin-bottom: 28px;
}
.site-header h1 {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: -.02em;
}
.site-header .dot { color: var(--accent); }
.tagline { margin: 4px 0 0; color: var(--muted); }

.header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.logout {
    color: var(--muted); text-decoration: none; font-size: .9rem;
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px;
    white-space: nowrap; transition: border-color .15s, color .15s;
}
.logout:hover { color: var(--text); border-color: var(--accent); }

/* Page de connexion */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 30px;
    width: 100%; max-width: 380px;
    text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 1.7rem; }
.login-card .dot { color: var(--accent); }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: .95rem; }
.login-input {
    width: 100%;
    font: inherit;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    margin-bottom: 14px;
}
.login-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-btn { width: 100%; padding: 12px; }
.login-error { color: #c0392b; margin: 0 0 14px; font-size: .9rem; }
.login-warn {
    margin: 18px 0 0; font-size: .8rem; color: var(--muted);
    background: rgba(181,131,90,.12); border-radius: 8px; padding: 10px;
}
.login-warn code { color: var(--text); }

.album-header { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.album-header h1 { font-size: 1.5rem; }
.back {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.back:hover { text-decoration: underline; }

/* Fil d'Ariane (Albums › Dossier › Sous-dossier) */
.crumbs { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); }
.crumbs .current { font-weight: 700; }

.site-footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .9rem;
}

.empty {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    color: var(--muted);
    text-align: center;
}
.empty code { color: var(--text); }

/* --- Grille des albums --- */
.albums {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}
.album-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.album-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(60,45,30,.16); }
.album-cover { aspect-ratio: 4 / 3; background: var(--line); overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover--empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; opacity: .5;
}
.album-info { padding: 14px 16px; }
.album-title { display: block; font-weight: 600; }
.album-count { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* --- Barre d'outils (sélection) --- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sel-count { color: var(--muted); font-size: .9rem; }

.btn {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 10px;
    transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

/* --- Galerie de miniatures --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.tile {
    position: relative;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--line);
    aspect-ratio: 1 / 1;
}
.tile-btn {
    display: block; width: 100%; height: 100%;
    padding: 0; border: 0; cursor: zoom-in; background: none;
    position: relative;
}
.tile-media {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .25s ease;
    background: #000;
}
.tile-btn:hover .tile-media { transform: scale(1.05); }

/* Badge lecture ▶ sur les vignettes vidéo */
.play-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 54px; height: 54px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    padding-left: 4px; /* recentre le triangle */
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.4);
    transition: background .15s;
}
.tile-btn:hover .play-badge { background: var(--accent); }

/* Case à cocher (masquée tant que le mode sélection n'est pas actif) */
.tile-check {
    position: absolute;
    top: 8px; left: 8px;
    z-index: 2;
    display: none;
    cursor: pointer;
}
body.selecting .tile-check { display: block; }
.tile-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkmark {
    display: block;
    width: 26px; height: 26px;
    border-radius: 7px;
    background: rgba(255,255,255,.85);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    position: relative;
}
.tile-check input:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}
.tile-check input:checked + .checkmark::after {
    content: "";
    position: absolute;
    left: 8px; top: 3px;
    width: 6px; height: 12px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}
/* Photo cochée : léger voile de couleur */
body.selecting .tile:has(input:checked) { outline: 3px solid var(--accent); outline-offset: -3px; }

/* --- Visionneuse plein écran (lightbox) --- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 6, .94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.lightbox[hidden] { display: none; }
.lb-image, .lb-video {
    max-width: 92vw;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.lb-video { width: auto; background: #000; }
.lb-image[hidden], .lb-video[hidden] { display: none; }
.lb-close, .lb-nav {
    position: absolute;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.28); }
.lb-close {
    top: 18px; right: 20px;
    width: 44px; height: 44px;
    font-size: 1.2rem;
}
.lb-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 54px; height: 54px;
    font-size: 2.2rem;
    line-height: 1;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-caption {
    position: absolute;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,.45);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .9rem;
    max-width: 80vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 560px) {
    .lb-nav { width: 44px; height: 44px; font-size: 1.8rem; }
    .lb-prev { left: 8px; } .lb-next { right: 8px; }
}
