:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2d3142;
    --text: #e4e6eb;
    --muted: #8b8fa3;
    --accent: #4f8cff;
    --accent-hover: #6ba0ff;
    --success: #34d399;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.search-form {
    flex: 1;
    display: flex;
    max-width: 500px;
}

.search-form input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.search-form input:focus { border-color: var(--accent); }

.search-form button {
    padding: 0.6rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-size: 1rem;
}

/* Main */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted);
    font-size: 1.1rem;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.cat-card {
    opacity: 0.5;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.2s, transform 0.2s;
}

.cat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.cat-icon { font-size: 2rem; }
.cat-name { font-weight: 600; font-size: 1rem; }
.cat-count { color: var(--muted); font-size: 0.85rem; }

/* Category Header */
.category-header {
    margin-bottom: 2rem;
}

.category-header .back {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.category-header .back:hover { color: var(--accent); }

.category-header h1 {
    margin: 0.5rem 0 0.3rem;
    font-size: 1.8rem;
}

/* Sites List */
.sites-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.site-card {
    opacity: 0.5;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    transition: border-color 0.2s;
}

.site-card:hover { border-color: var(--accent); }

.site-main {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-main h3 { font-size: 1.1rem; }
.site-main h3 a { color: var(--accent); text-decoration: none; }
.site-main h3 a:hover { text-decoration: underline; }

.site-domain {
    color: var(--muted);
    font-size: 0.85rem;
}

.site-desc {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.4rem;
    line-height: 1.4;
}

.site-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.cat-tag { color: var(--accent); border-color: var(--accent); }

/* Search */
.search-header { margin-bottom: 2rem; }
.search-header h1 { margin-bottom: 1rem; }

.search-form-full {
    display: flex;
    gap: 0.5rem;
}

.search-form-full input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    outline: none;
}

.search-form-full input:focus { border-color: var(--accent); }

.search-form-full button {
    padding: 0.8rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
}

.search-form-full button:hover { background: var(--accent-hover); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.pagination a:hover { text-decoration: underline; }
.pagination span { color: var(--muted); }

/* Empty */
.empty {
    text-align: center;
    color: var(--muted);
    padding: 3rem;
    font-size: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

footer a { color: var(--accent); text-decoration: none; }

/* ─── Carte des langues (home) ─────────────────────────────── */
.map-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0 0.8rem;
}
.map-views { display: flex; gap: 0.4rem; }
.map-views button {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.45rem 0.9rem; cursor: pointer; font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}
.map-views button:hover { border-color: var(--accent); }
.map-views button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.map-hint { color: var(--muted); font-size: 0.82rem; }

#map-wrap {
    position: relative; width: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
#worldmap { display: block; width: 100%; }
.m-sphere { fill: #0c1626; }
.m-grat { fill: none; stroke: #1c2740; stroke-width: 0.5; }
.m-country { fill: #243352; stroke: #0f1117; stroke-width: 0.4; }
.m-flagbg { fill: #fff; opacity: 0.9; }
.m-dot { fill: var(--accent); opacity: 0.85; }
.m-globe { text-anchor: middle; }
.m-count {
    text-anchor: middle; fill: var(--text); font-weight: 600;
    paint-order: stroke; stroke: #0c1626; stroke-width: 2.5px;
}
.m-pin image { transition: filter 0.15s; }
.m-pin.hover image { filter: drop-shadow(0 0 4px var(--accent)); }
.m-pin.hover .m-flagbg { fill: var(--accent); }

.map-tip {
    position: absolute; pointer-events: none; z-index: 10;
    background: rgba(12, 18, 32, 0.95); border: 1px solid var(--accent);
    border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.85rem;
    color: var(--text); line-height: 1.35; max-width: 200px;
}
.map-tip .tip-flag img, .map-tip .tip-flag span {
    display: inline-block; width: 22px; height: 16px; margin-right: 0.4rem;
    vertical-align: middle; object-fit: cover; border-radius: 2px;
}

/* ─── Chips de langues ─────────────────────────────────────── */
.lang-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.chips-label { color: var(--muted); font-size: 0.85rem; }
.lang-chip {
    display: inline-flex; align-items: center; gap: 0.45rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 0.35rem 0.8rem;
    color: var(--text); text-decoration: none; font-size: 0.88rem;
    transition: border-color 0.2s;
}
.lang-chip:hover { border-color: var(--accent); }
.lang-chip b { color: var(--accent); font-weight: 600; }
.chip-flag-img { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; }
.chip-flag { font-size: 1rem; }

.lang-fulllist { margin: 1.5rem 0 0; }
.lang-fulllist summary {
    cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 0.3rem 0;
}
.lang-fulllist summary:hover { color: var(--accent); }

/* Drapeaux d'en-tête (page langue / catégorie) */
.hdr-flag { width: 34px; height: 26px; object-fit: cover; border-radius: 3px; vertical-align: middle; }
.hdr-flag-sm { width: 22px; height: 16px; object-fit: cover; border-radius: 2px; vertical-align: middle; }
.lang-badge {
    font-size: 0.95rem; color: var(--muted); margin-left: 0.5rem;
    border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.6rem;
    display: inline-flex; align-items: center; gap: 0.3rem; vertical-align: middle;
}

/* Responsive */
@media (max-width: 768px) {
    header { padding: 0.8rem 1rem; }
    nav { gap: 1rem; }
    .logo { font-size: 1.1rem; }
    main { padding: 1rem; }
    .hero h1 { font-size: 1.8rem; }
    .categories-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .cat-card {
    opacity: 0.5; padding: 1rem; }
    .map-hint { display: none; }
}

/* ── Provenance : petits drapeaux dans les tags + infobulle + crédit ── */
.tag-flag { height: .72em; width: auto; margin-right: .3em; vertical-align: -1px; border-radius: 1px; }
.map-tip .tip-sub { opacity: .7; font-size: .82em; }
footer .attribution { opacity: .55; font-size: .78em; margin-top: .2rem; }
footer .attribution a { color: inherit; }

/* ── Toggle de provenance sur la carte (Tous / Confirmé) ── */
.map-modes { display: flex; gap: 0.4rem; }
.map-mode-btn {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.45rem 0.9rem; cursor: pointer; font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}
.map-mode-btn:hover { border-color: var(--accent); }
.map-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
