/* style.css — système visuel commun à l'accueil, au compte et au détail d'un site.
   Idée centrale : la couleur de la page suit l'état du site (vert = tout va bien, ambre = à surveiller,
   rouge = problème, bleu-vert foncé = pas encore d'information). Tout le reste reste calme et neutre. */

:root {
  --brume: #f2f6f5;          /* fond de page */
  --papier: #ffffff;         /* surfaces */
  --encre: #10272c;          /* texte */
  --maree: #0b3a45;          /* marque, boutons */
  --maree-fonce: #082a33;
  --muted: #566f74;          /* texte secondaire (contraste 5:1 sur fond clair) */
  --trait: #d3dfdd;          /* filets */
  --ok: #0b7a5d;      --ok-tint: #d9f2e8;
  --warn: #e2a400;    --warn-tint: #fff0c6;  --warn-ink: #7a5600;
  --down: #c42b33;    --down-tint: #fbe1e2;
  --idle: #0b3a45;    --idle-tint: #e3eeef;

  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* État courant : posé sur <body data-state="..."> ou sur n'importe quel bloc */
[data-state="ok"]   { --st: var(--ok);   --st-fg: #fff;          --st-tint: var(--ok-tint); }
[data-state="warn"] { --st: var(--warn); --st-fg: var(--encre);  --st-tint: var(--warn-tint); }
[data-state="down"] { --st: var(--down); --st-fg: #fff;          --st-tint: var(--down-tint); }
[data-state="idle"] { --st: var(--idle); --st-fg: #fff;          --st-tint: var(--idle-tint); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--brume); color: var(--encre);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; letter-spacing: -0.015em; font-weight: 700; }
p { margin: 0; }
a { color: var(--maree); }
:focus-visible { outline: 3px solid #2a8fa6; outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 680px; }
[hidden] { display: none !important; }

/* ---------- Barre du haut ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.logo svg { width: 30px; height: 20px; }
.bar-right { display: flex; align-items: center; gap: 18px; font-size: 14px; }

/* ---------- Boutons et liens ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--maree);
  background: var(--maree); color: #fff; font: 700 15px/1 var(--font-body); padding: 13px 22px; border-radius: 10px;
  cursor: pointer; text-decoration: none; transition: background-color .15s, transform .1s; }
.btn:hover { background: var(--maree-fonce); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--maree); }
.btn.ghost:hover { background: rgba(11,58,69,.08); }
.btn.on-state { background: var(--st-fg); color: var(--st); border-color: var(--st-fg); }
.btn.on-state:hover { opacity: .92; }
.btn.block { width: 100%; }
.btn.small { padding: 9px 14px; font-size: 14px; }
.linkbtn { background: none; border: none; padding: 0; font: 700 14px var(--font-body); color: var(--maree); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.danger { color: var(--down); }

/* ---------- Formulaires ---------- */
label.field { display: block; font-weight: 700; font-size: 15px; margin: 20px 0 6px; }
.field-first { margin-top: 0 !important; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; font: 16px var(--font-body); color: var(--encre); background: #fff;
  border: 2px solid var(--trait); border-radius: 10px; padding: 11px 13px; }
input:focus, select:focus { border-color: var(--maree); outline: none; box-shadow: 0 0 0 3px rgba(42,143,166,.35); }
.hint { font-size: 14px; color: var(--muted); margin-top: 6px; }
.err { display: none; margin-top: 16px; padding: 12px 14px; border-radius: 10px; font-size: 15px;
  background: var(--down-tint); color: #8e1a21; border-left: 5px solid var(--down); }
.err.show { display: block; }
.note { font-size: 15px; background: var(--idle-tint); border-radius: 10px; padding: 12px 14px; color: var(--encre); }

/* Choix en tuiles (radio) */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.choice { position: relative; display: block; margin: 0; font-weight: 400; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice > span { display: block; border: 2px solid var(--trait); border-radius: 12px; padding: 13px 15px; background: #fff;
  font-weight: 700; transition: border-color .15s, background-color .15s; }
.choice small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; line-height: 1.45; }
.choice input:checked + span { border-color: var(--maree); background: var(--idle-tint); }
.choice input:focus-visible + span { outline: 3px solid #2a8fa6; outline-offset: 2px; }

/* ---------- Bandeau d'état ---------- */
.band { background: var(--st); color: var(--st-fg); transition: background-color .5s ease, color .5s ease; }
.band a { color: inherit; }
.band .bar .logo { color: inherit; }
.band-body { padding: 28px 0 44px; }
.band h1 { font-size: clamp(30px, 5.2vw, 54px); font-weight: 800; letter-spacing: -0.025em; max-width: 18em; }
.band .lead { font-size: 18px; max-width: 38em; margin-top: 14px; opacity: .94; }

/* ---------- Pastilles et statuts ---------- */
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.status::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--st, var(--muted)); flex: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--st, var(--muted)) 22%, transparent); }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--st-tint, var(--idle-tint)); color: var(--encre); }

/* ---------- Ruban des 30 derniers jours ---------- */
.ribbon { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.ribbon i { display: block; height: 34px; border-radius: 3px; background: var(--ok); position: relative; }
.ribbon i[data-s="bad"] { background: var(--down); }
.ribbon i[data-s="warn"] { background: var(--warn); }
.ribbon i[data-s="none"] { background: #cfdcda; }
.ribbon i:hover, .ribbon i:focus { outline: 2px solid var(--encre); outline-offset: 1px; z-index: 2; }
.ribbon.small i { height: 18px; }
.ribbon-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.ribbon-legend span::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

/* ---------- Infobulle commune ---------- */
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--encre); color: #fff; font-size: 14px; line-height: 1.4;
  padding: 7px 10px; border-radius: 8px; max-width: 240px; opacity: 0; transition: opacity .1s; }
.tip.show { opacity: 1; }

/* ---------- Filtres (puces) ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: 700 14px var(--font-body); border: 2px solid var(--trait); background: #fff; color: var(--encre); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--maree); border-color: var(--maree); color: #fff; }
.chip:hover { border-color: var(--maree); }

/* ---------- Sections ---------- */
.section { padding: 40px 0; border-top: 1px solid var(--trait); }
.section:first-of-type { border-top: none; }
.section h2 { font-size: 26px; margin-bottom: 6px; }
.section .sub { color: var(--muted); max-width: 40em; margin-bottom: 22px; }
.section h2 + .chips { margin-top: 14px; }
.panel { background: var(--papier); border: 1px solid var(--trait); border-radius: 14px; padding: 24px; }

/* Accordéons */
details.acc { border-top: 1px solid var(--trait); }
details.acc:last-of-type { border-bottom: 1px solid var(--trait); }
details.acc > summary { list-style: none; cursor: pointer; padding: 16px 28px 16px 0; font-weight: 700; position: relative; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-size: 24px; font-weight: 400; color: var(--maree); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(45deg); }
details.acc > .acc-body { padding: 0 0 18px; color: var(--encre); max-width: 44em; }

/* ---------- Anneau de score ---------- */
.ring { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring .ring-arc { transition: stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1); }
.ring b { position: relative; font: 800 1.35em var(--font-display); color: var(--st); }
[data-state="warn"] .ring b, .ring[data-state="warn"] b { color: var(--warn-ink); }

/* ---------- Jauge simple ---------- */
.meter { height: 10px; border-radius: 6px; background: var(--trait); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--st, var(--maree)); border-radius: 6px; }

@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .choices { grid-template-columns: 1fr; }
  .ribbon { gap: 2px; }
  .ribbon i { height: 28px; }
  .band .lead { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Anti-spam : champ invisible pour les humains */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-size: 15px; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--maree); }

/* Pied de page et pages légales */
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; padding: 0 24px 40px; font-size: 14px; }
.legal { padding: 8px 0 24px; }
.legal h1 { font-size: clamp(28px, 4vw, 38px); margin: 18px 0 8px; }
.legal h2 { font-size: 22px; margin: 32px 0 8px; }
.legal p, .legal li { margin-top: 10px; }
.legal ul { padding-left: 22px; margin: 0; }
.todo { background: var(--warn-tint); color: var(--warn-ink); padding: 1px 6px; border-radius: 5px; font-weight: 700; }
.draft { background: var(--warn-tint); border-left: 5px solid var(--warn); padding: 12px 14px; border-radius: 10px; color: var(--encre); margin-top: 18px; font-size: 15px; }
