/* ============================================================
   Renzhi He — personal homepage
   Recreation of the Strikingly layout on GitHub Pages
   Fonts: Josefin Slab (titles), Unna (italic serif), Cardo (body serif)
   ============================================================ */

:root{
  --serif-title: 'Josefin Slab', Georgia, 'Songti SC', serif;
  --serif-accent: 'Unna', Cardo, 'Songti SC', serif;
  --serif-body: 'Cardo', 'Times New Roman', 'Songti SC', serif;

  --ink:        #1d2023;
  --ink-soft:   #21252b;
  --brown:      #433a32;   /* News title */
  --muted:      #897e72;   /* dates */
  --link:       #2f6db3;
  --line:       #e2e2e2;

  --bg-about:   #f2f2f2;
  --bg-news:    #a7bac1;   /* slate blue */
  --bg-research:#cccccc;   /* gray */
  --bg-light:   #e8eaec;   /* projects / beyond */
  --bg-footer:  #2e2e2f;
}

*{ box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  margin:0;
  font-family:var(--serif-body);
  color:var(--ink);
  font-size:18px;
  line-height:1.5;
  background:#fff;
  -webkit-font-smoothing:antialiased;
}

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

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

/* ---------- Titles ---------- */
.title-serif{
  font-family:var(--serif-title);
  font-weight:400;
  color:var(--ink-soft);
  font-size:48px;
  line-height:1.3;
  margin:0 0 24px;
}
.title-serif.center{ text-align:center; }
.sub-serif{
  font-family:var(--serif-title);
  font-weight:400;
  color:var(--ink-soft);
  font-size:26px;
  margin:34px 0 12px;
}

/* ============================================================
   NAV
   ============================================================ */
.nav{
  position:sticky; top:0; z-index:50;
  background:#fff;
  border-bottom:1px solid var(--line);
}
.nav-inner{
  max-width:1180px; margin:0 auto;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 28px;
}
.brand{ display:flex; align-items:center; gap:12px; color:var(--ink); }
.brand:hover{ text-decoration:none; }
.brand-logo{ width:44px; height:44px; object-fit:contain; }
.brand-name{
  font-family:var(--serif-title);
  font-size:22px; color:#333; letter-spacing:.5px;
}
.nav-links{ display:flex; gap:30px; }
.nav-links a{
  font-family:var(--serif-title);
  font-size:19px; font-weight:600;
  color:var(--ink);
}
.nav-links a:hover{ text-decoration:underline; }
.nav-toggle{
  display:none;
  background:none; border:none; font-size:26px; cursor:pointer; color:var(--ink);
}

/* ============================================================
   ABOUT  — split: photo left, text right on #f2f2f2
   ============================================================ */
.about{
  display:grid;
  grid-template-columns:1fr 1fr;
  background:var(--bg-about);
  min-height:640px;
}
.about-photo{ position:relative; }
.about-photo img{
  width:100%; height:100%; object-fit:cover;
}
.photo-caption{
  position:absolute; left:50%; top:42%;
  transform:translateX(-50%);
  color:#fff;
  font-family:var(--serif-accent);
  font-style:italic;
  font-size:22px;
  text-shadow:0 1px 6px rgba(0,0,0,.55);
}
.about-text{
  padding:70px 60px;
  align-self:center;
  max-width:640px;
}
.about-text p{
  font-family:var(--serif-accent);
  margin:0 0 18px;
  line-height:1.5;
}

/* ============================================================
   NEWS  — slate blue band, italic serif items
   ============================================================ */
