/* Vinh Ha — engineering portfolio.

   Modern technical, professional. Geist for text, Geist Mono for meta labels,
   a cool neutral ground with one cobalt accent, soft 12px radii and quiet
   hairlines. One stylesheet serves the static site (portfolio/build.mjs) and the
   React component library in portfolio/ds, so both render identical markup. */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light;
  --bg: #fbfbfc;
  --bg-2: #f3f4f6;
  --bg-3: #eaecf0;
  --surface: #ffffff;
  --line: #e5e7eb;
  --line-2: #d3d7de;
  --ink: #0c0e13;
  --ink-2: #474d59;
  --ink-3: #7b818c;
  --accent: #2f5bea;
  --accent-2: #1f43c4;
  --accent-soft: #eaf0ff;
  --font-sans: "Geist", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(12, 14, 19, 0.04), 0 8px 24px rgba(12, 14, 19, 0.06);
  --shadow-lift: 0 2px 4px rgba(12, 14, 19, 0.05), 0 18px 40px rgba(12, 14, 19, 0.1);
  --wrap: 1240px;
  --prose: 920px;
  --col-a: 1.05fr;
  --col-b: 1fr;
  --grid-gap: clamp(24px, 3vw, 48px);
  --gutter: clamp(20px, 5vw, 56px);
  --nav-bg: rgba(251, 251, 252, 0.82);
  --dot: #c3c9d3;
  --btn-ink: #ffffff;
  --paper: #ffffff;
}

/* Dark theme. Light is the default for every visitor; the toggle in the nav
   writes data-theme on <html> and site.js remembers the choice in localStorage.
   Same tokens, so every component follows without a rule of its own. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e12;
  --bg-2: #12161b;
  --bg-3: #1a1f26;
  --surface: #111519;
  --line: #232a32;
  --line-2: #333b45;
  --ink: #eef1f5;
  --ink-2: #aeb6c1;
  --ink-3: #7c8694;
  --accent: #6f93ff;
  --accent-2: #a8beff;
  --accent-soft: #17203a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(11, 14, 18, 0.82);
  --dot: #262e38;
  --btn-ink: #0b0e12;
}


* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

::selection { background: var(--accent-soft); color: var(--accent-2); }

code {
  font: 500 0.86em/1.4 var(--font-mono);
  background: var(--bg-3);
  padding: 0.14em 0.42em;
  border-radius: 5px;
}

/* Small uppercase meta label: venue, dates, section kickers. */
.eyebrow,
.hero-sub {
  margin: 0;
  font: 500 12.5px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px var(--gutter);
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  flex: none;
}

.mark::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav nav { display: flex; gap: clamp(16px, 2.6vw, 34px); }

.nav nav a {
  position: relative;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  transition: color 0.15s;
}

.nav nav a:hover { color: var(--ink); }
.nav nav a.on { color: var(--ink); }
.nav nav a.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -15px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-start { display: flex; align-items: center; gap: 14px; flex: none; }
.nav-end { display: flex; align-items: center; gap: 12px; }

.menu {
  display: none;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

/* ------------------------------------------------------------------ hero */

.hero {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(48px, 7vw, 96px) var(--gutter) clamp(28px, 3.5vw, 44px);
}

.hero h1 {
  margin: 14px 0 0;
  font-size: clamp(40px, 6.2vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
  text-wrap: balance;
  max-width: 17ch;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, var(--col-a)) minmax(0, var(--col-b));
  gap: var(--grid-gap);
  align-items: stretch;
}

/* Title block pinned to the top of the cover, key facts to its bottom edge. */
.head-text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
}

.page-head-solo { grid-template-columns: minmax(0, 1fr); }
.page-head-solo h1 { max-width: 22ch; }
.page-head-solo .head-lede { max-width: 60ch; }
.page-head-solo .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  margin: 0;
  border-top: 1px solid var(--line);
}

.facts > div { padding: 15px 0 14px; border-bottom: 1px solid var(--line); }
.facts > div.wide { grid-column: 1 / -1; }
.page-head-solo .facts > div.wide { grid-column: span 2; }

