/*!
 * fdm-ui : design system de francoisdm.fr
 * Source de vérité unique des couleurs, polices, fonds et composants communs.
 * Le plugin francoisdm-tools embarque une copie de ce fichier (générée par build.js)
 * qu'il n'utilise que si le thème actif ne déclare pas add_theme_support( 'fdm-ui' ).
 */

/* ------------------------------------------------------------------
 * 1. Polices auto-hébergées (aucun appel à Google Fonts : RGPD + perf)
 * ------------------------------------------------------------------ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('../fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('../fonts/jetbrains-mono-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ------------------------------------------------------------------
 * 2. Tokens (palette « dark tech »)
 * ------------------------------------------------------------------ */
:root {
  --bg-base: #0a0e1a;
  --bg-deep: #050810;
  --surface-1: rgba(18, 24, 40, 0.55);
  --surface-2: rgba(24, 32, 52, 0.75);
  --surface-hover: rgba(36, 48, 78, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-accent: rgba(99, 179, 237, 0.35);

  --text-primary: #e8eef7;
  --text-secondary: #a4b1c4;
  --text-tertiary: #6b7a90;

  --accent-cyan: #58a6ff;
  --accent-violet: #a78bfa;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f87171;
  --accent-sky: #22d3ee;
  --accent-pink: #f472b6;
  --accent-slate: #94a3b8;
  --glow-cyan: rgba(88, 166, 255, 0.18);
  --glow-violet: rgba(167, 139, 250, 0.15);

  --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
  --shadow-card-hover: 0 4px 8px rgba(0,0,0,0.35), 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px var(--border-accent);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fdm-bg-image: url('../img/portal-bg.webp');
}

/* ------------------------------------------------------------------
 * 3. Base
 * ------------------------------------------------------------------ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background-color: var(--bg-base);
  background-image:
    linear-gradient(180deg,
      rgba(5, 8, 16, 0.92) 0%,
      rgba(10, 14, 26, 0.85) 40%,
      rgba(10, 14, 26, 0.95) 100%),
    var(--fdm-bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Halos lumineux d'ambiance */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--glow-violet) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Grille subtile */
.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Pages « plein écran » avec leur propre décor (compte à rebours de Noël…) */
body.fdm-shell-bare { background-image: none; }
body.fdm-shell-bare::before,
body.fdm-shell-bare::after { display: none; }

img, svg, video, canvas { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.screen-reader-text,
.skip-link:not(:focus) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100000;
  padding: 0.6rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  text-decoration: none;
}

/* ------------------------------------------------------------------
 * 4. Kit de composants (badge, titres de section, bouton retour…)
 *    Actifs seulement sous la classe .fdm-kit : pages classiques du thème et
 *    nouveaux outils déclarés avec 'kit' => true dans le registre. Les outils
 *    migrés gardent leurs propres styles, rien ne déborde sur eux.
 *    :where() = spécificité nulle, le style.css d'un outil l'emporte toujours.
 * ------------------------------------------------------------------ */
:where(.fdm-kit .fdm-tool) {
  display: block;
  position: relative;
  min-height: 100vh;
  padding: 2rem 1rem;
}

/* Carte principale d'un outil */
:where(.fdm-kit .container) {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  margin: 2rem auto;
  padding: 3rem 2.75rem;
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:where(.fdm-kit h1) {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

:where(.fdm-kit .subtitle) {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Badge d'état (« prêt », « recherche »…) */
:where(.fdm-kit .badge) {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border-medium);
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

:where(.fdm-kit .badge .dot) {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all var(--transition);
}

/* Titres de section « ● TITRE ───── » */
:where(.fdm-kit .section-header) {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

:where(.fdm-kit .section-header h2) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

:where(.fdm-kit .section-header)::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-violet);
  box-shadow: 0 0 8px var(--accent-violet);
}

:where(.fdm-kit .section-header)::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-medium) 0%, transparent 100%);
}

/* Lien « ← Retour au portail » */
:where(.fdm-kit .back-button) {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 0.55rem 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  background: var(--surface-1);
  color: var(--text-secondary);
  transition: all var(--transition);
}

:where(.fdm-kit .back-button:hover) {
  background: var(--surface-2);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

:where(.fdm-kit .back-button .arrow) { transition: transform var(--transition); }
:where(.fdm-kit .back-button:hover .arrow) { transform: translateX(-3px); }

@media (max-width: 600px) {
:where(.fdm-kit h1) { font-size: 1.4rem; }
:where(.fdm-kit .container) { padding: 2rem 1.25rem; }
}

/* ------------------------------------------------------------------
 * 5. Impression : fond blanc, sans décor
 * ------------------------------------------------------------------ */
@media print {
  body { background: #fff !important; color: #000; }
  body::before, body::after, .grid-overlay { display: none !important; }
}

/* ------------------------------------------------------------------
 * 6. Accessibilité : réduction des animations
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
