/* KAIROS — Pastorale Numérique de l'Archidiocèse de Ouagadougou
   Palette issue du logo PNAO : bleu royal, or, ivoire. */
:root {
  --blue: #15308A;
  --blue-deep: #0C1D57;
  --blue-soft: #E7ECF8;
  --gold: #C29A3E;
  --gold-strong: #A87F24;
  --gold-light: #EAD7A2;
  --ivory: #FBF7EE;
  --parchment: #F4ECDA;
  --card: #FFFDF8;
  --ink: #1C2036;
  --muted: #5B6077;
  --line: #E4D9BF;
  --ok: #2F7A4B;
  --warn: #A3532A;
  --p1: #2F7A4B; --p2: #B07D1E; --p3: #5B6077;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(12,29,87,.06), 0 8px 24px rgba(12,29,87,.08);
  --serif: "Cormorant Garamond", "Libre Baskerville", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.55;
  color: var(--ink); background: var(--ivory);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(194,154,62,.10), transparent 40%),
    radial-gradient(circle at 110% 20%, rgba(21,48,138,.07), transparent 45%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
svg[aria-hidden="true"] { width: 1.15em; height: 1.15em; vertical-align: -0.18em; flex: none; }
.ornament svg { width: 22px; height: 22px; }
a { color: var(--blue); }
a:hover { color: var(--blue-deep); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--blue-deep); line-height: 1.15; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,247,238,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--blue-deep); min-width: 0; }
.brand img { width: 52px; height: 52px; flex: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; letter-spacing: .06em; line-height: 1; }
.brand-sub { font-size: .74rem; color: var(--muted); letter-spacing: .02em; display: block; margin-top: 3px; }
.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem;
}
.nav a:hover { background: var(--parchment); }
.nav a[aria-current="page"] { background: var(--blue); color: #fff; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; color: var(--blue-deep); }
.plan-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--gold); color: #fff; font-size: .75rem; }
@media (max-width: 920px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--ivory); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; flex-direction: column; }
  .nav.open { display: flex; }
  .nav a { border-radius: 10px; }
  .brand-sub { display: none; }
}

/* ---------- Structure ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; min-height: 70vh; }
.section { margin: 56px 0; }
.section-head { text-align: center; max-width: 760px; margin: 0 auto 28px; }
.eyebrow { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-strong); font-weight: 700; margin-bottom: 8px; display: block; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); margin: 14px auto; max-width: 320px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { background: linear-gradient(90deg, var(--gold), transparent); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
/* Carte en arc (vitrail) */
.arch { border-radius: 140px 140px var(--radius) var(--radius); padding-top: 42px; text-align: center; position: relative; }
.arch::before {
  content: ""; position: absolute; inset: 8px 8px auto 8px; height: 120px;
  border: 1px solid var(--gold-light); border-bottom: none; border-radius: 132px 132px 0 0; pointer-events: none;
}

/* ---------- Héros ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 56px 40px;
  background: linear-gradient(160deg, var(--blue-deep) 0%, var(--blue) 70%, #1E3FA6 100%);
  color: #F6F1E4; display: grid; grid-template-columns: 1.3fr .9fr; gap: 32px; align-items: center;
  box-shadow: 0 20px 50px rgba(12,29,87,.25);
}
.hero h1 { color: #fff; }
.hero h1 em { font-style: italic; color: var(--gold-light); }
.hero p.lead { font-size: 1.18rem; color: #DCE3F5; max-width: 560px; }
.hero .rose { position: absolute; right: -120px; top: -120px; width: 520px; opacity: .12; pointer-events: none; }
.hero-logo { justify-self: center; width: min(320px, 80%); filter: drop-shadow(0 12px 30px rgba(0,0,0,.35)); position: relative; }
.hero-quote { margin-top: 22px; padding-left: 16px; border-left: 3px solid var(--gold); font-family: var(--serif); font-size: 1.35rem; font-style: italic; color: #fff; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 36px 22px; text-align: left; }
  .hero-logo { order: -1; width: 160px; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem var(--sans); border-radius: 999px; padding: 12px 20px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; transition: transform .08s ease, background .15s ease;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-strong); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn-ghost:hover { background: var(--parchment); }
.btn-light { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-light:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-sm { padding: 7px 14px; min-height: 36px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Chiffres ---------- */
.stat { text-align: center; }
.stat .num { font-family: var(--serif); font-size: 3rem; font-weight: 700; color: var(--blue); line-height: 1; }
.stat .lbl { color: var(--muted); font-size: .95rem; margin-top: 6px; }

.ooda { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; counter-reset: ooda; }
.ooda > div { padding: 20px; border-top: 3px solid var(--gold); position: relative; }
.ooda > div + div { border-left: 1px dashed var(--line); }
.ooda b { font-family: var(--serif); font-size: 1.4rem; color: var(--blue-deep); display: block; }
@media (max-width: 760px) { .ooda { grid-template-columns: 1fr 1fr; } .ooda > div:nth-child(3) { border-left: none; } }

