/* ==========================================================================
   Xuzhong Wang — personal site
   Tokens · Base · Layout · Components · Motion
   ========================================================================== */

:root {
  /* Light palette — warm paper, ink, Columbia blue */
  --bg: #fcfbf9;
  --bg-alt: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #f7f5f1;
  --text: #1a1917;
  --text-muted: #635f57;
  --text-faint: #8b867c;
  --accent: #14477e;
  --accent-2: #2f7fb5;
  --accent-soft: #e3ecf6;
  --brand-blue: #b9d9eb;
  --border: #e4e1da;
  --border-strong: #d2cdc3;
  --shadow-sm: 0 1px 2px rgba(26, 25, 23, 0.05);
  --shadow-md: 0 1px 2px rgba(26, 25, 23, 0.04), 0 8px 22px rgba(26, 25, 23, 0.06);
  --shadow-lg: 0 2px 6px rgba(20, 71, 126, 0.06), 0 18px 44px rgba(20, 71, 126, 0.12);
  --dot: rgba(20, 71, 126, 0.14);

  --max-width: 760px;
  --max-width-wide: 1040px;

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --bg-alt: #16181b;
    --surface: #1a1c20;
    --surface-2: #202329;
    --text: #eae7e0;
    --text-muted: #a7a298;
    --text-faint: #7d786e;
    --accent: #8fc1e8;
    --accent-2: #b9d9eb;
    --accent-soft: #1c2b3a;
    --brand-blue: #3f6a90;
    --border: #2a2d32;
    --border-strong: #3a3e45;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 44px rgba(0, 0, 0, 0.45);
    --dot: rgba(143, 193, 232, 0.16);
  }
}

:root[data-theme="dark"] {
  --bg: #111214;
  --bg-alt: #16181b;
  --surface: #1a1c20;
  --surface-2: #202329;
  --text: #eae7e0;
  --text-muted: #a7a298;
  --text-faint: #7d786e;
  --accent: #8fc1e8;
  --accent-2: #b9d9eb;
  --accent-soft: #1c2b3a;
  --brand-blue: #3f6a90;
  --border: #2a2d32;
  --border-strong: #3a3e45;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 44px rgba(0, 0, 0, 0.45);
  --dot: rgba(143, 193, 232, 0.16);
}

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

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

a { color: inherit; }

img { max-width: 100%; }

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap-wide { max-width: var(--max-width-wide); }

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

/* --------------------------------------------------------------------------
   Scroll progress
   -------------------------------------------------------------------------- */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand-blue), var(--accent-2), var(--accent));
  z-index: 50;
  will-change: transform;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.site-header.is-stuck {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease);
}

.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* Anchor nav */
.section-nav { display: flex; gap: 0.2rem; }

.section-nav a {
  position: relative;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.section-nav a::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.12rem;
  height: 1.5px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.25s var(--ease);
}

.section-nav a:hover { color: var(--text); }
.section-nav a.is-active { color: var(--accent); }
.section-nav a.is-active::after { transform: scaleX(1); }

.icon-rail {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding-left: 0.7rem;
  border-left: 1px solid var(--border);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-nav a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.site-nav a svg,
.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle.is-dark .icon-moon { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }

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

.hero {
  position: relative;
  padding: 5rem 0 3.6rem;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  top: -38%;
  left: 50%;
  width: 140%;
  height: 130%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--brand-blue) 30%, transparent), transparent 60%);
  pointer-events: none;
}

.hero > .wrap {
  position: relative;
  z-index: 1;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.4rem;
  /* Clears the avatar's glow, which bleeds 7px past the image, so the last
     pill below can't collide with it. */
  margin-bottom: 2rem;
}

.hero-head { min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.8s var(--ease) infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

h1 {
  font-size: clamp(2.5rem, 7vw, 3.6rem);
  font-weight: 500;
  margin: 0 0 0.6rem;
  line-height: 1.08;
  letter-spacing: -0.022em;
}

.hero-role {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  color: var(--text-muted);
  margin: 0 0 1.4rem;
  max-width: 42ch;
}

.hero-role strong {
  color: var(--text);
  font-weight: 600;
}

.avatar-frame {
  position: relative;
  flex-shrink: 0;
}

.avatar-frame::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 20px;
  background: linear-gradient(140deg, var(--brand-blue), var(--accent-2), transparent 70%);
  opacity: 0.7;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.avatar-frame:hover::before {
  opacity: 1;
  transform: scale(1.02) rotate(-1.5deg);
}

.avatar {
  position: relative;
  display: block;
  width: 158px;
  height: 158px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

/* Hero link pills */
.pill-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.8rem;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 0.42rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
    background-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.pill svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex-shrink: 0;
}

.pill:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pill-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.pill-primary:hover {
  color: #fff;
  filter: brightness(1.1);
}

:root[data-theme="dark"] .pill-primary,
:root[data-theme="dark"] .pill-primary:hover { color: #10161c; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-primary,
  :root:not([data-theme="light"]) .pill-primary:hover { color: #10161c; }
}

.bio {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 62ch;
  margin: 0 0 1.6rem;
}

/* Topic tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-right: 0.3rem;
}

.tag {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
}

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

main { counter-reset: section; }

.section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
}

.section--alt { background: var(--bg-alt); }

.section:last-of-type { border-bottom: none; }

.section h2 {
  counter-increment: section;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  margin: 0 0 1.8rem;
}

.section h2::before {
  content: counter(section, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-faint);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
}

.section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

.section > .wrap > p {
  margin: 0 0 1.1rem;
  max-width: 66ch;
}

.section > .wrap > p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Research direction cards
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.6rem;
  padding: 0;
  list-style: none;
  counter-reset: direction;
}

.direction {
  position: relative;
  counter-increment: direction;
  padding: 1.15rem 1.2rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}

.direction::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--brand-blue));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.35s var(--ease);
}

.direction:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.direction:hover::before { transform: scaleX(1); }

.direction-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.direction-num::before { content: counter(direction, decimal-leading-zero); }

.direction h3 {
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 650;
  margin: 0 0 0.45rem;
  letter-spacing: -0.005em;
}

.direction p {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */

.panel {
  position: relative;
  padding: 1.5rem 1.6rem;
  margin: 0 0 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.panel > p { margin: 0 0 0.9rem; }
.panel > p:last-child { margin-bottom: 0; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.8rem;
}

.panel-head h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 650;
  margin: 0;
}

.badge {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  white-space: nowrap;
}

.badge-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* --------------------------------------------------------------------------
   Publication cards
   -------------------------------------------------------------------------- */

.pub-list-home {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1rem;
}

.pub-card {
  position: relative;
  padding: 1.3rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}

.pub-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--brand-blue));
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform 0.35s var(--ease);
}

