/* ── FONTS ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=DM+Mono:wght@300;400&display=swap');

/* ── EHU BRAND PALETTE ─────────────────────────────────── */
:root {
  /* Core EHU colours */
  --ehu-green:    #5FD790;   /* UNIBERDEA */
  --ehu-mint:     #B0FBC1;   /* BERDE LEUNA */
  --ehu-warm:     #B1AB9F;   /* EGURRA */
  --ehu-orange:   #FF9378;   /* EGUNSENTIA */
  --ehu-blue:     #7D8CFE;   /* ZERUA */
  --ehu-yellow:   #EEED46;   /* ARGIA */
  --ehu-lavender: #C0B4F0;   /* BEHE LAINOA */

  /* Semantic tokens */
  --accent:       var(--ehu-green);
  --accent-dark:  #1f9e5c;   /* darker green for text on white */
  --ink:          #161616;
  --ink-mid:      #444444;
  --ink-light:    #767676;
  --paper:        #ffffff;
  --surface:      #f4faf7;   /* very light green tint */
  --surface-2:    #edf8f2;
  --rule:         #d8f0e4;
  --tag-bg:       #e6f9ef;

  --sans:  'Montserrat', system-ui, sans-serif;
  --mono:  'DM Mono', monospace;

  --max-w:   860px;
  --side-w:  220px;
  --radius:  6px;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── LANGUAGE BAR ───────────────────────────────────────── */
.lang-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--ehu-green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 2.5rem;
}

.lang-bar .site-name {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #0d5c32;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
}

.lang-btns { display: flex; gap: 0.2rem; }

.lang-bar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: #0d5c32;
  text-decoration: none;
  font-weight: 500;
  opacity: 0.75;
  transition: opacity 0.15s;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-link:hover { opacity: 1; }

.nav-sep {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: #0d5c32;
  opacity: 0.4;
}

.nav-divider {
  width: 1px;
  height: 1rem;
  background: rgba(0,0,0,0.2);
}

.lang-btn {
  background: transparent;
  border: 1.5px solid rgba(0,0,0,0.2);
  color: #0d5c32;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: var(--radius);
  font-weight: 500;
}
.lang-btn:hover { background: rgba(255,255,255,0.3); border-color: rgba(0,0,0,0.3); }
.lang-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ehu-green);
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.page-wrap {
  max-width: calc(var(--max-w) + var(--side-w) + 4rem);
  margin: 0 auto;
  padding: 5.5rem 2rem 4rem;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  gap: 0 4rem;
  align-items: start;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 5rem;
  padding-top: 0.5rem;
}

.avatar-placeholder {
  width: 100px; height: 100px;
  background: var(--ehu-green);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 1.4rem; font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.1rem;
  border-radius: var(--radius);
  letter-spacing: 0.05em;
}

.avatar {
  width: 100px; height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 1.1rem;
}

.sidebar-name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.3rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.sidebar-title {
  font-size: 0.75rem;
  color: var(--ink-mid);
  line-height: 1.5;
  margin-bottom: 1.1rem;
  font-weight: 400;
}

.sidebar-divider {
  border: none;
  border-top: 1.5px solid var(--rule);
  margin: 0.9rem 0;
}

.sidebar-section { margin-bottom: 1rem; }

