/* Optimisateur du tableau des médailles — feuille de style
   Réutilise la charte du site (Cormorant Garamond + Montserrat, papier/or).
   Les variables :root sont exposées pour /assets/site.css (nav + footer). */

:root {
  --ink: #1a1814;
  --paper: #f2f5fa;          /* identique à la page d'accueil */
  --paper-dark: #e6ecf6;
  --brand: #2b3a55;          /* bleu ardoise, sobre */
  --gold: #b89a5a;
  --muted: #7a7060;
  --nav-h: 72px;
  --line: rgba(184, 154, 90, 0.30);
  --card: #fffdf8;
  --shadow: 0 14px 40px rgba(26, 24, 20, 0.09);

  --or: #c9a227;    --or-bg: #f8efcf;   --or-ink: #7a5c05;
  --arg: #8b9199;   --arg-bg: #eceef1;  --arg-ink: #4c525a;
  --brz: #b5793f;   --brz-bg: #f3e3d3;  --brz-ink: #7c4a1e;
  --up: #2f8f5b;    --down: #c2543f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ── EN-TÊTE ── */
.entete {
  max-width: 940px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 3.2rem) 1.5rem 1rem;
  text-align: center;
}
.eyebrow {
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.8rem;
}
.entete h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.03;
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--brand);
}
.accroche {
  max-width: 660px;
  margin: 1.1rem auto 0;
  font-size: 0.96rem;
  line-height: 1.72;
  color: #4a443b;
}
.accroche em { font-style: italic; color: var(--brand); }
.filet {
  width: 74px; height: 2px; margin: 1.6rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ── SCÈNE ── */
.scene {
  max-width: 940px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 4rem;
}

/* ── PANNEAUX ── */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.4rem;
  margin: 0 0 1.15rem;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 0 0 1rem;
}
.panel-num {
  flex: none;
  width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 0.9rem; font-weight: 500;
  font-family: 'Cormorant Garamond', serif;
}
.panel-head h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--brand);
}
.panel-aside {
  margin-left: auto;
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}

/* ── LIGNE ÉDITION ── */
.edition-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem;
}
.field { display: flex; flex-direction: column; gap: 0.32rem; min-width: 0; }
.field.grow { flex: 1 1 240px; }
.field-lab {
  font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
select, .custom-add input {
  font-family: 'Montserrat', sans-serif; font-size: 0.9rem;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 0.7rem;
  width: 100%;
}
select:focus, input:focus { outline: 2px solid rgba(43,58,85,0.35); outline-offset: 1px; }

/* Contrôle segmenté (saison) */
.seg {
  display: inline-flex; background: var(--paper-dark);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-size: 0.8rem; color: var(--muted);
  padding: 0.45rem 0.8rem; border-radius: 7px; transition: all 0.15s;
}
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-weight: 500; }

