/* Shell commun du site tom.prepa.
   Toutes les valeurs viennent de tokens.css. Aucune couleur en dur.
   Parti pris : aretes vives, equerres en signature d'angle, filet or devant les surtitres. */

@import url("tokens.css");

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ── Echelle web, derivee des tokens ── */
:root {
  /* Sur telephone, les bornes basses de ces clamp etaient calees sur des tailles
     d'ecran large : un titre de section a 34 px et 80 px entre chaque section
     transformaient chaque page en interminable colonne a faire defiler. Les
     bornes basses descendent, les hautes ne bougent pas. */
  --titre-xl: clamp(var(--text-3xl), 9vw, calc(var(--text-5xl) * 1.75));
  --titre-l:  clamp(var(--text-2xl), 6.5vw, calc(var(--text-5xl) * 1.1));
  /* La borne basse etait a --text-lg, exactement la taille du corps de texte :
     sur telephone un sous-titre ne se distinguait plus de son paragraphe. */
  --titre-m:  clamp(var(--text-xl), 3vw, var(--text-3xl));
  --corps: var(--text-base);
  --mesure: 62ch;                       /* longueur de ligne maximale du corps */
  --gouttiere: var(--space-4);
  --rythme: var(--space-10);             /* respiration verticale entre sections */
}
@media (min-width: 620px) {
  :root { --gouttiere: var(--space-6); --rythme: var(--space-20); --corps: var(--text-lg); }
}
@media (min-width: 760px) {
  :root { --gouttiere: var(--space-12); --rythme: calc(var(--space-20) * 1.6); }
}

/* ── Socle de page ── */
body {
  font-family: var(--font-corps);
  font-weight: var(--weight-corps);
  font-size: var(--text-base);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--gouttiere); }

.section { padding-block: var(--rythme); }
.section--serre { padding-block: calc(var(--rythme) * 0.55); }
.section--trame {
  background-image:
    linear-gradient(to right, var(--grille) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grille) 1px, transparent 1px);
  background-size: var(--space-10) var(--space-10);
}

/* ── Typographie ──
   Le tracking depend de la taille : un texte grand se lit trop espace, un texte
   petit trop serre. Une seule valeur pour tous les corps est fausse quelque part. */
.titre-xl, .titre-l, .titre-m {
  font-family: var(--font-titre);
  font-weight: 400;
  text-transform: uppercase;
}
.titre-xl { font-size: var(--titre-xl); line-height: 0.88; letter-spacing: -0.012em; }
.titre-l  { font-size: var(--titre-l);  line-height: 0.92; letter-spacing: -0.006em; }
.titre-m  { font-size: var(--titre-m);  line-height: 1.0;  letter-spacing: 0; }
.titre-xl .accent, .titre-l .accent, .titre-m .accent { color: var(--accent-texte); }

.texte { max-width: var(--mesure); font-size: var(--corps); line-height: 1.58; color: var(--text); }
@media (min-width: 620px) { .texte { line-height: 1.65; } }
.texte--faible { color: var(--text-faible); }
.texte + .texte { margin-top: var(--space-5); }

.note { font-family: var(--font-note); font-size: var(--text-xl); color: var(--accent-texte); line-height: 1.2; }

/* Le surtitre porte le filet or du design system. Il annonce, il ne decore pas. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faible);
  margin-bottom: var(--space-5);
}
.eyebrow::before {
  content: "";
  width: var(--space-10);
  height: var(--filet-epaisseur);
  background: var(--accent);
  flex: none;
}

/* ── Equerres : les angles du ring. Deux angles, jamais quatre. ── */
.equerres { position: relative; }
.equerres::before, .equerres::after {
  content: "";
  position: absolute;
  width: var(--space-10);
  height: var(--space-10);
  border: var(--filet-epaisseur) solid var(--accent);
  pointer-events: none;
}
.equerres::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.equerres::after { bottom: 0; right: 0; border-left: none; border-top: none; }

