/* ArchiExplore — page d'accueil, carte travaillée, fiche projet, connexion */

/* ---------- Accueil ---------- */
.home-hero {
    position: relative;
    min-height: 78vh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: #1a1c20;
}
.home-hero-bg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: saturate(.9) contrast(1.02);
    transform: scale(1.02);
}
.home-hero-veil {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(16,18,21,.30) 0%, rgba(16,18,21,.55) 45%, rgba(16,18,21,.88) 100%);
}
.home-hero-inner { position: relative; padding: 0 26px 54px; color: #fff; width: 100%; }
.home-hero h1 {
    font-size: clamp(2.3rem, 5.4vw, 4.1rem);
    line-height: 1.05;
    margin: 0 0 18px;
    text-shadow: 0 2px 30px rgba(0,0,0,.35);
}
.kicker.light { color: #e9c3b1; }
.hero-lede {
    font-family: var(--serif);
    font-size: clamp(1.05rem, 1.6vw, 1.28rem);
    max-width: 60ch;
    color: rgba(255,255,255,.9);
    margin-bottom: 26px;
}
.hero-search { display: flex; gap: 10px; max-width: 620px; margin-bottom: 20px; }
.hero-search input {
    flex: 1;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.13);
    color: #fff;
    font-size: 1rem;
    backdrop-filter: blur(6px);
}
.hero-search input::placeholder { color: rgba(255,255,255,.65); }
.hero-search input:focus { outline: none; border-color: #fff; background: rgba(255,255,255,.2); }
.hero-search .btn { padding: 14px 24px; }

.hero-links { display: flex; gap: 22px; flex-wrap: wrap; font-size: .92rem; }
.hero-links a { color: rgba(255,255,255,.86); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.35); padding-bottom: 2px; }
.hero-links a:hover { color: #fff; border-color: #fff; }

.hero-credit {
    position: absolute; right: 26px; bottom: 18px;
    font-size: .76rem; color: rgba(255,255,255,.6); text-decoration: none;
}
.hero-credit:hover { color: #fff; }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 22px;
    padding-top: 40px;
    padding-bottom: 6px;
}

.home-map { height: 460px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }

.band { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 62px; padding: 56px 0; }
.band-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 46px; align-items: start; }
.band-inner h2 { margin-bottom: 14px; }

/* ---------- Carte plein écran ---------- */
.map-side .brand-line { font-family: var(--serif); font-size: 1.02rem; margin-bottom: 4px; }

.marker-dot {
    display: block;              /* un span inline ignore width et height */
    width: 13px; height: 13px; border-radius: 50%;
    box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0,0,0,.4);
    transition: transform .12s ease;
}
.leaflet-marker-icon:hover .marker-dot { transform: scale(1.35); }
.cluster-bubble {
    background: rgba(180, 71, 31, .92);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--sans); font-size: .82rem; font-weight: 600;
    box-shadow: 0 0 0 6px rgba(180, 71, 31, .18), 0 2px 10px rgba(0,0,0,.25);
}
.cluster-bubble.wide { font-size: .74rem; }

.leaflet-container { font-family: var(--sans); background: #eae6df; }
.leaflet-control-zoom a {
    border-radius: 3px !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
}
.leaflet-popup-content-wrapper { box-shadow: var(--shadow-hover); padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0 !important; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important; }

.map-legend {
    position: absolute; right: 12px; bottom: 26px; z-index: 500;
    background: var(--voile-entete);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 13px;
    font-size: .78rem;
    box-shadow: var(--shadow);
}
.map-legend div { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Fiche projet ---------- */
.project-head { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 40px; align-items: start; }
.project-figure { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--line-soft); }
.project-figure img { width: 100%; display: block; max-height: 70vh; object-fit: cover; }

.infobox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); overflow: hidden; }
.infobox h3 { margin: 0; padding: 14px 18px; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; font-family: var(--sans); background: var(--paper); border-bottom: 1px solid var(--line); }
.infobox dl { margin: 0; padding: 6px 18px 16px; }
.infobox dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin-top: 12px; }
.infobox dd { margin: 2px 0 0; font-size: .95rem; }
.infobox a { color: var(--accent); }

