/* ==========================================================================
   Devin Yaung Lee — portfolio
   Palette: deep harbour blue-slate with a teal "validated" accent and an amber
   "flagged" accent, the two states every data check ends in.
   ========================================================================== */
/* Self-hosted fonts (SIL Open Font License) */
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0c1620;
  --bg-2: #122230;
  --surface: #132029;
  --surface-2: #192a36;
  --line: rgba(168, 196, 214, 0.13);
  --line-strong: rgba(168, 196, 214, 0.26);
  --text: #e8eef2;
  --text-2: #b0c0cb;
  --muted: #7f93a1;
  --teal: #4fd1bc;          /* UI accent (text-safe) */
  --amber: #e8b04f;         /* flagged / attention */
  /* chart palette — validated for the dark surface (CVD-safe) */
  --c1: #14a08d;
  --c2: #c48214;
  --c3: #5e80da;
  --c4: #d05e82;

  --font-display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: clamp(0.83rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.09rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.45vw, 1.42rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 1.8vw, 3rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.4vw, 4.9rem);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-s: 6px;
  --radius-m: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; max-width: 68ch; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.08; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1, h2 { text-transform: uppercase; letter-spacing: -0.005em; line-height: 1.02; }
::selection { background: rgba(79, 209, 188, 0.3); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 14px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.num { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: rgba(12, 22, 32, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); }
.nav.hide { transform: translateY(-100%); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--teal); }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--text-2); font-size: var(--step--1);
  padding: 8px 12px; border-radius: 999px; transition: color 0.25s, background 0.25s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links .cta { color: var(--bg); background: var(--teal); font-weight: 600; }
.nav-links .cta:hover { background: #7fe3d2; color: var(--bg); }
.menu-btn { display: none; background: none; border: 1px solid var(--line-strong); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: var(--step--1); }

/* ----------------------------------------------------------------- hero */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; padding: 110px 0 60px; overflow: hidden; }
#data-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { /* soft vignette so text stays readable over the canvas */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(12, 22, 32, 0.88) 38%, rgba(12, 22, 32, 0.15) 75%, rgba(12, 22, 32, 0.4) 100%);
}
.hero .wrap { position: relative; z-index: 2; }
.status {
  display: inline-flex; align-items: center; gap: 10px; font-size: var(--step--1); color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px 6px 10px; margin-bottom: 28px;
  background: rgba(19, 32, 41, 0.6);
}
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(79, 209, 188, 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(79, 209, 188, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 209, 188, 0); } }
.hero h1 { font-size: var(--step-4); font-weight: 750; letter-spacing: -0.024em; }
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line > span { display: block; transform: translateY(105%); transition: transform 1.1s var(--ease); }
.loaded .hero h1 .line > span { transform: none; }
.hero h1 .line:nth-child(2) > span { transition-delay: 0.12s; }
.hero h1 .line:nth-child(3) > span { transition-delay: 0.24s; }
.hero h1 .line:nth-child(4) > span { transition-delay: 0.36s; }
.hero .lede { margin-top: 26px; font-size: var(--step-1); color: var(--text-2); max-width: 44ch; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.fade-in { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: 0.45s; }
.loaded .fade-in { opacity: 1; transform: none; }
.hero-legend { position: absolute; right: var(--gutter); bottom: 34px; z-index: 2; display: flex; gap: 18px; font-size: 0.8rem; color: var(--muted); }
.hero-legend span { display: inline-flex; align-items: center; gap: 7px; }
.hero-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: var(--step--1);
  padding: 13px 22px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text);
  transition: transform 0.35s var(--ease), background 0.3s, border-color 0.3s, color 0.3s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--teal); }
