/* ===== Design tokens — flat dashboard palette (aligned with ujdc-cockpit) ===== */
:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --surface: #21262d;
  --border: #30363d;
  --gold: #d4a853;
  --gold2: #b8860b;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #9aa4b0;
  --green: #3fb950;
  --red: #f85149;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --orange: #d29922;
  --zh-heading: #e0bc74;
  --zh-body: #bfae8f;
  --font-head: 'Marcellus', Georgia, serif;
  --font-body: 'Montserrat', -apple-system, 'Segoe UI', sans-serif;
  --font-zh: 'Noto Sans SC', var(--font-body);
  --maxw: 1140px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

h1, h2, h3 {
  font-family: var(--font-head);
  color: var(--text);
  margin: 0;
  line-height: 1.15;
  font-weight: 400;
}

h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); max-width: 860px; }
h3 { font-size: 1.15rem; margin: 0; }

p { color: var(--text2); margin: 0; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.section-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.75rem;
  position: relative;
  z-index: 1;
}
.section-inner.narrow { max-width: 780px; }

/* ===== Bilingual line system — English line, then Chinese line, always separated ===== */
.zh-text { font-family: var(--font-zh); }

.kicker { margin-bottom: 1rem; }
.kicker-en {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 700;
}
.kicker-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--zh-body);
  margin-top: 0.25rem;
}

.h2-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.85em;
  font-weight: 600;
  color: var(--zh-heading);
  margin: 0.5rem 0 0;
}

.section-header { display: flex; flex-direction: column; margin-bottom: 2rem; }
.section-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-header h2::before {
  content: '';
  width: 4px; height: 22px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.lead-en { font-size: 1.02rem; max-width: 660px; color: var(--text2); }
.lead-zh {
  font-family: var(--font-zh);
  font-size: 1rem;
  max-width: 660px;
  color: var(--zh-body);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

/* ===== Nav ===== */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  background: rgba(13, 17, 23, 0.9);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-family: var(--font-head);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; color: var(--gold); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text2);
  text-align: center;
}
.nav-en { font-size: 0.88rem; font-weight: 500; }
.nav-zh { font-family: var(--font-zh); font-size: 0.68rem; color: var(--text3); margin-top: 1px; }
.nav-links a:hover { text-decoration: none; }
.nav-links a:hover .nav-en { color: var(--gold); }
.nav-cta {
  border: 1px solid var(--gold2);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
}
.nav-cta .nav-en { color: var(--gold); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

@media (max-width: 800px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed;
    top: 58px; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: min(78vw, 300px);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    padding: 0.4rem 0;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding: 0.8rem 1.4rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-zh { margin-top: 0; }
  .nav-cta { margin: 0.7rem 1.4rem; justify-content: center; }
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6.5rem 1.5rem 3.5rem;
  text-align: center;
  background: var(--bg);
}
.hero-inner {
  position: relative;
  max-width: 860px;
}
.eyebrow-en {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  font-weight: 700;
  color: var(--gold);
  margin: 0;
}
.eyebrow-zh {
  font-family: var(--font-zh);
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  font-weight: 600;
  color: var(--zh-body);
  margin: 0.6rem 0 0;
}
.hero-title-en {
  display: block;
  font-size: clamp(2rem, 5.6vw, 4rem);
  line-height: 1.12;
  color: var(--text);
  margin: 1.5rem 0 0;
}
.hero-title-zh {
  font-family: var(--font-zh);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 600;
  color: var(--zh-heading);
  margin: 0.75rem 0 0;
}
.hero-sub-en {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--text2);
  max-width: 560px;
  margin: 1.75rem auto 0;
}
.hero-sub-zh {
  font-family: var(--font-zh);
  font-size: 1.02rem;
  color: var(--zh-body);
  max-width: 560px;
  margin: 0.6rem auto 0;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.2rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn-en { font-size: 0.95rem; }
.btn-zh { font-family: var(--font-zh); font-size: 0.72rem; opacity: 0.85; }
.btn-solid {
  background: var(--gold2);
  color: #0d1117;
}
.btn-solid:hover {
  background: var(--gold);
  text-decoration: none;
}
.btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  text-decoration: none;
}
.btn-lg .btn-en { font-size: 1.05rem; }
.btn-lg .btn-zh { font-size: 0.78rem; }

/* ===== Sections ===== */
.section {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
}
.section:first-of-type { border-top: none; }
.section-alt { background: var(--bg2); }

