/* ==========================================================================
   Base : reset, typographie, layout, primitives (boutons, badges, focus)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: clip;
}
/* Grain global : donne de la matière aux aplats */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: var(--grain);
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: overlay;
}
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.08;
  text-wrap: balance;
  font-optical-sizing: auto;
}
h1 { font-size: var(--step-4); letter-spacing: -0.032em; line-height: 1.02; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.012em; line-height: 1.2; }
p { text-wrap: pretty; }

code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* --- Accessibilité --- */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 200;
  background: var(--amber); color: var(--amber-ink);
  padding: 0.6rem 1rem; border-radius: var(--radius-s); font-weight: 700;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* --- Layout --- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-pad); position: relative; }
.section--tint { background: var(--bg-raised); border-block: 1px solid var(--line); }

.section-head { max-width: 46rem; margin-bottom: var(--space-7); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--space-4);
  display: flex; align-items: center; gap: 0.75rem;
}
.eyebrow::before { content: ""; width: 2rem; height: 1px; background: currentColor; opacity: 0.7; }
.lead { font-size: var(--step-1); color: var(--text-soft); line-height: 1.6; max-width: 40rem; }
.section-head .lead { margin-top: var(--space-4); }

/* --- Boutons --- */
.btn {
  --_bg: var(--surface-2); --_fg: var(--text); --_bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 3rem; padding: 0.7rem 1.35rem;
  background: var(--_bg); color: var(--_fg);
  border: 1px solid var(--_bd); border-radius: 999px;
  font-weight: 700; font-size: 0.97rem; letter-spacing: 0.005em;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.25s var(--ease), background-color 0.25s, border-color 0.25s, color 0.25s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn--primary { --_bg: var(--amber); --_fg: var(--amber-ink); --_bd: transparent; box-shadow: 0 10px 30px -12px hsl(40 80% 50% / 0.55); }
.btn--primary:hover { --_bg: hsl(40 80% 66%); }
:root[data-theme="light"] .btn--primary:hover { --_bg: var(--amber-strong); }
.btn--ghost { --_bg: transparent; }
.btn--ghost:hover { --_bg: var(--surface-2); }
.btn--sm { min-height: 2.5rem; padding: 0.45rem 1rem; font-size: 0.9rem; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.22rem 0.6rem; border-radius: 0.4rem;
  background: var(--surface-2); color: var(--text-soft);
}
.badge--joueur { background: var(--emerald-soft); color: var(--emerald); }
.badge--mj { background: var(--amber-soft); color: var(--amber); }
.badge--admin { background: var(--ruby-soft); color: var(--ruby); }
.badge--module { background: var(--sky-soft); color: var(--sky); }

kbd.key {
  display: inline-grid; place-items: center; min-width: 1.5rem; padding: 0.05rem 0.4rem;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 0.35rem;
  background: var(--surface); color: var(--text-soft); font-size: 0.78rem;
}

/* --- Reveal au scroll --- */
.reveal { opacity: 0; transform: translateY(1.25rem); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; transform: none; }
}
