/* ── Tokens ────────────────────────────────────────────────── */

:root {
  --paper:  #f5f1e8;
  --ink:    #1a1a1a;
  --muted:  #8a8478;
  --accent: #c44a2b;
  --dash:   rgba(26, 26, 26, 0.22);
}

[data-theme="dark"] {
  --paper:  #15140f;
  --ink:    #ebe5d2;
  --muted:  #7a766a;
  --dash:   rgba(235, 229, 210, 0.22);
}

/* ── Reset ─────────────────────────────────────────────────── */

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  background: var(--paper);
  color: var(--ink);
  transition: background 200ms ease, color 200ms ease;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Desktop nav (hidden on mobile) ───────────────────────── */

.site-nav {
  display: none;
}

/* ── Page content ──────────────────────────────────────────── */

.content {
  padding: 40px 32px 100px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-width: 0;
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
  display: flex;
  align-items: center;
  gap: 24px;
}

.portrait {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  object-fit: cover;
  flex-shrink: 0;
}

.hero-name {
  font-size: 25px;
  font-weight: 600;
  font-family: inherit;
}

.hero-role {
  font-size: 17px;
  color: var(--muted);
  margin-top: 4px;
}

.hero-bio {
  display: none;
}

.mob-bio {
  font-size: 19px;
  line-height: 1.6;
}

/* ── Rule ──────────────────────────────────────────────────── */

.rule {
  border: none;
  border-top: 1px solid var(--ink);
  opacity: 0.7;
}

/* ── Section ───────────────────────────────────────────────── */

.section {
  display: flex;
  flex-direction: column;
}

.section-heading {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 13px;
}

/* ── Project list ──────────────────────────────────────────── */

.project-list {
  display: flex;
  flex-direction: column;
}

.project-row {
  display: grid;
  grid-template-columns: 40px 1fr 46px;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--dash);
  font-size: 19px;
  align-items: baseline;
}

.col-num  { color: var(--muted); }
.col-name { font-weight: 600; }
.col-role { display: none; }
.col-year { color: var(--muted); text-align: right; }

/* ── Academic ──────────────────────────────────────────────── */

.academic-list {
  display: flex;
  flex-direction: column;
}

.academic-row {
  display: grid;
  grid-template-columns: 40px 1fr 46px;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--dash);
  font-size: 19px;
  align-items: baseline;
}

.academic-row:last-child { border-bottom: none; }

.col-acad-name   { font-weight: 600; }
.col-institution { display: none; color: var(--muted); white-space: nowrap; }
.col-acad-year   { color: var(--muted); text-align: right; }

/* ── Research ──────────────────────────────────────────────── */

.research-list {
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

.research-item {
  padding: 13px 0;
  border-bottom: 1px dashed var(--dash);
}

.research-item p:first-child {
  padding-left: 2ch;
  text-indent: -2ch;
}

.research-item:last-child { border-bottom: none; }

.research-meta {
  font-size: 14px;
  color: var(--muted);
  margin-top: 5px;
  padding-left: 2ch;
}

.research-link { transition: color 100ms ease; }
.research-link:hover { color: var(--accent); }

.research-meta a { transition: color 100ms ease; }
.research-meta a:hover { color: var(--accent); }

/* ── Links ─────────────────────────────────────────────────── */

.links-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 19px;
}

.link-item { transition: color 100ms ease; }
.link-item:hover { color: var(--accent); }

/* ── Notes page ────────────────────────────────────────────── */

.notes-header { display: flex; flex-direction: column; }

.notes-title {
  font-size: 25px;
  font-weight: 600;
  font-family: inherit;
}

.notes-subtitle {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entries-list { display: flex; flex-direction: column; }

.entry-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--dash);
  font-size: 17px;
  align-items: baseline;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.entry-row:hover .entry-name  { color: var(--accent); }
.entry-row:hover .entry-arrow { color: var(--accent); }

.entry-date  { color: var(--muted); white-space: nowrap; }
.entry-name  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.entry-time  { display: none; }
.entry-arrow { color: var(--muted); font-size: 16px; }

/* ── Post page ─────────────────────────────────────────────── */

.post-header { display: flex; flex-direction: column; gap: 8px; }

.post-meta {
  font-size: 15px;
  color: var(--muted);
}

.post-title {
  font-size: 24px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
}

.post-image-wrap { width: 100%; }

