/* Base du logiciel : remise à zéro sobre, corps de page, styles de texte, classes utilitaires, focus visible.
   Aucune couleur, aucun rayon, aucune taille de texte ici : tout vient de jetons.css. */

/* --- Remise à zéro --- */

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

* {
  scrollbar-width: thin;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--tz-fond);
  scrollbar-color: var(--tz-separateur-fort) transparent;
}

/* La taille de base (17 px) est posée sur le corps : la racine reste à 16 px, les jetons de taille sont en rem. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--tz-fond);
  color: var(--tz-texte);
  font-family: var(--tz-police);
  font-size: var(--tz-taille-corps);
  line-height: 1.29;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.21;
}

h1 {
  font-size: var(--tz-taille-titre-1);
}

h2 {
  font-size: var(--tz-taille-titre-2);
  line-height: 1.27;
}

h3 {
  font-size: var(--tz-taille-titre-3);
  font-weight: 600;
  line-height: 1.25;
}

h4,
h5,
h6 {
  font-size: var(--tz-taille-corps);
  font-weight: 600;
  line-height: 1.29;
}

ul,
ol {
  margin: 0;
  padding-inline-start: var(--tz-espace-5);
}

small {
  font-size: var(--tz-taille-note);
}

code,
kbd,
samp,
pre {
  font-family: var(--tz-police-mono);
  font-size: var(--tz-taille-annexe);
}

a {
  color: var(--tz-accent-texte);
  text-decoration: none;
}

/* Un lien nu dans un texte se reconnaît autrement que par sa seule couleur. */
:where(p, li, dd, td) > a:not([class]) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img,
video {
  max-width: 100%;
  height: auto;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--tz-separateur);
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--tz-accent-fond);
}

/* Barres de défilement discrètes (moteurs WebKit sans scrollbar-color). */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: var(--tz-rayon-capsule);
    background: var(--tz-separateur-fort);
    background-clip: padding-box;
  }
}

/* --- Focus visible : un anneau net au clavier, rien au toucher ni au pointeur --- */

:focus-visible {
  outline: 3px solid var(--tz-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --- Coque de page --- */

/* L'application occupe tout l'écran ; ce qui la remplit (coque, écrans de session) gère ses propres zones sûres.
   Contexte d'empilement à part : les surcouches, posées après elle dans la page, passent toujours devant. */
.tz-app {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Lien d'évitement : hors de l'écran tant qu'il n'a pas le focus, puis capsule de verre en haut de page. */
.tz-evitement {
  position: fixed;
  z-index: 1000;
  top: calc(var(--tz-zone-haut) + var(--tz-espace-2));
  left: calc(var(--tz-zone-gauche) + var(--tz-espace-2));
  display: inline-flex;
  align-items: center;
  min-height: var(--tz-cible);
  padding: var(--tz-espace-2) var(--tz-espace-5);
  border: 1px solid var(--tz-verre-bord);
  border-radius: var(--tz-rayon-capsule);
  background: var(--tz-verre-fort);
  -webkit-backdrop-filter: var(--tz-verre-flou);
  backdrop-filter: var(--tz-verre-flou);
  box-shadow: var(--tz-verre-ombre);
  color: var(--tz-accent-texte);
  font-weight: 600;
  opacity: 0;
  transform: translateY(calc(-100% - var(--tz-zone-haut) - var(--tz-espace-7)));
  transition: transform var(--tz-duree) var(--tz-courbe), opacity var(--tz-duree) var(--tz-courbe);
}

.tz-evitement:focus {
  opacity: 1;
  transform: none;
}

/* Message sans JavaScript : centré sur l'écran, devant l'application restée vide. */
.tz-sans-script {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 32rem);
  place-content: center;
  margin: 0;
  padding: calc(var(--tz-zone-haut) + var(--tz-espace-5)) calc(var(--tz-zone-droite) + var(--tz-espace-5)) calc(var(--tz-zone-bas) + var(--tz-espace-5)) calc(var(--tz-zone-gauche) + var(--tz-espace-5));
  text-align: center;
}

/* --- Styles de texte : tailles, graisses accentuées et interlignes d'iPadOS (Large Title à Caption 1) --- */

.tz-grand-titre {
  font-size: var(--tz-taille-grand-titre);
  font-weight: 700;
  line-height: 1.21;
  text-wrap: balance;
}

.tz-titre-1 {
  font-size: var(--tz-taille-titre-1);
  font-weight: 700;
  line-height: 1.21;
  text-wrap: balance;
}

.tz-titre-2 {
  font-size: var(--tz-taille-titre-2);
  font-weight: 700;
  line-height: 1.27;
}

.tz-titre-3 {
  font-size: var(--tz-taille-titre-3);
  font-weight: 600;
  line-height: 1.25;
}

.tz-corps {
  font-size: var(--tz-taille-corps);
  font-weight: 400;
  line-height: 1.29;
}

.tz-annexe {
  font-size: var(--tz-taille-annexe);
  line-height: 1.33;
}

.tz-note {
  font-size: var(--tz-taille-note);
  line-height: 1.38;
}

.tz-legende {
  font-size: var(--tz-taille-legende);
  line-height: 1.33;
}

.tz-mono {
  font-family: var(--tz-police-mono);
  font-variant-numeric: tabular-nums;
}

.tz-texte-2 {
  color: var(--tz-texte-2);
}

/* Décor seulement : ce gris ne tient pas le contraste d'un texte à lire. */
.tz-texte-3 {
  color: var(--tz-texte-3);
}

/* --- Disposition --- */

.tz-pile {
  display: flex;
  flex-direction: column;
  gap: var(--tz-espace-4);
}

.tz-rangee {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tz-espace-3);
}

.tz-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: var(--tz-espace-4);
}

/* Un enfant ne déborde pas de sa colonne ou de sa rangée : son contenu passe à la ligne. */
.tz-pile > *,
.tz-rangee > *,
.tz-grille > * {
  min-width: 0;
}

/* Variantes d'espacement, à poser avec tz-pile, tz-rangee ou tz-grille. */
.tz-serre {
  gap: var(--tz-espace-2);
}

.tz-large {
  gap: var(--tz-espace-6);
}

/* Repousse à la fin : à droite dans une rangée, en bas dans une pile. */
.tz-pousse {
  margin-inline-start: auto;
}

.tz-pile > .tz-pousse {
  margin-inline-start: 0;
  margin-block-start: auto;
}

/* Visible des seuls lecteurs d'écran. */
.tz-masque {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
