/* ===== Design tokens — NUS AIDF-inspired light system ===== */
:root {
  --bg: #ffffff;
  --bg2: #f6f6f6;
  --bg3: #ffffff;
  --surface: #ffffff;
  --border: #e8e8e8;
  --navy: #003d7c;
  --navy-dark: #0a2149;
  --navy-deep: #002852;
  --gold: #b99d59;
  --gold2: #7b6c4a; /* desaturated from #8c7339 per "dull the link" feedback — same hue/lightness, less saturated so it reads muted instead of bright gold. Still clears WCAG AA (5.14:1 vs white, was 4.54). */
  --orange: #ef7c00;
  --sky: #6ec1e4;
  --green: #4fa860;
  /* Darkened, text-safe variants of the three lightest category accents —
     orange/sky/green fail WCAG AA (2.0–3.0:1) as small text or as a solid
     background under white text. These hit ~4.5:1+ against white while
     staying recognizably the same hue. Used for text and for the active-tab
     background; the brighter originals stay for non-text decoration
     (card-head border-left, tinted card-head/pill backgrounds). */
  --orange-text: #b75f00;
  --sky-text: #1f7da5;
  --green-text: #3d824a;
  --text: #161616;
  --text2: #54595f;
  --text3: #7a7a7a;
  --blue: #003d7c;
  --zh-heading: #8e753a;
  --zh-body: #7a7a7a;

  /* Category accents — sky and green pull from NUS AIDF's own Elementor
     global color kit (--e-global-color-primary:#6EC1E4 / --e-global-color-
     accent:#61CE70), so the extra hues stay inside the source palette
     instead of introducing new brand colors. Green is darkened slightly
     from the source #61CE70 for AA contrast on white card backgrounds.
     Per-category --accent/--accent-text pairs are set locally on .cap-card,
     .proj-card and .proj-tab below (scoped per element, not globally). */
  --font-head: 'League Spartan', 'Helvetica', sans-serif;
  --font-body: 'Roboto', -apple-system, 'Segoe UI', sans-serif;
  --font-zh: 'Noto Sans SC', var(--font-body);
  --maxw: 1140px;
  --card-shadow: 0px 9px 24px 0px rgba(10, 33, 73, 0.07);
}

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

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text2);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  -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: 600;
}

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(--gold2); 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 ===== */
.kicker { margin-bottom: 1rem; }
.kicker-en {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--gold2);
  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: 1.15rem 1.75rem;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease, backdrop-filter 0.3s ease;
  --nav-text: #ffffff;
  --nav-text2: rgba(255, 255, 255, 0.82);
}
.site-nav.scrolled {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--border);
  padding: 0.75rem 1.75rem;
  --nav-text: #161616;
  --nav-text2: #54595f;
}
.nav-brand {
  display: flex;
  align-items: center;
  transition: opacity 0.2s ease;
}
.nav-brand img {
  /* Both logo-nav-white.png and logo-nav-navy.png have a genuinely
     transparent background (the content was masked out from the original
     asset, not just cropped) — so no card/box/shadow treatment is needed
     or wanted here. Two color variants swap with the nav's own
     transparent/scrolled states below, the same way .nav-en text color
     already does via --nav-text. Source asset is 2x (68px actual height)
     for retina sharpness; displayed at half that. */
  display: block;
  height: 34px;
  width: auto;
}
/* Top of page: nav is transparent over the dark hero — show the white glyph,
   hide the navy one (both stacked via width:0 rather than display:none so
   layout doesn't jump between states). */
