/* DESIGN ÉDITORIAL SUISSE - TABLEAU DE BORD FIXE */
:root {
    --bg: #ffffff;
    --text: #000000;
    --accent: #ff0000;
    --line: rgba(0, 0, 0, 0.2);
    --text-light: #777777;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-6: 48px;
    --space-8: 64px;

    --hairline: 1px;

    --unit-height: calc(100vh / 15);
    --nav-height: calc(var(--unit-height) * 2);
    --breadcrumb-height: var(--unit-height);
    --photo-height: calc(var(--unit-height) * 3);
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    :root { --hairline: 0.5px; }
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Helvetica Neue', 'Nimbus Sans', Helvetica, Arial, sans-serif;
    margin: 0; padding: 0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

/* ── NAVIGATION ── */
nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(5, minmax(0, 1fr));
    height: var(--nav-height);
    position: fixed;
    top: 0; left: 0; width: 100%;
    background: var(--bg);
    z-index: 10001;
    border-bottom: var(--hairline) solid var(--line);
}

.nav-btn {
    background: var(--bg);
    border: none;
    border-right: var(--hairline) solid var(--line);
    color: var(--text);
    padding: 0 var(--space-3);
    display: flex; align-items: center; justify-content: flex-start;
    cursor: pointer;
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    white-space: nowrap;
}
.nav-btn:first-child { }
.nav-btn:hover { background: #fafafa; color: var(--accent); }
.nav-btn.active-nav { background: var(--bg); color: var(--accent); box-shadow: none; }
.nav-btn.active-nav:hover { background: var(--bg); color: var(--accent); }

/* Stats dans la nav */
.global-stats-wrapper {
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding: 0 var(--space-3);
    border-left: var(--hairline) solid var(--line);
    grid-column: -2 / -1;
}
.global-stats-wrapper.visible { display: flex; }
.global-stats {
    display: flex; gap: var(--space-3);
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    color: var(--text);
}
.stat-accent { color: var(--accent); }

/* ── SECTIONS ── */
.view-section {
    display: none;
    height: calc(100vh - var(--nav-height));
    margin-top: var(--nav-height);
    overflow: hidden;
}
.view-section.active { display: block; }

/* ── EXPLORATEUR (INDEX) ── */
.explorer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(5, minmax(0, 1fr));
    height: 100%;
}

.explorer-sidebar {
    border-right: var(--hairline) solid var(--line);
    overflow-y: auto;
    background: var(--bg);
}
.explorer-sidebar::-webkit-scrollbar { width: 3px; }
.explorer-sidebar::-webkit-scrollbar-thumb { background: var(--line); }

.sidebar-item {
    border-bottom: var(--hairline) solid var(--line);
    cursor: pointer;
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    line-height: 1.4;
    overflow: hidden;
    position: relative;
    display: flex; align-items: center;
    height: var(--unit-height);
    padding: 0 var(--space-2);
}
.sidebar-item-meta {
    font-size: 10px; font-weight: normal;
    color: var(--text-light); letter-spacing: 0;
    margin-top: 2px; line-height: 1.3;
}
.sidebar-item img {
    width: auto;
    height: auto;
    max-width: 50px;
    max-height: 70%;
    object-fit: contain;
    margin-right: var(--space-2);
}
.sidebar-item:hover { background: #fafafa; color: var(--accent); }
.sidebar-item:hover img { opacity: 0.8; }
.sidebar-item.active-vol { background: #e0e0e0; color: var(--text); }
.sidebar-item.active-vol span { color: var(--text-light); }
.sidebar-item.active-vol img { filter: none; }

.explorer-main {
    display: flex; flex-direction: column;
    overflow: hidden; height: 100%;
    grid-column: 2 / -1;
}

.breadcrumb-bar {
    height: var(--breadcrumb-height);
    padding: 0 var(--space-3);
    border-bottom: var(--hairline) solid var(--line);
    font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: -0.02em;
    display: flex; align-items: center;
    flex-shrink: 0;
    background: var(--bg);
}
.breadcrumb-link { cursor: pointer; color: var(--text-light); }
.breadcrumb-link:hover { color: var(--accent); }
.breadcrumb-current { color: var(--text); }

/* ── GRILLE PRINCIPALE ── */
#sd-content-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: var(--photo-height);
    gap: 0;
    overflow-y: auto;
    height: 100%;
}

.desktop-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, var(--photo-height));
    gap: 0;
    overflow: hidden;
}

