/* Capacité nucléaire française — feuille de style
   Charte du site (Cormorant Garamond + Montserrat, papier / or / bleu).
   Les variables :root sont exposées pour /assets/site.css (nav + footer). */

:root {
  --ink: #1a1814;
  --paper: #f2f5fa;
  --paper-dark: #e6ecf6;
  --brand: #1d3a5f;
  --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);
  --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) + 3rem) 1.5rem 0.6rem;
  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.2rem, 5.4vw, 3.7rem); line-height: 1.04;
  margin: 0; letter-spacing: 0.01em; color: var(--brand);
}
.accroche {
  max-width: 680px; margin: 1rem auto 0;
  font-size: 0.95rem; line-height: 1.7; color: #4a443b;
}
.accroche em { font-style: italic; color: var(--brand); }
.filet { width: 74px; height: 2px; margin: 1.4rem auto 0; background: var(--gold); }

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

/* Deux colonnes sur ordinateur : graphe à gauche (collant), options à droite. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 432px; gap: 1.15rem; align-items: start; }
.col-chart { position: sticky; top: calc(var(--nav-h) + 8px); min-width: 0; }
.col-opts { min-width: 0; }
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .col-chart { position: static; }
}

/* ── PANNEAUX (repliables) ── */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; margin: 0 0 0.9rem; box-shadow: var(--shadow); overflow: hidden;
}
.panel-toggle {
  width: 100%; display: flex; align-items: center; gap: 0.7rem;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: 'Montserrat', sans-serif; padding: 1rem 1.25rem;
}
.panel-toggle:hover h2 { color: var(--gold); }
.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-toggle h2 {
  margin: 0; font-family: 'Cormorant Garamond', serif; font-weight: 600;
  font-size: 1.42rem; color: var(--brand); transition: color 0.15s;
}
.panel-toggle:hover { background: rgba(184,154,90,0.06); }
.pcaret {
  margin-left: auto; flex: none; width: 1.85rem; height: 1.85rem;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-dark);
  color: var(--brand); font-size: 0.8rem; line-height: 1;
  transition: transform 0.22s, background 0.15s, border-color 0.15s, color 0.15s;
}
.panel-toggle:hover .pcaret { border-color: var(--gold); color: var(--gold); background: #fff; }
.panel:not(.open) .pcaret { transform: rotate(-90deg); }
.panel-body { padding: 0 1.25rem 1.3rem; }
.panel:not(.open) .panel-body { display: none; }
.panel-sub { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--muted); line-height: 1.6; }

/* ═══════════════ GRAPHE (carte collante) ═══════════════ */
.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 0.9rem 0.9rem 0.7rem; margin: 0;
}
.chart-topbar {
  display: flex; align-items: center; gap: 0.6rem 1rem; flex-wrap: wrap;
  margin: 0 0 0.5rem; padding: 0 0.2rem;
}
.chart-title { font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; color: var(--brand); font-weight: 600; margin: 0; }
.seg {
  display: inline-flex; background: var(--paper-dark);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-left: auto;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-size: 0.76rem; color: var(--muted);
  padding: 0.4rem 0.7rem; border-radius: 7px; transition: all 0.15s; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-weight: 500; }

.chart-wrap { position: relative; width: 100%; }
#chart { display: block; width: 100%; height: auto; touch-action: none; }
#chart .grid { stroke: rgba(122,112,96,0.16); stroke-width: 1; }
#chart .axis { stroke: rgba(122,112,96,0.5); stroke-width: 1; }
#chart .tick-txt { fill: var(--muted); font: 400 11px 'Montserrat', sans-serif; }
#chart .axis-lab { fill: var(--muted); font: 500 11px 'Montserrat', sans-serif; letter-spacing: 0.06em; }
#chart .now-line { stroke: var(--brand); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.55; }
#chart .now-txt { fill: var(--brand); font: 600 10.5px 'Montserrat', sans-serif; }
#chart .total-line { fill: none; stroke: #24324a; stroke-width: 2; }
#chart .area { stroke: #fff; stroke-width: 0.6; transition: opacity 0.15s; }
#chart .guide { stroke: var(--brand); stroke-width: 1; opacity: 0.45; }
#chart .gdot { stroke: #fff; stroke-width: 1.4; }

