/*
 * SIGNATURE DJOK : site vitrine et site support.
 *
 * Couleurs, rayons et verre repris de src/theme/index.ts (palettes SOMBRE et CLAIR,
 * `verre`, `radius`). Ce qui est DÉRIVÉ pour le web est dit comme tel.
 *
 * Concept : un instrument de lecture. Deux motifs reviennent partout :
 *   - la règle des secondes (graduations fines, une forte toutes les cinq) ;
 *   - la tête de lecture (un trait orange vertical ou une barre de progression).
 * Quatre voix typographiques, une par rôle :
 *   - Archivo élargi      : Djok parle (titres) ;
 *   - Hanken Grotesk      : le texte courant et l'interface ;
 *   - Martian Mono        : ce qui se mesure (chiffres, unités, identifiants) ;
 *   - Newsreader          : ce que disent les sources (références, réserves).
 * Polices auto-hébergées (OFL 1.1) : aucun appel à un tiers.
 */

@font-face {
  font-family: "Archivo";
  src: url("polices/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("polices/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("polices/martian-mono-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("polices/newsreader-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  src: url("polices/newsreader-latin-standard-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ── Jetons : CLAIR (aplats), la palette complète ─────────────────────── */
:root {
  color-scheme: light;

  --f-titre: "Archivo", "Arial Nova", "Helvetica Neue", Arial, sans-serif;
  --f-texte: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mesure: "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-source: "Newsreader", Georgia, "Times New Roman", serif;

  --fond: #ffffff; /* dérivé : la surface de lecture est la carte blanche de l'app */
  --fond-2: #f2f3f5; /* le fond d'écran de l'app, ici pour les bandes et les creux */
  --carte: #ffffff;
  --carte-fond: #ffffff;
  --tuile: #f5f6f7;
  --creux: rgba(15, 19, 23, 0.05);
  --encre: #14181c;
  --texte: #2b3239; /* dérivé : le texte long, entre l'encre et le gris */
  --gris: #5b6570;
  --tertiaire: #646e79;
  --chevron: #848d96;
  --ligne: #e1e4e8;
  --filet: rgba(15, 19, 23, 0.09);
  --filet-fort: #d3d8de;
  --accent: #ff5a2d;
  --accent-texte: #c23100;
  --accent-doux: #ffe6dc;
  --accent-filet: rgba(255, 90, 45, 0.45);
  --plein-texte: #0f1317;
  --plein-halo: rgba(255, 90, 45, 0.35);
  --ombre-carte: 0 1px 2px rgba(15, 19, 23, 0.05);
  --ombre-haute: 0 24px 60px rgba(15, 19, 23, 0.16), 0 2px 6px rgba(15, 19, 23, 0.06);
  --halos: none;
  --bandeau: rgba(255, 255, 255, 0.82);
  --tick: rgba(15, 19, 23, 0.16);
  --tick-fort: rgba(15, 19, 23, 0.38);
  --voile: rgba(15, 19, 23, 0.35);

  /* Niveaux de preuve */
  --p-etaye: #2e7d32;
  --p-convention: #196abb;
  --p-choix: #b32d00;
  --p-sans: #816400;
  --p-fonct: #5b6570;

  /* Une teinte par domaine, celles de l'app */
  --d-conditions: #816400;
  --d-programme: #b83a00;
  --d-ftp: #7e55af;
  --d-recuperation: #4f5bb5;
  --d-poids: #537300;
  --d-forme: #196abb;
  --d-charge: #00766a;
  --d-fc: #bf2963;
  --d-materiel: #5d4122;
  --d-neutre: #5b6570;

  /* Macronutriments, les couleurs des jauges de l'app */
  --m-glucides: #bb4d1a;
  --m-proteines: #1e73b6;
  --m-boissons: #00686f;

  --r-carte: 16px;
  --r-tuile: 14px;
  --r-bouton: 12px;
  --r-pastille: 11px;
  --r-chip: 9px;
}

/* ── Jetons : SOMBRE (verre) ──────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;

  --fond: #0f1317;
  --fond-2: #0b0e11; /* dérivé : un cran sous le fond, pour les bandes */
  --carte: #171c21;
  --carte-fond: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.035)),
    rgba(23, 28, 33, 0.62);
  --tuile: #1d2329;
  --creux: rgba(0, 0, 0, 0.28);
  --encre: #f2f4f6;
  --texte: #c9cfd6; /* dérivé */
  --gris: #9aa3ad;
  --tertiaire: #8c95a0;
  --chevron: #636d77;
  --ligne: #222930;
  --filet: rgba(255, 255, 255, 0.08);
  --filet-fort: #2c343d;
  --accent-texte: #ff8868;
  --accent-doux: rgba(255, 90, 45, 0.15);
  --accent-filet: rgba(255, 90, 45, 0.38);
  --plein-halo: rgba(255, 90, 45, 0.55);
  --ombre-carte: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 30px rgba(0, 0, 0, 0.35);
  --ombre-haute: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 30px 80px rgba(0, 0, 0, 0.6);
  --halos: radial-gradient(130% 55% at 0% 0%, rgba(255, 90, 45, 0.13), rgba(255, 90, 45, 0) 60%),
    radial-gradient(110% 50% at 100% 100%, rgba(90, 169, 240, 0.1), rgba(90, 169, 240, 0) 60%);
  --bandeau: rgba(15, 19, 23, 0.72);
  --tick: rgba(255, 255, 255, 0.14);
  --tick-fort: rgba(255, 255, 255, 0.36);
  --voile: rgba(0, 0, 0, 0.6);

  --p-etaye: #81c784;
  --p-convention: #5aa9f0;
  --p-choix: #ff8868;
  --p-sans: #edd05a;
  --p-fonct: #9aa3ad;

  --d-conditions: #edd05a;
  --d-programme: #ff7a4d;
  --d-ftp: #b58ceb;
  --d-recuperation: #b9c2f7;
  --d-poids: #a4c95a;
  --d-forme: #5aa9f0;
  --d-charge: #3dbdae;
  --d-fc: #f25c8c;
  --d-materiel: #cca866;
  --d-neutre: #9aa3ad;

  --m-glucides: #ff8a5c;
  --m-proteines: #5aa9f0;
  --m-boissons: #4dd0e1;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

::selection {
  background: rgba(255, 90, 45, 0.28);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--encre);
  text-wrap: balance;
}

p {
  margin: 0;
}

/* ── Les quatre voix ──────────────────────────────────────────────────── */
.titre {
  font-family: var(--f-titre);
  font-stretch: 116%;
  font-weight: 760;
  letter-spacing: -0.032em;
  line-height: 1.02;
}

.mesure {
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* L'étiquette : un mot en capitales au-dessus d'un titre, dans la voix de la mesure. */
.etiquette {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gris);
}

/* Trois graduations devant l'étiquette, la dernière en orange : la tête de lecture. */
.etiquette::before {
  content: "";
  width: 13px;
  height: 10px;
  flex: 0 0 auto;
  background:
    linear-gradient(var(--tick-fort), var(--tick-fort)) 0 100% / 1px 60% no-repeat,
    linear-gradient(var(--tick-fort), var(--tick-fort)) 6px 100% / 1px 60% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 12px 100% / 1px 100% no-repeat;
}

/* Le mot-symbole : « Djok » en Archivo élargi. Le point du j est orange : la seconde,
   la plus petite chose que Djok lit. Position mesurée dans la police (largeur 125 %,
   graisse 800), en em : elle suit toutes les tailles. */
.mot {
  position: relative;
  display: inline-block;
  font-family: var(--f-titre);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--encre);
}

