/* ---------- Themes (dark is the default; see data-theme on <html>) ---------- */
:root, [data-theme="light"] {
  --bg: #ffffff;
  --text: #161616;
  --text-2: #3d3d3d;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --stage: #f4f4f2;
  --card: #ffffff;
  --card-line: #e2e2e0;
  --accent: #2557d6;
  --tag-bg: #f1f1ef;
  --tag-text: #444444;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --btn-line: #dcdcdc;
  --btn-hover: #f6f6f6;
  --primary-bg: #161616;
  --primary-text: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
}
[data-theme="dark"] {
  --bg: #0e1116;
  --text: #ececee;
  --text-2: #c4c6cc;
  --muted: #8d9099;
  --line: #22262e;
  --stage: #161a21;
  --card: #1c2129;
  --card-line: #2b313b;
  --accent: #7fa6ff;
  --tag-bg: #1c2129;
  --tag-text: #c4c6cc;
  --nav-bg: rgba(14, 17, 22, 0.85);
  --btn-line: #2f3540;
  --btn-hover: #1a1f27;
  --primary-bg: #ececee;
  --primary-text: #0e1116;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
}

:root { --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.65; font-size: 17px; -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.nav-name { color: var(--text); font-weight: 600; }
.nav nav { display: flex; align-items: center; }
.nav nav a { color: var(--muted); margin-left: 24px; font-size: 15px; }
.nav nav a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  margin-left: 20px; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--btn-line); background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--text); background: var(--btn-hover); }

/* Intro */
.intro {
  display: flex; align-items: center; gap: 32px;
  padding-top: 48px; padding-bottom: 48px;
}
.avatar { width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%; overflow: hidden; background: var(--stage); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; }
.lede { font-size: 18px; color: var(--text-2); margin-top: 6px; max-width: 600px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  border: 1px solid var(--btn-line); border-radius: 8px; padding: 8px 16px;
  color: var(--text); font-size: 15px; font-weight: 500; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-bg); opacity: .88; }

