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

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

:root {
  /* Yale official palette */
  --yale-blue:    #00356b;
  --yale-blue2:   #1a5494;
  --yale-blue3:   #286dc0;
  --yale-blue4:   #63aaff;
  --yale-gold:    #bd8b13;
  --yale-gold2:   #c8a951;
  --yale-gold3:   #f0d98c;
  --yale-gold-bg: #fdf8ec;

  --text:         #1a1a1a;
  --muted:        #5a5a6e;
  --border:       #dde1ea;
  --bg:           #ffffff;
  --bg-soft:      #f8f9fc;
  --radius:       6px;
  --max-w:        900px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--yale-blue3); text-decoration: none; }
a:hover { color: var(--yale-blue2); text-decoration: underline; }

/* ============================================================
   Navigation — blue bar with gold accent stripe
   ============================================================ */
nav {
  background: var(--yale-blue);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
  border-bottom: 3px solid var(--yale-gold);
}

nav .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.brand {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.brand:hover { text-decoration: none; color: var(--yale-gold3); }

.nav-shield {
  height: 32px;
  width: auto;
}

nav ul { list-style: none; display: flex; }

nav ul li a {
  color: rgba(255,255,255,0.78);
  padding: 0 0.9rem;
  line-height: 54px;
  display: block;
  font-size: 0.84rem;
  font-weight: 400;
  letter-spacing: 0.025em;
  text-decoration: none;
  transition: color 0.15s;
  position: relative;
}
nav ul li a::after {
  content: '';
  position: absolute;
  bottom: -3px; /* sits on the gold border */
  left: 0.9rem;
  right: 0.9rem;
  height: 3px;
  background: var(--yale-gold);
  opacity: 0;
  transition: opacity 0.15s;
}
nav ul li a:hover { color: #fff; text-decoration: none; }
nav ul li a.active { color: #fff; }
nav ul li a.active::after { opacity: 1; }

/* ============================================================
   Hero banner strip
   ============================================================ */
.hero-banner {
  background: linear-gradient(135deg, var(--yale-blue) 0%, var(--yale-blue2) 100%);
  border-bottom: 4px solid var(--yale-gold);
  padding: 3rem 2rem 3.5rem;
}

.hero-banner .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-photo img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  object-position: top;
  border-radius: 50%;
  border: 4px solid var(--yale-gold);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: block;
}

.hero-photo .photo-placeholder {
  width: 190px;
  height: 230px;
  border-radius: var(--radius);
  border: 3px solid var(--yale-gold);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  font-size: 0.8rem;
}

.hero-text h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.hero-text .subtitle {
  font-size: 0.88rem;
  color: var(--yale-gold2);
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-text p {
  font-size: 0.94rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 0.8rem;
  line-height: 1.8;
}

.hero-text strong { color: #fff; font-weight: 600; }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1.15rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.03em;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1;
}

.btn-gold {
  background: var(--yale-gold);
  color: #fff;
  border: 1.5px solid var(--yale-gold);
}
.btn-gold:hover {
  background: #a57610;
  border-color: #a57610;
  color: #fff;
  text-decoration: none;
}

.btn-outline-white {
  background: transparent;
  color: rgba(255,255,255,0.88);
  border: 1.5px solid rgba(255,255,255,0.4);
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.7);
  color: #fff;
  text-decoration: none;
}

/* On white background */
.btn-primary {
  background: var(--yale-blue);
  color: #fff;
  border: 1.5px solid var(--yale-blue);
}
.btn-primary:hover {
  background: var(--yale-blue2);
  border-color: var(--yale-blue2);
  color: #fff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--yale-blue);
  border: 1.5px solid var(--yale-blue2);
}
.btn-outline:hover {
  background: var(--bg-soft);
  color: var(--yale-blue);
  text-decoration: none;
}

/* ============================================================
   Page wrapper (for pages without hero banner)
   ============================================================ */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}

/* Home page body content (below banner) */
.home-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

/* ============================================================
   Section headings — gold underline accent
   ============================================================ */
h2.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
h2.section-title::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--yale-gold);
  flex-shrink: 0;
}
h2.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   Research — Paper cards
   ============================================================ */
.paper-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }

.paper-card {
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--bg);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.paper-card:hover {
  border-left-color: var(--yale-gold);
  box-shadow: 0 3px 14px rgba(0,53,107,0.09);
}

.paper-card .paper-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 0.3rem;
}

.paper-card .paper-authors {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.71rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--yale-gold-bg);
  color: var(--yale-gold);
  border: 1px solid var(--yale-gold3);
}

/* ============================================================
   Teaching / Entry list
   ============================================================ */
.entry-list { list-style: none; }

.entry-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.entry-list li:first-child { border-top: 1px solid var(--border); }

.entry-title { font-size: 0.95rem; font-weight: 500; display: block; margin-bottom: 0.1rem; }
.entry-sub   { font-size: 0.83rem; color: var(--muted); }
.entry-meta  { font-size: 0.82rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ============================================================
   CV page
   ============================================================ */
.cv-actions { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }

.cv-embed {
  width: 100%;
  height: 82vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ============================================================
   Code / Repo grid
   ============================================================ */
.repos-intro { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }

.repo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.repo-card {
  border: 1px solid var(--border);
  border-top: 3px solid var(--yale-blue);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  background: var(--bg);
  text-decoration: none;
  transition: box-shadow 0.15s, border-top-color 0.15s;
  display: block;
}
.repo-card:hover {
  border-top-color: var(--yale-gold);
  box-shadow: 0 3px 14px rgba(0,53,107,0.09);
  text-decoration: none;
}
.repo-card h3 { font-size: 0.9rem; font-weight: 600; color: var(--yale-blue3); margin-bottom: 0.3rem; }
.repo-card p  { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

/* ============================================================
   Footer
   ============================================================ */
footer {
  background: var(--yale-blue);
  border-top: 3px solid var(--yale-gold);
  text-align: center;
  padding: 1.6rem 2rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
}
footer a { color: var(--yale-gold2); }
footer a:hover { color: var(--yale-gold3); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .hero-banner .inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
  .hero-photo { display: flex; justify-content: center; }
  .hero-photo img {
    width: 160px;
    height: 160px;
  }
  .hero-photo .photo-placeholder { width: 160px; height: 160px; border-radius: 50%; }
  .btn-group { justify-content: center; flex-wrap: wrap; }
  nav .inner { overflow-x: auto; }
  nav ul { flex-wrap: nowrap; gap: 0; }
  nav ul li a { padding: 0 0.4rem; font-size: 0.72rem; white-space: nowrap; }
  nav .brand span { display: none; }
  .repo-grid { grid-template-columns: 1fr; }
  .entry-list li { grid-template-columns: 1fr; gap: 0.1rem; }
  main { padding: 2rem 1.2rem 4rem; }
  .home-content { padding: 2rem 1.2rem 4rem; }
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--yale-blue);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--yale-blue3); }
