/* ─────────────────────────────────────────
   RESET & CUSTOM PROPERTIES
───────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-w: 200px; /* left sidebar */
  --right-w: calc(
    100vw - var(--sidebar-w) - 100vh
  ); /* right sidebar width = makes main panel a square */

  --bg: #ffffff;
  --text: #111111;
  --muted: #aaaaaa;

  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  /* NO overflow:hidden — window scroll drives scenes */
}

img {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ─────────────────────────────────────────
   LAYOUT — LEFT SIDEBAR (fixed)
───────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 48px 36px;
  z-index: 20;
  background: var(--bg);
}

/* ─── University affiliations + social — pushed to bottom of sidebar ─── */
.sidebar-edu {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edu-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.edu-badge {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5.5px;
  font-family: var(--font-sans);
  letter-spacing: 0.08em;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

/* Swap .edu-badge for this when you have actual logo images */
.edu-logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.edu-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.edu-school {
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.edu-role {
  font-size: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 300;
}

/* ─── Social icons (below school section) ─── */
.sidebar-social {
  margin-top: 18px;
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: center;
}

.social-link {
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.social-link:hover {
  opacity: 1;
}

/* ─────────────────────────────────────────
   LAYOUT — MAIN PANEL (fixed, between sidebars)
───────────────────────────────────────── */
.main-panel {
  position: fixed;
  left: var(--sidebar-w);
  right: var(--right-w);
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 10;
  /* right is driven by JS on scroll — no CSS transition */
}

/* ─────────────────────────────────────────
   HERO CANVAS
───────────────────────────────────────── */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ─────────────────────────────────────────
   SCROLL SPACE — invisible, creates window scroll height
───────────────────────────────────────── */
#scroll-space {
  /* height set by JS: SCENE_COUNT × 100vh */
  pointer-events: none;
  visibility: hidden;
}

/* ─────────────────────────────────────────
   SIDEBAR — NAVIGATION
───────────────────────────────────────── */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.nav-link:hover {
  opacity: 0.4;
}
.nav-link.active {
  pointer-events: none;
}
.nav-link.active .nav-label {
  font-weight: 500;
}

.nav-num {
  font-family: var(--font-serif);
  font-size: 0.625rem;
  color: var(--muted);
  min-width: 14px;
  letter-spacing: 0.02em;
}

.nav-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 300;
  transition: font-weight 0.15s;
}

/* ─────────────────────────────────────────
   SIDEBAR — BIO anchor (invisible, used by script.js for preview height)
───────────────────────────────────────── */
.sidebar-bio {
  height: 0;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   HERO — Identity block (photo + name + bio)
   Sits behind the canvas; canvas is transparent except during comet animation.
───────────────────────────────────────── */
.hero-identity {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  pointer-events: none;
  user-select: none;
}

.hero-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 32px;
}

.hero-avatar {
  width: 87px;
  height: 87px;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}

.hero-text {
  display: flex;
  flex-direction: column;
}

.hero-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(32px, 6vh, 60px);
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
}

/* Bio text left-aligned with the photo (no indent) */
.hero-bio-text {
  font-size: 0.7rem;
  line-height: 1.9;
  color: var(--muted);
  font-weight: 300;
  font-family: var(--font-sans);
}

/* ─────────────────────────────────────────
   SCENES — stacked, driven by window.scrollY
───────────────────────────────────────── */
.scene {
  position: absolute;
  inset: 0; /* width: 100%; height: 100%; top: 0; left: 0 */
  display: flex;
  align-items: flex-start;
  will-change: transform;
}

/* Inner content wrapper */
.scene-inner {
  width: 100%;
  padding: 12vh 72px 0;
}

/* Scene header */
.scene-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 44px;
}

.scene-num {
  font-family: var(--font-serif);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.scene-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────
   PROJECT ROWS (horizontal scroll)
───────────────────────────────────────── */
.project-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding-right: 450px;
}

/* Card */
.project-item {
  flex-shrink: 0;
  cursor: pointer;
}

.project-item img {
  width: 100%;
  aspect-ratio: 240 / 170;
  height: auto;
  object-fit: cover;
  display: block;
}

.project-item figcaption {
  margin-top: 10px;
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  line-height: 1.65;
}

/* Placeholder */
.placeholder-block {
  width: 100%;
  aspect-ratio: 240 / 170;
  background: #f0f0f0;
}
.project-placeholder {
  cursor: pointer;
}

