/* =====================================================================
   Academic Personal Website — Motion Minimal
   Monochrome ink on off-white, single blue accent.
   Space Grotesk (display) + Archivo (body).
   ===================================================================== */

:root {
  --bg:        #FAFAFA;
  --surface:   #FFFFFF;
  --ink:       #09090B;
  --secondary: #3F3F46;
  --muted:     #E8ECF0;
  --muted-2:   #71717A;
  --border:    #E4E4E7;
  --accent:    #2563EB;
  --accent-ink:#1D4ED8;
  --danger:    #DC2626;

  --display: "Space Grotesk", system-ui, sans-serif;
  --body:    "Archivo", system-ui, sans-serif;

  --radius:   14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(9,9,11,.04), 0 1px 1px rgba(9,9,11,.03);
  --shadow:    0 6px 24px rgba(9,9,11,.06), 0 2px 6px rgba(9,9,11,.04);
  --shadow-lg: 0 18px 50px rgba(9,9,11,.10);

  --ease: cubic-bezier(.2,.7,.2,1);
  --maxw: 1120px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--accent-ink); }

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

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,250,250,.82);
  backdrop-filter: saturate(150%) blur(10px);
  /* faint divider separating the header from the page body */
  border-bottom: 1px solid rgba(9,9,11,.06);
}
.nav {
  max-width: var(--maxw); margin-inline: auto;
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-brand {
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
  color: var(--ink); letter-spacing: -0.02em;
}
.nav-brand:hover { color: var(--ink); }
.nav-menu {
  list-style: none; display: flex; gap: 24px; margin: 0; padding: 0;
}
.nav-menu a {
  position: relative; display: block; padding: 6px 2px;
  color: var(--secondary); font-weight: 500; font-size: .95rem; letter-spacing: .01em;
  font-family: var(--display);
  transition: color .2s var(--ease);
}
/* Draw-in underline on hover; persistent for the active page. */
.nav-menu a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav-menu a:hover { color: var(--ink); }
.nav-menu a:hover::after { transform: scaleX(1); }
.nav-menu a.is-active { color: var(--ink); }
.nav-menu a.is-active::after { transform: scaleX(1); }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; transition: .25s var(--ease); }

/* ---------- Hero (home) ---------- */
.hero { padding: 56px 0 40px; }
.hero-grid {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 40px;
  align-items: start;
}
/* When there is no news box, drop the third column. */
.hero-grid.no-news { grid-template-columns: 220px 1fr; }
.hero-photo {
  width: 200px; height: 200px; border-radius: 50%;
  /* "contain" shows the whole head (no cropping); white circle blends with
     studio-style white-background headshots. */
  object-fit: contain; object-position: center;
  background: #FFFFFF;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero-photo-fallback {
  width: 200px; height: 200px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--muted), #fff);
  border: 1px solid var(--border); color: var(--muted-2);
  font-family: var(--display); font-size: 3rem; font-weight: 600;
}
.hero-id h1 { font-size: clamp(2rem, 4vw, 2.9rem); }
.hero-title { font-family: var(--display); font-weight: 600; color: var(--ink); margin-top: 10px; font-size: 1.1rem; }
.hero-affil { color: var(--secondary); margin-top: 6px; line-height: 1.5; }
.hero-affil a { font-weight: 500; }
.hero-contact { margin-top: 18px; display: grid; gap: 4px; font-size: .96rem; color: var(--secondary); }
.hero-contact .label { font-family: var(--display); font-weight: 600; color: var(--ink); margin-right: 6px; }

