/* ==========================================================================
   ALLAOUA Nazim — Portfolio — Design system
   ========================================================================== */

:root {
  --bg: #090c14;
  --bg-alt: #0d1220;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --text-dim: #a4acc2;
  --text-faint: #6b7288;
  --accent: #7c8cff;
  --accent-2: #22d3ee;
  --accent-3: #c084fc;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --maxw: 1180px;
  --grad: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent-3) 120%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60vw 60vw at 85% -10%, rgba(124, 140, 255, 0.16), transparent 60%),
    radial-gradient(50vw 50vw at -10% 20%, rgba(34, 211, 238, 0.10), transparent 60%),
    var(--bg);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(80% 60% at 50% 0%, black, transparent 90%);
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--text-dim); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

section { position: relative; padding: 54px 0; }
/* Ancres : compense la hauteur de la nav fixe pour que le titre de section reste visible */
[id] { scroll-margin-top: 20px; }
section.tight { padding: 44px 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 30px;
  height: 2px;
  background: var(--grad);
  border-radius: 2px;
}

.section-head { max-width: 620px; margin-bottom: 30px; }
.section-head h2 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 500; color: var(--text); }
.section-head p { font-size: 17px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15.5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 30px -12px rgba(124,140,255,.5); }
.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: #0a0e17;
}
.btn-primary:hover { box-shadow: 0 12px 34px -10px rgba(124,140,255,.6); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 16px; font-size: 14px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background .25s ease, border-color .25s ease, padding .25s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(9, 12, 20, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.nav .container { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 17px; white-space: nowrap; flex-shrink: 0; }
@media (max-width: 1100px) { .nav-links { gap: 20px; } .nav-links a { font-size: 14.5px; } }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  color: #0a0e17; font-weight: 800; font-size: 14px;
}
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { font-size: 15.5px; color: var(--text-dim); font-weight: 500; transition: color .15s ease; position: relative; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px;
  background: var(--grad); border-radius: 2px;
}
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; }
/* « Contact » est redondant avec le bouton « Me contacter » sur desktop ;
   on ne le garde que dans le menu mobile, où le bouton est masqué */
.nav-contact { display: none; }
@media (max-width: 860px) { .nav-contact { display: block; } }

@media (max-width: 860px) {
  .nav-links { position: fixed; top: 66px; left: 16px; right: 16px; flex-direction: column; align-items: stretch; gap: 4px;
    background: rgba(13,18,32,.97); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: all .2s ease; }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 13px 14px; border-radius: 9px; font-size: 15.5px; }
  .nav-links a:hover { background: var(--surface); }
  .nav-links a.active { background: var(--surface); color: var(--accent-2); }
  .nav-links a.active::after { left: 0; right: auto; top: 8px; bottom: 8px; width: 3px; height: auto; border-radius: 2px; }
  .nav-links .nav-contact { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
  .nav-links .nav-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--grad); color: #0a0e17; font-weight: 700; text-align: center;
    box-shadow: 0 10px 26px -12px rgba(124,140,255,.55);
  }
  .nav-links .nav-cta:hover { background: var(--grad); opacity: .92; }
  .nav-links .nav-cta.active { background: var(--grad); color: #0a0e17; }
  .nav-links .nav-cta.active::after { display: none; }
  .nav-toggle {
    display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
    border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
  }
  .nav-toggle:hover { border-color: var(--accent); color: var(--text); }
  .nav-toggle.open { background: var(--surface-strong); border-color: var(--accent); color: var(--accent-2); }
  .nav-actions { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 122px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px;
  border: 1px solid var(--border-strong); border-radius: 999px; font-size: 14.5px; color: var(--text-dim);
  background: var(--surface); margin-bottom: 22px;
}
.hero-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(52,211,153,.18); }
.hero h1 { font-size: clamp(34px, 5vw, 58px); }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { font-size: 19px; max-width: 560px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }

.hero-card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0;
}
.hero-photo-frame {
  position: relative;
  align-self: center;
  width: fit-content; max-width: 100%;
  flex: 1; min-height: 0;
  border-radius: 28px 28px 0 0;
  overflow: hidden;
}
.hero-photo { height: 100%; width: auto; max-width: 100%; display: block; }
.hero-card-body {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 28px 40px 40px; flex-shrink: 0;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-card-body::before {
  content: ""; position: absolute; inset: -1px; border-radius: 28px; padding: 1px;
  background: var(--grad); opacity: .35;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
  z-index: 2; pointer-events: none;
}
.hero-card h3 { font-size: 28px; margin-bottom: 10px; }
.hero-card .role {
  display: inline-flex; color: var(--accent-2); font-size: 15.5px; font-weight: 600;
  background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.25);
  padding: 6px 16px; border-radius: 999px; margin-bottom: 30px;
}
.hero-stats { display: flex; width: 100%; margin-top: auto; padding-top: 28px; border-top: 1px solid var(--border); }
.hero-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 8px; position: relative; }
.hero-stat + .hero-stat::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 1px; background: var(--border); }
.hero-stat strong { font-family: "Space Grotesk", sans-serif; font-size: 26px; }
.hero-stat span { font-size: 13px; color: var(--text-faint); line-height: 1.35; }

