/* =========================================================================
   Wei Hao — site redesign
   Design system generated with UI/UX Pro Max skill:
   Swiss/technical minimal · monochrome zinc + blue accent · Inter + JetBrains Mono
   Light + dark (token-driven) · accessible (focus rings, reduced-motion)
   ========================================================================= */

/* ----- Tokens ----------------------------------------------------------- */
:root {
  --bg:        #ffffff;
  --bg-soft:   #fafafa;
  --surface:   #ffffff;
  --surface-2: #f4f4f5;
  --fg:        #09090b;
  --fg-muted:  #52525b;
  --fg-subtle: #71717a;
  --border:    #e4e4e7;
  --border-strong: #d4d4d8;
  --accent:    #2563eb;
  --accent-fg: #ffffff;
  --accent-soft: rgba(37, 99, 235, .10);
  --ring:      #2563eb;

  /* Cyber background layer */
  --cyber-line:    rgba(37, 99, 235, .16);
  --cyber-glow-a:  rgba(37, 99, 235, .16);
  --cyber-glow-b:  rgba(14, 165, 233, .14);
  --cyber-scan:    rgba(37, 99, 235, .14);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1080px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(9,9,11,.05), 0 1px 1px rgba(9,9,11,.04);
  --shadow-md: 0 6px 24px -8px rgba(9,9,11,.18);
  --step: cubic-bezier(.22,.61,.36,1);
}

html[data-theme="dark"] {
  --bg:        #09090b;
  --bg-soft:   #0c0c0e;
  --surface:   #131316;
  --surface-2: #1a1a1e;
  --fg:        #fafafa;
  --fg-muted:  #a1a1aa;
  --fg-subtle: #8b8b93;
  --border:    #27272a;
  --border-strong: #3f3f46;
  --accent:    #60a5fa;
  --accent-fg: #0b1220;
  --accent-soft: rgba(96, 165, 250, .14);
  --ring:      #60a5fa;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 10px 34px -12px rgba(0,0,0,.7);

  /* Cyber background layer (neon-tinted for dark mode) */
  --cyber-line:    rgba(96, 165, 250, .28);
  --cyber-glow-a:  rgba(96, 165, 250, .26);
  --cyber-glow-b:  rgba(34, 211, 238, .22);
  --cyber-scan:    rgba(125, 211, 252, .22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b; --bg-soft:#0c0c0e; --surface:#131316; --surface-2:#1a1a1e;
    --fg:#fafafa; --fg-muted:#a1a1aa; --fg-subtle:#8b8b93;
    --border:#27272a; --border-strong:#3f3f46;
    --accent:#60a5fa; --accent-fg:#0b1220; --accent-soft:rgba(96,165,250,.14); --ring:#60a5fa;
    --shadow-sm:0 1px 2px rgba(0,0,0,.5); --shadow-md:0 10px 34px -12px rgba(0,0,0,.7);
    --cyber-line:rgba(96,165,250,.28); --cyber-glow-a:rgba(96,165,250,.26);
    --cyber-glow-b:rgba(34,211,238,.22); --cyber-scan:rgba(125,211,252,.22);
  }
}

/* ----- Reset / base ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.rd {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02","cv03","cv04","cv11";
}
.rd img { max-width: 100%; height: auto; }

/* ----- Cyber dynamic background ---------------------------------------- */
/* Fixed, full-viewport decorative layer sitting behind all content.
   Three stacked animated elements: a drifting neon grid, slowly floating
   glow blobs, and a periodic scan sweep. Kept very subtle for readability. */
.cyberbg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.cyberbg > span { position: absolute; inset: 0; display: block; }

/* Outer span holds the viewport-fixed fade mask; the ::before holds the grid
   pattern and scrolls via a GPU-composited transform (reliable + smooth). */