.nav-brand .logo-navy { width: 0; height: 0; opacity: 0; position: absolute; }
.nav-brand .logo-white { display: block; }
.site-nav.scrolled .nav-brand .logo-white { width: 0; height: 0; opacity: 0; position: absolute; }
.site-nav.scrolled .nav-brand .logo-navy { display: block; width: auto; height: 34px; position: static; opacity: 1; }
.nav-brand:hover { opacity: 0.8; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--nav-text2);
  text-align: center;
}
.nav-en { font-size: 0.88rem; font-weight: 500; color: var(--nav-text); }
.nav-zh { font-family: var(--font-zh); font-size: 0.68rem; color: var(--nav-text2); margin-top: 1px; }
.nav-links a:hover { text-decoration: none; }
.nav-links a:hover .nav-en { color: var(--gold); }
.nav-cta {
  border: 1.5px solid var(--gold2);
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
}
.nav-cta .nav-en { color: var(--gold2); }
.site-nav.scrolled .nav-cta .nav-en { color: var(--gold2); }
.nav-cta:hover { background: var(--gold2); }
.nav-cta:hover .nav-en { color: #ffffff; }
.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(--nav-text);
  border-radius: 2px;
  transition: background 0.2s ease;
}

@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: #ffffff;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(10, 33, 73, 0.08);
    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-links .nav-en, .nav-links .nav-zh { color: var(--text2); }
  .nav-links a:hover .nav-en { color: var(--gold2); }
  .nav-zh { margin-top: 0; }
  .nav-links a.nav-cta {
    width: auto;
    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: linear-gradient(150deg, var(--navy) 0%, var(--navy-dark) 62%, var(--navy-deep) 100%);
}
.hero-inner {
  position: relative;
  max-width: 860px;
}
.hero-logo {
  /* logo-hero.png is now a white glyph on a genuinely transparent
     background (masked from the source asset, same treatment as the nav
     logo), so it sits directly on the hero's dark gradient with no card/
     border/shadow needed — those were compensating for an opaque
     background that no longer exists here. margin-bottom gives it clear
     breathing room from the eyebrow line below (per feedback: the name
     logo and "DATA SCIENTIST · ..." line were sitting too close together). */
  display: block;
  width: min(280px, 65vw);
  height: auto;
  margin: 0 auto 2.25rem;
}
.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: rgba(255, 255, 255, 0.75);
  margin: 0.6rem 0 0;
}
.hero-title-en {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2rem, 5.6vw, 4rem);
  line-height: 1.12;
  color: #ffffff;
  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: #e8d3a4;
  margin: 0.75rem 0 0;
}
.hero-sub-en {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: rgba(255, 255, 255, 0.82);
  max-width: 560px;
  margin: 1.75rem auto 0;
}
.hero-sub-zh {
  font-family: var(--font-zh);
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.65);
  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 — pill-shaped, NUS style ===== */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.95rem 1.9rem;
  border-radius: 100px;
  border: 2px solid transparent;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn-en { font-size: 0.85rem; }
.btn-zh { font-family: var(--font-zh); font-size: 0.68rem; text-transform: none; letter-spacing: 0; opacity: 0.85; }
.btn-solid {
  background: var(--orange);
  border-color: var(--orange);
  color: #ffffff;
}
.btn-solid:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--orange);
  text-decoration: none;
}
.btn-outline {
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}
.btn-outline:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--navy);
  text-decoration: none;
}
.btn-lg { padding: 1.05rem 2.3rem; }
.btn-lg .btn-en { font-size: 0.92rem; }
.btn-lg .btn-zh { font-size: 0.7rem; }

/* Contact section is now a dark navy gradient band (matching the hero) —
   .btn-solid's default navy fill would vanish against that background, so
   this section needs its own override: orange fill (reads clearly on
   navy) that inverts to white-with-orange-text on hover, mirroring the
   hero's own .btn-solid behavior. */
.section-contact .btn-solid {
  background: var(--orange);
  border-color: var(--orange);
  color: #ffffff;
}
.section-contact .btn-solid:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--orange);
}

/* The mailto button's text is a long, un-hyphenatable email address — .btn's
   white-space:nowrap (needed elsewhere for short pill labels) makes it wider
   than the viewport on phones, pushing it off-center and clipped by the
   overflow-x:hidden safety net. Let it wrap and shrink instead. */
