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

:root {
  --bg: #1a1d21;
  --ink: #e8eaed;
  --muted: #b1b8c3;
  --accent: #7eb8d4;
  --rule: #2d3138;
}

html { font-size: 17px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  line-height: 1.7;
  min-height: 100vh;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
}

nav {
  display: flex;
  gap: 1.6rem;
  margin-bottom: 2rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.04em;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

nav a:hover { color: var(--ink); }
nav a.active { color: var(--ink); }

section {
  display: none;
  animation: fadein 0.3s ease;
}

section.visible { display: block; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Home ── */

.home-name {
  font-size: 2.6rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
  cursor: default;
}

.home-tagline {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: 2.4rem;
}

.home-intro {
  font-size: 1.08rem;
  color: var(--ink);
  max-width: 520px;
}

.home-intro p + p { margin-top: 1rem; }

.home-links {
  margin-top: 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--muted);
}

.home-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.home-links a:hover { color: var(--ink); }

/* ── Section label ── */

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2rem;
}

.portrait {
  float: right;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  margin: 1.5rem 0.8rem 1.2rem;
  border: 2px solid var(--rule);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  shape-outside: circle(50%);
}

/* ── Skills ── */

.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.skills-group {}

.skills-category {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.skills-list {
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.6;
}

/* ── Work ── */

.work-filters {
  display: flex;
  gap: 0.1rem;
  margin-bottom: 1.8rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 300;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 300;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: color 0.15s;
  position: relative;
}

.filter-btn:not(:last-child)::after {
  content: '·';
  position: absolute;
  right: -0.15rem;
  color: var(--rule);
}

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

.filter-btn.active {
  color: var(--ink);
}

.project-item.hidden {
  display: none;
}

.project-list { list-style: none; }

.project-item {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

.project-item:first-child { border-top: 1px solid var(--rule); }

.project-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}

.project-name {
  font-size: 1.1rem;
  font-weight: 500;
}

.project-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
}

.project-desc {
  font-size: 0.97rem;
  color: #9aa0aa;
  line-height: 1.6;
}

.project-stack {
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  font-weight: 300;
  letter-spacing: 0.03em;
}

.project-stack span {
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
  transition: color 0.15s, border-color 0.15s;
}

.project-item:hover .project-stack span {
  border-color: #3d444d;
}

.project-link {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.8rem;
}

.project-link:hover { text-decoration: underline; }

/* ── Project detail ── */

.back-to-work {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.back-to-work:hover { color: var(--ink); }

.detail-title {
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 0.2rem;
}

.detail-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

/* ── Case study ── */

.case-study-summary {
  font-size: 1.08rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2.4rem;
  padding-bottom: 2.4rem;
  border-bottom: 1px solid var(--rule);
}

.case-study-section {
  margin-bottom: 2.2rem;
}

.case-study-heading {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.case-study-body {
  font-size: 1.02rem;
  color: var(--ink);
  line-height: 1.75;
}

.case-study-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.case-study-bullets li {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.55;
  padding-left: 1rem;
  position: relative;
}

.case-study-bullets li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--muted);
}

.detail-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  font-weight: 300;
  letter-spacing: 0.03em;
  padding-top: 1.4rem;
  margin-top: 2.4rem;
  border-top: 1px solid var(--rule);
}

.detail-stack span {
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
}

.project-item[data-project] { cursor: pointer; }
.project-item[data-project]:hover .project-name { color: var(--accent); }

/* ── Research ── */

.paper-list { list-style: none; }

.paper-item {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

.paper-item:first-child { border-top: 1px solid var(--rule); }

.paper-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.3rem;
}

.paper-title {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.4;
}

.paper-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  flex-shrink: 0;
}

.paper-venue {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.paper-authors {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.paper-authors strong {
  color: var(--ink);
  font-weight: 500;
}

.paper-abstract {
  font-size: 0.95rem;
  color: #9aa0aa;
  line-height: 1.6;
  margin-bottom: 0.6rem;
}

.paper-links {
  display: flex;
  gap: 0.8rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 300;
}

.paper-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}

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

/* ── Contact ── */

.contact-text { font-size: 1.08rem; margin-bottom: 2rem; }

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
}

.contact-list a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s;
}

.contact-list a:hover { color: var(--accent); }
.contact-list .label { color: var(--muted); margin-right: 0.6rem; }

/* ── Footer ── */

footer {
  margin-top: 5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 300;
  color: var(--rule);
  letter-spacing: 0.04em;
}

/* ── Cat popup ── */

.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.popup-overlay.open {
  display: flex;
}

.popup-box {
  background: #e8eaed;
  border: 1px solid var(--rule);
  width: 280px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 300;
}

.popup-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.65rem;
  color: #2d3138;
}

.popup-close {
  background: none;
  border: 1px solid var(--rule);
  color: #2d3138;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  transition: color 0.15s;
}

.popup-close:hover { color: var(--ink); }

.popup-body {
  padding: 1.8rem 1.4rem;
  text-align: center;
  color: #2d3138;
  line-height: 2;
}

.popup-cat {
  display: block;
  margin: 0 auto 0.8rem;
  width: 20%;
  image-rendering: pixelated;
}

.popup-btn {
  display: block;
  margin: 1.2rem auto 0;
  background: none;
  border: 1px solid var(--rule);
  color: #2d3138;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 300;
  padding: 0.4rem 1.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.popup-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Responsive ── */

@media (max-width: 480px) {
  .home-name { font-size: 2rem; }
  .page { padding: 2.5rem 1.4rem 5rem; }
}