.hero-social { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.social-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 500; font-size: .95rem;
  color: var(--secondary); padding: 7px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.social-link:hover { transform: translateY(-2px); }
.social-link.is-linkedin:hover { color: #0A66C2; border-color: #0A66C2; }
.social-link.is-scholar:hover { color: #4285F4; border-color: #4285F4; }
.social-link svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Rich content (admin-authored HTML from the editor) ---------- */
.rich-content { color: var(--secondary); }
.rich-content p { margin: 0 0 1em; }
.rich-content p:last-child { margin-bottom: 0; }
/* Animated draw-in underline for inline text links */
.rich-content a, .hero-affil a, .hero-contact a {
  color: var(--accent); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size .3s var(--ease), color .2s var(--ease);
}
.rich-content a:hover, .hero-affil a:hover, .hero-contact a:hover { background-size: 100% 1.5px; }
.rich-content ul, .rich-content ol { padding-left: 1.5em; margin: 0 0 1em; }
.rich-content li { margin-bottom: 4px; }
.rich-content strong { color: var(--ink); }
/* Quill alignment classes */
.rich-content .ql-align-center { text-align: center; }
.rich-content .ql-align-right { text-align: right; }
.rich-content .ql-align-justify { text-align: justify; }
/* Quill font + size classes (shared whitelist with the editor) */
.ql-font-sans  { font-family: "Archivo", system-ui, sans-serif; }
.ql-font-serif { font-family: Georgia, "Times New Roman", serif; }
.ql-font-mono  { font-family: ui-monospace, Menlo, Consolas, monospace; }
.ql-size-small { font-size: 0.82em; }
.ql-size-large { font-size: 1.5em; }
.ql-size-huge  { font-size: 2.2em; }

/* News rail */
.news-rail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; align-self: stretch;
}
.news-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.news-head h2 { font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.news-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(37,99,235,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(37,99,235,.5);} 70%{box-shadow:0 0 0 9px rgba(37,99,235,0);} 100%{box-shadow:0 0 0 0 rgba(37,99,235,0);} }
.news-viewport { position: relative; height: 210px; overflow: hidden; }
/* Continuous, constant-speed vertical ticker. The track holds the items twice
   (JS clones them) and scrolls up by exactly one block (-50%) on a linear loop,
   so it reads as a seamless news-style marquee. */
.news-track { display: flex; flex-direction: column; will-change: transform; }
@keyframes news-scroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.news-track.is-scrolling { animation: news-scroll var(--news-duration, 24s) linear infinite; }
.news-rail:hover .news-track.is-scrolling,
.news-rail:focus-within .news-track.is-scrolling { animation-play-state: paused; }
.news-item {
  padding: 16px 18px; display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.news-date { font-family: var(--display); font-weight: 600; font-size: .82rem; color: var(--accent); letter-spacing: .02em; }
.news-body { margin-top: 8px; color: var(--secondary); font-size: .98rem; }
.news-body a { font-weight: 500; }
/* Publication mode: bigger year chip + prominent title */
.news-item--pub .news-date {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(37,99,235,.08); color: var(--accent-ink); font-size: .8rem;
}
.news-item--pub .news-body {
  margin-top: 12px; color: var(--ink); font-family: var(--display);
  font-weight: 600; font-size: 1.05rem; line-height: 1.4;
}
.news-dots { display: flex; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--border); }
.news-dot { width: 7px; height: 7px; border-radius: 50%; border: 0; padding: 0; background: var(--border); cursor: pointer; transition: .2s var(--ease); }
.news-dot.is-current { background: var(--accent); transform: scale(1.3); }
.news-empty { padding: 28px 18px; color: var(--muted-2); }

/* ---------- Sections ---------- */
.section { padding: 30px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-label {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .14em;
  font-size: .76rem; font-weight: 600; color: var(--accent); margin-bottom: 14px;
}
.section h2.section-title { font-size: 1.7rem; margin-bottom: 18px; }
.prose { max-width: 750px; line-height: 1.7; color: var(--secondary); }
.prose p { margin: 0 0 1em; }

/* Education list */
.edu-list { display: grid; gap: 2px; max-width: 760px; }
.edu-row {
  display: grid; grid-template-columns: 120px 1fr; gap: 18px;
  padding: 16px 0; border-bottom: 1px solid var(--border); align-items: baseline;
}
.edu-row:last-child { border-bottom: 0; }
.edu-period { font-family: var(--display); font-weight: 600; color: var(--muted-2); font-size: .92rem; }
.edu-degree { font-family: var(--display); font-weight: 600; color: var(--ink); }
.edu-inst { color: var(--secondary); }
.edu-field { color: var(--muted-2); font-size: .95rem; }

/* Research interests — chips at the end of the biography section */
.interest-block { margin-top: 40px; }
.interest-title { margin-bottom: 18px; }
.interest-list { display: flex; flex-wrap: wrap; gap: 10px; }
.interest-chip {
  padding: 7px 15px; border: 1px solid rgba(37,99,235,.16); border-radius: 999px;
  background: rgba(37,99,235,.06); font-family: var(--display); font-weight: 500; font-size: .92rem;
  color: var(--accent-ink); transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.interest-chip:hover { transform: translateY(-2px); border-color: var(--accent); background: rgba(37,99,235,.12); }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: 56px 0 8px; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.page-head p { color: var(--secondary); margin-top: 10px; max-width: 60ch; }

/* ---------- Teaching ---------- */
.offering {
  margin-top: 26px; padding: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: box-shadow .3s var(--ease);
}
.offering:hover { box-shadow: var(--shadow); }
.offering-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--bg));
}
.offering-term {
  font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink);
  display: inline-flex; align-items: center; gap: 10px;
}
.offering-term .term-badge {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}
.term-badge.term-fall { background: #B45309; }
.term-badge.term-spring { background: #047857; }
.offering-univ { color: var(--muted-2); font-weight: 500; margin-left: auto; }
.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; padding: 22px 24px;
}
.course-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); background: #fff; }
.course-thumb {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); background: var(--muted); flex: 0 0 auto;
}
.course-thumb-fallback {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--muted); color: var(--muted-2);
  font-family: var(--display); font-weight: 700;
}
.course-title { font-family: var(--display); font-weight: 600; font-size: 1rem; }

