/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg:        #fafaf8;
  --surface:   #ffffff;
  --border:    #e4e4dc;
  --text:      #1a1a18;
  --muted:     #6b6b62;
  --accent:    #0d9448;       /* banderia green */
  --accent-lt: #e9f8ef;
  --font-sans: 'DM Sans', sans-serif;
  --font-serif:'Lora', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-w:     720px;
  --nav-h:     58px;
}

/* ── Dark theme ───────────────────────────────────────────────── */
html[data-theme="dark"] {
  --bg:        #081713;
  --surface:   #0f231a;
  --border:    #1f3d2d;
  --text:      #eaf3ec;
  --muted:     #86ab97;
  --accent:    #2fcf72;
  --accent-lt: #123322;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Navigation ───────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(250,250,248,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-brand:hover { text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
}
.theme-toggle-btn .icon-moon { display: block; }
.theme-toggle-btn .icon-sun  { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: block; }

html[data-theme="dark"] nav {
  background: rgba(8,23,19,0.92);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  text-decoration: none;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.other-card-body p + p {
  margin-top: 0.5rem;
}

/* Hamburger toggle — hidden on desktop, shown via the mobile media query below */
.nav-toggle-checkbox { display: none; }
.nav-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 15px;
  cursor: pointer;
  z-index: 101;
}
.nav-toggle-label span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
 
.other-card-body p + p {
  margin-top: 0.5rem;
}


/* ── Page wrapper ─────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Main content area ────────────────────────────────────────── */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

/* ── Section title ────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.section-rule {
  border: none;
  border-top: 2px solid var(--accent);
  width: 2.5rem;
  margin-bottom: 2rem;
}

/* ── HOME HERO ────────────────────────────────────────────────── */
.home-hero {
  min-height: calc(100vh - var(--nav-h));
  background: #f0f2f5;
  display: flex;
  align-items: center;
  padding: 4rem 2rem;
}
html[data-theme="dark"] .home-hero {
  background: #0c1f17;
}
.hero-inner {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
  align-items: start;
}

/* LEFT sidebar */
.hero-aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: 60%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}
.hero-photo-placeholder {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.hero-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}
.hero-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: color 0.15s;
}
.hero-link svg { flex-shrink: 0; opacity: 0.6; transition: opacity 0.15s; }
.hero-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}
.hero-link:hover svg { opacity: 1; }

/* RIGHT body */
.hero-name {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.hero-role {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.15rem;
}
.hero-affiliation {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.hero-advisor {
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-advisor a { color: var(--muted); font-weight: 500; }
.hero-advisor a:hover { color: var(--accent); }

.hero-divider {
  width: 2.5rem;
  border-top: 2px solid var(--accent);
  margin: 1.25rem 0;
}

.hero-bio {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 0.85rem;
}
.hero-bio:last-of-type { margin-bottom: 0; }
.hero-bio a { color: var(--accent); }
.hero-bio strong { color: var(--text); }

.hero-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.5rem;
}
.interest-tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
}

/* ── CV ───────────────────────────────────────────────────────── */
.cv-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-lt);
  border: 1px solid #bfe6cf;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 2.5rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}