.facts dt {
  margin-bottom: 7px;
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.facts dd { margin: 0; font-size: 15.5px; line-height: 1.45; color: var(--ink); }
.facts dd a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.facts dd a:hover { color: var(--accent); text-decoration-color: currentColor; }

.page-head h1 { font-size: clamp(36px, 4.8vw, 58px); max-width: 100%; }

.head-lede {
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: clamp(18px, 1.9vw, 21px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  max-width: 36ch;
}

.head-media {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.head-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Home hero: statement left, portrait right, on a faint dot grid. */
.hero-home {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.hero-home h1 { max-width: 100%; }

.hero-lede {
  margin: 24px 0 0;
  color: var(--ink-2);
  font-size: clamp(18px, 1.7vw, 20px);
  line-height: 1.6;
  max-width: 50ch;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.portrait {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  aspect-ratio: 4 / 5;
}

.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

.portrait-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
  padding: 24px;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ main */

main {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(8px, 1.5vw, 20px) var(--gutter) 96px;
}

.lede {
  max-width: var(--prose);
  margin: 0 0 34px;
  color: var(--ink-2);
  font-size: 19px;
}

h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 30px 0 14px;
  font-weight: 600;
}

h3 { font-size: 20px; letter-spacing: -0.015em; margin: 30px 0 10px; font-weight: 600; }

.strip { padding-top: clamp(40px, 5vw, 64px); }
.strip > h2:first-child { margin-top: 0; }

.strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.strip-head h2 { margin: 0; }

.link-arrow {
  font: 500 14px/1 var(--font-sans);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.link-arrow::after { content: " →"; transition: margin 0.15s; }
.link-arrow:hover { color: var(--accent); }

/* --------------------------------------------------------------- filters */

.filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  margin-bottom: 34px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 100%;
}

.filter {
  background: transparent;
  border: 0;
  color: var(--ink-2);
  padding: 8px 15px;
  border-radius: 999px;
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
  transition: 0.15s;
}

.filter:hover { color: var(--ink); }
.filter.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(12, 14, 19, 0.08), 0 0 0 1px var(--line); }

/* ------------------------------------------------------------------ grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px 24px;
}

.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.card[hidden] { display: none; }
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); border-color: var(--line-2); }

.card-frame {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
}

.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-img { transform: scale(1.03); }

.card-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--ink-3);
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.card-line { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; }

.card-meta { display: flex; justify-content: space-between; gap: 12px; }

.card-badge, .card-year {
  font: 500 12px/1.3 var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card-year { flex: none; font-variant-numeric: tabular-nums; }

.card-title {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.card:hover .card-title { color: var(--accent); }

/* ---------------------------------------------------------------- prose */

.prose { max-width: 100%; }

/* A section: prose across the full width, wrapping around figures floated right
   and level with the heading. flow-root keeps the floats inside their section. */
.row {
  display: flow-root;
  margin: 0 0 60px;
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.prose > .row:first-child { border-top: 0; padding-top: 12px; }
.row h2 { margin-top: 0; }

.row figure.float {
  float: right;
  clear: right;
  width: var(--fw, 46%);
  margin: 4px 0 26px clamp(28px, 3.2vw, 52px);
}

.row:not(:has(> figure.float)) ul.short {
  columns: 2;
  column-gap: clamp(32px, 4vw, 64px);
}

.row ul.short li { break-inside: avoid; }

.row-gallery {
  clear: both;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 22px;
  padding-top: 14px;
}

.row-gallery figure { margin: 0; }

/* Short sections set side by side as cards: figure on top, heading and text under. */
.row-set {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 28px clamp(24px, 3vw, 44px);
  margin: 0 0 60px;
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.row-set .row { margin: 0; padding: 0; border: 0; }
.row-set .row figure { margin: 0 0 22px; }
.row-set .row h2 { font-size: clamp(21px, 2vw, 25px); }
.row-set .row figcaption { min-height: 3em; }

/* Figures in rows and cards share one frame shape, so neighbours line up. */
.row-set .row figure img, .row-set .row figure.fit img,
.row .row-gallery figure img, .row .row-gallery figure.fit img { aspect-ratio: 16 / 10; max-height: none; }

.row figure img,
.row figure video {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
  height: auto;
}

.row figure.fit img {
  aspect-ratio: auto;
  object-fit: contain;
  max-height: 380px;
  background: var(--surface);
  padding: 12px;
}

.prose p { margin: 0 0 17px; color: var(--ink-2); }
.prose ul { padding-left: 20px; color: var(--ink-2); }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--ink-3); }
.prose strong { font-weight: 600; color: var(--ink); }

.disclosure {
  max-width: 100%;
  margin: 0 0 38px;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
}

.gap {
  max-width: var(--prose);
  margin: 26px 0;
  padding: 15px 17px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.gap p { margin: 0; color: var(--ink-2); font-size: 16px; }

.gap-tag {
  display: block;
  margin-bottom: 6px;
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* --------------------------------------------------------------- images */

.page-hero { margin: 0 0 38px; max-width: 760px; }

.page-hero img,
figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
}

figure { margin: 22px 0; max-width: 100%; }

figcaption {
  margin-top: 9px;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
}

figure.video video {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.page-hero video { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); display: block; }

/* An interactive 3D model runs the full width of the article. */
.row-model { margin: 0 0 56px; }
figure.model { margin: 0; }
figure.model iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #2e5b4c;
  box-shadow: var(--shadow-lift);
}
figure.model figcaption { margin-top: 12px; }

/* ------------------------------------------------------ skills + others */

.skills, .others {
  max-width: none;
  margin: 48px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.skills h2, .others h2 {
  margin: 0 0 16px;
  font: 500 12.5px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.skills ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }

.skills li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  color: var(--ink-2);
}

.other-links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 26px; }
.other-links a { color: var(--ink-2); font-size: 16px; text-decoration: none; }
.other-links a:hover { color: var(--accent); }

/* ------------------------------------------------------------- timeline */

.timeline {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 2px 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.timeline li:last-child { border-bottom: 1px solid var(--line); }

.timeline .when {
  grid-row: span 3;
  font: 400 13px/1.7 var(--font-mono);
  color: var(--ink-3);
}

.timeline b { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.timeline b a { text-decoration: none; }
.timeline b a:hover { color: var(--accent); }
.timeline span { color: var(--ink-2); font-size: 15.5px; }
.timeline .where { color: var(--ink-3); font-size: 14px; }

.timeline-lg b { font-size: 21px; }

.edu-notes { margin: 14px 0 0; padding: 0 0 0 20px; color: var(--ink-2); font-size: 15.5px; }
.edu-notes li { margin-bottom: 5px; }

.role-meta { margin: 0 0 32px; font: 500 12.5px/1.3 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------------ btn */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: var(--btn-ink);
  font: 500 15px/1.2 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover { background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 18px rgba(47, 91, 234, 0.25); }

.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); box-shadow: none; }

.btn-sm { padding: 7px 14px; font-size: 14px; border-radius: 8px; }

/* --------------------------------------------------------------- footer */

footer {
  padding: 32px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 14px;
}

footer .footer-in {
  max-width: var(--wrap);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}

footer p { margin: 0; }
footer a { color: var(--ink-2); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- contact */


/* ----------------------------------------------------------------- resume */

.resume-embed {
  display: block;
  width: 100%;
  height: min(84vh, 1200px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}

/* --------------------------------------------------- experience index grid */

.exp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--grid-gap);
  align-items: start;
}

.exp-layout .strip { padding-top: 0; }


/* ---------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .page-head, .exp-layout { grid-template-columns: 1fr; }
  .page-head .head-media { order: -1; }
  .page-head-solo .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row figure.float { float: none; width: 100%; margin: 0 0 22px; }
  .row-set, .row-gallery { grid-template-columns: 1fr; }
  .row:not(:has(> figure.float)) ul.short { columns: 1; }
  .hero-home { grid-template-columns: 1fr; }
  .portrait { max-width: 300px; order: -1; aspect-ratio: 1 / 1; }
  .timeline li { grid-template-columns: 1fr; }
  .timeline .when { grid-row: auto; }
}

@media (max-width: 720px) {
  .nav nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav nav.open { display: flex; }
  .nav nav a { padding: 11px 0; }
  .nav nav a.on::after { display: none; }
  .menu { display: block; }
  body { font-size: 16px; }
  .contact-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------- lightbox */

.prose figure img, .head-media img { cursor: zoom-in; }

.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(12, 14, 19, 0.82);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
}

/* ------------------------------------------------------- dot field */

/* A dot grid behind the whole site. Near the pointer the dots turn cobalt and
   brighten; site.js feeds the pointer position into --mx / --my. */
.dot-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--dot) 1.15px, transparent 1.5px);
  background-size: 22px 22px;
}