/* ── CASES (dossiers & photos) ── */
.sub-folder, .photo-card {
    background: var(--bg);
    border-right: var(--hairline) solid var(--line);
    border-bottom: var(--hairline) solid var(--line);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.sub-folder {
    display: flex; flex-direction: column;
    justify-content: flex-end; align-items: flex-start;
    padding: var(--space-2);
}
.sub-folder:hover, .photo-card:hover { z-index: 10; }
.sub-folder-icon {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -60%);
    color: var(--text-light);
    opacity: 0.35;
    pointer-events: none;
}
.sub-folder:hover .sub-folder-icon { opacity: 0.65; }
.sd-id {
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em; text-transform: uppercase;
    position: relative; z-index: 1;
}
.sub-folder-count {
    font-size: 10px; font-weight: normal;
    color: var(--text-light); letter-spacing: 0;
    margin-top: 2px; line-height: 1.3;
    position: relative; z-index: 1;
}

.photo-card img, .photo-card video {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    background: #f0f0f0;
}
.photo-data {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: var(--bg);
    padding: 7px 10px;
    font-size: 9px; font-family: 'Courier New', monospace;
    font-weight: bold; letter-spacing: 0.04em;
    display: none;
    border-top: var(--hairline) solid var(--line);
}
.photo-card:hover .photo-data { display: block; }

.photo-card:has(video)::after,
.photo-card.video-card::after {
    content: '▶';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
}

.data-label {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

/* ── PAGINATION ── */
.pagination-controls {
    display: flex; align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 11px; font-weight: bold;
}
.page-btn {
    background: transparent;
    border: var(--hairline) solid var(--line);
    color: var(--text); padding: 3px 10px;
    cursor: pointer; font-family: inherit;
    font-size: 11px; font-weight: bold;
    line-height: 1;
}
.page-btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.page-btn:disabled { opacity: 0.25; pointer-events: none; }

/* ── TAGS ── */
#tags.view-section.active {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
#tags-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.tags-cloud {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    gap: var(--space-4) var(--space-1);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: var(--space-2);
}
.tags-cloud::-webkit-scrollbar { width: 3px; }
.tags-cloud::-webkit-scrollbar-thumb { background: var(--line); }

.tag-category-block {
    break-inside: avoid;
    margin-bottom: var(--space-4);
}
.tag-category-name {
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    color: var(--text);
    border-bottom: var(--hairline) solid var(--line);
    padding-bottom: 6px;
    margin-bottom: 6px;
}
.tag-category-name.tag-category-zero { color: var(--line); }
.tag-item {
    display: block;
    width: 100%;
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    color: var(--text);
    background: none; border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    line-height: 1.7;
}
.tag-item:hover { color: var(--accent); }
.tag-item.active-tag { color: var(--accent); }
.tag-item.tag-zero { opacity: 0.25; pointer-events: none; }
.tag-item .tag-count { opacity: 0.4; font-size: 10px; font-weight: normal; white-space: nowrap; margin-left: 4px; font-variant-numeric: tabular-nums; }

#tags-validate-bar {
    height: var(--breadcrumb-height);
    border-bottom: var(--hairline) solid var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(5, minmax(0, 1fr));
    align-items: stretch;
    flex-shrink: 0;
}
#tags-selection-info {
    grid-column: 1 / 5;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text);
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
}
#tags-deselect-btn {
    grid-column: 5 / 6;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text);
    background: transparent;
    border: none;
    border-left: var(--hairline) solid var(--line);
    cursor: pointer;
    padding: 0 var(--space-2);
}
#tags-deselect-btn:disabled { color: var(--line); cursor: default; }
#tags-deselect-btn:not(:disabled):hover { background: #fafafa; }
#tags-validate-btn {
    grid-column: 6 / 7;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--text);
    border: none;
    border-left: var(--hairline) solid var(--line);
    cursor: pointer;
    padding: 0;
}
#tags-validate-btn:disabled { opacity: 0.3; cursor: default; }
#tags-validate-btn:not(:disabled):hover { background: var(--accent); }

