/* Two lenses: plain (default, light) and tech (dark, code-flavored). */
:root {
  --bg: #FFFFFF; --ink: #15171C; --body: #30343B; --muted: #525862; --muted2: #878C95;
  --rule: #E3E6EB; --rule2: #D3D8DF; --panel: #F7F8FA; --chip: #EEF1F5; --seg: #EEF1F5; --seg-on: #FFFFFF;
  --accent: #1F4FD1; --accent-soft: rgba(31, 79, 209, .08); --tip-bg: #15171C; --tip-fg: #FFFFFF; --key: #1F4FD1; --str: #1A7F4B; --num: #B4441D; --good: #1A7F4B;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --chain: #C9D4F2;
  --head: var(--sans);
}
html[data-lens="tech"] {
  --bg: #0E1116; --ink: #E6E9EF; --body: #B9C0CC; --muted: #8B95A5; --muted2: #5F6B7C;
  --rule: #1F2630; --rule2: #2C3542; --panel: #141922; --chip: #1A2029; --seg: #1A2029; --seg-on: #2A3240;
  --accent: #7AA2F7; --accent-soft: rgba(122, 162, 247, .14); --chain: #2E3D5E; --tip-bg: #E6E9EF; --tip-fg: #0E1116; --key: #7AA2F7; --str: #9ECE6A; --num: #E0AF68; --good: #9ECE6A;
  --head: var(--mono);
  color-scheme: dark;
}
html:not([data-lens="tech"]) .t,
html[data-lens="tech"] .p { display: none !important; }

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s;
}
a { color: inherit; }
img { display: block; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- shared pieces ---------- */
.logo { font: 700 15px var(--head); letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--seg); flex-shrink: 0; }
html:not(.js) .seg { display: none; }
.seg button {
  min-height: 34px; padding: 0 12px; border: none; border-radius: 8px; background: transparent;
  color: var(--muted); font: 500 13px var(--sans); cursor: pointer; white-space: nowrap;
}
.seg button.code { font-family: var(--mono); }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; text-decoration: none;
}
.ln { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule2); }
.ln:hover { border-color: var(--ink); }
.lab { margin: 0; font: 12px var(--mono); letter-spacing: .06em; color: var(--muted2); }
h2 { margin: 6px 0 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-family: var(--head); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #2BB673; flex-shrink: 0; }
.code-block {
  margin: 18px 0 0; padding: 16px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--rule);
  font: 13px/1.75 var(--mono); color: var(--ink); overflow-x: auto; white-space: pre;
}
.c-cm { color: var(--muted2); } .c-k { color: var(--key); } .c-s { color: var(--str); } .c-n { color: var(--num); } .c-a { color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; padding: 0; list-style: none; }
.chips li { padding: 4px 9px; border-radius: 6px; background: var(--chip); font: 12px var(--mono); color: var(--body); }
.flow { margin: 14px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow span { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule2); background: var(--panel); font: 12px var(--mono); max-width: 100%; }
.flow span.hi { border-color: var(--accent); color: var(--accent); }
.flow i { font: normal 13px var(--mono); color: var(--muted2); }

/* ---------- homepage ---------- */
.page { max-width: 1520px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px); }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px 0; background: var(--bg); border-bottom: 1px solid transparent; transition: background-color .3s;
}
.topbar-r { display: flex; align-items: center; gap: 20px; }
.topbar-r .btn { min-height: 36px; padding: 0 14px; font-size: 14px; white-space: nowrap; }