@media (max-width: 480px) {
  .section-contact .btn-lg {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
    padding: 0.9rem 1.4rem;
  }
  .section-contact .btn-lg .btn-en { font-size: 0.8rem; }
}

/* ===== Sections =====
   Backgrounds combine two techniques prototyped in bg-demo.html: a
   directional linear sweep (navy-tinted corner → gold-tinted corner, same
   direction as the hero's gradient) plus two radial glows layered on top
   for corner-pooling depth. Kept light enough that white cards/.card-head
   text contrast is untouched — this is atmosphere, not a color block.
   .section-contact is the one deliberate exception: a full dark navy
   gradient (the hero's own recipe) so the page opens and closes on the
   same tone, with the site-footer (already navy-dark) continuing it
   straight into one uninterrupted dark band at the bottom. */
.section {
  position: relative;
  padding: 5rem 0;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--navy) 5%, transparent) 0%, transparent 55%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--gold) 6%, transparent) 0%, transparent 50%),
    linear-gradient(160deg, color-mix(in srgb, var(--navy) 5%, #ffffff) 0%, #ffffff 45%, color-mix(in srgb, var(--gold) 6%, #ffffff) 100%);
}
.section:first-of-type { border-top: none; }
.section-alt {
  background:
    radial-gradient(circle at 85% 0%, color-mix(in srgb, var(--navy) 7%, transparent) 0%, transparent 55%),
    radial-gradient(circle at 8% 100%, color-mix(in srgb, var(--gold) 8%, transparent) 0%, transparent 50%),
    linear-gradient(160deg, color-mix(in srgb, var(--navy) 8%, var(--bg2)) 0%, var(--bg2) 45%, color-mix(in srgb, var(--gold) 9%, var(--bg2)) 100%);
}

.section-contact {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-dark) 60%, var(--navy-deep) 100%);
  border-top: none;
  padding-bottom: 4rem;
}
/* Lightened variant of --gold, not the raw token — at 0.78rem/700 this
   text doesn't qualify as WCAG "large text," so it needs 4.5:1. Against
   the gradient's lightest stop (--navy, 0%) plain --gold only hits 4.10:1. */
