/* ─────────────────────────────────────────────────────────────
   Pages guides statiques — Vitality Archetype
   Feuille des pages /{fr|en}/guides/ et /{es|pt}/guias/ générées
   par scripts/build-guides.mjs. Reprend la charte des pages
   légales (public/legal/legal.css) : fond sombre #0A0A0A,
   accents dorés #EAB308, Bebas Neue pour le titre, Geist pour le
   corps, colonne de lecture 720 px max, mobile-first.
   ───────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  /* Accent éditorial : posé en style inline par scripts/build-guides.mjs
     (couleur du group, la même que sur l'image de partage). Ces valeurs
     ne sont que le repli si l'attribut manque. */
  --ga: #EAB308;
  --ga-rgb: 234, 179, 8;
  margin: 0;
  background: #0A0A0A;
  color: rgba(255, 255, 255, 0.72);
  font-family: "Geist", "DM Sans", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

/* Halo discret en haut du viewport, comme les écrans de l'app. Il suit le
   défilement : volontairement plus faible qu'avant, le bandeau de titre
   porte désormais l'essentiel de la lumière et les deux s'ajoutaient. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(var(--ga-rgb), 0.045), transparent 55%);
  pointer-events: none;
}

/* ── Bandeau de titre ────────────────────────────────────────────────
   Le fond de la couverture de partage, refait en CSS : même recette de
   calques que tools/visual-studio/js/background.js, dans le même ordre
   d'empilement (aplat, halo, bulles, grille, vignette, grain, filets).
   D'où le découpage en trois couches : la grille doit passer AU-DESSUS
   des halos mais SOUS la vignette, et elle seule porte un masque.

     .guide-hero          → aplat + halo + bulles
     .guide-hero::before  → grille 60 px, estompée par un masque radial
     .guide-hero::after   → vignette + filets + grain
     .guide-hero-inner    → le texte, au-dessus de tout           */

.guide-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: #0A0A0A;
  background-image:
    radial-gradient(58% 120% at 115% 55%, rgba(var(--ga-rgb), 0.07), transparent 62%),
    radial-gradient(64% 130% at -15% 32%, rgba(var(--ga-rgb), 0.09), transparent 62%),
    radial-gradient(120% 155% at 50% -6%, rgba(var(--ga-rgb), 0.20), rgba(var(--ga-rgb), 0.055) 34%, transparent 68%);
}

.guide-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(90% 150% at 50% 12%, #000, transparent 72%);
  mask-image: radial-gradient(90% 150% at 50% 12%, #000, transparent 72%);
}

/* Le grain (SVG en ligne, aucune requête) n'est pas de la décoration :
   sans lui, un dégradé aussi large que celui-ci fait des cercles
   concentriques visibles sur les écrans 8 bits. */
.guide-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E"),
    linear-gradient(90deg, transparent, rgba(var(--ga-rgb), 0.85) 28%, rgba(var(--ga-rgb), 0.85) 72%, transparent),
    linear-gradient(90deg, transparent, rgba(var(--ga-rgb), 0.45) 26%, rgba(var(--ga-rgb), 0.45) 74%, transparent),
    radial-gradient(130% 95% at 50% 118%, rgba(0, 0, 0, 0.62), transparent 66%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 140px 140px, 100% 2px, 100% 1px, auto;
  background-position: 0 0, 0 0, 0 100%, 0 0;
}

/* Le header vit dans le bandeau : il lui faut sa place au-dessus des
   calques décoratifs, sinon les filets lui passent devant. */
.guide-hero .legal-header { z-index: 2; }

.guide-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(26px, 6vw, 44px) 20px clamp(28px, 6vw, 42px);
}

.guide-eyebrow {
  margin: 0;
  font-family: "Geist Mono", "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ga);
}

/* Le filet court sous le surtitre : le même repère que sur la vignette. */
.guide-eyebrow::after {
  content: "";
  display: block;
  width: 54px;
  height: 3px;
  margin: 13px 0 16px;
  background: var(--ga);
}

.guide-hero h1 {
  font-family: "Bebas Neue", "Geist", Arial, sans-serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 6.4vw, 3.2rem);
  line-height: 1.03;
  letter-spacing: 0.04em;
  margin: 0;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.16);
}

/* ── Header : retour au site + sélecteur de langue ── */

.legal-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 20px 8px;
}

