/* ==========================================================================
   Mushuang Liu — main stylesheet
   Palette: Virginia Tech brand colors (maroon primary, orange accent).
   Brand rule: maroon/orange may be darkened, never tinted; soft surfaces
   use warm-grey neutrals instead.
   ========================================================================== */

:root {
  /* Brand */
  --brand: #861f41;          /* Chicago Maroon */
  --brand-dark: #6b1934;     /* darkened maroon for hover */
  --accent: #e5751f;         /* Burnt Orange: fills/decoration only, never text */
  --accent-text: #c64600;    /* Impact Orange: the web-safe orange for text/thin UI */
  --stone: #75787b;          /* Hokie Stone: borders/decoration, not small text */

  /* Neutrals */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-tint: #f7f5f7;
  --ink: #171819;
  --ink-muted: #5e6062;      /* 6.3:1 on white */
  --line: #e5e1e6;
  --line-strong: #cfcbd0;
  --on-brand: #ffffff;
  --footer-text: #d6d4d7;

  /* Type */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --fs-sm: 0.875rem;
  --fs-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --fs-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-h3: clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);
  --fs-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-h1: clamp(2.5rem, 1.7rem + 3.8vw, 4.5rem);

  /* Layout */
  --container: 1140px;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --header-h: 4rem;
  --radius-sm: 0.5rem;
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --section-space: clamp(4rem, 3rem + 5vw, 7rem);

  --shadow-sm: 0 1px 2px rgb(23 24 25 / 0.06);
  --shadow: 0 1px 2px rgb(23 24 25 / 0.05), 0 8px 24px -8px rgb(23 24 25 / 0.14);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Base ------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--brand);
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

a:hover {
  color: var(--brand-dark);
  text-decoration-color: var(--accent);
}

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

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

section[id],
[id="main"] {
  scroll-margin-top: var(--header-h);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: none;
  color: var(--on-brand);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.eyebrow::before {
  content: "";
  width: 1.5rem;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

/* Header ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(255 255 255 / 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand:hover {
  color: var(--brand);
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.site-nav a:hover {
  background: var(--surface-tint);
  color: var(--brand);
}

.site-nav .nav-external {
  background: var(--brand);
  color: var(--on-brand);
}

.site-nav .nav-external:hover {
  background: var(--brand-dark);
  color: var(--on-brand);
}

.nav-toggle {
  display: none;
}

/* Mobile navigation: only collapses when JS is available (html.js) */
@media (max-width: 55.99rem) {
  .js .nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 0.75rem;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
  }

  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 1.15rem;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
  }

  .nav-toggle-bars {
    position: relative;
  }

  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .nav-toggle-bars::before {
    top: -6px;
  }

  .nav-toggle-bars::after {
    top: 6px;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Without JS the links simply wrap below the brand */
  .header-inner {
    flex-wrap: wrap;
  }

  .site-nav {
    width: 100%;
    padding-bottom: 0.75rem;
  }

  .site-nav ul {
    flex-wrap: wrap;
  }

  .js .header-inner {
    flex-wrap: nowrap;
  }

  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    padding: 0.75rem var(--gutter) 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px -12px rgb(23 24 25 / 0.18);
  }

  .js .site-nav:not(.is-open) {
    display: none;
  }

  .js .site-nav ul {
    flex-direction: column;
    gap: 0.25rem;
  }

  .js .site-nav a {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
  }

  .js .site-nav .nav-external {
    margin-top: 0.5rem;
    text-align: center;
  }
}

/* Buttons & links -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 16px -8px rgb(23 24 25 / 0.45);
}

.btn-primary:hover {
  background: var(--brand-dark);
  color: var(--on-brand);
}

.btn-ghost {
  border: 1.5px solid var(--brand);
  color: var(--brand);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--brand);
  color: var(--on-brand);
}

.link-arrow {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

/* Hero ------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(2.5rem, 2rem + 4vw, 5.5rem) clamp(3rem, 2rem + 5vw, 6rem);
  overflow: hidden;
}

.hero-inner {
  position: relative;
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
}

.hero-title {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: 1.25rem;
}

.hero-role {
  max-width: 44ch;
  padding-left: 1rem;
  border-left: 3px solid var(--brand);
  margin-bottom: 2.25rem;
  line-height: 1.5;
}

.hero-role p {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 500;
}

.hero-role p + p {
  margin-top: 0.25rem;
  font-size: var(--fs-base);
  color: var(--ink-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list li {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-muted);
}

.hero-media {
  position: relative;
  justify-self: center;
  width: min(100%, 480px);
}

.hero-media::after {
  /* small dotted grid accent */
  content: "";
  position: absolute;
  left: -1rem;
  top: -1rem;
  width: 5.5rem;
  height: 5.5rem;
  background-image: radial-gradient(var(--stone) 1.4px, transparent 1.6px);
  background-size: 11px 11px;
  opacity: 0.5;
}