/* hero: full width, scrolls away */
.hero { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 56px; padding: 64px 0 72px; position: relative; }
.hero > div { grid-column: 2; max-width: 1040px; }
.eyebrow { margin: 0; font-size: 18px; color: var(--body); }
.eyebrow b { color: var(--ink); font-weight: 600; }
.hero h1 { margin: 18px 0 0; font-size: clamp(2rem, 2.8vw, 2.5rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
@media (min-width: 761px) { .hero h1 em { white-space: nowrap; } }
.hero h1.t { font-size: 48px; line-height: 1.12; letter-spacing: -0.025em; }
.hero h1.t em { font-weight: 700; }
.lede { margin: 22px 0 0; font-size: 18px; line-height: 1.65; color: var(--body); max-width: 74ch; }
.creds { margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--muted); font-family: var(--mono); }
.creds span { display: inline-flex; align-items: center; gap: 8px; }
.creds span::before { content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); }
.links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px;
  border: 1px solid var(--rule2); background: var(--bg); color: var(--ink); transition: border-color .15s, color .15s;
}
.icon svg { width: 19px; height: 19px; fill: currentColor; }
.icon:hover { border-color: var(--ink); color: var(--accent); }

/* divider that fades out toward both ends */
.hero::after, .foot::before {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; opacity: .55;
  background: linear-gradient(90deg, transparent, var(--ink) 50%, transparent);
}
.hero::after { bottom: 0; }
.foot::before { top: 0; }

/* body: small sticky index + wide sections */
.body { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 56px; }
.toc { position: sticky; top: 72px; align-self: start; padding-top: 72px; display: flex; flex-direction: column; gap: 2px; font-family: var(--head); }
.toc a {
  display: flex; align-items: center; gap: 12px; min-height: 36px; text-decoration: none;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted2);
}
html[data-lens="tech"] .toc a { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; }
.toc a::before { content: ""; width: 20px; height: 1px; background: currentColor; transition: width .2s; }
.toc a:hover, .toc a[aria-current="true"] { color: var(--ink); }
.toc a:hover::before, .toc a[aria-current="true"]::before { width: 40px; }
.main { padding: 72px 0 80px; min-width: 0; max-width: 1040px; }
.sec + .sec { margin-top: 96px; }
.sec-head h2 { margin: 0; }