#tags-results-panel {
    position: absolute;
    inset: 0;
    background: var(--bg);
    display: none;
    flex-direction: column;
    z-index: 5;
}
#tags-results-panel.visible { display: flex; }
#tags-results-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: 0;
}
#tags-results-breadcrumb {
    grid-column: 1 / 6;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
}
#tags-back-btn {
    grid-column: 6 / 7;
    border: none;
    border-left: var(--hairline) solid var(--line);
    background: var(--text);
    color: var(--bg);
    height: 100%;
    border-radius: 0;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
}
#tags-back-btn:hover { background: var(--accent); border-color: var(--accent); }
#tags-results {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: var(--photo-height);
    gap: 0;
    overflow-y: auto;
    min-height: 0;
}

/* ── LIGHTBOX ── */
.lightbox {
    position: fixed;
    top: calc(var(--nav-height) + var(--breadcrumb-height)); left: 0; right: 0; bottom: 0;
    background: var(--bg);
    z-index: 10000;
    display: none;
    grid-template-columns: minmax(0, 4fr) minmax(0, 2fr);
}
.lightbox.active { display: grid; }

.lightbox-media {
    display: flex;
    align-items: center; justify-content: center;
    overflow: hidden;
    border-right: var(--hairline) solid var(--line);
    background: var(--bg);
    position: relative;
}
.lightbox-img {
    display: none;
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.lightbox-img.is-cover {
    width: 100%; height: 100%;
    object-fit: cover;
}
#lightbox-video {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: contain;
}
.lightbox-audio-container {
    display: none;
    flex-direction: column; align-items: center;
    padding: var(--space-4);
}

.lightbox-sidebar {
    display: flex; flex-direction: column;
    overflow: hidden;
    border-left: var(--hairline) solid var(--line);
}
.lightbox-sidebar-header { display: none; }

/* Barre breadcrumb lightbox */
#lightbox-crumb-bar {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    height: var(--breadcrumb-height);
    background: var(--bg);
    border-bottom: var(--hairline) solid var(--line);
    z-index: 10001;
    grid-template-columns: minmax(0, 1fr) repeat(5, minmax(0, 1fr));
    align-items: stretch;
}
#lightbox-crumb-bar.visible { display: grid; }
#lightbox-crumb-path {
    grid-column: 2 / 6;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    overflow: hidden;
    white-space: nowrap;
}
.crumb-part { color: var(--text-light); }
.crumb-part.crumb-last { color: var(--text); }
.crumb-sep { color: var(--line); margin: 0 6px; }
#lightbox-crumb-back {
    grid-column: 6 / 7;
    border: none; border-left: var(--hairline) solid var(--line);
    background: var(--text); color: var(--bg);
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    cursor: pointer; font-family: inherit;
    padding: 0;
}
#lightbox-crumb-back:hover { background: var(--accent); }
.lightbox-meta {
    padding: var(--space-3);
    font-family: 'Courier New', monospace;
    font-size: 11px; font-weight: bold;
    overflow-y: auto;
    line-height: 1.8;
    flex: 1;
}
.lightbox-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: var(--hairline) solid var(--line);
    flex-shrink: 0;
}
.lightbox-nav-btn {
    border: none; border-radius: 0;
    background: var(--bg); color: var(--text);
    font-size: 18px; font-weight: bold;
    height: calc(var(--unit-height) * 3);
    cursor: pointer; font-family: inherit;
    padding: 0;
}
.lightbox-nav-btn:hover { background: var(--text); color: var(--bg); }
.lightbox-nav-btn:first-child { border-right: var(--hairline) solid var(--line); }

/* ── EXTRACTION ALÉATOIRE ── */
#random.view-section.active { display: flex; flex-direction: column; }
.source-label {
    grid-column: span 2;
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text);
    display: flex; align-items: center;
    padding: 0 var(--space-3);
    white-space: nowrap;
}

