/* ============================================================
   Bao Lab — Shared Stylesheet
   Theme: Cloud Dancer expanded palette
   ============================================================ */

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

:root {
  --cloud:          #f1f0ec;
  --sky:            #b8cddd;
  --rose:           #d4aaa5;
  --sage:           #a9b69e;
  --bg:             #243441;
  --bg-nav:         #1d2b36;
  --bg-card:        #2f414e;
  --bg-card-hover:  #3a5060;
  --accent:         var(--rose);
  --accent-dim:     rgba(212, 170, 165, 0.16);
  --accent-border:  rgba(184, 205, 221, 0.25);
  --accent-glow:    rgba(212, 170, 165, 0.14);
  --text:           #d7e0e4;
  --text-hi:        var(--cloud);
  --text-dim:       #adbac3;
  --radius:         8px;
  --max-w:          960px;
  --nav-h:          58px;
}

/* ── Body ──────────────────────────────────────────────── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.78;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Navigation ─────────────────────────────────────────── */
nav {
  background-color: var(--bg-nav);
  border-bottom: 1px solid var(--accent-border);
  height: var(--nav-h);
  padding: 0 40px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  color: var(--text-hi);
  font-weight: 700;
  font-size: 1.05em;
  text-decoration: none !important;
  letter-spacing: 0.02em;
  margin-right: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  font-size: 0.88em;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 5px;
  transition: color 0.18s, background 0.18s;
  position: relative;
}

.nav-links a:hover {
  color: var(--accent);
  background: var(--accent-dim);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Page Layout ─────────────────────────────────────────── */
.page-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 40px 80px;
}

/* ── Typography ──────────────────────────────────────────── */
.page-title {
  font-size: 2.1em;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-dim);
  font-size: 0.95em;
  margin-bottom: 40px;
}

.section-label {
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 44px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent-border);
}

h2 {
  font-size: 1.15em;
  color: var(--text-hi);
  margin-bottom: 0.5em;
  font-weight: 600;
}

p {
  margin-bottom: 1em;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.card-title {
  font-size: 1.02em;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 6px;
  line-height: 1.45;
}

.card-meta {
  font-size: 0.82em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.card-body {
  font-size: 0.92em;
  color: var(--text);
}

/* ── Tags / Badges ───────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 0.73em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
  margin-bottom: 4px;
}

/* ── Bullet list ─────────────────────────────────────────── */
.accent-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1.2em;
}

.accent-list li {
  padding: 0.35em 0 0.35em 1.5em;
  position: relative;
  font-size: 0.95em;
  color: var(--text);
}

.accent-list li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.85em;
  top: 0.42em;
}

/* ── Links ───────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

/* ── CJK name sub-label ──────────────────────────────────── */
.name-cn {
  font-weight: 400;
  font-size: 0.82em;
  color: var(--text-dim);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--accent-border);
  margin: 36px 0;
}

/* ── Hamburger button (hidden on desktop) ────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.18s;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--accent-dim); }
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1),
              opacity 0.2s,
              background 0.18s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile drawer ───────────────────────────────────────── */
@media (max-width: 680px) {
  nav { padding: 0 20px; }
  .page-content { padding: 36px 20px 60px; }
  .nav-brand { font-size: 0.9em; }
  .page-title { font-size: 1.6em; }

  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(29, 43, 54, 0.97);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--accent-border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 16px;
    z-index: 99;
    /* collapsed */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.25s cubic-bezier(0.22,1,0.36,1),
                transform 0.25s cubic-bezier(0.22,1,0.36,1);
  }
  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .nav-links a {
    padding: 13px 24px;
    font-size: 0.92em;
    border-radius: 0;
    border-left: 2px solid transparent;
  }
  .nav-links a:hover,
  .nav-links a.active {
    border-left-color: var(--accent);
    background: var(--accent-dim);
  }
  /* suppress the underline sweep on mobile */
  .nav-links a::after { display: none; }
}

/* ============================================================
   Animations & Motion — Premium Edition
   ============================================================ */

html { scroll-behavior: smooth; }

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 7px rgba(212,170,165,0.36); }
  50%       { box-shadow: 0 0 18px rgba(212,170,165,0.72), 0 0 36px rgba(184,205,221,0.18); }
}

