/* ============================================================
   main.css — shared stylesheet for the whole site.
   Palette: dark, elegant oxblood/wine red on a warm ivory base.
   ============================================================ */

:root {
  --bg: #faf8f6;
  --surface: #ffffff;
  --text: #201819;
  --text-muted: #6b5d5d;
  --border: #e9e0dd;
  --accent: #6e1423;
  --accent-2: #a3495a;
  --accent-soft: #f6e9e8;
  --footer-bg: #2a0d12;
  --footer-text: #e6cfd0;
  --header-bg: rgba(250, 249, 247, 0.92);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 15, 15, 0.05), 0 8px 24px rgba(30, 15, 15, 0.07);
  --max-width: 1080px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark mode — same oxblood identity, inverted surfaces, brighter accent for contrast */
[data-theme="dark"] {
  --bg: #18110f;
  --surface: #251c1a;
  --text: #f2e8e6;
  --text-muted: #b9a5a2;
  --border: #3d2c2a;
  --accent: #cf4d63;
  --accent-2: #dd8c96;
  --accent-soft: #3a2428;
  --footer-bg: #0d0908;
  --footer-text: #d9b8ba;
  --header-bg: rgba(24, 17, 15, 0.92);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}

img {
  max-width: 100%;
}

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

/* ---------------- Header / Nav ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.theme-toggle:hover {
  background: var(--accent);
  color: #fff;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 800px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open {
    max-height: 480px;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    border-left: 2px solid transparent;
  }
  .nav-links a.active {
    border-left-color: var(--accent);
    border-bottom-color: var(--border);
  }
}

/* ---------------- Page shell ---------------- */
main {
  padding: 48px 0 80px;
}

.page-title {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 40px;
  max-width: 640px;
}

.section {
  margin-bottom: 48px;
}
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

/* ---------------- Hero (Home) ---------------- */
.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 32px;
  margin-bottom: 56px;
}

.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
}

.hero-name {
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.hero-role {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 18px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
}
.chip-list li a,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.86rem;
  font-weight: 500;
}
.chip-list li a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
}
.btn:hover {
  background: var(--text);
  color: #fff;
  text-decoration: none;
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

/* ---------------- News strip (Home) ---------------- */
.news-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 16px;
  margin-bottom: 4px;
  scroll-snap-type: x proximity;
}
.news-item {
  flex: 0 0 auto;
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  scroll-snap-align: start;
}
.news-date {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 6px;
}
.news-text {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0;
}

@media (max-width: 680px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-photo {
    margin: 0 auto;
  }
  .chip-list {
    justify-content: center;
  }
}

/* Keyword chips (research interests) */
.keyword-chip {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  margin: 0 6px 8px 0;
}

/* ---------------- Journey timeline (replaces the old map) ---------------- */
.journey {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.journey::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.journey-item {
  display: flex;
  gap: 20px;
  position: relative;
  padding-bottom: 28px;
}
.journey-item:last-child {
  padding-bottom: 0;
}
.journey-flag {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: var(--shadow);
  z-index: 1;
}
.journey-body {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
}
.journey-date {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}
.journey-place {
  font-weight: 700;
  font-size: 1.02rem;
  margin: 0 0 3px;
}
.journey-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}
.journey-item.current .journey-flag {
  background: var(--accent);
  border-color: var(--accent);
}
.journey-current-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 8px;
  vertical-align: middle;
}
.map-note {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 10px;
}
@media (max-width: 560px) {
  .journey-flag {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
  .journey::before {
    left: 21px;
  }
}

/* ---------------- Journey + footprint two-column layout ---------------- */
.journey-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 860px) {
  .journey-grid {
    grid-template-columns: 1fr;
  }
}

