/* ══════════════════════════════════════════════
   shared.css — styles communs à toutes les pages
   ══════════════════════════════════════════════ */

/* ── Tokens couleur ── */
:root {
  --bg:         #f8fafc;
  --fg:         #0f172a;
  --muted:      #64748b;
  --border:     #cbd5e1;
  --border-act: #0f172a;
  --shadow:     rgba(15,23,42,0.12);
  --accent:     #6366f1;   /* indigo-500 */
  --accent-lt:  #e0e7ff;   /* indigo-100 */
  --card-bg:    #ffffff;
  --toggle-bg:  #e2e8f0;
  --toggle-fg:  #0f172a;
  --grid-line:  rgba(99,102,241,0.10);
}
[data-theme="dark"] {
  --bg:         #0f172a;
  --fg:         #f1f5f9;
  --muted:      #94a3b8;
  --border:     #1e293b;
  --border-act: #f1f5f9;
  --shadow:     rgba(0,0,0,0.45);
  --accent:     #818cf8;   /* indigo-400 */
  --accent-lt:  #1e1b4b;   /* indigo-950 */
  --card-bg:    #1e293b;
  --toggle-bg:  #1e293b;
  --toggle-fg:  #f1f5f9;
  --grid-line:  rgba(129,140,248,0.07);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { transition: background .4s ease, color .4s ease; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--fg);
  min-height: 100vh;
  transition: background-color .4s ease, color .4s ease;
}
/* Tout le contenu au-dessus du fond */
body > * { position: relative; z-index: 1; }

/* ── Header ── */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  transition: background .4s ease, border-color .4s ease;
}
#logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
#logo img  { height: 2rem; width: auto; }
#logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--fg);
  transition: color .4s ease;
}
nav { display: flex; gap: 1.75rem; align-items: center; }
nav a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
nav a:hover, nav a.active { color: var(--fg); }

/* ── Dropdown nav ── */
.nav-item { position: relative; display: flex; align-items: center; }
.nav-has-sub > a::after { content: "▾"; font-size: .65em; margin-left: .2em; opacity: .5; }
.nav-sub {
  position: absolute;
  top: calc(100% + .6rem);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: .35rem;
  min-width: 180px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 300;
}
.nav-item:hover .nav-sub {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-sub::before {
  content: "";
  position: absolute;
  top: -.7rem; left: 0; right: 0;
  height: .7rem;
}
.nav-sub a {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .75rem;
  border-radius: .5rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.nav-sub a:hover,
.nav-sub a.active { background: var(--accent-lt); color: var(--accent); }
.nav-sub a.active::before {
  content: "";
  width: .35rem; height: .35rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Toggle ── */
#theme-toggle {
  position: relative;
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  color: var(--toggle-fg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease;
  isolation: isolate;
}
#theme-toggle::before,
#theme-toggle::after {
  content: '';
  position: absolute;
  left: -2px;
  top: -2px;
  border-radius: 50%;
  background: linear-gradient(45deg, #fb0094, #0000ff, #00ff00, #ffff00, #ff0000, #fb0094, #0000ff, #00ff00, #ffff00, #ff0000);
  background-size: 400%;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  z-index: -1;
  opacity: 0.5;
  animation: rainbow 30s linear infinite;
}
#theme-toggle::after {
  filter: blur(8px);
  opacity: 0.25;
}
#theme-toggle:hover { transform: scale(1.1); }
#theme-toggle svg {
  width: 1.05rem; height: 1.05rem;
  stroke: currentColor; fill: none;
  stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
#icon-sun  { display: none; }
#icon-moon { display: block; }
[data-theme="dark"] #icon-sun  { display: block; }
[data-theme="dark"] #icon-moon { display: none; }
@keyframes rainbow {
  0%   { background-position: 0 0; }
  50%  { background-position: 400% 0; }
  100% { background-position: 0 0; }
}

/* ── Page wrapper ── */
main {
  padding-top: 5rem;
  padding-bottom: 4rem;
  max-width: 1024px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ── Page title ── */
.page-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--fg);
  margin-bottom: .5rem;
  transition: color .4s ease;
}
.page-sub {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 3rem;
  transition: color .4s ease;
}

/* ── Back link ── */
.back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color .2s ease;
}
.back:hover { color: var(--accent); }
.back svg {
  width: 1rem; height: 1rem;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