.legal-back {
  color: var(--ga);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.legal-back::before { content: "← "; }

.legal-back:hover { text-decoration: underline; }

.legal-lang {
  display: flex;
  gap: 4px;
}

.legal-lang a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-family: "Geist Mono", "Courier New", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 4px 7px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.legal-lang a:hover {
  color: var(--ga);
  border-color: rgba(var(--ga-rgb), 0.35);
  background: rgba(var(--ga-rgb), 0.08);
}

/* ── Corps ── */

/* Le h1 vit dans le bandeau : la colonne de lecture reprend juste en
   dessous, avec l'air qu'il faut pour ne pas coller au filet. */
.legal-main {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 38px) 20px 72px;
}

.legal-main h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 2.2em 0 0.6em;
  padding-top: 0.5em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.legal-main h3 {
  font-size: 1.02rem;
  line-height: 1.35;
  margin: 1.6em 0 0.5em;
  color: rgba(255, 255, 255, 0.92);
}

.legal-main p { margin: 0 0 1em; }

.legal-main ul,
.legal-main ol {
  margin: 0 0 1.1em;
  padding-left: 1.25em;
}

.legal-main li { margin: 0 0 0.45em; }

.legal-main li::marker { color: rgba(234, 179, 8, 0.7); }

.legal-main strong { color: #ffffff; font-weight: 700; }

.legal-main a { color: #EAB308; }

.legal-main em { color: rgba(255, 255, 255, 0.5); }

/* Chapeau du hub : la colonne de texte reste plus courte que le titre,
   pour ne pas transformer le bandeau en paragraphe. */
.guide-hero-lede {
  max-width: 54ch;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 1rem;
}

/* ── Byline (auteur + date de mise à jour) ── */

.guide-byline {
  margin: 18px 0 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

/* ── Bouton CTA ── */

.guide-cta {
  margin: 2.4em 0 1.2em;
  text-align: center;
}

.guide-cta-btn {
  display: inline-block;
  background: #EAB308;
  color: #0A0A0A !important;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 14px 30px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 0 24px rgba(234, 179, 8, 0.25);
}

.guide-cta-btn:hover { filter: brightness(1.08); }

/* ── Maillage interne « À lire aussi » ── */

.guide-related {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-related h2 {
  border-top: none;
  padding-top: 0;
  margin: 0 0 0.8em;
  font-size: 1.05rem;
}

.guide-related ul {
  list-style: none;
  padding-left: 0;
}

.guide-related li { margin: 0 0 0.6em; }

.guide-related li a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.guide-related li a:hover { color: #EAB308; text-decoration: underline; }

.guide-all { margin-top: 1.2em; font-size: 0.9rem; }

.guide-all a { text-decoration: none; }

.guide-all a:hover { text-decoration: underline; }

/* ── Section FAQ (accordéon, même pattern que les pages FAQ légales) ── */

.guide-faq h2 {
  margin-bottom: 0.9em;
}

.faq-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item > summary::-webkit-details-marker { display: none; }

.faq-item > summary h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: #ffffff;
}

.faq-item > summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s;
  opacity: .6;
  flex: 0 0 auto;
}

.faq-item[open] > summary::after { transform: rotate(-135deg); }

.faq-answer { padding: 0 18px 4px; }

/* ── Template programme : listes semaine par semaine en cartes ── */

.tpl-programme .guide-body > ul {
  list-style: none;
  padding-left: 0;
}

.tpl-programme .guide-body > ul > li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 10px;
}

.tpl-programme .guide-body li strong { color: #EAB308; }

/* ── Hub (index des guides par langue) ── */

.tpl-hub h2 {
  border-top: none;
  padding-top: 0;
  margin: 2.4em 0 0.9em;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #EAB308;
}

/* La première section suit directement le bandeau : sa marge haute de
   respiration ferait un trou. */
.tpl-hub .legal-main > section:first-of-type h2 { margin-top: 0.4em; }

.hub-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1.4em;
}

.hub-list li { margin: 0 0 10px; }

.hub-list a {
  display: block;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
}

.hub-list a:hover { border-color: rgba(234, 179, 8, 0.4); }

.hub-item-title {
  display: block;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 4px;
}

.hub-item-desc {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ── Tableaux du corps d'article ──────────────────────────────────────
   Aucun style n'existait : les pages calculette (template `outil`) posent
   des tableaux de repères dans le markdown, et un tableau non stylé sur
   fond sombre est illisible. Le conteneur défile horizontalement plutôt
   que d'élargir la page : la colonne de lecture reste à 720 px et le
   <body> ne défile JAMAIS latéralement. */

.guide-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.guide-body table thead th {
  text-align: left;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.guide-body table td,
.guide-body table tbody th {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-weight: 400;
}

.guide-body table tbody th { color: #ffffff; font-weight: 600; }
.guide-body table tbody tr:last-child td,
.guide-body table tbody tr:last-child th { border-bottom: none; }

/* ── Widget calculette ────────────────────────────────────────────────
   scripts/guide-calculators.mjs. Fonctionne sans JavaScript au sens où la
   page reste lisible : le widget se contente alors de ne rien calculer,
   les tableaux de repères du markdown portent l'information. */

.va-calc {
  margin: 2em 0 2.4em;
  padding: 18px;
  border: 1px solid rgba(var(--ga-rgb), 0.28);
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 50% -20%, rgba(var(--ga-rgb), 0.07), transparent 70%),
    rgba(255, 255, 255, 0.02);
}

.va-calc fieldset {
  border: none;
  margin: 0 0 14px;
  padding: 0;
}

.va-calc fieldset:last-of-type { margin-bottom: 0; }

.va-calc legend {
  padding: 0;
  color: var(--ga);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.va-calc-row,
.va-calc-grid { display: grid; gap: 12px; }
.va-calc-row { grid-template-columns: 1fr; }
/* `align-items: end` cale les champs sur le bas de leur rangée. Sans ça, un
   libellé qui passe sur deux lignes (« Burpee Broad Jump 80 m » sur mobile)
   décale son champ vers le bas et désaligne la rangée entière. */
.va-calc-grid { grid-template-columns: 1fr 1fr; align-items: end; }

.va-calc-field { display: block; }

.va-calc-field > span {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.82rem;
  margin-bottom: 5px;
}

.va-calc input,
.va-calc select {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  min-height: 44px;
}

.va-calc input:focus,
.va-calc select:focus {
  outline: 2px solid rgba(var(--ga-rgb), 0.6);
  outline-offset: 1px;
  border-color: rgba(var(--ga-rgb), 0.6);
}

.va-calc-time { display: flex; align-items: center; gap: 6px; }
.va-calc-time input { width: 100%; min-width: 0; text-align: center; }
.va-calc-time span { color: rgba(255, 255, 255, 0.4); font-size: 0.82rem; }

.va-calc-msg {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.88rem;
}

.va-calc-out { margin-top: 6px; }

.va-calc-out h3 {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 20px 0 0;
  border: none;
  padding: 0;
}

.va-calc-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(var(--ga-rgb), 0.1);
}

.va-calc-total > span { color: rgba(255, 255, 255, 0.65); font-size: 0.88rem; }

.va-calc-total > strong {
  color: var(--ga);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.va-calc-scroll { overflow-x: auto; }

.va-calc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 0;
  font-size: 0.92rem;
  white-space: nowrap;
}

.va-calc-table thead th {
  text-align: left;
  color: rgba(255, 255, 255, 0.42);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 12px 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.va-calc-table td,
.va-calc-table tbody th {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.va-calc-table tbody th { color: rgba(255, 255, 255, 0.82); font-weight: 500; white-space: normal; }
.va-calc-table tbody tr.is-ref th,
.va-calc-table tbody tr.is-ref td { color: var(--ga); font-weight: 600; }
.va-calc-table tbody tr.is-station th { color: #ffffff; font-weight: 600; }

@media (min-width: 620px) {
  .va-calc { padding: 22px 24px; }
  .va-calc-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ── Sélecteur d'unité ────────────────────────────────────────────────
   Rendu uniquement pour les 5 calculettes que l'audit désigne (CALC_UNITS
   dans src/lib/calculators.mjs). Il vit DANS la calculette, entre la légende
   et les champs, pour être visiblement rattaché à ce qu'il change. */

.va-calc-units {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.va-calc-units > span {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.va-calc-units button {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.va-calc-units button[aria-pressed="true"] {
  background: rgba(var(--ga-rgb), 0.16);
  border-color: rgba(var(--ga-rgb), 0.5);
  color: var(--ga);
}

.va-calc-units button:focus-visible {
  outline: 2px solid rgba(var(--ga-rgb), 0.6);
  outline-offset: 1px;
}
