/* ==========================================================
   Cheng-Kai (Kai) Hsu — personal site
   Modern sans-serif · single ASU-maroon accent · cool neutrals
   ========================================================== */
:root {
  --bg: #f8f7f7;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --text: #151214;
  --text-2: #433c3f;
  --muted: #74696d;
  --line: #e8e3e5;
  --line-strong: #d6cfd2;
  --accent: #8c1d40;        /* ASU maroon */
  --accent-hover: #6e1532;
  --accent-soft: #f6e9ee;
  --gold: #ffc627;          /* ASU gold — small touches only */
  --gold-soft: #fff3cc;
  --green: #2a6648;         /* forest green — small touches only */
  --green-soft: #e6f2ea;
  --radius: 12px;
  --max: 1080px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;
}

/* ==========================================================
   Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.1; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
sub { font-size: 0.7em; }

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ==========================================================
   Header / nav
   ========================================================== */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--max); margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.logo {
  font-family: var(--display); font-weight: 800; font-size: 1rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
}
.logo::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--gold); }
.nav-links { display: flex; gap: 4px; font-size: 0.875rem; font-weight: 500; }
.nav-links a {
  color: var(--text-2); text-decoration: none; padding: 6px 10px; border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; padding: 8px; cursor: pointer;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.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); }

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  max-width: var(--max); margin: 0 auto; padding: 96px 24px 88px;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 20px;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--gold); border-radius: 2px; }
h1 {
  font-size: clamp(2.4rem, 5vw, 3.9rem); font-weight: 800; letter-spacing: -0.035em;
  margin-bottom: 16px; color: var(--text);
}
h1 .honorific { font-weight: inherit; color: inherit; letter-spacing: inherit; }
h1 .nickname { color: var(--accent); font-weight: 500; }
.affiliation-logo { display: block; margin: 18px 0 0; }
.affiliation-logo img { height: 44px !important; width: auto !important; border: 0 !important; border-radius: 0 !important; }
.hero-title { font-size: 1rem; line-height: 1.55; color: var(--text-2); margin-bottom: 24px; }
.hero-title a { color: inherit; text-decoration-color: var(--line-strong); }
.hero-title a:hover { color: var(--accent); }
.lead { font-size: 1.15rem; line-height: 1.65; max-width: 600px; color: var(--text-2); }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.button {
  display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 0.875rem; text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.button:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.button.ghost { background: transparent; }

.portrait { margin: 0; justify-self: end; text-align: left; width: 300px; }
.portrait > img, .portrait-fallback {
  width: 300px; height: 300px; border-radius: 20px; object-fit: cover; object-position: center top;
  margin: 0; border: 1px solid var(--line);
}
.portrait-fallback {
  display: none; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--display); font-size: 4rem; font-weight: 800;
}
.portrait figcaption { display: none; }

/* ==========================================================
   Sections
   ========================================================== */
