/* =========================================================
   schwiizertuetsch.ch : feuille de style unique (piste C3)
   Brief technique, section 5. Conçu d'abord pour le téléphone
   (360 px), puis élargi à partir de 720 px.
   ========================================================= */

/* ---------- 1. Couleurs et mesures (à modifier ici seulement) ---------- */
:root {
  --fond: #FFFFFF;
  --surface: #F5F5F5;        /* zones secondaires */
  --encre: #111111;          /* texte */
  --doux: #555555;           /* texte secondaire */
  --filet: #E4E4E4;          /* filets de 1 px */
  --rouge: #DA291C;          /* rouge suisse : seule couleur d'accent */
  --sur-rouge: #FFFFFF;      /* texte blanc sur le rouge */
  --juste: #1A7F37;
  --juste-fond: #EAF5EC;
  --faux: #DA291C;
  --faux-fond: #FDECEA;

  --police: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --largeur: 1080px;         /* contenu centré */
  --largeur-texte: 680px;    /* textes longs */
  --marge: 22px;             /* marge latérale sur téléphone */
  --coin: 4px;               /* cartes et encadrés */
}

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

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

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

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
}

p { margin: 0; }

a { color: inherit; }

/* Focus clavier toujours visible : contour noir de 2 px */
:focus-visible {
  outline: 2px solid var(--encre);
  outline-offset: 3px;
}

/* Largeur du contenu */
.conteneur {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 var(--marge);
}

.texte-long { max-width: var(--largeur-texte); }

/* Lignes de 70 caractères au plus */
p, li, dd, summary { max-width: 70ch; }

/* ---------- 3. En-tête et menu (pas de menu « hamburger ») ---------- */
.entete {
  border-bottom: 1px solid var(--filet);
}

.entete .conteneur {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.nom-site {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}

.menu ul {
  display: flex;
  flex-wrap: wrap;            /* passe à la ligne sur un petit écran */
  gap: 4px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.menu a { text-decoration: none; }
.menu a:hover { text-decoration: underline; }
.menu a[aria-current="page"] { font-weight: 700; }

/* ---------- 4. Pied de page ---------- */
.pied {
  border-top: 1px solid var(--filet);
  margin-top: 0;
}

.pied .conteneur {
  padding-top: 24px;
  padding-bottom: 32px;
}

.pied ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--doux);
}

.pied a { text-decoration: none; }
.pied a:hover { text-decoration: underline; }

/* ---------- 5. Repères : petits carrés rouges de 18 px ---------- */
.carre {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  background: var(--rouge);
}

.titre-bloc {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 26px;
}

.titre-bloc .carre { margin-top: 0.2em; }

.surtitre {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--doux);
}

/* ---------- 6. Boutons : toujours en pilule ---------- */
.boutons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bouton {
  display: inline-block;
  padding: 13px 22px;
  border: 2px solid var(--encre);
  border-radius: 999px;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.bouton-principal {
  border-color: var(--rouge);
  background: var(--rouge);
  color: var(--sur-rouge);
}

.bouton:hover { text-decoration: underline; }

/* ---------- 7. Sections de page ---------- */
.section {
  padding-top: 44px;
  padding-bottom: 44px;
}

.section-grise {
  background: var(--surface);
  border-top: 1px solid var(--filet);
  border-bottom: 1px solid var(--filet);
}

.pile { display: grid; gap: 18px; }

.lien-fleche { font-weight: 700; }

/* Cartes et encadrés */
.carte {
  background: var(--fond);
  border: 1px solid var(--filet);
  border-radius: var(--coin);
  padding: 20px;
}

/* ---------- 8. Accueil : grands mots ---------- */
.hero {
  padding-top: 40px;
  padding-bottom: 44px;
}

.grands-mots {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grand-mot {
  position: relative;
  display: inline-block;
  font-weight: 700;
  /* La taille suit la largeur de l'écran, pour que « Schwiizerdütsch? »
     tienne toujours sur une ligne (jusqu'à 108 px sur ordinateur). */
  font-size: clamp(30px, calc(10.5vw - 6px), 108px);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  cursor: help;
}

.grand-mot-rouge { color: var(--rouge); }

/* Glose : visible au survol, au toucher et au focus clavier */
.glose {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 2;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--coin);
  background: var(--encre);
  color: var(--fond);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
}

.grand-mot:hover .glose,
.grand-mot:focus .glose,
.grand-mot.glose-ouverte .glose {
  opacity: 1;
  visibility: visible;
}

.traduction-mots {
  margin-top: 14px;
  font-size: 14px;
  color: var(--doux);
}

.hero h1 {
  margin-top: 36px;
  font-size: 36px;
}

.sous-titre {
  margin-top: 18px;
  color: var(--doux);
  max-width: 600px;
}

.hero .boutons { margin-top: 26px; }

.mention {
  margin-top: 12px;
  font-size: 14px;
  color: var(--doux);
}

/* ---------- 9. Accueil : « Ce qui change ici » et étapes ---------- */
.trois-colonnes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.argument h3 {
  font-size: 19px;
  margin-bottom: 8px;
}

.argument p { color: var(--doux); }

.etape {
  border-top: 4px solid var(--encre);
  padding: 18px 18px 0 0;
}

.etape-numero {
  display: block;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--rouge);
  margin-bottom: 10px;
}

