/* ============================================================
   OBI+ — Base de connaissances sur les dépendances psychiques
   Feuille de styles
   Thème : imagerie cérébrale IRM · phosphore vert · terminal
           médical · monitoring neurologique chaud
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;1,300&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=Bebas+Neue&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg-core:       #050906;
  --bg-panel:      #080e0a;
  --bg-card:       #0a1410;
  --bg-card-hi:    #0d1a14;
  --green-hot:     #00ff88;
  --green-mid:     #00c96a;
  --green-dim:     rgba(0,255,136,.12);
  --green-trace:   rgba(0,255,136,.06);
  --amber:         #ffb830;
  --amber-dim:     rgba(255,184,48,.12);
  --red-alert:     #ff3d3d;
  --red-dim:       rgba(255,61,61,.12);
  --white-bright:  #d8f0e4;
  --white-body:    #8ab09a;
  --white-muted:   #3a5044;
  --border-lo:     rgba(0,255,136,.09);
  --border-mid:    rgba(0,255,136,.22);
  --border-hi:     rgba(0,255,136,.5);
  --glow-green:    0 0 18px rgba(0,255,136,.3);
  --glow-amber:    0 0 16px rgba(255,184,48,.35);
  --font-mono:     'IBM Plex Mono', monospace;
  --font-display:  'Bebas Neue', sans-serif;
  --font-body:     'DM Sans', sans-serif;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Corps ───────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  font-size: .97rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--white-body);
  background: var(--bg-core);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grain phosphore */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 110% 70% at 50% -5%,
    rgba(0,255,136,.07) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Scanlines légères */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 3px,
    rgba(0,0,0,.06) 3px, rgba(0,0,0,.06) 4px
  );
  pointer-events: none;
  z-index: 9990;
}

/* ── Canvas IRM cerveau fond ─────────────────────────────── */
#brain-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .4;
}

/* ── Barre de lecture ─────────────────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--green-mid), var(--green-hot));
  box-shadow: 0 0 8px var(--green-hot);
  z-index: 9999;
  transition: width .08s linear;
}

/* ── Toast notification ──────────────────────────────────── */
#obi-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-left: 3px solid var(--green-hot);
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--green-mid);
  letter-spacing: .08em;
  border-radius: 3px;
  z-index: 9000;
  transform: translateY(80px);
  opacity: 0;
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .4s;
  box-shadow: var(--glow-green);
  pointer-events: none;
}
#obi-toast.show { transform: translateY(0); opacity: 1; }

/* ── Layout ──────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 24px 90px;
}

/* ── Header ──────────────────────────────────────────────── */
.page-header {
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border-lo);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 22px;
}

/* Logo OBI+ */
.logo-mark {
  font-family: var(--font-display);
  font-size: 3.4rem;
  letter-spacing: .06em;
  color: var(--green-hot);
  line-height: 1;
  text-shadow: var(--glow-green);
  position: relative;
  flex-shrink: 0;
  animation: logoIn .9s cubic-bezier(.22,1,.36,1) both;
}
.logo-mark sup {
  font-size: 1.2rem;
  color: var(--amber);
  text-shadow: var(--glow-amber);
  vertical-align: super;
  margin-left: -4px;
}
@keyframes logoIn {
  from { opacity:0; transform: scale(.7) rotate(-6deg); }
  to   { opacity:1; transform: none; }
}

.header-desc {
  flex: 1;
}
.header-desc h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.6rem);
  letter-spacing: .07em;
  color: var(--white-bright);
  line-height: 1.15;
  animation: slideUp .7s .15s ease both;
}
.header-desc p {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  color: var(--white-muted);
  text-transform: uppercase;
  margin-top: 8px;
  animation: slideUp .7s .3s ease both;
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: none; }
}

/* Stats rapides */
.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  animation: slideUp .7s .45s ease both;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-lo);
  padding: 8px 16px;
  border-radius: 3px;
  transition: border-color .25s;
}
.stat-pill:hover { border-color: var(--border-mid); }
.stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--green-hot);
  line-height: 1;
  text-shadow: var(--glow-green);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .1em;
  color: var(--white-muted);
  text-transform: uppercase;
  line-height: 1.3;
}

/* Ligne EEG header */
.eeg-header {
  width: 100%;
  height: 32px;
  display: block;
  margin-top: 8px;
  animation: slideUp .7s .55s ease both;
}
.eeg-header path {
  stroke: var(--green-hot);
  stroke-width: 1;
  fill: none;
  opacity: .5;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawPath 3.5s 1s ease forwards;
}
@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

/* ── Grid des sections ───────────────────────────────────── */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.section--wide {
  grid-column: 1 / -1;
}
@media (max-width: 680px) {
  .sections-grid { grid-template-columns: 1fr; }
}

/* ── Carte section ───────────────────────────────────────── */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border-lo);
  border-radius: 4px;
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: border-color .28s, box-shadow .28s;
}
.section.visible {
  opacity: 1; transform: none;
  transition: opacity .5s ease, transform .5s ease,
              border-color .28s, box-shadow .28s;
}
.section:hover {
  border-color: var(--border-mid);
  box-shadow: 0 0 24px rgba(0,255,136,.05);
}

