/* ============================================================
   Lavi K. Upreti — Academic Website
   Clean academic style inspired by P. Lenggenhager's site
   ============================================================ */

:root {
  --bg:         #ffffff;
  --bg-alt:     #f8f9fa;
  --text:       #212529;
  --text-muted: #6c757d;
  --link:       #2563a8;
  --link-hover: #1a4a80;
  --accent:     #2563a8;
  --border:     #dee2e6;
  --border-light:#e9ecef;
  --shadow:     0 1px 3px rgba(0,0,0,0.08);

  --font-sans:  'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --max-w:      960px;
  --sidebar-w:  220px;
  --gap:        2.5rem;
  --nav-h:      56px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ── Header / Navigation ───────────────────────────────────── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.site-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.7rem 0 0.1rem;
  letter-spacing: -0.01em;
}
.site-name:hover { text-decoration: none; color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}
.nav-links li a {
  display: block;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.nav-links li a:hover {
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
}
.nav-links li a.active {
  background: var(--accent);
  color: #fff;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 26px; height: 20px; position: relative;
}
.nav-toggle span {
  display: block; width: 100%; height: 2px;
  background: var(--text); position: absolute; left: 0;
  transition: .25s;
}
.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 9px; }
.nav-toggle span:nth-child(3) { top: 18px; }
.nav-toggle.active span:nth-child(1) { top: 9px; transform: rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { top: 9px; transform: rotate(-45deg); }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-body { padding: 2rem 0 3rem; }

.two-col {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: var(--gap);
  align-items: start;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--nav-h) + 24px); }

.photo-wrap {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  background: var(--bg-alt);
}
.photo-wrap img { width: 100%; display: block; }
.photo-placeholder {
  width: 100%; aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 0.4rem;
}
.photo-placeholder svg { width: 54px; height: 54px; }
.photo-placeholder span { font-size: 0.78rem; font-style: italic; }

.sidebar h5 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}

.quick-links { list-style: none; }
.quick-links li { margin-bottom: 0.35rem; }
.quick-links a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.88rem; color: var(--link);
  transition: color .15s;
}
.quick-links a:hover { color: var(--link-hover); text-decoration: none; }
.quick-links .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Recent paper card ─────────────────────────────────────── */
.recent-paper {
  margin-top: 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.85rem;
  transition: box-shadow .2s;
}
.recent-paper:hover { box-shadow: var(--shadow); }
.recent-paper .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-style: italic;
}
.recent-paper .rp-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-top: 0.25rem;
}
.recent-paper a { color: inherit; }
.recent-paper a:hover { color: var(--accent); text-decoration: none; }

/* ── Main content ──────────────────────────────────────────── */
.main-col h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--accent);
}

.main-col h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.main-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.main-col p {
  margin-bottom: 0.85rem;
  font-size: 0.94rem;
  color: #343a40;
}

.main-col section + section {
  margin-top: 2rem;
}

/* ── CV Timeline ───────────────────────────────────────────── */
.cv-list { list-style: none; }
.cv-list li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
}
.cv-list li:last-child { border-bottom: none; }
.cv-dates {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  font-size: 0.88rem;
  padding-top: 0.06rem;
}
.cv-desc { color: #495057; }
.cv-desc strong { color: var(--text); }

/* ── Awards / lists ────────────────────────────────────────── */
.diamond-list { list-style: none; }
.diamond-list li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  color: #495057;
}
.diamond-list li::before {
  content: '◆';
  position: absolute; left: 0; top: 0;
  color: var(--accent);
  font-size: 0.45rem;
  line-height: 1.7rem;
}

/* ── Supervision list ──────────────────────────────────────── */
.supervision-list { list-style: none; }
.supervision-list li {
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  color: #495057;
}
.supervision-list li strong { color: var(--text); }

/* teaching list */
.teaching-list {
  font-size: 0.92rem;
  color: #495057;
  line-height: 1.8;
}

/* ── Publications page ─────────────────────────────────────── */
.pub-list { list-style: none; }
.pub-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border-light);
}
.pub-item:last-child { border-bottom: none; }
.pub-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.45;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.15rem 0;
}
.pub-authors .me { font-weight: 700; color: var(--text); }
.pub-journal {
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
}
.pub-note {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-left: 0.35rem;
}
.pub-note.corresponding { background: #e8f4fd; color: #1a6fb5; }
.pub-note.first-author  { background: #e8f8e8; color: #2d7a2d; }

/* ── Research page ─────────────────────────────────────────── */
.research-block {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
}
.research-block:last-of-type { border-bottom: none; }
.research-block h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.research-block p {
  font-size: 0.93rem;
  color: #495057;
  margin-bottom: 0.6rem;
}

/* ── Contact page ──────────────────────────────────────────── */
.contact-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 1.5rem;
  max-width: 520px;
}
.contact-card h4 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0 0 1rem;
}
.contact-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
}
.contact-label { font-weight: 600; color: var(--text); }
.contact-val { color: #495057; }

.contact-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.contact-btn:hover { background: var(--link-hover); color: #fff; text-decoration: none; }

/* ── Talks page ────────────────────────────────────────────── */
.talk-list { list-style: none; }
.talk-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
}
.talk-item:last-child { border-bottom: none; }
.talk-title { font-weight: 700; color: var(--text); }
.talk-venue { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.1rem; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2rem;
}

/* ── Single column pages ───────────────────────────────────── */
.single-col { max-width: 720px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }

  .two-col { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.25rem;
    align-items: start;
  }

  .cv-list li { grid-template-columns: 1fr; gap: 0.15rem; }

  .contact-row { grid-template-columns: 1fr; gap: 0.1rem; }
}

@media (max-width: 480px) {
  .sidebar { grid-template-columns: 1fr; }
  .photo-wrap { max-width: 160px; margin: 0 auto 0.75rem; }
}