/* ---------- Publications ---------- */
.pub-year-group { border-top: 1px solid var(--border); padding: 22px 0; }
.pub-year {
  font-family: var(--display); font-weight: 700; font-size: 2.4rem; color: var(--ink);
  letter-spacing: -0.02em; margin-bottom: 12px;
  display: inline-flex; align-items: center; gap: 12px;
}
.pub-year::after { content: ""; height: 3px; width: 48px; background: var(--accent); border-radius: 2px; }
.pub-list { display: grid; gap: 8px; }
.pub-item {
  display: block; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  position: relative; overflow: hidden;
}
.pub-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .3s var(--ease);
}
.pub-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pub-item:hover::before { transform: scaleY(1); }
.pub-title { font-family: var(--display); font-weight: 600; font-size: 1.12rem; color: var(--ink); }
.pub-authors { color: var(--secondary); margin-top: 6px; font-size: .98rem; }
.pub-venue { color: var(--accent); margin-top: 4px; font-size: .94rem; font-style: italic; }
.pub-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  font-family: var(--display); font-weight: 600; font-size: .88rem; color: var(--accent);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.pub-link:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.pub-link svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- Research ---------- */
.research-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.research-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.research-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-weight: 600; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-ongoing { background: rgba(37,99,235,.1); color: var(--accent-ink); }
.status-ongoing::before { background: var(--accent); animation: pulse 2.4s infinite; }
.status-completed { background: var(--muted); color: var(--secondary); }
.status-completed::before { background: var(--muted-2); }
.research-title { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 14px 0 10px; }
.research-meta { color: var(--secondary); font-size: .96rem; }
.research-meta .label { font-family: var(--display); font-weight: 600; color: var(--ink); }
.research-pubs { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.research-pubs h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 8px; }
.research-pubs ul { margin: 0; padding-left: 18px; color: var(--secondary); font-size: .94rem; }
.research-pubs li { margin-bottom: 6px; }

/* ---------- Empty states ---------- */
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted-2); }
.empty-state h3 { font-size: 1.2rem; color: var(--secondary); margin-bottom: 8px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; color: var(--muted-2); font-size: .9rem; font-family: var(--display); }

/* ---------- Reveal animation (scroll-triggered, below the fold) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Hero page-load sequence (above the fold) ---------- */
/* Each element rises and fades in, staggered by its --i index. */
.load-rise {
  opacity: 0;
  animation: load-rise .7s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 110ms + 80ms);
}
@keyframes load-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .news-rail { order: 3; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--surface);
    border-bottom: 1px solid var(--border); padding: 8px;
    max-height: 0; overflow: hidden; transition: max-height .3s var(--ease);
  }
  .nav-menu.is-open { max-height: 320px; }
  .nav-menu a { padding: 12px 14px; border-radius: 8px; }
  .edu-row { grid-template-columns: 1fr; gap: 4px; }
  .footer-inner { flex-direction: column; gap: 6px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .load-rise { opacity: 1; transform: none; animation: none; }
}