.post-image {
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(12%) saturate(0.85) brightness(0.97);
}

.post-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: 17px;
  line-height: 1.75;
}

.post-back {
  display: inline-block;
  font-size: 16px;
  color: var(--muted);
  transition: color 100ms ease;
}

.post-back:hover { color: var(--accent); }

.archive-note {
  font-size: 18px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 1px;
}

/* ── Footer note ───────────────────────────────────────────── */

.footer-note {
  font-size: 17px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 1px;
}

/* ── Tab bar ───────────────────────────────────────────────── */

.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  border-top: 1px solid var(--ink);
  background: var(--paper);
  font-size: 16px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  z-index: 100;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 0;
  color: var(--muted);
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.tab:not(:last-child) { border-right: 1px solid var(--dash); }

.tab.active {
  color: var(--ink);
  font-weight: 600;
}

.tab-theme {
  padding: 15px 28px;
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Theme button ──────────────────────────────────────────── */

.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 23px;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

.theme-btn:hover { color: var(--ink); }

/* ── Utility ───────────────────────────────────────────────── */

.desk-only { display: none; }

@media (min-width: 768px) {
  .mob-only { display: none; }
}

/* ── Desktop (≥768px) ──────────────────────────────────────── */

@media (min-width: 768px) {
  .tab-bar    { display: none !important; }
  .mob-bio    { display: none; }
  .desk-only  { display: block; }

  /* Nav */
  .site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 33px 66px;
    border-bottom: 1px solid var(--ink);
    font-size: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--paper);
  }

  .site-name { font-weight: 600; }

  .nav-links {
    display: flex;
    gap: 33px;
    align-items: center;
    font-size: 18px;
    letter-spacing: 1px;
  }

  .nav-link { color: var(--muted); transition: color 100ms ease; }
  .nav-link:hover { color: var(--accent); }
  .nav-link.active { color: var(--ink); font-weight: 600; }

  /* Content column */
  .content {
    max-width: 1020px;
    margin: 0 auto;
    padding: 100px 66px 60px;
    gap: 60px;
    font-size: 21px;
  }

  /* Hero */
  .hero { gap: 46px; align-items: flex-start; }

  .portrait { width: 160px; height: 160px; }

  .hero-name { font-size: 36px; }
  .hero-role { font-size: 20px; margin-top: 10px; }

  .hero-bio {
    display: block;
    font-size: 20px;
    line-height: 1.6;
    max-width: 628px;
    margin-top: 23px;
  }

  /* Sections */
  .section-heading { font-size: 18px; margin-bottom: 23px; }

  /* Project rows: 4 cols on desktop */
  .project-row {
    grid-template-columns: 46px 1fr auto 82px;
    gap: 20px;
    padding: 20px 0;
    font-size: 21px;
  }

  .col-role { display: block; color: var(--muted); white-space: nowrap; }

  /* Academic rows: 4 cols on desktop */
  .academic-row {
    grid-template-columns: 46px 1fr auto 82px;
    gap: 20px;
    padding: 20px 0;
    font-size: 21px;
  }

  .col-institution { display: block; }

  /* Links: 2-col grid */
  .links-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    font-size: 21px;
  }

  /* Research */
  .research-list { font-size: 20px; }
  .research-item { padding: 16px 0; }
  .research-meta { font-size: 18px; padding-left: 23px; margin-top: 4px; }

  /* Notes */
  .notes-title { font-size: 36px; }
  .notes-subtitle { font-size: 20px; margin-top: 10px; white-space: normal; overflow: visible; text-overflow: unset; }

  .entry-row {
    grid-template-columns: 182px 1fr 100px auto;
    gap: 20px;
    padding: 17px 0;
    font-size: 21px;
    border-bottom: 1px dashed var(--dash);
  }

  .entry-name  { white-space: normal; overflow: visible; text-overflow: unset; }
  .entry-time  { display: block; color: var(--muted); text-align: right; }
  .entry-arrow { font-size: 18px; }

  .archive-note { font-size: 18px; margin-top: 20px; }
  .footer-note  { font-size: 17px; margin-top: 14px; }

  /* Post page desktop */
  .post-title { font-size: 36px; }
  .post-meta  { font-size: 18px; }
  .post-body  { font-size: 20px; gap: 28px; }
  .post-back  { font-size: 18px; }
}
