/* ============================================================
   Fonts (self-hosted)
   ============================================================ */
@font-face {
  font-family: 'Cabin';
  src: url('/fonts/Cabin-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cabin';
  src: url('/fonts/Cabin-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cabin';
  src: url('/fonts/Cabin-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cabin';
  src: url('/fonts/Cabin-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cabin';
  src: url('/fonts/Cabin-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg:           #0b0b0b;
  --surface:      #141414;
  --border:       #1e1e1e;
  --border-hover: #2e2e2e;
  --text:         #e2dfd9;
  --text-2:       #8a8a8a;
  --text-3:       #444;
  --accent:       #6fa86f;
  --max:          860px;
  --pad:          1.5rem;
  --radius:       8px;
  --transition:   0.15s ease;
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cabin', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img { display: block; max-width: 100%; }

ul { list-style: none; }

/* ============================================================
   Layout container
   ============================================================ */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ============================================================
   Navigation
   ============================================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 11, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.nav-name {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text);
  border: none;
  transition: color var(--transition);
}

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

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.03em;
  border: none;
  transition: color var(--transition);
}

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

/* ============================================================
   Load animations
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.hero-name     { animation: fadeUp 0.55s ease 0.05s both; }
.hero-bio      { animation: fadeUp 0.55s ease 0.35s both; }
.hero-meta     { animation: fadeUp 0.55s ease 0.5s  both; }
.hero-portrait { animation: fadeUp 0.55s ease 0.1s  both; }

/* ============================================================
   Scroll reveal
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 5.5rem 0 4rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3.5rem;
  align-items: start;
}

.hero-name {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 0.55rem;
}

.hero-role {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 1.6rem;
}

.hero-role .accent { color: var(--accent); }

.hero-bio {
  font-size: 0.975rem;
  color: #b8b4ae;
  line-height: 1.8;
  max-width: 520px;
  margin-bottom: 2rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-2);
}

.hero-meta a {
  display: inline-flex;
  align-items: center;
  border: none;
  color: var(--text-2);
  transition: color var(--transition);
}

.hero-meta a:hover { color: var(--text); }

.hero-portrait {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-hover);
  margin-top: 0.4rem;
  flex-shrink: 0;
}

/* ============================================================
   Section blocks (cards)
   ============================================================ */
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 1rem;
}

.block-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 2rem;
}

/* ============================================================
   Research / project list
   ============================================================ */
.research-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.research-item {}

.research-item-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.research-item-desc {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 580px;
}

.research-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
}

.research-links a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

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

.view-all {
  margin-top: 2rem;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  border: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color var(--transition), border-color var(--transition);
}

.view-all:hover {
  color: var(--text);
  border-bottom-color: var(--text-2);
}

/* ============================================================
   Notes list
   ============================================================ */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.note-row a {
  font-size: 0.95rem;
  color: var(--text);
  border: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.note-row a:hover {
  border-bottom-color: var(--border-hover);
}

.note-date {
  font-size: 0.78rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   Cats
   ============================================================ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 3rem;
  justify-content: start;
}

.cat-figure { text-align: left; }

.cat-photos {
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 6px;
  overflow: hidden;
}

.cat-photos img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.cat-photos img.active { opacity: 1; }

.cat-caption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
}

.cat-caption strong { color: var(--text); }

.cat-caption .cat-title {
  display: block;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.1rem;
}

/* ============================================================
   Activity section (3D commit skyline)
   ============================================================ */
.activity-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 420px;
  background: #0b0b0b;
}

.activity-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.activity-caption {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-3);
}

.activity-caption a {
  color: var(--text-2);
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.activity-caption a:hover {
  color: var(--text);
  border-bottom-color: var(--text-3);
}

@media (max-width: 640px) {
  .activity-wrap { height: 300px; }
}

/* ============================================================
   Background illustration (research section)
   ============================================================ */
.research-layout {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}

.research-illustration {
  width: 220px;
  flex-shrink: 0;
  opacity: 0.75;
  pointer-events: none;
}

.research-content {
  flex: 1;
  min-width: 0;
}

.bacterium-group {
  animation: bact-swim 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes bact-swim {
  0%   { transform: translate(0px,   0px)  rotate(-3deg); }
  22%  { transform: translate(12px, -7px)  rotate(3deg);  }
  48%  { transform: translate(20px,  3px)  rotate(6deg);  }
  72%  { transform: translate(9px,   9px)  rotate(1deg);  }
  100% { transform: translate(0px,   0px)  rotate(-3deg); }
}

.flagella-group {
  animation: flag-wave 1.0s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: right center;
}

@keyframes flag-wave {
  from { transform: rotate(-11deg); }
  to   { transform: rotate(11deg);  }
}

@media (max-width: 700px) {
  .research-layout { display: block; }
  .research-illustration { display: none; }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ============================================================
   Article pages (notes)
   ============================================================ */
.article-header {
  padding: 4.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.article-back {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-2);
  border: none;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}

.article-back:hover { color: var(--text); }

.article-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
}

.article-date {
  font-size: 0.8rem;
  color: var(--text-3);
}

.article-body {
  max-width: 620px;
  padding-bottom: 5rem;
}

.article-body p {
  font-size: 1rem;
  color: #c0bdb8;
  line-height: 1.85;
  margin-bottom: 1.4rem;
}

.article-body a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.article-body a:hover { border-bottom-color: var(--accent); }

/* ============================================================
   Page title (projects, notes index, cv)
   ============================================================ */
.page-header {
  padding: 5rem 0 3rem;
}

.page-title {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-2);
}

/* ============================================================
   CV
   ============================================================ */
.cv-section {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
}

.cv-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.5rem;
}

.cv-entry {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cv-entry:last-child { margin-bottom: 0; }

.cv-year {
  font-size: 0.82rem;
  color: var(--text-3);
  padding-top: 0.1rem;
}

.cv-entry-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.cv-entry-sub {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: 0.15rem;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
  :root { --pad: 1.1rem; }

  .hero {
    grid-template-columns: 1fr;
    padding: 3rem 0 2.5rem;
    gap: 1.5rem;
  }

  .hero-portrait {
    width: 80px;
    height: 80px;
    order: -1;
  }

  .hero-name { font-size: 2.1rem; }

  .nav-links { gap: 1.1rem; }

  .cat-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .cat-photos { width: 100%; height: 220px; }

  .cv-entry {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .article-title { font-size: 1.6rem; }

  .page-title { font-size: 1.9rem; }
}