.mot::after {
  content: "";
  position: absolute;
  left: 0.948em;
  top: 0.103em;
  width: 0.193em;
  height: 0.134em;
  background: var(--accent);
}

/* ── La règle des secondes ────────────────────────────────────────────── */
.regle {
  height: 12px;
  background-image:
    repeating-linear-gradient(90deg, var(--tick-fort) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size:
    100% 100%,
    100% 50%;
  background-position:
    0 0,
    0 100%;
  background-repeat: no-repeat;
}

.regle.fondue {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}

/* ── Icônes : famille Feather / Lucide, le trait de l'app ─────────────── */
.ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Surfaces ─────────────────────────────────────────────────────────── */
.carte {
  background: var(--carte-fond);
  border: 1px solid var(--filet);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre-carte);
}

/* ── Pastille de domaine : fond = teinte à 14 %, icône dans la teinte ─── */
.pastille {
  --teinte: var(--d-neutre);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--r-pastille);
  background: color-mix(in srgb, var(--teinte) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teinte) 22%, transparent);
  color: var(--teinte);
}

.pastille.petite {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.pastille.petite .ico {
  width: 15px;
  height: 15px;
}

.t-conditions { --teinte: var(--d-conditions); }
.t-programme { --teinte: var(--d-programme); }
.t-ftp { --teinte: var(--d-ftp); }
.t-recuperation { --teinte: var(--d-recuperation); }
.t-poids { --teinte: var(--d-poids); }
.t-forme { --teinte: var(--d-forme); }
.t-charge { --teinte: var(--d-charge); }
.t-fc { --teinte: var(--d-fc); }
.t-materiel { --teinte: var(--d-materiel); }
.t-accent { --teinte: var(--accent-texte); }
.t-neutre { --teinte: var(--d-neutre); }

/* ── Boutons : les quatre niveaux de l'app ────────────────────────────── */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--r-bouton);
  font-family: var(--f-texte);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

/* Plein : UN seul par écran. Texte sombre sur l'orange (6,0:1). */
.bouton.plein {
  background: var(--accent);
  color: var(--plein-texte);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 24px -8px var(--plein-halo);
}

.bouton.plein:hover {
  background: #ff6b42;
  transform: translateY(-1px);
}

.bouton.tonal {
  background: var(--accent-doux);
  color: var(--accent-texte);
  box-shadow: inset 0 0 0 1px var(--accent-filet);
}