/* Coin supérieur droit décoratif */
.section::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 32px; height: 32px;
  border-top: 1px solid var(--border-mid);
  border-right: 1px solid var(--border-mid);
  border-radius: 0 4px 0 0;
  opacity: 0;
  transition: opacity .28s;
}
.section:hover::after { opacity: 1; }

/* Index en watermark */
.section-idx {
  position: absolute;
  bottom: 14px; right: 18px;
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: rgba(0,255,136,.04);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* ── h2 ──────────────────────────────────────────────────── */
h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: .1em;
  color: var(--white-bright);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-lo);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}
h2 .h2-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-hot);
  box-shadow: 0 0 8px var(--green-hot);
  flex-shrink: 0;
  animation: dotPulse 2.5s ease-in-out infinite;
}
@keyframes dotPulse {
  0%,100% { box-shadow: 0 0 6px var(--green-hot); }
  50%      { box-shadow: 0 0 18px var(--green-hot), 0 0 30px rgba(0,255,136,.2); }
}

/* ── Paragraphes ─────────────────────────────────────────── */
p {
  font-size: .94rem;
  color: var(--white-body);
  margin-bottom: 12px;
}
p:last-child { margin-bottom: 0; }
b, strong { font-weight: 500; color: var(--white-bright); }

/* ── Labels symptômes / mécanismes ──────────────────────── */
.symptomes,
.mecanismes {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 2px;
  margin: 12px 0 6px;
}
.symptomes {
  color: var(--red-alert);
  background: var(--red-dim);
  border: 1px solid rgba(255,61,61,.22);
}
.symptomes::before { content: '△'; font-size: .8em; }
.mecanismes {
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(255,184,48,.22);
}
.mecanismes::before { content: '◎'; font-size: .75em; }

/* ── Listes ──────────────────────────────────────────────── */
ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
li {
  font-size: .92rem;
  color: var(--white-body);
  padding-left: 18px;
  position: relative;
  transition: color .18s, padding-left .18s;
}
li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--white-muted);
  font-size: .75em;
  top: .3em;
  transition: color .18s;
}
li:hover { color: var(--white-bright); padding-left: 22px; }
li:hover::before { color: var(--green-hot); }

/* ── Section mécanisme : tableau + visualiseur ───────────── */
.neuro-viz {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 500px) {
  .neuro-viz { grid-template-columns: 1fr; }
}

/* Mini cerveau SVG animé */
.brain-icon {
  width: 90px; height: 90px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 14px rgba(0,255,136,.4));
  animation: brainPulse 3s ease-in-out infinite;
}
@keyframes brainPulse {
  0%,100% { filter: drop-shadow(0 0 10px rgba(0,255,136,.3)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 24px rgba(0,255,136,.6)); transform: scale(1.04); }
}

/* Barre dopamine inline */
.dopa-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--white-muted);
  letter-spacing: .08em;
}
.dopa-track {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  overflow: hidden;
}
.dopa-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green-mid), var(--green-hot));
  border-radius: 2px;
  transition: width 1.8s cubic-bezier(.22,1,.36,1);
}
.dopa-val {
  color: var(--green-hot);
  min-width: 34px;
  text-align: right;
  font-size: .65rem;
}

/* Tags zones cérébrales */
.zone-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.zone-tag {
  font-family: var(--font-mono);
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border-lo);
  border-radius: 2px;
  color: var(--white-muted);
  cursor: default;
  transition: all .2s;
}
.zone-tag:hover {
  border-color: var(--green-hot);
  color: var(--green-hot);
  background: var(--green-dim);
  box-shadow: var(--glow-green);
}

/* ── Section prévention : liste stylisée ─────────────────── */
.prev-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.prev-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--green-trace);
  border: 1px solid var(--border-lo);
  border-radius: 3px;
  font-size: .9rem;
  color: var(--white-body);
  transition: background .2s, border-color .2s;
}
.prev-item:hover {
  background: var(--green-dim);
  border-color: var(--border-mid);
  color: var(--white-bright);
}
.prev-item::before {
  content: '✓';
  color: var(--green-hot);
  font-size: .8rem;
  flex-shrink: 0;
  text-shadow: var(--glow-green);
}

/* ── Canvas EEG live ─────────────────────────────────────── */
#eeg-canvas {
  width: 100%;
  height: 40px;
  display: block;
  margin-top: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-lo);
  background: var(--bg-core);
}

/* ── Footer ──────────────────────────────────────────────── */
.page-footer {
  border-top: 1px solid var(--border-lo);
  padding-top: 28px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-id {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--white-muted);
}
.footer-id strong { color: var(--green-mid); }
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-hot);
  box-shadow: 0 0 8px var(--green-hot);
  animation: dotPulse 2s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .wrap { padding: 0 14px 60px; }
  .header-top { flex-direction: column; align-items: flex-start; }
  h2 { font-size: 1.05rem; }
}
