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

:root {
  --bg:      #f7f6f3;
  --surface: #ffffff;
  --text:    #1a1a1a;
  --muted:   #888888;
  --accent:  #8b2020;
  --border:  #ebe9e3;
  --line:    #d2d2d2;
  --dot:     #818080;
  --nav-h:   58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

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

/* ── Navigation ── */
.nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(247,246,243,0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.nav-brand {
  font-size: 0.88rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  letter-spacing: 0.01em; white-space: nowrap;
  justify-self: start;
}
.nav-brand:hover { text-decoration: none; color: var(--text); }

.nav-links { list-style: none; display: flex; gap: 1px; align-items: center; justify-self: center; }
.nav-links a {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.71rem; font-weight: 400;
  color: var(--text); text-decoration: none;
  padding: 5px 8px; border-radius: 6px; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover  { background: rgba(0,0,0,0.06); text-decoration: none; }
.nav-links a.active { font-weight: 600; color: var(--accent); }

.nav-icon-svg { display: inline-flex; align-items: center; flex-shrink: 0; opacity: 0.38; transition: opacity 0.15s; }
.nav-icon-svg svg { display: block; fill: currentColor; width: 12px; height: 12px; }
.nav-links a:hover .nav-icon-svg { opacity: 0.75; }
.nav-links a.active .nav-icon-svg { opacity: 1; }

.nav-icons {
  display: flex; align-items: center; gap: 9px;
  justify-self: end;
  padding-left: 12px; border-left: 1px solid var(--border);
}
.icon-link {
  display: flex; align-items: center; justify-content: center;
  color: var(--text); opacity: 0.55;
  transition: opacity 0.15s, color 0.15s; text-decoration: none;
}
.icon-link:hover { opacity: 1; color: var(--accent); text-decoration: none; }
.icon-link svg { display: block; fill: currentColor; }
.nav-icons .icon-link svg { width: 15px; height: 15px; }
.profile-icon-links .icon-link svg { width: 20px; height: 20px; }
.profile-icon-links { display: flex; align-items: center; gap: 16px; margin-top: 16px; }

/* ── Container ── */
.container { max-width: 860px; margin: 0 auto; padding: 64px 44px; }

/* ── Section heading ── */
.section-heading {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 36px; margin-top: 52px;
}
.section-heading:first-child { margin-top: 0; }

.sh-icon { display: flex; align-items: center; flex-shrink: 0; opacity: 0.45; }
.sh-icon svg { display: block; fill: currentColor; width: 17px; height: 17px; }

/* ── Profile block ── */
.profile-block {
  display: flex; align-items: center; gap: 44px;
  padding-bottom: 52px; border-bottom: 1px solid var(--border); margin-bottom: 52px;
}
.profile-photo {
  width: 148px; height: 148px; border-radius: 50%; background: #d4d2cc; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: #888; font-weight: 500; letter-spacing: 0.04em; overflow: hidden;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-info h1 { font-size: 2rem; font-weight: 700; line-height: 1.15; margin-bottom: 8px; }
.profile-subtitle { font-size: 0.9rem; font-weight: 300; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.profile-links { font-size: 0.82rem; }

/* ══ PAGE MENU (landing) ══════════════════════════ */
.page-menu {
  margin-top: 40px;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.page-menu-item {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 13px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  background: rgba(0,0,0,0.05);
  overflow: hidden;
  white-space: nowrap;
  transition: background 1s ease, color 0.5s ease;
}

.page-menu-item:hover {
  text-decoration: none;
  background: rgba(139,32,32,0.09);
  color: var(--accent);
  transition: background 1s ease, color 0.5s ease;
}

.pmi-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  color: var(--text);
  transition: opacity 0.25s ease, color 0.25s ease;
}
.pmi-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.page-menu-item:hover .pmi-icon {
  opacity: 1;
  color: var(--accent);
}

.pmi-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0;
  margin-left: 0;
  transition:
    max-width 1s cubic-bezier(0.25, 0, 0.1, 1),
    opacity 0.7s ease,
    margin-left 1s cubic-bezier(0.25, 0, 0.1, 1);
}

.page-menu-item:hover .pmi-label {
  max-width: 200px;
  opacity: 1;
  margin-left: 8px;
  transition:
    max-width 1s cubic-bezier(0.25, 0, 0.1, 1),
    opacity 0.7s ease,
    margin-left 1s cubic-bezier(0.25, 0, 0.1, 1);
}

.pmi-arrow { display: none; }

/* CV download items: label always visible */
.page-menu-item.pmi-cv .pmi-label {
  max-width: 200px;
  opacity: 1;
  margin-left: 8px;
  color: var(--accent);
}
.page-menu-item.pmi-cv .pmi-icon { opacity: 0.75; color: var(--accent); }

/* ── Body text ── */
.body-text { font-size: 0.875rem; line-height: 1.9; margin-bottom: 18px; color: var(--text); }

/* ══ TIMELINE ════════════════════════════════ */
.timeline { --date-w: 110px; --line-w: 26px; }
.tl-row { display: grid; grid-template-columns: var(--date-w) var(--line-w) 1fr; align-items: start; }
.tl-date {
  padding-right: 10px; padding-top: 4px; text-align: right;
  font-size: 0.67rem; color: var(--muted); line-height: 1.55; font-weight: 400;
  white-space: nowrap;
}
.tl-line-col { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex-shrink: 0; margin-top: 5px; z-index: 1; }
.tl-seg { flex: 1; width: 1px; background: var(--line); margin-top: 5px; min-height: 24px; }
.tl-row.last .tl-seg { display: none; }
.tl-content { padding: 0 0 36px 16px; }
.tl-tag { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 3px; }
.tl-title { font-size: 0.88rem; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 2px; }
.tl-subtitle { font-size: 0.78rem; color: var(--muted); line-height: 1.5; margin-bottom: 3px; }
.tl-detail { font-size: 0.73rem; color: var(--muted); font-style: italic; margin-bottom: 5px; }
.tl-bullets { margin: 5px 0 0; padding-left: 14px; font-size: 0.75rem; color: var(--muted); line-height: 1.85; }

/* ══ PUBLICATIONS ════════════════════════════ */
.pub-section { margin-bottom: 36px; }
.pub-section-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.pub-entry { position: relative; padding: 0 90px 22px 0; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.pub-entry:last-child { border-bottom: none; margin-bottom: 0; }
.pub-title   { font-size: 0.875rem; font-weight: 600; line-height: 1.45; margin-bottom: 5px; }
.pub-authors { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-bottom: 3px; }
.pub-journal { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.pub-summary { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-top: 8px; margin-right: -90px; font-style: italic; border-left: 2px solid var(--border); padding-left: 10px; text-align: justify; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto; }
.pub-link    { font-size: 0.75rem; }
.pub-badge {
  display: inline-block; font-size: 0.58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 3px;
  vertical-align: middle; margin-left: 0;
}
.pub-badge.published { background: #f0e4e4; color: var(--accent); }
.pub-badge.in-prep   { background: #ececec; color: var(--muted); }
.pub-badge.poster      { background: #e4eaf0; color: #2d5f8a; }
.pub-badge.talk    { background: #daeed8; color: #63c978; }
.pub-badge.journal-club    { background: #f7e7dd; color: #f9a560; }
.pub-entry-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.os-badges { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.os-badge {
  display: inline-block; font-size: 0.52rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; padding: 2px 6px; border-radius: 3px;
}
.os-badge.prereg      { background: #f5e0e0; color: #8b1a1a; }
.os-badge.prereg-plus { background: #f5e0e0; color: #8b1a1a; }
.os-badge.open-data   { background: #dde8f5; color: #1a5296; }
.os-badge.open-mat    { background: #fdf0dd; color: #8a5a00; }
.os-badge.open-code   { background: #dff0df; color: #1f6b1f; }

/* ══ PRESENTATIONS ═══════════════════════════ */
.pres-entry {
  position: relative;
  display: grid; grid-template-columns: 68px 1fr auto; gap: 0 18px;
  padding: 14px 0; border-bottom: 1px solid var(--border); align-items: start;
}
.pres-entry .os-badges {
  position: static;
  align-items: flex-end;
  justify-self: end;
}
.pres-date     { font-size: 0.72rem; color: var(--muted); padding-top: 2px; }
.pres-title    { font-size: 0.85rem; font-weight: 500; line-height: 1.45; margin-bottom: 3px; }
.pres-venue    { font-size: 0.75rem; color: var(--muted); }
.pres-location { font-size: 0.72rem; color: var(--muted); font-style: italic; }

/* ══ TABLE ═══════════════════════════════════ */
.teaching-table { width: 100%; border-collapse: collapse; font-size: 0.845rem; }
.teaching-table th {
  text-align: left; font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted); font-weight: 600;
  padding: 0 16px 10px 0; border-bottom: 1px solid var(--border);
}
.teaching-table td {
  padding: 11px 16px 11px 0; border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.5;
}
.teaching-table td:first-child { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.teaching-table td:nth-child(2) {
  white-space: nowrap;
}
.course-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ══ AWARDS ══════════════════════════════════ */
.award-entry {
  display: grid; grid-template-columns: 70px 1fr auto; gap: 0 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border); align-items: baseline;
}
.award-date  { font-size: 0.72rem; color: var(--muted); }
.award-title { font-size: 0.845rem; font-weight: 500; line-height: 1.45; }
.award-amt   { font-size: 0.75rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.award-desc  { grid-column: 2 / 3; font-size: 0.78rem; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.award-desc .pub-journal { margin-top: 5px; margin-bottom: 0; }

/* ══ OUTREACH ════════════════════════════════ */
.outreach-entry { padding: 14px 0; border-bottom: 1px solid var(--border); }
.outreach-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 3px; }
.outreach-meta  { font-size: 0.75rem; color: var(--muted); }
.outreach-entry .pub-summary { border-left: none; padding-left: 0; }

/* ══ SKILLS GRID ═════════════════════════════ */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 52px; font-size: 0.845rem; margin-bottom: 16px; }
.skill-group-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted); margin-bottom: 10px;
}
.skill-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }
.skill-name  { font-weight: 500; }
.skill-level { color: var(--muted); font-size: 0.78rem; }

/* ══ MEMBERSHIP ENTRIES ══════════════════════ */
.member-entry {
  display: grid; grid-template-columns: 120px 1fr 1.5fr; gap: 0 18px;
  padding: 14px 0; border-bottom: 1px solid var(--border); align-items: start;
}
.member-date { font-size: 0.72rem; color: var(--muted); padding-top: 2px; white-space: nowrap; line-height: 1.5; }
.member-org  { font-size: 0.85rem; font-weight: 400; line-height: 1.45; }
.member-role { font-size: 0.85rem; font-weight: 500; line-height: 1.45; margin-bottom: 3px; }
.member-inst { font-size: 0.72rem; color: var(--muted); font-style: italic; }

/* ══ LIST ROWS ═══════════════════════════════ */
.list-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 0.865rem; line-height: 1.6;
}
.list-row-year { color: var(--muted); font-size: 0.75rem; white-space: nowrap; flex-shrink: 0; padding-top: 2px; }

/* ══ FOOTER ══════════════════════════════════ */
.site-footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 32px 0 24px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ══ PROFILE TAGLINE ═════════════════════════ */
.profile-tagline {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 12px;
}

/* ══ PROFILE ICON LINKS (landing) ════════════ */
.profile-icon-links .icon-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.profile-icon-links .icon-label {
  font-size: 0.75rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  color: #666;
  letter-spacing: 0.02em;
}
.profile-icon-links .icon-link:hover .icon-label { color: inherit; }

/* ══ ABOUT TEXT ══════════════════════════════ */
.body-text {
  text-align: justify;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}

/* ══ PROJECTS PAGE ═══════════════════════════ */
.project-group { margin-top: 32px; margin-bottom: 4px; }
.project-group-title {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 0;
}
.project-entry { padding: 16px 0; border-bottom: 1px solid var(--border); }
.project-entry:last-child { border-bottom: none; }
.project-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.project-title { font-size: 0.88rem; font-weight: 700; color: var(--text); line-height: 1.35; }
.project-title a { color: var(--text); text-decoration: none; }
.project-title a:hover { color: var(--accent); text-decoration: none; }
.project-lang {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); background: var(--border); padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.lang-matlab { background: #f5c4a8; color: #7a3010; }
.lang-python  { background: #d4c4f0; color: #3d2080; }
.lang-r       { background: #b8d9f8; color: #0a4d8c; }
.lang-html    { background: #f5bfb0; color: #7a2010; }
.lang-css     { background: #a8e0d8; color: #0a4840; }
.lang-js      { background: #fdf0a0; color: #5a4800; }
.project-desc { font-size: 0.80rem; color: var(--muted); line-height: 1.65; text-align: justify; -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto; }

/* ══ RESOURCES PAGE ══════════════════════════ */
.resource-entry { padding: 14px 0; border-bottom: 1px solid var(--border); }
.resource-title { font-size: 0.86rem; font-weight: 600; line-height: 1.45; margin-bottom: 2px; }
.resource-title a { color: var(--text); text-decoration: none; }
.resource-title a:hover { color: var(--accent); text-decoration: none; }
.resource-meta {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px;
}
.resource-desc { font-size: 0.79rem; color: var(--muted); line-height: 1.65; }
.resource-subheading {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin: 16px 0 0;
}

/* ── GitHub contribution heatmap ── */
.gh-calendar-wrap { display: flex; align-items: flex-start; gap: 5px; }
.gh-dow-labels {
  display: grid; grid-template-rows: 16px repeat(7, var(--gh-cell, 10px));
  gap: 2px; flex-shrink: 0; padding-top: 1px;
}
.gh-dow-labels span {
  font-size: 0.58rem; color: var(--muted); line-height: var(--gh-cell, 10px);
  text-align: right; white-space: nowrap; font-weight: 400;
}
.gh-calendar-outer { flex: 1; min-width: 0; padding-bottom: 2px; }
.gh-calendar {
  display: grid; width: 100%; grid-template-rows: 16px repeat(7, var(--gh-cell, 10px));
  grid-auto-flow: column; grid-auto-columns: var(--gh-cell, 10px); gap: 2px; cursor: default;
}
.gh-month-label {
  font-size: 0.58rem; color: var(--muted); white-space: nowrap;
  line-height: 16px; font-weight: 400;
}
.gh-day { width: var(--gh-cell, 10px); height: var(--gh-cell, 10px); border-radius: 2px; background: var(--border); }
.gh-day[data-level="1"] { background: #c6e48b; }
.gh-day[data-level="2"] { background: #7bc96f; }
.gh-day[data-level="3"] { background: #239a3b; }
.gh-day[data-level="4"] { background: #196127; }
.gh-day-empty { visibility: hidden; }
.gh-meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.gh-total { font-size: 0.70rem; color: var(--muted); }
.gh-legend { display: flex; align-items: center; gap: 3px; }
.gh-legend-label { font-size: 0.58rem; color: var(--muted); margin-right: 2px; }
.gh-legend-cell { width: 10px; height: 10px; border-radius: 2px; background: var(--border); }
.gh-legend-cell[data-level="1"] { background: #c6e48b; }
.gh-legend-cell[data-level="2"] { background: #7bc96f; }
.gh-legend-cell[data-level="3"] { background: #239a3b; }
.gh-legend-cell[data-level="4"] { background: #196127; }
#gh-tooltip {
  position: fixed; background: var(--text); color: var(--bg);
  font-size: 0.65rem; font-family: inherit; padding: 4px 9px;
  border-radius: 3px; pointer-events: none; display: none; z-index: 1000; white-space: nowrap;
}

/* ══ HAMBURGER BUTTON ════════════════════════ */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
  opacity: 0.65;
  transition: opacity 0.15s;
  justify-self: end;
}
.nav-hamburger:hover { opacity: 1; }
.nav-hamburger svg { display: block; fill: currentColor; width: 20px; height: 20px; }

/* ══ RESPONSIVE ══════════════════════════════ */
@media (max-width: 780px) {
  .nav {
    padding: 0 14px;
    grid-template-columns: 1fr auto;
    grid-template-rows: var(--nav-h) auto;
    height: auto;
  }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    grid-column: 1 / 3;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 0 10px;
    border-top: 1px solid var(--border);
  }
  .nav.nav-open .nav-links { display: flex; }
  .nav-links li { display: block; }
  .nav-links a { font-size: 0.78rem; padding: 9px 10px; border-radius: 0; }
  .nav-icons { display: none; }
  .container { padding: 36px 20px; }
  .profile-block { flex-direction: column; align-items: flex-start; gap: 20px; }
  .profile-info h1 { font-size: 1.6rem; }
  .timeline { --date-w: 66px; }
  .tl-date { font-size: 0.58rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .award-entry { grid-template-columns: 56px 1fr; }
  .award-amt { display: none; }
  .section-nav { grid-template-columns: 1fr 1fr; }
  /* page-menu pills: flex-wrap handles layout naturally */
  /* member-entry: stack vertically */
  .member-entry { display: flex; flex-direction: column; gap: 1px; }
  /* profile icon links: allow wrapping */
  .profile-icon-links { flex-wrap: wrap; row-gap: 10px; }
  /* teaching table: enable horizontal scroll */
  .teaching-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* publication/presentation badges: stack below content on narrow screens */
  .pub-entry, .pres-entry { padding-right: 0; }
  .pub-summary { margin-right: 0; }
  .os-badges { position: static; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; margin-top: 6px; }
  /* body text: left-align avoids ugly word-spacing on narrow screens */
  .body-text, .pub-summary, .project-desc { text-align: left; }
}
@media (max-width: 520px) {
  .section-nav { grid-template-columns: 1fr; }
  /* hide timeline dots and vertical lines on mobile */
  .tl-line-col { display: none; }
  .tl-row { grid-template-columns: var(--date-w) 1fr; }
}