/* Bulle survol */
.tip {
  position: absolute; pointer-events: none; z-index: 10;
  background: #fffefaee; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(26,24,20,0.16); padding: 0.55rem 0.7rem;
  font-size: 0.76rem; color: var(--ink); min-width: 168px; max-width: 260px;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s;
  backdrop-filter: blur(2px);
}
.tip.on { opacity: 1; transform: translateY(0); }
.tip-year { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 600; color: var(--brand); }
.tip-tot { font-weight: 600; margin: 0.1rem 0 0.4rem; }
.tip-tot b { color: var(--brand); font-variant-numeric: tabular-nums; }
.tip-row { display: flex; align-items: center; gap: 0.4rem; line-height: 1.55; }
.tip-row .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip-row .nm { flex: 1 1 auto; color: #4a443b; }
.tip-row .vl { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.tip-empty { color: var(--muted); font-style: italic; }

/* Bandeau de chiffres-clés */
.kpis { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0.1rem 0.15rem; }
.kpi {
  flex: 1 1 120px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 11px; padding: 0.5rem 0.7rem; text-align: center;
}
.kpi .k-lab { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kpi .k-val { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; font-weight: 600; color: var(--brand); line-height: 1.15; }
.kpi .k-val small { font-size: 0.72rem; font-family: 'Montserrat', sans-serif; color: var(--muted); font-weight: 400; }
.kpi .k-sub { font-size: 0.66rem; color: var(--muted); }

/* Légende (paliers cliquables) */
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.55rem; margin: 0.55rem 0.1rem 0.15rem; }
.leg {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.25rem 0.62rem; font-size: 0.72rem; color: var(--ink); transition: all 0.15s;
  user-select: none;
}
.leg:hover { border-color: var(--gold); }
.leg .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.leg .lg-mw { color: var(--muted); font-size: 0.66rem; }
.leg.off { opacity: 0.42; }
.leg.off .sw { background: #c9c3b6 !important; }

/* ═══════════════ CONTRÔLES ═══════════════ */
/* Scénarios types */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(198px, 1fr)); gap: 0.65rem; }
.scn {
  text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--line);
  border-radius: 13px; padding: 0.75rem 0.85rem; transition: all 0.15s; font-family: 'Montserrat', sans-serif;
}
.scn:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26,24,20,0.07); }
.scn.on { border-color: var(--brand); background: #f4f8fd; box-shadow: inset 0 0 0 1px var(--brand); }
.scn .scn-ic { font-size: 1.3rem; }
.scn .scn-nm { display: block; font-weight: 600; color: var(--brand); font-size: 0.92rem; margin: 0.2rem 0 0.15rem; }
.scn .scn-dc { display: block; font-size: 0.74rem; color: var(--muted); line-height: 1.5; font-weight: 300; }

/* Groupes de boutons-pastilles */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.pill-row + .pill-row { margin-top: 0.7rem; }
.pill-lab { font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-right: 0.15rem; min-width: 92px; }
.pill {
  font-family: 'Montserrat', sans-serif; cursor: pointer; font-size: 0.78rem;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.42rem 0.85rem; transition: all 0.15s;
}
.pill:hover { border-color: var(--gold); }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill:disabled { opacity: 0.34; cursor: not-allowed; border-style: dashed; }
.pill:disabled:hover { border-color: var(--line); }

/* Prolongation par palier */
.palier-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.palier-row {
  display: grid; grid-template-columns: 1.1fr auto; align-items: center; gap: 0.6rem 0.9rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 0.5rem 0.7rem;
}
.palier-id { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.palier-id .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.palier-id .p-nm { font-weight: 500; color: var(--ink); font-size: 0.9rem; }
.palier-id .p-meta { font-size: 0.68rem; color: var(--muted); }
.palier-id .p-nm small { color: var(--muted); font-weight: 300; }
.life-seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 2px; flex: none; }
.life-seg button {
  border: 0; background: transparent; cursor: pointer; font-family: 'Montserrat', sans-serif;
  font-size: 0.76rem; color: var(--muted); padding: 0.32rem 0.5rem; border-radius: 6px; transition: all 0.12s;
  min-width: 2.1rem;
}
.life-seg button.on { background: var(--brand); color: #fff; font-weight: 500; }
.life-seg button:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }
.life-seg button.mixed { background: repeating-linear-gradient(45deg,#eef2f7,#eef2f7 4px,#dfe6ef 4px,#dfe6ef 8px); color: var(--brand); }

/* EPR2 */
.epr2-box { display: flex; flex-direction: column; gap: 0.9rem; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.toggle {
  display: flex; align-items: center; gap: 0.6rem; cursor: pointer; flex: 1 1 240px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.8rem;
  transition: all 0.15s;
}
.toggle:hover { border-color: var(--gold); }
.toggle.on { background: #f4f8fd; border-color: var(--brand); }
.toggle .tg-sw {
  width: 42px; height: 24px; border-radius: 999px; background: #cfd6df; position: relative;
  flex: none; transition: background 0.18s;
}
.toggle .tg-sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s;
}
.toggle.on .tg-sw { background: var(--brand); }
.toggle.on .tg-sw::after { transform: translateX(18px); }
.toggle .tg-txt { min-width: 0; }
.toggle .tg-nm { font-weight: 600; color: var(--brand); font-size: 0.88rem; display: flex; align-items: center; gap: 0.4rem; }
.toggle .tg-nm .sw { width: 11px; height: 11px; border-radius: 3px; }
.toggle .tg-dc { font-size: 0.73rem; color: var(--muted); line-height: 1.45; }

.delay-box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.9rem; }
.delay-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.delay-top .d-nm { font-weight: 500; font-size: 0.86rem; color: var(--ink); }
.delay-top output { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand); font-size: 0.95rem; }
input[type=range].slider-in {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--paper-dark); border-radius: 999px; cursor: pointer; margin: 0.3rem 0; accent-color: var(--brand);
}
input[type=range].slider-in::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
input[type=range].slider-in::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; cursor: pointer;
}
.delay-scale { display: flex; justify-content: space-between; font-size: 0.64rem; color: var(--muted); }

