/* Venkatesh Shanmugam — portfolio v3
   Tokens first: light on bare :root, dark via OS preference or the toggle. */
:root {
  --bg: #f7f6f2;
  --bg-alt: #efede6;
  --panel: #ffffff;
  --panel-2: #f3f1ea;
  --line: #e1ddd2;
  --line-strong: #c9c3b4;
  --text: #17181a;
  --text-2: #4a4c50;
  --muted: #74767b;
  --accent: #0b6e63;
  --accent-soft: #dcefeb;
  --accent-ink: #064c44;
  --model: #6d4bc9;
  --model-soft: #ece6fb;
  --code: #0b6e63;
  --code-soft: #dcefeb;
  --human: #b45a12;
  --human-soft: #fbeadb;
  --data: #34618f;
  --data-soft: #e2ebf5;
  --shadow: 0 1px 2px rgba(23, 24, 26, .04), 0 8px 24px -12px rgba(23, 24, 26, .12);
  --font: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --container: 1240px;
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012; --bg-alt: #131619; --panel: #16191c; --panel-2: #1b1f23;
    --line: #262b30; --line-strong: #353b42;
    --text: #eef0f2; --text-2: #b9bec4; --muted: #868c93;
    --accent: #4fd1bd; --accent-soft: #12302c; --accent-ink: #9be8db;
    --model: #a993f0; --model-soft: #241d3a;
    --code: #4fd1bd; --code-soft: #12302c;
    --human: #f0a465; --human-soft: #36230f;
    --data: #82b1e3; --data-soft: #16263a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1012; --bg-alt: #131619; --panel: #16191c; --panel-2: #1b1f23;
  --line: #262b30; --line-strong: #353b42;
  --text: #eef0f2; --text-2: #b9bec4; --muted: #868c93;
  --accent: #4fd1bd; --accent-soft: #12302c; --accent-ink: #9be8db;
  --model: #a993f0; --model-soft: #241d3a;
  --code: #4fd1bd; --code-soft: #12302c;
  --human: #f0a465; --human-soft: #36230f;
  --data: #82b1e3; --data-soft: #16263a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--container); margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Nav ── */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-in { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { font-weight: 650; text-decoration: none; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--text-2); font-size: 14px; padding: 6px 11px; border-radius: 8px; transition: color .15s, background .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--panel-2); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
.nav-toggle { display: none; }
#progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); }

/* ── Buttons, chips ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 550; text-decoration: none; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn svg { width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: var(--panel); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.tag { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.tag.model { color: var(--model); background: var(--model-soft); }
.tag.code { color: var(--code); background: var(--code-soft); }
.tag.human { color: var(--human); background: var(--human-soft); }
.tag.data { color: var(--data); background: var(--data-soft); }

/* ── Sections ── */
section { padding-block: clamp(56px, 8vw, 104px); }
section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px 64px; align-items: end; margin-bottom: 40px; }
.sec-head h2 { font-size: clamp(28px, 3.6vw, 42px); font-weight: 600; margin-top: 10px; }
.sec-head p { color: var(--text-2); font-size: 17px; max-width: 62ch; }

