:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #0e7490;
  --accent-soft: #e0f2f6;
  --top: #15803d;    --top-bg: #dcfce7;
  --bon: #65a30d;    --bon-bg: #ecfccb;
  --moyen: #b45309;  --moyen-bg: #fef3c7;
  --bof: #b91c1c;    --bof-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #171e27;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --border: #2a3441;
    --accent: #38bdf8;
    --accent-soft: #0c2a38;
    --top: #4ade80;    --top-bg: #12301f;
    --bon: #a3e635;    --bon-bg: #243010;
    --moyen: #fbbf24;  --moyen-bg: #33280c;
    --bof: #f87171;    --bof-bg: #3a1515;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); }

.drapeau { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }

/* ---------- En-tête ---------- */
.hero {
  background: linear-gradient(135deg, #0e7490 0%, #0369a1 55%, #f59e0b 140%);
  color: #fff;
  padding: 40px 16px 56px;
}
.hero-inner { max-width: 1240px; margin: 0 auto; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.02em; }
.hero p { margin: 0; max-width: 720px; opacity: .92; font-size: 1.05rem; }

/* ---------- Mise en page ---------- */
.layout {
  max-width: 1240px;
  margin: -32px auto 40px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- Filtres ---------- */
.filtres {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 18px 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
@media (max-width: 860px) {
  .filtres { position: static; max-height: none; }
}

fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
legend {
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 8px; padding: 0;
}
legend small { text-transform: none; letter-spacing: 0; font-weight: 400; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }

input[type="number"], input[type="search"], select {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  width: 100%;
}
input[type="range"] { width: 100%; margin: 12px 0 10px; accent-color: var(--accent); }

.segmented {
  display: flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; gap: 3px;
}
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 7px 4px; border-radius: 7px;
  cursor: pointer; font-size: .9rem; font-weight: 500; color: var(--muted);
  transition: background .15s, color .15s;
}
.segmented.small span { font-size: .8rem; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }
.check[hidden] { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--border); font-size: .84rem; cursor: pointer;
  transition: all .15s;
}
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }

.link {
  margin-top: 18px; background: none; border: 0; padding: 0;
  color: var(--muted); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer;
}

/* ---------- Barre d'outils ---------- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.toolbar p { margin: 0; }
.toolbar-droite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tri { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.tri select { width: auto; }

.bascule { display: flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.bascule button {
  font: inherit; font-size: .85rem; border: 0; background: var(--bg); color: var(--muted);
  padding: 7px 12px; cursor: pointer;
}
.bascule button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }

.carte-ensemble { height: 560px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 0; }
@media (max-width: 600px) { .carte-ensemble { height: 420px; } }

/* ---------- Résultats ---------- */
.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.sous-titre { font-size: 1.05rem; margin: 32px 0 12px; color: var(--muted); }
#bloc-plus .carte { opacity: .85; }