.media-frame { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.media-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.doc {
    display: flex; align-items: center; gap: 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; background: var(--paper-2); text-decoration: none;
}
.doc:hover { border-color: var(--ink); }
.doc b { display: block; font-weight: 500; font-size: .92rem; }
.doc span { font-size: .78rem; color: var(--ink-faint); }
.doc .ico { width: 34px; height: 34px; flex: none; border-radius: 4px; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery-grid a { display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; background: var(--line-soft); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.gallery-grid a:hover img { transform: scale(1.05); }

.source-note { font-size: .84rem; color: var(--ink-soft); border-left: 2px solid var(--line); padding-left: 14px; }

.share { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Connexion et inscription ---------- */
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 64px); }
.auth-visual { position: relative; background: #1a1c20; overflow: hidden; }
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.auth-visual .veil { position: absolute; inset: 0; background: linear-gradient(160deg, rgba(16,18,21,.25), rgba(16,18,21,.8)); }
.auth-visual .quote { position: absolute; left: 42px; right: 42px; bottom: 44px; color: #fff; }
.auth-visual .quote p { font-family: var(--serif); font-size: 1.3rem; line-height: 1.35; margin-bottom: 10px; }
.auth-visual .quote span { font-size: .84rem; color: rgba(255,255,255,.7); }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 26px; }
.auth-form .inner { width: 100%; max-width: 430px; }
.auth-form h1 { font-size: 2rem; }
.auth-form .lede { font-size: 1rem; margin-bottom: 22px; }
.auth-form .card { box-shadow: none; }

.choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.choice label {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 8px; text-align: center; cursor: pointer; font-size: .84rem; background: #fff;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked + span { color: var(--accent-dark); font-weight: 600; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 900px) {
    .home-hero { min-height: 72vh; }
    .band-inner { grid-template-columns: 1fr; gap: 30px; }
    .project-head { grid-template-columns: 1fr; gap: 24px; }
    .auth-split { grid-template-columns: 1fr; min-height: 0; }
    .auth-visual { min-height: 200px; }
    .hero-search { flex-direction: column; }
}

/* Le bouton de la navigation doit rester blanc sur fond ocre */
.nav a.btn, .nav a.btn:hover { color: #fff; }
.nav a.btn-ghost { color: var(--ink); }
.nav a.btn::after { display: none; }

.choice-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 620px) { .choice-5 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Formulaire de dépôt ---------- */
.form-steps {
    position: sticky; top: 64px; z-index: 500;
    display: flex; gap: 4px; flex-wrap: wrap;
    background: rgba(247,245,240,.95); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding: 10px 0 12px; margin-bottom: 8px;
}
.form-steps a {
    font-size: .84rem; text-decoration: none; color: var(--ink-soft);
    padding: 6px 12px; border-radius: 999px; border: 1px solid transparent;
}
.form-steps a:hover { color: var(--ink); }
.form-steps a.on { background: var(--ink); color: #fff; }

.form-block {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-top: 20px;
    scroll-margin-top: 130px;
}
.form-block header { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.form-block header h2 { margin: 0 0 4px; font-size: 1.3rem; }
.form-block header p { margin: 0; font-size: .88rem; color: var(--ink-soft); }

.hint { display: block; font-style: normal; font-size: .8rem; color: var(--ink-faint); margin-top: 5px; }
.hint.ok { color: #226b3a; }

.checkbox-line { display: flex; align-items: center; gap: 10px; }
.checkbox-line input { width: auto; }
.checkbox-line span {
    margin: 0; font-size: .93rem; color: var(--ink);
    text-transform: none; letter-spacing: 0;
}

.locate-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.locate-row .hint { margin: 0; }

.thumb-preview { width: 104px; height: 78px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.thumb-card { position: relative; margin: 0; }
.thumb-card img { width: 120px; height: 90px; object-fit: cover; border-radius: 4px; display: block; }
.thumb-remove {
    position: absolute; top: -7px; right: -7px;
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid var(--line); background: #fff; color: #9b2c2c;
    cursor: pointer; font-size: 15px; line-height: 1;
}
.thumb-remove:hover { background: #9b2c2c; color: #fff; border-color: #9b2c2c; }

.form-actions {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 24px; padding: 18px 0;
    border-top: 1px solid var(--line);
}

/* ---------- Discussion et contributions ---------- */
.comment-form textarea { min-height: 84px; }
.comment-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.file-inline { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); cursor: pointer; }
.file-inline input { width: auto; font-size: .8rem; }

.comments { margin-top: 22px; display: flex; flex-direction: column; gap: 18px; }
.comment { display: flex; gap: 14px; }
.comment .avatar {
    width: 42px; height: 42px; flex: none; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-dark);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-size: 1.1rem; font-weight: 600;
}
.comment .avatar.small { width: 32px; height: 32px; font-size: .95rem; }
.comment-body { flex: 1; min-width: 0; }
.comment-body header { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-body header time { font-size: .8rem; color: var(--ink-faint); }
.comment-body p { margin: 0 0 8px; }
.comment-image { max-width: 320px; border-radius: var(--radius); display: block; margin-bottom: 8px; }
.comment-actions { display: flex; gap: 14px; align-items: center; }
.comment.reply { margin-top: 14px; padding-left: 6px; border-left: 2px solid var(--line); }

.link-btn {
    background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; font-size: .82rem; color: var(--ink-soft); text-decoration: underline;
}
.link-btn:hover { color: var(--accent); }
.link-btn.danger:hover { color: #9b2c2c; }

.reply-form { display: none; margin: 10px 0 4px; gap: 8px; }
.reply-form.open { display: flex; align-items: flex-start; }
.reply-form textarea { flex: 1; min-height: 54px; }

/* ---------- Le coin hors sol ---------- */
.space-page {
    background: radial-gradient(1200px 600px at 20% -10%, #23293a 0%, #14161a 55%, #0e1013 100%);
    color: #f2efe9;
    min-height: 70vh;
    padding-bottom: 20px;
}
.space-page h1, .space-page h2, .space-page h3 { color: #fff; }
.space-page .section-head { border-color: rgba(255,255,255,.14); }
.space-card {
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius);
    padding: 20px;
    background: rgba(255,255,255,.03);
}
.space-card h3 { margin: 10px 0 6px; }
.space-card p { color: rgba(255,255,255,.76); font-size: .92rem; }
.space-card .coords {
    font-family: var(--sans); font-size: .8rem; letter-spacing: .04em;
    color: rgba(255,255,255,.5); margin: 12px 0 0;
}

/* ---------- Coups de coeur ---------- */
.like-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: rgba(255,255,255,.94);
    border-radius: 999px; padding: 6px 12px; cursor: pointer;
    font: inherit; font-size: .84rem; color: var(--ink-soft);
    transition: transform .14s ease, border-color .14s ease, color .14s ease, background .14s ease;
}
.like-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.like-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.like-btn.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.like-btn.on svg { fill: #fff; }
.like-btn.pulse { animation: like-pulse .45s ease; }
@keyframes like-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.tile .like-btn { position: absolute; right: 10px; bottom: 10px; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.tile .thumb-wrap { position: relative; }

/* Signal de popularité sur les vignettes */
.flame { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--accent-dark); }

/* ---------- Un peu de vie ---------- */
.tile, .pill, .card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.pill:hover { background: var(--accent-soft); border-color: var(--accent); }
.stat b { transition: color .2s ease; }
.stat:hover b { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.seen { opacity: 1; transform: none; }

.counter { font-variant-numeric: tabular-nums; }

/* ---------- Filtres avancés de la carte ---------- */
.map-side .filters { max-height: 62vh; overflow-y: auto; }

.autocomplete { position: relative; }
.suggestions {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 1200;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-hover); overflow: hidden; margin-top: 4px;
    max-height: 280px; overflow-y: auto;
}
.suggestions button {
    display: block; width: 100%; text-align: left; border: 0; background: none;
    padding: 9px 12px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line-soft);
}
.suggestions button:last-child { border-bottom: 0; }
.suggestions button:hover { background: var(--accent-soft); }
.suggestions b { display: block; font-weight: 500; font-size: .9rem; }
.suggestions span { font-size: .78rem; color: var(--ink-faint); }

.more-filters { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.more-filters summary {
    cursor: pointer; font-size: .84rem; color: var(--ink-soft);
    list-style: none; display: flex; align-items: center; gap: 6px;
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::before { content: '+'; font-size: 1rem; line-height: 1; }
.more-filters[open] summary::before { content: '−'; }
.more-filters summary:hover { color: var(--accent); }

.filters-footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.filters-footer .hint { margin: 0 0 0 auto; color: var(--accent-dark); }

/* Accueil : exemples de recherche, mode d'emploi, contributeurs */
.hero-tries { margin: 12px 0 0; font-size: .92rem; color: rgba(255, 255, 255, .78); }
.hero-tries a { color: #fff; text-decoration: underline; text-underline-offset: 3px; margin: 0 2px; }
.hero-tries span { opacity: .5; margin: 0 4px; }

.how-card {
    display: block; position: relative; text-decoration: none; color: inherit;
    background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 26px 24px 22px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.how-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.how-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; margin-bottom: 14px;
    background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; font-size: .95rem;
}
.how-card h3 { margin: 0 0 8px; font-size: 1.12rem; }
.how-card p { margin: 0 0 14px; color: var(--ink-soft); font-size: .94rem; line-height: 1.55; }
.how-card em { font-style: normal; color: var(--accent); font-size: .9rem; font-weight: 500; }
.how-card em::after { content: ' →'; }

.who { border-left: 2px solid var(--accent-soft); padding: 4px 0 4px 16px; }
.who b { display: block; margin-bottom: 6px; font-weight: 600; }
.who span { color: var(--ink-soft); font-size: .92rem; line-height: 1.55; }

@media (max-width: 720px) {
    .how-card { padding: 20px 18px; }
    .who { border-left: none; border-top: 2px solid var(--accent-soft); padding: 12px 0 0; }
}

/* --- Accessibilité et finitions --- */

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 200;
    background: var(--ink); color: #fff; padding: 10px 16px;
    border-radius: var(--radius); text-decoration: none; font-size: .92rem;
    transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* Un anneau de focus lisible partout, y compris sur fond sombre */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}
main:focus { outline: none; }

/* Les vignettes gardent leur place pendant le chargement, plus de sursaut */
.thumb-wrap { background: var(--line-soft); }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* Les liens de contenu se distinguent sans surcharger la page */
.prose a { text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
    .site-header, .site-footer, .map-panel, .share, .geofix, .like-btn { display: none !important; }
    body { background: #fff; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}

/* --- Carte : lisibilité des points et de la légende --- */
.marker-dot-open { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(20,22,26,.25); }
.map-legend strong { display: block; margin-bottom: 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.map-legend div { display: flex; align-items: center; gap: 7px; font-size: .82rem; line-height: 1.7; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.pop-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.badge-stage { color: #fff; border: none; }
.pop-link { display: inline-block; font-weight: 500; }
.result.is-hovered { background: var(--accent-soft); }

/* Provenance et état, visibles dès la vignette */
.badge-student { background: #2f7c5d; color: #fff; border: none; }
.badge-stage-construction { background: #c98a12; color: #fff; border: none; }
.badge-stage-study { background: #2f7c5d; color: #fff; border: none; }
.badge-stage-unbuilt { background: #5b4b8a; color: #fff; border: none; }
.badge-stage-demolished { background: #7a7f87; color: #fff; border: none; }

/* Tableau de bord : courbe et barres */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 10px 12px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
.spark span { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark span:hover { opacity: 1; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: .88rem; }
.bar-label { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-value { font-variant-numeric: tabular-nums; color: var(--ink); }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 0 10px 8px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table td:not(:first-child) { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   Charte « Relevé » : application au site
   ============================================================ */

/* Les données se lisent en colonne : coordonnées, années, surfaces. */
.stat b,
.mesure,
.pop-tags .badge,
.map-legend,
.count-bar,
.bar-value,
.table td:not(:first-child),
.spark + p {
    font-variant-numeric: tabular-nums;
}

.stat b {
    font-family: var(--mono);
    font-weight: 500;
    letter-spacing: -.02em;
}

/* Les mentions de source et les repères géographiques passent en chasse fixe. */
.coord,
.hero-credit,
.result .ph + div p em,
.infobox dd:last-child {
    font-family: var(--mono);
    font-size: .84rem;
    letter-spacing: -.01em;
}

/* Étiquettes : capitales courtes et interlettrées, jamais plus de trois mots. */
.kicker,
.field > span,
.map-legend strong,
.table th {
    font-family: var(--sans);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .78rem;
}

/* Les états de la carte tirent leurs couleurs des variables de la charte. */
.badge-stage-construction { background: var(--etat-construction); }
.badge-stage-study { background: var(--etat-study); }
.badge-stage-unbuilt { background: var(--etat-unbuilt); }
.badge-stage-demolished { background: var(--etat-demolished); }
.badge-student { background: var(--etat-study); }

/* Le bleu de plan signale ce qui relève de la donnée et non de l'action. */
.badge-wiki { color: var(--plan); border-color: var(--plan); background: var(--plan-soft); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline-color: var(--plan);
}

/* Angles presque droits partout, arrondi complet réservé aux pastilles. */
.card, .tile, .btn, .field input, .field select, .field textarea, .result, .how-card {
    border-radius: var(--radius);
}
.pill, .chip, .badge, .jeton { border-radius: 100px; }

/* Cible tactile de 44 pixels sur petit écran. */
@media (max-width: 720px) {
    .btn, .pill, .chip, .nav a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Bascule de thème : un disque mi-plein, comme une lune. */
.theme-toggle {
    width: 30px; height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper-2);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: border-color .15s ease;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle span {
    width: 13px; height: 13px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--ink) 0 50%, transparent 50% 100%);
    border: 1.5px solid var(--ink);
    display: block;
}

/* Le voile du bandeau d'accueil doit rester sombre dans les deux thèmes. */
.home-hero-veil { background: linear-gradient(180deg, rgba(10, 14, 19, .28), rgba(10, 14, 19, .74)); }
.hero-lede, .hero-tries, .hero-credit { color: rgba(255, 255, 255, .86); }
.home-hero h1, .home-hero .kicker.light { color: #fff; }

/* En sombre, une image de vignette ne doit pas éclabousser la grille. */
:root[data-theme="dark"] .thumb-wrap img { filter: brightness(.92); }

/* La légende de la carte prend ses couleurs d'état des jetons de la charte. */
.map-legend div:nth-of-type(1) i { background: var(--etat-built) !important; }
.map-legend div:nth-of-type(2) i { background: var(--etat-construction) !important; }
.map-legend div:nth-of-type(3) i { background: var(--etat-study) !important; }
.map-legend div:nth-of-type(4) i { background: var(--etat-unbuilt) !important; }
.map-legend div:nth-of-type(5) i { background: var(--etat-demolished) !important; }

/* Les commandes de Leaflet suivent le thème. */
.leaflet-bar a, .leaflet-control-layers, .leaflet-control-attribution {
    background: var(--paper-2) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--paper-3) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper-2); color: var(--ink); }

/* En thème sombre, l'accent s'éclaircit : du blanc dessus ne tient plus
   le contraste, on repasse à l'encre. */
:root[data-theme="dark"] .btn-accent,
:root[data-theme="dark"] .badge-stage,
:root[data-theme="dark"] .badge-student { color: #14181d; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn-accent,
    :root:not([data-theme="light"]) .badge-stage,
    :root:not([data-theme="light"]) .badge-student { color: #14181d; }
}

/* Bandeau en deux colonnes : le texte à gauche, la carte à droite. */
.hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--espace-5, 56px);
    align-items: center;
}
.hero-split > div:first-child { min-width: 0; }

.hero-map {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-3);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: box-shadow .2s ease, border-color .2s ease;
}
.hero-map:hover { box-shadow: var(--shadow-hover); border-color: var(--accent); }

.hero-map-toile { position: absolute; inset: 0; display: block; }

.hero-map-pied {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 500;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: var(--voile-entete);
    border-top: 1px solid var(--line);
    font-size: .88rem;
}
.hero-map-pied b { font-family: var(--mono); font-weight: 500; font-size: .84rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.hero-map-pied em { font-style: normal; color: var(--accent); font-weight: 500; white-space: nowrap; }
.hero-map-pied em::after { content: ' →'; }

@media (max-width: 900px) {
    .hero-split { grid-template-columns: 1fr; gap: 28px; }
    .hero-map { aspect-ratio: 16 / 10; }
}

/* Dans le bandeau à deux colonnes, les quatre compteurs tiennent sur une ligne. */
.hero-split .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hero-split .stat b { font-size: 1.5rem; }

@media (max-width: 1100px) {
    .hero-split .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tunnel de conversion : une barre par étape, du plus large au plus étroit. */
.tunnel { display: flex; flex-direction: column; gap: 10px; }

.tunnel-etape {
    display: grid;
    grid-template-columns: minmax(140px, 210px) 1fr 80px 74px;
    align-items: center;
    gap: 14px;
    font-size: .92rem;
}
.tunnel-nom { color: var(--ink-soft); }
.tunnel-piste { height: 26px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.tunnel-remplissage { display: block; height: 100%; border-radius: 3px; transition: width .4s ease; }
.tunnel-valeur { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.tunnel-passage { font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
.tunnel-passage em { font-style: normal; color: var(--ink-faint); }

/* La couleur se resserre à mesure que l'engagement grandit. */
.tunnel-arrivee { background: #c9b8ae; }
.tunnel-exploration { background: #c2895f; }
.tunnel-fiche { background: var(--accent); }
.tunnel-interet { background: var(--etat-study); }
.tunnel-inscription { background: var(--plan); }
.tunnel-publication { background: var(--etat-unbuilt); }

@media (max-width: 720px) {
    .tunnel-etape { grid-template-columns: 1fr 60px 62px; grid-template-areas: "nom nom nom" "piste valeur passage"; }
    .tunnel-nom { grid-area: nom; }
    .tunnel-piste { grid-area: piste; }
    .tunnel-valeur { grid-area: valeur; }
    .tunnel-passage { grid-area: passage; }
}

/* --- Encyclopédie ouverte : édition, historique, modifications --- */

.wiki-form h2 {
    font-size: 1.15rem;
    margin: 34px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.wiki-form .grid { gap: 16px; }
.wiki-resume {
    margin-top: 32px;
    padding: 22px;
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.revisions { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.revision { background: var(--paper-2); padding: 18px 20px; }
.revision-retour { border-left: 3px solid var(--etat-demolished); }

.revision-tete { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; font-size: .88rem; }
.revision-date { font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.revision-auteur { font-weight: 500; }
.revision-poids { font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-left: auto; }
.revision-poids.positif { color: var(--etat-study); }
.revision-poids.negatif { color: var(--accent); }

.revision-resume { margin: 6px 0 0; color: var(--ink-soft); font-size: .94rem; }

.revision-detail { margin: 12px 0 0; display: grid; grid-template-columns: minmax(110px, 170px) 1fr; gap: 6px 16px; font-size: .88rem; }
.revision-detail dt { color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; padding-top: 3px; }
.revision-detail dd { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.revision-detail del { background: #fbeae5; color: #8f3617; text-decoration: line-through; padding: 1px 5px; border-radius: 2px; }
.revision-detail ins { background: #e6f2ec; color: #1f5c44; text-decoration: none; padding: 1px 5px; border-radius: 2px; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .revision-detail del { background: #3a1f18; color: #e8a891; }
    :root:not([data-theme="light"]) .revision-detail ins { background: #163025; color: #8fd0b4; }
}
:root[data-theme="dark"] .revision-detail del { background: #3a1f18; color: #e8a891; }
:root[data-theme="dark"] .revision-detail ins { background: #163025; color: #8fd0b4; }

.modifications td.date { font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); white-space: nowrap; }
.modifications .lien-histo { font-size: .76rem; color: var(--ink-faint); margin-left: 6px; }
.modifications td:last-child { text-align: right; }

/* Barre d'actions posée en tête de fiche */
.fiche-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 0; font-size: .88rem; }
.fiche-actions a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.fiche-actions a:hover { color: var(--accent); border-color: var(--accent); }
.fiche-actions .separateur { color: var(--ink-faint); }

/* Entrée par la ville : recherche et classement */
.recherche-ville { display: flex; gap: 10px; margin: 26px 0 8px; flex-wrap: wrap; }
.recherche-ville input {
    flex: 1 1 320px;
    padding: 14px 18px;
    font-size: 1.05rem;
    font-family: var(--sans);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper-2);
    color: var(--ink);
}
.recherche-ville input:focus { outline: 2px solid var(--plan); outline-offset: 2px; border-color: var(--plan); }

.classement { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.classement-ligne {
    display: grid;
    grid-template-columns: 46px 1fr auto 92px;
    gap: 14px;
    align-items: baseline;
    padding: 12px 18px;
    background: var(--paper-2);
    text-decoration: none;
    color: inherit;
    font-size: .94rem;
}
.classement-ligne:hover { background: var(--accent-soft); }
.classement-rang { font-family: var(--mono); font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.classement-nom { font-weight: 500; }
.classement-pays { color: var(--ink-faint); font-size: .86rem; }
.classement-total { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
    .classement-ligne { grid-template-columns: 34px 1fr 78px; }
    .classement-pays { display: none; }
}