/* ---------- Cards / grids ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform .26s cubic-bezier(.2,.7,.2,1), border-color .26s ease, background .26s ease;
  will-change: transform;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--surface-strong); }
.card .icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-strong); border: 1px solid var(--border); margin-bottom: 16px; color: var(--accent-2); }
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { font-size: 15.5px; margin-bottom: 0; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 54px; align-items: center; }
.about-grid h2 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 500; color: var(--text); }
.about-lead { font-size: 18px; color: var(--text); }
.about-points { display: grid; gap: 16px; margin-top: 26px; }
.about-point { display: flex; gap: 14px; }
.about-point .num { font-family: "Space Grotesk", sans-serif; font-weight: 700; color: var(--accent-2); font-size: 15px; padding-top: 2px; }
.about-point h4 { font-size: 16px; margin-bottom: 4px; }
.about-point p { font-size: 15px; margin: 0; }

/* ---------- Timeline (experience / education) ---------- */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), transparent); }
.tl-item { position: relative; padding-bottom: 42px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -34px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent-2); box-shadow: 0 0 0 4px rgba(34,211,238,.12); }
.tl-item.dim .tl-dot { border-color: var(--text-faint); box-shadow: none; }
.tl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-head h3 { font-size: 19.5px; margin: 0; }
.tl-period { font-size: 14px; color: var(--accent-2); font-weight: 600; white-space: nowrap; }
.tl-org { font-size: 15px; color: var(--text-faint); margin-bottom: 12px; }
.tl-item ul { display: grid; gap: 8px; }
.tl-item li { font-size: 15.5px; color: var(--text-dim); padding-left: 18px; position: relative; }
.tl-item li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tl-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-dim); background: var(--surface); }
.badge.grade { color: var(--good); border-color: rgba(52,211,153,.35); }

/* ---------- Skills ---------- */
.skill-cat { margin-bottom: 6px; }
.skill-cat h4 { font-size: 15.5px; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.skill-cat h4::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--grad); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip { font-size: 14px; padding: 7px 13px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); transition: all .15s ease; }
.chip:hover { border-color: var(--accent); color: var(--text); background: var(--surface-strong); }
.lang-row { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 15px; }
.lang-row span:last-child { color: var(--text-faint); font-size: 13.5px; }

