/* ---------- tokens ---------- */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #61646b;
  --line: #dedcd5;
  --accent: #d9480f;          /* engineering orange */
  --accent-ink: #ffffff;
  --ph-a: #ecebe5;
  --ph-b: #e3e1d9;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .06);
  --radius: 10px;
  --maxw: 1160px;
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114; --surface: #171a1f; --ink: #eceae4; --muted: #9a9ca3; --line: #2a2e35;
    --accent: #ff7a3d; --accent-ink: #120a05; --ph-a: #1b1e24; --ph-b: #22262d;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1114; --surface: #171a1f; --ink: #eceae4; --muted: #9a9ca3; --line: #2a2e35;
  --accent: #ff7a3d; --accent-ink: #120a05; --ph-a: #1b1e24; --ph-b: #22262d;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .3);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--f-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
img, video, iframe { display: block; max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.small { font-size: .78rem; letter-spacing: .02em; }
.label { font: 500 .78rem var(--f-mono); color: var(--accent); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .6em; }
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.mono-logo {
  font: 700 1rem var(--f-display); text-decoration: none; border: 2px solid var(--ink);
  padding: 2px 7px; border-radius: 4px; letter-spacing: .04em;
}
.nav-links { display: flex; gap: 22px; margin-left: auto; overflow-x: auto; }
.nav-links a { text-decoration: none; font-size: .92rem; color: var(--muted); white-space: nowrap; }
.nav-links a:hover { color: var(--ink); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 500;
  font-size: .95rem; transition: transform .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  padding-top: 72px; padding-bottom: 48px;
}
.eyebrow { font: 500 .82rem var(--f-mono); color: var(--muted); letter-spacing: .04em; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 5rem); letter-spacing: -.03em; margin-bottom: .25em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
/* headshot */
.hero-id { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.hero-id .eyebrow { margin: 0; }
.avatar {
  flex: 0 0 auto; width: 112px; height: 112px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
.avatar .ph { padding: 8px; gap: 2px; }
.avatar .ph-icon svg { width: 26px; height: 26px; }
.avatar .ph-label { font-size: .58rem; }
.avatar .ph-file { font-size: .6rem; padding: 1px 5px; }

/* featured carousel */
.carousel { position: relative; }
.slides {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); background: var(--ph-a);
}
.slide {
  position: absolute; inset: 0; display: block; text-decoration: none; color: #fff;
  opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s linear .7s;
}
.slide.active { opacity: 1; visibility: visible; transition: opacity .7s ease; }
.slide .media img { transition: transform 6s ease-out; transform: scale(1.04); }
.slide.active .media img { transform: scale(1); }
.slide .ph { padding-bottom: 38%; }   /* keep the placeholder label clear of the caption */
.slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 24px 20px;
  background: linear-gradient(to top, rgb(8 9 12 / .88), rgb(8 9 12 / .55) 55%, transparent);
}
.slide-kicker { color: #ffb28a; margin-bottom: .4em; letter-spacing: .08em; text-transform: uppercase; }
.slide-cap h3 { font-size: 1.55rem; margin-bottom: .25em; color: #fff; }
.slide-sum {
  font-size: .9rem; color: rgb(255 255 255 / .82); margin-bottom: .6em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.slide-cta { font-size: .85rem; font-weight: 600; border-bottom: 1px solid rgb(255 255 255 / .5); }
.slide:hover .slide-cta { border-color: #fff; }

.carousel-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.carousel.single .carousel-bar { display: none; }
.dots { display: flex; gap: 6px; flex: 1; max-width: 320px; }
.dots button {
  flex: 1; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; position: relative;
}
.dots button::before, .dot-fill {
  content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 3px; border-radius: 2px;
}
.dots button::before { background: var(--line); }
.dot-fill { background: var(--ink); transform: scaleX(0); transform-origin: left; }
.dots button[aria-selected="true"] .dot-fill { transform: scaleX(1); }
.dots.run button[aria-selected="true"] .dot-fill { animation: dotfill var(--slide-ms, 6s) linear forwards; }
.carousel.paused .dots button[aria-selected="true"] .dot-fill { animation: none; transform: scaleX(1); }
@keyframes dotfill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.arrows { display: flex; gap: 8px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stat-strip > div { padding: 20px 16px; border-left: 1px solid var(--line); }
.stat-strip > div:first-child { border-left: 0; padding-left: 0; }
.stat-strip dd { margin: 0; font: 600 1.7rem var(--f-display); order: -1; }
.stat-strip dt { font-size: .82rem; color: var(--muted); }
.stat-strip > div { display: flex; flex-direction: column; }

/* ---------- sections ---------- */
.section { padding-top: 96px; }
.section-head { margin-bottom: 32px; }

/* ---------- media + placeholders ---------- */
.media { position: relative; width: 100%; height: 100%; background: var(--ph-a); overflow: hidden; }
.media img, .media video, .media iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.ph {
  width: 100%; height: 100%; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-align: center; padding: 16px;
  background: repeating-linear-gradient(135deg, var(--ph-a) 0 14px, var(--ph-b) 14px 15px);
}
.ph-icon svg { width: 38px; height: 38px; opacity: .7; }
.ph-compact .ph-icon svg { width: 22px; height: 22px; }
.ph-label { font: 500 .72rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; }
.ph-file { font: .72rem var(--f-mono); background: var(--surface); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); }
.play-badge {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none;
}
.play-badge svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgb(0 0 0 / .5)); }

/* ---------- stats (project view) ---------- */

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 24px; width: 100%; }
.mini-stats > div { border-top: 2px solid var(--accent); padding-top: 8px; display: flex; flex-direction: column; }
.mini-stats dd { margin: 0; font: 600 1.25rem var(--f-display); order: -1; }
.mini-stats dt { font-size: .78rem; color: var(--muted); line-height: 1.35; }

/* ---------- filters + grid ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  font: 500 .85rem var(--f-body); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.filter:hover { color: var(--ink); border-color: var(--ink); }
.filter.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.card-media { position: relative; aspect-ratio: 16 / 10; }
.card-media img { transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.03); }
.chip-video {
  position: absolute; top: 10px; right: 10px; font: 500 .7rem var(--f-mono);
  background: rgb(0 0 0 / .65); color: #fff; padding: 3px 8px; border-radius: 4px;
}
.card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin-bottom: .35em; }
.card-sum { color: var(--muted); font-size: .94rem; }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font: .72rem var(--f-mono); padding: 3px 8px; border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink);
}

/* ---------- research ---------- */
.research { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.res { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.res h3 { font-size: 1.3rem; margin-bottom: .2em; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li {
  display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 28px 0; border-top: 1px solid var(--line);
}
.timeline > li:last-child { border-bottom: 1px solid var(--line); }
.tl-meta { display: flex; flex-direction: column; gap: 2px; }
.timeline h3 { margin-bottom: .1em; }
.bullets { padding-left: 1.1em; margin: .5em 0 0; }
.bullets li { margin-bottom: .45em; }
.bullets li::marker { color: var(--accent); }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: start; }
.about-photo .media { aspect-ratio: 4 / 5; border-radius: var(--radius); }
.about-body > div:first-child p { font-size: 1.05rem; }
.edu { margin-top: 28px; border-top: 1px solid var(--line); }
.edu-item { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.edu-item > div { display: flex; flex-direction: column; }
.edu-item .muted { font-size: .88rem; }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; margin-top: 64px; }
.skill h3 { font-size: .95rem; margin-bottom: .8em; }
.awards { margin-top: 56px; }
.awards h3 { font-size: .95rem; }
.awards ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; }
.awards li { padding: 8px 0; border-bottom: 1px solid var(--line); break-inside: avoid; font-size: .94rem; }

/* ---------- contact + footer ---------- */
.contact { padding-bottom: 32px; }
.contact h2 { font-size: clamp(2.4rem, 6vw, 4rem); }
.contact-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 28px; }
.contact-links a {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s;
  overflow-wrap: anywhere;
}
.contact-links a:hover { border-color: var(--accent); }
.contact-links .mono { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.footer {
  display: flex; justify-content: space-between; gap: 16px; padding-top: 48px; padding-bottom: 40px;
  color: var(--muted); font-size: .85rem;
}

/* ---------- project dialog ---------- */
dialog {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink);
  box-shadow: 0 30px 80px rgb(0 0 0 / .35); overflow-y: auto;
}
dialog::backdrop { background: rgb(10 12 15 / .6); backdrop-filter: blur(4px); }
.dlg { position: relative; padding: 36px; }
.dlg-close { position: sticky; top: 0; float: right; margin: -12px -12px 0 0; z-index: 2; }
.dlg-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin-bottom: .35em; }
.dlg-head { margin-bottom: 24px; }
.gallery { margin-bottom: 28px; }
.stage { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.stage .media { background: var(--ph-a); }
.stage .media img, .stage .media video { object-fit: contain; background: #000; }
.stage-cap { font-size: .88rem; margin: 10px 0 12px; min-height: 1.4em; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumbs button {
  flex: 0 0 104px; aspect-ratio: 16 / 10; padding: 0; border-radius: 6px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: none; opacity: .65; transition: opacity .15s;
}
.thumbs button:hover { opacity: 1; }
.thumbs button[aria-selected="true"] { border-color: var(--accent); opacity: 1; }
.dlg-cols { display: grid; grid-template-columns: 1fr 260px; gap: 40px; }
.dlg-cols h3 { font-size: .95rem; margin-top: 1.4em; }
.dlg-cols > div > h3:first-child, .dlg-cols aside > h3:first-child { margin-top: 0; }
.dlg-links { margin-top: 24px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero, .about, .research, .dlg-cols { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; gap: 32px; }
  .slides { aspect-ratio: 4 / 3.4; }
  .slide-cap h3 { font-size: 1.3rem; }
  .about-photo { max-width: 260px; }
  .timeline > li { grid-template-columns: 1fr; gap: 8px; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat-strip > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .nav-links { gap: 14px; }
  .nav-links a:nth-child(n+4) { display: none; }
  .grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .awards ul { columns: 1; }
  .section { padding-top: 72px; }
  .dlg { padding: 20px; }
  .dlg-close { margin: -6px -6px 0 0; }
  .card-foot { flex-direction: column; align-items: flex-start; }
  .avatar { width: 84px; height: 84px; }
  .avatar .ph-label, .avatar .ph-file { display: none; }
  .slide-sum { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