.dot-field::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, -1000px) var(--my, -1000px), rgba(47, 91, 234, 0.08), transparent 70%);
  opacity: var(--field-on, 0);
  transition: opacity 0.35s ease;
}

.dot-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--accent) 1.5px, transparent 1.9px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(230px circle at var(--mx, -1000px) var(--my, -1000px), #000 0%, rgba(0, 0, 0, 0.45) 45%, transparent 100%);
  mask-image: radial-gradient(230px circle at var(--mx, -1000px) var(--my, -1000px), #000 0%, rgba(0, 0, 0, 0.45) 45%, transparent 100%);
  opacity: var(--field-on, 0);
  transition: opacity 0.35s ease;
}

/* ---------------------------------------------------- obvious links */

.role-overview a, .about-text a, .prose p a, .prose li a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(47, 91, 234, 0.35);
  text-underline-offset: 3px;
}

.role-overview a:hover, .about-text a:hover, .prose p a:hover, .prose li a:hover { text-decoration-color: currentColor; }

.card-cta {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

.card-cta::after { content: " →"; display: inline-block; transition: transform 0.15s; }
.card:hover .card-cta::after { transform: translateX(3px); }

/* ------------------------------------------------------- main page */

.band {
  padding-top: clamp(56px, 7vw, 96px);
  scroll-margin-top: 64px;
}

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 28px;
  padding-bottom: 22px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}

