/* ==========================================================================
   Marco van der Ben — portfolio
   ========================================================================== */

:root {
  --bg: #0a0d12;
  --bg-2: #0e1219;
  --surface: #121821;
  --surface-2: #18202b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8edf2;
  --muted: #94a2b1;
  --faint: #5f6d7c;
  --accent: #ff5a36;
  --accent-soft: rgba(255, 90, 54, 0.12);
  --accent-2: #4fd1c5;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --container: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }

::selection { background: var(--accent); color: #fff; }

.container { width: min(100% - 48px, var(--container)); margin-inline: auto; }

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.nav-links a { color: var(--muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

.nav-cta {
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: border-color 0.2s, background 0.2s;
}
.nav-cta:hover { border-color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-cta { display: none; }
  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(10, 13, 18, 0.97);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 20px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 0; font-size: 16px; }
}

/* --------------------------------------------------------------------------
   Buttons, tags
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff6c4c; border-color: #ff6c4c; }
.btn svg { width: 16px; height: 16px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 0 80px;
}

#voronoi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 20% 45%, rgba(10, 13, 18, 0.92) 0%, rgba(10, 13, 18, 0.4) 60%, transparent 100%),
    linear-gradient(to bottom, transparent 70%, var(--bg) 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 64px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(46px, 7vw, 88px);
  font-weight: 600;
  margin: 22px 0 22px;
  letter-spacing: -0.035em;
}

.hero .lead {
  font-size: clamp(18px, 1.6vw, 21px);
  color: var(--muted);
  max-width: 600px;
  margin-bottom: 36px;
}
.hero .lead strong { color: var(--text); font-weight: 500; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 44px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero-meta li { display: flex; align-items: center; gap: 8px; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.15);
}

.hero-portrait { position: relative; }
.hero-portrait .ph { border-radius: 24px; }
.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -14px 14px 14px -14px;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--faint);
  text-transform: uppercase;
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-portrait { max-width: 260px; order: -1; }
}

/* --------------------------------------------------------------------------
   Stats strip
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
}
.stat { padding: 28px 28px 26px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 10px;
}
.stat-value small { font-size: 0.55em; color: var(--accent); margin-left: 2px; }
.stat-label { font-size: 14px; color: var(--muted); line-height: 1.45; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 120px 0; }
.section-tight { padding: 64px 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 56px;
}
.section-head h2 {
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 600;
  margin-top: 16px;
}
.section-head p { color: var(--muted); max-width: 420px; margin: 0; }

@media (max-width: 860px) {
  .section { padding: 84px 0; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
.about-text p { font-size: 19px; color: var(--muted); }
.about-text p strong { color: var(--text); font-weight: 500; }
.about-text p:first-child { font-size: 23px; color: var(--text); line-height: 1.5; }

.path { list-style: none; padding: 0; margin: 0; position: relative; }
.path::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-strong), var(--accent));
}
.path li { position: relative; padding: 0 0 30px 40px; }
.path li:last-child { padding-bottom: 0; }
.path li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
}
.path li:last-child::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.path .when { font-family: var(--font-mono); font-size: 12.5px; color: var(--faint); }
.path h3 { font-size: 19px; font-weight: 500; margin: 4px 0 4px; }
.path p { font-size: 15px; color: var(--muted); margin: 0; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
}

/* --------------------------------------------------------------------------
   Image placeholders (auto-replaced by an <img> when the file exists)
   -------------------------------------------------------------------------- */

.ph {
  --ar: 16 / 10;
  position: relative;
  aspect-ratio: var(--ar);
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.025) 50%, rgba(255, 255, 255, 0.025) 75%, transparent 75%) 0 0 / 14px 14px,
    var(--surface);
  border: 1px dashed var(--border-strong);
  display: grid;
  place-items: center;
  text-align: center;
}
.ph-inner { padding: 20px; display: grid; gap: 8px; justify-items: center; max-width: 90%; }
.ph-inner svg { width: 28px; height: 28px; color: var(--faint); }
.ph-title { font-size: 14px; color: var(--muted); font-weight: 500; }
.ph-file { font-family: var(--font-mono); font-size: 11px; color: var(--faint); word-break: break-all; }

.ph.loaded { border: 0; background: var(--surface); }
.ph.loaded > img,
.ph.loaded > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph.contain.loaded > img,
.ph.contain.loaded > video { object-fit: contain; }

figure.shot { margin: 0; }
figure.shot figcaption { font-size: 13.5px; color: var(--faint); margin-top: 12px; }

/* --------------------------------------------------------------------------
   Project cards
   -------------------------------------------------------------------------- */

.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--surface); }
.card .ph { border-radius: 0; border: 0; border-bottom: 1px solid var(--border); }
.card .ph.loaded > img { transition: transform 0.6s var(--ease); }
.card:hover .ph.loaded > img { transform: scale(1.03); }

