/* ==========================================================================
   Personal academic site — shared styles
   Highlight colors: blue (--blue) and green (--green). Change them here.
   ========================================================================== */

:root {
  --blue: #1f6feb;
  --blue-dark: #174ea6;
  --green: #1a9f6b;
  --green-dark: #127a52;

  --bg: #ffffff;
  --bg-alt: #f5f8fa;
  --surface: #ffffff;
  --text: #1c2430;
  --text-muted: #5b6675;
  --border: #e1e7ee;
  --tag-blue-bg: #e7f0fe;
  --tag-green-bg: #e3f6ee;

  --radius: 10px;
  --max-width: 1040px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
}

/* The site always uses the light theme above.
   A saved dark theme lives in css/themes/dark.css (see that file to switch). */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--green); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--blue);
}

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

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: #000;
}
.brand:hover { color: #000; text-decoration: none; }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover {
  color: var(--blue);
  background: var(--tag-blue-bg);
  text-decoration: none;
}
.nav-links a.active {
  color: #fff;
  background: var(--blue);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 67px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Sections ---------- */

main { min-height: calc(100vh - 200px); }

.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.section-title::before {
  content: "";
  width: 6px;
  height: 1.4em;
  border-radius: 3px;
  background: var(--blue);
}

.page-header {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--border);
}
.page-header p { color: var(--text-muted); max-width: 680px; margin: 0; }

.filler { color: var(--text-muted); }

/* ---------- Hero / About ---------- */

.hero {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: center;
  padding: 72px 0 56px;
}

.avatar {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--blue);
  padding: 5px;
}
.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  overflow: hidden;
}
.avatar-inner img { width: 100%; height: 100%; object-fit: cover; }

.hero .eyebrow {
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero h1 .pronouns {
  font-size: 0.4em;
  font-weight: 400;
  letter-spacing: 0;
  color: #9aa3ad;
  vertical-align: middle;
}
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--green); border-color: var(--green); color: #fff; }
.btn-icon { width: 1em; height: 1em; flex-shrink: 0; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 28px; padding-top: 48px; }
  .avatar { width: 180px; height: 180px; margin: 0 auto; }
  .links-row { justify-content: center; }
  .hero > div:last-child { padding: 0 14px; }
  .hero > div:last-child > p:not(.subtitle) { line-height: 1.75; margin-bottom: 1.1em; }
}

/* ---------- Grids & cards ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.interest-card h3 { color: var(--blue); }
.interest-card:nth-child(even) h3 { color: var(--green); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tag-blue-bg);
  color: var(--blue-dark);
}
.tag.green { background: var(--tag-green-bg); color: var(--green-dark); }

/* ---------- News list ---------- */

.news { list-style: none; padding: 0; margin: 0; }
.news li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.news li:last-child { border-bottom: none; }
.news .date { font-weight: 600; color: var(--green); font-size: 0.9rem; }

/* ---------- CV ---------- */

.cv-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.cv-section { margin-bottom: 48px; }

.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 28px; }
.timeline-item { position: relative; margin-bottom: 28px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--blue);
}
.timeline-item:nth-child(even)::before { border-color: var(--green); }
.timeline-item h3 { margin-bottom: 2px; }
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.timeline-meta .when { font-weight: 600; color: var(--blue); }
.timeline-item ul { margin: 6px 0 0; padding-left: 20px; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.skills-grid h3 { font-size: 1rem; color: var(--green); }

.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.simple-list .when { color: var(--text-muted); white-space: nowrap; font-size: 0.95rem; }

/* ---------- Portfolio ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.filter-btn:hover { border-color: var(--green); color: var(--green); }
.filter-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

.project-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16, 24, 40, 0.12); }
.project-card.hidden { display: none; }

.project-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }

.project-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.project-body p { color: var(--text-muted); font-size: 0.95rem; flex: 1; }
.project-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.9rem; font-weight: 600; margin-top: 12px; }

/* Opening "Read more" on one card shouldn't stretch the rest of its row */
.grid-3:has(.project-card) { align-items: start; }

/* Paper figures: show the whole figure on white instead of cropping */
.project-thumb.fit { background: #fff; border-bottom: 1px solid var(--border); }
.project-thumb.fit img { object-fit: contain; padding: 8px; }
/* Tall images (flyers): keep the top of the image in view */
.project-thumb { overflow: hidden; } /* keeps tall images inside the 16:10 box */
.project-thumb.top img { object-position: center 30%; }

.project-body .img-credit { flex: none; font-size: 0.75rem; font-style: italic; color: var(--text-muted); margin: -4px 0 8px; }

.project-thumb.note { padding: 16px; text-align: center; font-style: italic; }

.project-more { margin-top: 12px; font-size: 0.93rem; }
.project-more summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 600;
  font-size: 0.9rem;
}
.project-more summary:hover { color: var(--blue); }
.project-more[open] summary { margin-bottom: 8px; }
.project-body .project-more p { flex: none; color: var(--text); }
.project-more ul { margin: 0 0 1em; padding-left: 20px; }
.project-more figure { margin: 0 0 1em; }
.project-more figure img { border-radius: 6px; border: 1px solid var(--border); }
.project-more figcaption { font-size: 0.8rem; font-style: italic; color: var(--text-muted); margin-top: 4px; }

/* ---------- Publications ---------- */

.pub-year {
  font-size: 1.2rem;
  color: var(--blue);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  margin: 40px 0 16px;
}
.pub-year:first-of-type { margin-top: 0; }

.pub {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.pub-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 4px 6px;
  border-radius: 6px;
  height: fit-content;
  background: var(--tag-blue-bg);
  color: var(--blue-dark);
}
.pub-type.conf { background: var(--tag-green-bg); color: var(--green-dark); }
.pub-type.preprint { background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }

.pub-title { font-weight: 600; margin-bottom: 2px; }
.pub-authors { font-size: 0.95rem; color: var(--text-muted); }
.pub-authors .me { color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; }
.pub-venue { font-size: 0.95rem; font-style: italic; }
.pub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pub-links a {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.pub-links a:hover { border-color: var(--blue); text-decoration: none; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; color: var(--text-muted); margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .pub-type { display: inline-block; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Print (for CV page) ---------- */

@media print {
  .site-header, .site-footer, .cv-actions, .nav-toggle { display: none; }
  body { font-size: 12pt; }
  .section { padding: 16px 0; }
}

/* Linked-to portfolio cards (e.g. portfolio.html#auxbots from the bio) */
.project-card[id] { scroll-margin-top: 90px; }
.project-card:target { border-color: var(--green); box-shadow: 0 0 0 3px rgba(26, 159, 107, 0.25); }

.press-title { margin-top: 40px; }