.cyber-grid {
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 120% 85% at 50% 0%, #000 35%, transparent 88%);
          mask-image: radial-gradient(ellipse 120% 85% at 50% 0%, #000 35%, transparent 88%);
}
.cyber-grid::before {
  content: ""; position: absolute; left: -10%; right: -10%; top: -48px; bottom: -48px;
  background-image:
    linear-gradient(var(--cyber-line) 1.4px, transparent 1.4px),
    linear-gradient(90deg, var(--cyber-line) 1.4px, transparent 1.4px);
  background-size: 44px 44px;
  will-change: transform;
  animation: cyberScroll 5s linear infinite;
}
/* Travel exactly one tile (44px) so the loop is seamless. */
@keyframes cyberScroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, 44px, 0); }
}

.cyber-glow {
  background:
    radial-gradient(40% 40% at 12% 18%, var(--cyber-glow-a), transparent 68%),
    radial-gradient(38% 44% at 88% 12%, var(--cyber-glow-b), transparent 68%),
    radial-gradient(44% 40% at 72% 88%, var(--cyber-glow-a), transparent 70%);
  animation: cyberFloat 14s ease-in-out infinite alternate;
}
@keyframes cyberFloat {
  from { transform: translate3d(-4%, 2%, 0) scale(1); }
  to   { transform: translate3d(4%, -6%, 0) scale(1.12); }
}

.cyber-scan {
  inset: auto 0 auto 0; height: 220px;
  background: linear-gradient(180deg, transparent, var(--cyber-scan) 45%, transparent);
  filter: blur(2px);
  animation: cyberScan 6s linear infinite;
}
@keyframes cyberScan {
  0%   { transform: translateY(-240px); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cyber-grid::before, .cyber-glow, .cyber-scan { animation: none; }
  .cyber-scan { display: none; }
}
/* Plain content links get the accent color. Buttons, chips and icon buttons
   are excluded so they keep their own component colors — otherwise this rule
   (specificity 0,1,1) would override .btn/.chip (0,1,0) and e.g. paint the
   primary button's text blue-on-blue. */
.rd a:not(.btn):not(.chip):not(.iconbtn) { color: var(--accent); text-decoration: none; }
.rd a:not(.btn):not(.chip):not(.iconbtn):hover { text-decoration: underline; text-underline-offset: 3px; }
/* Component anchors are excluded above, so restore no-underline for them. */
.rd a.btn, .rd a.chip, .rd a.iconbtn { text-decoration: none; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* skip link */
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-fg);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200; font-size: 14px; }
.skip:focus { left: 0; }

