/* eNDAMBO — styles communs. Mobile d'abord. Tout le monde utilise ces variables ;
   ne pas écrire de couleurs en dur dans les modules. */

:root {
  --bg: #08130f;
  --surface: #0f211a;
  --surface-2: #153027;
  --border: #21423a;
  --text: #e9f3ee;
  --muted: #9bb5aa;
  --primary: #34c46a;
  --primary-ink: #04140b;
  --accent: #f2b705;
  --danger: #ff7b7b;
  --info: #5aa9ff;

  --radius: 12px;
  --gap: 1rem;
  --topbar-h: 56px;
  --nav-w: 220px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.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;
}
.muted { color: var(--muted); }

/* ---------- Structure ---------- */
.app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.brand__sub { color: var(--primary); letter-spacing: .25em; font-size: .75rem; }
.lang select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .4rem .6rem; font: inherit; min-height: 40px;
}

main { padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); min-width: 0; }
main:focus { outline: none; }

/* Navigation : en bas sur téléphone, à gauche dès la tablette */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .75rem;
}
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--primary); }

@media (min-width: 768px) {
  .app { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: var(--topbar-h);
    height: calc(100dvh - var(--topbar-h)); align-self: start;
    flex-direction: column; justify-content: flex-start; gap: 2px;
    border-top: 0; border-right: 1px solid var(--border);
    padding: 1rem .5rem;
  }
  .nav a {
    flex: none; flex-direction: row; justify-content: flex-start;
    gap: .75rem; padding: .6rem .8rem; border-radius: 10px; font-size: 1rem;
  }
  .nav a[aria-current="page"] { background: var(--surface-2); }
  main { padding: 1.5rem 2rem 2rem; }
}
@media (min-width: 1100px) {
  main > * { max-width: 1100px; }
}

/* ---------- Composants ---------- */
.stack > * + * { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--2, .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.card--active { border-color: var(--primary); }
.card--soon { opacity: .75; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1rem;
  background: var(--primary); color: var(--primary-ink);
  border: 0; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px;
  font-size: .8rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.badge--ok { color: var(--primary); border-color: var(--primary); }
.badge--warn { color: var(--accent); border-color: var(--accent); }

.notice {
  padding: .75rem 1rem; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
}
.notice--demo { border-color: var(--accent); }
.notice--error { border-color: var(--danger); color: var(--danger); }

.field { display: grid; gap: .25rem; max-width: 20rem; }
.field label { color: var(--muted); font-size: .9rem; }
.field select, .field input {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .6rem; font: inherit; min-height: 44px;
}

.swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--border); vertical-align: middle; margin-right: 3px;
}

/* Tableaux : défilement horizontal, ou lignes empilées sur petit écran avec .table--stack */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .85rem; background: var(--surface); }
tr:last-child td { border-bottom: 0; }

@media (max-width: 639px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: block; padding: .5rem .8rem; border-bottom: 1px solid var(--border); }
  .table--stack tr:last-child { border-bottom: 0; }
  .table--stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem 0; }
  .table--stack td::before { content: attr(data-label); color: var(--muted); }
}

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