/* ==========================================================================
   Robert — identité « bleu nuit, tricolore »
   Bleu nuit pour le cadre (en-tête, ouverture, pied de page), papier chaud
   pour le contenu, bleu et rouge du drapeau en aplats francs. Titres en
   Spectral (fonderie parisienne), interface en Instrument Sans. Surtitres en
   plaques de rue émaillées, boutons à chant épais. Pas de dégradés, pas de halos.
   Thème clair / sombre (suit l'appareil, forçable via data-theme sur <html>).
   ========================================================================== */

:root {
  /* Couleurs du drapeau (fixes) */
  --flag-blue: #2346d4;
  --flag-white: #ffffff;
  --flag-red: #e0233a;
  --ink-950: #070b18;
  --ink-900: #0b1437;
  /* Cadre bleu nuit et plaque de rue (fixes) */
  --night: #0b1437;
  --night-2: #131f52;
  --plaque: #1b3aa8;
  --plaque-edge: #1d6b4f;
  --paper: #f6f3ec;

  /* Thème clair */
  --bg: #ffffff;
  --bg-soft: #f6f3ec;
  --bg-muted: #efebe1;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --surface-3: #f1ede4;
  --overlay: rgba(11, 20, 55, .5);
  --border: #d9d2c2;
  --border-strong: #8a826f;
  --rule: #e6e1d5;
  --text: #0b1437;
  --text-2: #2a3358;
  --muted: #5a6078;
  --faint: #5f6479;
  --primary: #2346d4;
  --primary-hover: #1b38b0;
  --primary-edge: #15298a;
  --primary-soft: #e9edfd;
  --primary-soft-2: #d6defb;
  --on-primary: #ffffff;
  --link: #2346d4;
  /* contour de focus et piste d'interrupteur active (3:1 minimum sur toutes les surfaces) */
  --focus: #2346d4;
  --switch-on: #2346d4;
  --accent: #c41c31;
  --accent-bg: #c91d32;
  --accent-hover: #b01a2c;
  --accent-edge: #9c1425;
  --accent-soft: #fdecee;
  --on-accent: #ffffff;
  --success: #14703a;
  --success-soft: #e6f5ec;
  --warning: #8f5106;
  --warning-soft: #fdf2df;
  --danger: #c81e32;
  --danger-soft: #fdeaec;
  --info: #2346d4;
  --info-soft: #ebefff;
  --ring: rgba(35, 70, 212, .3);
  --shadow-sm: 0 1px 2px rgba(11, 20, 55, .06);
  --shadow: 0 1px 2px rgba(11, 20, 55, .05), 0 6px 16px rgba(11, 20, 55, .07);
  --shadow-lg: 0 2px 4px rgba(11, 20, 55, .05), 0 22px 48px rgba(11, 20, 55, .16);
  --glass: rgba(255, 255, 255, .9);
  --code-bg: #f4f1e9;

  /* Maquette Discord */
  --dc-bg: #ffffff;
  --dc-side: #f2f3f5;
  --dc-embed: #f2f3f5;
  --dc-text: #313338;
  --dc-muted: #5c5e66;
  --dc-name: #060607;
  --dc-blurple: #5865f2;

  /* Typographie */
  --font-display: "Spectral", Georgia, "Times New Roman", serif;
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Formes et rythme */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --maxw: 1200px;
  --header-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --z-header: 50;
  --z-drawer: 60;
  --z-dropdown: 70;
  --z-modal: 80;
  --z-toast: 90;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080f2b;
    --bg-soft: #0b1437;
    --bg-muted: #111c47;
    --surface: #0e1740;
    --surface-2: #131f52;
    --surface-3: #1a2864;
    --overlay: rgba(3, 6, 20, .72);
    --border: #2c3a78;
    --border-strong: #6575c2;
    --rule: #212d63;
    --text: #f3f4fa;
    --text-2: #d2d7ea;
    --muted: #a3abcb;
    --faint: #9aa2c4;
    --primary: #3a5ce6;
    --primary-hover: #4d6df0;    --primary-edge: #2238a8;
    --primary-soft: rgba(95, 128, 255, .14);
    --primary-soft-2: rgba(95, 128, 255, .24);
    --on-primary: #ffffff;
    --link: #8fa6ff;
    --focus: #8fa6ff;
    --switch-on: #4d6df0;
    --accent: #ff6b7a;
    --accent-bg: #c91d32;
    --accent-hover: #d52a40;    --accent-edge: #9c1425;
    --accent-soft: rgba(255, 107, 122, .14);
    --on-accent: #ffffff;
    --success: #5ad18a;
    --success-soft: rgba(90, 209, 138, .12);
    --warning: #f1c04f;
    --warning-soft: rgba(241, 192, 79, .12);
    --danger: #ff7383;
    --danger-soft: rgba(255, 115, 131, .13);
    --info: #8fa6ff;
    --info-soft: rgba(143, 166, 255, .12);
    --ring: rgba(143, 166, 255, .45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 50px rgba(0, 0, 0, .5);
    --glass: rgba(8, 15, 43, .9);
    --code-bg: #0b1437;
    --dc-bg: #313338;
    --dc-side: #2b2d31;
    --dc-embed: #2b2d31;
    --dc-text: #dbdee1;
    --dc-muted: #949ba4;
    --dc-name: #f2f3f5;
    color-scheme: dark;
  }
}