.bubble-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  position: sticky;
  top: 90px;
}
@media (max-width: 860px) {
  .bubble-panel {
    position: static;
  }
}
.bubble-panel h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.bubble-caption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 20px;
}
.bubble-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 0 4px;
}
.bubble {
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.bubble-flag {
  font-size: 1.2em;
  line-height: 1;
}
.bubble-count {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.9;
  margin-top: 1px;
}
.bubble-footnote {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 18px 0 0;
}

/* ---------------- CV layout ---------------- */
.cv-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

.cv-sidebar {
  position: sticky;
  top: 90px;
}

.cv-sidebar .card {
  text-align: center;
}
.cv-sidebar-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 14px;
}
.cv-sidebar h3 {
  margin: 0 0 2px;
  font-size: 1.1rem;
}
.cv-sidebar .role {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.cv-links {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
}
.cv-links li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.cv-links li:last-child {
  border-bottom: none;
}

@media (max-width: 900px) {
  .cv-layout {
    grid-template-columns: 1fr;
  }
  .cv-sidebar {
    position: static;
  }
}

/* Timeline entries (education, stays, teaching...) */
.entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.entry:last-child {
  border-bottom: none;
}
.entry-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.entry-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 1rem;
}
.entry-org {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.entry-meta {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.entry-flag-big {
  font-size: 2.1rem;
  line-height: 1;
}
@media (max-width: 620px) {
  .entry-date {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .entry-flag-big {
    font-size: 1.6rem;
  }
}
.section-intro {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: -10px 0 16px;
  max-width: 640px;
}

@media (max-width: 620px) {
  .entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Simple two-column fact table (languages, skills) */
.fact-table {
  width: 100%;
  border-collapse: collapse;
}
.fact-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
  vertical-align: top;
}
.fact-table td:first-child {
  width: 34%;
  color: var(--text-muted);
  font-weight: 600;
}
.fact-table tr:last-child td {
  border-bottom: none;
}

.callout {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 0.94rem;
}
.callout a {
  font-weight: 600;
}

.prose p {
  margin: 0 0 16px;
}
.prose p:last-child {
  margin-bottom: 0;
}
.about-prose {
  text-align: justify;
  hyphens: auto;
}

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 44px 0 28px;
  margin-top: 64px;
}
.site-footer h6 {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  color: #fff;
  margin: 0 0 10px;
}
.site-footer a {
  color: #e8c9c9;
}
.site-footer a:hover {
  color: #fff;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  font-size: 0.9rem;
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 30px;
  padding-top: 18px;
  font-size: 0.8rem;
  color: #b89b9b;
  text-align: center;
}

@media (max-width: 620px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Topic cards (Research Interests) ---------------- */
.topic-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: start;
}
.topic-card img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
}
@media (max-width: 620px) {
  .topic-card {
    grid-template-columns: 1fr;
  }
  .topic-card img {
    width: 100%;
    height: 160px;
  }
}

details.more {
  margin-top: 10px;
}
details.more summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
}
details.more summary::-webkit-details-marker {
  display: none;
}
details.more summary:hover {
  color: var(--accent);
}
details.more summary::after {
  content: " +";
}
details.more[open] summary::after {
  content: " -";
}
details.more p {
  margin-top: 10px;
}

/* ---------------- Publication / talk list items ---------------- */
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pub;
}
.pub-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child {
  border-bottom: none;
}
.pub-title {
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0 0 4px;
}
.pub-authors {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 4px;
}
.pub-meta {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin: 0;
}
.pub-meta a {
  font-weight: 600;
}

/* Posters */
.poster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.poster-grid embed {
  width: 100%;
  height: 560px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
@media (max-width: 780px) {
  .poster-grid {
    grid-template-columns: 1fr;
  }
}

/* Co-authorship graph: hover a node to bring it forward (grow + bold label +
   brighten its line to Arturo). No dimming of other nodes, no blur/shadow —
   kept crisp. */
#collab-graph .node-line {
  transition: stroke-opacity 0.2s ease;
}
#collab-graph .node-wrap:hover .node-line {
  stroke-opacity: 1;
}
#collab-graph .node-visual {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.18s ease;
}
#collab-graph .node-wrap:hover .node-visual {
  transform: scale(1.2);
}
#collab-graph .node-wrap:hover .node-label {
  font-weight: 700;
}