/* ----- Nav -------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav__in { max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 18px; }
.nav__brand { font-weight: 700; letter-spacing: -.02em; color: var(--fg); font-size: 16px; }
.nav__brand:hover { text-decoration: none; }
.nav__brand .dot { color: var(--accent); }
.brand-rotate { color: var(--accent); }
.brand-caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  background: var(--accent); vertical-align: -2px; animation: caretBlink 1.05s step-end infinite; }
@keyframes caretBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .brand-caret { animation: none; } }
.nav__links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav__links a {
  color: var(--fg-muted); font-size: 14.5px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: color .16s var(--step), background .16s var(--step);
}
.nav__links a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.nav__links a.active { color: var(--fg); }
.iconbtn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--fg-muted); cursor: pointer; transition: all .16s var(--step);
}
.iconbtn:hover { color: var(--fg); border-color: var(--border-strong); }
.iconbtn svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
@media (max-width: 640px) {
  .nav__links a.navtext { display: none; }
}

/* ----- Hero ------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 26px 26px; color: var(--border); opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 70% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 70% 0%, #000 30%, transparent 75%);
  animation: heroDots 26s linear infinite;
}
@keyframes heroDots { from { background-position: 0 0; } to { background-position: 0 260px; } }
@media (prefers-reduced-motion: reduce) { .hero::before { animation: none; } }
.hero__in { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 88px 24px 64px;
  display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.eyebrow { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: 9px; margin: 0 0 20px; }
.eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 var(--accent-soft)} 70%{box-shadow:0 0 0 10px transparent} 100%{box-shadow:0 0 0 0 transparent} }
@media (prefers-reduced-motion: reduce){ .eyebrow .pulse{ animation:none } }

.hero h1 { font-size: clamp(2.6rem, 6vw, 4.3rem); line-height: 1.02; letter-spacing: -.035em;
  margin: 0 0 18px; font-weight: 700; }
.hero__lead { font-size: clamp(1.06rem, 2.2vw, 1.3rem); color: var(--fg-muted); max-width: 40ch;
  margin: 0 0 14px; line-height: 1.5; }
.hero__lead strong { color: var(--fg); font-weight: 600; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--fg-subtle); font-size: 14.5px;
  margin: 22px 0 28px; }
.hero__meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero__meta svg { width: 15px; height: 15px; opacity: .8; }

.hero__photo { width: 188px; height: 188px; border-radius: 22px; object-fit: cover;
  border: 1px solid var(--border); box-shadow: var(--shadow-md); }
@media (max-width: 760px) {
  .hero__in { grid-template-columns: 1fr; padding-top: 56px; }
  .hero__photo { width: 120px; height: 120px; order: -1; }
}

/* buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  transition: transform .15s var(--step), background .15s var(--step), border-color .15s var(--step), box-shadow .15s var(--step);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--fg-subtle); box-shadow: var(--shadow-sm); }
.btn--primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn--primary:hover { box-shadow: 0 8px 22px -8px var(--accent); }
@media (prefers-reduced-motion: reduce){ .btn:hover{ transform:none } }

/* ----- Sections --------------------------------------------------------- */
.section { padding: 72px 0; border-bottom: 1px solid var(--border); }
/* Slightly translucent so the cyber background subtly shows through. */
.section--soft { background: color-mix(in srgb, var(--bg-soft) 86%, transparent); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 34px; }
.section__kicker { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-subtle); }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.025em; margin: 6px 0 0; font-weight: 700; }
.section__more { font-size: 14px; font-weight: 600; font-family: var(--font-mono); white-space: nowrap; }

/* vision prose */
.vision { font-size: clamp(1.25rem, 2.6vw, 1.7rem); line-height: 1.5; letter-spacing: -.015em;
  max-width: 24ch; font-weight: 400; }
.vision-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: start; }
.vision-body p { color: var(--fg-muted); max-width: 62ch; margin: 0 0 16px; }
.vision-body p strong { color: var(--fg); font-weight: 600; }
.pillars { display: grid; gap: 14px; margin-top: 26px; }
.pillar { display: flex; gap: 14px; padding: 16px 18px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); }
.pillar__ic { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.pillar__ic svg { width: 19px; height: 19px; }
.pillar h3 { margin: 0 0 3px; font-size: 15.5px; letter-spacing: -.01em; }
.pillar p { margin: 0; font-size: 14px; color: var(--fg-muted); line-height: 1.5; }
@media (max-width: 760px){ .vision-grid{ grid-template-columns:1fr; gap:28px } .vision{ max-width:none } }

/* publications */
.pubs { display: grid; gap: 0; }
.pub {
  display: grid; grid-template-columns: 116px 1fr; gap: 22px; padding: 24px 0;
  border-top: 1px solid var(--border); align-items: start;
}
.pub:last-child { border-bottom: 1px solid var(--border); }
.pub__venue { padding-top: 2px; }
.vbadge { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px;
  display: inline-block; letter-spacing: .01em; }
.pub__year { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); margin-top: 8px; }
.pub__title { font-size: 1.12rem; font-weight: 600; letter-spacing: -.015em; margin: 0 0 6px; line-height: 1.35; }
.pub__title a { color: var(--fg); }
.pub__title a:hover { color: var(--accent); }
.pub__authors { font-size: 14.5px; color: var(--fg-muted); margin: 0 0 12px; line-height: 1.5; }
.pub__authors .me { color: var(--fg); font-weight: 600; }
.pub__links { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--border); color: var(--fg-muted); background: var(--surface);
  transition: all .15s var(--step); }