html[data-theme="dark"] .cv-download-bar {
  border-color: #1f4a30;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; text-decoration: none; color: #fff; }

.cv-block { margin-bottom: 2.5rem; }
.cv-block-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.cv-entry { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.cv-year {
  order: 2;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.15rem;
  text-align: right;
}
.cv-entry-body { order: 1; }
.cv-entry-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.cv-entry-body .cv-org {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.cv-entry-body p {
  font-size: 0.85rem;
  color: var(--muted);
}


/* ── UPDATES ──────────────────────────────────────────────────── */
.update-list { list-style: none; }
.update-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.update-item:last-child { border-bottom: none; }
.update-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  flex-shrink: 0;
  min-width: 5.5rem;
}
.update-date {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.update-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}
.badge-paper   { background: #dbeafe; color: #1e40af; }
.badge-talk    { background: #dcfce7; color: #166534; }
.badge-award   { background: #fef9c3; color: #854d0e; }
.badge-news    { background: #fce7f3; color: #9d174d; }
.badge-travel  { background: #ede9fe; color: #5b21b6; }

html[data-theme="dark"] .badge-paper  { background: rgba(59,130,246,0.16); color: #93c5fd; }
html[data-theme="dark"] .badge-talk   { background: rgba(47,207,114,0.16); color: #86efac; }
html[data-theme="dark"] .badge-award  { background: rgba(234,179,8,0.16); color: #fde68a; }
html[data-theme="dark"] .badge-news   { background: rgba(236,72,153,0.16); color: #f9a8d4; }
html[data-theme="dark"] .badge-travel { background: rgba(139,92,246,0.16); color: #c4b5fd; }
.update-text { font-size: 0.9rem; color: var(--text); line-height: 1.5; }

/* ── PUBLICATIONS ─────────────────────────────────────────────── */
.pub-filters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.filter-btn {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pub-list { list-style: none; }
.pub-item {
  padding: 1.25rem 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  margin: 0.7rem 0;
}
.pub-item:last-child { border-bottom: none; }
.pub-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.pub-authors {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.pub-authors strong { color: var(--text); }
.pub-venue {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.pub-links { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pub-link {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  transition: all 0.15s;
}
.pub-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
  text-decoration: none;
}

/* ── Publication TL;DR ────────────────────────────────────────── */
.pub-tldr {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

.pub-tldr-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ── OTHER ────────────────────────────────────────────────────── */
.other-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}
.other-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.other-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(13,148,72,0.07);
}
.other-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.other-card p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.77rem;
  color: var(--muted);
}

/* ── Responsive ───────────────────────────────────────────────── */
 
/* Tablet: tighten spacing a little, everything else already reflows fine */
@media (max-width: 900px) {
  .home-hero { padding: 3rem 1.5rem; }
  main { padding: 3rem 1.25rem 4rem; }
}
 
/* Phone (and small tablets in portrait): stack hero, collapse nav into a menu */
@media (max-width: 640px) {
  .home-hero { min-height: auto; padding: 2.5rem 1.5rem; }
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
  .hero-aside { align-items: center; }
  .hero-photo { width: 160px; height: 160px; }
  .hero-links { align-items: flex-start; max-width: 220px; margin: 0 auto; }
  .hero-name { font-size: 1.9rem; }
  .hero-divider { margin: 1.25rem auto; }
  .hero-interests { justify-content: center; }
 
  /* Nav collapses into a hamburger-driven dropdown */
  .nav-toggle-label { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 20px rgba(0,0,0,0.06);
    padding: 0.5rem 1.25rem 1rem;
  }
  .nav-toggle-checkbox:checked ~ .nav-links { display: flex; }
  .nav-links a {
    width: 100%;
    padding: 0.7rem 0.5rem;
    font-size: 0.85rem;
  }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(2) { opacity: 0; }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
 
  /* CV entries stack: date sits above the title instead of squeezing beside it */
  .cv-entry { flex-direction: column; gap: 0.15rem; }
  .cv-year { order: -1; text-align: left; }
 
  /* Update rows stack the same way */
  .update-item { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .update-meta { flex-direction: row; align-items: center; gap: 0.6rem; min-width: 0; padding-top: 0; }
 
  /* Two-up photo grid gets a bit tight on phones — go single column */
  .other-card-photos { grid-template-columns: 1fr; }
  .other-card { padding: 1rem 1.1rem; }
}
 
/* Small phones: trim a bit further */
@media (max-width: 400px) {
  .nav-brand { font-size: 0.92rem; }
  .hero-name { font-size: 1.6rem; }
  .hero-photo { width: 130px; height: 130px; }
  .section-title { font-size: 1.4rem; }
}
 
.other-card { cursor: pointer; }
 
.other-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.other-card-summary {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
 
.other-card-arrow {
  font-size: 0.9rem;
  color: var(--muted);
  transition: transform 0.25s;
}
 
.other-card.open .other-card-arrow {
  transform: rotate(90deg);
}
 
.other-card-body {
  display: none;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
 
.other-card-body ul {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
}
 
.other-card-body li { margin-bottom: 0.3rem; }
 
.other-card.open .other-card-body {
  display: block;
}
 
/* ── Other card photos ────────────────────────────────────────── */
.other-card-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}
 
.other-card-photos figure {
  margin: 0;
}
 
.other-card-photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
 
.other-card-photos figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.35rem;
  font-style: italic;
}

/* ── Other card photo — single, centered ─────────────────────── */
.other-card-photo-single {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}
.other-card-photo-single figure {
  margin: 0;
  width: 100%;
  max-width: 320px;
}
.other-card-photo-single img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.other-card-photo-single figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.35rem;
  font-style: italic;
}