.section-contact .kicker-en { color: #c1a86b; }
.section-contact .kicker-zh { color: rgba(255, 255, 255, 0.65); }
.section-contact h2, .section-contact .h2-zh { color: #ffffff; }
.section-contact .h2-zh { color: #e8d3a4; }
.section-contact .section-header h2::before { background: var(--gold); }
.section-contact .lead-en { color: rgba(255, 255, 255, 0.82); }
.section-contact .lead-zh { color: rgba(255, 255, 255, 0.6); border-top-color: rgba(255, 255, 255, 0.2); }

/* ===== 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; }

.hl { color: var(--gold2); font-weight: 600; }
.bullets-zh .hl, .desc-zh .hl { color: var(--zh-heading); }
.bullets-en li::before, .bullets-zh li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.6em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* ===== Capabilities ===== */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 0;
}
.cap-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 26px -6px rgba(10, 33, 73, 0.14), 0 2px 6px rgba(10, 33, 73, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  --accent: var(--navy);
  --accent-text: var(--navy);
}
.cap-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px -8px rgba(10, 33, 73, 0.2), 0 2px 6px rgba(10, 33, 73, 0.07);
}
.cap-card[data-accent="2"] { --accent: var(--gold2); --accent-text: var(--gold2); }
.cap-card[data-accent="3"] { --accent: var(--orange); --accent-text: var(--orange-text); }
.cap-card[data-accent="4"] { --accent: var(--sky); --accent-text: var(--sky-text); }
.cap-card[data-accent="5"] { --accent: var(--green); --accent-text: var(--green-text); }
.cap-card[data-accent="6"] { --accent: var(--navy-dark); --accent-text: var(--navy-dark); }

/* ===== Card-in-card head — a solid gradient-shaded banner (not just a
   tint) so the category color reads as the dominant signal at a glance
   across a large grid, plus a corner glow for a bit of shine. It sits
   flush against the card's own top corners: the card has overflow:hidden
   and the head has no border-radius of its own, so the parent's rounding
   clips it automatically — no need to duplicate the radius value.
   .card-watermark is a large, low-opacity index numeral behind the body
   text, purely decorative (pointer-events:none) — sits below the head in
   DOM order so the head's opaque background naturally paints over it,
   and low enough in the card that it doesn't collide with body text. ===== */
.card-head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  /* --accent-text, not --accent — this banner is a solid fill with white
     text on top, so it needs the WCAG-safe darkened variant. orange/sky/
     green at full brightness (--accent) only hit 2.0–2.8:1 against white,
     failing AA even at the 3.0:1 large-text threshold. --accent-text
     (~4.5:1+) was already defined for exactly this kind of case — see the
     .proj-tab active-state comment below for the same reasoning. Decorative,
     non-text uses (the watermark numeral, corner glow) keep the brighter
     --accent since contrast rules don't apply to decoration. */
  background: linear-gradient(135deg, var(--accent-text) 0%, color-mix(in srgb, var(--accent-text) 78%, black) 100%);
  padding: 0.9rem 1.1rem;
}
.card-head::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, transparent 70%);
  border-radius: 50%;
}
.cap-index {
  position: relative;
  font-family: var(--font-head);
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.card-head h3 { position: relative; font-size: 1.05rem; color: #ffffff; }
.card-head .h3-zh {
  position: relative;
  display: block;
  font-family: var(--font-zh);
  font-size: 0.92rem;
  font-weight: 600;
  color: #e8d3a4;
  margin-top: 0.3rem;
}
.card-watermark {
  position: absolute;
  bottom: -0.5rem;
  right: 0.4rem;
  font-family: var(--font-head);
  font-size: 4rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 9%, transparent);
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
.cap-card .bullets-en, .cap-card .bullets-zh { position: relative; padding: 0 1.1rem; margin-top: 0.9rem; gap: 0.45rem; }
.cap-card .bullets-en li, .cap-card .bullets-zh li { font-size: 0.85rem; }
.cap-card .bullets-zh { padding-top: 1.4rem; margin-top: 1rem; padding-bottom: 1.1rem; }

@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(--surface);
  border: 1.5px solid var(--border);
  padding: 0.55rem 1.05rem;
  border-radius: 100px;
  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, background 0.15s ease;
}
.proj-tab-en { font-family: var(--font-body); font-size: 0.82rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.03em; }
.proj-tab-zh { font-family: var(--font-zh); font-size: 0.66rem; color: var(--text3); }
.proj-tab:hover { border-color: var(--gold2); }
/* --accent-text (not --accent) fills the active tab's solid background —
   white text on top needs the darkened variant; orange/sky/green at full
   brightness fail WCAG AA against white (2.0–2.8:1). */
.proj-tab { --accent-text: var(--navy); }
.proj-tab[data-cat="saas"]    { --accent-text: var(--gold2); }
.proj-tab[data-cat="product"] { --accent-text: var(--orange-text); }
.proj-tab[data-cat="data"]    { --accent-text: var(--sky-text); }
.proj-tab[data-cat="tools"]   { --accent-text: var(--green-text); }
.proj-tab.active { background: var(--accent-text); border-color: var(--accent-text); }
.proj-tab.active .proj-tab-en { color: #ffffff; }
.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 {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 26px -6px rgba(10, 33, 73, 0.14), 0 2px 6px rgba(10, 33, 73, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  --accent: var(--navy);
  --accent-text: var(--navy);
}
.proj-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px -8px rgba(10, 33, 73, 0.2), 0 2px 6px rgba(10, 33, 73, 0.07);
}
.proj-card.hidden { display: none; }
.proj-card[data-cat="saas"]    { --accent: var(--gold2); --accent-text: var(--gold2); }
.proj-card[data-cat="product"] { --accent: var(--orange); --accent-text: var(--orange-text); }
.proj-card[data-cat="data"]    { --accent: var(--sky); --accent-text: var(--sky-text); }
.proj-card[data-cat="tools"]   { --accent: var(--green); --accent-text: var(--green-text); }

/* .card-head's gradient banner + corner glow come from the shared rule
   above (cap-card and proj-card both use it). proj-card's body — desc +
   stack — lives in .proj-body so it gets its own padding independent of
   the now-flush, padding-less .card-head. */
.proj-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem;
  flex: 1;
}
.proj-cat-tag {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.proj-cat-en {
  position: relative;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.62);
}
.proj-cat-zh { position: relative; font-family: var(--font-zh); font-size: 0.66rem; color: rgba(255, 255, 255, 0.5); }
.card-head h3.proj-title { font-size: 1rem; margin-top: 0.3rem; }
.proj-card .h3-zh {
  display: block;
  font-family: var(--font-zh);
  font-size: 0.9rem;
  font-weight: 600;
  color: #e8d3a4;
  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(--accent-text);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg2));
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
}