.card-body { padding: 28px 30px 30px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.card-kicker { font-family: var(--font-mono); font-size: 12px; color: var(--faint); letter-spacing: 0.04em; }
.card h3 { font-size: 25px; font-weight: 600; }
.card p { color: var(--muted); font-size: 15.5px; margin: 0; }
.card .tags { margin-top: auto; padding-top: 8px; }

.card-metric {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--border);
}
.card-metric strong { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--accent); }
.card-metric span { font-size: 14px; color: var(--muted); }

.card-arrow {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 13, 18, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  transition: background 0.3s, transform 0.3s var(--ease);
  z-index: 2;
}
.card-arrow svg { width: 16px; height: 16px; }
.card:hover .card-arrow { background: var(--accent); border-color: var(--accent); transform: rotate(-45deg); }

.card.featured { grid-column: 1 / -1; flex-direction: row; }
.card.featured .ph { flex: 1.25; aspect-ratio: auto; min-height: 420px; border-bottom: 0; border-right: 1px solid var(--border); }
.card.featured .card-body { flex: 1; padding: 40px; justify-content: center; }
.card.featured h3 { font-size: 34px; }
.card.featured p { font-size: 16.5px; }

.badge {
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: 6px;
}

.card.featured.reverse { flex-direction: row-reverse; }
.card.featured.reverse .ph { border-right: 0; border-left: 1px solid var(--border); }
.card.featured.reverse .card-arrow { right: 18px; left: auto; } /* stays over the image, clear of the badge */

@media (max-width: 960px) {
  .projects { grid-template-columns: 1fr; }
  .card.featured.reverse { flex-direction: column; }
  .card.featured.reverse .ph { border-left: 0; }
  .card.featured.reverse .card-arrow { left: auto; right: 18px; }
  .card.featured { flex-direction: column; }
  .card.featured .ph { min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--border); }
  .card.featured .card-body { padding: 28px 30px 30px; }
}

/* --------------------------------------------------------------------------
   Experience
   -------------------------------------------------------------------------- */

.xp {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  padding: 44px 0;
  border-top: 1px solid var(--border);
}
.xp:last-child { border-bottom: 1px solid var(--border); }
.xp-when { font-family: var(--font-mono); font-size: 13.5px; color: var(--faint); padding-top: 6px; }
.xp h3 { font-size: 26px; font-weight: 600; }
.xp .org { color: var(--muted); margin: 6px 0 22px; }
.xp ul.points { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.xp ul.points li { position: relative; padding-left: 26px; color: var(--muted); }
.xp ul.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 12px;
  height: 1px;
  background: var(--accent);
}
.xp ul.points li strong { color: var(--text); font-weight: 500; }

.xp-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px; }

.xp-compact { display: grid; gap: 18px; }
.xp-compact div { display: grid; grid-template-columns: 120px 1fr; gap: 20px; font-size: 15.5px; }
.xp-compact .when { font-family: var(--font-mono); font-size: 13px; color: var(--faint); padding-top: 2px; }
.xp-compact b { font-weight: 500; }
.xp-compact span.d { color: var(--muted); }

@media (max-width: 860px) {
  .xp { grid-template-columns: 1fr; gap: 12px; }
  .xp-gallery { grid-template-columns: 1fr 1fr; }
}

/* --------------------------------------------------------------------------
   Skills
   -------------------------------------------------------------------------- */