@keyframes shimmer {
  0%   { background-position: 150% 50%; }
  100% { background-position: -150% 50%; }
}

@keyframes borderPulse {
  0%, 100% { opacity: 0.22; }
  50%       { opacity: 0.55; }
}


/* ── Ambient glow orb ────────────────────────────────────── */
.ambient-orb {
  position: fixed;
  top: 0; left: 0;
  width: 640px; height: 640px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(212,170,165,0.045) 0%, rgba(184,205,221,0.025) 38%, transparent 65%);
  transition: transform 1.4s cubic-bezier(0.25,0.46,0.45,0.94);
  will-change: transform;
}

/* ── Nav scroll blur ─────────────────────────────────────── */
nav { transition: background-color 0.35s, box-shadow 0.35s, backdrop-filter 0.35s; }
nav.scrolled {
  background-color: rgba(41,56,68,0.84);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 1px 0 rgba(184,205,221,0.18), 0 8px 40px rgba(20,28,34,0.38);
}

/* ── Nav underline sweep ─────────────────────────────────── */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%; right: 50%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(212,170,165,0.5);
  transition: left 0.26s cubic-bezier(0.22,1,0.36,1),
              right 0.26s cubic-bezier(0.22,1,0.36,1);
}
.nav-links a:hover::after,
.nav-links a.active::after { left: 8px; right: 8px; }

/* ── Hero entrance ───────────────────────────────────────── */
.hero-lab     { opacity: 0; animation: fadeUp 0.95s cubic-bezier(0.22,1,0.36,1) 0.10s both; }
.hero-sub     { opacity: 0; animation: fadeUp 0.95s cubic-bezier(0.22,1,0.36,1) 0.32s both; }
.hero-tagline { opacity: 0; animation: fadeUp 0.95s cubic-bezier(0.22,1,0.36,1) 0.54s both; }
.hero-cta     { opacity: 0; animation: fadeUp 0.95s cubic-bezier(0.22,1,0.36,1) 0.74s both; }

/* ── Hero "Lab" shimmer ──────────────────────────────────── */
.hero-lab span {
  background: linear-gradient(90deg,
    var(--rose) 0%, var(--sky) 34%, var(--cloud) 50%, var(--sage) 66%, var(--rose) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear 1.6s infinite;
}

/* ── Kinetic page title words ────────────────────────────── */
.page-subtitle { animation: fadeUp 0.72s cubic-bezier(0.22,1,0.36,1) 0.22s both; }

.word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.25;
}
.word-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.72s cubic-bezier(0.22,1,0.36,1);
}
.word-inner.shown { transform: translateY(0); }

/* ── Section label sweep line ────────────────────────────── */
.section-label { position: relative; }
.section-label::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--rose) 0%, rgba(184,205,221,0.42) 52%, rgba(169,182,158,0.22) 78%, transparent);
  box-shadow: 0 0 8px rgba(212,170,165,0.32);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.85s cubic-bezier(0.22,1,0.36,1);
}
.section-label.visible::after { transform: scaleX(1); }

/* ── Scroll reveal ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.62s cubic-bezier(0.22,1,0.36,1),
              transform 0.62s cubic-bezier(0.22,1,0.36,1);
}
.reveal.visible { opacity: 1; transform: none; }

/* ── Button interactions ─────────────────────────────────── */
.btn {
  transition: background 0.2s, border-color 0.2s,
              transform 0.22s cubic-bezier(0.22,1,0.36,1),
              box-shadow 0.25s;
}
.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(212,170,165,0.24);
}
.btn-outline:hover {
  box-shadow: 0 8px 24px rgba(184,205,221,0.16);
}

/* ── Card interactions (base) ────────────────────────────── */
.card, .home-card {
  transition: border-color 0.22s, background 0.22s, box-shadow 0.28s, transform 0.12s;
}
.card:hover, .home-card:hover {
  box-shadow: 0 0 0 1px rgba(212,170,165,0.34), 0 10px 36px rgba(20,28,34,0.18);
}

/* ── Timeline & about dots ───────────────────────────────── */
.member-year-label::after {
  animation: pulseGlow 2.8s ease-in-out var(--pulse-delay, 0s) infinite;
}
.tl-dot { animation: pulseGlow 2.8s ease-in-out infinite; }

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
