/* Wenxin Wang — personal academic website
   Plain CSS, no build step. Colors: HBS crimson accent on white. */

:root {
  --crimson: #a51c30;
  --crimson-dark: #7f1524;
  --crimson-tint: #f8ecee;
  --ink: #1f2933;
  --muted: #5f6b7a;
  --rule: #e6e8eb;
  --bg: #ffffff;
  --maxw: 1000px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a {
  color: var(--crimson);
  text-decoration: none;
  border-bottom: 1px solid rgba(165, 28, 48, 0.35);
}
a:hover { border-bottom-color: var(--crimson); }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: 20px;
}

/* ---------- Top bar ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  flex-wrap: wrap;
  min-height: 66px;
  padding-block: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  color: var(--ink);
}
.brand img { height: 42px; width: auto; display: block; }
.brand span {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
nav a {
  border: none;
  color: var(--ink);
  font-size: 16px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
nav a:hover,
nav a[aria-current="page"] {
  color: var(--crimson);
  border-bottom-color: var(--crimson);
}

/* ---------- Hero band ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--crimson);
  color: #fff;
  text-align: center;
  padding: 68px 20px 62px;
}
.hero::before {
  /* subtle diagonal texture, like a patterned banner */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.055) 0 2px,
    transparent 2px 16px
  );
  pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: 0.3px;
}
.hero p {
  margin: 4px 0;
  font-size: clamp(16px, 2.3vw, 19px);
  opacity: 0.95;
}
.hero.small { padding: 92px 20px 84px; }
.hero.small h1 { font-size: clamp(30px, 5vw, 44px); margin: 0; }

/* Photo banners: class "photo" plus one bg-* class per page, under a dark wash */
.hero.photo {
  background-size: cover;
  background-position: center 45%;
}
.hero.photo::before { display: none; }
.hero.bg-campus {   /* Home: HBS campus in bloom */
  background-image: linear-gradient(rgba(15, 15, 25, 0.38), rgba(15, 15, 25, 0.50)), url("images/banner-campus.jpg");
  background-position: center 45%;
}
.hero.bg-gulls {    /* Personal: seagulls at sunset */
  background-image: linear-gradient(rgba(15, 15, 25, 0.30), rgba(15, 15, 25, 0.45)), url("images/banner-gulls-2.jpg");
  background-position: center 50%;
}
.hero.bg-blossom {  /* Research: blossoms and blue sky */
  background-image: linear-gradient(rgba(15, 15, 25, 0.40), rgba(15, 15, 25, 0.50)), url("images/banner-blossom.jpg");
  background-position: center 40%;
}
.hero.bg-river {    /* Teaching: Charles River sunset */
  background-image: linear-gradient(rgba(15, 15, 25, 0.30), rgba(15, 15, 25, 0.45)), url("images/banner-river.jpg");
  background-position: center 68%;
}
.hero.photo h1,
.hero.photo p { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5); }

/* ---------- Home: photo + bio ---------- */
.intro {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
  padding: 52px 0 28px;
}
.intro img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
}
.intro h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 12px;
}
.intro p { margin: 0 0 14px; }
.hl { color: var(--crimson); font-weight: 600; }
.contact {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 16px;
}
.contact li { margin: 2px 0; }
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.links a { font-weight: 600; }

/* ---------- Generic sections ---------- */
main.wrap { padding-bottom: 24px; }
.section { padding: 28px 0 8px; }
.section h2,
.papers h2 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  display: inline-block;
  margin: 8px 0 16px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--crimson);
}
.section p { margin: 0 0 14px; }
.lead {
  font-size: 18px;
  padding: 36px 0 4px;
  margin: 0;
}