.section { max-width: var(--max); margin: 0 auto; padding: 88px 24px; }
.section.alt {
  max-width: none; background: var(--bg-alt);
  padding-left: max(24px, calc((100% - var(--max)) / 2 + 24px));
  padding-right: max(24px, calc((100% - var(--max)) / 2 + 24px));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.section.alt + .section.alt { border-top: 0; }

.section-head { margin-bottom: 36px; }
h2 { font-size: clamp(1.7rem, 2.8vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 12px; }
.section-intro { color: var(--muted); max-width: 600px; font-size: 1rem; }

.two-column { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; align-items: start; }
.two-column .section-head { position: sticky; top: 96px; margin-bottom: 0; }

.text-block p { color: var(--text-2); max-width: 66ch; }
.text-block .intro { color: var(--text); font-size: 1.2rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.5; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; margin: 36px 0 0; padding-top: 28px; border-top: 1px solid var(--line); }
.facts-col { display: grid; gap: 28px; align-content: start; }
.facts-col > div + div { padding-top: 20px; border-top: 1px solid var(--line); }
.facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.facts dd { margin: 0; color: var(--text); font-size: 0.93rem; line-height: 1.6; }

/* Research cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.section-body { min-width: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: border-color .15s ease;
}
.card:hover { border-color: var(--green); }
.card-number {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--green-soft); color: var(--green);
  font-family: var(--display); font-size: 0.8rem; font-weight: 800; margin-bottom: 18px;
}
.card h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 10px; }
.card p { color: var(--text-2); font-size: 0.93rem; }
.card-meta a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.card-meta a:hover { color: var(--green); border-color: var(--green); }
.card-meta { margin-top: 16px !important; font-size: 0.75rem !important; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted) !important; font-weight: 600; }

/* Publications */
.pub-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.chip {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text-2);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--text); border-color: var(--text); color: #fff; }

.pub-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pub {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.pub[hidden] { display: none; }
.pub-year { font-family: var(--display); font-weight: 700; font-size: 0.85rem; color: var(--green); padding-top: 3px; }
.pub-title { font-weight: 600; color: var(--text); text-decoration: none; font-size: 1rem; line-height: 1.45; letter-spacing: -0.005em; }
a.pub-title:hover { color: var(--accent); }
.pub-authors { color: var(--text-2); font-size: 0.875rem; margin: 6px 0 2px; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { color: var(--muted); font-size: 0.875rem; }
.pub-venue em { font-style: normal; }
.pub.featured .pub-year::after {
  content: "Featured"; display: inline-block; margin-top: 8px; padding: 2px 7px; border-radius: 6px;
  background: var(--gold-soft); color: #7a5a00;
  font-family: var(--sans); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}

/* Timeline (awards / news) */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li {
  display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 20px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.timeline time { font-family: var(--display); font-weight: 700; font-size: 0.85rem; color: var(--green); padding-top: 2px; }
.timeline p { color: var(--text-2); }
.timeline.awards p strong { color: var(--text); font-weight: 600; }
.timeline.awards p { font-size: 0.95rem; line-height: 1.5; }
.timeline.awards time { color: var(--green); }

/* Media & talks */
.timeline.media p strong { display: block; font-weight: 600; color: var(--text); }
.timeline.media p strong a { color: var(--text); text-decoration: none; }
.timeline.media p strong a:hover { color: var(--accent); }
.media-source { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.media-item { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; align-items: start; }
.media-thumb { position: relative; display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.media-thumb img { width: 120px; height: 90px; object-fit: cover; display: block; }
.media-thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.media-thumb .play::before {
  content: ""; width: 0; height: 0; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent;
  margin-left: 3px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
.media-thumb:hover img { opacity: .85; }

/* Callout */
.callout {
  margin-top: 28px; padding: 24px 28px; border-radius: var(--radius);
  background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
}
.callout h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.callout p { color: var(--text-2); font-size: 0.93rem; margin-bottom: 16px; max-width: none; }

/* Contact */

.contact-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 32px; max-width: 520px;
}
.contact-card address { font-style: normal; color: var(--text-2); line-height: 1.65; margin-bottom: 14px; font-size: 0.95rem; }
.contact-card address strong { color: var(--text); font-weight: 600; }
.contact-card p a { font-weight: 600; }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.875rem; font-weight: 600; }

footer { padding: 32px 24px; text-align: center; color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--muted); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 56px; gap: 36px; }
  .portrait { justify-self: start; order: -1; }
  .portrait > img, .portrait-fallback { width: 140px; height: 140px; border-radius: 16px; font-size: 2.4rem; }
  .two-column, .contact-section { grid-template-columns: 1fr; gap: 24px; }
  .two-column .section-head { position: static; }
  .grid { grid-template-columns: 1fr; }
  .section { padding: 64px 24px; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 16px 12px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px 10px; border-radius: 8px; }
  .pub { grid-template-columns: 1fr; gap: 4px; }
  .pub.featured .pub-year::after { margin: 0 0 0 10px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .media-item { grid-template-columns: 100px minmax(0, 1fr); gap: 12px; }
  .media-thumb img { width: 100px; height: 75px; }
  .facts { grid-template-columns: 1fr; }
  .buttons .button { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button, .nav-toggle span, .card, .chip { transition: none; }
}