.band-head h2 { margin: 0; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -0.035em; }
.band-sub { margin: 0; color: var(--ink-2); font-size: 17px; }

.jumps { display: flex; flex-wrap: wrap; gap: 8px; }

.jump {
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.jump::after { content: " ↓"; color: var(--ink-3); }
.jump:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* One role: title and overview, everything done there, pictures, its projects. */
.role {
  padding: clamp(40px, 5vw, 64px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 72px;
}

.role:last-child { border-bottom: 0; }

.role-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: var(--grid-gap);
  align-items: start;
}

.role-title h3 {
  margin: 12px 0 0;
  font-size: clamp(26px, 2.8vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.role-line { margin: 10px 0 0; color: var(--ink-2); font-size: 16.5px; line-height: 1.5; }

.role-overview p { margin: 0 0 14px; color: var(--ink-2); font-size: 18px; line-height: 1.65; }
.role-overview .disclosure { margin-top: 18px; font-size: 14px; }

.work-list {
  list-style: none;
  margin: clamp(28px, 3.5vw, 40px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--grid-gap);
}

.work-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
}

.work-item h4 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.work-item p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }

.work-link {
  margin-top: 6px;
  padding: 5px 12px 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.work-link::before { content: "Project page · "; color: rgba(31, 67, 196, 0.7); }
.work-link::after { content: " →"; }
.work-link:hover { background: var(--accent); color: var(--btn-ink); }
.work-link:hover::before { color: rgba(255, 255, 255, 0.8); }

.role-gallery {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.role-gallery figure { margin: 0; }

.role-gallery img,
.role-gallery video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-3);
  cursor: zoom-in;
}

.role-gallery video { cursor: default; }
.role-gallery figcaption { font-size: 13px; }

.role-projects { margin-top: 34px; }
.role-projects > .eyebrow { margin-bottom: 14px; }
.role-projects .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* About and education side by side. */
.band-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--grid-gap);
  align-items: start;
}

.about-text h2 { margin: 0 0 22px; padding-bottom: 22px; border-bottom: 1px solid var(--ink); font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -0.035em; }
.about-text .row { border: 0; padding: 0; margin: 0 0 20px; }
.about-text h4 { margin: 0 0 8px; font-size: 17px; }
.about-text p { color: var(--ink-2); font-size: 17px; }

