/* =====================================================
   You Zhi Hu — personal site
   Design system: soft, calm, research-product
   ===================================================== */

:root {
  /* Colour — Emerald lavender lake (adapted, lightened): emerald + sky + lilac */
  --bg:        #F5F7F7;   /* cool near-white */
  --bg-alt:    #E9F4F5;   /* pale aqua section (from sky blue) */
  --ink:       #243330;   /* deep green-charcoal */
  --ink-soft:  #66726E;   /* muted green-grey */
  --accent:    #1E7D4D;   /* emerald — actions, links, stats */
  --accent-dk: #176540;   /* deeper emerald for hover */
  --accent-sf: #DCEFE6;   /* pale emerald wash */
  --lilac:     #8A6491;   /* mauve — graphic accents (timeline dots) */
  --lilac-dk:  #6E4A74;   /* deeper mauve for text on lilac */
  --lilac-sf:  #ECE4EE;   /* pale lilac wash — process tags, media */
  --sky:       #7CC4D0;   /* soft sky blue */
  --sky-sf:    #E6F4F6;   /* pale aqua wash */
  --line:      #E1EAE7;   /* soft hairline */

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Rhythm */
  --maxw: 1080px;
  --pad: clamp(1.25rem, 5vw, 4rem);
  --radius: 14px;
}

* { 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.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ===================== NAV ===================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: .01em;
}
.nav__links {
  display: flex;
  gap: clamp(1rem, 4vw, 2.25rem);
}
.nav__links a {
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .2s ease;
}
.nav__links a:hover { color: var(--accent); }

/* ===================== HERO ===================== */
.hero {
  padding: clamp(4.5rem, 12vh, 9rem) 0 clamp(3.5rem, 9vh, 6.5rem);
}
.hero__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  margin-bottom: 1.6rem;
  max-width: 880px;
}
.hero__heading { flex: 0 1 auto; }
.hero__heading .hero__eyebrow { margin-bottom: 0; }
.hero__avatar {
  flex: 0 0 auto;
  width: clamp(135px, 15vw, 170px);
}
.hero__avatar img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(36, 51, 48, 0.14));
}
.hero__intro { max-width: 880px; }
.hero__eyebrow {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lilac-dk);
  margin: 0 0 1.4rem;
}
.hero__headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 .7rem;
  max-width: none;
}
.hero__intro {
  font-size: clamp(1.05rem, 2.1vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 880px;
  margin: 0 0 2.4rem;
}
.hero__actions { display: flex; gap: .9rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: .8rem 1.5rem;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .2s ease;
  border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dk); transform: translateY(-1px); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===================== SECTIONS ===================== */
.section { padding: clamp(3.5rem, 9vh, 6.5rem) 0; }
.section--products { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section__head { max-width: 60ch; margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.section__kicker {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lilac-dk);
  margin-bottom: 1rem;
}
.section__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}
.section__lede {
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ===================== PRODUCT ===================== */
.product {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding: clamp(2.5rem, 6vh, 4rem) 0;
  border-top: 1px solid var(--line);
}
.product:first-of-type { border-top: none; }
.product--reverse { grid-template-columns: 1.15fr 0.85fr; }
.product--reverse .product__media { order: 2; }

.product__media { position: sticky; top: 90px; }
.media-placeholder {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: linear-gradient(150deg, var(--lilac-sf), var(--sky-sf));
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  color: var(--lilac-dk);
}
.media-placeholder span { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; }
.product__img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.media-placeholder small { color: var(--ink-soft); font-size: .82rem; }

.product__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.product__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0;
}
.product__years { font-size: .9rem; color: var(--ink-soft); white-space: nowrap; }
.product__role {
  font-size: .9rem;
  font-weight: 500;
  color: var(--accent);
  margin: .5rem 0 1rem;
}
.product__desc { margin: 0 0 1.6rem; color: var(--ink-soft); max-width: 56ch; }

/* stats */
.stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem 2rem;
  padding: 1.2rem 0;
  margin: 0 0 1.6rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stats li { display: flex; flex-direction: column; }
.stats strong {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}
.stats span { font-size: .78rem; color: var(--ink-soft); margin-top: .35rem; }

/* iterative loop */
.loop { list-style: none; counter-reset: loop; padding: 0; margin: 0 0 1.6rem; }
.loop li {
  position: relative;
  padding: 0 0 1.3rem 0;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  align-items: start;
}
.loop li:not(:last-child) { border-bottom: 1px dashed var(--line); margin-bottom: 1.3rem; }
.loop__tag {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--lilac-dk);
  background: var(--lilac-sf);
  padding: .35rem .55rem;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
}
.loop p { margin: 0; font-size: .96rem; color: var(--ink); }

