/* =========================================================================
   JIAHCP : styles communs à tout le site
   Univers : le registre de comptes de l'exploitation (papier réglé vert pâle,
   encre bleu de travail) et les cagettes de tri peintes au pochoir.
   ========================================================================= */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../polices/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../polices/atkinson-hyperlegible-next-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Big Shoulders Stencil";
  src: url("../polices/big-shoulders-stencil.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Couleurs de base */
  --registre: #e6ece1;        /* papier du registre, vert pâle */
  --registre-fonce: #d8e1d1;
  --reglure: #cbd8c4;         /* lignes du registre */
  --marge: #dfa79d;           /* filet rouge de marge du registre */
  --papier: #fdfdf9;          /* factures */
  --encre: #19294a;           /* encre bleu de travail : texte */
  --encre-douce: #4b5b78;
  --encre-pale: #8a97ad;

  /* Les trois cagettes */
  --co: #f0be2c;              /* jaune colza : charges opérationnelles */
  --co-fonce: #b98a07;
  --co-texte: #19294a;
  --css: #33804f;             /* vert luzerne : structure spécifiques */
  --css-fonce: #22603a;
  --css-texte: #ffffff;
  --csc: #2a55a0;             /* bleu de travail : structure communes */
  --csc-fonce: #1c3d78;
  --csc-texte: #ffffff;

  /* Tampons */
  --violet: #6b3fa6;          /* encre violette : classé, juste */
  --rouge: #c2352c;           /* encre rouge : à reclasser */

  /* Typographie */
  --texte: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --pochoir: "Big Shoulders Stencil", "Arial Narrow", sans-serif;

  /* Échelle (rapport 1,25) */
  --t-xs: 0.8rem;
  --t-s: 0.9rem;
  --t-m: 1rem;
  --t-l: 1.25rem;
  --t-xl: 1.563rem;
  --t-2xl: 1.953rem;
  --t-3xl: 2.441rem;
  --t-4xl: 3.052rem;

  --ombre-papier: 0 1px 0 rgba(25, 41, 74, 0.08), 0 12px 28px -14px rgba(25, 41, 74, 0.45);
  --ombre-cagette: 0 2px 0 rgba(25, 41, 74, 0.18), 0 14px 22px -16px rgba(25, 41, 74, 0.6);
  --ligne: 2rem;              /* pas de la réglure du registre */
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 106.25%; /* 17 px : lisible au tableau comme sur téléphone */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--texte);
  font-size: var(--t-m);
  line-height: 1.5;
  color: var(--encre);
  background-color: var(--registre);
  /* Réglure du registre : lignes horizontales + double filet rouge de marge */
  background-image:
    linear-gradient(90deg, transparent 0 calc(var(--marge-x, 3.25rem) - 3px), var(--marge) calc(var(--marge-x, 3.25rem) - 3px) calc(var(--marge-x, 3.25rem) - 2px), transparent calc(var(--marge-x, 3.25rem) - 2px) var(--marge-x, 3.25rem), var(--marge) var(--marge-x, 3.25rem) calc(var(--marge-x, 3.25rem) + 1px), transparent calc(var(--marge-x, 3.25rem) + 1px)),
    linear-gradient(180deg, transparent calc(var(--ligne) - 1px), var(--reglure) calc(var(--ligne) - 1px));
  background-size: 100% 100%, 100% var(--ligne);
  background-attachment: fixed, scroll;
  overflow-x: clip;
}

[hidden] { display: none !important; }
img, svg { display: block; }
.icone { width: 1.25em; height: 1.25em; flex: none; }

a { color: inherit; }

h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ----- Boutons ----- */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.75rem;
  padding: 0.6em 1.25em;
  border: 2px solid var(--encre);
  border-radius: 10px;
  background: var(--encre);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 3px 0 #0c1730;
}
.bouton:hover { background: #22386a; }
.bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 #0c1730; }
.bouton--clair {
  background: var(--papier);
  color: var(--encre);
  box-shadow: 0 3px 0 rgba(25, 41, 74, 0.35);
}
.bouton--clair:hover { background: #fff; }
.bouton--clair:active { box-shadow: 0 1px 0 rgba(25, 41, 74, 0.35); }
.bouton--discret {
  min-height: 2.5rem;
  padding: 0.45em 0.8em;
  border-color: transparent;
  background: transparent;
  color: var(--encre);
  box-shadow: none;
  font-weight: 600;
}
.bouton--discret:hover { background: rgba(25, 41, 74, 0.08); }
.bouton--discret:active { box-shadow: none; }
.bouton[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ----- Barre du haut ----- */
.barre {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.4rem max(1rem, env(safe-area-inset-left)) 0.4rem max(1rem, env(safe-area-inset-left));
  background: rgba(230, 236, 225, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--encre);
}
.barre__marque {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--pochoir);
  font-weight: 800;
  font-size: var(--t-xl);
  letter-spacing: 0.04em;
  text-decoration: none;
  line-height: 1;
}
.barre__marque .icone { width: 1.1rem; height: 1.1rem; }
.barre__titre {
  font-weight: 700;
  font-size: var(--t-m);
  color: var(--encre-douce);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.barre__titre::before {
  content: "/";
  margin-right: 0.6rem;
  color: var(--encre-pale);
}
.barre__outils {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

/* Tableau numérique / grand écran : tout grossit d'un quart pour être lu du fond de la classe */
@media (min-width: 1600px) and (min-height: 950px) {
  html { font-size: 132%; }
}

@media (max-width: 560px) {
  body { --marge-x: 1.1rem; }
  .barre__outils .bouton__texte { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
