/* ============================================================
   Salmen Khemir — Portfolio Data & AI
   Design tokens : base ardoise froide, accent "medallion"
   (bronze → or, clin d'œil à l'architecture Bronze/Silver/Gold)
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --ink: #15181e;
  --ink-soft: #4b5260;
  --ink-faint: #8a91a0;
  --line: #dde0e6;
  --accent: #b96f2c;
  --accent-2: #e2a65a;
  --steel: #5d7ea3;
  --node: #ffffff;
  --shadow: 0 1px 2px rgba(21, 24, 30, 0.06), 0 8px 28px rgba(21, 24, 30, 0.07);
  --grad: linear-gradient(92deg, #b96f2c, #e2a65a);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c242e;
  --ink: #e6e9ed;
  --ink-soft: #aab2bf;
  --ink-faint: #6d7685;
  --line: #2a333f;
  --accent: #e2a65a;
  --accent-2: #c0742f;
  --steel: #7e9fc4;
  --node: #1c242e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 32px rgba(0, 0, 0, 0.35);
  --grad: linear-gradient(92deg, #e2a65a, #c98a45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Figtree", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16.5px;
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-2); color: #15181e; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 {
  font-family: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  display: block;
  margin-bottom: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: 1080px; margin: 0 auto;
}
.brand {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: 0.92rem; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-ctrl { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; font-size: 0.95rem;
  transition: border-color 0.2s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.lang-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  height: 36px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem; letter-spacing: 0.05em;
  display: grid; place-items: center; transition: border-color 0.2s, transform 0.15s;
}
.lang-btn:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 84px 0 56px; }
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  max-width: 760px;
  margin-bottom: 20px;
}
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lede { font-size: 1.13rem; color: var(--ink-soft); max-width: 640px; margin-bottom: 30px; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: 0.98rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #14110b; box-shadow: var(--shadow); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }

/* Pipeline SVG — élément signature */
.pipeline { width: 100%; max-width: 980px; display: block; margin: 0 auto; }
.pipeline .flow {
  stroke: var(--steel); stroke-width: 1.6; fill: none;
  stroke-dasharray: 6 7; opacity: 0.85;
  animation: flow 2.6s linear infinite;
}
.pipeline .node-box { fill: var(--node); stroke: var(--line); stroke-width: 1.2; }
.pipeline .node-box.lit { stroke: var(--accent); stroke-width: 1.6; }
.pipeline text { fill: var(--ink); font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.pipeline .sub { fill: var(--ink-faint); font-size: 10px; }
@keyframes flow { to { stroke-dashoffset: -26; } }

/* ---------- Stats strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; margin: 26px 0 0;
}
.stat { background: var(--surface); padding: 22px 20px; }
.stat b {
  font-family: "Bricolage Grotesque", sans-serif; font-size: 1.7rem; font-weight: 700;
  display: block; line-height: 1.1;
}
.stat span { color: var(--ink-faint); font-size: 0.86rem; }

/* ---------- Sections ---------- */
section { padding: 72px 0; }
section h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: 14px; }
.section-intro { color: var(--ink-soft); max-width: 620px; margin-bottom: 42px; }

/* Expertises */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 24px; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { font-size: 1.18rem; margin: 14px 0 10px; }
.card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.card .pin {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 1.1rem;
}
.taglist { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: "JetBrains Mono", monospace; font-size: 0.7rem; letter-spacing: 0.03em;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  color: var(--ink-soft); background: var(--bg);
}

/* Études de cas */
.case {
  display: grid; grid-template-columns: 1fr 230px; gap: 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px 30px; margin-bottom: 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.case:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.case h3 { font-size: 1.25rem; margin: 8px 0 10px; }
.case .ctx { color: var(--ink-soft); font-size: 0.97rem; margin-bottom: 16px; }
.case .metric {
  border-left: 1px solid var(--line); padding-left: 26px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.case .metric b {
  font-family: "Bricolage Grotesque", sans-serif; font-size: 1.9rem; line-height: 1.05;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.case .metric span { color: var(--ink-faint); font-size: 0.85rem; }

/* Méthodologie */
.method { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; position: relative; }
.step { position: relative; padding: 0 18px 0 0; display: flex; flex-direction: column; align-items: flex-start; }
.step::before {
  content: ""; position: absolute; top: 19px; left: 0; right: 0; height: 2px;
  background: repeating-linear-gradient(90deg, var(--steel) 0 6px, transparent 6px 13px);
  opacity: 0.55;
}
.step:last-child::before { right: 60%; }
.step .dot {
  position: relative; z-index: 1;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--accent);
  display: grid; place-items: center;
  font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--accent);
  margin-bottom: 16px;
}
.step h3 { font-size: 1.02rem; margin-bottom: 8px; }
.step p { color: var(--ink-soft); font-size: 0.88rem; padding-right: 6px; }
.step .mono.fw { color: var(--ink-faint); display: block; margin-top: auto; padding-top: 12px; font-size: 0.68rem; }

/* Parcours */
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 30px; }
.tl-item { position: relative; padding-bottom: 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -37px; top: 7px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 0 4px var(--bg);
}
.tl-item h3 { font-size: 1.08rem; }
.tl-item .where { color: var(--ink-soft); font-size: 0.94rem; }
.tl-item .when { color: var(--ink-faint); }
.tl-item p { color: var(--ink-soft); font-size: 0.93rem; margin-top: 6px; max-width: 640px; }

.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 36px; }
.edu .card { padding: 20px 22px; }
.edu .card h3 { font-size: 1rem; margin: 0 0 4px; }
.edu .card p { margin: 0; font-size: 0.88rem; }

/* Contact */
.contact-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 52px 48px; text-align: center;
}
.contact-box h2 { margin-bottom: 12px; }
.contact-box p { color: var(--ink-soft); max-width: 520px; margin: 0 auto 28px; }

footer {
  border-top: 1px solid var(--line); padding: 26px 0 34px;
  color: var(--ink-faint); font-size: 0.85rem;
}
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Révélation au scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pipeline .flow { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover, .icon-btn:hover, .lang-btn:hover { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .method { grid-template-columns: 1fr; gap: 26px; }
  .step::before { display: none; }
  .case { grid-template-columns: 1fr; }
  .case .metric { border-left: none; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .nav-links { display: none; }
  .edu { grid-template-columns: 1fr; }
  .contact-box { padding: 38px 24px; }
}