/* experience + education: a chain of logos down the left */
.chain { position: relative; margin-top: 28px; }
.chain::before {
  content: ""; position: absolute; left: 27px; top: 28px; bottom: 28px; width: 2px; border-radius: 2px;
  background: var(--chain);
}
.job { position: relative; display: grid; grid-template-columns: 56px 264px minmax(0, 1fr); gap: 0 28px; padding: 0 0 44px; }
.job:last-child { padding-bottom: 0; }
/* hide the chain line below the last logo */
.chain .job:last-child::after { content: ""; position: absolute; left: 0; top: 56px; bottom: 0; width: 56px; background: var(--bg); }
.node {
  position: relative; z-index: 1; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; padding: 9px;
  border: 2px solid var(--accent); background: #FFFFFF;
  box-shadow: 0 0 0 5px var(--bg); transition: transform .2s, box-shadow .3s;
}
.node.fill { padding: 0; }
.node.roomy { padding: 11px; }
.node.dark { padding: 8px; background: #16263A; }
.node img { width: 100%; height: 100%; object-fit: contain; }
.node.fill img { object-fit: cover; border-radius: 50%; }
.job:hover .node { transform: scale(1.06); }
.job h3 { margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; }
.job .co { margin: 4px 0 0; font-size: 16px; color: var(--ink); }
.co a { color: inherit; text-decoration: none; }
.co a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule2); }
.co .ext { display: inline-block; margin-left: 4px; font-size: 13px; color: var(--accent); opacity: 0; transform: translate(-2px, 2px); transition: opacity .15s, transform .15s; }
.co a:hover .ext, .co a:focus-visible .ext { opacity: 1; transform: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.when { margin: 8px 0 0; font: 12.5px/1.5 var(--mono); color: var(--muted); }
.loc { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.bul { margin: 0; padding-left: 18px; font-size: 16.5px; line-height: 1.65; color: var(--body); max-width: 80ch; }
.bul li + li { margin-top: 8px; }
.bul li::marker { color: var(--accent); }
/* key results (the phrases bolded on the resume): darker ink, medium weight */
mark { background: none; color: var(--ink); font-weight: 500; }
.edu-note { margin: 0; font-size: 16.5px; line-height: 1.65; color: var(--body); max-width: 80ch; text-wrap: pretty; }
.edu-note + .edu-note { margin-top: 8px; }
.edu-note b { font-weight: 500; color: var(--ink); }
.edu-note a { color: var(--accent); }
.more-link { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 600; }

.trace { margin-top: 20px; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--panel); }
.tr-h, .tr-row > div { display: flex; align-items: center; }
.tr-h { padding: 10px 16px; border-bottom: 1px solid var(--rule); font: 11px var(--mono); color: var(--muted2); }
.tr-name { width: 240px; flex-shrink: 0; }
.tr-axis { flex: 1; display: flex; justify-content: space-between; }
.tr-row { padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.tr-row:last-child { border-bottom: 0; }
.tr-row .tr-name { font: 12.5px var(--mono); }
.tr-row .tr-name::before { content: "● "; color: var(--c); }
.tr-bar { flex: 1; position: relative; height: 10px; }
.tr-bar::after { content: ""; position: absolute; top: 0; height: 10px; border-radius: 3px; left: var(--l); width: var(--w); background: var(--c); }

/* projects: rows with a small picture tile */
.grid2 { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 44px; }
.proj { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0 22px; padding: 24px 0; border-top: 1px solid var(--rule); }
.grid2 .proj:nth-child(-n+2) { border-top: 0; }
.thumb { width: 160px; height: 120px; border-radius: 12px; overflow: hidden; background: var(--rule); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb svg { display: block; width: 100%; height: 100%; }
.thumb:has(svg) { display: grid; place-items: center; }
.thumb svg { width: 132px; height: 96px; }
.proj h3 { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -0.01em; }
.badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--chip); font: 600 11px var(--sans); color: var(--ink); vertical-align: 2px; }
.ctx { margin: 3px 0 0; font-size: 13px; color: var(--muted2); }
.proj .desc { margin: 10px 0 0; font-size: 16px; line-height: 1.6; color: var(--body); max-width: 80ch; }
.plinks { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; font-weight: 600; }
.plinks .note { font-weight: 400; color: var(--muted2); }

/* skills, education, contact */
.skills { margin-top: 20px; }
.skills > div { display: grid; grid-template-columns: 348px minmax(0, 1fr); gap: 0 28px; padding: 18px 0; border-top: 1px solid var(--rule); }
.skills > div:first-child { border-top: 0; padding-top: 4px; }
.skills h3 { margin: 0; font-size: 17px; font-weight: 600; }
.skills h3 + p { margin: 4px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.skills .chips { margin: 0; align-self: start; }
.skills .chips li { font-family: var(--mono); font-size: 13.5px; font-weight: 500; padding: 6px 11px; border-radius: 4px; background: var(--panel); border: 1px solid var(--rule2); color: var(--ink); }
/* skills with evidence open a "used in" card on hover or tap */
.skills li[data-used] { position: relative; cursor: help; transition: border-color .15s, background-color .15s; }
.skills li[data-used]:hover, .skills li[data-used].on { border-color: var(--accent); background: var(--accent-soft); }
.skill-tip {
  position: absolute; z-index: 6; left: 0; top: calc(100% + 8px); width: max-content; max-width: 280px;
  padding: 9px 12px; border-radius: 9px; background: var(--tip-bg); color: var(--tip-fg);
  font: 400 13px/1.5 var(--sans); text-decoration: none; cursor: default; box-shadow: 0 10px 28px rgba(0,0,0,.18);
}
.skill-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.skill-tip.flip { left: auto; right: 0; }
.skill-tip b { font-weight: 600; }
.skill-tip a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.skill-tip a:hover { text-decoration-color: currentColor; }
/* the role or project a skill link jumps to */
@keyframes flash { 0%, 60% { background: var(--accent-soft); } 100% { background: transparent; } }
.flash { animation: flash 1.8s ease-out; border-radius: 12px; }
.contact-box { margin-top: 20px; padding: 32px 36px; border-radius: 18px; border: 1px solid var(--rule); background: var(--panel); }
.contact { margin: 0; font-size: 19px; line-height: 1.6; color: var(--body); text-wrap: pretty; }
.contact-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }
.cbtn { gap: 9px; justify-content: center; background: var(--bg); color: var(--ink); border: 1px solid var(--rule2); font-weight: 500; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.cbtn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cbtn svg { width: 16px; height: 16px; flex: none; fill: currentColor; color: var(--accent); }
.cbtn svg[fill="none"] { fill: none; }
.cbtn.copy { font-family: var(--mono); font-size: 14px; }
.cbtn.copy svg { color: var(--muted); }
.cbtn.copy:hover svg { color: var(--accent); }
.cbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cursor { display: inline-block; width: 8px; height: 15px; vertical-align: -2px; background: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.foot { margin: 0; padding: 20px 0 32px; position: relative; font-size: 13px; color: var(--muted2); }
.foot .ln { font-size: 13px; }

@media (max-width: 1100px) {
  .page { padding: 0 32px; }
  .hero h1.t { font-size: 40px; }
  .body, .hero { grid-template-columns: 1fr; }
  .hero > div { grid-column: 1; }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .job { grid-template-columns: 56px minmax(0, 1fr); gap: 14px 20px; }
  .job > div:last-child { grid-column: 2; }
}
@media (max-width: 760px) {
  .page { padding: 0 16px; }
  .topbar-r { gap: 10px; }
  .topbar-r .btn { padding: 0 12px; font-size: 13px; }
  .hero { padding: 32px 0 48px; }
  .hero h1 { font-size: 30px; } .hero h1.t { font-size: 28px; }
  .lede { font-size: 17px; }
  .main { padding-top: 48px; }
  .chain::before { left: 21px; top: 22px; }
  .job { grid-template-columns: 44px minmax(0, 1fr); gap: 14px 16px; padding-bottom: 36px; }
  .job > div:last-child { grid-column: 2; }
  .node { width: 44px; height: 44px; padding: 6px; border-width: 2px; }
  .chain .job:last-child::after { top: 44px; width: 44px; }
  .skills > div { grid-template-columns: 1fr; gap: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 .proj:nth-child(2) { border-top: 1px solid var(--rule); }
  .proj { grid-template-columns: 112px minmax(0, 1fr); gap: 0 16px; }
  .thumb { width: 112px; height: 84px; }
  .thumb svg { width: 104px; height: 76px; }
  .tr-axis, .tr-bar { display: none; }
  .tr-name { width: auto; }
  .seg button { padding: 0 9px; font-size: 12px; }
  .logo { font-size: 13px; }
  .contact-box { padding: 22px; }
  .contact { font-size: 17px; }
  .contact-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cbtn.mail, .cbtn.copy { grid-column: 1 / -1; }

}
@media (max-width: 440px) {
  .topbar .logo { display: none; }
  .topbar-r { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .cursor { animation: none; }
  .toc a::before { transition: none; }
  .flash { animation: none; }
  .node { transition: none; }
  .job:hover .node { transform: none; }
}

/* ---------- article pages (case studies) ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px 80px; }
.nav {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 16px 0; background: var(--bg); transition: background-color .3s;
}
.nav-r { display: flex; align-items: center; gap: 22px; }
.wrap .hero { display: block; padding: 48px 0 0; border: 0; }
.wrap h1 { margin: 18px 0 0; font-size: 44px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.wrap .lede { max-width: none; font-size: 18px; }
.wrap .sec { padding-top: 72px; }
.wrap .sec + .sec { margin-top: 0; }
.wrap footer { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted2); }
.wrap footer .ln { font-size: 13px; }
@media (max-width: 700px) {
  .wrap { padding: 0 16px 56px; }
  .wrap h1 { font-size: 32px; }
}

.plinks .play { color: var(--accent); border-color: var(--accent); }
