/* ============================================================
   Shruti Agarwal — Academic Profile
   ============================================================ */

/* ── CUSTOM PROPERTIES ───────────────────────────────────── */
:root {
  --bg:           #f8f7f4;
  --surface:      #ffffff;
  --border:       #e3e2dc;
  --text-1:       #18171a;
  --text-2:       #4a4852;
  --text-3:       #8e8c96;
  --accent:       #1c48c4;
  --accent-hover: #1637a0;
  --accent-bg:    #eef2fc;
  --nav-h:        58px;
  --sidebar-w:    252px;
  --max-w:        1040px;
  --r:            5px;
  --font:         'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont,
                  'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.layout,
.research-layout,
.index-wrap {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}

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

/* ── NAVIGATION ──────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(248, 247, 244, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

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

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

.nav-links {
  list-style: none;
  display: flex;
  gap: 30px;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: none;
}

/* ── PAGE LAYOUT (two-column) ────────────────────────────── */
.layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 40px 100px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 60px;
  align-items: start;
}

/* ── INDEX PAGE WRAPPER ──────────────────────────────────── */
.index-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 40px;
  flex: 1 0 auto;
}

/* ── INDEX PAGE: top panel (sidebar + bio) ───────────────── */
.top-panel {
  padding: 56px 0 40px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 60px;
  align-items: start;
}

/* ── INDEX PAGE: papers full-width panel ─────────────────── */
.papers-panel {
  padding: 40px 0 100px;
  border-top: 1px solid var(--border);
}

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

.sidebar-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: top;
  border-radius: var(--r);
  background: #e5e7eb;
  margin-bottom: 0;
}

/* on the index page, photo column is photo-only — stretch to fill row height */
.top-panel {
  align-items: stretch;
}
.top-panel .sidebar {
  position: static;
  display: flex;
  flex-direction: column;
}
.top-panel .sidebar-photo {
  width: 100%;
  flex: 1;
  object-fit: cover;
  object-position: top center;
  min-height: 0;
}

.sidebar-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.2;
  margin-bottom: 14px;
}

.sidebar-affil {
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.9;
  margin-bottom: 18px;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 18px;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.4;
}
.sidebar-link svg { flex-shrink: 0; color: var(--text-3); }
.sidebar-link:hover { text-decoration: underline; color: var(--accent-hover); }

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

/* ── SECTION ─────────────────────────────────────────────── */
.section {
  margin-bottom: 52px;
}
.section:last-child { margin-bottom: 0; }

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── BIO ─────────────────────────────────────────────────── */
.bio-text p {
  font-size: 0.975rem;
  line-height: 1.75;
  color: var(--text-1);
  margin-bottom: 15px;
}
.bio-text p:last-child { margin-bottom: 0; }
.bio-text strong { font-weight: 600; color: var(--text-1); }
.bio-text a { color: var(--accent); }
.bio-text a:hover { color: var(--accent-hover); }

/* ── FIELDS TAGS ─────────────────────────────────────────── */
.fields-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-tag {
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.79rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 100px;
  letter-spacing: 0.01em;
}

/* ── PAPER LIST (index.html) ─────────────────────────────── */
.papers-list {
  display: flex;
  flex-direction: column;
}

.paper-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.papers-list .paper-item:first-child { border-top: 1px solid var(--border); }

.paper-item-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.45;
  margin-bottom: 5px;
}
.paper-item-title a {
  color: var(--text-1);
  font-weight: 500;
}
.paper-item-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.paper-item-meta {
  font-size: 0.81rem;
  color: var(--text-3);
  line-height: 1.5;
}
.paper-item-meta a { color: var(--text-3); }
.paper-item-meta a:hover { color: var(--accent); text-decoration: underline; }

.paper-item-venues {
  margin-top: 5px;
  font-size: 0.79rem;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── RESEARCH PAGE LAYOUT ────────────────────────────────── */
.research-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 40px 100px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 60px;
  align-items: start;
}

.research-main {
  min-width: 0;
}

.page-header {
  margin-bottom: 36px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-3);
}

/* ── PAPER CARDS (research.html) ─────────────────────────── */
.paper-card {
  border-bottom: 1px solid var(--border);
  width: 100%;
}
.paper-cards > .paper-card:first-child {
  border-top: none;
}

.paper-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 0;
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  user-select: none;
}
.paper-card > summary::-webkit-details-marker { display: none; }

.paper-card-header { flex: 1; min-width: 0; }

.paper-card-title {
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.48;
  margin-bottom: 6px;
  transition: color 0.15s;
}
.paper-card > summary:hover .paper-card-title { color: var(--accent); }

.paper-card-coauthors {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.4;
}
.paper-card-coauthors a { color: var(--text-3); }
.paper-card-coauthors a:hover { color: var(--accent); text-decoration: underline; }

.paper-toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-3);
  margin-top: 3px;
  transition: transform 0.2s ease, color 0.15s;
}
.paper-card[open] .paper-toggle {
  transform: rotate(45deg);
  color: var(--accent);
}

/* Paper body */
.paper-body {
  padding-top: 20px;
  padding-bottom: 28px;
  display: grid;
  grid-template-columns: 44% 1fr;
  gap: 36px;
  align-items: start;
}

/* figure is second in HTML but visually first (left) */
.paper-body > div { order: 2; }
.paper-body .paper-figure { order: 1; }

/* papers with no figure: single column */
.paper-body.no-figure {
  grid-template-columns: 1fr;
}
.paper-body.no-figure > div { order: 0; }

.paper-abstract {
  font-size: 0.88rem;
  line-height: 1.78;
  color: var(--text-2);
  font-weight: 300;
}

.paper-presentations {
  margin-top: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  font-size: 0.79rem;
  color: var(--text-3);
  line-height: 1.55;
}

.paper-figure img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: block;
  cursor: zoom-in;
}
.paper-figure-caption {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 22px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ── LIGHTBOX ────────────────────────────────────────────── */
.paper-figure img {
  cursor: zoom-in;
}

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.lightbox-overlay.open {
  display: flex;
}
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}
.lightbox-close:hover { opacity: 1; }

/* ── PHOTO TREATMENT ────────────────────────────────────── */
.sidebar-photo {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10), 0 0 0 1px var(--border);
}

/* ── PAPER ROW HOVER ─────────────────────────────────────── */
.paper-card > summary {
  border-radius: 4px;
  margin: 0 -10px;
  padding-left: 10px;
  padding-right: 10px;
  transition: background 0.15s;
}
.paper-card > summary:hover {
  background: var(--accent-bg);
}

/* ── SMOOTH ABSTRACT ANIMATION ───────────────────────────── */
.paper-body {
  overflow: hidden;
  animation: expand 0.22s ease;
}

@keyframes expand {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 800px) {
  .layout,
  .research-layout {
    grid-template-columns: 1fr;
    padding: 36px 20px 72px;
    gap: 36px;
  }

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

  .sidebar-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: 0;
  }

  .paper-body {
    grid-template-columns: 1fr;
  }
  .paper-figure { display: none; }

  .nav-inner { padding: 0 20px; }
  .footer-inner { padding: 18px 20px; flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  .sidebar { grid-template-columns: 1fr; }
  .sidebar-photo { max-width: 180px; }
  .nav-links { gap: 18px; }
}