/* ─────────────────────────────────────────
   RESEARCH SCENE — Academic paper list
───────────────────────────────────────── */
.paper-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.paper-list::-webkit-scrollbar {
  width: 3px;
}
.paper-list::-webkit-scrollbar-thumb {
  background: #ddd;
}

.paper-item {
  display: grid;
  grid-template-columns: 175px 1fr;
  gap: 0 20px;
  align-items: start;
  padding: 18px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.paper-item:last-child {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.paper-thumb-empty {
  width: 175px;
  height: 130px;
  background: #f2f2f2;
  flex-shrink: 0;
}

.paper-thumb-link {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  transition: opacity 0.2s;
}
.paper-thumb-link:hover {
  opacity: 0.75;
}

.paper-thumb {
  width: 175px;
  height: 130px;
  object-fit: cover;
  display: block;
}

.paper-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.paper-title {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.3;
  max-width: 60%;
}

.paper-title a {
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}
.paper-title a:hover {
  opacity: 0.5;
}

.paper-authors {
  font-size: 0.5625rem;
  color: var(--muted);
  line-height: 1.7;
  font-weight: 300;
}
.paper-authors strong {
  color: var(--text);
  font-weight: 500;
}

.paper-venue {
  font-size: 0.5625rem;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-serif);
}

.paper-abstract {
  font-size: 0.5625rem;
  color: var(--text);
  line-height: 1.85;
  font-weight: 300;
  margin-top: 2px;
  max-width: 60%;
}

.paper-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.paper-link {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  color: var(--muted);
  text-decoration: none;
  transition: opacity 0.2s;
}
.paper-link:hover {
  opacity: 0.5;
}

/* ─────────────────────────────────────────
   CONTACT SCENE
───────────────────────────────────────── */
.contact-body {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 2.2;
}

/* ─────────────────────────────────────────
   FULLSCREEN OVERLAY
   pointer-events: none — hover pass-through
───────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none; /* always; overlay is purely visual */
  transition: opacity 0.28s var(--ease);
}

.overlay.visible {
  opacity: 1;
}

#overlay-img {
  max-width: calc(100vw - var(--sidebar-w) - 80px);
  max-height: calc(100vh - 80px);
  object-fit: contain;
}

.overlay-title {
  position: absolute;
  bottom: 36px;
  left: calc(var(--sidebar-w) + 56px);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ─────────────────────────────────────────
   RIGHT SIDEBAR — Recent Projects
   Populated dynamically from projects.js
───────────────────────────────────────── */
.right-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: var(--right-w);
  height: 100vh;
  padding: 12.5vh 28px 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* transform and visibility driven by JS on scroll */
}

/* "RECENT" label */
.rs-label {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding: 0; /* sidebar padding handles indentation */
  margin-bottom: 16px;
  flex-shrink: 0;
}

/* Project list — fills remaining sidebar height, 6 items share it equally */
.rs-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Each card: image left, text right — horizontal layout, fills sidebar height equally */
.rs-item {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 12px 0;
  overflow: hidden;
  text-decoration: none;
}
.rs-item:first-child {
  border-top: none;
  padding-top: 0;
}
.rs-item:hover {
  opacity: 0.5;
}

/* Thumbnail — fixed width, height fills the item automatically */
.rs-thumb {
  width: 188px; /* ← adjust width here */
  flex-shrink: 0;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--ease);
}
.rs-item:hover .rs-thumb {
  transform: scale(1.06);
}

/* No-preview placeholder */
.rs-thumb-empty {
  width: 88px; /* ← keep in sync with .rs-thumb width */
  flex-shrink: 0;
  background: #f0f0f0;
}

/* Text area to the right of the image */
.rs-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.rs-title {
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rs-meta {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.rs-desc {
  font-size: 0.5625rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   RIGHT SIDEBAR — Hover preview
   Covers the left area: left/top/right edges flush,
   bottom stops at sidebar-bio top (set by JS).
   right tracks --right-w so it adapts if sidebar width changes.
───────────────────────────────────────── */
.rs-preview {
  position: fixed;
  top: 0;
  left: 35px;
  right: var(--right-w); /* flush with right sidebar left edge */
  /* height set by JS = sidebar-bio.getBoundingClientRect().top - 24 */
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
  z-index: 25; /* above sidebars (20), below overlay (100) */
}

.rs-preview.visible {
  opacity: 1;
}

#rs-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