:root[data-theme="dark"], .on-night {
  --bg: #080f2b;
  --bg-soft: #0b1437;
  --bg-muted: #111c47;
  --surface: #0e1740;
  --surface-2: #131f52;
  --surface-3: #1a2864;
  --overlay: rgba(3, 6, 20, .72);
  --border: #2c3a78;
  --border-strong: #6575c2;
  --rule: #212d63;
  --text: #f3f4fa;
  --text-2: #d2d7ea;
  --muted: #a3abcb;
  --faint: #9aa2c4;
  --primary: #3a5ce6;
  --primary-hover: #4d6df0;  --primary-edge: #2238a8;
  --primary-soft: rgba(95, 128, 255, .14);
  --primary-soft-2: rgba(95, 128, 255, .24);
  --on-primary: #ffffff;
  --link: #8fa6ff;
  --focus: #8fa6ff;
  --switch-on: #4d6df0;
  --accent: #ff6b7a;
  --accent-bg: #c91d32;
  --accent-hover: #d52a40;  --accent-edge: #9c1425;
  --accent-soft: rgba(255, 107, 122, .14);
  --on-accent: #ffffff;
  --success: #5ad18a;
  --success-soft: rgba(90, 209, 138, .12);
  --warning: #f1c04f;
  --warning-soft: rgba(241, 192, 79, .12);
  --danger: #ff7383;
  --danger-soft: rgba(255, 115, 131, .13);
  --info: #8fa6ff;
  --info-soft: rgba(143, 166, 255, .12);
  --ring: rgba(143, 166, 255, .45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 50px rgba(0, 0, 0, .5);
  --glass: rgba(8, 15, 43, .9);
  --code-bg: #0b1437;
  --dc-bg: #313338;
  --dc-side: #2b2d31;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-name: #f2f3f5;
  color-scheme: dark;
}

/* --------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16.5px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
}
img, svg, video { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 .5em;
  text-wrap: balance;
  font-feature-settings: "kern", "liga", "lnum";
}
h1 { font-size: clamp(2.5rem, 5.6vw, 4.2rem); line-height: 1.02; letter-spacing: -.025em; }
h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); }
h3 { font-size: 1.18rem; font-family: var(--font-sans); font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h4 { font-size: 1.02rem; font-family: var(--font-sans); font-weight: 650; letter-spacing: -.01em; }
/* Mot souligné d'un trait rouge tracé à la main (remplace l'italique coloré) */
h1 em, h2 em, h3 em {
  font-style: normal; font-weight: inherit; color: inherit; padding-bottom: .1em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 14' preserveAspectRatio='none'%3E%3Cpath d='M3 9c40-5 92-7 146-4 52 3 100 1 148-2' fill='none' stroke='%23e0233a' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 100% / 100% .26em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
p { margin: 0 0 1em; text-wrap: pretty; }
small { font-size: .85em; }
b, strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .9em; }
:not(pre) > code {
  padding: .1em .38em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text-2);
  white-space: nowrap;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: .05em .4em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: .78em;
  text-align: center;
}
pre {
  margin: 0 0 1.2em;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--text-2);
  line-height: 1.55;
  tab-size: 2;
}
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------- Icônes */
.i {
  display: inline-block;
  flex: none;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-sm { width: 1em; height: 1em; }
.i-lg { width: 1.5em; height: 1.5em; }
.i-xl { width: 2em; height: 2em; }

/* --------------------------------------------------------------- Mise en page */
.container { width: min(var(--maxw), 100% - 40px); margin-inline: auto; }
.container-narrow { width: min(820px, 100% - 40px); margin-inline: auto; }
.section { padding-block: clamp(64px, 9vw, 112px); }
.section-sm { padding-block: clamp(40px, 6vw, 64px); }
.section-soft { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section-rule { border-top: 1px solid var(--rule); }
.stack > * + * { margin-top: var(--gap, 1rem); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, .75rem); }
.row { display: flex; align-items: center; gap: var(--gap, .75rem); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap, 20px); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px;
  background: var(--primary); color: var(--on-primary); font-weight: 600; transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* --------------------------------------------------------------- Typographie */
/* Surtitre en plaque de rue : émail bleu, lettres blanches, liseré vert */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 12px 5px;
  border: 2px solid var(--plaque-edge);
  border-radius: 5px;
  background: var(--plaque);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 2px 0 rgba(11, 20, 55, .18);
  color: #fff;
  font: 700 .74rem/1.2 var(--font-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
  transform-origin: 0 50%;
}
.numeral { font-weight: 600; color: var(--accent); }
.lead { font-size: clamp(1.06rem, 1.5vw, 1.2rem); line-height: 1.65; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.xsmall { font-size: .78rem; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); }
.strong { font-weight: 600; }
.text-blue { color: var(--link); }
.text-red { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.caption { margin-top: 12px; color: var(--muted); font: 400 .9rem/1.45 var(--font-sans); }
.caption b { font-style: normal; font-weight: 600; color: var(--text); }

/* --------------------------------------------------------------- Tricolore */
.tricolore {
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--flag-blue) 0 33.33%, var(--flag-white) 33.33% 66.66%, var(--flag-red) 66.66%);
}
.flag {
  display: inline-block;
  width: 1.3em;
  height: .9em;
  vertical-align: -.08em;
  border-radius: 2px;
  background: linear-gradient(90deg, #2346d4 0 33.33%, #ffffff 33.33% 66.66%, #e0233a 66.66%);
  box-shadow: 0 0 0 1px rgba(12, 19, 48, .16);
}
.flag-gb {
  background:
    linear-gradient(90deg, transparent 42%, #c8102e 42% 58%, transparent 58%),
    linear-gradient(transparent 38%, #c8102e 38% 62%, transparent 62%),
    linear-gradient(90deg, transparent 36%, #fff 36% 64%, transparent 64%),
    linear-gradient(transparent 30%, #fff 30% 70%, transparent 70%),
    #012169;
}
.cocarde { width: 34px; height: 34px; flex: none; }

/* --------------------------------------------------------------- Boutons */
/* Boutons à chant épais : ils se soulèvent au survol et s'enfoncent au clic */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-edge: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  box-shadow: 0 2px 0 var(--btn-edge);
  color: var(--btn-fg);
  font: 650 .95rem/1.2 var(--font-sans);
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease), box-shadow .12s var(--ease);
  user-select: none;
}
/* un grand bouton au libellé long ne sort jamais de l'écran : il passe sur deux lignes sur téléphone */
.btn { max-width: 100%; }
@media (max-width: 480px) { .btn-lg { white-space: normal; text-align: center; } }
.btn:hover { background: var(--surface-3); border-color: var(--faint); transform: translateY(-1px); box-shadow: 0 3px 0 var(--btn-edge); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--btn-edge); }
/* Bouton désactivé : gris lisible plutôt qu'une simple transparence (un bouton coloré à moitié transparent sur fond
   sombre devenait un rectangle au texte illisible). */
.btn.btn[disabled], .btn.btn.is-disabled { opacity: 1; cursor: not-allowed; pointer-events: none; background: var(--surface-3); border-color: var(--border); color: var(--muted); box-shadow: none; }
.btn.btn-ghost[disabled], .btn.btn-ghost.is-disabled { background: transparent; border-color: transparent; }
.btn-block:hover, .btn-icon:hover { transform: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-border: var(--primary); --btn-edge: var(--primary-edge); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { --btn-bg: var(--accent-bg); --btn-fg: var(--on-accent); --btn-border: var(--accent-bg); --btn-edge: var(--accent-edge); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ink { --btn-bg: var(--text); --btn-fg: var(--bg); --btn-border: var(--text); --btn-edge: rgba(11, 20, 55, .35); }
.btn-ink:hover { background: var(--text-2); border-color: var(--text-2); }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--link); --btn-border: transparent; --btn-edge: transparent; }
.btn-soft:hover { background: var(--primary-soft-2); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-2); --btn-border: transparent; --btn-edge: transparent; }
.btn-ghost:hover, .btn-soft:hover { transform: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: transparent; --btn-edge: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-discord { --btn-bg: #5865f2; --btn-fg: #fff; --btn-border: #5865f2; --btn-edge: #3c45a5; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .86rem; }
.btn-lg { min-height: 54px; padding: 14px 26px; font-size: 1.04rem; border-radius: 10px; box-shadow: 0 3px 0 var(--btn-edge); }
.btn-lg:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--btn-edge); }
.btn-lg:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-edge); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn .i { width: 1.1em; height: 1.1em; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin .7s linear infinite;
}
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--link); }
.link-arrow .i { transition: transform .18s var(--ease); }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover .i { transform: translateX(3px); }