/* ── Boutons. Aretes vives, aucun deplacement au survol. ── */
.cta-or, .cta-fantome {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  text-align: center;
  border-radius: var(--radius-none);
  font-weight: var(--weight-cta);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .1s ease-out;
}
/* Le retour se donne des l'appui : attendre le relachement fait un bouton mort. */
.cta-or:active, .cta-fantome:active { transform: scale(0.97); }
.cta-or { background: var(--accent); color: var(--sur-accent); }
.cta-or:hover, .cta-or:focus-visible { background: var(--accent-survol); }
.cta-fantome { border: 2px solid var(--line); color: var(--text); }
.cta-fantome:hover, .cta-fantome:focus-visible { border-color: var(--accent); color: var(--accent-texte); }

/* ── En-tete ── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) var(--gouttiere);
  background: transparent;
  transition: background-color .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
/* L'en-tete est un materiau, pas un bandeau plein : le contenu defile dessous
   et reste devine a travers. Une barre opaque decoupe l'ecran en deux. */
.site-header.est-defile {
  background: color-mix(in srgb, var(--surface-bas) 68%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom-color: color-mix(in srgb, var(--text) 10%, transparent);
}
@media (prefers-reduced-transparency: reduce) {
  .site-header.est-defile {
    background: var(--surface-bas);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.site-logo { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; }
.site-logo img { width: var(--space-8); height: var(--space-8); }
.site-logo span { font-family: var(--font-corps); font-weight: var(--weight-fort); font-size: var(--text-base); letter-spacing: 0.01em; }

/* Entre le logo et le bouton de menu, il ne reste que quelques centimes de
   largeur sur un telephone : sans nowrap, "Prendre un appel" se casse en deux
   lignes et le bouton double de hauteur. */
/* Sur telephone l'en-tete ne porte plus que le logo et le menu. Le bouton
   d'action descend dans une barre fixe en bas, ou il a la place de dire ce
   qu'il fait en entier : abrege en "Appel" ou "Programme", il n'annoncait plus
   rien. */
@media (max-width: 759px) {
  .site-header { gap: var(--space-3); padding-inline: var(--space-4); }
  .site-header > .cta-or { display: none; }
}

.barre-action {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 98;
  display: flex;
  padding: var(--space-3) var(--gouttiere) calc(var(--space-3) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface-bas) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  transform: translateY(110%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}
.barre-action[data-visible="true"] { transform: translateY(0); }
.barre-action .cta-or { flex: 1; justify-content: center; }
body[data-menu="ouvert"] .barre-action { transform: translateY(110%); }
@media (min-width: 760px) { .barre-action { display: none; } }
@media (prefers-reduced-transparency: reduce) {
  .barre-action { background: var(--surface-bas); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { .barre-action { transition: none; } }

.site-nav { display: none; gap: var(--space-6); }
.site-nav a {
  font-size: var(--text-sm);
  font-weight: var(--weight-ui);
  text-decoration: none;
  color: var(--text-faible);
  padding-bottom: var(--space-1);
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.site-nav a:hover, .site-nav a:focus-visible, .site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
@media (min-width: 760px) { .site-nav { display: flex; } }

/* ── Menu de telephone ──
   Sous 760 px, la navigation etait simplement masquee : on ne pouvait plus
   passer d'une page a l'autre autrement que par le pied de page. Le bouton et
   le panneau sont poses par site.js a partir des liens deja presents dans le
   HTML, pour qu'une seule source alimente les deux affichages. */
.nav-bouton {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--space-10);
  height: var(--space-10);
  padding: var(--space-2);
  flex: 0 0 auto;
}
.nav-bouton span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  transition: transform .18s ease, opacity .18s ease;
}
.nav-bouton[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-bouton[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-bouton[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 760px) { .nav-bouton { display: none; } }

.menu-mobile {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  align-content: center;
  gap: var(--space-2);
  padding: var(--space-16) var(--space-8) var(--space-8);
  background: var(--surface-bas);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.menu-mobile[data-ouvert="true"] { opacity: 1; visibility: visible; }
.menu-mobile a {
  font-family: var(--font-titre);
  font-size: var(--text-3xl);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--line);
}
.menu-mobile a[aria-current="page"] { color: var(--accent-texte); }
.menu-mobile .menu-appel {
  margin-top: var(--space-8);
  font-family: var(--font-corps);
  font-size: var(--text-sm);
  border-bottom: none;
  color: var(--accent-texte);
}
body[data-menu="ouvert"] { overflow: hidden; }
@media (min-width: 760px) { .menu-mobile { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .menu-mobile, .nav-bouton span { transition: none; }
}

/* ── Pied de page ── */
/* Le pied est le seul contenu du site qui ne vit pas dans une carte : il n'a
   donc aucun rembourrage propre et se retrouvait colle aux bords de l'ecran. Il
   prend sa propre marge laterale, plus large que la gouttiere generale. */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-10) var(--space-8); color: var(--text-faible); font-size: var(--text-sm); }
.site-footer .wrap { padding-inline: var(--space-6); }
@media (min-width: 620px) { .site-footer .wrap { padding-inline: var(--space-10); } }
@media (min-width: 1100px) { .site-footer .wrap { padding-inline: var(--gouttiere); } }
@media (min-width: 620px) { .site-footer { padding-block: var(--space-16) var(--space-10); } }
/* La barre d'action flotte au-dessus du bas de page : sans cette reserve, elle
   recouvre les mentions legales, qui sont precisement ce qu'on va y chercher. */
@media (max-width: 759px) {
  /* La barre d'action flotte au-dessus : il faut sa hauteur, plus de quoi
     respirer, sinon la derniere ligne du pied est collee au bouton. */
  .site-footer { padding-bottom: calc(var(--space-20) + var(--space-12) + env(safe-area-inset-bottom)); }
}
.site-footer a { text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--accent-texte); text-decoration: underline; }
/* Sur telephone, chaque groupe prend la largeur entiere et ses liens tiennent
   alors sur UNE ligne. En deux colonnes, "Mentions legales · CGV ·
   Confidentialite" debordait sur deux lignes quand "Instagram · TikTok ·
   Facebook" tenait sur une : deux groupes voisins, deux hauteurs, et un pied
   qui semblait mal fichu. Une colonne, des rangees regulieres. */
.footer-cols { display: grid; grid-template-columns: 1fr; gap: var(--space-8); }
@media (min-width: 960px) {
  .footer-cols { grid-template-columns: 2fr 1fr 1.2fr; gap: var(--space-8); }
}

/* La signature sous la marque, en manuscrit : c'est le seul endroit du site
   ou elle apparait telle quelle. */
.signature-pied {
  font-family: var(--font-note);
  font-size: var(--text-xl);
  color: var(--accent-texte);
  line-height: 1.2;
  margin-top: var(--space-2);
}
.footer-liens { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); line-height: 1.5; }
/* L'adresse mail n'est pas un reseau social : sortie de la liste, elle ne
   pousse plus les trois liens sur une deuxieme ligne. */
.footer-mail { margin-top: var(--space-5); }
/* Un point separe les liens mis en ligne, jamais devant le premier. */
.footer-liens a + a::before { content: "·"; margin-right: var(--space-4); color: var(--text-tres-faible); }
@media (min-width: 960px) {
  .footer-liens { flex-direction: column; gap: var(--space-3); }
  .footer-liens a + a::before { content: none; }
}
.footer-titre { font-size: var(--text-xs); font-weight: var(--weight-ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-tres-faible); margin-bottom: var(--space-5); }

/* ── Plancher de qualite ── */
:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.saut-contenu { position: absolute; left: -9999px; }
.saut-contenu:focus { left: var(--space-4); top: var(--space-4); z-index: 200; padding: var(--space-3) var(--space-5); background: var(--accent); color: var(--sur-accent); }

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