.sidebar-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.45rem;
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--ink-mid);
  text-decoration: none;
  padding: 0.18rem 0;
  transition: color 0.15s;
  font-weight: 400;
}
.sidebar-link:hover { color: var(--accent-dark); }
.sidebar-link svg { flex-shrink: 0; opacity: 0.5; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag {
  background: var(--tag-bg);
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  color: var(--accent-dark);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.skill-item {
  background: var(--surface);
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 400;
  color: var(--ink-mid);
}
.skill-dots { color: var(--accent-dark); letter-spacing: 1px; font-size: 0.65rem; }

/* ── MAIN ───────────────────────────────────────────────── */
.main-content { min-width: 0; }

.lang-block { display: none; }
.lang-block.active { display: block; }

/* ── HERO ───────────────────────────────────────────────── */
.hero {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2.5px solid var(--ehu-green);
}

.hero-name {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.hero-name em {
  font-style: normal;
  color: var(--accent-dark);
}

.hero-subtitle {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  margin-top: 0.6rem;
}

/* ── SECTIONS ───────────────────────────────────────────── */
.cv-section { margin-bottom: 2.8rem; scroll-margin-top: 3.5rem; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid var(--rule);
}

.section-num {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--paper);
  background: var(--ehu-green);
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  line-height: 1.5;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

/* ── BIO ────────────────────────────────────────────────── */
.bio-text {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--ink-mid);
  font-weight: 400;
}
.bio-text p + p { margin-top: 0.85em; }

.bio-text a,
.entry-desc a,
.entry-sub a,
.entry-title a,
.pub-meta a,
.pub-title a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-color: var(--ehu-mint);
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.bio-text a:hover,
.entry-desc a:hover,
.entry-sub a:hover,
.entry-title a:hover,
.pub-meta a:hover,
.pub-title a:hover { color: var(--ehu-green); }

/* ── SUBSECTION LABELS ──────────────────────────────────── */
.subsection-label {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 0.8rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--rule);
}

/* ── RESEARCH LINES ─────────────────────────────────────── */
.research-lines { display: flex; flex-direction: column; gap: 0; }

.rl-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 1.5rem;
  align-items: baseline;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.rl-row:hover {
  border-left-color: var(--ehu-green);
  background: var(--surface);
}

.rl-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.rl-desc {
  font-size: 0.85rem;
  color: var(--ink-mid);
  line-height: 1.65;
}

/* keep old class harmless */
.research-line { display: none; }
.rl-dot { display: none; }

/* ── TIMELINE ENTRIES ───────────────────────────────────── */
.entry {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0 1.5rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--surface-2);
}
.entry:last-child { border-bottom: none; }

.entry-year {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-light);
  padding-top: 0.1rem;
  line-height: 1.5;
}

.entry-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.entry-sub {
  font-size: 0.78rem;
  color: var(--ink-light);
  margin-top: 0.1rem;
  font-weight: 400;
}
.entry-desc {
  font-size: 0.8rem;
  color: var(--ink-light);
  margin-top: 0.3rem;
  line-height: 1.6;
  font-weight: 400;
}

/* ── PUBLICATIONS ───────────────────────────────────────── */
.pub {
  padding: 0.85rem 0 0.85rem 1rem;
  border-left: 3px solid var(--ehu-mint);
  margin-bottom: 0.6rem;
  transition: border-left-color 0.15s;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.pub:hover { border-left-color: var(--ehu-green); }

.pub-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.pub-title a { color: inherit; text-decoration: none; }
.pub-title a:hover { color: var(--accent-dark); }

.pub-translation {
  font-size: 0.78rem;
  color: var(--ink-light);
  font-weight: 400;
  font-style: italic;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.pub-meta {
  font-size: 0.76rem;
  color: var(--ink-light);
  margin-top: 0.25rem;
  font-style: italic;
  font-weight: 400;
}

/* BADGES */
.pub-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-family: var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
  margin-left: 0.4rem;
  vertical-align: middle;
  font-weight: 500;
  line-height: 1.6;
}

.pub-badge.book  { background: var(--ehu-orange); color: #fff; }
.pub-badge.rpkg  { background: var(--ehu-blue);   color: #fff; }
.pub-badge.prize { background: var(--ehu-yellow);  color: var(--ink); }
.pub-badge.ip    { background: var(--ehu-green);   color: var(--ink); }

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  margin-top: 3.5rem;
  padding: 1.2rem 0;
  border-top: 1.5px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--ink-light);
  letter-spacing: 0.05em;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrap {
    grid-template-columns: 1fr;
    padding: 4.5rem 1.2rem 3rem;
  }
  .sidebar { position: static; margin-bottom: 2rem; display: flex; flex-direction: column; align-items: flex-start; }
  .avatar-placeholder, .avatar { width: 80px; height: 80px; font-size: 1rem; }
  .entry { grid-template-columns: 75px 1fr; gap: 0 0.7rem; }
  .lang-bar { padding: 0.5rem 1.2rem; }
  .lang-bar .site-name { display: none; }
  .nav-links { display: none; }
  .nav-divider { display: none; }
  .rl-row { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Only animate the whole block, not individual sections */
.lang-block.active { animation: fadeUp 0.2s ease; }

.cv-section { opacity: 1; } /* no per-section animation — avoids re-trigger on lang switch */

/* ── QUARTO OVERRIDES ───────────────────────────────────── */
/* quarto overrides — hide auto-generated title block */
#title-block-header,
.quarto-title-block,
.quarto-title,
#title-block-header h1.title { display: none !important; }
#quarto-content { padding: 0 !important; }
.page-columns { max-width: 100% !important; }
.page-columns { max-width: 100% !important; }