/* ---------- Projects ---------- */
.proj-card {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.2,.7,.2,1), border-color .28s ease, box-shadow .28s ease;
  will-change: transform;
}
.proj-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 18px 40px -18px rgba(0,0,0,.6); }
.proj-thumb { height: 150px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.proj-thumb .glow { position: absolute; inset: -40%; opacity: .55; filter: blur(30px); }
.proj-thumb svg { position: relative; z-index: 1; width: 56px; height: 56px; color: var(--text); }
.proj-body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.proj-body h3 { font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-body p { font-size: 15px; margin: 0; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.proj-tags span { font-size: 12.5px; padding: 3px 9px; border-radius: 6px; background: rgba(255,255,255,.05); color: var(--text-faint); border: 1px solid var(--border); }
.proj-link { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-weight: 600; font-size: 15px; padding-top: 6px; }
.proj-link svg { width: 15px; height: 15px; transition: transform .2s ease; }
.proj-card:hover .proj-link svg { transform: translateX(4px); }

/* ---------- Contact ---------- */
.contact-box {
  border-radius: 24px; border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(124,140,255,.12), rgba(34,211,238,.06));
  padding: 60px 50px; text-align: center;
}
.contact-box h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 14px; }
.contact-box p { max-width: 520px; margin: 0 auto 30px; font-size: 17px; }
.contact-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

footer { padding: 40px 0; border-top: 1px solid var(--border); }
footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
footer p { margin: 0; font-size: 14px; color: var(--text-faint); }
footer .foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
footer .foot-links a { font-size: 14px; color: var(--text-faint); }
footer .foot-links a:hover { color: var(--text-dim); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
/* La hauteur de la carte photo suit le bloc de texte : toute resynchronisation est lissée */
.hero-card.reveal { transition: opacity .7s ease, transform .7s ease, height .3s ease; }
/* .reveal-stagger : l'apparition est portée par le parent ; pas de délai sur les enfants (il retarderait aussi le survol) */
.reveal-stagger > * { transition-delay: 0s; }

/* ==========================================================================
   Project / Dashboard pages
   ========================================================================== */
.proj-hero { padding: 136px 0 24px; }
/* Hero projet : titre → badges de thèmes → cartes Approche / Démontre → onglets → panneau actif, à 24px d'écart */
.proj-hero .explain-grid { margin-top: 24px; }
.proj-hero + section.tight { padding-top: 0; }

/* Onglets de navigation interne (Analyse / Modèle de données / Exemple de code).
   Volontairement différents du menu principal (onglets à fond, coins arrondis en haut,
   pas de dégradé permanent) et fixés sous la nav pendant le scroll dans un panneau. */
.proj-tabs {
  position: sticky; top: 65px; z-index: 20;
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 24px; padding-top: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.proj-tabs a {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); padding: 10px 18px; border-radius: 9px 9px 0 0;
  background: transparent; border: 1px solid transparent; border-bottom: none;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.proj-tabs a:hover { color: var(--text-dim); background: var(--surface); }
.proj-tabs a.active {
  color: var(--accent-2); background: var(--surface-strong);
  border-color: var(--border); border-bottom: none; margin-bottom: -1px;
}
.tab-panel { margin-top: 24px; }
.tab-panel.subsection { margin-top: 24px; }
.tab-panel[hidden] { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--text-faint); margin-bottom: 22px; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent-2); }
.disclaimer {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 7px 13px;
  border-radius: 999px; border: 1px solid rgba(251,191,36,.35); color: var(--warn); background: rgba(251,191,36,.08);
  width: fit-content; margin-bottom: 10px;
}
.disclaimer + .disclaimer { margin-top: 0; margin-bottom: 20px; }
.proj-hero h1 { font-size: clamp(28px, 4vw, 42px); max-width: 780px; }
.proj-hero .lead { font-size: 17.5px; max-width: 720px; }
.skills-demo { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.skills-demo span { font-size: 13.5px; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); }

.dash {
  border-radius: 22px; border: 1px solid var(--border); background: var(--surface);
  padding: 26px; margin-top: 10px;
}
.filter-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 168px; flex: 1; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.field select, .field input[type="text"] {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-family: inherit; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  min-width: 0; width: 100%;
}
.field select {
  cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a4acc2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
.field select option { background: var(--bg-alt); color: var(--text); }
.field input::placeholder { color: var(--text-faint); }
.field select:hover, .field input:hover { border-color: var(--border-strong); }
.field select:focus, .field input:focus { border-color: rgba(124,140,255,.6); box-shadow: 0 0 0 3px rgba(124,140,255,.14); background: var(--surface-strong); }
.field.grow-0 { flex: none; min-width: 140px; }
.field-wide { min-width: 300px; }
.run-btn { align-self: flex-end; }
.range-field input[type="range"] { width: 100%; accent-color: var(--accent-2); margin: 10px 0 4px; }
.range-value { font-size: 13.5px; color: var(--accent-2); font-weight: 600; }
.reset-btn { align-self: flex-end; margin-left: auto; }

/* Boutons dans les dashboards : plus sobres que les CTA de la page d'accueil */
.dash .btn { border-radius: 10px; }
.dash .btn:hover { transform: none; box-shadow: none; }
.dash .btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-dim); }
.dash .btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-strong); }
.dash .btn-primary { background: var(--accent); border-color: transparent; color: #0a0e17; }
.dash .btn-primary:hover { background: #8d9bff; }
.dash .btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi {
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-alt);
  padding: 18px 20px; min-width: 0;
}
.kpi span.label { display: block; font-size: 13px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.kpi span.value { font-family: "Space Grotesk", sans-serif; font-size: clamp(18px, 4.5vw, 26px); font-weight: 700; }
.kpi span.trend { font-size: 13.5px; margin-left: 8px; font-weight: 600; }
.kpi span.trend.up { color: var(--good); }
.kpi span.trend.down { color: var(--bad); }

.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-grid.thirds { grid-template-columns: 1fr 1fr 1fr; }
.chart-box { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-alt); padding: 18px 20px 8px; min-width: 0; }
.chart-box h4 { font-size: 15px; margin-bottom: 2px; color: var(--text); }
.chart-box .sub { font-size: 13px; color: var(--text-faint); margin-bottom: 12px; }
.chart-box canvas { max-height: 260px; max-width: 100%; }

.table-wrap { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-alt); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 640px; }
table.data-table th {
  text-align: left; padding: 12px 16px; background: rgba(255,255,255,.03); color: var(--text-faint);
  font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0;
  cursor: pointer; user-select: none; white-space: nowrap;
}
table.data-table th:hover { color: var(--text); }
table.data-table th .arrow { opacity: .5; margin-left: 4px; }
table.data-table td { padding: 11px 16px; border-top: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
table.data-table tr:hover td { background: rgba(255,255,255,.02); color: var(--text); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.status-pill.ok { background: rgba(52,211,153,.12); color: var(--good); }
.status-pill.wait { background: rgba(251,191,36,.12); color: var(--warn); }
.status-pill.late { background: rgba(248,113,113,.12); color: var(--bad); }
.anom-pill { background: rgba(248,113,113,.14); color: var(--bad); font-weight: 700; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-size: 14px; color: var(--text-faint); }
.pager .btns { display: flex; gap: 8px; }
.pager button { background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.pager button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-strong); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }

/* Segmented control */
.method-toggle { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.method-toggle button { background: transparent; border: none; color: var(--text-dim); padding: 7px 14px; font-size: 13.5px; font-weight: 500; border-radius: 7px; cursor: pointer; font-family: inherit; transition: all .15s ease; }
.method-toggle button:hover { color: var(--text); }
.method-toggle button.active { background: var(--surface-strong); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border-strong); }

.explain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 40px; }
.explain-grid .card p { font-size: 15px; }

