/* =========================================================
   DESIGN TOKENS
   Palette named after the strata it's drawn from:
   - ink:       deep slate, primary text / dark sections
   - paper:     warm off-white background, like topo map paper
   - rust:      terracotta accent, oxidised iron in rock
   - moss:      muted green, secondary accent
   - stone:     mid grey, supporting text
   - sand:      pale warm grey, hairlines & cards
   ========================================================= */
:root {
  --ink:    #1c2422;
  --paper:  #f7f4ec;
  --rust:   #bf5b3a;
  --moss:   #4f6b58;
  --stone:  #6b6a60;
  --sand:   #e4ddcc;
  --line:   #d6cdb8;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body:    "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --max: 880px;
  --gap: clamp(1.25rem, 2.5vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  /* Intentionally not auto-dark: a topo-paper feel reads best light.
     Left as a hook if you want to add a toggle later. */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

a {
  color: var(--rust);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }

p { margin: 1em 0 1.1em; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss);
  display: block;
  margin-bottom: 0.6em;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- NAV ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  border-bottom: 1px solid var(--ink);
}
.site-nav .wrap {
  max-width: 980px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
}
.site-nav .brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--paper);
  text-decoration: none;
  padding: 0.95rem 0;
}
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  color: rgba(247, 244, 236, 0.65);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  padding: 1.05rem 1.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover {
  color: var(--paper);
  background: rgba(247, 244, 236, 0.06);
}
.site-nav a.active {
  color: var(--paper);
  border-bottom-color: var(--rust);
}

.nav-toggle { display: none; }

@media (max-width: 640px) {
  .site-nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--ink);
    border-bottom: 1px solid rgba(247, 244, 236, 0.15);
    padding: 0.5rem 1.5rem 1rem;
    gap: 0;
  }
  .site-nav ul.open { display: flex; }
  .site-nav ul a {
    padding: 0.75rem 0.2rem;
    border-bottom: 1px solid rgba(247, 244, 236, 0.1);
    border-left: none;
  }
  .site-nav ul a.active { border-bottom-color: rgba(247, 244, 236, 0.1); border-left: 2px solid var(--rust); padding-left: 0.6rem; }
  .nav-toggle {
    display: inline-block;
    background: none;
    border: 1px solid rgba(247, 244, 236, 0.4);
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--paper);
    cursor: pointer;
  }
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero .wrap {
  max-width: 980px;
  padding-top: clamp(2rem, 5vw, 3rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
  position: relative;
  z-index: 2;
}
.hero-contours {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  z-index: 1;
  opacity: 0.55;
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--gap);
  align-items: center;
}
@media (max-width: 700px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero h1 { margin-bottom: 0.3em; }
.hero .role {
  font-family: var(--mono);
  color: var(--stone);
  font-size: 0.95rem;
  margin-bottom: 1.4em;
}
.hero .tagline {
  font-size: 1.1rem;
  max-width: 46ch;
}
.hero-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  /* border: 1px solid var(--line); */
  /* background: var(--sand); */
}

.hero-photo-wide {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  /* border: 1px solid var(--line); */
  /* background: var(--sand); */
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}
.pill {
  font-family: var(--mono);
  font-size: 0.82rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
}
.pill:hover { background: var(--ink); color: var(--paper); }
.pill.accent { background: var(--rust); border-color: var(--rust); color: var(--paper); }
.pill.accent:hover { background: var(--ink); border-color: var(--ink); }

/* ---------- SECTIONS ---------- */
section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
section + section { border-top: 1px solid var(--line); }

.section-head { margin-bottom: 1.8rem; }

.lede {
  font-size: 1.05rem;
  color: var(--stone);
  max-width: 60ch;
}

/* ---------- RESEARCH THEMES ---------- */
.theme-list {
  display: grid;
  gap: 1.4rem;
}
.theme {
  border: 1px solid var(--line);
  border-left: 3px solid var(--moss);
  background: #fffdf8;
  border-radius: 4px;
  padding: 1.3rem 1.5rem;
}
.theme h3 { color: var(--ink); margin-bottom: 0.35em; }
.theme p { color: var(--stone); margin-bottom: 0; }

/* ---------- METHODS / TOOLS CHIPS ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--sand);
  border-radius: 4px;
  padding: 0.3rem 0.65rem;
  color: var(--ink);
}

/* ---------- PUBLICATIONS ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.pub:first-child { border-top: 1px solid var(--line); }
.pub .year {
  font-family: var(--mono);
  color: var(--moss);
  font-size: 0.95rem;
  padding-top: 0.15em;
}
.pub .title { font-weight: 600; margin-bottom: 0.2em; }
.pub .meta { color: var(--stone); font-size: 0.92rem; margin-bottom: 0.4em; }
.pub .links a { font-family: var(--mono); font-size: 0.82rem; margin-right: 1rem; }

/* ---------- SOFTWARE / CODE ---------- */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.2rem;
}
.repo-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.2rem 1.3rem;
  background: #fffdf8;
}
.repo-card h3 { margin-bottom: 0.3em; font-size: 1.05rem; }
.repo-card .repo-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--rust);
  display: block;
  margin-bottom: 0.5em;
}
.repo-card p { color: var(--stone); font-size: 0.93rem; margin-bottom: 0.7em; }

/* ---------- CONTACT ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.contact-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  background: #fffdf8;
}
.contact-item .eyebrow { margin-bottom: 0.3em; }
.contact-item a { font-family: var(--mono); font-size: 0.95rem; word-break: break-word; }

/* ---------- FOOTER ---------- */
footer {
  padding: 2rem 0 3rem;
  text-align: center;
  color: var(--stone);
  font-size: 0.85rem;
}
footer .wrap { border-top: 1px solid var(--line); padding-top: 1.5rem; }

/* ---------- CV PAGE BUTTON ---------- */
.cv-actions { margin-top: 1.5rem; }