.btn.primary { background: var(--teal); color: var(--bg); border-color: var(--teal); }
.btn.primary:hover { background: #7fe3d2; }
.btn svg { width: 16px; height: 16px; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* ------------------------------------------------------------- sections */
section { padding: clamp(64px, 8vw, 112px) 0; position: relative; }
.section-head { display: grid; gap: 14px; margin-bottom: clamp(40px, 6vw, 72px); max-width: 720px; }
.section-head h2 { font-size: var(--step-3); }
.section-head p { color: var(--text-2); font-size: var(--step-1); line-height: 1.5; margin: 0; }

/* reveal on scroll — slides in from the side the content sits on */
.reveal { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.from-left { transform: translate3d(-48px, 0, 0); }
.reveal.from-right { transform: translate3d(48px, 0, 0); }
.reveal.in { opacity: 1; transform: none; }

/* --------------------------------------------------------------- impact */
.impact { padding-top: 40px; padding-bottom: 0; }
.impact-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.impact-item { padding: 30px 24px 8px 0; }
.impact-item + .impact-item { padding-left: 24px; border-left: 1px solid var(--line); }
.impact-item b { display: block; font-family: var(--font-display); font-size: var(--step-3); font-weight: 650; letter-spacing: -0.03em; line-height: 1; margin-bottom: 14px; color: var(--text); }
.impact-item p { color: var(--text-2); font-size: var(--step--1); margin: 0; }

/* ------------------------------------------------------------- projects */
.project {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center;
  padding: clamp(36px, 5vw, 64px) 0; border-top: 1px solid var(--line);
}
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { font-size: 0.78rem; color: var(--text-2); border: 1px solid var(--line-strong); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.real { color: var(--teal); border-color: rgba(79, 209, 188, 0.45); }
.chip.sim { color: var(--amber); border-color: rgba(232, 176, 79, 0.45); }
.project h3 { font-size: var(--step-2); margin-bottom: 14px; }
.project h3 a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size 0.5s var(--ease); }
.project h3 a:hover { background-size: 100% 2px; }
.project .summary { color: var(--text-2); }
.result { display: flex; gap: 14px; align-items: baseline; margin: 22px 0 26px; padding: 16px 18px; border-radius: var(--radius-s); background: var(--surface); border-left: 3px solid var(--teal); }
.result b { font-family: var(--font-display); font-size: var(--step-2); letter-spacing: -0.03em; white-space: nowrap; color: var(--teal); }
.result span { color: var(--text-2); font-size: var(--step--1); line-height: 1.45; }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; }
.project-visual {
  position: relative; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line);
  padding: 22px 22px 16px; min-height: 300px; display: flex; flex-direction: column;
  transition: border-color 0.4s, transform 0.6s var(--ease);
}
.project-visual:hover { border-color: var(--line-strong); }
.project-visual .viz-title { font-size: var(--step--1); color: var(--text-2); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.project-visual .viz-title span:last-child { color: var(--muted); }
.project-visual .chart-box { position: relative; flex: 1; min-height: 240px; }

/* ----------------------------------------------------------- experience */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.timeline li { position: relative; padding: 0 0 46px 44px; display: grid; grid-template-columns: 220px 1fr; gap: 8px 40px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); }
.timeline li:first-child::before { border-color: var(--teal); background: var(--teal); }
.timeline .when { color: var(--muted); font-size: var(--step--1); padding-top: 3px; }
.timeline h3 { font-size: var(--step-1); font-weight: 650; letter-spacing: -0.01em; }
.timeline .org { color: var(--text-2); margin: 4px 0 12px; }
.timeline ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: var(--step--1); }
.timeline ul li { display: list-item; padding: 0 0 6px; }
.timeline ul li::before { display: none; }