/* --------------------------------------------------------------- Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: 600 .72rem/1 var(--font-sans);
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge .i { width: .95em; height: .95em; }
.badge-blue { border-color: transparent; background: var(--primary-soft); color: var(--link); }
.badge-red { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.badge-green { border-color: transparent; background: var(--success-soft); color: var(--success); }
.badge-yellow { border-color: transparent; background: var(--warning-soft); color: var(--warning); }
.badge-outline { background: transparent; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.plan-badge { text-transform: uppercase; letter-spacing: .08em; font-size: .64rem; height: 19px; padding: 0 6px; }
.plan-free { color: var(--muted); }
.plan-premium { border-color: var(--accent); color: var(--accent); }
.plan-pro { border-color: var(--primary); color: var(--link); }
.plan-network { border-color: var(--text); color: var(--text); }

/* --------------------------------------------------------------- Cartes */
.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-pad { padding: clamp(18px, 2.4vw, 26px); }
.card-hover { transition: border-color .15s var(--ease); }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
a.card { color: inherit; text-decoration: none; display: block; }
.icon-tile {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--link);
}
.icon-tile .i { width: 20px; height: 20px; }
.icon-tile.red { color: var(--accent); }
.icon-tile.neutral { color: var(--text-2); }
.icon-tile.sm { width: 32px; height: 32px; }
.icon-tile.sm .i { width: 17px; height: 17px; }