.edu {
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.edu h3 { margin: 10px 0 0; font-size: 22px; letter-spacing: -0.02em; }
.edu ul { margin: 16px 0 0; padding: 14px 0 0 18px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }
.edu li { margin-bottom: 6px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

a.contact-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
a.contact-card .contact-v::after { content: " ↗"; color: var(--accent); }

.contact-k { font: 500 12px/1.2 var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.contact-v { font-size: 16.5px; color: var(--ink); overflow-wrap: anywhere; }

/* ---------------------------------------------------- project pages */

.crumbs {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 26px var(--gutter) 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

.back-link::before { content: "←"; color: var(--accent); }
.back-link:hover { border-color: var(--accent); color: var(--accent); }
.project .hero { padding-top: 28px; }

.more { padding-top: clamp(40px, 5vw, 64px); }
.more .strip-head { margin-bottom: 20px; }

@media (max-width: 860px) {
  .role-head, .band-split { grid-template-columns: 1fr; }
  .work-list { grid-template-columns: 1fr; }
  .role-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .contact-grid, .role-gallery { grid-template-columns: 1fr; }
}

@media (hover: none) {
  .dot-field::before, .dot-field::after { display: none; }
}

/* Content sits in boxes: roles are white panels with their work as tiles, and
   project write-ups are panels per section. The boxes are opaque, so the dot
   field only shows in the space between them; loose text outside a box sits on
   a patch of page ground instead. */
.role {
  margin: 0 0 22px;
  padding: clamp(24px, 3.2vw, 44px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.role:last-child { border-bottom: 1px solid var(--line); margin-bottom: 0; }
.band > .band-head + .role { margin-top: 26px; }

.work-list { gap: 14px; }

.work-item {
  padding: 18px 20px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.role-projects .card { background: var(--bg); }
.role-projects .card-frame { background: var(--bg-3); }

.about-text {
  padding: clamp(24px, 3vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.prose .row {
  margin: 0 0 20px;
  padding: clamp(22px, 3vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.prose > .row:first-child { padding-top: clamp(22px, 3vw, 36px); }

.row-set { margin: 0 0 20px; padding-top: 0; border-top: 0; gap: 20px; }
.row-set .row { margin: 0; padding: 20px 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.row-model { margin: 0 0 20px; }

.about-text .row { padding: 0; margin: 0 0 20px; background: none; border: 0; box-shadow: none; }

.hero-home > div:first-child,
.page-head .head-text,
.band-head,
.row-model figcaption,
.skills,
.more .strip-head {
  background-color: var(--bg);
  box-shadow: 0 0 0 16px var(--bg);
}

.row-model figcaption { display: table; box-shadow: 0 0 0 8px var(--bg); }

.band-head + .grid { margin-top: 26px; }

/* ------------------------------------------------------------- logos */

.logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.logo-tile img { display: block; height: 34px; width: auto; max-width: 190px; object-fit: contain; }

.role-title .logo-tile { margin-bottom: 18px; }
.edu .logo-tile { margin-bottom: 16px; }

.hero-logos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-logos .logo-tile { height: 54px; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.hero-logos .logo-tile img { height: 30px; }
a.logo-tile:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }

/* ------------------------------------------------------- designed pages */

/* Bodies laid out on the design canvas (pages/<slug>.html): split rows, dark
   frames for ANSYS screenshots, figure rows whose items share one height, spec
   grids, stat pairs and data tables. Everything collapses to one column on phones. */

.prose .measure { max-width: var(--prose); }

.d-label {
  margin: 0;
  font: 500 11.5px/1.3 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.d-label-gap { margin-top: 22px; }

.d-cols { display: grid; gap: 16px; margin-top: 24px; }
.d-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.d-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 8px; }
.d-cols-3 h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.prose .d-cols-3 p:not(.d-label) { margin: 8px 0 0; font-size: 16px; line-height: 1.6; }

.d-note { padding: 18px 20px; background: var(--bg-2); border-radius: var(--radius); }
.prose .d-note p:not(.d-label) { margin: 10px 0 0; font-size: 16px; line-height: 1.55; }

.d-split { display: grid; gap: 56px; align-items: start; }
.d-split-narrow { grid-template-columns: minmax(0, 1fr) 236px; }
.d-split-wide { grid-template-columns: minmax(0, 1fr) 440px; align-items: center; }
.d-split h2 { margin-top: 0; }

.prose .d-split figure, .prose .d-figrow figure, .prose .d-gallery figure { margin: 0; }

.d-dark img {
  display: block;
  width: 100%;
  height: auto;
  background: #2a2c30;
  border-radius: var(--radius);
}
.d-chart img { background: #3a3c40; }

/* The section rule crops row figures to 16:10; designed figures keep their own shape. */
.prose .row .d-dark img { aspect-ratio: auto; object-fit: fill; max-height: none; }
.prose .row .d-gallery img { aspect-ratio: auto; max-height: none; height: clamp(220px, 24vw, 320px); }
.prose .row .d-gallery .d-photo img { object-fit: cover; }
.prose .row .d-gallery .d-sheet img { object-fit: contain; background: var(--paper); }

.d-figrow { display: flex; gap: 16px; align-items: flex-start; margin-top: 28px; }
.d-figrow figure { flex: var(--grow, 1) 1 0; min-width: 0; }

.d-gallery {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.d-gallery img { display: block; width: 100%; height: 300px; border-radius: var(--radius); }
.d-photo img { object-fit: cover; }
.d-sheet img { object-fit: contain; background: var(--paper); border: 1px solid var(--line); }

.d-specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 20px;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
}
.d-specs > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.d-specs dt { font-size: 13px; color: var(--ink-3); }
.d-specs dd { margin: 0; font-size: 17px; font-weight: 500; color: var(--ink); }

.d-table-wrap { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.d-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 15px; color: var(--ink-2); }
.d-table th {
  padding: 10px 16px;
  background: var(--bg-2);
  text-align: left;
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.d-table td { padding: 10px 16px; border-top: 1px solid var(--line); }
.d-table tr.is-final td { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.d-table tr.is-final td:last-child { color: var(--accent-2); }

.d-stat { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.d-stat-values { display: flex; align-items: baseline; gap: 28px; margin-top: 16px; }
.d-stat-values span { display: block; font-size: 13px; color: var(--ink-3); }
.d-stat-values b { display: block; white-space: nowrap; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.3; color: var(--ink); }
.d-stat-values b.is-fea { color: var(--accent); }
.prose .d-stat p:not(.d-label) { margin: 12px 0 0; font-size: 15px; line-height: 1.55; }

@media (max-width: 860px) {
  .d-split-narrow, .d-split-wide { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .d-upright { max-width: 260px; }
  .d-cols-2, .d-cols-3 { grid-template-columns: minmax(0, 1fr); }
  .d-cols-3 { gap: 22px; }
  .d-figrow { flex-direction: column; }
  .d-figrow figure { flex: none; width: 100%; }
  .d-gallery { grid-template-columns: minmax(0, 1fr); }
  .prose .row .d-gallery img { height: auto; }
  .d-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-stat { padding: 18px 20px; }
  .d-stat-values { gap: 22px; }
  .d-stat-values b { font-size: 24px; }
}

/* Natural-shape media in designed rows: photos, screenshots and clips keep their
   own aspect ratio, so a flex row whose items grow by that ratio lines up in height. */
.prose .row .d-frame img,
.prose .row .d-frame video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: fill;
  max-height: none;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-3);
}
.prose .row figure.d-frame { margin: 0; }
.prose .row .d-frame.d-diagram img { background: var(--paper); padding: 12px; }

.d-split-media { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.d-split-photo { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.d-split-tall { grid-template-columns: minmax(0, 1fr) 250px; }
.d-split > .d-stack { display: flex; flex-direction: column; gap: 16px; }

.prose .row .d-split p:last-child, .prose .row .d-split ul:last-child { margin-bottom: 0; }

/* Feature tiles: a design's requirements or features, one idea each. */
.d-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
.d-tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prose .d-tiles li {
  margin: 0;
  padding: 16px 18px;
  background: var(--bg-2);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.55;
}
.d-tiles li strong { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 600; }

/* Numbered steps for work that happens in order. */
.d-steps { counter-reset: step; margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.prose .d-steps li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 14px 18px 14px 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.55;
}
.d-steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 13px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  font: 600 13px/1 var(--font-mono);
}

/* A left-to-right process drawn in HTML: stages joined by arrows. */
.d-flow { display: flex; align-items: stretch; gap: 0; margin-top: 22px; }
.d-flow > div {
  flex: 1 1 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.d-flow > div.is-end { background: var(--accent-soft); border-color: transparent; }
.d-flow > span { flex: none; width: 34px; display: grid; place-items: center; color: var(--ink-3); }
.d-flow > span svg { width: 18px; height: 18px; }
.prose .d-flow p:not(.d-label) { margin: 6px 0 0; font-size: 15px; line-height: 1.5; }
.d-flow h3 { margin: 6px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

/* Result numbers: the figure the section exists to report, taken from its text. */
.d-metrics { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.d-metric { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.d-metric b { display: block; font-size: clamp(30px, 3.4vw, 42px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; color: var(--accent); }
.prose .d-metric p { margin: 8px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 860px) {
  .d-split-media, .d-split-photo, .d-split-tall { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .d-tiles, .d-tiles-2 { grid-template-columns: minmax(0, 1fr); }
  .d-flow { flex-direction: column; }
  .d-flow > span { width: auto; height: 30px; transform: rotate(90deg); }
  .d-metrics { grid-template-columns: minmax(0, 1fr); }
}

.d-tiles-2 li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.d-cols h3, .d-subhead { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.prose .d-cols > div > h3 + p { margin: 8px 0 0; font-size: 16px; line-height: 1.6; }
.d-split-aside { grid-template-columns: minmax(0, 1fr) 300px; }
.d-center { align-items: center; }
.d-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.d-tiles-1 { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) {
  .d-split-aside { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .d-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.prose ul.d-tiles, .prose ol.d-steps { padding-left: 0; }
.prose p.d-label { margin: 0; }
.prose p.d-label-gap { margin-top: 28px; }
.d-label + .d-tiles, .d-label + .d-steps { margin-top: 10px; }

/* Two short sections side by side, figure on top. */
.d-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; }
.prose .d-pair > .row { margin: 0; }
.d-pair .d-frame { margin-bottom: 22px !important; }
.d-split-video { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); }
@media (max-width: 860px) {
  .d-pair, .d-split-video { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------- theme toggle */

/* A sliding switch: both faces are on the track and the knob covers the one
   in use, so the state reads at a glance. */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  width: 68px;
  height: 36px;
  padding: 0 9px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover { border-color: var(--ink-3); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tt-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(15, 20, 30, 0.22);
  transition: transform 0.22s cubic-bezier(0.3, 1.4, 0.6, 1);
}

.theme-toggle svg {
  position: relative;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  transition: color 0.2s;
}

/* Light: the knob sits over the sun. Dark: it slides to the moon. */
.theme-toggle .icon-sun { color: var(--ink); }
:root[data-theme="dark"] .theme-toggle .icon-sun { color: var(--ink-3); }
:root[data-theme="dark"] .theme-toggle .icon-moon { color: var(--ink); }
:root[data-theme="dark"] .tt-knob { transform: translateX(30px); }
:root[data-theme="dark"] .tt-knob { background: var(--line-2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

@media (prefers-reduced-motion: reduce) {
  .tt-knob { transition: none; }
}

@media (max-width: 720px) {
  .theme-toggle { width: 60px; height: 32px; padding: 0 7px; }
  .theme-toggle svg { width: 15px; height: 15px; }
  .tt-knob { top: 2.5px; left: 2.5px; width: 25px; height: 25px; }
  :root[data-theme="dark"] .tt-knob { transform: translateX(27px); }
}


/* Company marks are dark artwork on white: they keep their own light chip. */
:root[data-theme="dark"] .logo-tile { background: var(--paper); border-color: var(--line-2); }
