/* ============================================================
   Michael Zhang — personal site
   Dark, technical, editorial. Inter for prose, JetBrains Mono
   for the machine-flavoured accents.
   ============================================================ */

:root {
  --bg: #07090f;
  --bg-alt: #0b0e17;
  --surface: #10141f;
  --surface-2: #141927;
  --border: rgba(148, 163, 200, 0.14);
  --border-strong: rgba(148, 163, 200, 0.28);
  --text: #e8ecf6;
  --text-dim: #a3adc2;
  --text-faint: #6b7590;
  --accent: #5eead4;        /* teal */
  --accent-2: #818cf8;      /* indigo */
  --accent-3: #f472b6;      /* pink, sparingly */
  --ok: #4ade80;
  --radius: 14px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }
.muted { color: var(--text-faint); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- background canvas ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
}

/* ---------- nav ---------- */
.nav-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 9, 15, 0.72);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13.5px;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--accent); }

.nav-cta {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text) !important;
}
.nav-cta:hover { border-color: var(--accent); color: var(--accent) !important; }

/* ---------- hero ---------- */
.hero {
  padding: 170px 0 80px;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.kicker {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.hero-role {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dim);
  margin: 10px 0 26px;
}

.gradient-text {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 55%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lede {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 54ch;
  margin-bottom: 34px;
}
.hero-lede strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.btn-primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #06131a;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(94, 234, 212, 0.28);
}

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- terminal card ---------- */
.hero-terminal {
  background: rgba(13, 17, 27, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(94, 234, 212, 0.05);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: rgba(148, 163, 200, 0.06);
  border-bottom: 1px solid var(--border);
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.amber { background: #febc2e; }
.dot.green { background: #28c840; }

.term-title {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.term-body {
  padding: 20px 20px 24px;
  font-size: 13.5px;
  line-height: 2;
}

.t-prompt { color: var(--accent); font-weight: 700; }
.t-out { color: var(--text-dim); padding-left: 16px; }
.t-dir { color: var(--accent-2); font-weight: 500; }
.t-ok { color: var(--ok); }
.t-cursor { color: var(--text); }

.caret {
  color: var(--accent);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- stats ---------- */
.stats-band {
  margin-top: 84px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: border-color 0.25s, transform 0.25s;
}
.stat:hover { border-color: rgba(94, 234, 212, 0.4); transform: translateY(-3px); }

.stat-num, .stat-plus {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat-money::before { content: "$"; }

.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-faint);
}

/* clickable stats */
.stat-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

/* stat with popover */
.stat-pop { position: relative; cursor: pointer; }

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 10px;
  font-style: normal;
  color: var(--accent);
  margin-left: 5px;
  vertical-align: 1px;
}

.stat-popover {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: min(340px, 86vw);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-dim);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 30;
}
.stat-popover strong { color: var(--accent); }
.stat-popover em { color: var(--text); font-style: normal; font-weight: 600; }

.stat-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--border-strong);
}

.stat-pop:hover .stat-popover,
.stat-pop:focus-visible .stat-popover,
.stat-pop.open .stat-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ---------- sections ---------- */
.section { padding: 104px 0; position: relative; }

.section-alt {
  background: linear-gradient(180deg, rgba(16, 20, 31, 0.0), rgba(16, 20, 31, 0.55) 18%, rgba(16, 20, 31, 0.55) 82%, rgba(16, 20, 31, 0));
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--accent);
  font-size: 13.5px;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.section-eyebrow .line {
  display: inline-block;
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.section-title {
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}

.section-sub {
  color: var(--text-dim);
  max-width: 62ch;
  margin-bottom: 48px;
}

/* ---------- work cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.card:hover {
  border-color: rgba(129, 140, 248, 0.45);
  transform: translateY(-5px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.card:hover::before { opacity: 1; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.card-icon {
  font-size: 22px;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.22);
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ok);
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.07);
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.card h4 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }

.card-role { font-size: 12px; color: var(--accent-2); letter-spacing: 0.05em; text-transform: uppercase; }

.card > p { color: var(--text-dim); font-size: 14.5px; }

.card-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 4px 0 6px;
}
.card-points li { padding-left: 18px; position: relative; }
.card-points li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.tags span {
  font-size: 11.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(148, 163, 200, 0.04);
  transition: color 0.2s, border-color 0.2s;
}
.tags span:hover { color: var(--accent); border-color: rgba(94, 234, 212, 0.4); }

.card-link {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.card-link:hover { color: var(--text); }

/* ---------- timeline ---------- */
.timeline {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
}

.tl-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 36px;
  padding: 30px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tl-item:last-child { border-bottom: none; }

.tl-when {
  color: var(--accent);
  font-size: 13.5px;
  letter-spacing: 0.03em;
}

.tl-body h4 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.tl-org { color: var(--text-faint); font-weight: 500; }
.tl-body p { color: var(--text-dim); font-size: 15px; max-width: 74ch; }

/* ---------- speaking ---------- */
.talk-card {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 40px;
  align-items: center;
  background: linear-gradient(120deg, rgba(94, 234, 212, 0.05), rgba(129, 140, 248, 0.07));
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: var(--radius);
  padding: 44px;
}

.talk-conf {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.talk-left h4 {
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  line-height: 1.3;
}

.talk-left p { color: var(--text-dim); margin-bottom: 24px; max-width: 62ch; }

.talk-ascii {
  color: var(--accent-2);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.85;
}

/* ---------- research panels ---------- */
.split-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.25s;
}
.panel:hover { border-color: var(--border-strong); }

.panel-title {
  color: var(--accent);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.plain-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14.5px;
}
.plain-list strong { display: block; font-weight: 600; }
.pub-link { text-decoration: none; color: inherit; }
.pub-link:hover strong { color: var(--accent); }
.plain-list .muted { font-size: 13px; }
.plain-list.compact { gap: 10px; }
.plain-list.compact li { color: var(--text-dim); }
.plain-list.compact .muted { margin-right: 8px; font-size: 12px; }

/* ---------- stack ---------- */
.stack-rows {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.stack-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.stack-key {
  color: var(--accent);
  font-size: 13.5px;
  letter-spacing: 0.06em;
}

/* ---------- contact ---------- */
.contact-section { padding: 140px 0 120px; }

.contact-inner { text-align: center; }
.contact-inner .section-eyebrow { justify-content: center; }
.contact-inner .section-eyebrow .line { background: linear-gradient(90deg, transparent, var(--accent)); }
.contact-inner .section-sub { margin-left: auto; margin-right: auto; }
.contact-inner .hero-actions { justify-content: center; margin-top: 10px; }

.contact-title {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 20px;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .caret { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .talk-card { grid-template-columns: 1fr; padding: 32px; }
  .talk-right { display: none; }
  .split-grid { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: 8px; padding: 24px 0; }
  .nav-links { gap: 16px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .hero { padding-top: 130px; }
}
