:root {
  --bg: #fafaf7;
  --bg-card: #f0ede6;
  --bg-card-hover: #e8e4db;
  --text: #1a1a1a;
  --text-dim: #6b6b6b;
  --status: #16a34a;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --measure: 920px;
  --measure-text: 640px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: #161616;
  --bg-card-hover: #1f1f1f;
  --text: #ededed;
  --text-dim: #888888;
  --status: #22c55e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.2s, color 0.2s;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.6; }

strong { font-weight: 700; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; }

/* ---- nav (full bleed) ---- */
nav {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.identity {
  display: flex;
  align-items: baseline;
  gap: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-dim);
}
.nav-links a:hover { color: var(--text); opacity: 1; }

#theme-toggle {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s;
}
#theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* ---- terminal cursor ---- */
.cursor {
  display: inline-block;
  margin-left: 2px;
  font-weight: 700;
  animation: blink 1s steps(2) infinite;
}

/* ---- status bar (weather + time) ---- */
.status-bar {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 1.5rem;
  font-size: 11px;
  color: var(--text-dim);
}
.status-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}
.status-sep { opacity: 0.4; }
.status-item { letter-spacing: 0.02em; }

/* ---- main column ---- */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

main > section { margin-top: 3rem; max-width: var(--measure-text); }

.section-h {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 1rem;
  letter-spacing: 0;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* ---- tabs ---- */
.tab {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); font-weight: 500; }
.tab-sep { color: var(--text-dim); opacity: 0.5; }
.tab-prefix { color: var(--text-dim); }

/* ---- hero ---- */
.hero.hero--split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}
.hero-text { min-width: 0; }
.hero-media { min-width: 0; }

.hero h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin-bottom: 1rem;
}
.tagline {
  margin-bottom: 1rem;
  max-width: 56ch;
}
.bio {
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  max-width: 62ch;
}
.bio strong { color: var(--text); font-weight: 500; }
.bio a { color: var(--text-dim); }
.bio a strong { color: var(--text); }
.bio a:hover { color: var(--text); opacity: 1; }
.bio a:hover strong { color: var(--text); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.4rem;
}
.links a {
  text-decoration: none;
  color: var(--text-dim);
}
.links a:hover { color: var(--text); opacity: 1; }

/* ---- badges (still used on mpi) ---- */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.badge {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
  line-height: 1.4;
}
a.badge:hover { border-color: var(--border-strong); background: var(--bg-card); opacity: 1; }
.badge-k {
  padding: 0.3rem 0.55rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border-right: 1px solid var(--border);
}
.badge-v {
  padding: 0.3rem 0.55rem;
  color: var(--text);
}
.chip-row .badge { font-size: 12px; }
.chip-row .badge .badge-v { padding: 0.35rem 0.7rem; }

/* ---- photos ---- */
.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

/* in the two-column hero (main page) the column is narrower so square reads better */
.hero-media .photo-frame { aspect-ratio: 1 / 1; }
.photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.photo-img.is-active { opacity: 1; }
.photo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 1rem;
  text-align: center;
}
.photo-frame.has-photos .photo-empty { display: none; }
.photo-caption {
  margin-top: 0.55rem;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 1em;
}

/* ---- lists ---- */
.list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}
.list.arrow li:not(.empty) > span:first-child::before {
  content: "→  ";
  color: var(--text-dim);
}
.list li.empty { padding: 0.5rem 0; opacity: 0.6; }
.list .meta {
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---- project list (name + link slot + meta) ---- */
.list.project-list li { gap: 0.75rem; }
.proj-name { flex: 1; min-width: 0; }
.proj-link {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
  min-width: 56px;
  text-align: right;
}
.proj-link:empty { visibility: hidden; }
.proj-link a {
  text-decoration: none;
  color: var(--text-dim);
}
.proj-link a:hover { color: var(--text); opacity: 1; }

/* ---- contact / misc ---- */
.sub-meta {
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

/* ---- footer (full bleed) ---- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.4rem 1.5rem;
  color: var(--text-dim);
  font-size: 12px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* ---- motion ---- */
.reveal {
  opacity: 0;
  transform: translateY(6px);
  animation: fadeUp 0.55s ease forwards;
  animation-delay: var(--d, 0s);
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .cursor, .photo-img { animation: none; transition: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- substack embed ---- */
.substack-embed {
  display: block;
  width: 100%;
  max-width: 480px;
  border: 0;
  background: transparent;
}

/* ---- mobile ---- */
@media (max-width: 720px) {
  .hero.hero--split {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .hero-media .photo-frame { max-width: 320px; }
}

@media (max-width: 600px) {
  nav { padding: 0.85rem 1.25rem; }
  .nav-inner { gap: 0.75rem; }
  .nav-links { gap: 0.85rem; font-size: 12px; }
  .status-bar { padding: 0.45rem 1.25rem; }
  main { padding: 2.5rem 1.25rem 1.5rem; }
  .hero h1 { font-size: 26px; }
  .list li { flex-direction: column; gap: 0.1rem; }
  footer { padding: 1.2rem 1.25rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}