/* Boutons */
.btn-ghost, .btn-solid {
  font-family: 'Montserrat', sans-serif; cursor: pointer;
  border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.82rem;
  transition: all 0.15s; white-space: nowrap;
}
.btn-ghost {
  background: #fff; color: var(--brand);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost.small, .btn-solid.small { padding: 0.42rem 0.7rem; font-size: 0.76rem; }
.btn-ghost.danger { color: var(--down); }
.btn-ghost.danger:hover { border-color: var(--down); color: var(--down); }
.btn-solid {
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
}
.btn-solid:hover { background: #1f2c43; }

/* Méta édition */
.edition-meta {
  margin: 0.95rem 0 0; font-size: 0.85rem; color: #4a443b; line-height: 1.6;
}
.edition-meta .em-city { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; color: var(--brand); font-weight: 600; }
.edition-meta .chip {
  display: inline-block; margin-left: 0.4rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--paper-dark); color: var(--muted); vertical-align: middle;
}
.edition-meta .chip.warn { background: #f6e2d8; color: #9a4a2c; }

/* ── ÉDITEUR PERSONNALISÉ ── */
.hint { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--muted); line-height: 1.6; }
.custom-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin-bottom: 0.9rem; }
.custom-tools .field { flex: 1 1 200px; }
.custom-add {
  display: grid; grid-template-columns: 1fr 3.4rem 3.4rem 3.4rem auto; gap: 0.5rem; margin-bottom: 0.9rem;
}
.custom-add input[type=number] { text-align: center; padding: 0.6rem 0.3rem; -moz-appearance: textfield; }
.custom-add input::-webkit-outer-spin-button, .custom-add input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.custom-list { display: flex; flex-direction: column; gap: 0.35rem; }
.crow {
  display: grid; grid-template-columns: 1.6rem 1fr 3.2rem 3.2rem 3.2rem 1.9rem; gap: 0.5rem; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 0.35rem 0.5rem;
}
.crow .cr-flag { text-align: center; }
.crow .cr-name { font-size: 0.88rem; }
.crow input { border: 1px solid var(--line); border-radius: 7px; padding: 0.35rem; text-align: center; font-size: 0.85rem; width: 100%; background:#fff; -moz-appearance: textfield; }
.crow input::-webkit-outer-spin-button, .crow input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.crow .cr-g { color: var(--or-ink); }
.crow .cr-s { color: var(--arg-ink); }
.crow .cr-b { color: var(--brz-ink); }
.cr-del { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0.2rem; border-radius: 6px; }
.cr-del:hover { color: var(--down); background: #f6e2d8; }
.custom-empty { font-size: 0.85rem; color: var(--muted); font-style: italic; padding: 0.5rem 0; }

/* ── PRÉRÉGLAGES ── */
.presets { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.15rem; }
.presets button {
  font-family: 'Montserrat', sans-serif; cursor: pointer; font-size: 0.8rem;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.45rem 0.95rem; transition: all 0.15s;
}
.presets button:hover { border-color: var(--gold); }
.presets button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── CURSEURS ── */
.sliders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.slider-top { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.5rem; }
.medal-dot { font-size: 1.05rem; }
.slider-name { font-size: 0.82rem; color: var(--ink); font-weight: 500; }
.slider-top output {
  margin-left: auto; font-variant-numeric: tabular-nums;
  font-size: 0.95rem; font-weight: 600; color: var(--brand);
  min-width: 2.4ch; text-align: right;
}
.slider input[type=range] {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--paper-dark); border-radius: 999px; cursor: pointer; margin: 0.35rem 0;
}
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.slider input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.s-gold   input[type=range] { accent-color: var(--or); }
.s-silver input[type=range] { accent-color: var(--arg); }
.s-bronze input[type=range] { accent-color: var(--brz); }
.s-gold   input[type=range]::-webkit-slider-thumb { background: var(--or); }
.s-silver input[type=range]::-webkit-slider-thumb { background: var(--arg); }
.s-bronze input[type=range]::-webkit-slider-thumb { background: var(--brz); }
.s-gold   input[type=range]::-moz-range-thumb { background: var(--or); }
.s-silver input[type=range]::-moz-range-thumb { background: var(--arg); }
.s-bronze input[type=range]::-moz-range-thumb { background: var(--brz); }
.slider.dim { opacity: 0.5; }

.ratio-line { margin: 1.15rem 0 0; font-size: 0.82rem; color: var(--muted); text-align: center; }
.ratio-line b { color: var(--brand); font-weight: 600; }

/* ── OPTIMISEUR ── */
.optimizer {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(180deg, #fffef9, #fdf7e8);
  border: 1px solid var(--gold); border-radius: 14px;
  padding: 0.95rem 1.15rem; margin: 0 0 1.1rem;
  box-shadow: var(--shadow);
}
.opt-body { display: flex; align-items: center; gap: 0.85rem; flex: 1 1 320px; }
.opt-flag { font-size: 1.9rem; line-height: 1; flex: none; }
.opt-text { font-size: 0.9rem; line-height: 1.55; color: #4a443b; }
.opt-text b { color: var(--brand); }
.opt-text .opt-rank { font-family: 'Cormorant Garamond', serif; font-weight: 600; color: var(--brand); }
.opt-text .opt-coef { white-space: nowrap; font-variant-numeric: tabular-nums; }
.opt-actions { display: flex; gap: 0.5rem; margin-left: auto; }

.table-hint { text-align: center; font-size: 0.8rem; color: var(--muted); margin: 0 0 0.6rem; font-style: italic; }

/* ── TABLEAU ── */
.table-wrap {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden; overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 540px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--brand); color: #fff;
  font-weight: 500; font-size: 0.72rem; letter-spacing: 0.04em;
  padding: 0.7rem 0.5rem; text-align: center;
}
thead th.c-country { text-align: left; padding-left: 1rem; }
tbody td { padding: 0.6rem 0.5rem; text-align: center; border-top: 1px solid rgba(184,154,90,0.14); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; transition: background 0.12s; }
tbody tr:hover { background: #fbf6ea; }
tbody tr.sel { background: #fdf1d5; }
tbody tr.sel:hover { background: #fbecc7; }

.c-rank { width: 3rem; }
td.c-rank { font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; font-weight: 600; color: var(--brand); }
tr.podium-1 td.c-rank { color: var(--or-ink); }
tr.podium-2 td.c-rank { color: var(--arg-ink); }
tr.podium-3 td.c-rank { color: var(--brz-ink); }

.c-delta { width: 2.6rem; }
td.c-delta { font-size: 0.78rem; font-weight: 600; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }
.delta-flat { color: #c3bcae; }

.c-country { text-align: left; }
td.c-country { text-align: left; padding-left: 1rem; }
.country-cell { display: flex; align-items: center; gap: 0.55rem; }
.flag { font-size: 1.15rem; line-height: 1; flex: none; width: 1.5rem; text-align: center; }
.flag.noflag { font-size: 0.95rem; color: var(--muted); }
.cname { font-weight: 400; }
.host-badge { font-size: 0.6rem; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; background: var(--gold); border-radius: 4px; padding: 0.05rem 0.32rem; margin-left: 0.15rem; }

td.c-g { color: var(--or-ink); background: rgba(201,162,39,0.07); font-weight: 500; }
td.c-s { color: var(--arg-ink); background: rgba(139,145,153,0.09); font-weight: 500; }
td.c-b { color: var(--brz-ink); background: rgba(181,121,63,0.08); font-weight: 500; }
td.c-total { font-weight: 600; color: var(--ink); }
td.c-points { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
tbody tr.zero td { color: #b8b0a0; }

.empty { padding: 2rem; text-align: center; color: var(--muted); font-style: italic; }

/* ── NOTE / SOURCES ── */
.note { margin: 2rem 0 0; padding: 1.4rem 0 0; border-top: 1px solid var(--line); }
.note h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; color: var(--brand); font-weight: 600; margin: 0 0 0.7rem; }
.note p { font-size: 0.86rem; line-height: 1.72; color: #4a443b; margin: 0 0 0.7rem; }
.note b { font-weight: 600; color: var(--ink); }
.note em { font-style: italic; color: var(--brand); }
.note .sources { font-size: 0.78rem; color: var(--muted); }
.note a { color: var(--brand); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.note a:hover { color: var(--gold); }

/* ── RESPONSIVE ── */
@media (max-width: 620px) {
  .sliders { grid-template-columns: 1fr; gap: 0.85rem; }
  .edition-row { flex-direction: column; align-items: stretch; }
  .seg { align-self: flex-start; }
  .custom-add { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .custom-add > input:first-child { grid-column: 1 / -1; }
  .custom-add > button { grid-column: 1 / -1; }
  .opt-actions { margin-left: 0; }
  thead th { font-size: 0.66rem; }
  .entete { padding-top: calc(var(--nav-h) + 2rem); }
}
