/* ════════════════════════════════════════════════════════════════
   Audit de résilience citoyenne : thème (teal #007481 / marine #0a2540)
   ════════════════════════════════════════════════════════════════ */

:root {
  --navy: #0a2540;
  --navy-2: #12355c;
  --teal: #007481;
  --teal-2: #00578a;
  --cyan: #7fe6ff;
  --ink: #1a1a33;
  --muted: #5d6b85;
  --line: #d8e2e8;
  --bg: #f4f7f9;
  --card: #ffffff;
  --tint: #eef6f8;
  --ok: #1f8a5b;
  --mid: #2f7fb8;
  --warn: #d9822b;
  --high: #c0392b;
  --red: #d63a2f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(10, 37, 64, .06), 0 6px 20px rgba(10, 37, 64, .06);
  --rainbow: linear-gradient(to right, violet, indigo, blue, green, yellow, orange, red);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { color: var(--teal); line-height: 1.25; margin: 0 0 .6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .7rem; }
a { color: var(--teal); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.opt { font-weight: 400; font-size: .85rem; color: var(--muted); }

/* ── En-tête animé ─────────────────────────────────────────── */
.hero { position: relative; height: 240px; background: var(--navy); overflow: hidden; color: #fff; }
#matrix { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-inner {
  position: relative; z-index: 2; height: 100%;
  max-width: 1200px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hero-title { display: flex; flex-direction: column; font-weight: 900; letter-spacing: .5px; line-height: 1.1; }
.h-small { font-size: 1.35rem; }
.h-big { font-size: 2rem; color: var(--cyan); }
.mini-rainbow { display: block; height: 2px; width: 100%; background: var(--rainbow); margin: 8px 0; }
.hero-brain {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 120px; user-select: none; pointer-events: none;
  filter: drop-shadow(0 0 30px rgba(0, 255, 200, .45));
  animation: pulseTurn 4s ease-in-out infinite;
}
.hero-tag { display: flex; flex-direction: column; align-items: flex-end; max-width: 360px; }
.tagline {
  background: rgba(0, 116, 129, .88); padding: 8px 14px; border-radius: 6px;
  font-weight: 700; font-size: .85rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); text-align: center;
}
@keyframes pulseTurn {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  50% { transform: translate(-50%, -50%) scale(1.12) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) { .hero-brain { animation: none; } }

.date-banner {
  max-width: 1200px; margin: 12px auto 0; padding: 10px 20px;
  background: var(--teal); color: #fff; border-radius: 12px; text-align: center; font-weight: 600;
}
.rainbow { height: 4px; background: var(--rainbow); border-radius: 2px; margin: 12px auto; max-width: 1200px; }
.rainbow.thin { height: 3px; margin: 8px 0 14px; }

/* ── Mise en page ──────────────────────────────────────────── */
main, .login-wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin: 0 0 18px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 > .card, .grid-3 > .card { margin: 0; }
.grid-2.align-start { align-items: start; margin-bottom: 18px; }
.card .grid-2, .card .grid-3 { margin-bottom: 4px; }

/* ── Formulaires ───────────────────────────────────────────── */
label { display: block; font-weight: 600; font-size: .92rem; margin: 10px 0 6px; color: var(--navy); }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #c4d1da; border-radius: 8px; padding: 10px 12px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, .seg input:focus-visible + span, .check input:focus-visible + span {
  outline: 3px solid rgba(0, 116, 129, .45); outline-offset: 2px;
}
.form-error { color: var(--high); font-weight: 600; margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; border: 0; border-radius: 8px; cursor: pointer;
  padding: 11px 20px; min-height: 44px; transition: background-color .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b02a21; }
.btn-ghost { background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.btn-ghost:hover { background: var(--tint); }
.btn-block { width: 100%; }
.btn-lg { font-size: 1.05rem; padding: 15px 22px; margin: 6px 0 18px; }

/* Connexion */
.login-wrap { display: flex; justify-content: center; padding-top: 16px; }
.login-card { width: 100%; max-width: 460px; }
.login-card .btn { margin-top: 18px; }

/* Barre utilisateur + titre */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 8px; }
.who { color: var(--muted); }
.page-title { text-align: center; margin: 10px 0 18px; }
.page-title h1 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); margin-bottom: 4px; }
.subtitle { color: var(--teal-2); font-weight: 700; letter-spacing: .5px; margin: 0; font-size: clamp(.9rem, 2vw, 1.15rem); }