.news{
  background:var(--bg-news);
  padding:60px 28px 80px;
}
.news-title{
  font-family:var(--serif-title);
  font-weight:400;
  color:var(--brown);
  font-size:28px;
  text-align:center;
  margin:0 0 34px;
}
.news-list{
  list-style:none;
  max-width:1000px; margin:0 auto; padding:0;
}
.news-list li{
  font-family:var(--serif-accent);
  font-style:italic;
  font-size:30px;
  line-height:1.45;
  color:#000;
  margin:0 0 4px;
}
.news-list a{ color:#153b66; }

/* ============================================================
   QUOTE bands — full-width bg image, centered bold Josefin
   ============================================================ */
.quote{
  min-height:280px;
  display:flex; align-items:center; justify-content:center;
  background-size:cover; background-position:center;
  background-attachment:fixed;          /* parallax: bg stays put, reveals different parts */
  padding:40px 24px;
}
.quote p{
  font-family:var(--serif-title);
  font-weight:700;
  font-size:19px;
  color:#000;
  text-align:center;
  margin:0;
}

/* ============================================================
   RESEARCH — gray bg, white paper cards, centered header text
   ============================================================ */
.research{
  background:var(--bg-research);
  padding:70px 24px 90px;
}
.research > .title-serif{ margin-bottom:44px; }
.paper{
  max-width:1180px; margin:0 auto 46px;
  background:transparent;
}
.paper-img{
  background:#fff; padding:10px;
  border:1px solid #bdbdbd;
}
.paper-img img{
  width:100%; height:auto; object-fit:contain;
  margin:0 auto;
}
.paper-title{
  font-family:var(--serif-title);
  font-weight:700;
  font-size:20px;
  text-align:center;
  color:#000;
  margin:22px auto 6px;
  max-width:1000px;
}
.paper-venue{
  font-family:var(--serif-title);
  text-align:center;
  color:#212529;
  margin:2px 0;
}
.paper-date{
  font-family:var(--serif-accent);
  text-align:center;
  color:var(--muted);
  margin:2px 0;
}
.paper-links{
  text-align:center;
  font-family:var(--serif-body);
  margin:6px 0 14px;
}
.paper-body p{
  font-family:var(--serif-body);
  text-align:justify;
  color:#111;
  margin:0 0 10px;
  line-height:1.45;
}

/* ---------- Research groups (collapsible) ---------- */
.research-group{
  max-width:1180px;
  margin:0 auto 40px;
}
.research-group-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
  cursor:pointer;
  list-style:none;
  padding:14px 2px;
  border-bottom:2px solid rgba(0,0,0,.28);
  user-select:none;
}
.research-group-head::-webkit-details-marker{ display:none; }
.research-group-head:hover .research-group-title{ opacity:.62; }
.research-group-title{
  font-family:var(--serif-title);
  font-size:30px;
  color:var(--ink-soft);
  line-height:1.2;
}
.research-toggle{
  flex:0 0 auto;
  width:13px; height:13px;
  margin-right:8px;
  border-right:2px solid #4a4a4a;
  border-bottom:2px solid #4a4a4a;
  transform:rotate(45deg);            /* points down: click to expand */
  transition:transform .3s ease;
}
.research-group[open] > .research-group-head .research-toggle{
  transform:rotate(-135deg);          /* points up: click to collapse */
}
.research-group-intro{
  font-family:var(--serif-accent);
  font-style:italic;
  font-size:18px;
  color:#2c2c2c;
  max-width:920px;
  margin:18px 0 24px;
  line-height:1.55;
}

/* ---------- Research directions + nested "Projects" ---------- */
.research-direction{ margin:6px 0 0; }
.direction-title{
  font-family:var(--serif-title);
  font-size:24px;
  color:var(--ink-soft);
  margin:22px 0 8px;
}
.research-sub{ margin:2px 0 14px; }
.research-sub-head{
  display:inline-flex; align-items:center;
  gap:10px;
  cursor:pointer;
  list-style:none;
  padding:8px 0;
  user-select:none;
}
.research-sub-head::-webkit-details-marker{ display:none; }
.research-sub-head:hover .research-sub-title{ opacity:.6; }
.research-sub-title{
  font-family:var(--serif-title);
  font-size:17px;
  letter-spacing:1px;
  text-transform:uppercase;
  color:#5a5a5a;
}
.research-toggle.small{
  width:10px; height:10px;
  margin:0;
}
.research-sub[open] > .research-sub-head .research-toggle{
  transform:rotate(-135deg);
}