.next-proj { display: flex; justify-content: space-between; align-items: center; padding: 26px 0; border-top: 1px solid var(--border); margin-top: 60px; }
.next-proj a { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-dim); }
.next-proj a:hover { color: var(--accent-2); }

@media (max-width: 980px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .chart-grid, .chart-grid.thirds, .explain-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .contact-box { padding: 40px 24px; }
  .hero-photo-frame { flex: none; height: 420px; }
}
@media (max-width: 640px) {
  section { padding: 16px 0; }
  section.tight { padding: 14px 0; }
  .hero { padding: 80px 0 14px; }
  .proj-hero { padding: 78px 0 10px; }
  .about-points { margin-top: 6px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 14px 14px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .field-wide { min-width: 0; }
  .run-btn { align-self: stretch; justify-content: center; }
  .reset-btn { margin-left: 0; align-self: flex-start; }
}

/* ==========================================================================
   Insights automatiques
   ========================================================================== */
.insight-panel {
  border-radius: var(--radius); border: 1px solid rgba(124,140,255,.25);
  background: linear-gradient(135deg, rgba(124,140,255,.08), rgba(34,211,238,.04));
  padding: 24px 26px; margin-top: 26px;
}
.insight-panel .ip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.insight-panel .ip-head .ip-icon {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; color: #0a0e17; flex-shrink: 0;
}
.insight-panel .ip-head h4 { margin: 0; font-size: 16px; }
.insight-panel .ip-head span { font-size: 13px; color: var(--text-faint); }
.insight-list { display: grid; gap: 12px; }
.insight-item {
  display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--text-dim);
  padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--border);
}
.insight-item b, .insight-item strong { color: var(--text); }
.insight-item .bullet { color: var(--accent-2); flex-shrink: 0; margin-top: 1px; }

/* ==========================================================================
   Schema / pipeline diagrams
   ========================================================================== */
.diagram-wrap { overflow-x: auto; padding: 6px 0 10px; }
.diagram-wrap svg { display: block; margin: 0 auto; min-width: 560px; }
.schema-box rect { fill: var(--bg-alt); stroke: var(--border-strong); stroke-width: 1; }
.schema-box.fact rect { stroke: var(--accent-2); }
.schema-box .tbl-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 13px; fill: var(--text); }
.schema-box .tbl-field { font-family: "Inter", sans-serif; font-size: 11px; fill: var(--text-dim); }
.schema-box .tbl-field.pk { fill: var(--accent-2); }
.schema-line { stroke: var(--border-strong); stroke-width: 1.4; fill: none; }
.schema-label { font-size: 10.5px; fill: var(--text-faint); font-family: "Inter", sans-serif; }

/* ==========================================================================
   Code panels (SQL / Python)
   ========================================================================== */
.code-panel { border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; background: #0b0e17; }
.code-tabs { display: flex; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); }
.code-tabs button {
  font-family: "Inter", sans-serif; font-size: 14px; font-weight: 600; padding: 12px 20px;
  background: transparent; border: none; color: var(--text-faint); cursor: pointer; border-bottom: 2px solid transparent;
}
.code-tabs button.active { color: var(--text); border-bottom-color: var(--accent-2); }
.code-caption { padding: 14px 20px 0; font-size: 14px; color: var(--text-dim); }
.code-caption b { color: var(--text); }
.code-panel pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.code-panel pre code.hljs { background: transparent; padding: 0; }
.code-block-group { display: none; }
.code-block-group.active { display: block; }

.subsection { margin-top: 40px; }
.subsection .section-head { margin-bottom: 30px; }
.subsection .section-head h2 { font-size: 24px; }

@media (max-width: 640px) {
  .hero-photo-frame { height: 320px; }
  .hero-card-body { padding: 24px 26px 32px; }
  .hero-card h3 { font-size: 25px; }
}