.vide {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

.note { font-size: .8rem; color: var(--muted); margin-top: 20px; }

/* ---------- Carte destination ---------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.carte:hover, .carte:focus-visible { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16, 24, 40, .14); outline: none; }
.carte:focus-visible { outline: 2px solid var(--accent); }

.photo {
  position: relative; height: 150px;
  background: linear-gradient(135deg, var(--accent-soft), var(--border)) center / cover no-repeat;
}
.photo.sans::after { content: "🌍"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; opacity: .5; }
.score {
  position: absolute; top: 10px; right: 10px;
  font-weight: 700; font-size: .95rem; color: #fff;
  background: rgba(14, 116, 144, .92); border-radius: 9px; padding: 3px 9px;
}

.corps { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.carte h3 { margin: 0; font-size: 1.08rem; }
.pays { margin: -6px 0 0; color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.accroche { margin: 0; font-size: .82rem; color: var(--muted); font-style: italic; min-height: 1.2em; }
.accroche:first-letter { text-transform: uppercase; }

.meteo { border-radius: 9px; padding: 8px 10px; font-size: .88rem; display: flex; flex-direction: column; gap: 2px; }
.meteo span { color: var(--text); opacity: .85; }
.meteo.top { background: var(--top-bg); color: var(--top); }
.meteo.bon { background: var(--bon-bg); color: var(--bon); }
.meteo.moyen { background: var(--moyen-bg); color: var(--moyen); }
.meteo.bof { background: var(--bof-bg); color: var(--bof); }

.climat { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.climat li {
  text-align: center; font-size: .66rem; font-weight: 600; padding: 4px 0; border-radius: 4px;
  color: #fff; cursor: default;
}
.climat li.top, .barre.top { background: var(--top); }
.climat li.bon, .barre.bon { background: var(--bon); }
.climat li.moyen, .barre.moyen { background: var(--moyen); }
.climat li.bof, .barre.bof { background: var(--bof); }
@media (prefers-color-scheme: dark) { .climat li { color: #0f141b; } }
.climat li.actif { outline: 2px solid var(--text); outline-offset: 1px; }

.infos { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.infos li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.infos li > span:first-child { color: var(--muted); }

.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; text-align: right; }
.badge.direct { background: var(--top-bg); color: var(--top); }
.badge.escale { background: var(--moyen-bg); color: var(--moyen); }
.badge.paris { background: var(--accent-soft); color: var(--accent); }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.tags li { font-size: .72rem; padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tags li.match { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.btn {
  margin-top: auto;
  display: block; text-align: center;
  background: var(--accent); color: #fff; font-weight: 600; font-size: .9rem;
  padding: 9px; border-radius: 9px;
}
@media (prefers-color-scheme: dark) { .btn, .bascule button[aria-pressed="true"] { color: #0f141b; } }

/* ---------- Fiche détaillée ---------- */
dialog {
  width: min(1100px, 100vw - 24px);
  max-height: calc(100vh - 24px);
  padding: 0; border: 0; border-radius: 18px;
  background: var(--bg); color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  overflow-y: auto;
}
dialog::backdrop { background: rgba(10, 15, 25, .6); backdrop-filter: blur(3px); }
@media (max-width: 600px) {
  dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
}

.fiche-hero {
  position: relative; min-height: 280px; display: flex; align-items: flex-end;
  background: linear-gradient(135deg, #0e7490, #0369a1) center / cover no-repeat;
  color: #fff; padding: 24px;
}
.fiche-titre p { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.fiche-titre h2 { margin: 4px 0; font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.02em; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.fiche-desc { font-style: italic; opacity: .95; }
.fiche-desc:first-letter { text-transform: uppercase; }
.fermer {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px;
  border-radius: 50%; border: 0; cursor: pointer; font-size: 1.1rem;
  background: rgba(0, 0, 0, .55); color: #fff;
}
.fermer:hover { background: rgba(0, 0, 0, .8); }

.fiche-grille {
  display: grid; grid-template-columns: 1fr 340px; gap: 20px; padding: 20px;
}
@media (max-width: 860px) { .fiche-grille { grid-template-columns: 1fr; padding: 16px; } }

.fiche section, .encart {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.fiche h3 { margin: 0 0 10px; font-size: 1.05rem; }
.fiche section p { margin: 0 0 8px; }
.chargement { color: var(--muted); font-style: italic; }
.petit { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }

.top10 { margin: 0; padding: 0; list-style: none; counter-reset: top; display: grid; gap: 8px; }
.top10 li {
  counter-increment: top; position: relative; padding: 8px 10px 8px 46px;
  background: var(--bg); border-radius: 10px;
}
.top10 li::before {
  content: counter(top); position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem;
}
@media (prefers-color-scheme: dark) { .top10 li::before { color: #0f141b; } }

.plats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.plat { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.plat span { font-size: .85rem; color: var(--muted); }
.boissons { margin-top: 12px !important; font-size: .92rem; }

.pratique { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0 0 12px; font-size: .92rem; }
.pratique dt { font-weight: 600; }
.pratique dd { margin: 0; }
@media (max-width: 600px) { .pratique { grid-template-columns: 1fr; } .pratique dd { margin-bottom: 6px; } }

.liste-puces { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.carte-detail { display: block; width: 100%; height: 280px; border: 0; border-radius: 10px; margin: 10px 0 6px; background: var(--bg); }
.bascule.petite { display: inline-flex; }
.bascule.petite button { padding: 5px 10px; font-size: .8rem; }

.raisons { margin: 0; font-size: .78rem; color: var(--bof); background: var(--bof-bg); border-radius: 8px; padding: 5px 8px; }
.grille.exclues .carte { opacity: .75; }
.masquees { font-size: .85rem; color: var(--muted); }
.bandeau {
  margin-top: 24px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--moyen-bg); color: var(--text); border: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .9rem;
}
.btn-secondaire {
  font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
  background: var(--surface); color: var(--accent); border: 1px solid var(--accent);
  border-radius: 9px; padding: 7px 12px;
}
.btn-secondaire:hover { background: var(--accent-soft); }
.link-inline {
  background: none; border: 0; padding: 0; margin-left: 4px; cursor: pointer;
  font: inherit; color: var(--accent); font-weight: 600; text-decoration: underline;
}

.fiche-pays { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: .9rem; }
.fiche-pays dt { color: var(--muted); }
.fiche-pays dd { margin: 0; font-weight: 500; }
.fiche-pays dd:first-letter { text-transform: uppercase; }

.meteo-direct { font-size: 1.4rem; }

.graph-climat {
  list-style: none; margin: 0; padding: 0; height: 170px;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end;
}
.graph-climat li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: .62rem; }
.graph-climat .barre { width: 100%; max-height: 100px; border-radius: 4px 4px 0 0; flex: 0 0 auto; }
.graph-climat .t { font-weight: 600; margin-bottom: 2px; }
.graph-climat .m { color: var(--muted); margin-top: 3px; }
.graph-climat .p { color: var(--muted); }
.graph-climat li.actif .m { color: var(--text); font-weight: 700; }
.graph-climat li.actif .barre { outline: 2px solid var(--text); outline-offset: 1px; }

.pastille { display: inline-block; padding: 1px 8px; border-radius: 6px; font-weight: 600; font-size: .8rem; }
.pastille.top { background: var(--top-bg); color: var(--top); }
.pastille.bon { background: var(--bon-bg); color: var(--bon); }
.pastille.moyen { background: var(--moyen-bg); color: var(--moyen); }
.pastille.bof { background: var(--bof-bg); color: var(--bof); }

.liens { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.sources { font-size: .76rem; color: var(--muted); padding: 0 20px 20px; margin: 0; }

.leaflet-container { font-family: inherit; }

.quand { margin: 10px 0 0 !important; font-size: .86rem; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }
