/* ===== THEME.CSS — Variables & thème global ===== */

/* Open Sans — polices locales (latin-ext couvre fr-CH, accents, ê, é, à…) */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../assets/fonts/open-sans-latin-ext.woff2') format('woff2');
  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: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../assets/fonts/open-sans-latin.woff2') format('woff2');
  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;
}

:root {
  color-scheme: dark;
  --bg:          #09111d;
  --bg2:         #0e1727;
  --bg3:         #172337;
  --surface:     rgba(22, 32, 50, 0.94);
  --surface2:    rgba(28, 41, 63, 0.98);
  --surface3:    rgba(18, 27, 43, 0.90);
  --border:      rgba(148,220,230,0.16);
  --border-strong: rgba(168,234,242,0.28);
  --text:        #f6fbff;
  --text2:       #deebf7;
  --text3:       #b8c7d9;

  --accent:      #5ec4d4;
  --accent-rgb:  94, 196, 212;
  --accent2:     #83bd45;
  --accent3:     #325da9;
  --danger:      #ff7f9d;
  --success:     #83bd45;
  --warning:     #f3c969;

  --gradient:    linear-gradient(135deg, #325da9 0%, #5ec4d4 52%, #83bd45 100%);
  --gradient2:   linear-gradient(135deg, #83bd45 0%, #5ec4d4 45%, #325da9 100%);
  --gradient3:   linear-gradient(135deg, #f3c969 0%, #ff7f9d 100%);
  --glass:       linear-gradient(180deg, rgba(26,38,58,0.96), rgba(15,23,38,0.92));
  --glass-soft:  linear-gradient(180deg, rgba(30,44,68,0.88), rgba(17,26,42,0.82));

  --font-head:   'Open Sans', sans-serif;
  --font-body:   'Open Sans', sans-serif;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --shadow-sm: 0 6px 14px rgba(0,0,0,0.16);
  --shadow-md: 0 10px 24px rgba(0,0,0,0.22);
  --shadow-lg: 0 18px 42px rgba(0,0,0,0.28);
  --shadow-accent: 0 10px 22px rgba(50,93,169,0.14);
  --shadow-green:  0 10px 22px rgba(75,120,45,0.12);
  --neuron-glow: rgba(94,196,212,0.035);
  --neuron-pulse-speed: 5s;
  --synapse-color: rgba(94,196,212,0.07);

  --sidebar-w: 300px;
  --header-h:  96px;

  /* Transitions : rapide pour l'habillage "OS natif" (Win11), base pour le reste du site */
  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
}

/* MODE SOMBRE */
body.dark {
  color-scheme: dark;
  --bg:      #0f1117;
  --bg2:     #161b27;
  --bg3:     #1e2535;
  --surface: #222b3d;
  --surface2:#2a3550;
  --border:  rgba(255,255,255,0.08);
  --text:    #e8edf5;
  --text2:   #c2ccdb;
  --text3:   #8e9bb0;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

/* MODE DYSLEXIE */
body.dyslexia {
  --font-body: 'OpenDyslexic', 'Comic Sans MS', cursive;
  --font-head: 'OpenDyslexic', 'Comic Sans MS', cursive;
  line-height: 1.9;
  letter-spacing: 0.05em;
  word-spacing: 0.15em;
}

/* ACCESSIBILITÉ : Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  transition: none;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  text-shadow: 0 0 0 rgba(0,0,0,0);
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: auto;
  border-radius: 50%;
  pointer-events: none;
  z-index: -2;
  filter: blur(54px);
  opacity: 0.07;
}

body::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: rgba(50,93,169,0.55);
}

body::after {
  width: 360px;
  height: 360px;
  right: -80px;
  bottom: -120px;
  background: rgba(131,189,69,0.45);
}

html::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -3;
  background:
    radial-gradient(circle at 20% 15%, rgba(94,196,212,0.045), transparent 28%),
    radial-gradient(circle at 78% 24%, rgba(50,93,169,0.055), transparent 26%),
    radial-gradient(circle at 62% 78%, rgba(131,189,69,0.04), transparent 24%),
    linear-gradient(180deg, #08111c 0%, #0d1625 48%, #0a111d 100%);
}

body.accessible-ui {
  font-size: 18px;
  line-height: 1.8;
  --bg: #f7f7f4;
  --bg2: #efefe9;
  --bg3: #e5e5dc;
  --surface: #ffffff;
  --surface2: #fbfbf7;
  --border: #cfcfbe;
  --text: #202020;
  --text2: #333333;
  --text3: #5a5a5a;
  --accent: #184a9c;
  --accent-rgb: 24, 74, 156;
  --accent2: #2f7d32;
  --success: #047857;
  --danger: #b91c1c;
  --warning: #a15c00;
}

body.accessible-ui h1,
body.accessible-ui h2,
body.accessible-ui h3 {
  letter-spacing: 0;
  line-height: 1.3;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 1; color: #9de6ef; }

p, li, label, small, strong, span, div {
  text-rendering: optimizeLegibility;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: var(--font-body);
  color: var(--text);
  background: rgba(15, 24, 39, 0.92);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94,196,212,0.10);
}

body.accessible-ui input,
body.accessible-ui textarea,
body.accessible-ui select {
  min-height: 52px;
  padding: 14px 18px;
  font-size: 18px;
  border-width: 2px;
}

/* Mode focus */
.focus-mode-toggle {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid rgba(50,93,169,0.22);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  font: 800 14px/1 var(--font-body);
}

.focus-mode-toggle:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}

.focus-mode-toggle:active {
  transform: translateY(0) scale(0.98);
}

.focus-mode-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.focus-mode-toggle span {
  font-size: 15px;
  line-height: 1;
}

body.focus-mode {
  --sidebar-w: 0px;
}

body.focus-mode .header,
body.focus-mode .floating-header,
body.focus-mode .sidebar,
body.focus-mode .footer {
  display: none;
}

body.focus-mode .layout {
  padding-top: 0;
  padding-left: 0;
}

body.focus-mode .main {
  width: min(100%, 1120px);
  padding: clamp(18px, 3vw, 36px) clamp(14px, 3vw, 36px) 92px;
}

body.focus-mode .landing {
  padding-bottom: 92px;
}

body.focus-mode .landing-grid {
  display: none;
}

body.accessible-ui .focus-mode-toggle {
  min-height: 56px;
  padding: 14px 18px;
  font-size: 16px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Laptop screens (1366px+) */
@media (min-width: 1366px) {
  :root {
    --sidebar-w: 320px;
  }

  body {
    font-size: 16px;
  }

  input, textarea, select {
    padding: 13px 17px;
    font-size: 16px;
  }
}

/* Large PC screens (1920px+) */
@media (min-width: 1920px) {
  :root {
    --sidebar-w: 340px;
    --header-h: 100px;
  }

  body {
    font-size: 17px;
    line-height: 1.65;
  }

  h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
  }

  input, textarea, select {
    min-height: 48px;
    padding: 14px 18px;
    font-size: 17px;
  }

  .focus-mode-toggle {
    min-height: 52px;
    padding: 14px 18px;
    font-size: 15px;
  }
}