/* --------------------------------------------------------------- Formulaires */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-weight: 600; font-size: .92rem; color: var(--text); }
.help { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.error-text { font-size: .82rem; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8e9f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input-group { display: flex; align-items: stretch; }
.input-group > .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.input-icon { position: relative; display: block; }
.input-icon > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.45; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* Interrupteur */
.switch { position: relative; display: inline-flex; align-items: center; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
/* la piste est dessinée après l'input : sans ceci elle capte le clic quand l'interrupteur n'est pas dans un <label> */
.switch-track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong);
  transition: background .15s var(--ease); position: relative;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s var(--ease);
}
.switch input:checked + .switch-track { background: var(--switch-on); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }

/* Segmenté (mensuel / annuel, onglets compacts) */
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.segmented button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 16px;
  border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem;
}
.segmented button[aria-pressed="true"], .segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button .badge { border-color: transparent; background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------------- Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { font-size: .92rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }

/* --------------------------------------------------------------- Encadrés */
.callout {
  display: flex; gap: 12px; padding: 14px 16px; margin: 0 0 1.2em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text-2); line-height: 1.55;
}
.callout > .i { margin-top: 3px; color: var(--info); }
.callout p:last-child { margin-bottom: 0; }
.callout-success { background: var(--success-soft); }
.callout-success > .i { color: var(--success); }
.callout-warning { background: var(--warning-soft); }
.callout-warning > .i { color: var(--warning); }
.callout-danger { background: var(--danger-soft); }
.callout-danger > .i { color: var(--danger); }

/* --------------------------------------------------------------- Divers */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden; background: var(--primary-soft); color: var(--link); font-weight: 650; font-size: .85rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: .7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-green { background: var(--success); }
.dot-red { background: var(--danger); }
.dot-yellow { background: var(--warning); }
.dot-blue { background: var(--primary); }
.divider { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
.progress { height: 6px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width .4s var(--ease); }
.progress.red > span { background: var(--accent-bg); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }

/* Infobulle (au-dessus par défaut, en dessous avec data-tip-pos="bottom") */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  z-index: var(--z-dropdown); width: max-content; max-width: 260px; padding: 6px 9px;
  background: var(--ink-900); color: #fff; font: 500 .78rem/1.35 var(--font-sans); text-align: center; pointer-events: none;
}
[data-tip][data-tip-pos="bottom"]:hover::after, [data-tip][data-tip-pos="bottom"]:focus-visible::after { bottom: auto; top: calc(100% + 8px); }

