@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

/* ─── Design tokens ─── */
:root {
  --bg:       #FAF8F3;
  --surface:  #FFFFFF;
  --text:     #1A1A1A;
  --text-2:   #3C3C3C;
  --text-3:   #7A7060;
  --accent:   #C8102E;
  --border:   #DDD6C8;
  --border-2: rgba(210, 200, 185, 0.55);

  --sh-2: 0 4px 28px rgba(15, 8, 0, 0.07), 0 1px 6px rgba(15, 8, 0, 0.04);
  --sh-3: 0 10px 48px rgba(15, 8, 0, 0.10), 0 2px 12px rgba(15, 8, 0, 0.05);

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:  'Lora', Georgia, serif;
  --ui:    'Inter', -apple-system, 'Helvetica Neue', sans-serif;

  --r: 10px;
  --w: 900px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
img  { max-width: 100%; display: block; }

/* ─── Base ─── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.82;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.18s; }
a:hover { color: #9b0c23; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; }

/* ════════════════════════════════
   NAVIGATION
════════════════════════════════ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(250, 248, 243, 0.90);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Circular avatar logo — image from assets/logo.jpg */
.nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: 0 1px 5px rgba(0,0,0,0.12);
  transition: opacity 0.2s, box-shadow 0.2s;
}
.nav-logo:hover { text-decoration: none; opacity: 0.88;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18); }
.nav-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 45%;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}
.nav-links a {
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.18s;
  padding-bottom: 2px;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active {
  color: var(--accent);
  border-bottom: 1.5px solid var(--accent);
}

/* ─── Page wrapper ─── */
.page {
  max-width: var(--w);
  margin: 0 auto;
  padding: 3rem 2rem 7rem;
}

/* ─── Floating card (Research / Misc) ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--sh-2);
  transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: var(--sh-3); }

/* ─── Section divider ─── */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3.5rem 0 2rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider span {
  font-family: var(--ui);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-family: var(--ui);
  font-size: 0.66rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* ════════════════════════════════
   HOME PAGE — open layout, no card
════════════════════════════════ */

.home-hero {
  display: grid;
  grid-template-columns: 1fr 295px;
  gap: 4.5rem;
  padding: 4.5rem 0 5rem;
  align-items: start;
}

/* ── Left column ── */
.hero-left {
  display: flex;
  flex-direction: column;
}

/* Display name — prominent but not overwhelming */
.display-name {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.0;
  color: var(--text);
}

.display-name-sub {
  margin-top: 0.55rem;
  display: flex;
  align-items: baseline;
  gap: 0.65em;
  flex-wrap: wrap;
}

.display-name-zh {
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

.display-pron {
  font-family: var(--ui);
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-3);
  letter-spacing: 0.03em;
  opacity: 0.85;
}

/* Education / affiliation line — sits right under the name (text proximity) */
.hero-edu {
  font-family: var(--ui);
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-top: 0.7rem;
}

/* Research-interest tags, below the education line */
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.hero-tag {
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.32em 0.85em;
  white-space: nowrap;
}

.hero-bio {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-2);
  margin-top: 1.9rem;
}
.hero-bio p { font-size: 0.95rem; line-height: 1.82; }
.hero-bio p a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.hero-bio p a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Contact links — a grouped row at the end of the bio column, left-aligned */
.contact-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.6rem;
  margin-top: 2rem;
}

.contact-link {
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.18s, text-decoration-color 0.18s;
}
.contact-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ── Right column: photo cards + contact list ── */
.hero-right {
  display: flex;
  flex-direction: column;
}

.photo-stack {
  position: relative;
  width: 295px;
  height: 420px;
  margin-top: 0.25rem;
}

/* Each card mimics a physical photo print (white border, thicker at bottom) */
.photo-card {
  position: absolute;
  background: #fff;
  padding: 8px 8px 30px;
  border-radius: 2px;
  cursor: default;
  /* Smooth tilt transitions on hover */
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow 0.35s ease,
              z-index 0s 0s;
}

.photo-card img {
  display: block;
  border-radius: 1px;
}

/* Primary — professional portrait, front-left, tilted left */
.photo-card--primary {
  width: 210px;
  top: 0;
  left: 4px;
  transform: rotate(-3deg);
  box-shadow: 0 10px 40px rgba(0,0,0,0.13), 0 3px 10px rgba(0,0,0,0.07);
  z-index: 2;
}
.photo-card--primary img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: center top;
}