@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(--gold);
  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(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}
.text-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold2);
  box-shadow: 0px 14px 28px 0px rgba(10, 33, 73, 0.12);
  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; }
/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}
.footer-zh { font-family: var(--font-zh); display: block; margin-top: 0.25rem; color: rgba(255, 255, 255, 0.5); }

/* ===== Scroll reveal system — animation shape (keyframes, duration, the
   translate3d(±100%) "sweep") cloned from Elementor's own entrance-animation
   engine (assets/lib/animations + frontend/handlers/global.js GlobalHandler).
   Elements start visibility:hidden (not opacity:0, so they don't affect
   layout flow readers) and swap straight to "animated + <name>" once their
   delay elapses. Unlike Elementor's one-shot version, script.js re-arms each
   element when it's scrolled back out past the top — see script.js for why —
   so the class gets removed and re-added on the way back down. translate3d
   uses 100% of the element's own box (not a fixed px nudge) — that's what
   produces the "sweep" feel. ===== */
.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 {
  visibility: hidden;
}
.reveal.animated {
  visibility: visible;
  animation-duration: 1.25s;
  animation-fill-mode: both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 100%, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translate3d(0, -100%, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translate3d(-100%, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translate3d(100%, 0, 0); }
  to   { opacity: 1; transform: none; }
}
.reveal.fadeInUp    { animation-name: fadeInUp; }
.reveal.fadeInDown  { animation-name: fadeInDown; }
.reveal.fadeInLeft  { animation-name: fadeInLeft; }
.reveal.fadeInRight { animation-name: fadeInRight; }

/* ===== Reverse (leaving) sweep — plays the exit as an actual retreating
   animation instead of an instant classList.remove() snap. Each entrance
   direction gets the mirrored exit: enters-from-below retreats downward,
   enters-from-above retreats upward, and left/right retrace their own
   entry side. script.js swaps "animated + <anim>" for "leaving + <reverse
   anim>" and waits for animationend before letting the element fall back
   to the base hidden state, so the sweep genuinely reverses on scroll-up
   instead of the element just vanishing. ===== */
.reveal.leaving {
  visibility: visible;
  animation-duration: 0.6s;
  animation-timing-function: ease-in;
  animation-fill-mode: both;
}
@keyframes fadeOutDown {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(0, 100%, 0); }
}
@keyframes fadeOutUp {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(0, -100%, 0); }
}
@keyframes fadeOutLeft {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(-100%, 0, 0); }
}
@keyframes fadeOutRight {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(100%, 0, 0); }
}
.reveal.leaving.fadeOutDown  { animation-name: fadeOutDown; }
.reveal.leaving.fadeOutUp    { animation-name: fadeOutUp; }
.reveal.leaving.fadeOutLeft  { animation-name: fadeOutLeft; }
.reveal.leaving.fadeOutRight { animation-name: fadeOutRight; }

@media (prefers-reduced-motion: reduce) {
  .reveal { visibility: visible; }
  .reveal.animated { animation: none; }
}