/* --------------------------------------------------------------- skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.skill-group { padding: 28px 28px 28px 0; border-bottom: 1px solid var(--line); }
.skill-group:not(:nth-child(3n + 1)) { padding-left: 28px; border-left: 1px solid var(--line); }
.skill-group h3 { font-size: var(--step-1); font-weight: 650; margin-bottom: 14px; }
.skill-group ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.skill-group li { font-size: var(--step--1); color: var(--text-2); background: var(--surface); border-radius: var(--radius-s); padding: 5px 11px; }

/* -------------------------------------------------------------- contact */
.contact { padding-bottom: 60px; }
.contact-inner { border-top: 1px solid var(--line); padding-top: clamp(60px, 8vw, 110px); }
.contact h2 { font-size: var(--step-4); max-width: 14ch; letter-spacing: -0.024em; }
.contact p { color: var(--text-2); font-size: var(--step-1); margin: 22px 0 34px; }
.mail {
  font-family: var(--font-display); font-size: var(--step-2); text-decoration: none; color: var(--teal);
  background: linear-gradient(var(--teal), var(--teal)) 0 100% / 100% 2px no-repeat; padding-bottom: 4px;
  transition: background-size 0.5s var(--ease); word-break: break-all;
}
.mail:hover { background-size: 0 2px; background-position: 100% 100%; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }
footer { color: var(--muted); font-size: 0.82rem; padding: 40px 0 50px; }
footer .wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border-top: 1px solid var(--line); padding-top: 24px; }

/* ===================================================== case study pages */
.case-hero { padding: 150px 0 60px; }
.back { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); text-decoration: none; font-size: var(--step--1); margin-bottom: 34px; }
.back:hover { color: var(--teal); }
.back svg { width: 16px; transform: rotate(180deg); }
.case-hero h1 { font-size: clamp(2.3rem, 1.5rem + 3.2vw, 4.3rem); max-width: 20ch; }
.case-hero .lede { color: var(--text-2); font-size: var(--step-1); max-width: 56ch; margin-top: 24px; line-height: 1.5; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 54px; border-top: 1px solid var(--line); }
.facts div { padding: 20px 20px 0 0; }
.facts div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; }
.facts dd { margin: 0; font-size: var(--step--1); color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius-m); padding: 22px; }
.kpi b { display: block; font-family: var(--font-display); font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 10px; }
.kpi > span { color: var(--text-2); font-size: var(--step--1); line-height: 1.4; display: block; }
.kpi.accent b { color: var(--teal); }

.case section { padding: clamp(56px, 7vw, 96px) 0; }
.case h2 { font-size: var(--step-3); margin-bottom: 22px; max-width: 22ch; }
.case .prose p, .case .prose li { color: var(--text-2); }
.case .prose strong { color: var(--text); font-weight: 600; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 56px 1fr; gap: 18px; padding: 22px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(s); font-family: var(--font-display); font-size: var(--step-2); color: var(--teal); line-height: 1; font-weight: 600; }
.steps h3 { font-size: var(--step-1); font-weight: 650; margin-bottom: 6px; }
.steps p { color: var(--text-2); margin: 0; font-size: var(--step--1); }
.steps code, .prose code { font-size: 0.86em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; color: var(--text); }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; margin-top: 8px; }
.chart-card h3 { font-size: var(--step-1); font-weight: 650; letter-spacing: -0.01em; }
.chart-card .sub { color: var(--muted); font-size: var(--step--1); margin: 6px 0 18px; }
.chart-card .chart-box { position: relative; height: 340px; }
.chart-card .chart-box.tall { height: 420px; }
.chart-card .takeaway { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-2); font-size: var(--step--1); }
.chart-card .takeaway strong { color: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: var(--step--1); color: var(--text-2); margin: -6px 0 14px; }
.legend span { display: inline-flex; gap: 8px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.findings { display: grid; gap: 18px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 500; }
table.data td { color: var(--text-2); }
table.data td:first-child { white-space: nowrap; }
table.data td.r, table.data th.r { text-align: right; }

.heat td { text-align: center; color: var(--text); padding: 9px 6px; border: 2px solid var(--surface); border-radius: 4px; cursor: default; transition: outline-color 0.2s; }
.heat td:hover { outline: 2px solid var(--text); outline-offset: -2px; }
.heat th { text-align: center; }
.heat th:first-child, .heat td:first-child { text-align: left; }

.recs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.recs li { background: var(--surface); border-radius: var(--radius-m); padding: 22px; border-top: 3px solid var(--amber); }
.recs h3 { font-size: var(--step-1); font-weight: 650; margin-bottom: 8px; }
.recs p { color: var(--text-2); font-size: var(--step--1); margin: 0; }
.note { font-size: var(--step--1); color: var(--muted); border-left: 2px solid var(--amber); padding: 4px 0 4px 14px; margin-top: 18px; max-width: 70ch; }

.next-case { display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); padding: 44px 0 10px; text-decoration: none; }
.next-case small { color: var(--muted); display: block; margin-bottom: 6px; }
.next-case strong { font-family: var(--font-display); font-size: var(--step-2); letter-spacing: -0.02em; transition: color 0.3s; }
.next-case:hover strong { color: var(--teal); }
.next-case svg { width: 28px; flex: none; transition: transform 0.4s var(--ease); }
.next-case:hover svg { transform: translateX(6px); }