.bouton.tonal:hover {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.bouton.fantome {
  color: var(--encre);
  box-shadow: inset 0 0 0 1px var(--filet-fort);
}

.bouton.fantome:hover {
  background: var(--creux);
}

.bouton.petit {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13.5px;
}

/* ── Chips et touches ─────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--filet);
  background: var(--creux);
  color: var(--gris);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

a.chip:hover,
button.chip:hover {
  color: var(--encre);
  border-color: var(--filet-fort);
}

.touche {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--filet-fort);
  background: var(--fond);
  color: var(--gris);
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 10.5px;
  font-weight: 500;
}

/* ── Niveau de preuve : des barres de signal et un mot ────────────────── */
.preuve {
  --c: var(--p-fonct);
  --b1: color-mix(in srgb, var(--c) 30%, transparent);
  --b2: var(--b1);
  --b3: var(--b1);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent);
  color: var(--c);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.preuve::before {
  content: "";
  width: 13px;
  height: 11px;
  flex: 0 0 auto;
  background:
    linear-gradient(var(--b1), var(--b1)) 0 100% / 3px 4px no-repeat,
    linear-gradient(var(--b2), var(--b2)) 5px 100% / 3px 7.5px no-repeat,
    linear-gradient(var(--b3), var(--b3)) 10px 100% / 3px 11px no-repeat;
  border-radius: 1px;
}

.preuve.etaye { --c: var(--p-etaye); --b1: var(--c); --b2: var(--c); --b3: var(--c); }
.preuve.convention { --c: var(--p-convention); --b1: var(--c); --b2: var(--c); }
.preuve.choix { --c: var(--p-choix); --b1: var(--c); }
.preuve.sans { --c: var(--p-sans); }

/* Fonctionnement : aucune science en jeu, donc pas de barres, un tiret. */
.preuve.fonct::before {
  width: 9px;
  height: 2px;
  background: var(--c);
  border-radius: 2px;
}

/* ── Référence scientifique : composée comme dans une revue ───────────── */
.reference {
  font-family: var(--f-source);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
  font-variation-settings: "opsz" 16;
}

.reference i,
.reference em {
  font-style: italic;
}

.reference .id {
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 11.5px;
  color: var(--gris);
  white-space: nowrap;
}

a.id:hover,
.reference a.id:hover {
  color: var(--accent-texte);
}

.type-etude {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--filet-fort);
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gris);
  vertical-align: 2px;
}

/* ── Morceaux de l'app et fiche de règle, communs aux deux sites ─────── */
/* Les jauges de la carte « Carburant du jour » : la valeur, et la fourchette visée. */
.app-carte {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 18px 18px;
}

.app-carte-tete {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.app-carte-tete strong {
  flex: 1;
  font-size: 15px;
}

.app-carte-tete span:last-child {
  font-size: 12px;
  color: var(--gris);
}

.jauge {
  --c: var(--m-glucides);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--filet);
}

.jauge .nom {
  font-size: 13.5px;
  font-weight: 600;
}

.jauge .val {
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 12px;
  color: var(--gris);
}

.jauge .val b {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--encre);
}

.jauge .piste {
  position: relative;
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: var(--creux);
}

.jauge .piste i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--c);
}

/* La fourchette visée : un cadre posé sur la piste. */
.jauge .piste em {
  position: absolute;
  top: -4px;
  bottom: -4px;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
}

.jauge.proteines { --c: var(--m-proteines); }
.jauge.eau { --c: var(--m-boissons); }

/* ── Fiche de règle : repliée, un mot et un énoncé ; dépliée, le fondement ─ */
.fiche-regle {
  border-radius: 14px;
  border: 1px solid var(--filet);
  background: var(--carte-fond);
  box-shadow: var(--ombre-carte);
}

.fiche-regle > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 14px;
  padding: 15px 16px 15px 18px;
  list-style: none;
  cursor: pointer;
  border-radius: 14px;
}

.fiche-regle > summary::-webkit-details-marker {
  display: none;
}

.fiche-regle > summary strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.35;
}

.fiche-regle > summary .ico {
  color: var(--chevron);
  transition: transform 0.2s ease;
}

.fiche-regle[open] > summary .ico {
  transform: rotate(90deg);
}

.fiche-regle:hover {
  border-color: var(--filet-fort);
}

.fiche-corps {
  display: grid;
  gap: 18px;
  padding: 4px 18px 18px;
}

.fiche-corps > p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--texte);
}

.fiche-corps h4 {
  margin: 0 0 8px;
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tertiaire);
}

.fiche-corps .reference + .reference {
  margin-top: 10px;
}

/* La réserve : ce que la source ne dit pas, dans la voix des sources. */
.reserve {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--creux);
  font-family: var(--f-source);
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--texte);
}

.fiche-corps > p.verifie,
.verifie {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding-top: 13px;
  border-top: 1px solid var(--filet);
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 11px;
  color: var(--tertiaire);
}

.verifie .ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--p-etaye);
}

.verifie .ico {
  width: 13px;
  height: 13px;
}

/* Bandeau de maquette : dit ce qui est un exemple, sans se faire passer pour du contenu. */
.note-maquette {
  font-family: var(--f-mesure);
  font-stretch: 88%;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--tertiaire);
}

@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;
  }
}