.random-source-bar {
    height: var(--breadcrumb-height);
    border-bottom: var(--hairline) solid var(--line);
    display: grid;
    grid-template-columns: repeat(18, minmax(0, 1fr));
    align-items: stretch;
    flex-shrink: 0;
}
.random-showcase {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    flex: 1;
    overflow: hidden;
}
.random-media-wrapper {
    grid-column: 1 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    overflow: hidden;
}
.random-media-wrapper img, .random-media-wrapper video {
    max-width: 100%; max-height: 100%; object-fit: contain;
}
.random-meta-box {
    grid-column: 5 / 7;
    padding: var(--space-4);
    border-left: var(--hairline) solid var(--line);
    display: flex; flex-direction: column;
    justify-content: space-between; overflow: hidden;
}
.random-meta-content {
    font-family: 'Courier New', monospace;
    font-size: 11px; font-weight: bold;
    line-height: 1.6; letter-spacing: 0.05em;
    color: var(--text);
}
.random-card-selector { display: contents; }
.random-card-group {
    grid-column: span 3;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    justify-items: center;
}
.random-card-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    font-family: inherit;
    cursor: pointer;
    opacity: 0.25;
}
.random-card-btn:hover { opacity: 1; color: var(--accent); }
.random-card-btn.active { opacity: 1; }

.random-action-btn {
    background: var(--text); color: var(--bg);
    border: none; padding: var(--space-2) var(--space-3);
    cursor: pointer; text-transform: uppercase;
    font-size: 11px; font-weight: bold;
    width: 100%; letter-spacing: -0.02em;
}
.random-action-btn:hover { background: var(--accent); }

/* ── CHRONOLOGIE ── */
#timeline.view-section.active { display: block; overflow-y: auto; }
#timeline-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: var(--breadcrumb-height);
}

.timeline-year-header {
    grid-column: 1 / -1;
    height: var(--breadcrumb-height);
    padding: 0 var(--space-3);
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text);
    border-top: var(--hairline) solid var(--line);
    border-bottom: var(--hairline) solid var(--line);
    background: var(--bg);
    display: grid; grid-template-columns: repeat(6, 1fr); align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: clip;
}
.timeline-year-count {
    grid-column: 2;
    font-size: 10px; font-weight: normal;
    color: var(--text-light); letter-spacing: 0;
    text-transform: none;
}

.timeline-photo-cell {
    grid-row: span 2;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border-right: var(--hairline) solid var(--line);
    border-bottom: var(--hairline) solid var(--line);
    background: #f0f0f0;
    content-visibility: auto;
    contain-intrinsic-size: 0 calc(var(--unit-height) * 2);
}

.timeline-photo-cell img,
.timeline-photo-cell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── CARTE ── */
#carte.view-section.active { display: block; position: relative; overflow: hidden; }
#map-container { width: 100%; height: 100%; }
.leaflet-layer { filter: grayscale(1) opacity(0.65) contrast(1.2); }

/* Popup Swiss design */
.popup-sd .leaflet-popup-content-wrapper {
    background: #fff;
    border: 1px solid #000;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
.popup-sd .leaflet-popup-content {
    margin: 0;
    min-width: 200px;
}
.popup-sd .leaflet-popup-tip-container { display: none; }
.popup-sd .leaflet-popup-close-button { display: none; }

.popup-dossier {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #999;
    padding: 7px 10px 6px;
    border-bottom: 1px solid rgba(0,0,0,0.15);
}
.popup-lieu {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #000;
    padding: 8px 10px 2px;
    line-height: 1.1;
}
.popup-ville {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 10px;
    font-weight: normal;
    color: #777;
    padding: 0 10px 8px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-top: 1px solid rgba(0,0,0,0.15);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: -0.02em;
}
.popup-count-multi { color: #ff0000; }
.popup-count-single { color: #aaa; font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.popup-date { color: #aaa; font-weight: normal; }

#map-gallery-panel {
    position: absolute;
    top: 0; right: 0;
    width: calc(100% / 3 * 2);
    height: 100%;
    background: var(--bg);
    border-left: var(--hairline) solid var(--line);
    display: none;
    flex-direction: column;
    z-index: 1000;
}
#map-gallery-panel.visible { display: flex; }
#map-gallery-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1fr);
    align-items: stretch;
    padding: 0;
}
#map-gallery-title {
    grid-column: 1 / 4;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
}
#map-gallery-close-btn {
    grid-column: 4 / 5;
    border: none;
    border-left: var(--hairline) solid var(--line);
    background: var(--text);
    color: var(--bg);
    height: 100%;
    border-radius: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
}
#map-gallery-close-btn:hover { background: var(--accent); border-color: var(--accent); }
#map-gallery-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: var(--photo-height);
    gap: 0;
    overflow-y: auto;
    min-height: 0;
}

