/* Direction artistique « l'Ananas » : nuit bleu marine, papier crème grainé, jaune ananas, bleu électrique,
   orange et rose. Titres en serif épais, accents manuscrits, bords de papier déchiré, notes adhésives.
   Polices servies en local (voir fonts/LICENSE.txt). Thème clair (papier) / sombre (nuit). */
@font-face { font-family: Fraunces; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/fraunces-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Fraunces; font-weight: 900; font-style: normal; font-display: swap; src: url(fonts/fraunces-latin-900-normal.woff2) format("woff2"); }
@font-face { font-family: Fraunces; font-weight: 900; font-style: italic; font-display: swap; src: url(fonts/fraunces-latin-900-italic.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-weight: 400; font-display: swap; src: url(fonts/figtree-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-weight: 600; font-display: swap; src: url(fonts/figtree-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Figtree; font-weight: 700; font-display: swap; src: url(fonts/figtree-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Caveat; font-weight: 600; font-display: swap; src: url(fonts/caveat-latin-600-normal.woff2) format("woff2"); }

:root {
  --serif: Fraunces, "Iowan Old Style", Georgia, serif;
  --sans: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: Caveat, "Segoe Print", cursive;

  --navy: #1a1b5e; --navy-deep: #12134a; --yellow: #f9c440; --blue: #3f5bde; --orange: #f28c3c; --pink: #e88daa;
  --edge: #4a6cf0;

  --bg: #ebe6da; --surface: #f7f3e8; --surface-2: #e3ddcd; --text: #161745; --muted: #4c4e7a; --border: #d5cebb;
  --accent: var(--yellow); --accent-ink: #161745; --accent-text: #b8400c; --hand-ink: #3f5bde;
  --focus: #3f5bde; --bad: #b3261e; --good: #17734a; --warn-bg: #fbe7a8;
  --c1: #c2410c; --c2: #3f5bde; --c3: #0f7f70; --c4: #c7457c; --c5: #62648a;
  --shadow: 0 6px 16px rgb(26 27 94 / 12%), 0 1px 2px rgb(26 27 94 / 10%);
  --grain-opacity: .22; --grain-blend: multiply;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12134a; --surface: #1e2068; --surface-2: #272a7c; --text: #f5f0e1; --muted: #b3b6e6; --border: #34378a;
    --accent-text: #f9c440; --hand-ink: #9db0ff; --focus: #9db0ff; --bad: #ff9a90; --good: #7fdcaa; --warn-bg: #4a3d00;
    --c1: #f9c440; --c2: #8ba3ff; --c3: #4fd1bd; --c4: #f29bbe; --c5: #b3b6e6;
    --shadow: 0 6px 16px rgb(0 0 0 / 30%); --grain-opacity: .35; --grain-blend: screen;
  }
}
:root[data-theme="dark"] {
  --bg: #12134a; --surface: #1e2068; --surface-2: #272a7c; --text: #f5f0e1; --muted: #b3b6e6; --border: #34378a;
  --accent-text: #f9c440; --hand-ink: #9db0ff; --focus: #9db0ff; --bad: #ff9a90; --good: #7fdcaa; --warn-bg: #4a3d00;
  --c1: #f9c440; --c2: #8ba3ff; --c3: #4fd1bd; --c4: #f29bbe; --c5: #b3b6e6;
  --shadow: 0 6px 16px rgb(0 0 0 / 30%); --grain-opacity: .35; --grain-blend: screen;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); position: relative; min-height: 100vh; }
/* grain de papier, purement décoratif */
body::before { content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; background: url(grain.svg); opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: var(--navy); padding: 8px 12px; z-index: 60; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }

.demo-banner { background: var(--orange); color: #161745; text-align: center; padding: 6px 12px; font-weight: 700; font-size: 13px; letter-spacing: .03em; position: relative; z-index: 2; }

/* --- En-tête nuit + hero ---------------------------------------------------------- */
.hero-wrap { position: relative; color: #f5f0e1; background:
  radial-gradient(60% 90% at 85% 10%, rgb(74 108 240 / 38%) 0%, transparent 70%),
  radial-gradient(50% 80% at 8% 100%, rgb(63 91 222 / 30%) 0%, transparent 70%), var(--navy); }
.hero-wrap::before, .hero-wrap::after { content: ""; position: absolute; left: 0; right: 0; height: 24px; -webkit-mask: url(torn.svg) repeat-x bottom / 1200px 24px; mask: url(torn.svg) repeat-x bottom / 1200px 24px; }
.hero-wrap::before { bottom: -8px; background: var(--edge); }
.hero-wrap::after { bottom: -13px; background: var(--bg); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px 28px; max-width: 1280px; margin: 0 auto; }
.brand { display: flex; align-items: baseline; gap: 10px; font-family: var(--serif); font-weight: 900; font-size: 26px; color: var(--yellow); letter-spacing: -.01em; }
.brand small { font: 600 20px var(--hand); color: #9db0ff; letter-spacing: 0; white-space: nowrap; }
@media (max-width: 1340px) { .brand small { display: none; } }
.spark { color: var(--yellow); font-size: 18px; align-self: center; }
#nav { display: flex; flex-wrap: wrap; gap: 2px 2px; flex: 1 1 auto; justify-content: center; }
#nav a { color: #f5f0e1; text-decoration: none; white-space: nowrap; padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 15px; }
#nav a:hover { background: rgb(255 255 255 / 12%); }
#nav a[aria-current="page"] { background: var(--yellow); color: var(--navy); box-shadow: 0 3px 0 #e8892b; }
.top :focus-visible, .hero-wrap :focus-visible { outline-color: var(--yellow); }
.tools { display: flex; align-items: center; gap: 8px; }
.who { font-size: 14px; font-weight: 600; color: #cfd3ff; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn { font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; background: transparent; color: var(--text); border: 1.5px solid var(--border); border-radius: 99px; padding: 5px 14px; }
.btn:hover { background: var(--surface-2); }
.btn[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.top .btn { color: #f5f0e1; border-color: rgb(245 240 225 / 45%); }
.top .btn:hover { background: rgb(255 255 255 / 12%); }

.page-hero { max-width: 1280px; margin: 0 auto; padding: 22px 28px 64px; position: relative; }
.page-hero .kicker { font: 600 24px/1.1 var(--hand); color: #9db0ff; margin: 0; }
.page-hero h1 { font: 900 clamp(34px, 5.2vw, 58px)/1.05 var(--serif); letter-spacing: -.015em; margin: 4px 0 10px; color: #f5f0e1; }
.page-hero h1 .accent { color: var(--yellow); background: linear-gradient(transparent 88%, var(--yellow) 88% 93%, transparent 93%); }
.page-hero .sub { color: #cfd3ff; max-width: 70ch; margin: 0; border-left: 3px solid rgb(249 196 64 / 70%); padding-left: 14px; }
.page-hero .sub:empty { display: none; }

main { max-width: 1280px; margin: 0 auto; padding: 36px 28px 40px; outline: none; }
h2 { font: 900 clamp(24px, 3vw, 32px)/1.15 var(--serif); margin: 44px 0 14px; letter-spacing: -.01em; }
h2::first-line { color: inherit; }
h3 { font: 700 18px/1.25 var(--serif); margin: 0; }
.sub { color: var(--muted); }
.loading, .empty { color: var(--muted); font-style: italic; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; position: relative; }

/* notes adhésives : les chiffres clés sont posés avec un morceau de ruban */
.kpi { padding-top: 22px; }
.kpi::before { content: ""; position: absolute; top: -9px; left: 22px; width: 72px; height: 20px; background: var(--yellow); opacity: .92; transform: rotate(-2.5deg); border-radius: 2px; box-shadow: 0 1px 2px rgb(0 0 0 / 15%); }
.kpi:nth-child(3n+2)::before { background: var(--orange); transform: rotate(1.8deg); left: 38px; }
.kpi:nth-child(3n)::before { background: var(--pink); transform: rotate(-1deg); left: 28px; }
@media (prefers-reduced-motion: no-preference) { .kpi { transition: transform .2s; } .kpi:hover { transform: rotate(-.6deg) translateY(-2px); } }
.kpi .label { color: var(--muted); font-size: 14px; font-weight: 600; }
.kpi .value { font: 900 36px/1.15 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.kpi .detail { color: var(--muted); font-size: 13.5px; }
.trend-up::before, .trend-down::before, .trend-flat::before { position: static; display: inline; background: none; box-shadow: none; transform: none; opacity: 1; width: auto; height: auto; }
.trend-up::before { content: "▲ "; color: var(--good); } .trend-down::before { content: "▼ "; color: var(--bad); } .trend-flat::before { content: "■ "; color: var(--muted); }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.chart-head .note { color: var(--muted); font-size: 13.5px; margin: 3px 0 0; }
.chart-body { min-height: 60px; }
.chart-body svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; margin: 0 0 6px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend svg { width: 28px; height: 12px; }

svg text { fill: var(--muted); font: 11.5px var(--sans); }
svg .grid-line { stroke: var(--border); stroke-width: 1; }
svg .axis-line { stroke: var(--muted); stroke-width: 1; }
svg .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg .hit { fill: transparent; }
svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.s1 { --s: var(--c1); } .s2 { --s: var(--c2); } .s3 { --s: var(--c3); } .s4 { --s: var(--c4); } .s5 { --s: var(--c5); }
svg .line { fill: none; stroke: var(--s); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg .fill { fill: var(--s); }
svg .band { fill: var(--c2); fill-opacity: .18; }
svg .marker { fill: var(--surface); stroke: var(--s); stroke-width: 2; }
svg .heat { fill: var(--c2); }

.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--navy); color: #f5f0e1; border: 1px solid #4a6cf0; border-radius: 10px; padding: 7px 11px; font-size: 13px; max-width: 290px; box-shadow: 0 6px 18px rgb(0 0 0 / 30%); }
.tip b { display: block; margin-bottom: 2px; font-family: var(--serif); color: var(--yellow); }
.tip .row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; }
.table-wrap { max-height: 380px; overflow: auto; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { background: var(--surface-2); border-radius: 99px; height: 14px; overflow: hidden; }
.bars .fillbar { display: block; height: 100%; background: var(--yellow); border-radius: 99px; box-shadow: inset 0 -3px 0 rgb(232 137 43 / 55%); }
.bars .val { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; min-width: 70px; }

.alert { border-left: 6px solid var(--orange); background: var(--warn-bg); padding: 11px 16px; border-radius: 10px; margin: 0 0 14px; }
.alert::before { content: "⚠ "; font-weight: 800; }
.status { display: inline-flex; align-items: center; gap: 8px; font: 900 22px var(--serif); }
.status.up { color: var(--good); } .status.down { color: var(--bad); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 700; }
a { color: var(--focus); }
.login { max-width: 480px; margin: 20px auto; text-align: center; padding: 28px 24px; }
.login h1 { font: 900 32px var(--serif); margin: 0 0 6px; }
.btn-primary { display: inline-block; margin-top: 14px; padding: 11px 22px; background: var(--yellow); color: var(--navy); font-weight: 700; border-radius: 99px; text-decoration: none; box-shadow: 0 4px 0 #e8892b; }
.btn-primary:hover { transform: translateY(1px); box-shadow: 0 3px 0 #e8892b; }

/* bandeau « urgence » en pied de page, comme sur le site */
.foot { background: var(--yellow); color: var(--navy); margin-top: 24px; }
.foot-in { max-width: 1280px; margin: 0 auto; padding: 22px 28px; display: grid; grid-template-columns: auto 1fr; gap: 6px 28px; align-items: center; }
.foot .hand { font: 600 22px var(--hand); margin: 0; }
.foot strong.big { font: 900 26px var(--serif); }
.foot p { margin: 0; }

@media (max-width: 720px) {
  .top { padding: 12px 14px; } #nav { justify-content: flex-start; }
  .page-hero { padding: 16px 16px 52px; } main { padding: 28px 14px 30px; }
  .bars li { grid-template-columns: 1fr auto; } .bars .track { grid-column: 1 / -1; grid-row: 2; }
  .foot-in { grid-template-columns: 1fr; padding: 18px 16px; }
}
