/*
 * Zhaonan Dong — personal website
 *
 * Quick edits:
 *   1. Change colours and spacing in :root.
 *   2. Shared name/contact/navigation live in site.js.
 *   3. Page content lives in the matching HTML file.
 */

:root {
  --ink: #17242f;
  --ink-soft: #4f5f6c;
  --navy: #163a59;
  --navy-deep: #0d2a41;
  --blue: #247da3;
  --accent: #e74524;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --line: #dce3e6;
  --line-strong: #c5d0d5;
  --shadow: 0 16px 50px rgba(18, 45, 66, 0.08);
  --radius: 18px;
  --content: 1120px;
  --text: 72ch;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 0%, rgba(36, 125, 163, 0.08), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--blue);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--navy-deep);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.16;
}

h1 {
  font-size: clamp(2.7rem, 6vw, 5.4rem);
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.28rem;
}

.container {
  width: min(calc(100% - 40px), var(--content));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  color: #fff;
  background: var(--navy-deep);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(197, 208, 213, 0.75);
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(14px);
}

.nav-shell {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  color: var(--navy-deep);
  text-decoration: none;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.2;
}

.brand span {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

.site-nav a {
  padding: 8px 13px;
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--navy-deep);
  background: #fff;
  box-shadow: 0 3px 16px rgba(18, 45, 66, 0.08);
}

.menu-button {
  display: none;
  padding: 8px 12px;
  color: var(--navy-deep);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

main {
  min-height: 60vh;
}

.hero,
.page-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(68px, 10vw, 130px);
}

.hero::after,
.page-hero::after {
  position: absolute;
  z-index: -1;
  top: 16%;
  right: max(-14vw, -180px);
  width: min(36vw, 430px);
  aspect-ratio: 1;
  border: 1px solid rgba(36, 125, 163, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgba(36, 125, 163, 0.035),
    0 0 0 104px rgba(36, 125, 163, 0.025);
  content: "";
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(290px, 0.65fr);
  align-items: end;
  gap: clamp(40px, 7vw, 86px);
}

.eyebrow {
  margin-bottom: 17px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 20px;
}

.hero h1 span {
  display: block;
  margin-top: 8px;
  color: var(--blue);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.44em;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.hero-role {
  max-width: 590px;
  margin-bottom: 28px;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.5vw, 1.72rem);
  line-height: 1.4;
}

.button-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.button-link:hover {
  color: #fff;
  background: var(--accent);
}

.affiliations {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.affiliation {
  display: block;
  padding: 22px 24px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
  text-decoration: none;
}

.affiliation strong,
.affiliation span {
  display: block;
}

.affiliation strong {
  margin-bottom: 4px;
  color: var(--navy-deep);
}

.affiliation span {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.content-section {
  padding-block: 40px 84px;
}

.section-heading {
  max-width: var(--text);
  margin-bottom: 28px;
}

.section-heading p,
.page-intro {
  max-width: var(--text);
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.card {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.card--wide {
  grid-column: 1 / -1;
}

.card h2,
.card h3 {
  margin-bottom: 14px;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  padding-block: 13px;
  border-top: 1px solid var(--line);
}

.clean-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.clean-list strong {
  color: var(--navy-deep);
}

.muted {
  color: var(--ink-soft);
}

.page-hero {
  padding-bottom: 58px;
}

.page-hero h1 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.5rem, 5vw, 4.65rem);
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding-block: 20px;
  border-top: 1px solid var(--line);
}

.timeline li:first-child {
  padding-top: 0;
  border-top: 0;
}

.timeline time {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.timeline p {
  margin-bottom: 0;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.people-grid a,
.people-grid span {
  display: flex;
  min-height: 72px;
  align-items: center;
  padding: 16px 18px;
  color: var(--navy-deep);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.86);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.people-grid a:hover {
  color: var(--accent);
  border-color: rgba(231, 69, 36, 0.38);
  transform: translateY(-1px);
}

.publication-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: clamp(30px, 6vw, 72px);
  padding-bottom: 100px;
}

.publication-toc {
  position: sticky;
  top: 106px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.publication-toc strong {
  display: block;
  margin: 0 8px 8px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.publication-toc a {
  display: block;
  padding: 7px 8px;
  color: var(--ink-soft);
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.35;
  text-decoration: none;
}

.publication-toc a:hover {
  color: var(--navy-deep);
  background: #fff;
}

.publication-section {
  scroll-margin-top: 105px;
  margin-bottom: 70px;
}

.publication-section h2.publication-section-heading {
  margin-bottom: 18px;
  padding: 16px 20px;
  color: var(--navy-deep);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.publication-list {
  counter-reset: publication;
}

.publication-entry {
  position: relative;
  padding: 25px 0 25px 50px;
  border-bottom: 1px solid var(--line);
  counter-increment: publication;
}

.publication-entry::before {
  position: absolute;
  top: 25px;
  left: 0;
  width: 34px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: right;
  content: counter(publication, decimal-leading-zero);
}

.publication-authors {
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.publication-citation {
  display: inline;
  max-width: none;
  margin-bottom: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
  line-height: 1.55;
}

.publication-title {
  color: var(--navy-deep);
  font-weight: 750;
}

.publication-venue {
  font-style: italic;
}

.publication-note {
  font-style: italic;
}

.publication-links {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 7px;
  margin-left: 8px;
  vertical-align: baseline;
  white-space: nowrap;
}

.publication-links a {
  padding: 4px 9px;
  color: var(--navy);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.publication-links a:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.book-feature {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin-bottom: 34px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.book-feature img {
  border-radius: 5px;
  box-shadow: 0 10px 30px rgba(18, 45, 66, 0.2);
}

.book-feature p:last-child {
  margin-bottom: 0;
}

.site-footer {
  padding: 48px 0 28px;
  color: rgba(255, 255, 255, 0.8);
  background: var(--navy-deep);
}

.footer-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 36px;
  align-items: start;
}

.site-footer h2 {
  margin-bottom: 12px;
  color: #fff;
  font-size: 1.4rem;
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list a {
  color: #fff;
}

.institution-banner {
  padding: 14px;
  border-radius: 10px;
  background: #fff;
}

.institution-banner img {
  width: 100%;
  height: auto;
}

.footer-bottom {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
}

@media (max-width: 860px) {
  .menu-button {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 20px;
    left: 20px;
    display: none;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .site-nav[data-open="true"] {
    display: grid;
  }

  .site-nav a {
    padding: 11px 13px;
  }

  .hero-grid,
  .publication-layout,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .publication-toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .publication-toc strong {
    width: 100%;
  }

  .publication-toc a {
    border: 1px solid var(--line);
  }

  .people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    font-size: 16px;
  }

  .container {
    width: min(calc(100% - 28px), var(--content));
  }

  .brand span {
    display: none;
  }

  .hero,
  .page-hero {
    padding-block: 62px;
  }

  .card-grid,
  .people-grid {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .publication-entry {
    padding-left: 0;
  }

  .publication-entry::before {
    display: none;
  }

  .book-feature {
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 18px;
  }
}

@media print {
  .site-header,
  .site-footer,
  .publication-toc,
  .button-link {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  .page-hero {
    padding: 20px 0;
  }

  .publication-layout {
    display: block;
  }

  .publication-section h2.publication-section-heading {
    border: 1px solid #999;
    box-shadow: none;
  }

  .publication-entry {
    break-inside: avoid;
  }
}