.pub-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.pub-card:hover::before { transform: scaleY(1); }

.pub-venue-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.pub-card h3 {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.008em;
  margin: 0 0 0.5rem;
  max-width: 54ch;
}

.pub-authors {
  font-family: var(--font-sans);
  font-size: 0.87rem;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}

.pub-authors strong {
  color: var(--text);
  font-weight: 650;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.pub-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
}

.pub-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* --------------------------------------------------------------------------
   Experience list
   -------------------------------------------------------------------------- */

.exp-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.2rem;
}

.exp-item {
  display: grid;
  gap: 0.3rem;
  padding: 1.15rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.exp-item:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateX(3px);
}

.exp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.8rem;
}

.exp-head h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 650;
  margin: 0;
}

.exp-role {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.exp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.exp-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.exp-meta svg {
  width: 13px;
  height: 13px;
  flex: none;
  opacity: 0.75;
}

.exp-item p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text-muted);
  max-width: 68ch;
}

.exp-item p strong {
  color: var(--text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Pull quote
   -------------------------------------------------------------------------- */

.quip {
  margin: 2.4rem 0 0;
  padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 2px solid var(--brand-blue);
  font-style: italic;
  color: var(--text-muted);
  max-width: 58ch;
}

.quip p { margin: 0 0 0.4rem; }

.quip cite {
  display: block;
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   CV page
   -------------------------------------------------------------------------- */

.hero-small { padding: 3.2rem 0 2.4rem; }

.hero-small h1 {
  font-size: clamp(2rem, 5vw, 2.6rem);
  margin-bottom: 1.2rem;
}

#cv-pdf .wrap { max-width: 1000px; }

.pdf-embed {
  width: 100%;
  height: 86vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  background: var(--surface);
}

/* Rendered pages and the link-out card are mobile-only; see cv.html. */
.pdf-pages,
.pdf-fallback { display: none; }

.pdf-page {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  background: #fff;
}

.pdf-note {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-faint);
  text-align: center;
  padding: 2rem 0;
}

/* --------------------------------------------------------------------------
   Prose links
   -------------------------------------------------------------------------- */

.section p a,
.bio a,
.panel a,
.exp-item p a,
.direction p a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 1px;
  transition: background-size 0.28s var(--ease), color 0.18s var(--ease);
}

.section p a:hover,
.bio a:hover,
.panel a:hover,
.exp-item p a:hover,
.direction p a:hover {
  background-size: 100% 2px;
  color: var(--accent-2);
}

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

.site-footer {
  padding: 2.6rem 0 3rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}

.site-footer p {
  font-family: var(--font-sans);
  font-size: 0.79rem;
  color: var(--text-faint);
  margin: 0;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.site-footer a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

/* Hidden only when JS is present to reveal them again. */
:root.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

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

:root.js .reveal-stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}

:root.js .reveal-stagger.is-visible > * {
  opacity: 1;
  transform: none;
}

:root.js .reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
:root.js .reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.16s; }
:root.js .reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.24s; }
:root.js .reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.32s; }

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  :root.js .reveal,
  :root.js .reveal-stagger > * {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .section-nav { display: none; }

  .icon-rail {
    padding-left: 0;
    border-left: none;
  }

  .pdf-embed { display: none; }

  .pdf-pages:not([hidden]) {
    display: grid;
    gap: 1rem;
  }

  .pdf-fallback:not([hidden]) {
    display: block;
    text-align: center;
  }
}

@media (max-width: 620px) {
  .hero { padding: 3.4rem 0 2.6rem; }

  .hero-top {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 1.6rem;
    /* Stacked here, so the avatar is no longer beside the pills. */
    margin-bottom: 1.4rem;
  }

  .avatar {
    width: 108px;
    height: 108px;
  }

  .section { padding: 3rem 0; }

  .bio { font-size: 1.04rem; }

  .panel { padding: 1.2rem 1.1rem; }

  .footer-inner { justify-content: flex-start; }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .progress-bar,
  .back-to-top,
  .hero::before,
  .hero::after { display: none !important; }

  body { background: #fff; color: #000; }

  .section {
    break-inside: avoid;
    border-bottom: none;
  }
}