.etape p { color: var(--doux); }
.etape strong { color: var(--encre); }

/* ---------- 10. Accueil : FAQ (questions dépliables) ---------- */
.questions { border-bottom: 1px solid var(--filet); }

.questions details {
  border-top: 1px solid var(--filet);
  padding: 16px 0;
}

.questions summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.questions summary::-webkit-details-marker { display: none; }

.questions summary::after {
  content: "+";
  color: var(--rouge);
  font-weight: 700;
}

.questions details[open] summary::after { content: "−"; }

.questions details p {
  margin-top: 10px;
  color: var(--doux);
}

/* ---------- 11. Accueil : nouveautés ---------- */
.nouveautes {
  background: var(--surface);
  border-radius: var(--coin);
  padding: 24px 20px;
}

/* Formulaire d'inscription aux nouveautés (Brevo) */
.form-nouveautes { display: grid; gap: 12px; }

.champ-ligne {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.champ {
  flex: 1 1 220px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--filet);
  border-radius: var(--coin);
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 16px;
}

.champ[aria-invalid="true"] { border-color: var(--faux); }

.form-nouveautes .mention { margin-top: 0; }

.message-form p {
  padding: 12px 14px;
  border-radius: var(--coin);
  font-weight: 700;
}
.message-form p[hidden] { display: none; }
.message-juste-form { color: var(--juste); background: var(--juste-fond); }
.message-erreur-form,
.message-echec-form { color: var(--faux); background: var(--faux-fond); }

/* Texte réservé aux lecteurs d'écran (étiquette du champ) */
.sr-seulement {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Champ-piège anti-robots, invisible (exigé par Brevo) */
.piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- 12. Pages d'exercice ---------- */
.page-exercice h1 { font-size: 32px; }

.situation {
  background: var(--surface);
  border-radius: var(--coin);
  padding: 18px 20px;
}

/* Tableau de la règle : défile sur le côté s'il est trop large */
.tableau-defile {
  overflow-x: auto;
  border: 1px solid var(--filet);
  border-radius: var(--coin);
}

.tableau-regle {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.tableau-regle th,
.tableau-regle td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--filet);
  text-align: left;
  vertical-align: top;
}

.tableau-regle thead th {
  background: var(--surface);
  font-weight: 700;
}

.tableau-regle tbody th {
  font-weight: 700;
  white-space: nowrap;
}

/* Sur téléphone : tableau plus serré */
@media (max-width: 719px) {
  .tableau-regle { font-size: 15px; }
  .tableau-regle th,
  .tableau-regle td { padding: 8px 10px; }
}
.tableau-regle tbody tr:last-child > * { border-bottom: 0; }

.lien-erreur {
  font-size: 15px;
  color: var(--doux);
}

/* Encadré de règle (démonstration de l'accueil) */
.encadre-regle {
  background: var(--surface);
  border-radius: var(--coin);
  padding: 18px 20px;
  display: grid;
  gap: 10px;
}

.encadre-regle h3 { font-size: 17px; }

/* ---------- Textes longs : justifiés, avec césure automatique ----------
   (FAQ, À propos, pages légales, règles des exercices). La césure évite les
   grands blancs entre les mots, surtout sur téléphone ; elle marche parce que
   chaque page est déclarée en français (lang="fr").
   Les paragraphes qui contiennent l'adresse e-mail (classe p-courriel) restent
   alignés à gauche : cette longue adresse écarterait trop les mots de la ligne d'avant. */