/* ── CONTEXTE ── */
#contexte.view-section.active { display: block; overflow-y: auto; }
.contexte-content {
    padding: var(--space-8); max-width: 1200px; margin: 0 auto;
}
.manifesto {
    font-size: clamp(18px, 2.5vw, 32px); line-height: 1.15;
    font-weight: bold; margin-bottom: var(--space-8);
    text-transform: uppercase;
}
.contexte-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: var(--space-6); border-top: var(--hairline) solid var(--line);
    padding-top: var(--space-4);
}
.contexte-column h3 {
    font-size: 11px; font-weight: bold;
    text-transform: uppercase; letter-spacing: -0.02em;
    margin: 0 0 var(--space-2);
}
.contexte-column p {
    font-size: 13px; color: var(--text-light); line-height: 1.7; margin: 0;
}

/* ── LOADING ── */
#landing {
    display: none;
    position: fixed; inset: 0; background: var(--bg);
    z-index: 10002;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-6);
}
.landing-content {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0;
    padding-top: var(--space-3);
}
.landing-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    align-self: stretch;
}
.landing-left {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}
.landing-card-img {
    height: clamp(110px, 24.2vw, 355px);
    width: auto;
    object-fit: contain;
}
.landing-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(55px, 9.9vw, 154px);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.8;
    color: var(--text);
    text-transform: uppercase;
}
.landing-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.landing-stat {
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    color: var(--text);
    opacity: 0.5;
}
.landing-enter {
    align-self: flex-end;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px; font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    background: var(--text);
    color: var(--bg);
    border: none;
    height: calc(var(--unit-height) * 2);
    width: calc(100vw / 6 - var(--space-6));
    padding: 0;
    cursor: pointer;
    margin-top: var(--space-2);
}
.landing-enter:hover { background: var(--accent); }

#loading-screen {
    position: fixed; inset: 0; background: var(--bg);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-6);
}
.loading-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(80px, 15vw, 220px);
    font-weight: 700;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    line-height: 0.85;
    color: var(--text);
}
.loading-status {
    font-size: 11px; font-weight: bold;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text);
    padding-bottom: var(--space-3);
    border-bottom: var(--hairline) solid var(--line);
}

/* ── TABLETTE ── */
@media (max-width: 900px) {
    .nav-btn:first-child { width: auto; flex: 1; }
    .explorer-layout { grid-template-columns: 1fr; grid-template-rows: 180px 1fr; }
    .explorer-sidebar { border-right: none; border-bottom: var(--hairline) solid var(--line); overflow-x: auto; overflow-y: hidden; display: flex; }
    .sidebar-item { flex-shrink: 0; border-bottom: none; border-right: var(--hairline) solid var(--line); }
    .desktop-grid { grid-template-columns: repeat(3, 1fr); }
    .random-showcase { flex-direction: column; }
    .random-meta-box { flex: auto; border-left: none; border-top: var(--hairline) solid var(--line); }
    .contexte-grid { grid-template-columns: 1fr; }
}

