/* Calculs et Mesures — feuille unique, sans dépendance extérieure.
   Deux thèmes : clair (crème, encre verte) et sombre, suivant le réglage de l'appareil. */

:root {
  --fond: #fbf8f1;
  --fond-2: #fffdf8;
  --encre: #1d2a24;
  --encre-doux: #4a5a51;
  --filet: #e2dbcc;
  --vert: #2f6b4f;
  --accent: #2f6b4f;
  --pastille: #eaf1ec;
  --alerte: #a33a2a;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #12161b;
    --fond-2: #171d24;
    --encre: #e9e4d8;
    --encre-doux: #a9b3ab;
    --filet: #2a323a;
    --vert: #8fc9a8;
    --accent: #8fc9a8;
    --pastille: #1b2721;
    --alerte: #e08b7a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
}

.saut {
  position: absolute; left: -9999px;
}
.saut:focus {
  left: 12px; top: 12px; z-index: 9; background: var(--fond-2);
  padding: 10px 14px; border: 1px solid var(--filet); border-radius: 6px;
}

.entete {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--filet);
  background: var(--fond-2);
}
.lien-portail {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--encre-doux);
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
}
.lien-portail img { display: block; }

.entete nav { display: flex; flex-wrap: wrap; gap: 16px; }
.entete nav a {
  color: var(--encre); text-decoration: none; font-size: 15px;
  padding: 4px 2px; border-bottom: 2px solid transparent;
}
.entete nav a:hover { border-bottom-color: var(--accent); }
.entete nav a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }

.wrap { max-width: 780px; margin: 0 auto; padding: 40px 22px 10px; }

.sur-titre {
  margin: 0 0 10px; font-size: 11.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--encre-doux);
}
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 5vw, 44px); margin: 0 0 16px; line-height: 1.12; }
.chapeau { font-size: 18.5px; color: var(--encre-doux); margin: 0 0 34px; max-width: 62ch; }

.bloc {
  border: 1px solid var(--filet); border-radius: 12px;
  background: var(--fond-2); padding: 22px 24px; margin: 0 0 22px;
}
h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 14px; }

.liste, .liste-calculs { margin: 0; padding-left: 20px; }
.liste li { margin: 0 0 10px; }
.liste-calculs { list-style: none; padding: 0; }
.liste-calculs li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 0; border-bottom: 1px solid var(--filet);
}
.liste-calculs li:last-child { border-bottom: 0; }
.liste-calculs a { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 18px; }
.liste-calculs a:hover { text-decoration: underline; }
.liste-calculs .detail { color: var(--encre-doux); font-size: 15px; }

.note { color: var(--encre-doux); font-size: 15px; margin: 14px 0 0; }
.alerte {
  border-left: 3px solid var(--alerte); background: var(--fond-2);
  padding: 12px 16px; margin: 0 0 20px; color: var(--encre);
}

.forme { display: grid; gap: 8px; margin: 0 0 24px; max-width: 460px; }
.forme label { font-size: 14px; color: var(--encre-doux); }
.forme input[type="date"],
.forme input[type="text"],
.forme select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--filet);
  border-radius: 8px; background: var(--fond-2); color: var(--encre);
  width: 100%;
}
.forme select { appearance: auto; }
.forme input:focus-visible, .forme select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.forme .deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.forme .deux-colonnes > div { display: grid; gap: 8px; }
.forme .trois-colonnes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.forme .trois-colonnes > div { display: grid; gap: 8px; }
.forme .legende { margin: 0; font-size: 14px; color: var(--encre-doux); }
@media (max-width: 520px) {
  .forme .deux-colonnes, .forme .trois-colonnes { grid-template-columns: 1fr; }
}
.forme button {
  margin-top: 6px; font: inherit; font-weight: 600; cursor: pointer;
  padding: 11px 20px; border: 0; border-radius: 8px;
  background: var(--vert); color: #fff;
}
@media (prefers-color-scheme: dark) { .forme button { color: #10201a; } }

.resultat .grand {
  font-family: var(--serif); font-size: clamp(38px, 7vw, 56px);
  margin: 0 0 12px; line-height: 1;
}
.resultat .unite-grande {
  font-family: var(--sans); font-size: 15px; font-weight: 400;
  color: var(--encre-doux); letter-spacing: .04em;
}
.resultat h3 {
  font-family: var(--serif); font-weight: 600; font-size: 18px;
  margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--filet);
}
.liste .signal { color: var(--alerte); }

/* Tableaux de valeurs (conversions) */
.tableau {
  width: 100%; border-collapse: collapse; margin: 0 0 6px; font-size: 16px;
}
.tableau thead th {
  text-align: left; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--encre-doux); font-weight: 500; padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--filet);
}
.tableau tbody th, .tableau tbody td {
  text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--filet);
  font-weight: 400;
}
.tableau tbody th { color: var(--encre-doux); font-size: 15px; }
.tableau tbody td { font-variant-numeric: tabular-nums; }
.tableau thead th:last-child, .tableau tbody td { text-align: right; }
.tableau tbody tr:last-child th, .tableau tbody tr:last-child td { border-bottom: 0; }
.tableau + .note { margin-top: 18px; }
.tableau .ligne-retenue th, .tableau .ligne-retenue td {
  background: var(--pastille); font-weight: 600; color: var(--encre);
}

/* Accueil : une rubrique et ses calculateurs */
.rubrique-accueil { margin-top: 22px; }
.rubrique-accueil:first-of-type { margin-top: 6px; }
.rubrique-titre {
  margin: 0 0 4px; font-family: var(--serif); font-size: 20px; font-weight: 600;
  display: flex; align-items: baseline; gap: 10px;
}
.rubrique-titre a { color: var(--encre); text-decoration: none; }
.rubrique-titre a:hover { text-decoration: underline; }
.rubrique-titre .compte {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--accent); background: var(--pastille);
  border-radius: 999px; padding: 1px 9px;
}
.sur-titre a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--filet); }
.sur-titre a:hover { border-bottom-color: var(--accent); }

.pied {
  border-top: 1px solid var(--filet); margin-top: 40px;
  padding: 26px 22px 40px; text-align: center; color: var(--encre-doux); font-size: 14.5px;
}
.pied-liens { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.pied a { color: var(--accent); }
.pied-droits { margin: 0; font-size: 13px; }

@media (max-width: 700px) {
  .entete { padding: 12px 16px; }
  .wrap { padding: 28px 16px 8px; }
  .bloc { padding: 18px 16px; }
}