/* ===== About ===== */
.bullets-en, .bullets-zh {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}
.bullets-zh {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  font-family: var(--font-zh);
}
.bullets-en li, .bullets-zh li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--text2);
  font-size: 0.98rem;
}
.bullets-zh li { color: var(--zh-body); font-size: 0.95rem; }
.bullets-en li::before, .bullets-zh li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.55em;
  width: 6px; height: 6px;
  background: var(--gold2);
}

/* ===== Capabilities ===== */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 0;
}
.cap-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}
.cap-index {
  font-family: var(--font-head);
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}
.cap-card h3 { margin-top: 0.5rem; font-size: 1.05rem; }
.cap-card .h3-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--zh-heading);
  margin-top: 0.3rem;
}
.cap-card .bullets-en, .cap-card .bullets-zh { margin-top: 0.9rem; gap: 0.45rem; }
.cap-card .bullets-en li, .cap-card .bullets-zh li { font-size: 0.85rem; }

@media (max-width: 900px) {
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .cap-grid { grid-template-columns: 1fr; }
}

/* ===== Projects ===== */
.proj-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 1.75rem 0 2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.proj-tab {
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: border-color 0.15s ease;
}
.proj-tab-en { font-family: var(--font-body); font-size: 0.82rem; font-weight: 600; color: var(--text2); }
.proj-tab-zh { font-family: var(--font-zh); font-size: 0.66rem; color: var(--text3); }
.proj-tab:hover { border-color: var(--gold2); }
.proj-tab.active { background: var(--gold2); border-color: var(--gold2); }
.proj-tab.active .proj-tab-en { color: #fff; }
.proj-tab.active .proj-tab-zh { color: rgba(255,255,255,0.75); }

.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
.proj-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.proj-card.hidden { display: none; }
.proj-cat-tag {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.proj-cat-en {
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
}
.proj-cat-zh { font-family: var(--font-zh); font-size: 0.66rem; color: var(--zh-body); }
.proj-card h3 { font-size: 1rem; margin: 0; }
.proj-card .h3-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--zh-heading);
  margin-top: 0.25rem;
}
.proj-card p.desc-en { font-size: 0.85rem; margin: 0; color: var(--text2); }
.proj-card p.desc-zh {
  font-family: var(--font-zh);
  font-size: 0.84rem;
  color: var(--zh-body);
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
}
.proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.proj-stack span {
  font-size: 0.7rem;
  color: var(--blue);
  border: 1px solid var(--border);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .proj-grid { grid-template-columns: 1fr; }
}

/* ===== Education ===== */
.edu-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 0;
}
.edu-col h3 { font-size: 1.05rem; }
.edu-col .h3-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--zh-heading);
  margin-top: 0.3rem;
}
.edu-col ul {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.edu-col li {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--gold2);
  padding-left: 0.9rem;
}
.edu-deg-en { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.edu-deg-zh { font-family: var(--font-zh); color: var(--zh-heading); font-size: 0.85rem; font-weight: 500; margin-top: 0.15rem; }
.edu-meta-en { color: var(--text2); font-size: 0.82rem; margin-top: 0.35rem; }
.edu-meta-zh { font-family: var(--font-zh); color: var(--zh-body); font-size: 0.8rem; margin-top: 0.1rem; }

@media (max-width: 700px) {
  .edu-columns { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* ===== Texts ===== */
.texts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.text-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border-color 0.15s ease;
}
.text-card:hover {
  border-color: var(--gold2);
  text-decoration: none;
}
.text-zh {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--text);
}
.text-en {
  font-size: 0.8rem;
  color: var(--text3);
}

@media (max-width: 600px) {
  .texts-grid { grid-template-columns: 1fr; }
}

/* ===== Contact ===== */
.section-contact { text-align: center; }
.section-contact .section-header { align-items: center; }
.section-contact .section-header h2 { justify-content: center; }
.section-contact .lead-en, .section-contact .lead-zh { margin-left: auto; margin-right: auto; text-align: center; }
.contact-note-en { font-size: 0.85rem; color: var(--text3); margin-top: 1rem; }
.contact-note-zh { font-family: var(--font-zh); font-size: 0.85rem; color: var(--zh-body); margin-top: 0.3rem; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 0.8rem;
}
.footer-zh { font-family: var(--font-zh); display: block; margin-top: 0.25rem; color: var(--zh-body); }

/* ===== Scroll reveal system ===== */
.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.word.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