/* Secondary — life/outdoor, back-right, tilted right, partially behind */
.photo-card--secondary {
  width: 172px;
  bottom: 0;
  right: 0;
  transform: rotate(4.5deg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 1;
  opacity: 0.95;
}
.photo-card--secondary img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* Hover: lift and gently un-tilt — feels like picking up a print */
.photo-card--primary:hover {
  transform: rotate(-1deg) translateY(-6px);
  box-shadow: 0 18px 56px rgba(0,0,0,0.16), 0 4px 14px rgba(0,0,0,0.08);
  z-index: 4;
}
.photo-card--secondary:hover {
  transform: rotate(2deg) translateY(-6px);
  box-shadow: 0 14px 48px rgba(0,0,0,0.14), 0 3px 12px rgba(0,0,0,0.07);
  z-index: 4;
}

/* ════════════════════════════════
   RESEARCH & MISC — shared header
════════════════════════════════ */

.page-header {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.page-header h1 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

/* ════════════════════════════════
   RESEARCH PAGE
════════════════════════════════ */

.research-tagline {
  font-size: 1rem;
  color: var(--text-3);
  font-style: italic;
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.paper-card {
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
}

.paper-venue {
  font-family: var(--ui);
  font-size: 0.73rem;
  color: var(--text-3);
  font-style: italic;
  margin-bottom: 0.6rem;
}

.paper-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.paper-authors {
  font-family: var(--ui);
  font-size: 0.76rem;
  color: var(--text-3);
  line-height: 1.55;
}
.paper-authors strong { color: var(--text-2); font-weight: 600; }

.paper-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.abstract-btn {
  font-family: var(--ui);
  font-size: 0.72rem;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  transition: color 0.18s;
  user-select: none;
}
.abstract-btn:hover { color: var(--accent); }
.abstract-btn .caret {
  font-size: 0.56rem;
  transition: transform 0.22s ease;
  display: inline-block;
}
.abstract-btn.open .caret { transform: rotate(180deg); }

.abstract-text {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.75;
}
.abstract-text.open { display: block; }

.paper-link {
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
}
.paper-link:hover { text-decoration: underline; }

/* ════════════════════════════════
   MISC PAGE
════════════════════════════════ */

.misc-intro {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.82;
  margin-bottom: 2.5rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.photo-item {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sh-2);
  aspect-ratio: 4/3;
}
.photo-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
  display: block;
}
.photo-item:hover img { transform: scale(1.04); }

.photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.1rem 1.25rem 0.9rem;
  background: linear-gradient(to top, rgba(15,10,5,0.72) 0%, transparent 100%);
  color: #fff;
}
.photo-caption .place {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  display: block;
  line-height: 1.3;
}
.photo-caption .region {
  font-family: var(--ui);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.82;
  margin-top: 0.15em;
  display: block;
}

/* ─── Trail map (Leaflet) ─── */
.trail-map-wrap {
  padding: 8px;            /* thin white frame, like the photo prints */
  overflow: hidden;
}
#trail-map {
  width: 100%;
  height: 440px;
  border-radius: 6px;
  background: var(--bg-subtle);
  z-index: 1;              /* keep below the sticky nav */
}

.map-note {
  font-family: var(--ui);
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.85rem;
  line-height: 1.6;
}

/* Custom route pin — small accent dot with a soft ring */
.trail-dot {
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(200,16,46,0.35), 0 2px 5px rgba(0,0,0,0.25);
}

/* Leaflet popup restyled to match the site */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: var(--sh-2);
}
.leaflet-popup-content {
  font-family: var(--ui);
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0.7rem 0.95rem;
}
.leaflet-popup-content b {
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--text);
}
.leaflet-container { font-family: var(--ui); }
.leaflet-bar a {
  color: var(--text-2);
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
  .nav-inner { padding: 0 1.25rem; }
  .page      { padding: 2rem 1.25rem 5rem; }

  /* Stack hero: photos first, then name → education → tags → bio → contacts */
  .home-hero {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 2.5rem 0 4rem;
  }
  .hero-left  { order: 2; }
  .hero-right { order: 1; align-items: center; }

  .photo-stack {
    width: 220px;
    height: 200px;
    margin: 0 auto;
  }
  .photo-card--primary {
    width: 130px;
    top: 0; left: 0;
  }
  .photo-card--secondary {
    width: 110px;
    bottom: 0; right: 0;
  }

  .photo-grid { grid-template-columns: 1fr; }
  .paper-card { padding: 1.4rem; }
  #trail-map  { height: 340px; }
}