/* ---------- Calculateur ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .calc { grid-template-columns: 1fr; } }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: none; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 1.25rem;
  box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 4px var(--gold-light);
}
.step h3 { font-size: 1.3rem; margin: 6px 0 10px; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label.lbl { font-weight: 600; font-size: .92rem; display: block; margin-bottom: 4px; }
input[type="text"], input[type="number"], input[type="search"], input[type="password"], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #D6CBAE; border-radius: 10px;
  padding: 10px 12px; min-height: 44px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(21,48,138,.15); }
input[type="number"] { width: 110px; }
textarea { width: 100%; min-height: 120px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  font: 600 .95rem var(--sans); color: var(--ink); min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
input[type="range"] { width: 100%; accent-color: var(--gold); min-height: 32px; }
.range-out { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--blue); min-width: 70px; display: inline-block; }

.task-picker { position: relative; }
.task-picker input { width: 100%; }
.task-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 360px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: none;
}
.task-list.open { display: block; }
.task-list .grp { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-strong); padding: 10px 14px 4px; font-weight: 700; position: sticky; top: 0; background: #fff; }
.task-list button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: baseline; border: none; background: none; padding: 9px 14px; font: inherit; cursor: pointer; color: var(--ink); }
.task-list button:hover, .task-list button.active { background: var(--blue-soft); }
.task-list .no { color: var(--muted); font-size: .85rem; min-width: 30px; }

.task-card { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--parchment); border: 1px solid var(--line); font-size: .95rem; }
.task-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; }
.task-card dt { color: var(--muted); }
.task-card dd { margin: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap; }
.badge-P1 { background: #E3F1E8; color: var(--p1); }
.badge-P2 { background: #F7EBD2; color: #8A5F12; }
.badge-P3 { background: #ECEDF2; color: var(--p3); }
.badge-dom { background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.badge-dom i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.result { position: sticky; top: 92px; background: linear-gradient(180deg, #fff, var(--card)); }
.result-head { text-align: center; padding: 6px 0 14px; border-bottom: 1px solid var(--line); }
.result-big { font-family: var(--serif); font-size: clamp(3rem, 8vw, 4.6rem); font-weight: 700; color: var(--blue); line-height: 1; }
.result-big small { font-size: .38em; color: var(--blue-deep); font-weight: 600; }
.result-sub { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kv span:nth-child(even) { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.equiv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px 0; }
.equiv div { background: var(--parchment); border-radius: 12px; padding: 10px 12px; font-size: .9rem; line-height: 1.3; }
.equiv b { display: block; font-family: var(--serif); font-size: 1.7rem; color: var(--blue-deep); line-height: 1.1; }
.breakeven { padding: 14px; border-radius: 12px; margin: 6px 0 12px; }
.breakeven.ok { background: #E8F3EC; color: #1F5A36; }
.breakeven.ko { background: #FBEDE4; color: #7A3A18; }
.chart svg { width: 100%; height: auto; display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: #FFF6E2; border: 1px solid var(--gold-light); font-size: .95rem; }
.notice.sanct { background: #EEF1FA; border-color: #C9D3EE; }
.notice svg { flex: none; width: 22px; height: 22px; color: var(--gold-strong); margin-top: 2px; }

.prompt-box { background: #fff; border: 1px dashed var(--gold); border-radius: 12px; padding: 14px; font-size: .95rem; white-space: pre-wrap; }

/* ---------- Matrice ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar input[type="search"] { width: 100%; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--parchment); font-weight: 700; color: var(--blue-deep); position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: #FFFBF0; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
td select { min-height: 34px; padding: 4px 6px; }
.score { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--blue-deep); }
.tt { font-weight: 600; }
.cards-m { display: none; }
@media (max-width: 760px) {
  .table-wrap.matrix { display: none; }
  .cards-m { display: grid; gap: 12px; }
}
.mcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.mcard .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.mcard .notes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mcard .notes label { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; }

.bar { height: 10px; border-radius: 999px; background: #EFE7D3; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }

/* ---------- Plan ---------- */
.timeline { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0; margin-top: 10px; }
.timeline > div { padding: 16px; border-top: 4px solid var(--gold-light); }
.timeline > div.w0 { border-color: var(--muted); }
.timeline > div.w1 { border-color: var(--p1); }
.timeline > div.w2 { border-color: var(--gold); }
.timeline > div.w3 { border-color: var(--p3); }
.timeline h4 { font-size: 1.15rem; margin-bottom: 2px; }
.timeline ul { margin: 8px 0 0; padding-left: 18px; font-size: .9rem; }
@media (max-width: 760px) { .timeline { grid-template-columns: 1fr; } }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.checklist input { width: 20px; height: 20px; accent-color: var(--blue); margin-top: 3px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; color: var(--gold); margin: 0 auto 10px; }

/* ---------- Sanctuaire ---------- */
.sanct-card { text-align: left; }
.sanct-card .ico { width: 46px; height: 46px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; margin-bottom: 10px; }
.sanct-card .ico svg { width: 24px; height: 24px; }

/* ---------- Pied de page ---------- */
footer { border-top: 1px solid var(--line); background: var(--parchment); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 28px 16px; display: flex; gap: 24px; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: .9rem; color: var(--muted); }
.footer-inner .brand img { width: 40px; height: 40px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--blue-deep); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  transition: all .25s ease; z-index: 100; max-width: calc(100% - 32px); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.offline-pill { font-size: .75rem; padding: 3px 10px; border-radius: 999px; background: #FBEDE4; color: #7A3A18; }

details.card summary { cursor: pointer; font-weight: 700; color: var(--blue-deep); }
details.card[open] summary { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Impression ---------- */
@media print {
  .topbar, footer, .actions, .toolbar, .no-print, .nav-toggle, .toast { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .result { position: static; }
  .print-only { display: block !important; }
  .table-wrap.matrix { display: block !important; }
  .cards-m { display: none !important; }
}
.print-only { display: none; }

.plan-table { min-width: 1120px; }
.plan-table td:nth-child(2) { min-width: 260px; }
.plan-table td { vertical-align: middle; }
@media print { .plan-table { min-width: 0; font-size: 9pt; } .plan-table input, .plan-table select { border: none; width: auto !important; padding: 0; min-height: 0; } }
