/* Anonari Apps — Base : reset, typographie, éléments HTML natifs.
   Ne consomme que les tokens (tokens.css). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ax-bg);
  color: var(--ax-ink);
  font-family: var(--ax-font);
  font-size: var(--ax-fs-body);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
h1 { font-size: var(--ax-fs-h1-page); font-weight: var(--ax-fw-strong); letter-spacing: var(--ax-tracking-tight); line-height: 1.1; }
h2 { font-size: var(--ax-fs-h2); font-weight: var(--ax-fw-semi); line-height: 1.3; }
h3 { font-size: var(--ax-fs-ui); font-weight: var(--ax-fw-semi); line-height: 1.35; }
p, li { text-wrap: pretty; }
strong, b { font-weight: var(--ax-fw-strong); }

a { color: var(--ax-link); text-underline-offset: 2px; }
a:hover { color: var(--ax-link-hover); }

/* Focus toujours visible au clavier. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ax-focus); outline-offset: 2px; border-radius: var(--ax-r-xs); }

code, kbd, samp, .ax-mono {
  font-family: var(--ax-font-mono);
  font-size: .86em;
  font-weight: 500;
}
code {
  background: var(--ax-fill-soft);
  border-radius: 4px;
  padding: 1px 5px;
  word-break: break-word;
}
pre {
  margin: 0;
  overflow-x: auto;
  background: var(--ax-bg-sunken);
  border: 1px solid var(--ax-line);
  border-radius: var(--ax-r-md);
  padding: var(--ax-s3);
  font: 500 12px/1.5 var(--ax-font-mono);
}
pre code { background: none; padding: 0; }

ul, ol { padding-left: 1.2em; }
li + li { margin-top: var(--ax-s1); }

hr { border: 0; border-top: 1px solid var(--ax-line); margin: var(--ax-s5) 0; }

/* ── Formulaires ─────────────────────────────────────────────────────────── */
label { display: block; font-size: var(--ax-fs-label); font-weight: var(--ax-fw-medium); color: var(--ax-ink-2); }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  min-height: var(--ax-control-h);
  margin-top: var(--ax-s1);
  padding: 8px 12px;
  background: var(--ax-surface);
  border: 1px solid var(--ax-line-strong);
  border-radius: var(--ax-r-md);
  font-size: var(--ax-fs-ui);
  color: var(--ax-ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ax-focus);
  outline-offset: 1px;
  border-color: var(--ax-focus);
}
input::placeholder, textarea::placeholder { color: var(--ax-faint); }
input[type=checkbox], input[type=radio] { accent-color: var(--ax-action); width: 16px; height: 16px; }
fieldset { border: 1px solid var(--ax-line); border-radius: var(--ax-r-lg); padding: var(--ax-s3) var(--ax-s4); margin: var(--ax-s3) 0; }
legend { padding: 0 var(--ax-s1); font-size: var(--ax-fs-label); font-weight: var(--ax-fw-semi); }
details > summary { cursor: pointer; color: var(--ax-muted); font-size: var(--ax-fs-label); }
details > summary:hover { color: var(--ax-ink); }

/* ── Tableaux natifs (runtime à blocs, Designer) ─────────────────────────── */
table { border-collapse: collapse; width: 100%; font-size: var(--ax-fs-label); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ax-line-soft); vertical-align: top; }
th { background: var(--ax-bg); color: var(--ax-muted); font-size: var(--ax-fs-xs); font-weight: var(--ax-fw-semi); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: var(--ax-fs-label); }
dt { color: var(--ax-muted); }
dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ── Utilitaires typographiques (conservés : utilisés par toutes les vues) ── */
.muted { color: var(--ax-muted); }
.small { font-size: var(--ax-fs-small); }
.lead  { font-size: var(--ax-fs-lead); color: var(--ax-muted); }
.err   { color: var(--ax-negative-ink); }
.ax-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
  dl { grid-template-columns: 1fr; }
  dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
