/* =====================================================================
   Charte PERI-G pour les outils (applications) hébergés dans /app/uploads
   Chargée par chaque outil APRÈS ses propres styles : elle remplace les
   couleurs et la police par celles du site perig.com, et met en forme la
   barre « Toutes les applications ».
   Chaque outil est repéré par l'attribut data-perig-app sur <html>.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap");

/* ---------- Police Outfit (police du site) ---------- */
html[data-perig-app] body,
html[data-perig-app] h1, html[data-perig-app] h2, html[data-perig-app] h3,
html[data-perig-app] h4, html[data-perig-app] h5, html[data-perig-app] h6,
html[data-perig-app] button, html[data-perig-app] input,
html[data-perig-app] select, html[data-perig-app] textarea {
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Barre PERI-G + bouton retour ---------- */
.perig-bar {
  position: relative; z-index: 50;
  background: #fff; border-bottom: 3px solid #0094c9;
  box-shadow: 0 2px 18px 0 rgba(0, 148, 201, .2);
  font: 500 15px/1.2 "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #011638;
}
.perig-bar__in {
  max-width: 1280px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.perig-bar a { text-decoration: none; }
.perig-bar__back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: #002E47; color: #fff !important; font-weight: 600;
  transition: background .15s ease;
}
.perig-bar__back:hover { background: #011638; }
.perig-bar__back:focus-visible { outline: 3px solid #00aede; outline-offset: 2px; }
.perig-bar__back svg { width: 16px; height: 16px; flex: none; }
.perig-bar__logo { display: block; line-height: 0; }
.perig-bar__logo img { height: 42px !important; width: auto !important; max-width: none; margin: 0; }
@media (max-width: 520px) {
  .perig-bar__back span { display: none; }
  .perig-bar__back { padding: 9px 12px; }
  .perig-bar__back::after { content: "Applications"; }
}
@media print { .perig-bar { display: none !important; } }


/* =====================================================================
   Boussole des démarches / Boussole des aides
   ===================================================================== */
@media (prefers-color-scheme: light) {
  html[data-perig-app="boussole"]:not([data-theme="dark"]) {
    --vert: #002E47; --turquoise: #0094c9; --orange: #00aede;
    --accent: #002E47; --accent-ink: #FFFFFF; --focus: #0094c9;
    --bg: #F6F8FA; --surface: #FFFFFF; --surface-2: #EEF3F7;
    --text: #011638; --muted: #364156; --line: #DCE3EA;
    --shadow: 0 1px 2px rgba(1,22,56,.06), 0 4px 16px rgba(0,148,201,.10);
  }
}
html[data-perig-app="boussole"][data-theme="light"] {
  --vert: #002E47; --turquoise: #0094c9; --orange: #00aede;
  --accent: #002E47; --accent-ink: #FFFFFF; --focus: #0094c9;
  --bg: #F6F8FA; --surface: #FFFFFF; --surface-2: #EEF3F7;
  --text: #011638; --muted: #364156; --line: #DCE3EA;
  --shadow: 0 1px 2px rgba(1,22,56,.06), 0 4px 16px rgba(0,148,201,.10);
}
@media (prefers-color-scheme: dark) {
  html[data-perig-app="boussole"]:not([data-theme="light"]) {
    --vert: #10597a; --turquoise: #18caf8; --orange: #18caf8;
    --accent: #18caf8; --accent-ink: #011638; --focus: #60e2ff;
    --bg: #0B1623; --surface: #12202F; --surface-2: #1A2B3D;
    --text: #EAF2F8; --muted: #9FB1C2; --line: #26394D;
  }
}
html[data-perig-app="boussole"][data-theme="dark"] {
  --vert: #10597a; --turquoise: #18caf8; --orange: #18caf8;
  --accent: #18caf8; --accent-ink: #011638; --focus: #60e2ff;
  --bg: #0B1623; --surface: #12202F; --surface-2: #1A2B3D;
  --text: #EAF2F8; --muted: #9FB1C2; --line: #26394D;
}
html[data-perig-app="boussole"] .brand-mark {
  background: conic-gradient(#00aede 0 25%, #0094c9 0 50%, #086d96 0 75%, #002E47 0);
}
/* échéance proche : on garde une alerte ambrée */
html[data-perig-app="boussole"] .dfin.proche { background: color-mix(in srgb, #F8B334 30%, transparent); }
html[data-perig-app="boussole"] .cmpbar .go { color: #011638; }


/* =====================================================================
   Eval'Métha (déjà aux couleurs PERI-G : seule la police change)
   ===================================================================== */
html[data-perig-app="evalmetha"] {
  --f-display: "Outfit", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --f-body: "Outfit", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}


/* =====================================================================
   Calcul du TCO machinisme (pas de mode sombre)
   ===================================================================== */
html[data-perig-app="tco"] {
  --font: "Outfit", "Helvetica Neue", Arial, sans-serif;
  --bg: #F6F8FA; --card: #FFFFFF; --ink: #011638; --muted: #364156; --line: #DCE3EA;
  --jaune: #002E47; --jaune-d: #011638; --jaune-l: #E6F4FA;
  --vert: #0094c9; --vert-d: #086d96; --vert-l: #EBF6FB;
  --amber: #B47B09; --red: #E7511E;
  --shadow: 0 1px 2px rgba(1,22,56,.06), 0 8px 24px rgba(0,148,201,.10);
}
html[data-perig-app="tco"] header.app { color: #fff; border-bottom: 4px solid #0094c9; }
html[data-perig-app="tco"] header.app h1,
html[data-perig-app="tco"] header.app h2,
html[data-perig-app="tco"] header.app p { color: #fff; }
html[data-perig-app="tco"] .stepper button.active .n,
html[data-perig-app="tco"] button.act,
html[data-perig-app="tco"] .badge.win { color: #fff; }
html[data-perig-app="tco"] .sub { color: #0094c9; }
html[data-perig-app="tco"] .alert.amber { background: #FFF4DC; border-color: #F0D79A; }
html[data-perig-app="tco"] .alert.green { border-color: #B7DDEE; }


/* =====================================================================
   Diagnostic graminées automnales
   ===================================================================== */
@media (prefers-color-scheme: light) {
  html[data-perig-app="gram"]:not([data-theme="dark"]) {
    --jaune: #002E47; --jaune-fonce: #086d96; --sable: #E6F4FA; --on-jaune: #FFFFFF;
    --vert: #0094c9; --vert-fonce: #086d96; --menthe: #EBF6FB;
    --gris: #011638; --ink-soft: #364156; --gris-clair: #DCE3EA;
    --ground: #F6F8FA; --paper: #FFFFFF; --paper-alt: #F6F8FA;
    --shadow: 0 6px 20px rgba(0, 148, 201, .12);
  }
}
html[data-perig-app="gram"][data-theme="light"] {
  --jaune: #002E47; --jaune-fonce: #086d96; --sable: #E6F4FA; --on-jaune: #FFFFFF;
  --vert: #0094c9; --vert-fonce: #086d96; --menthe: #EBF6FB;
  --gris: #011638; --ink-soft: #364156; --gris-clair: #DCE3EA;
  --ground: #F6F8FA; --paper: #FFFFFF; --paper-alt: #F6F8FA;
  --shadow: 0 6px 20px rgba(0, 148, 201, .12);
}
@media (prefers-color-scheme: dark) {
  html[data-perig-app="gram"]:not([data-theme="light"]) {
    --jaune: #18caf8; --jaune-fonce: #60e2ff; --sable: #0E3550; --on-jaune: #011638;
    --vert: #18caf8; --vert-fonce: #a1efff; --menthe: #0E3040;
    --ink: #EAF2F8; --ink-soft: #9FB1C2; --gris-clair: #26394D;
    --ground: #0B1623; --paper: #12202F; --paper-alt: #1A2B3D;
  }
}
html[data-perig-app="gram"][data-theme="dark"] {
  --jaune: #18caf8; --jaune-fonce: #60e2ff; --sable: #0E3550; --on-jaune: #011638;
  --vert: #18caf8; --vert-fonce: #a1efff; --menthe: #0E3040;
  --ink: #EAF2F8; --ink-soft: #9FB1C2; --gris-clair: #26394D;
  --ground: #0B1623; --paper: #12202F; --paper-alt: #1A2B3D;
}
/* le rouge Cerfrance servait d'accent (étiquettes, bouton action) : il passe au bleu PERI-G.
   --rouge-fonce et --abricot restent pour les alertes (surcoût, avertissements). */
html[data-perig-app="gram"] { --rouge: #0094c9; }
@media (prefers-color-scheme: dark) { html[data-perig-app="gram"]:not([data-theme="light"]) { --rouge: #18caf8; } }
html[data-perig-app="gram"][data-theme="dark"] { --rouge: #18caf8; }
html[data-perig-app="gram"] .btn.accent { background: #086d96; color: #fff; }
html[data-perig-app="gram"] .btn.accent:hover { background: #002E47; }

/* --- Mise en page façon perig.com --- */
/* le logo est déjà dans la barre PERI-G : le bandeau logo ne sert qu'à l'impression */
@media screen { html[data-perig-app="gram"] .brandbar { display: none; } }

/* en-tête clair : étiquette-pilule bleue, grand titre gras, sous-titre gris */
html[data-perig-app="gram"] .hero {
  background: linear-gradient(180deg, var(--menthe) 0%, var(--ground) 100%);
  color: var(--ink); padding-block: 40px 36px;
}
html[data-perig-app="gram"] .hero::after { display: none; }
html[data-perig-app="gram"] .hero .eyebrow {
  justify-self: start; width: max-content; max-width: 100%;
  background: #0094c9; color: #fff; border-radius: 16px; padding: 6px 16px;
  font-size: 13px; font-weight: 500; letter-spacing: .02em; text-transform: none;
}
html[data-perig-app="gram"] .hero h1 {
  color: var(--ink); text-transform: none; font-weight: 800;
  font-size: clamp(32px, 5vw, 56px); line-height: 1.1; letter-spacing: -.01em; margin: 18px 0 14px;
}
html[data-perig-app="gram"] .hero .lead { color: var(--ink-soft); font-weight: 300; font-size: clamp(16px, 1.6vw, 20px); max-width: 60ch; }
html[data-perig-app="gram"] .hero .src { color: var(--ink-soft); opacity: .8; }
html[data-perig-app="gram"] .hero .src a { color: var(--vert); }

/* titres de section : gras, sans majuscules forcées */
html[data-perig-app="gram"] .sec-head h2 { text-transform: none; font-weight: 800; font-size: 24px; color: var(--ink); }

/* cartes arrondies avec liseré et ombre bleutée, comme les cartes du site */
html[data-perig-app="gram"] section.card {
  border-radius: 16px; border: 1px solid var(--gris-clair);
  box-shadow: 0 8px 28px 0 rgba(0, 148, 201, .08); padding: 24px;
}
html[data-perig-app="gram"] .species img,
html[data-perig-app="gram"] .semis-box,
html[data-perig-app="gram"] .zone { border-radius: 16px; }

/* boutons : bleu nuit, survol plus foncé */
html[data-perig-app="gram"] .btn:hover { background: #011638; color: #fff; }
html[data-perig-app="gram"] .trigger { border-radius: 16px; }

/* barre de score en bas */
html[data-perig-app="gram"] .bar { border-top-color: #0094c9; }
html[data-perig-app="gram"] .bar .fill { background: #0094c9; }

@media (max-width: 640px) {
  html[data-perig-app="gram"] .hero { padding-block: 28px 24px; }
  html[data-perig-app="gram"] section.card { padding: 16px; }
}
@media print {
  html[data-perig-app="gram"] .hero { background: #EBF6FB !important; color: #011638 !important; }
}