/* Projects */
.project { padding-top: 64px; padding-bottom: 64px; border-top: 1px solid var(--line); }
.project-head { max-width: 760px; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.project h2 { font-size: 34px; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.summary { font-size: 18px; color: var(--text-2); margin-top: 10px; }
.project-links { margin-top: 12px; display: flex; gap: 20px; font-weight: 500; font-size: 16px; }

.stage {
  margin-top: 28px; background: var(--stage); border-radius: 16px;
  padding: 32px; display: flex; gap: 24px; justify-content: center; align-items: center;
  overflow-x: auto;
}
.stage img, .stage video {
  height: 440px; width: auto; flex-shrink: 0; border-radius: 10px;
  box-shadow: var(--shadow); background: #000;
}
.stage img.wide { height: auto; width: min(100%, 600px); flex-shrink: 1; min-width: 0; }
.zoomable { cursor: zoom-in; }
.media { display: flex; flex-direction: column; align-items: center; gap: 10px; flex-shrink: 0; }
.media figcaption { font-size: 14px; color: var(--muted); }

/* BookBeater diagram */
.stage-diagram { flex-direction: column; gap: 18px; padding: 44px 32px; }
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; justify-content: center; }
.node {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; min-width: 140px; text-align: center;
}
.node b { font-size: 15px; }
.node span { font-size: 13px; color: var(--muted); }
.arrow { align-self: center; color: var(--muted); font-size: 20px; }
.flow-caption { font-size: 14px; color: var(--muted); text-align: center; }

.project-body { display: grid; gap: 16px; margin-top: 28px; max-width: 760px; }
.project-body ul { margin-left: 20px; }
.project-body li { margin-top: 6px; }
li::marker { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { background: var(--tag-bg); color: var(--tag-text); font-size: 13px; padding: 3px 11px; border-radius: 999px; }

/* About */
.about p { max-width: 760px; }
.about {
  padding-top: 64px; padding-bottom: 72px; border-top: 1px solid var(--line);
}
.section-label {
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 16px;
}
.about p + p { margin-top: 14px; }
.skills { font-size: 15px; color: var(--text-2); }
.timeline { list-style: none; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
.timeline li:first-child { padding-top: 0; }
.t-date { color: var(--muted); font-size: 15px; white-space: nowrap; }
.more { display: inline-block; margin-top: 14px; font-weight: 500; font-size: 15px; }

/* Footer */
.footer {
  display: flex; justify-content: space-between; padding-top: 24px; padding-bottom: 40px;
  color: var(--muted); font-size: 14px; border-top: 1px solid var(--line);
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Tablet / mobile */
@media (max-width: 820px) {
  .stage { justify-content: flex-start; padding: 20px; gap: 16px; }
  .stage img, .stage video { height: 360px; }
  .stage img.wide { height: 360px; width: auto; flex-shrink: 0; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 0 20px; }
  .nav-name { display: none; }
  .nav-inner { justify-content: center; }
  .nav nav a { margin: 0 12px; }
  .theme-toggle { margin-left: 8px; }
  .intro { gap: 18px; padding-top: 32px; padding-bottom: 36px; align-items: flex-start; }
  .avatar { width: 84px; height: 84px; }
  h1 { font-size: 26px; }
  .lede { font-size: 16px; }
  .links { gap: 8px; }
  .btn { padding: 6px 12px; font-size: 14px; }
  .project { padding-top: 48px; padding-bottom: 48px; }
  .project h2 { font-size: 28px; }
  .summary { font-size: 17px; }
  .stage { margin-left: -20px; margin-right: -20px; border-radius: 0; }
  .stage img, .stage video { height: 320px; }
  .stage img.wide { height: 320px; }
  .stage-diagram { padding: 28px 20px; }
  .flow { flex-direction: column; align-items: stretch; }
  .arrow { transform: rotate(90deg); }
  .footer { flex-direction: column; gap: 6px; }
}

/* Experience timeline */
.work { padding-top: 8px; padding-bottom: 56px; }
.path {
  list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
  position: relative; padding-top: 8px;
}
.path::before {               /* the connecting line */
  content: ""; position: absolute; top: 14px; left: 6px; right: 6px; height: 2px;
  background: linear-gradient(90deg, var(--line), var(--card-line) 60%, var(--accent));
}
.stop { position: relative; padding-top: 28px; display: flex; flex-direction: column; gap: 2px; }
.dot {
  position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.stop.current .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.stop h3 { font-size: 16px; font-weight: 600; line-height: 1.3; margin-top: 2px; }
.stop .company { color: var(--accent); font-weight: 500; font-size: 15px; }
.stop .tags { margin-top: 10px; }
.stop .tags span { font-size: 12px; }
.toolbox {
  margin-top: 32px; display: grid; grid-template-columns: max-content 1fr;
  column-gap: 20px; row-gap: 4px; font-size: 14px;
}
.toolbox dt { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; line-height: 21px; }
.toolbox dd { color: var(--text-2); }
@media (max-width: 900px) {
  .path { grid-template-columns: 1fr; gap: 22px; padding-top: 0; padding-left: 30px; }
  .path::before { top: 6px; bottom: 6px; left: 6px; right: auto; width: 2px; height: auto;
    background: linear-gradient(180deg, var(--line), var(--card-line) 60%, var(--accent)); }
  .stop { padding-top: 0; }
  .dot { left: -30px; top: 4px; }
}
.projects-label { padding-top: 24px; padding-bottom: 8px; border-top: 1px solid var(--line); }
.projects-label h2 { font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; padding-top: 48px; padding-bottom: 32px; }
@media (max-width: 600px) { .projects-label h2 { font-size: 34px; padding-top: 32px; padding-bottom: 24px; } }
.projects-label + .project { border-top: none; padding-top: 0; }
.timeline .company { display: block; margin-top: 0; font-size: 15px; }
@media (max-width: 900px) { .jobs { grid-template-columns: 1fr; } }

/* School / company brand colors (dark-theme versions are lightened slightly for contrast) */
:root, [data-theme="light"] { --uiuc: #e84a27; --geico: #2e9a47; --nyl: #0060a9; }
[data-theme="dark"]          { --uiuc: #ff6a1f; --geico: #4cbf63; --nyl: #4d9be0; }
.stop .company.uiuc  { color: var(--uiuc); }
.stop .company.geico { color: var(--geico); }
.stop .company.nyl   { color: var(--nyl); }