/* ── MOBILE ── */
@media (max-width: 600px) {
    :root {
        --nav-height: 44px;
        --unit-height: calc(100vw / 5);
    }

    /* Nav scrollable horizontalement */
    nav {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
        grid-template-columns: none;
    }
    nav::-webkit-scrollbar { display: none; }
    .nav-btn { flex-shrink: 0; font-size: 10px; padding: 0 14px; height: 100%; }
    .global-stats-wrapper { display: none !important; }

    /* Explorer: sidebar horizontale + contenu pleine largeur */
    .explorer-layout { grid-template-columns: 1fr; grid-template-rows: 90px 1fr; }
    .explorer-sidebar { border-right: none; border-bottom: var(--hairline) solid var(--line); overflow-x: auto; overflow-y: hidden; display: flex; }
    .sidebar-item { flex-shrink: 0; border-bottom: none; border-right: var(--hairline) solid var(--line); min-width: 80px; width: auto; }
    .sidebar-item img { max-width: 30px; margin-right: 8px; }
    .explorer-main { grid-column: 1; }

    /* Grille principale : 2 colonnes */
    #sd-content-grid { grid-template-columns: repeat(2, 1fr); }
    .desktop-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: none; grid-auto-rows: var(--photo-height); }

    /* Breadcrumb */
    #breadcrumb { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Tags cloud : 2 colonnes */
    .tags-cloud { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-1); }
    #tags-validate-bar { grid-template-columns: 1fr 1fr 1fr; }
    #tags-selection-info { grid-column: 1 / 2; font-size: 9px; padding: 0 var(--space-2); }
    #tags-deselect-btn { grid-column: 2 / 3; font-size: 10px; }
    #tags-validate-btn { grid-column: 3 / 4; font-size: 10px; }

    /* Tags results */
    #tags-results { grid-template-columns: repeat(2, 1fr); }
    #tags-results-bar { grid-template-columns: 1fr auto; }
    #tags-results-breadcrumb { grid-column: 1; font-size: 10px; }
    #tags-back-btn { grid-column: 2; padding: 0 var(--space-2); white-space: nowrap; }

    /* Lightbox : stack vertical */
    .lightbox { display: none; flex-direction: column; top: calc(var(--nav-height) + var(--breadcrumb-height)); }
    .lightbox.active { display: flex; }
    .lightbox-media { flex: 0 0 52vh; border-right: none; border-bottom: var(--hairline) solid var(--line); }
    .lightbox-sidebar { flex: 1; min-height: 0; border-left: none; overflow-y: auto; }
    .lightbox-meta { font-size: 10px; line-height: 1.6; padding: var(--space-2); }
    .lightbox-nav-btn { font-size: 14px; }

    /* Carte : galerie plein écran */
    #map-gallery-panel { width: 100%; }
    #map-gallery-grid { grid-template-columns: repeat(2, 1fr); }
    #map-gallery-bar { grid-template-columns: 1fr auto; }
    #map-gallery-title { grid-column: 1; font-size: 10px; }
    #map-gallery-close-btn { grid-column: 2; padding: 0 var(--space-2); white-space: nowrap; }

    /* Chronologie : 4 colonnes */
    #timeline-container { grid-template-columns: repeat(4, 1fr); }
    .timeline-year-header { grid-template-columns: 1fr 1fr; }
    .timeline-year-count { grid-column: 2; }

    /* Extraction aléatoire */
    .random-showcase { display: flex; flex-direction: column; }
    .random-media-wrapper { flex: 0 0 45vh; grid-column: unset; }
    .random-meta-box { flex: 1; grid-column: unset; border-left: none; border-top: var(--hairline) solid var(--line); padding: var(--space-2); overflow-y: auto; justify-content: flex-start; gap: var(--space-2); }
    .random-source-bar { display: flex; overflow-x: auto; scrollbar-width: none; height: auto; min-height: var(--breadcrumb-height); }
    .random-source-bar::-webkit-scrollbar { display: none; }
    .source-label { flex-shrink: 0; }
    .random-card-selector { display: flex; flex-shrink: 0; }
    .random-card-group { flex-shrink: 0; display: flex; gap: 4px; padding: 0 8px; grid-column: unset; }

    /* Landing */
    #landing { padding: var(--space-3); }
    .landing-title { font-size: clamp(36px, 13vw, 80px); }
    .landing-card-img { height: clamp(55px, 16vw, 110px); }
    .landing-enter { padding: 12px 24px; font-size: 13px; }
}