/* ============================================================
   PROJECTS — light bg, text left / image right rows
   ============================================================ */
.projects{
  background:var(--bg-light);
  padding:70px 24px 90px;
}
.projects > .title-serif{ margin-bottom:50px; }
.proj{
  max-width:1180px; margin:0 auto 60px;
  display:grid;
  grid-template-columns:1fr 340px;
  gap:48px;
  align-items:start;
}
.proj-title{
  font-family:var(--serif-title);
  font-weight:400;
  font-size:22px;
  color:var(--ink-soft);
  margin:0 0 6px;
}
.proj-date{
  font-family:var(--serif-accent);
  color:var(--muted);
  margin:0 0 16px;
}
.proj-text ul{ margin:0; padding-left:20px; }
.proj-text li{ margin:0 0 10px; line-height:1.45; }
.proj-links{ margin-top:16px; }
.proj-img img{
  width:100%; border-radius:2px;
  box-shadow:0 2px 10px rgba(0,0,0,.15);
}

/* ============================================================
   BEYOND THE LAB — light bg, centered header, left content
   ============================================================ */
.beyond{
  background:var(--bg-light);
  padding:40px 24px 100px;
}
.beyond > .title-serif{ margin-bottom:40px; }
.beyond-inner,
.beyond .sub-serif,
.beyond .award-list,
.beyond-para{
  max-width:1130px;
  margin-left:auto; margin-right:auto;
}
.award-list{ padding-left:22px; }
.award-list li{ margin:0 0 8px; }
.beyond-para{
  font-family:var(--serif-accent);
  line-height:1.55;
  margin:6px auto 10px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer{
  background:var(--bg-footer);
  color:#cfcfcf;
  text-align:center;
  padding:30px 20px;
  font-family:var(--serif-body);
  font-size:15px;
}

/* ============================================================
   SCROLL REVEAL  (progressive enhancement — only active with JS)
   Elements fade + slide up as they enter the viewport.
   ============================================================ */
.js .reveal{
  opacity:0;
  transform:translateY(30px);
  transition:opacity .8s cubic-bezier(.22,.61,.36,1),
             transform .8s cubic-bezier(.22,.61,.36,1);
  will-change:opacity, transform;
}
.js .reveal.reveal-img{ transform:translateY(30px) scale(.965); }
.js .reveal.visible{ opacity:1; transform:none; }

/* Users who prefer less motion get everything static */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .js .reveal{ opacity:1; transform:none; transition:none; }
  .quote{ background-attachment:scroll; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:860px){
  body{ font-size:17px; }
  .title-serif{ font-size:38px; }

  /* fixed backgrounds are unreliable / janky on touch devices */
  .quote{ background-attachment:scroll; }

  .nav-links{
    position:absolute; top:100%; right:0;
    flex-direction:column; gap:0;
    background:#fff; border:1px solid var(--line);
    min-width:200px;
    display:none;
  }
  .nav-links.open{ display:flex; }
  .nav-links a{ padding:14px 20px; border-bottom:1px solid var(--line); }
  .nav-toggle{ display:block; }

  .about{ grid-template-columns:1fr; }
  .about-photo{ height:360px; }
  .about-text{ padding:44px 28px; }

  .news-list li{ font-size:22px; }

  .proj{ grid-template-columns:1fr; gap:20px; }
  .proj-img{ max-width:420px; }
}

@media (max-width:520px){
  .title-serif{ font-size:32px; }
  .paper-title{ font-size:18px; }
  .news-list li{ font-size:19px; }
  .research-group-title{ font-size:23px; }
  .research-group-intro{ font-size:17px; }
}