/* research */
.research { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.research summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .92rem;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.research summary::-webkit-details-marker { display: none; }
.research summary::before { content: "+"; font-size: 1.1rem; line-height: 1; }
.research[open] summary::before { content: "\2013"; }
.research__body { padding-top: .9rem; }
.research__body ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.research__body li { font-size: .9rem; margin-bottom: .5rem; }
.research__placeholder { color: var(--ink-soft); font-style: italic; }
.research__scholar { font-size: .9rem; font-weight: 500; color: var(--accent); text-decoration: none; }
.research__scholar:hover { text-decoration: underline; }

/* ===================== TIMELINE ===================== */
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(2rem, 6vw, 5rem);
  margin-bottom: clamp(3rem, 7vh, 5rem);
}
/* center line */
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line);
  transform: translateX(-50%);
}
.timeline__heads { display: contents; }
.timeline__head {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  padding-bottom: 1.4rem;
  margin-bottom: .5rem;
}
.timeline__head--left { text-align: right; padding-right: 2rem; }
.timeline__head--right { grid-column: 2; padding-left: 2rem; }

.tl-item {
  position: relative;
  padding: 0 2rem 2.2rem;
}
.tl-item--left  { grid-column: 1; text-align: right; }
.tl-item--right { grid-column: 2; text-align: left; }

/* node dot on the center line */
.tl-item::before {
  content: "";
  position: absolute;
  top: .35rem;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--lilac);
}
.tl-item--left::before  { right: -2rem; transform: translateX(50%); }
.tl-item--right::before { left: -2rem;  transform: translateX(-50%); }

.tl-year {
  display: inline-block;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--lilac-dk);
  margin-bottom: .4rem;
}
.tl-item h4 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  margin: 0 0 .25rem;
}
.tl-org { font-size: .9rem; color: var(--ink); margin: 0 0 .4rem; font-weight: 500; }
.tl-note { font-size: .88rem; color: var(--ink-soft); margin: 0; }

/* ===================== SKILLS ===================== */
.skills { border-top: 1px solid var(--line); padding-top: clamp(2rem, 5vh, 3rem); }
.skills__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0 0 1.6rem;
}
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.6rem 2rem;
}
.skill-group h4 {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--lilac-dk);
  margin: 0 0 .5rem;
}
.skill-group p { margin: 0; font-size: .94rem; color: var(--ink-soft); }

/* ===================== CONTACT ===================== */
.section--contact { background: var(--bg-alt); border-top: 1px solid var(--line); padding-bottom: 0; }
.contact__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  max-width: 18ch;
}
.contact__lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 52ch; margin: 0 0 2rem; }
.contact__links { display: flex; flex-wrap: wrap; gap: .8rem; }
.contact__links a {
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  padding: .65rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: all .2s ease;
}
.contact__links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.footer {
  margin-top: clamp(3.5rem, 8vh, 6rem);
  border-top: 1px solid var(--line);
  padding: 1.6rem 0;
}
.footer .container { display: flex; justify-content: space-between; align-items: center; }
.footer span, .footer a { font-size: .85rem; color: var(--ink-soft); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ===================== REVEAL ANIMATION ===================== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 820px) {
  .hero__avatar { width: clamp(120px, 24vw, 160px); }

  .product {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .product--reverse .product__media { order: 0; }
  .product__media { position: static; }
  .media-placeholder { aspect-ratio: 16 / 9; }

  /* timeline collapses to a single left-aligned column */
  .timeline { grid-template-columns: 1fr; }
  .timeline::before { left: 6px; transform: none; }
  .timeline__heads { display: none; }
  .tl-item--left, .tl-item--right { grid-column: 1; text-align: left; padding: 0 0 2rem 2rem; }
  .tl-item--left::before  { right: auto; left: 6px; transform: translateX(-50%); }
  .tl-item--right::before { left: 6px; transform: translateX(-50%); }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero__top { flex-direction: column-reverse; align-items: flex-start; gap: 1.2rem; }
  .hero__avatar { width: clamp(150px, 45vw, 190px); }
  .loop li { grid-template-columns: 1fr; gap: .5rem; }
  .loop__tag { justify-self: start; }
  .stats { gap: 1.2rem 1.5rem; }
}