/* ── Hero ── */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(48px, 7vw, 80px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); font-weight: 650; letter-spacing: -0.035em; }
.hero .role { margin-top: 14px; font-size: 18px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.hero .role .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.hero .lede { margin-top: 22px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--text); max-width: 56ch; }
.hero .lede em { font-style: normal; color: var(--accent-ink); background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.hero .ctas { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px; }
.proof-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.proof-panel .pp-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.proof-grid { display: grid; grid-template-columns: 1fr 1fr; }
.proof { padding: 20px 18px; border-bottom: 1px solid var(--line); }
.proof:nth-child(odd) { border-right: 1px solid var(--line); }
.proof:nth-last-child(-n+2) { border-bottom: 0; }
.proof .v { font-size: clamp(26px, 3vw, 34px); font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.proof .l { font-size: 13.5px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }

/* ── Pillars ── */
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.pillar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.pillar .pi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.pillar .pi svg { width: 20px; height: 20px; }
.pillar h3 { font-size: 19px; font-weight: 600; }
.pillar .belief { color: var(--text-2); font-size: 15px; }
.pillar ul { display: grid; gap: 8px; margin-top: 4px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pillar li { font-size: 14px; color: var(--text-2); display: grid; grid-template-columns: auto 1fr; gap: 8px; line-height: 1.45; }
.pillar li b { color: var(--text); font-weight: 600; }
.pillar li .where { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; height: fit-content; margin-top: 2px; }

/* ── Experience ── */
.xp { display: grid; gap: 20px; }
.job { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.job-side .when { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.job-side h3 { font-size: 21px; font-weight: 600; margin-top: 8px; }
.job-side .co { margin-top: 4px; color: var(--text-2); }
.job-side .badge { margin-top: 12px; display: inline-block; }
.job-side .ctx { margin-top: 14px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.job-main { display: grid; gap: 22px; min-width: 0; }
.wins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.win { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--panel-2); display: grid; gap: 6px; align-content: start; }
.win h4 { font-size: 15.5px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.win h4 .k { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.win p { font-size: 14.5px; color: var(--text-2); line-height: 1.5; }
.bullets { display: grid; gap: 10px; }
.bullets li { position: relative; padding-left: 18px; color: var(--text-2); font-size: 15px; }
.bullets li::before { content: ''; position: absolute; left: 0; top: .7em; width: 7px; height: 1.5px; background: var(--accent); }
.bullets b { color: var(--text); font-weight: 600; }
.job.compact { padding: 22px 28px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.split-col { display: grid; gap: 12px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.split-head { display: grid; gap: 6px; padding-bottom: 10px; }
.split-head .tag { justify-self: start; }
.split-head h4 { font-size: 19px; font-weight: 600; }
.split-head p { font-size: 14.5px; color: var(--text-2); }
.job.wide { grid-template-columns: minmax(0, 1fr); gap: 22px; }
.job.wide .job-side { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 40px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.job.wide .job-side > :not(.ctx) { grid-column: 1; }
.job.wide .job-side .ctx { grid-column: 2; grid-row: 1 / span 4; margin: 0; max-width: 60ch; font-size: 15px; align-self: center; }
.job.wide .wins { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ── Flow diagrams (HTML, wraps on phones) ── */
.diagram { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px; display: grid; gap: 14px; min-width: 0; }
.diagram-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.diagram-title h4 { font-size: 15px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.flow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; align-items: stretch; }
.step { position: relative; display: grid; gap: 6px; align-content: start; padding: 14px 14px 14px; margin-right: 22px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); min-width: 0; }
.step:last-child { margin-right: 0; }
.step:not(:last-child)::after {
  content: ''; position: absolute; right: -17px; top: 50%; width: 12px; height: 12px;
  border-top: 2px solid var(--line-strong); border-right: 2px solid var(--line-strong); transform: translateY(-50%) rotate(45deg);
}
.step .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.step h5 { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.step p { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.step.model { border-color: color-mix(in srgb, var(--model) 40%, var(--line)); }
.step.code { border-color: color-mix(in srgb, var(--code) 40%, var(--line)); }
.step.human { border-color: color-mix(in srgb, var(--human) 45%, var(--line)); }
.step.data { border-color: color-mix(in srgb, var(--data) 40%, var(--line)); }
.step .tag { justify-self: start; }
.diagram .foot { font-size: 13px; color: var(--muted); }

/* ── Projects ── */
.proj-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.proj-switch button {
  font: inherit; font-size: 14.5px; cursor: pointer; text-align: left; display: grid; gap: 2px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); min-width: 0; flex: 1 1 240px;
}
.proj-switch button b { color: var(--text); font-weight: 600; }
.proj-switch button span { font-size: 13px; }
.proj-switch button[aria-selected="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.project { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.p-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; padding: clamp(20px, 3vw, 36px); align-items: start; }
.p-top h3 { font-size: clamp(24px, 2.6vw, 32px); font-weight: 620; }
.p-top .kicker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.p-top .pitch { margin-top: 14px; font-size: 17px; color: var(--text-2); max-width: 60ch; }
.p-top .links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.p-shot { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.p-shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 18px clamp(16px, 2.5vw, 28px); border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--text-2); line-height: 1.4; margin-top: 2px; }
.tabs { display: flex; gap: 4px; padding: 12px clamp(16px, 2.5vw, 28px) 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; background: none; border: 0; color: var(--muted);
  padding: 10px 12px 12px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel { padding: clamp(20px, 3vw, 36px); display: grid; gap: 24px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 32px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; background: var(--panel-2); display: grid; gap: 8px; align-content: start; }
.card h4 { font-size: 15.5px; font-weight: 600; }
.card p { font-size: 14.5px; color: var(--text-2); line-height: 1.5; }
.prose { display: grid; gap: 12px; align-content: start; color: var(--text-2); font-size: 16px; max-width: 70ch; }
.prose b { color: var(--text); font-weight: 600; }
.subhead { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Results table */
.results { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.results th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.results td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.results td:first-child { color: var(--text); font-weight: 500; }
.results td.n { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); font-weight: 600; }
.results tr:last-child td { border-bottom: 0; }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.base i { background: var(--line-strong); }

/* Graph explainer */
.graph-explain { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; }
.graph-svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.graph-svg text { font-family: var(--font); fill: var(--text); }
.graph-svg .sm { font-size: 11px; fill: var(--text-2); }
.graph-svg .edge { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
.graph-svg .elabel { font-family: var(--mono); font-size: 9.5px; fill: var(--muted); }

/* Live graph embed: screenshot until clicked, then the real app */
.live { margin: 0; display: grid; gap: 10px; }
.live-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.live-frame img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; filter: saturate(1.05); }
.live-cta { position: absolute; inset: auto 0 0 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 48px 16px 20px;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 92%, transparent), transparent); }
.live-frame iframe { display: block; width: 100%; height: min(78vh, 760px); border: 0; background: #fff; }
.live figcaption { font-size: 14px; color: var(--text-2); line-height: 1.5; max-width: 90ch; }
.live figcaption b { color: var(--text); font-weight: 600; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.gallery figure { margin: 0; display: grid; gap: 8px; }
.gallery img { border-radius: 10px; border: 1px solid var(--line); aspect-ratio: 16 / 10; object-fit: cover; object-position: top; width: 100%; cursor: zoom-in; background: var(--panel-2); }
.gallery figcaption { font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.note { font-size: 13.5px; color: var(--muted); border-left: 2px solid var(--line-strong); padding-left: 12px; }

.minor-projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }

/* ── Skills ── */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.skill { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; align-content: start; }
.skill h3 { font-size: 16.5px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.skill h3 small { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.skill .used { font-size: 13.5px; color: var(--text-2); border-top: 1px dashed var(--line); padding-top: 10px; line-height: 1.5; }

/* ── Background (edu, pubs) ── */
.bg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; }
.list-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 4px; align-content: start; }
.list-card h3 { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { font-weight: 550; font-size: 15px; }
.row .s { color: var(--text-2); font-size: 14px; grid-column: 1; }
.row .d { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; grid-column: 2; grid-row: 1; }
.row a.t { text-decoration: none; }
.row a.t:hover { color: var(--accent); }

/* ── Contact ── */
.contact { text-align: left; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 4vw, 48px); box-shadow: var(--shadow); }
.contact h2 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 620; }
.contact p { color: var(--text-2); margin-top: 12px; font-size: 17px; max-width: 52ch; }
.contact .links { display: grid; gap: 10px; }
.contact .links a { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 550; min-width: 0; }
.contact .links a span { color: var(--muted); font-weight: 400; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .links a:hover { border-color: var(--line-strong); }
footer { padding-block: 32px 48px; color: var(--muted); font-size: 13.5px; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 9, 10, .86); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-height: 90vh; border-radius: 10px; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .step { margin-right: 0; }
  .step:not(:last-child)::after { display: none; }
}
@media (max-width: 900px) {
  .job.wide .job-side { grid-template-columns: minmax(0, 1fr); }
  .job.wide .job-side .ctx { grid-column: 1; grid-row: auto; margin-top: 10px; }
  .job.wide .wins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid, .sec-head, .p-top, .two, .graph-explain, .bg-grid, .contact { grid-template-columns: minmax(0, 1fr); }
  .job { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .three { grid-template-columns: minmax(0, 1fr); }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: grid; margin-left: auto; }
  .nav-in .theme-toggle { margin-left: 0; }
}
@media (max-width: 640px) {
  .split, .pillars, .skills, .wins, .job.wide .wins, .gallery, .minor-projects { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .proof .v { font-size: 24px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .job, .job.compact { padding: 20px; }
}

/* ── v6: homepage restructure ── */
.nav-links a.nav-cta { border: 1px solid var(--line); margin-left: 6px; color: var(--text); }
.hero .lede { max-width: 62ch; }
.impact { margin-top: clamp(36px, 5vw, 56px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; }
.impact-item { padding: 22px clamp(18px, 2vw, 26px); border-right: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
.impact-item:last-child { border-right: 0; }
.impact-item .v { font-size: clamp(24px, 2.6vw, 30px); font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.impact-item p { font-size: 14.5px; color: var(--text-2); line-height: 1.5; }
.impact-item b { color: var(--text); font-weight: 600; }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.work-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; box-shadow: var(--shadow); }
.work-shot { display: block; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow: hidden; }
.work-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; transition: transform .3s ease; }
.work-card:hover .work-shot img { transform: scale(1.015); }
.work-body { padding: clamp(18px, 2.4vw, 28px); display: grid; gap: 12px; align-content: start; }
.work-body h3 { font-size: 24px; font-weight: 620; }
.work-body p { color: var(--text-2); font-size: 15.5px; }
.work-body .caption { font-size: 14px; color: var(--muted); font-style: italic; }
.result { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; font-size: 15px; color: var(--text-2); }
.result b { color: var(--text); font-size: 17px; font-weight: 650; }
.result span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.work-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.job > .bullets { min-width: 0; }
.split-col .bullets li { font-size: 14.5px; }
.earlier { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.earlier-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 32px; padding: 16px 28px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--text-2); }
.earlier-row:last-child { border-bottom: 0; }
.earlier-row b { color: var(--text); font-weight: 600; }
.earlier-row .when { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.about-main { display: grid; gap: 14px; }
.about-main h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 600; }
.about-main > p { color: var(--text-2); font-size: 16.5px; max-width: 64ch; }
.about-main .stack { font-size: 14.5px; line-height: 1.7; }
.about-main .stack .subhead { display: block; margin-bottom: 4px; }
.pubs { border-top: 1px solid var(--line); padding-top: 12px; }
.pubs summary { cursor: pointer; font-weight: 550; font-size: 15px; }
.pubs ul { display: grid; gap: 8px; margin-top: 12px; font-size: 14.5px; color: var(--text-2); }
.pubs a { color: var(--text); }
.contact-links { display: grid; gap: 10px; }
.contact-links a { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 550; min-width: 0; }
.contact-links a span { color: var(--muted); font-weight: 400; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-links a:hover { border-color: var(--line-strong); }

/* ── Case study pages ── */
.cs-hero { padding-block: clamp(32px, 5vw, 64px) clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.cs-hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 640; letter-spacing: -0.03em; max-width: 24ch; margin-top: 10px; }
.cs-hero .lede { margin-top: 16px; font-size: clamp(17px, 1.5vw, 19px); color: var(--text-2); max-width: 66ch; }
.cs-hero .ctas { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.back { display: inline-block; margin-bottom: 18px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.facts { margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.facts div { padding: 14px 18px; border-right: 1px solid var(--line); }
.facts div:last-child { border-right: 0; }
.facts dt { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: 15px; font-weight: 550; }
.facts dd span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.cs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-block: 40px 80px; }
.toc { position: sticky; top: calc(84px + env(safe-area-inset-top, 0px)); align-self: start; display: grid; gap: 2px; }
.toc .subhead { margin-bottom: 8px; }
.toc a { text-decoration: none; color: var(--text-2); font-size: 14px; padding: 6px 10px; border-left: 2px solid var(--line); }
.toc a:hover, .toc a.active { color: var(--text); border-left-color: var(--accent); }
.cs-body { min-width: 0; display: grid; gap: 64px; }
.cs-body > section { padding: 0; display: grid; gap: 22px; scroll-margin-top: 84px; }
.cs-body h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 620; display: flex; align-items: baseline; gap: 12px; }
.cs-body h2 .num { font-family: var(--mono); font-size: 14px; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 7px; }
.cs-body h3 { font-size: 19px; font-weight: 600; margin-top: 14px; }
.cs-body .prose { max-width: 72ch; }
.results caption { caption-side: top; text-align: left; padding: 12px 12px 4px; font-size: 13px; color: var(--muted); }
.results .sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Lightbox: native dialog gives focus trap and Esc */
.zoom { all: unset; display: block; cursor: zoom-in; border-radius: 10px; }
.zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
dialog.lightbox-dlg { border: 0; padding: 0; background: transparent; max-width: min(1400px, 94vw); overflow: visible; }
dialog.lightbox-dlg::backdrop { background: rgba(8, 9, 10, .86); }
dialog.lightbox-dlg img { max-height: 86vh; border-radius: 10px; }
dialog.lightbox-dlg .close { position: absolute; top: 10px; right: 10px; }

@media (max-width: 1000px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .cs { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .toc .subhead { width: 100%; margin: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
}
@media (max-width: 760px) {
  .impact, .facts { grid-template-columns: minmax(0, 1fr); }
  .impact-item, .facts div { border-right: 0; border-bottom: 1px solid var(--line); }
  .impact-item:last-child, .facts div:last-child { border-bottom: 0; }
  .about { grid-template-columns: minmax(0, 1fr); }
  .earlier-row { grid-template-columns: minmax(0, 1fr); padding: 14px 20px; }
}

/* ── v7: rotating project screenshots + focus chips ── */
.focus { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.focus li { font-size: 13.5px; font-weight: 550; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.shots { position: relative; border-bottom: 1px solid var(--line); background: #0e1012; overflow: hidden; }
.slides { display: grid; }
.slides img { grid-area: 1 / 1; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; opacity: 0; transition: opacity .7s ease; }
.slides img.on { opacity: 1; }
.shot-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 36px 14px 12px; background: linear-gradient(to top, rgba(8, 9, 10, .82), transparent); pointer-events: none; }
.shot-label { color: #f2f4f5; font-size: 13px; font-weight: 550; line-height: 1.35; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.dots { display: flex; gap: 6px; pointer-events: auto; flex-shrink: 0; }
.dots button { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.dots button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.45); transition: background .2s, transform .2s; }
.dots button[aria-pressed="true"]::before { background: #fff; transform: scale(1.25); }
.dots button:focus-visible { outline: 2px solid #fff; outline-offset: 0; border-radius: 50%; }