/* Bouton « Ajouter un EPR2 » */
#add-epr { align-self: flex-start; }

/* Stepper « tranches supplémentaires » */
.epr-stepper { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.epr-step-lab { flex: 1 1 100%; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.epr-stepper .mini-num { width: 3.8rem; }

/* Scénarios enregistrés + bloc d'action */
.scn-actions { margin-top: 0.85rem; }
.scn-login { font-size: 0.8rem; color: var(--muted); margin: 0; line-height: 1.5; }
.scn-login a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.scn-login a:hover { color: var(--gold); }
.scn-saved { position: relative; padding: 0; }
.scn-saved.on { border-color: var(--brand); background: #f4f8fd; box-shadow: inset 0 0 0 1px var(--brand); }
.scn-saved .scn-main {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 0.75rem 2rem 0.75rem 0.85rem; font-family: 'Montserrat', sans-serif;
}
.scn-del {
  position: absolute; top: 0.45rem; right: 0.45rem; width: 1.5rem; height: 1.5rem; line-height: 1;
  border: 0; border-radius: 6px; background: rgba(26,24,20,0.05); color: var(--muted);
  cursor: pointer; font-size: 0.82rem;
}
.scn-del:hover { color: var(--down); background: #f6e2d8; }

/* ── Réglage fin (réacteur par réacteur) ── */
.fine-group { margin: 0 0 0.55rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fine-group:last-child { margin-bottom: 0; }
.fine-gh {
  width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem;
  background: var(--paper); border: 0; cursor: pointer; text-align: left;
  font-family: 'Montserrat', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--brand);
}
.fine-gh:hover { background: var(--paper-dark); }
.fine-gh .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.fine-gh .fg-nm { flex: none; }
.fine-gh .fg-meta { font-weight: 300; color: var(--muted); font-size: 0.72rem; }
.fine-gh .fg-caret { margin-left: auto; color: var(--gold); font-size: 0.72rem; transition: transform 0.2s; }
.fine-group:not(.open) .fine-gh .fg-caret { transform: rotate(-90deg); }
.fine-group:not(.open) .rtable { display: none; }
.fine-group .rtable { padding: 0.5rem; }
.rtable { display: flex; flex-direction: column; gap: 0.35rem; }
.rrow {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem;
  padding: 0.42rem 0.6rem; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.rrow.hist { background: #f4f2ec; }
.rrow.off { opacity: 0.55; }
.rrow .r-nm { flex: 1 1 55%; font-size: 0.83rem; color: var(--ink); }
.rrow .r-nm small { color: var(--muted); }
.rrow .r-info { flex: 0 1 auto; margin-left: auto; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.rrow .r-ctrl { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.2rem; }
.rrow .r-lab { font-size: 0.66rem; color: var(--muted); }
.mini-num {
  width: 4.4rem; border: 1px solid var(--line); border-radius: 7px; padding: 0.3rem 0.4rem;
  text-align: center; font-size: 0.82rem; font-family: 'Montserrat', sans-serif; background: #fff;
  -moz-appearance: textfield;
}
.mini-num::-webkit-outer-spin-button, .mini-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mini-num:focus { outline: 2px solid rgba(29,58,95,0.35); outline-offset: 1px; }
.r-built { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; flex: none; }
.r-del {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.95rem;
  line-height: 1; padding: 0.2rem 0.35rem; border-radius: 6px; margin-left: auto;
}
.r-del:hover { color: var(--down); background: #f6e2d8; }
.hist-tag {
  font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; color: #fff;
  background: #8a8175; border-radius: 4px; padding: 0.05rem 0.35rem;
}
.life-seg.mini button { min-width: 1.85rem; padding: 0.26rem 0.4rem; font-size: 0.72rem; }

.btn-ghost {
  font-family: 'Montserrat', sans-serif; cursor: pointer; border-radius: 10px;
  padding: 0.5rem 0.85rem; font-size: 0.8rem; transition: all 0.15s;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost.small { padding: 0.38rem 0.68rem; font-size: 0.75rem; }

/* ── NOTE / SOURCES ── */
.note { max-width: 900px; margin: 2.4rem auto 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 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: 720px) {
  .palier-row { grid-template-columns: 1fr; }
  .life-seg { justify-self: start; }
  .seg { margin-left: 0; }
  .chart-topbar { gap: 0.5rem; }
}
@media (max-width: 520px) {
  .kpi { flex: 1 1 44%; }
  .pill-lab { min-width: 100%; margin-bottom: -0.2rem; }
  .life-seg button { min-width: 1.9rem; padding: 0.3rem 0.35rem; }
  .rrow .r-nm { flex: 1 1 100%; }
  .rrow .r-info { margin-left: 0; text-align: left; }
}