/* Onglets */
.tabs {
  display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 20px;
  position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: 6px;
}
.tab {
  font: inherit; font-weight: 700; background: transparent; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 10px 10px 0 0; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--teal); background: var(--tint); }
.tab[aria-selected="true"] { color: var(--teal); border-bottom-color: var(--teal); background: #fff; }
#tab-crise[aria-selected="true"] { color: var(--red); border-bottom-color: var(--red); }

.info-card { background: var(--tint); border-left: 4px solid var(--teal); padding: 14px 18px; border-radius: 8px; margin: 0 0 18px; }
.alert-card { background: #fff4e6; border-left: 4px solid #ff9944; padding: 11px 15px; border-radius: 8px; margin: 10px 0; }
.alert-card.alert-high { background: #fdecea; border-left-color: var(--high); font-weight: 600; }
.notice { background: var(--tint); border-radius: 8px; padding: 9px 13px; font-size: .9rem; color: var(--muted); }

.scale-hint { text-align: center; color: var(--muted); margin: 6px 0 14px; }

/* Échelle 1 à 5 */
.q { border: 0; padding: 0; margin: 0 0 18px; }
.q:last-child { margin-bottom: 0; }
.q legend { font-weight: 600; color: var(--navy); margin-bottom: 10px; padding: 0; }
.qid { display: inline-block; background: var(--navy); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: .82rem; margin-right: 4px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg { margin: 0; font-weight: 400; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 6px 4px; text-align: center; border: 1.5px solid #c4d1da; border-radius: 9px;
  background: #fff; color: var(--ink); transition: background-color .12s, border-color .12s, color .12s;
}
.seg span b { font-size: 1.1rem; }
.seg span small { font-size: .74rem; color: var(--muted); line-height: 1.15; }
.seg:hover span { border-color: var(--teal); }
.seg input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.seg input:checked + span small { color: #d9f3f6; }
#panel-crise .seg input:checked + span { background: var(--red); border-color: var(--red); }
#panel-crise .seg input:checked + span small { color: #ffe3e0; }

/* Cases à cocher */
.checks { display: grid; grid-template-columns: 1fr; gap: 6px; }
.checks.kit { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.check { margin: 0; font-weight: 400; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span {
  display: block; padding: 9px 12px 9px 40px; position: relative; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; transition: background-color .12s, border-color .12s;
}
.check span::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  border: 2px solid #9fb2bf; border-radius: 4px; background: #fff;
}
.check input:checked + span { background: var(--tint); border-color: var(--teal); }
.check input:checked + span::before { background: var(--teal); border-color: var(--teal); }
.check input:checked + span::after {
  content: ""; position: absolute; left: 18px; top: 50%; width: 5px; height: 10px; transform: translate(0, -62%) rotate(45deg);
  border: solid #fff; border-width: 0 2px 2px 0;
}
.kit-meter { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.kit-meter .progress { flex: 1; }
#kit-pct { font-weight: 700; min-width: 3.5em; text-align: right; }

/* Progression */
.progress { height: 10px; background: #e3ebf0; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--teal); border-radius: 99px; transition: width .4s ease; }
.tone-bar-ok { background: var(--ok); }
.tone-bar-warn { background: var(--warn); }
.tone-bar-high { background: var(--high); }
.progress-box { margin: 10px 0 20px; }
.progress-box .progress-bar { background: linear-gradient(90deg, var(--teal), var(--cyan)); }

/* ── Résultats ─────────────────────────────────────────────── */
.section-title { margin: 22px 0 12px; }
#audit-results, #crise-results, .panel { scroll-margin-top: 70px; }
.score-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--navy); color: #cfe9ff; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 18px;
}
.sb-meta { font-size: .9rem; opacity: .9; margin: 0 0 6px; }
.sb-main { font-size: 1.25rem; color: #fff; margin: 6px 0 2px; letter-spacing: .3px; }
.sb-main b { color: var(--cyan); }
.sb-level { font-weight: 700; color: var(--cyan); margin: 0 0 8px; }

.gauge { text-align: center; }
.gauge p { margin: 6px 0 0; font-size: .85rem; font-weight: 600; }
.gauge-ring {
  --c: var(--teal);
  width: 112px; height: 112px; border-radius: 50%; margin: 0 auto; display: grid; place-content: center;
  background: radial-gradient(closest-side, #fff 78%, transparent 79%), conic-gradient(var(--c) calc(var(--v) * 1%), #e3ebf0 0);
  color: var(--navy);
}
.gauge-ring span { font-size: 2rem; font-weight: 800; line-height: 1; }
.gauge-ring small { font-size: .8rem; color: var(--muted); }
.tone-ok .gauge-ring { --c: var(--ok); }
.tone-mid .gauge-ring { --c: var(--mid); }
.tone-warn .gauge-ring { --c: var(--warn); }
.tone-high .gauge-ring { --c: var(--high); }
.score-banner .gauge p { color: #cfe9ff; }

.radar { width: 100%; height: auto; max-width: 520px; display: block; margin: 0 auto; }
.rd-grid { fill: none; stroke: #cfd8dc; stroke-width: 1; }
.rd-tick { font-size: 9px; fill: #8796a8; }
.rd-area { fill: rgba(0, 116, 129, .32); stroke: var(--teal); stroke-width: 2; }
.rd-dot { fill: var(--teal); stroke: #fff; stroke-width: 1.5; }
.rd-label { font-size: 11.5px; font-weight: 700; fill: var(--navy); }

.bar-row { margin: 0 0 14px; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: .95rem; }

.report h3 { color: var(--teal); margin-top: 1.1rem; font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.report ul { padding-left: 1.2rem; margin: 0 0 .8rem; }
.report li { margin-bottom: .35rem; }

.crisis-teaser {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  border-left: 5px solid var(--red); background: #fff8f7;
}
.crisis-teaser > div { flex: 1 1 380px; }
.crisis-teaser h3 { color: var(--red); }
.crisis-teaser p { margin: 0; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
.actions .btn { flex: 1 1 260px; }

/* ── Onglet crise ──────────────────────────────────────────── */
.crise-intro {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #e6f3fb;
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 16px;
}
.crise-intro h2 { color: #fff; font-size: 1.55rem; }
.crise-intro p { margin: 0; }
.eyebrow { color: var(--cyan); font-weight: 700; letter-spacing: .6px; font-size: .85rem; margin-bottom: 6px !important; text-transform: uppercase; }
.quote { margin: 0; border-left: 3px solid var(--cyan); padding: 6px 0 6px 16px; }
.quote p { font-size: 1.35rem; font-weight: 700; color: #fff; font-style: italic; }
.quote footer { font-size: .85rem; color: #a9c7dc; margin-top: 6px; }

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.pillar { border-radius: 10px; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-top: 4px solid; }
.pillar b { display: block; letter-spacing: 1.5px; font-size: 1.05rem; }
.pillar span { font-size: .9rem; color: var(--muted); }
.pillar-savoir { border-top-color: var(--mid); } .pillar-savoir b, .pillar-card.pillar-savoir h4 { color: var(--mid); }
.pillar-preparer { border-top-color: var(--warn); } .pillar-preparer b, .pillar-card.pillar-preparer h4 { color: #b5651d; }
.pillar-agir { border-top-color: var(--ok); } .pillar-agir b, .pillar-card.pillar-agir h4 { color: var(--ok); }

.profile-card { text-align: center; border-top: 5px solid var(--teal); }
.profile-card.tone-ok { border-top-color: var(--ok); }
.profile-card.tone-mid { border-top-color: var(--mid); }
.profile-card.tone-warn { border-top-color: var(--warn); }
.profile-card.tone-high { border-top-color: var(--high); }
.profile-card h3 { margin-top: 12px; font-size: 1.25rem; color: var(--navy); }
.profile-card > p { text-align: left; }
.kv { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; }
.kv li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); }

.matrix-svg { width: 100%; height: auto; max-width: 440px; display: block; margin: 0 auto; }
.mx-ok { fill: #e3f4ec; stroke: #fff; stroke-width: 2; }
.mx-warn { fill: #fdf0e1; stroke: #fff; stroke-width: 2; }
.mx-high { fill: #fbe5e3; stroke: #fff; stroke-width: 2; }
.mx-q { font-size: 11px; font-weight: 700; fill: #4a5a70; }
.mx-axis { font-size: 11px; font-weight: 700; fill: var(--navy); }
.mx-tick { font-size: 10px; fill: var(--muted); }
.mx-dot { fill: var(--red); stroke: #fff; stroke-width: 2; }
.mx-dot-halo { fill: rgba(214, 58, 47, .22); }

.pillar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.pillar-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 5px solid; }
.pillar-card.pillar-savoir { border-top-color: var(--mid); }
.pillar-card.pillar-preparer { border-top-color: var(--warn); }
.pillar-card.pillar-agir { border-top-color: var(--ok); }
.pillar-card h4 { font-size: 1rem; letter-spacing: .3px; }
.pillar-card ul { padding-left: 1.1rem; margin: 0; }
.pillar-card li { margin-bottom: .45rem; font-size: .95rem; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #fdf0e1; color: #8a4b12; border: 1px solid #f3d3ad; border-radius: 99px; padding: 5px 12px; font-size: .88rem; }

/* Fiches réflexes */
.fiche { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.fiche summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  padding: 13px 16px; background: #fbfcfd;
}
.fiche summary::-webkit-details-marker { display: none; }
.fiche summary::after { content: "+"; grid-column: 3; grid-row: 1 / span 2; font-size: 1.4rem; color: var(--teal); font-weight: 700; }
.fiche[open] summary::after { content: "−"; }
.fiche[open] summary { border-bottom: 1px solid var(--line); }
.fiche-icon { grid-row: 1 / span 2; font-size: 1.6rem; }
.fiche-title { font-weight: 700; color: var(--navy); }
.fiche-themes { font-size: .85rem; color: var(--muted); }
.rank { display: inline-grid; place-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: .78rem; margin-right: 8px; }
.fiche-body { padding: 14px 18px 6px; }
.fiche-row { margin-bottom: 12px; }
.fiche-row h4 { font-size: .92rem; color: var(--teal); margin-bottom: 4px; }
.fiche-row ul { margin: 0; padding-left: 1.15rem; }
.fiche-row li { margin-bottom: 3px; }
.fiche-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fiche-row .dont h4 { color: var(--high); }
.fiche-row .dont { background: #fff7f6; border-radius: 8px; padding: 8px 12px; }
.fiche-note { font-size: .82rem; color: var(--muted); font-style: italic; border-top: 1px dashed var(--line); padding-top: 8px; }

.numeros { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.num { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.num:hover { border-color: var(--red); }
.num b { font-size: 1.35rem; color: var(--red); min-width: 2.6em; text-align: center; }
.num span { font-size: .86rem; line-height: 1.3; }

.disclaimer { background: #fff8e6; border: 1px solid #f1dfae; border-radius: 8px; padding: 11px 15px; margin: 14px 0; font-size: .92rem; }
.ethics { background: #fff4e6; border-left: 4px solid #ff9944; padding: 12px 16px; border-radius: 8px; margin-top: 24px; font-size: .92rem; }

.site-footer {
  max-width: 1200px; margin: 0 auto; padding: 18px 20px 30px; display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; font-size: .85rem; border-top: 1px solid var(--line);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .pillar-grid, .crise-intro { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .hero-tag { display: none; }
  .hero-brain { left: auto; right: 24px; transform: translateY(-50%); font-size: 80px; animation: none; }
}
@media (max-width: 600px) {
  main, .login-wrap { padding: 0 16px 32px; }
  .date-banner { margin: 10px 16px 0; font-size: .9rem; }
  .rainbow { margin: 10px 16px; }
  .hero { height: 170px; }
  .hero-inner { padding: 0 18px; }
  .h-small { font-size: 1.05rem; } .h-big { font-size: 1.5rem; }
  .hero-brain { font-size: 54px; right: 14px; }
  .grid-3, .pillars, .fiche-row.two { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .scale { gap: 4px; }
  .seg span { min-height: 52px; padding: 4px 2px; }
  .seg span small { font-size: .66rem; }
  .tab { padding: 10px 10px; font-size: .92rem; flex: 1; }
  .score-banner { padding: 16px; }
}