.committee ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px 28px;
}
.committee li strong { font-weight: 600; }
.committee li span {
  display: block;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

/* ---------- Research entries ---------- */
.papers { padding: 22px 0 4px; }
main.wrap > .papers:first-child { padding-top: 40px; }
.paper {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}
.paper:last-child { border-bottom: none; }
.paper .title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px;
}
.paper .title a { border-bottom-width: 1px; color: var(--ink); }
.paper .title a:hover { color: var(--crimson); }
.paper .authors { margin: 0; }
.paper .status {
  margin: 2px 0 0;
  color: var(--muted);
  font-style: italic;
}
.paper .venue { font-style: italic; }
.btns { margin: 10px 0 0; }
.btn {
  display: inline-block;
  border: 1px solid var(--crimson);
  border-radius: 3px;
  padding: 1px 10px;
  font-size: 14px;
  font-weight: 600;
  margin: 0 6px 6px 0;
}
.btn:hover { background: var(--crimson-tint); }
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  font-size: 13px;
  color: var(--crimson-dark);
  background: var(--crimson-tint);
  border-radius: 999px;
  padding: 1px 10px;
}
ul.meta { margin: 12px 0 0; padding-left: 20px; }
ul.meta li { margin: 2px 0; }
details { margin-top: 10px; }
summary {
  cursor: pointer;
  color: var(--crimson);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "+ "; }
details[open] summary::before { content: "\2212  "; }
details p { margin: 8px 0 0; }
.note { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

/* ---------- Teaching ---------- */
.course { padding: 6px 0 14px; }
.course h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
}
.course .meta { color: var(--muted); margin: 0 0 8px; }
.course ul { margin: 0; padding-left: 20px; }
.course li { margin: 4px 0; }

/* ---------- Personal ---------- */
.films {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 48px;
}
.films li { border-top: 1px solid var(--rule); padding: 8px 0 9px; }
.film-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.film-title .orig {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  margin-left: 2px;
  display: inline-block;   /* a long original title drops to the next line as one piece */
}
.film-meta { color: var(--muted); font-size: 14px; margin: 1px 0 0; }
.films p.film-note { margin: 0; }
.gallery-main {
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: 40px;
  align-items: center;
}
.gallery-main img,
.thumbs img { width: 100%; height: auto; display: block; border-radius: 4px; }
.thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.thumbs img { aspect-ratio: 8 / 9; object-fit: cover; }
.pair {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 44px;
  align-items: center;
}
.pair img { width: 100%; height: auto; display: block; border-radius: 4px; }
.duo {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-top: 22px;
}
.duo figure { margin: 0; }
.duo img { width: 100%; height: auto; display: block; border-radius: 4px; }   /* 3:2 beside 3:4 in a 2:1 grid gives equal heights, nothing cropped */
figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }
.ph {   /* grey boxes used only in drafts */
  background: #e9ecef;
  color: #7a8591;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
}
@media (max-width: 720px) {
  .films { grid-template-columns: 1fr; }
  .gallery-main { grid-template-columns: 1fr; gap: 20px; }
  .pair { grid-template-columns: 1fr; gap: 22px; }
  .duo { grid-template-columns: 1fr; }

  .thumbs {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 46%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .thumbs > * { scroll-snap-align: start; }
}

/* ---------- CV ---------- */
.cv-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 36px 0 14px;
}
.cv-actions .btn { margin: 0; padding: 4px 14px; font-size: 15px; }
.cv-actions .note { margin: 0; }
.cv-frame {
  display: block;
  width: 100%;
  height: 1180px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #f4f5f6;
}
@media (max-width: 720px) {
  .cv-frame { height: 75vh; }
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 28px;
  padding: 22px 20px 44px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
footer a { color: var(--muted); border-bottom-color: rgba(95, 107, 122, 0.4); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar .wrap { justify-content: center; text-align: center; }
  nav ul { justify-content: center; gap: 18px; }
  .intro { grid-template-columns: 1fr; gap: 26px; padding-top: 36px; }
  .intro img { max-width: 240px; margin: 0 auto; }
  .hero { padding: 48px 20px 44px; }
  .hero.small { padding: 66px 20px 60px; }
}