.texte-long > p:not(.lien-erreur):not(.mention):not(.texte-manquant):not(.situation):not(.p-courriel),
.questions details p:not(.p-courriel) {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* ---------- 12 ter. Pages de texte (FAQ, À propos, pages légales, 404) ---------- */
.titre-rubrique {
  font-size: 20px;
  margin-top: 14px;
}

/* Repère visible : texte non fourni dans les fichiers */
.texte-manquant {
  padding: 14px 16px;
  border: 2px dashed var(--rouge);
  border-radius: var(--coin);
  color: var(--rouge);
  font-weight: 700;
}

/* ---------- 12 bis. Liste des exercices ---------- */
.titre-liste { font-size: 36px; }

.liste-cartes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.carte-exercice {
  display: grid;
  gap: 8px;
  justify-items: start;
  align-content: start;
}

.carte-notion { font-weight: 700; font-size: 19px; line-height: 1.25; margin-bottom: 8px; }

/* ---------- 13. Moteur des exercices : calme et concentré ---------- */
.moteur {
  border: 1px solid var(--filet);
  border-radius: var(--coin);
  padding: 24px 20px;
}

.question,
.fin {
  display: grid;
  gap: 20px;
}

.question:focus,
.fin:focus { outline: none; }

.compteur {
  font-size: 14px;
  font-weight: 700;
  color: var(--doux);
}

.consigne { color: var(--doux); }

.phrase-trou {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  margin: 8px 0;
}

.trou {
  display: inline-block;
  min-width: 3em;
  color: var(--doux);
  text-align: center;
}

.trou-rempli {
  color: var(--encre);
  border-bottom: 2px solid var(--encre);
}

.trou-juste { color: var(--juste); border-bottom-color: var(--juste); }
.trou-faux  { color: var(--faux);  border-bottom-color: var(--faux); }

.reponses {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reponse {
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--filet);
  border-radius: 999px;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 17px;
  cursor: pointer;
}

/* Réponse sélectionnée : contour noir de 2 px (le padding compense) */
.reponse[aria-pressed="true"] {
  border: 2px solid var(--encre);
  padding: 9px 19px;
}

.reponse:disabled { cursor: default; }

.reponse.reponse-juste {
  border: 2px solid var(--juste);
  padding: 9px 19px;
  background: var(--juste-fond);
  color: var(--juste);
  font-weight: 700;
}

.reponse.reponse-fausse {
  border: 2px solid var(--faux);
  padding: 9px 19px;
  background: var(--faux-fond);
  color: var(--faux);
}

.message:empty { display: none; }

.message {
  padding: 14px 16px;
  border-radius: var(--coin);
  background: var(--surface);
}

.message-juste { background: var(--juste-fond); }
.message-juste strong { color: var(--juste); }
.message-faux { background: var(--faux-fond); }
.message-faux strong { color: var(--faux); }

.ecoute {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--filet);
  padding-top: 18px;
}

.ecoute[hidden] { display: none; }

.ecoute-titre {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--doux);
}

.ecoute-ligne {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ecoute-phrase { font-weight: 700; }

.ecoute-traduction {
  font-size: 15px;
  color: var(--doux);
}

/* Bouton de lecture rond, sans texte : un triangle dessiné en CSS */
.lecture {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--rouge);
  cursor: pointer;
}

.lecture::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -5px;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--sur-rouge);
}

.actions[hidden] { display: none; }

.fin-score {
  font-size: 24px;
  font-weight: 700;
}

/* ---------- 14. Écrans de 720 px et plus ---------- */
@media (min-width: 720px) {
  :root { --marge: 48px; }

  body { font-size: 18px; }

  .section {
    padding-top: 72px;
    padding-bottom: 72px;
  }

  .hero {
    padding-top: 72px;
    padding-bottom: 80px;
  }

  .hero h1 { font-size: 48px; }

  .titre-bloc { font-size: 32px; }

  .trois-colonnes {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
  }

  .carte { padding: 28px; }

  .nouveautes { padding: 36px 40px; }

  .page-exercice h1 { font-size: 44px; }

  .titre-liste { font-size: 48px; }

  .liste-cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

  .moteur { padding: 36px 40px; }

  .phrase-trou { font-size: 28px; }
}

@media (min-width: 1080px) {
  :root { --marge: 64px; }
  .hero h1 { font-size: 54px; }
}

/* Moins d'animations pour qui le demande */
@media (prefers-reduced-motion: reduce) {
  .glose { transition: none; }
}
