/* ==========================================================================
   OrderTracker — Réinitialisation et éléments de base
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background: var(--surface-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Encoches et barres système sur mobile / PWA installée. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

img,
picture,
svg,
canvas {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--brand);
  text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

h1, h2, h3, h4 {
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 650;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
  text-wrap: pretty;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* --- Accessibilité au clavier -------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: calc(-1 * var(--sp-16));
  z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand);
  color: var(--brand-contrast);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--sp-4);
}

/* Le temps d'appliquer la couleur de l'établissement, toute animation est
   suspendue : la bascule doit être instantanée, pas transitionnée. */
.brand-switching,
.brand-switching *,
.brand-switching *::before,
.brand-switching *::after {
  transition: none !important;
  animation: none !important;
}

/* --- Respect des préférences de mouvement -------------------------------- */

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

/* --- Utilitaires de mise en page ----------------------------------------- */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-16);
}

.page--narrow {
  max-width: var(--page-narrow);
}

.stack > * + * {
  margin-top: var(--gap, var(--sp-4));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, var(--sp-3));
  align-items: center;
}

.cluster--between {
  justify-content: space-between;
}

.cluster--end {
  justify-content: flex-end;
}

.grid-auto {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.hidden {
  display: none !important;
}

/* L'attribut HTML `hidden` ne masque que via la feuille de style du navigateur.
   Toute règle d'auteur définissant `display` l'emporte silencieusement : un
   `element.hidden = true` sur un bloc portant `.auth { display: grid }` n'a
   alors aucun effet visible. On rétablit la priorité attendue. */
[hidden] {
  display: none !important;
}

.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-3);
}

@media (max-width: 640px) {
  .page {
    padding: var(--sp-4) var(--sp-4) var(--sp-12);
  }
}
