/* Ordonnances — Protection Civile
   Charte FNPC : bleu #004080, orange #F08700, titres en Poppins, texte courant en Arial. */

@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/poppins-700.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bleu: #004080;
  --bleu-fonce: #002b57;
  --orange: #f08700;
  --orange-texte: #a85b00;
  --rouge: #b3121f;
  --rouge-pale: #fdecee;
  --ambre-pale: #fff3df;
  --fond: #edf1f6;
  --papier: #ffffff;
  --encre: #0f1e2e;
  --gris: #5a6675;
  --trait: #d5dce5;
  --lien: #004080;
  --bandeau: #004080;
  --titres: "Poppins", "Arial Rounded MT Bold", Arial, Helvetica, sans-serif;
  --texte: Arial, Helvetica, "Liberation Sans", sans-serif;
  --rayon: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bleu: #1d5fa3;
    --bleu-fonce: #06213d;
    --orange-texte: #ffb347;
    --rouge: #c4202e;
    --rouge-pale: #3a1218;
    --ambre-pale: #3a2a0c;
    --fond: #071a2e;
    --papier: #0e2743;
    --encre: #eef3f9;
    --gris: #a9b6c6;
    --trait: #224466;
    --lien: #9cc9f5;
    --bandeau: #06284c;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  color: var(--encre);
  font: 400 1.0625rem/1.5 var(--texte);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .plein { fill: currentColor; stroke: none; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.masque {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; opacity: 0;
}
.masque:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ───────── Bandeau ───────── */
.bandeau {
  background: var(--bandeau);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}
.bandeau__in {
  display: flex; align-items: center; gap: 12px;
  max-width: 1120px; margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
}
.bandeau__logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.bandeau__titre { flex: 1; min-width: 0; }
.bandeau__titre h1 { font: 700 1.375rem/1.15 var(--titres); letter-spacing: -0.01em; }
.bandeau__titre p { font: 500 0.8125rem/1.3 var(--titres); color: #ffc680; }

.rond {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: #fff;
}
.rond svg { width: 28px; height: 28px; }
.rond:active { background: rgba(255, 255, 255, 0.16); }
.rond--sombre { color: var(--encre); }
.rond--sombre:active { background: var(--fond); }

/* ───────── Mise en page ───────── */
.page {
  flex: 1; width: 100%; max-width: 680px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  display: grid; gap: 20px; align-content: start;
}
@media (min-width: 900px) {
  .page {
    max-width: 1120px; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    column-gap: 32px; padding-top: 32px;
  }
  .saisie, .installer { grid-column: 1; }
  .resultats { grid-column: 2; grid-row: 1 / span 3; }
}

/* ───────── Saisie ───────── */
.saisie { display: grid; gap: 14px; }
.saisie h2 { font: 700 1.5rem/1.2 var(--titres); letter-spacing: -0.015em; color: var(--lien); text-wrap: balance; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 52px; padding: 10px 20px; border: 0; border-radius: var(--rayon);
  font: 600 1.0625rem/1.2 var(--titres); text-align: center; cursor: pointer; user-select: none;
}
.bouton svg { width: 30px; height: 30px; flex: none; }
.bouton--action {
  min-height: 72px; width: 100%; background: var(--orange); color: #002b57;
  font-size: 1.1875rem; box-shadow: 0 2px 0 #b76700;
}
.bouton--action:active { transform: translateY(2px); box-shadow: none; }
.bouton--bleu { background: var(--bleu); color: #fff; }
.bouton--bleu:active { background: var(--bleu-fonce); }
.bouton[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

.lien {
  display: inline-block; padding: 12px 4px; margin: -8px 0; border: 0; background: none;
  color: var(--lien); font: 500 1rem/1.3 var(--titres);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; cursor: pointer;
}
.lien--danger { color: var(--rouge); }
@media (prefers-color-scheme: dark) { .lien--danger { color: #ff9aa3; } }
.saisie > .lien { justify-self: start; }

.lecture { padding: 14px 16px; border-radius: var(--rayon); background: var(--papier); border: 1px solid var(--trait); }
.lecture p { font: 500 1rem/1.35 var(--titres); margin-bottom: 10px; }
.jauge { height: 8px; border-radius: 4px; background: var(--trait); overflow: hidden; }
.jauge__barre { height: 100%; width: 0; background: var(--orange); border-radius: 4px; transition: width 0.25s ease-out; }
.jauge--attente .jauge__barre { width: 35% !important; animation: va-et-vient 1.2s ease-in-out infinite alternate; }
@keyframes va-et-vient { from { transform: translateX(-20%); } to { transform: translateX(210%); } }

.message {
  padding: 12px 16px; border-radius: var(--rayon);
  background: var(--ambre-pale); border-left: 5px solid var(--orange); font-size: 1rem;
}

.champ { position: relative; display: grid; gap: 8px; margin-top: 6px; }
.champ > label { font: 600 1rem/1.3 var(--titres); }
.champ__ligne { display: flex; gap: 8px; }
.champ input {
  flex: 1; min-width: 0; min-height: 52px; padding: 10px 14px;
  border: 2px solid var(--trait); border-radius: var(--rayon);
  background: var(--papier); color: var(--encre); font-size: 1.0625rem;
}
.champ input::placeholder { color: var(--gris); opacity: 1; }
.champ input:focus { outline: none; border-color: var(--lien); }
.aide { font-size: 0.875rem; color: var(--gris); }

.propositions {
  position: absolute; z-index: 5; left: 0; right: 0; top: 96px;
  background: var(--papier); border: 2px solid var(--lien); border-radius: var(--rayon);
  box-shadow: 0 12px 28px rgba(0, 32, 64, 0.22); overflow: hidden;
}
.propositions li {
  display: flex; flex-direction: column; justify-content: center; min-height: 54px; padding: 8px 14px;
  border-top: 1px solid var(--trait); cursor: pointer;
}
.propositions li:first-child { border-top: 0; }
.propositions li[aria-selected="true"], .propositions li:active { background: var(--fond); }
.propositions b { font: 600 1.0625rem/1.25 var(--titres); }
.propositions span { font-size: 0.875rem; color: var(--gris); }

.prive { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9375rem; color: var(--gris); }
.prive svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }

/* ───────── Alertes ───────── */
.alerte {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start;
  padding: 16px 18px; margin-bottom: 14px; border-radius: var(--rayon);
}
.alerte svg { width: 40px; height: 40px; grid-row: span 3; stroke-width: 2; }
.alerte h2 { font: 700 1.375rem/1.2 var(--titres); letter-spacing: -0.01em; }
.alerte__noms { font: 600 1.125rem/1.3 var(--titres); }
.alerte__texte { font-size: 1rem; line-height: 1.4; margin-top: 2px; }
.alerte--anticoagulant { background: var(--rouge); color: #fff; animation: signal 0.5s ease-out 1; }
.alerte--antiagregant { background: var(--ambre-pale); color: var(--encre); border: 2px solid var(--orange); }
.alerte--antiagregant svg { color: var(--orange-texte); }
@keyframes signal { 0% { transform: scale(0.96); opacity: 0; } 60% { transform: scale(1.015); opacity: 1; } 100% { transform: none; } }

.constat {
  padding: 12px 16px; margin-bottom: 14px; border-radius: var(--rayon);
  border: 1px dashed var(--gris); font-size: 0.9375rem; color: var(--gris);
}
.constat b { color: var(--encre); font-weight: 700; }

/* ───────── Feuille de résultats ───────── */
.feuille { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.feuille__tete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 3px solid var(--orange);
}
.feuille__tete h2 { font: 700 1.0625rem/1.25 var(--titres); color: var(--lien); }
.feuille__tete .lien { white-space: nowrap; flex: none; }
.feuille__vide { padding: 18px; color: var(--gris); }

.groupe h3 {
  padding: 16px 18px 6px; font: 600 0.9375rem/1.2 var(--titres); color: var(--orange-texte);
}
.groupe + .groupe { border-top: 1px solid var(--trait); }

.med { position: relative; padding: 10px 18px 14px; border-left: 6px solid transparent; }
.med + .med { border-top: 1px solid var(--trait); }
.med--anticoagulant { border-left-color: var(--rouge); background: var(--rouge-pale); }
.med--antiagregant { border-left-color: var(--orange); }
.med__tete { display: flex; align-items: flex-start; gap: 8px; }
.med__nom { flex: 1; min-width: 0; font: 600 1.25rem/1.25 var(--titres); overflow-wrap: anywhere; }
.med__nom small { display: block; font: 400 0.9375rem/1.35 var(--texte); color: var(--gris); }
.med__retirer {
  flex: none; width: 44px; height: 44px; margin: -6px -10px 0 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: var(--gris);
}
.med__retirer svg { width: 22px; height: 22px; }
.med__retirer:active { background: var(--fond); }
.med__etiquette {
  display: inline-block; margin: 6px 0 2px; padding: 3px 10px; border-radius: 6px;
  background: var(--rouge); color: #fff; font: 600 0.8125rem/1.4 var(--titres);
}
.med--antiagregant .med__etiquette { background: var(--orange); color: #002b57; }
.med__classe { margin-top: 4px; font-weight: 700; }
.med__usage { margin-top: 2px; }
.med__lu, .med__doute { margin-top: 8px; font-size: 0.875rem; color: var(--gris); overflow-wrap: anywhere; }
.med__doute { color: var(--orange-texte); font-weight: 700; }

.averifier { margin-top: 14px; padding: 14px 18px; border-radius: var(--rayon); background: var(--ambre-pale); border-left: 5px solid var(--orange); }
.averifier h3 { font: 600 1.0625rem/1.3 var(--titres); }
.averifier p { font-size: 0.9375rem; margin: 4px 0 8px; }
.averifier li { padding: 6px 0; border-top: 1px solid rgba(160, 100, 0, 0.3); font-weight: 700; overflow-wrap: anywhere; }

.rappel { margin-top: 14px; font-size: 0.875rem; color: var(--gris); }

/* ───────── Installation ───────── */
.installer {
  display: grid; gap: 12px; padding: 16px 18px; border-radius: var(--rayon);
  background: var(--papier); border: 2px solid var(--lien);
}
.installer h2 { font: 700 1.125rem/1.25 var(--titres); color: var(--lien); margin-bottom: 4px; }
.installer p, .installer ol { font-size: 1rem; }
.installer ol { list-style: decimal; padding-left: 1.3em; display: grid; gap: 4px; }
.installer .ios { width: 22px; height: 22px; vertical-align: -5px; color: var(--lien); }
.installer__actions { display: flex; align-items: center; gap: 20px; }

/* ───────── Pied ───────── */
.pied {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  font-size: 0.875rem; color: var(--gris); display: grid; gap: 4px;
}
.pied .lien { font-size: 0.875rem; margin-right: 18px; }

/* ───────── Fiche d'information ───────── */
.fiche {
  width: min(680px, 100% - 24px); max-height: min(88vh, 100% - 24px); padding: 0;
  border: 0; border-radius: 18px; background: var(--papier); color: var(--encre);
  box-shadow: 0 24px 60px rgba(0, 20, 40, 0.4);
}
.fiche[open] { display: flex; flex-direction: column; }
.fiche::backdrop { background: rgba(0, 24, 48, 0.6); }
.fiche__tete {
  display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 20px;
  border-bottom: 3px solid var(--orange);
}
.fiche__tete h2 { flex: 1; font: 700 1.125rem/1.25 var(--titres); color: var(--lien); }
.fiche__corps { overflow-y: auto; padding: 4px 20px 24px; -webkit-overflow-scrolling: touch; }
.fiche__corps h3 { margin: 20px 0 8px; font: 600 1rem/1.3 var(--titres); color: var(--orange-texte); }
.fiche__corps ul { list-style: disc; padding-left: 1.2em; display: grid; gap: 8px; font-size: 1rem; }
.fiche__corps dt { font-weight: 700; margin-top: 10px; font-size: 0.9375rem; }
.fiche__corps dd { font-size: 1rem; }
.fiche__corps mark { background: var(--ambre-pale); color: inherit; padding: 1px 6px; border-radius: 4px; border: 1px dashed var(--orange); }

.noscript { margin: 20px; padding: 16px; background: var(--ambre-pale); border-radius: var(--rayon); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