.chip svg { width: 13px; height: 13px; }
.chip:hover { color: var(--fg); border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.chip--award { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-soft); }
.chip--award:hover { color: var(--accent); }
@media (max-width: 620px){
  .pub{ grid-template-columns: 1fr; gap: 10px; }
  .pub__venue{ display:flex; align-items:center; gap:10px; }
  .pub__year{ margin-top:0; }
}

/* awards */
.awards { display: grid; gap: 0; }
.award { display: grid; grid-template-columns: 84px 1fr auto; gap: 20px; align-items: baseline;
  padding: 20px 0; border-top: 1px solid var(--border); }
.award:last-child { border-bottom: 1px solid var(--border); }
.award__yr { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 600; }
.award__name { font-weight: 600; font-size: 1.04rem; letter-spacing: -.01em; }
.award__name a { color: var(--fg); }
.award__name a:hover { color: var(--accent); }
.award__desc { color: var(--fg-muted); font-size: 14px; margin-top: 4px; max-width: 70ch; }
.award__tag { font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-subtle); white-space: nowrap; }
@media (max-width: 620px){
  .award{ grid-template-columns: 1fr; gap: 4px; }
  .award__tag{ order: 3; }
}

/* news timeline */
.news { position: relative; margin-left: 6px; }
.news::before { content:""; position:absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: var(--border); }
.news__item { position: relative; padding: 0 0 26px 30px; }
.news__item:last-child { padding-bottom: 0; }
.news__item::before { content:""; position:absolute; left: 0; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--border-strong); }
.news__item--hl::before { background: var(--accent); border-color: var(--accent); }
.news__date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); }
.news__body { margin-top: 3px; color: var(--fg); font-size: 15px; line-height: 1.55; }
.news__body a { font-weight: 500; }
.news__more { margin-top: 8px; }
.collapsed { display: none; }

/* talks */
.talks { display: grid; gap: 14px; }
.talk { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s var(--step), box-shadow .15s var(--step), transform .15s var(--step); }
.talk:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.talk__yr { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 600; padding-top: 2px; }
.talk h3 { margin: 0 0 5px; font-size: 1.04rem; letter-spacing: -.01em; }
.talk__meta { font-size: 13.5px; color: var(--fg-subtle); font-family: var(--font-mono); margin-bottom: 8px; }
.talk p { margin: 0 0 8px; color: var(--fg-muted); font-size: 14.5px; }

/* generic page content (publications/talks standalone pages) */
.page-hd { padding: 64px 0 8px; }
.page-hd .eyebrow { margin-bottom: 14px; }
.page-hd h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.03em; margin: 0 0 10px; }
.page-hd p { color: var(--fg-muted); max-width: 60ch; margin: 0; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 2.2em; }
.prose p, .prose li { color: var(--fg-muted); }
.prose strong { color: var(--fg); }

/* ----- Footer ----------------------------------------------------------- */
.foot { padding: 56px 0 64px; }
.foot__in { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.foot__cta h2 { font-size: clamp(1.4rem,3vw,1.9rem); letter-spacing: -.02em; margin: 0 0 6px; }
.foot__cta p { margin: 0; color: var(--fg-muted); }
.social { display: flex; gap: 10px; }
.social a { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  border: 1px solid var(--border); color: var(--fg-muted); background: var(--surface);
  transition: all .16s var(--step); }
.social a:hover { color: var(--fg); border-color: var(--border-strong); transform: translateY(-2px); text-decoration: none; }
.social svg { width: 19px; height: 19px; }
.foot__legal { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  color: var(--fg-subtle); font-size: 13px; font-family: var(--font-mono); }
@media (prefers-reduced-motion: reduce){ *{ animation-duration:.001ms !important; transition-duration:.001ms !important } }