.hero-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

@media (min-width: 60rem) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }

  .hero-media {
    justify-self: end;
    width: min(100%, 440px);
  }
}

/* Sections --------------------------------------------------------------- */

.section {
  padding-block: var(--section-space);
}

.section-head {
  max-width: 60rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-head h2 {
  font-size: var(--fs-h2);
}

.section-intro {
  margin-top: 1.25rem;
  font-size: var(--fs-lg);
  color: var(--ink-muted);
}

/* About ------------------------------------------------------------------ */

.about {
  background: var(--surface-tint);
  border-block: 1px solid var(--line);
}

.about-grid {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
}

.about-bio {
  max-width: 60rem;
}

.about-bio .section-head {
  margin-bottom: 1.25rem;
}

.about-bio > p {
  font-size: var(--fs-lg);
}

.about-timeline {
  display: grid;
  gap: 2rem clamp(2rem, 5vw, 4rem);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.timeline-heading {
  margin-bottom: 1.25rem;
  font-size: var(--fs-sm);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.timeline {
  list-style: none;
  position: relative;
  display: grid;
  gap: 1.25rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--line);
}

.timeline li {
  position: relative;
  display: grid;
  padding-left: 1.75rem;
  line-height: 1.45;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand);
}

.timeline li:first-child::before {
  background: var(--brand);
}

.timeline-date {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.timeline-role {
  font-weight: 600;
}

.timeline-org {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

@media (min-width: 48rem) {
  .about-timeline {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
}

/* Research --------------------------------------------------------------- */

.card-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card-icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.55rem;
  margin-bottom: 1.25rem;
  border-radius: 0.75rem;
  background: var(--surface-tint);
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card h3 {
  margin-bottom: 0.75rem;
  font-size: var(--fs-h3);
}

.card p {
  color: var(--ink-muted);
  font-size: 0.97rem;
}

.research-more {
  margin-top: 2.5rem;
}

/* Awards ----------------------------------------------------------------- */

.awards {
  background: var(--surface-tint);
  border-block: 1px solid var(--line);
}

.award-list {
  list-style: none;
  max-width: 54rem;
  border-top: 1px solid var(--line-strong);
}

.award-list li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line-strong);
  line-height: 1.5;
}

.award-year {
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.award-title {
  font-weight: 500;
}

/* Service ---------------------------------------------------------------- */

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 1.25rem;
}

.service-group {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.service-group h3 {
  margin-bottom: 1rem;
  font-size: var(--fs-h3);
}

.service-note {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
}

.service-group ul {
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.service-group li,
.service-group p {
  position: relative;
  color: var(--ink-muted);
  font-size: 0.97rem;
  line-height: 1.55;
}

.service-group li {
  padding-left: 1.1rem;
}

.service-group li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.service-group cite {
  font-style: italic;
}

/* Contact ---------------------------------------------------------------- */

.contact {
  background: var(--surface-tint);
  border-top: 1px solid var(--line);
}

.contact-grid {
  display: grid;
  gap: 2.5rem;
}

.contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 1.5rem 2rem;
  margin: 0;
}

.contact-item {
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}

.contact-item dt {
  margin-bottom: 0.25rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.contact-item dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
}

.contact-item a {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.contact-links {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
}

.link-card {
  position: relative;
  display: grid;
  height: 100%;
  padding: 1rem 3.25rem 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.link-card:hover {
  color: var(--ink);
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.link-card-title {
  font-weight: 600;
}

.link-card-sub {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.link-card-arrow {
  position: absolute;
  right: 1.1rem;
  top: 50%;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--brand);
  font-size: 0.95rem;
  transform: translateY(-50%);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.link-card:hover .link-card-arrow {
  background: var(--brand);
  color: var(--on-brand);
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
  padding-block: 2rem;
  background: var(--ink);
  color: var(--footer-text);
  font-size: var(--fs-sm);
}

/* 404 -------------------------------------------------------------------- */

.notfound {
  min-height: calc(100vh - var(--header-h) - 6rem);
  display: grid;
  align-content: center;
  padding-block: var(--section-space);
}

.notfound h1 {
  font-size: var(--fs-h1);
  margin-bottom: 1rem;
}

.notfound p:not(.eyebrow) {
  max-width: 40ch;
  color: var(--ink-muted);
  font-size: var(--fs-lg);
  margin-bottom: 2rem;
}

/* Reveal on scroll (only once JS has opted in) -------------------------- */

.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }

  .btn:hover,
  .card:hover,
  .link-card:hover {
    transform: none;
  }
}