/* Menus déroulants */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown); min-width: 230px; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg);
  animation: pop .14s var(--ease);
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0;
  background: none; color: var(--text-2); font-size: .92rem; font-weight: 500; text-align: left; text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--surface-3); color: var(--text); }
.menu .menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu a.text-danger, .menu button.text-danger { color: var(--danger); }
.menu a.text-danger:hover, .menu button.text-danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu button:disabled { opacity: .5; cursor: not-allowed; }
.menu .menu-head { padding: 8px 11px 6px; color: var(--muted); font-size: .8rem; }

/* Fenêtres modales */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 20px;
  background: var(--overlay); animation: fade .15s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease);
}
.modal-lg { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2, .modal-head h3 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Notifications */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: grid; gap: 10px; width: min(380px, calc(100% - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
 background: var(--surface); box-shadow: var(--shadow-lg);
  font-size: .92rem; animation: slideup .2s var(--ease);
}

/* Bouton de thème */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: inline-block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* --------------------------------------------------------------- Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } }
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

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

/* Pastille de phase (alpha / bêta) : variante bêta, partagée site + tableau de bord */
.stage-badge.is-beta { background: #d97706; }

/* Cadre bleu nuit : la classe .on-night applique les jetons du thème sombre à un bloc (en-tête, ouverture, pied de page) */
.on-night { color: var(--text); }

/* Robert salue, posé sur le bord supérieur d'une carte (connexion du site et du tableau de bord) */
.card:has(> .card-mascot) { margin-top: 130px; }
.card-mascot { display: block; width: 160px; height: auto; margin: calc(-160px - var(--card-pad, 32px)) auto calc(var(--card-pad, 32px) - 8px); animation: card-mascot-up .7s var(--ease) both; }
@keyframes card-mascot-up { from { opacity: 0; transform: translateY(24px); } }

/* la fenêtre reçoit le focus quand elle n'a aucun champ : pas de contour autour de toute la fenêtre */
.modal[tabindex="-1"]:focus { outline: none; }

/* ==========================================================================
   Mode accessibilité (site public et tableau de bord)
   Posé par js/boot.js avant le premier rendu, changé par js/a11y.js :
   - data-contrast="more" : palette renforcée (mode actif, ou aucun choix et prefers-contrast: more) ;
   - data-a11y="on"       : texte plus grand, liens soulignés, focus épais, sans animation, cibles de 44 px,
                            états écrits en clair à côté des pastilles et des interrupteurs ;
   - data-a11y-font       : police simplifiée (polices système, aucun téléchargement).
   Rien ne change pour qui ne l'active pas.
   ========================================================================== */
:root[data-contrast="more"] {
  --muted: #3d4360;
  --faint: #4a5068;
  --border: #8f8775;
  --border-strong: #5e5848;
  --rule: #8f8775;
  --text-2: #1c2447;
}
@media (prefers-color-scheme: dark) {
  :root[data-contrast="more"]:not([data-theme="light"]) {
    --muted: #c4cae0;
    --faint: #b3bad6;
    --border: #5a6bb8;
    --border-strong: #8a99dd;
    --rule: #5a6bb8;
    --text-2: #e4e7f3;
    --link: #a9bbff;
  }
}
:root[data-contrast="more"][data-theme="dark"], :root[data-contrast="more"] .on-night {
  --muted: #c4cae0;
  --faint: #b3bad6;
  --border: #5a6bb8;
  --border-strong: #8a99dd;
  --rule: #5a6bb8;
  --text-2: #e4e7f3;
  --link: #a9bbff;
}
/* interrupteur éteint : piste assez claire pour que le bouton blanc reste visible (3:1) dans les deux thèmes */
:root[data-contrast="more"] .switch input:not(:checked) + .switch-track { background: var(--border); }

/* Texte plus grand et plus aéré : le texte s'enroule, les tableaux et la matrice défilent dans leur cadre. */
:root[data-a11y="on"] { font-size: 112.5%; }
:root[data-a11y="on"] body { font-size: 18.5px; line-height: 1.75; }
:root[data-a11y="on"] :is(p, li, dd, td, .fld-help) { overflow-wrap: break-word; }
:root[data-a11y="on"] :is(.xsmall, .badge, .side-title, .data-table th, .fld-help, .count-pill, .role-pill, .tabs .count, .side-link .count, .picker-group, .rp-matrix .rp-gh th) { font-size: .875rem; }

/* Liens soulignés (liens de texte, pas les boutons ni la navigation) */
:root[data-a11y="on"] :is(a:not([class]), :is(p, li, td, dd, .fld-help, .callout, .prose, .docs-content) a:not(.btn)) {
  text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px;
}

/* Focus épais partout, y compris là où le contour était retiré */
:root[data-a11y="on"] :focus-visible { outline: 3px solid var(--focus) !important; outline-offset: 2px !important; }
:root[data-a11y="on"] .input:focus, :root[data-a11y="on"] .select:focus, :root[data-a11y="on"] .textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Aucune animation ni transition */
:root[data-a11y="on"] *, :root[data-a11y="on"] *::before, :root[data-a11y="on"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
:root[data-a11y="on"] .reveal { opacity: 1; transform: none; }

/* Cibles d'au moins 44 px */
:root[data-a11y="on"] :is(.btn, .btn-sm, .btn-icon, .tabs button, .md-btn, .notice-close, .banner-close, .segmented button) { min-height: 44px; min-width: 44px; }
:root[data-a11y="on"] .rp-cell { width: 36px; height: 36px; }
:root[data-a11y="on"] .tag button { width: 32px; height: 32px; }
:root[data-a11y="on"] .switch { min-height: 44px; }
@media (max-width: 560px) {
  /* barre du haut du tableau de bord à 360 px : tout tient sur une ligne */
  :root[data-a11y="on"] .app-top .btn { min-width: 40px; min-height: 40px; padding-inline: 6px; }
  :root[data-a11y="on"] .app-top > .dropdown:has(.guild-switch) { max-width: 110px; }
}

/* États écrits en clair : mots cachés à côté des pastilles de couleur, oui / non à côté des interrupteurs */
.status-dot { display: inline-flex; align-items: center; }
:root[data-a11y="on"] .modal[tabindex="-1"]:focus-visible { outline: none !important; }
:root[data-a11y="on"] .sr-only.a11y-visible {
  position: static !important; width: auto; height: auto; margin: 0 0 0 4px; overflow: visible; clip: auto;
  white-space: normal; color: var(--text-2); font-size: .875rem; font-weight: 600;
}
:root[data-a11y="on"] .switch { gap: 8px; }
:root[data-a11y="on"] .switch::after { content: "Non"; color: var(--text-2); font-size: .875rem; font-weight: 700; min-width: 2.2em; }
:root[data-a11y="on"] .switch:has(input:checked)::after { content: "Oui"; }
:root[data-a11y="on"]:lang(en) .switch::after { content: "No"; }
:root[data-a11y="on"]:lang(en) .switch:has(input:checked)::after { content: "Yes"; }

/* Police simplifiée : polices système larges, un peu d'espace entre lettres et mots, pas d'italique */
:root[data-a11y-font="simple"] {
  --font-sans: Verdana, "Segoe UI", Tahoma, Arial, sans-serif;
  --font-display: Verdana, "Segoe UI", Tahoma, Arial, sans-serif;
}
:root[data-a11y-font="simple"] body { letter-spacing: .02em; word-spacing: .06em; }
:root[data-a11y-font="simple"] :is(h1, h2, h3, h4) { letter-spacing: 0; }
:root[data-a11y-font="simple"] :is(em, i, cite) { font-style: normal; font-weight: 600; }

/* Réglages du mode (pied de page et menu mobile du site) */
.a11y-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.a11y-controls p { flex-basis: 100%; margin: 0; font-size: .85rem; opacity: .85; }
.a11y-toggle[aria-pressed="true"] { border-color: currentColor; font-weight: 700; }
.a11y-toggle .a11y-state { font-weight: 700; }
.footer-a11y { padding-block: 0 22px; color: #c9cfe6; }
.footer-a11y a { color: #c9cfe6; text-decoration: underline; text-underline-offset: .18em; }
.mobile-nav-a11y { margin-top: 14px; }
/* Choix à cocher dans un menu (mode accessibilité du menu du compte) : explication sous le libellé, état écrit */
.menu .menu-item-hint { align-items: flex-start; }
.menu .menu-item-hint > .i { margin-top: 3px; }
.menu .menu-item-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.menu .menu-item-text small { max-width: 32ch; color: var(--muted); font-size: .8rem; font-weight: 400; line-height: 1.35; white-space: normal; }
.menu :has(> .menu-check) { white-space: nowrap; }
.menu .menu-check { flex: none; margin-left: auto; padding: 1px 7px; white-space: nowrap; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.menu [aria-checked="true"] .menu-check { border-color: var(--link); background: var(--primary-soft); color: var(--link); }