.chart-tip { position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 0.8rem; color: var(--text); opacity: 0; transition: opacity 0.15s; z-index: 5; white-space: nowrap; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .impact-grid { grid-template-columns: 1fr 1fr; }
  .impact-item:nth-child(3) { padding-left: 0; border-left: 0; }
  .project { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr 1fr; }
  .skill-group:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
  .skill-group:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--line); }
  .timeline li { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .split, .grid-2, .recs { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
  .hero::after { background: linear-gradient(180deg, rgba(12, 22, 32, 0.55) 0%, rgba(12, 22, 32, 0.9) 60%, var(--bg) 100%); }
}
@media (max-width: 720px) {
  .menu-btn { display: inline-block; }
  .nav-links { position: fixed; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(12, 22, 32, 0.97); border-bottom: 1px solid var(--line); padding: 10px var(--gutter) 20px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.4s var(--ease); }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 14px 4px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav-links .cta { margin-top: 14px; text-align: center; border-radius: 999px; border: 0; }
  .nav.scrolled, .nav.menu-open { background: rgba(12, 22, 32, 0.97); }
  .skills { grid-template-columns: 1fr; }
  .skill-group:nth-child(even) { padding-left: 0; border-left: 0; }
  .hero-legend { display: none; }
  .result { flex-direction: column; gap: 4px; }
  .project-visual { padding: 16px 14px 12px; min-height: 260px; }
  .chart-card { padding: 18px 14px; }
  .chart-card .chart-box { height: 300px; }
  .kpis { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .impact-grid { grid-template-columns: 1fr; }
  .impact-item + .impact-item { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .facts { grid-template-columns: 1fr; }
  .facts div + div { padding-left: 0; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .reveal, .fade-in, .hero h1 .line > span { opacity: 1 !important; transform: none !important; }
}

/* horizontal "share" bars rendered in HTML (readable counts for tiny categories) */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bars li { display: grid; grid-template-columns: minmax(150px, 1.1fr) 2fr auto; gap: 14px; align-items: center; font-size: var(--step--1); color: var(--text-2); }
.bars .track { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 4px; min-width: 3px; width: 0; transition: width 1.2s var(--ease); }
.bars .val { font-variant-numeric: tabular-nums; color: var(--text); min-width: 92px; text-align: right; }
@media (max-width: 520px) { .bars li { grid-template-columns: 1fr auto; } .bars .track { grid-column: 1 / -1; grid-row: 2; } }

/* code excerpt */
pre.code { margin: 0; background: #0f1a23; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px; overflow-x: auto; font-size: 0.82rem; line-height: 1.65; color: #c9d6de; tab-size: 4; }
pre.code code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
pre.code .k { color: #7fb8f0; } pre.code .f { color: #4fd1bc; } pre.code .c { color: #6f8494; font-style: italic; } pre.code .s { color: #e8b04f; }
.code-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; margin-bottom: 10px; color: var(--muted); font-size: var(--step--1); }
.code-head a { color: var(--teal); text-decoration: none; }
.bars .track, .bars .fill { display: block; }
.split > *, .grid-2 > *, .project > * { min-width: 0; }
html { overflow-x: clip; }

/* ---------------------------------------------------- profile hero (v2) */
.hero { min-height: 0; padding: 112px 0 0; align-items: end; border-bottom: 1px solid var(--line); }
.hero::after { background: linear-gradient(90deg, var(--bg) 0%, rgba(12, 22, 32, 0.92) 34%, rgba(12, 22, 32, 0.25) 62%, rgba(12, 22, 32, 0.1) 100%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
.hero-text { padding-bottom: clamp(48px, 7vw, 96px); }
.role { color: var(--teal); font-weight: 500; font-size: var(--step-0); margin: 0 0 18px; }
.hero h1 { font-size: clamp(3rem, 2rem + 5.2vw, 6.6rem); font-weight: 760; line-height: 0.94; letter-spacing: -0.01em; }
.hero .lede { margin-top: 26px; max-width: 52ch; font-size: var(--step-1); }
.profile-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--line); max-width: 600px; }
.profile-facts dt { color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.profile-facts dd { margin: 0; font-size: var(--step--1); color: var(--text); line-height: 1.45; }
.portrait { position: relative; margin: 0; align-self: end; justify-self: center; width: min(100%, 560px); }
.portrait::before { /* soft teal halo so the cut-out sits in the scene */
  content: ""; position: absolute; left: 8%; right: 8%; top: 14%; bottom: 0; border-radius: 50% 50% 0 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(20, 160, 141, 0.42), rgba(20, 160, 141, 0.08) 55%, transparent 72%);
  filter: blur(6px); z-index: -1;
}
.portrait img { width: 100%; height: auto; display: block;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
.hero-grid { isolation: isolate; }
.impact { padding-top: clamp(64px, 8vw, 112px); padding-bottom: 0; }
@media (max-width: 960px) {
  .hero { padding-top: 96px; }
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; width: min(78%, 360px); justify-self: start; }
  .hero-text { padding-bottom: 56px; }
}
@media (max-width: 520px) {
  .profile-facts { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------------------------------------------------- v3 */
.brand { font-size: 1.25rem; letter-spacing: 0.02em; }
.hero h1 { font-size: clamp(3.2rem, 2rem + 6vw, 7.4rem); }
/* running descriptions are justified */
.hero .lede, .project .summary, .timeline ul li, .impact-item p, .section-head p, .contact p,
.case .prose p, .case-hero .lede, .chart-card .takeaway, .recs p, .steps p, .note, .result span {
  text-align: justify; hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty;
}
.timeline ul { font-size: 0.95rem; }
.timeline ul li { padding-bottom: 8px; max-width: 78ch; }
.contact-list { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 20px 56px; }
.contact-item { display: grid; gap: 6px; }
.contact-item .label { color: var(--muted); font-size: var(--step--1); }
@media (max-width: 720px) { .contact-list { grid-template-columns: 1fr; } }

/* v4: centred achievement figures, portrait nudged right */
.impact-item b { text-align: center; }
.impact-item { padding-right: 24px; }
@media (min-width: 961px) { .portrait { justify-self: end; margin-right: -24px; } }

/* v5: clear separation between home sections */
main > section:not(.hero) { border-top: 1px solid var(--line-strong); padding-block: clamp(72px, 9vw, 120px); }
main > section:not(.hero):nth-of-type(even) { background: var(--bg-2); }
main > section:not(.hero) .section-head h2::before,
.contact h2::before {
  content: ""; display: block; width: 56px; height: 4px; border-radius: 2px; background: var(--teal); margin-bottom: 22px;
}
.contact-inner { border-top: 0; padding-top: 0; }

/* v6: language switch */
.lang-toggle { display: inline-flex; gap: 2px; padding: 3px; margin: 0 4px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font: inherit; }
.lang-toggle span { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; padding: 5px 9px; border-radius: 999px; color: var(--muted); transition: background 0.3s, color 0.3s; }
.lang-toggle span.on { background: var(--surface-2); color: var(--text); }
.lang-toggle:hover span:not(.on) { color: var(--text); }
@media (max-width: 720px) { .lang-toggle { align-self: flex-start; margin: 14px 0 0; } }
pre.code code { background: none; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
table.data td.r, table.data th.r { white-space: nowrap; }