.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.skill {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.3s;
}
.skill:hover { border-color: var(--border-strong); }
.skill-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 22px;
}
.skill-icon svg { width: 22px; height: 22px; }
.skill h3 { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.skill p { font-size: 15px; color: var(--muted); margin-bottom: 20px; }
.skill.wide { grid-column: span 2; }

@media (max-width: 960px) {
  .skills { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .skills { grid-template-columns: 1fr; }
  .skill.wide { grid-column: auto; }
}

/* --------------------------------------------------------------------------
   Education
   -------------------------------------------------------------------------- */

.edu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.edu-item { padding: 30px; border-top: 2px solid var(--border-strong); }
.edu-item:first-child { border-top-color: var(--accent); }
.edu-item .when { font-family: var(--font-mono); font-size: 13px; color: var(--faint); }
.edu-item h3 { font-size: 21px; font-weight: 600; margin: 10px 0 6px; }
.edu-item .school { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.edu-item p { font-size: 14.5px; color: var(--muted); margin: 0; }

.langs { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 48px; font-size: 15px; color: var(--muted); }
.langs b { color: var(--text); font-weight: 500; margin-right: 8px; }

@media (max-width: 860px) {
  .edu { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Contact & footer
   -------------------------------------------------------------------------- */

.contact {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 80px 64px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(255, 90, 54, 0.14), transparent 60%),
    var(--bg-2);
}
.contact h2 { font-size: clamp(36px, 5vw, 64px); font-weight: 600; max-width: 760px; margin: 18px 0 22px; }
.contact p { color: var(--muted); font-size: 18px; max-width: 560px; margin-bottom: 36px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 14px; }

@media (max-width: 860px) {
  .contact { padding: 48px 28px; }
}

.site-footer {
  padding: 48px 0;
  margin-top: 120px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--faint);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.site-footer a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Case study pages
   -------------------------------------------------------------------------- */

.case-hero { padding: 150px 0 60px; position: relative; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 40px;
  transition: color 0.2s, gap 0.2s;
}
.back-link:hover { color: var(--text); gap: 12px; }
.back-link svg { width: 14px; height: 14px; }

.case-hero h1 { font-size: clamp(38px, 5.6vw, 72px); font-weight: 600; letter-spacing: -0.035em; margin: 20px 0 24px; max-width: 980px; }
.case-hero .lead { font-size: clamp(18px, 1.7vw, 22px); color: var(--muted); max-width: 760px; margin: 0; }

.case-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.case-meta dt { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.case-meta dd { margin: 0; font-size: 15px; }

@media (max-width: 860px) {
  .case-meta { grid-template-columns: 1fr 1fr; }
}

.case-cover { margin-top: 20px; }
.case-cover .ph { --ar: 21 / 9; border-radius: var(--radius); }

.case-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  padding: 100px 0 0;
}
.case-toc { position: sticky; top: 110px; align-self: start; list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.case-toc a {
  display: block;
  font-size: 14px;
  color: var(--faint);
  padding: 6px 0 6px 16px;
  border-left: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}
.case-toc a:hover,
.case-toc a.active { color: var(--text); border-left-color: var(--accent); }

.case-content { min-width: 0; }
.case-section { margin-bottom: 96px; }
.case-section > h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 600; margin: 14px 0 26px; }
.case-section > p,
.prose p { font-size: 18px; color: var(--muted); max-width: 760px; }
.prose strong, .case-section > p strong { color: var(--text); font-weight: 500; }

@media (max-width: 960px) {
  .case-body { grid-template-columns: 1fr; padding-top: 64px; }
  .case-toc { display: none; }
}

/* Pipeline steps */
.steps { display: grid; gap: 16px; counter-reset: step; margin-top: 36px; }
.step {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 90, 54, 0.35);
  border-radius: 12px;
}
.step h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.step p { font-size: 15.5px; color: var(--muted); margin: 0 0 12px; }
.step p:last-child { margin-bottom: 0; }
.step .tags { margin-top: 14px; }

/* Flow diagram (horizontal pipeline) */
.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 36px 0 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.flow-node {
  flex: 1 0 140px;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 14px;
}
.flow-node b { display: block; font-family: var(--font-display); font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }
.flow-node span { color: var(--faint); font-size: 12.5px; font-family: var(--font-mono); }
.flow-arrow { flex: 0 0 28px; display: grid; place-items: center; color: var(--accent); }
.flow-arrow svg { width: 16px; height: 16px; }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 36px 0;
}
.metric { background: var(--bg-2); padding: 28px 26px; }
.metric-value { font-family: var(--font-display); font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.metric-value small { font-size: 0.5em; color: var(--accent); margin-left: 2px; }
.metric-label { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.45; }

/* Two-column feature list */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.feature { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.feature h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.feature h3::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.feature p { font-size: 15px; color: var(--muted); margin: 0; }

@media (max-width: 760px) {
  .features { grid-template-columns: 1fr; }
}

/* Callout */
.callout {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.callout p { margin: 0; color: var(--text); font-size: 16.5px; }
.callout .label { display: block; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 32px; }
.gallery .span-2 { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Stack table */
.stack { display: grid; gap: 0; margin-top: 28px; border-top: 1px solid var(--border); }
.stack-row { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.stack-row dt { font-family: var(--font-mono); font-size: 13px; color: var(--faint); padding-top: 4px; }
.stack-row dd { margin: 0; }

@media (max-width: 640px) {
  .stack-row { grid-template-columns: 1fr; gap: 10px; }
}

/* Next project */
.next-project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 48px 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.next-project .label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.next-project h3 { font-size: clamp(24px, 3vw, 36px); font-weight: 600; margin-top: 8px; transition: color 0.2s; }
.next-project:hover h3 { color: var(--accent); }
.next-project .card-arrow { position: static; flex: 0 0 56px; width: 56px; height: 56px; }
.next-project:hover .card-arrow { background: var(--accent); border-color: var(--accent); transform: rotate(-45deg); }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

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

code.mono {
  font-size: 0.85em;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.case-hero .back-link { display: flex; width: max-content; }

@media (max-width: 960px) {
  .card.featured h3 { font-size: 27px; }
}

/* "My role" block on case studies: what I did vs. what the team did */
.role {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1px;
  margin: 36px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.role.solo { grid-template-columns: 1fr; }
.role > div { background: var(--bg-2); padding: 26px 28px; }
.role > div:first-child { background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--bg-2); }
.role .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.role > div:not(:first-child) .label { color: var(--faint); }
.role p { margin: 0; font-size: 16px; color: var(--text); }
.role ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.role li { position: relative; padding-left: 20px; font-size: 15.5px; color: var(--muted); }
.role li::before { content: ""; position: absolute; left: 0; top: 11px; width: 10px; height: 1px; background: var(--accent); }
.role > div:not(:first-child) li::before { background: var(--faint); }
.role li strong { color: var(--text); font-weight: 500; }

@media (max-width: 760px) {
  .role { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   HTML data visuals (no image needed): bar comparisons, confusion matrix,
   cluster cards, question cards
   -------------------------------------------------------------------------- */

.viz {
  margin: 36px 0;
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.viz-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 22px; }
.viz-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.viz-sub { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.viz-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 8px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-note { font-size: 14px; color: var(--muted); margin: 18px 0 0; }

.bars { display: grid; gap: 14px; }
.bar-group { display: grid; grid-template-columns: 70px 1fr; gap: 16px; align-items: center; }
.bar-label { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.bar-pair { display: grid; gap: 4px; }
.bar { display: flex; align-items: center; gap: 10px; }
.bar b {
  display: block;
  height: 14px;
  width: var(--w);
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.bar.alt b { background: #3a4554; }
.bar em { font-style: normal; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.confusion { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; max-width: 520px; }
.confusion .h { font-family: var(--font-mono); font-size: 12px; color: var(--faint); display: flex; align-items: center; justify-content: center; padding: 4px; text-align: center; }
.confusion .h.row { justify-content: flex-end; padding-right: 12px; }
.confusion .cell {
  border-radius: 8px;
  padding: 18px 14px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.confusion .cell small { display: block; font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--faint); margin-top: 4px; }
.confusion .cell.ok { background: var(--accent-soft); border-color: rgba(255, 90, 54, 0.35); }

.clusters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 32px; }
.cluster { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.cluster h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.cluster .count { font-family: var(--font-mono); font-size: 12.5px; color: var(--faint); }
.cluster .share { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.05); margin: 14px 0 16px; overflow: hidden; }
.cluster .share b { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 3px; }
.cluster dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.cluster dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.cluster dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.cluster p { font-size: 14px; color: var(--muted); margin: 0; }

.questions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 32px; }
.question { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.question .q { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.question h3 { font-size: 16px; font-weight: 600; margin: 8px 0 6px; line-height: 1.35; }
.question p { font-size: 13.5px; color: var(--muted); margin: 0; }

.ph.light, .ph.light.loaded { background: #fff; }

@media (max-width: 760px) {
  .clusters { grid-template-columns: 1fr; }
  .bar-group { grid-template-columns: 52px 1fr; gap: 10px; }
  .viz { padding: 22px 18px; }
}

/* Media rendered on the page colour: no frame, edges faded into the page */
.ph.blend, .ph.blend.loaded { background: transparent; border: 0; border-radius: 0; }
.ph.blend.loaded > img,
.ph.blend.loaded > video {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  mask-composite: intersect;
}

/* System map: sensors -> controller -> actuators (cat bowl) */
.sysmap {
  display: grid;
  grid-template-columns: 1fr 68px 1.05fr 68px 1fr;
  grid-template-rows: auto 44px repeat(3, auto);
  row-gap: 14px;
  align-items: center;
  margin: 36px 0 8px;
}
.sys-head { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); align-self: end; }
.sys-head.in { grid-column: 1; grid-row: 1; }
.sys-head.out { grid-column: 5; grid-row: 1; }
.sys-node {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 14px;
}
.sys-node b { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.sys-node span { color: var(--faint); font-size: 12.5px; }
.sys-cloud { grid-column: 3; grid-row: 1; text-align: center; border-style: dashed; border-color: var(--border-strong); }
.sys-wifi { grid-column: 3; grid-row: 2; justify-self: center; height: 100%; width: 1px; background: repeating-linear-gradient(to bottom, var(--accent) 0 4px, transparent 4px 8px); position: relative; }
.sys-wifi em { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.sys-hub {
  grid-column: 3; grid-row: 3 / span 3; align-self: stretch;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: 22px 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--bg-2);
  text-align: center;
}
.sys-hub b { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.sys-hub > span { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.sys-hub ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sys-hub li { font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.sys-link { position: relative; height: 1px; background: var(--accent); }
.sys-link::after { content: ""; position: absolute; top: -4px; border: 4.5px solid transparent; }
.sys-link.to-hub::after { right: -1px; border-left: 7px solid var(--accent); border-right: 0; }
.sys-link.from-hub::after { right: -1px; border-left: 7px solid var(--accent); border-right: 0; }
.sys-link em { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
@media (max-width: 760px) {
  /* stacked, but the connections stay visible: Wi-Fi link, bus badges, direction in the group titles */
  .sysmap { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 10px; }
  .sysmap > * { grid-column: 1 !important; grid-row: auto !important; }
  .sys-link { display: none; }
  .sys-cloud { order: 1; }
  .sys-wifi { order: 2; height: 34px; margin: -4px 0; }
  .sys-hub { order: 3; }
  .sys-head { margin-top: 12px; }
  .sys-head.in { order: 4; } .sysmap .in-node { order: 5; }
  .sys-head.out { order: 6; } .sysmap .out-node { order: 7; }
  .sys-head.in::after { content: "  →  ESP32"; color: var(--accent); }
  .sys-head.out::before { content: "ESP32  →  "; color: var(--accent); }
  .sys-node[data-bus] { position: relative; padding-right: 92px; }
  .sys-node[data-bus]::after {
    content: attr(data-bus);
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap;
    padding: 3px 8px; border: 1px solid rgba(255, 90, 54, 0.35); border-radius: 6px;
  }
}

/* Screenshots: keep a thin frame once loaded */
.ph.framed.loaded { border: 1px solid var(--border); }

/* Sub-heading inside a case-study section */
.case-section h3.sub { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 56px 0 0; }

/* Lightbox: tap a figure to see it full screen */
.shot .ph.loaded > img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px; background: rgba(5, 7, 10, 0.94); cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.lightbox-hint {
  position: absolute; bottom: 18px; left: 0; right: 0; text-align: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
}

/* Phones */
@media (max-width: 640px) {
  .section { padding: 76px 0; }
  .case-section { margin-bottom: 68px; }
  .hero-portrait { max-width: 200px; }

  /* numbered steps: number above the text, text uses the full width */
  .step { grid-template-columns: 1fr; gap: 14px; padding: 22px; }
  .step::before { width: 40px; height: 40px; }

  /* pipelines read top to bottom instead of being cut on the right */
  .flow { flex-direction: column; overflow: visible; }
  .flow-node { flex: none; }
  .flow-arrow { flex: 0 0 26px; transform: rotate(90deg); }

  /* wide banners whose subject sits in the middle get a taller frame */
  .case-cover .ph.crop-mobile { --ar: 4 / 3; }
}

/* Language switch (EN · FR) */
.nav-end { display: flex; align-items: center; gap: 14px; }
.lang-switch {
  display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1;
}
.lang-switch a, .lang-switch span { padding: 5px 9px; border-radius: 999px; color: var(--muted); }
.lang-switch a:hover { color: var(--text); }
.lang-switch [aria-current] { background: var(--surface-2); color: var(--text); }
@media (max-width: 860px) { .nav-end { gap: 6px; } }
