/* ==========================================================
   Xueli Chen, personal academic website
   Colors and fonts are defined once below as variables.
   To change the main color, edit --spruce below.
   ========================================================== */

:root {
  --paper: #f6f8f7;
  --surface: #ffffff;
  --ink: #17221f;
  --ink-2: #44524e;
  --muted: #6a7773;
  --line: #d8e0dd;
  --line-soft: #e7ecea;
  --spruce: #1e5c55;          /* main color: deep spruce green */
  --spruce-strong: #154741;
  --spruce-wash: #e3eeeb;
  --straw: #b8892b;           /* accent: dry straw */
  --straw-text: #85611a;
  --straw-wash: #f4ead2;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --wrap: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 6px;
  color-scheme: light;
}

/* ---------- Base ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--spruce);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--spruce) 40%, transparent);
}
a:hover { color: var(--spruce-strong); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--straw); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
h2 { font-size: clamp(1.55rem, 2.6vw, 1.9rem); letter-spacing: -0.005em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--spruce); color: var(--paper); padding: 8px 14px; border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

.prose { max-width: 68ch; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 500;
  color: var(--ink); text-decoration: none; letter-spacing: -0.005em;
}
.brand:hover { color: var(--spruce); }
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.site-nav a {
  display: block; padding: 6px 12px; font-size: 0.95rem;
  color: var(--ink-2); text-decoration: none; border-radius: var(--radius);
  position: relative;
}
.site-nav a:hover { color: var(--ink); background: var(--line-soft); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 1px;
  height: 2px; background: var(--straw); border-radius: 2px;
}
.nav-toggle {
  appearance: none; border: 1px solid transparent; background: none; color: var(--ink-2);
  width: 38px; height: 38px; border-radius: var(--radius); cursor: pointer;
  display: inline-grid; place-items: center;
}
.nav-toggle:hover { background: var(--line-soft); color: var(--ink); }
.nav-toggle { display: none; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 1.6px; background: currentColor; border-radius: 2px;
  position: relative; transition: transform .2s ease, opacity .2s ease;
}
.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); }

@media (max-width: 840px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 10px 4px; font-size: 1.05rem; }
  .site-nav a[aria-current="page"]::after { left: 4px; right: auto; width: 24px; bottom: 4px; }
}

/* ---------- Buttons and links row ---------- */
.profile-links { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; font: 500 0.92rem/1.3 var(--sans);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.btn:hover { border-color: var(--spruce); color: var(--spruce-strong); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.btn-primary { background: var(--spruce); border-color: var(--spruce); color: var(--paper); }
.btn-primary:hover { background: var(--spruce-strong); border-color: var(--spruce-strong); color: var(--paper); }

/* ---------- Home: hero ---------- */
.hero { padding: clamp(48px, 8vw, 96px) 0 0; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(32px, 6vw, 72px); align-items: center;
}
.hero-name {
  font-size: clamp(2.7rem, 6.4vw, 4.6rem);
  font-weight: 400; letter-spacing: -0.022em; line-height: 1.02;
}
.hero-degree { font-size: 0.42em; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.hero-role { margin: 18px 0 0; font-size: 1.05rem; font-weight: 500; color: var(--ink); line-height: 1.5; }
.hero-role span { font-weight: 400; color: var(--ink-2); }
.hero-tagline {
  margin: 22px 0 0; max-width: 34em;
  font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.42rem); line-height: 1.45;
  color: var(--ink-2);
}
.hero-photo { margin: 0; position: relative; width: clamp(200px, 26vw, 300px); }
.hero-photo img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 50%;
  background: var(--spruce-wash);
  position: relative; z-index: 1;
}
.hero-photo::before {
  content: ""; position: absolute; inset: -10px;
  border-radius: 50%; border: 1px solid var(--straw);
  transform: translate(10px, 8px);
}

/* The fiber band: plant fibers that loosen and break into fragments */
.fiber-band { display: block; width: 100%; height: clamp(90px, 12vw, 150px); margin-top: clamp(36px, 6vw, 64px); overflow: visible; }
.fiber-band .strand { fill: none; stroke: var(--spruce); stroke-linecap: round; }
.fiber-band .bit { fill: var(--straw); }
.fiber-band .bit.alt { fill: var(--spruce); }
.fiber-band.animate .strand { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.9s cubic-bezier(.45,.05,.25,1) forwards; animation-delay: var(--delay); }
.fiber-band.animate .bit { opacity: 0; animation: appear .6s ease forwards; animation-delay: var(--delay); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: var(--op, 1); } }
@media (prefers-reduced-motion: reduce) {
  .fiber-band.animate .strand, .fiber-band.animate .bit { animation: none; stroke-dashoffset: 0; opacity: var(--op, 1); }
}

/* ---------- Sections ---------- */
.section { padding-top: clamp(48px, 7vw, 80px); }
.section:last-child { padding-bottom: clamp(56px, 8vw, 96px); }
main > .wrap:last-child { padding-bottom: clamp(56px, 8vw, 96px); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
.more { font-size: 0.95rem; white-space: nowrap; }
.h-small {
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  color: var(--ink); margin: 0 0 10px;
}

.about { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(32px, 6vw, 72px); }
.about h2 { margin-bottom: 18px; }
.about-side { padding-top: 8px; }
.about-page { padding: clamp(32px, 5vw, 48px) 0 0; }
.about-page .profile-links { margin-top: 32px; }
.about-side .h-small:not(:first-child) { margin-top: 28px; }
.interest-list { list-style: none; margin: 0; padding: 0; }
.interest-list li {
  padding: 9px 0 9px 18px; border-bottom: 1px solid var(--line-soft); position: relative;
  color: var(--ink-2); font-size: 0.98rem; line-height: 1.4;
}
.interest-list li::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px;
  border-radius: 50%; background: var(--straw); transform: translateY(-50%);
}
.side-text { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; }

/* Research directions on the home page */
.directions {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px;
}
.direction a { display: block; color: inherit; text-decoration: none; }
.direction figure {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: border-color .15s ease;
}
.direction img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.direction h3 { margin: 14px 0 6px; font-size: 1.15rem; line-height: 1.3; text-wrap: balance; }
.direction p { margin: 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; }
.direction a:hover figure { border-color: var(--spruce); }
.direction a:hover h3 { color: var(--spruce); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
@media (max-width: 900px) { .directions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .directions { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .direction a { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; }
  .direction h3 { margin-top: 0; font-size: 1.05rem; }
}

/* ---------- News ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px;
  padding: 16px 0; border-bottom: 1px solid var(--line-soft);
}
.news-item:last-child { border-bottom: 0; }
.news-item time { color: var(--straw-text); font-size: 0.9rem; font-weight: 500; padding-top: 2px; font-variant-numeric: tabular-nums; }
.news-text { max-width: 68ch; }
.news-text p { margin: 0; }

/* ---------- Inner page heading ---------- */
.page-head { padding: clamp(44px, 7vw, 80px) 0 clamp(20px, 3vw, 32px); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.page-head h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); font-weight: 400; letter-spacing: -0.018em; }
.page-intro { margin: 14px 0 0; max-width: 60ch; color: var(--ink-2); font-size: 1.08rem; }

/* Year groups (News and Publications) */
.year-group {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px;
  padding: 28px 0; border-bottom: 1px solid var(--line-soft);
}
.year-group:last-of-type { border-bottom: 0; }
.year-label {
  font-size: 1.9rem; font-weight: 400; color: var(--straw-text);
  font-variant-numeric: oldstyle-nums; line-height: 1.1;
  position: sticky; top: 84px; align-self: start;
}
.year-group .news-item:first-child { padding-top: 4px; }

/* ---------- Publications ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.pub:last-child { border-bottom: 0; }
.year-group .pub:first-child { padding-top: 4px; }
.pub p { margin: 0; }
.pub-title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.35; font-weight: 500; max-width: 62ch; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--spruce); text-decoration: underline; text-decoration-color: var(--spruce); }
.pub-authors { margin-top: 5px !important; color: var(--ink-2); font-size: 0.96rem; }
.pub-authors .me { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--straw); text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
.pub-venue { color: var(--muted); font-size: 0.94rem; }
.pub-links { margin-top: 8px !important; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 0.88rem; font-weight: 500; }
.pub-links a { text-decoration: none; }
.pub-links a:hover { text-decoration: underline; }
.pub-note { background: var(--straw-wash); color: var(--straw-text); padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; }

.pub-tools {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1.5fr);
  gap: 12px 16px; align-items: end;
  padding: 24px 0 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.pub-tools input[type="search"], .pub-tools select {
  width: 100%; min-width: 0; height: 42px;
  font: 0.97rem var(--sans); color: var(--ink);
  background-color: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 12px;
}
.pub-tools select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.pub-tools input[type="search"]:hover, .pub-tools select:hover { border-color: color-mix(in srgb, var(--spruce) 45%, var(--line)); }
.pub-tools input[type="search"]:focus, .pub-tools select:focus { outline: none; border-color: var(--spruce); box-shadow: 0 0 0 3px var(--spruce-wash); }
.pub-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; min-height: 24px; }
.pub-count { margin: 0; color: var(--muted); font-size: 0.9rem; }
.link-btn {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 0.9rem var(--sans); color: var(--spruce); text-decoration: underline; text-underline-offset: 0.18em;
}
.link-btn:hover { color: var(--spruce-strong); }
@media (max-width: 860px) {
  .pub-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-search { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .pub-tools { grid-template-columns: minmax(0, 1fr); }
}
.empty-state { padding: 40px 0; color: var(--ink-2); }

/* ---------- Research ---------- */
.themes { padding-top: 16px; }
.theme {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 5vw, 56px); align-items: start;
  padding: clamp(32px, 5vw, 52px) 0; border-bottom: 1px solid var(--line-soft);
}
.theme:last-child { border-bottom: 0; }
.theme-figure {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.theme-figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.theme-body h2 { margin-bottom: 14px; }
.tags { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: 0.84rem; color: var(--spruce-strong); background: var(--spruce-wash);
  padding: 3px 10px; border-radius: 999px;
}
.related { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.related ul { margin: 0; padding-left: 1.1em; }
.related li { margin: 4px 0; font-size: 0.96rem; }

/* ---------- Experience ---------- */
.experience { margin-top: clamp(40px, 6vw, 64px); border-top: 1px solid var(--line); }
.xp-section { padding: clamp(32px, 5vw, 48px) 0 0; }
.xp-section > h2 { margin-bottom: 20px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item {
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 24px;
  position: relative; padding-bottom: 28px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-dates { margin: 0; color: var(--straw-text); font-size: 0.9rem; font-weight: 500; padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-body { position: relative; padding-left: 24px; border-left: 1px solid var(--line); }
.tl-body::before {
  content: ""; position: absolute; left: -5px; top: 9px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--spruce);
}
.tl-item:first-child .tl-body::before { background: var(--spruce); }
.tl-item:last-child .tl-body { border-left-color: transparent; }
.tl-body h3 { font-size: 1.22rem; }
.tl-org { margin: 4px 0 0; color: var(--ink-2); }
.tl-note { margin: 6px 0 0; color: var(--ink-2); font-size: 0.96rem; }
.tl-details { margin: 10px 0 0; padding-left: 1.1em; color: var(--ink-2); font-size: 0.97rem; }
.tl-details li { margin: 3px 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 24px; padding: 8px 0; }
.pl-year { color: var(--straw-text); font-size: 0.9rem; font-weight: 500; }
.skills { margin: 0; }
.skill-row { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 24px; padding: 6px 0; }
.skill-row dt { font-weight: 600; font-size: 0.95rem; padding-top: 4px; }
.skill-row dd { margin: 0; }
.skill-row .tags { margin: 0; }

/* ---------- Academic journey map (About me) ---------- */
.journey { margin-top: clamp(40px, 6vw, 64px); padding-top: clamp(32px, 5vw, 48px); border-top: 1px solid var(--line); }
.journey > h2 { margin-bottom: 8px; }
.journey-map { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1000 / 265; margin-top: 24px; }
.journey-land, .journey-routes { position: absolute; inset: 0; width: 100%; height: 100%; }
.journey-routes path.route { fill: none; stroke: #b8892b; stroke-width: 1.7; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: opacity .2s ease; }
.journey-map.has-active .route { opacity: .22; }
.journey-map.has-active .route.is-active { opacity: 1; }
.journey-pin { position: absolute; width: 0; height: 0; visibility: hidden; }
.journey-map.is-ready .journey-pin { visibility: visible; }
.pin-dot {
  position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--spruce); box-shadow: 0 0 0 3px var(--paper); transition: transform .2s ease, background-color .2s ease;
}
.pin-label {
  position: absolute; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 9px 3px 3px; border-radius: 12px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  font-size: 0.82rem; font-weight: 500; color: var(--ink); line-height: 1.15;
}
.pin-text { display: flex; flex-direction: column; gap: 1px; }
.pin-place { font-size: 0.74rem; font-weight: 400; color: var(--muted); }
.pin-num, .stop-num {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--spruce); color: var(--paper);
  font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* The number sits right next to its dot; the name follows the number. */
.label-top .pin-label { left: -12px; bottom: 8px; }
.label-bottom .pin-label { left: -12px; top: 8px; }
.label-right .pin-label { left: 7px; top: 0; transform: translateY(-50%); }
.label-left .pin-label { right: 7px; top: 0; transform: translateY(-50%); }
.label-top-left .pin-label { right: -12px; bottom: 8px; }
.label-bottom-left .pin-label { right: -12px; top: 8px; }
.label-left .pin-label, .label-top-left .pin-label, .label-bottom-left .pin-label { flex-direction: row-reverse; padding: 3px 3px 3px 9px; }
.label-left .pin-text, .label-top-left .pin-text, .label-bottom-left .pin-text { align-items: flex-end; text-align: right; }
.journey-pin.is-active .pin-dot { background: var(--straw); transform: scale(1.3); }
.journey-pin.is-active .pin-num { background: var(--straw); }
.journey-pin.is-active { z-index: 2; }

.journey-list {
  list-style: none; margin: 28px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px;
}
.journey-list li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start;
  padding-top: 14px; border-top: 2px solid var(--line-soft); transition: border-color .2s ease;
}
.journey-list li.is-active { border-top-color: var(--straw); }
.journey-list li.is-active .stop-num { background: var(--straw); }
.journey-list h3 { font-size: 1.05rem; margin: 0 0 4px; }
.journey-list p { margin: 0; }
.stop-years { font-size: 0.85rem; font-weight: 500; color: var(--straw-text); margin-bottom: 2px !important; font-variant-numeric: tabular-nums; }
.stop-what { font-size: 0.92rem; color: var(--ink-2); line-height: 1.45; }
@media (max-width: 860px) {
  .journey-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .journey-list li { padding: 12px 0; border-top-width: 1px; }
}
@media (max-width: 640px) {
  .pin-text { display: none; }
  .pin-label, .label-left .pin-label, .label-top-left .pin-label, .label-bottom-left .pin-label { padding: 0; background: none; }
  .label-top-left .pin-label { right: -8.5px; bottom: 5px; }
  .label-bottom-left .pin-label { right: -8.5px; top: 5px; }
  .pin-dot { left: -4px; top: -4px; width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--paper); }
  .pin-num { width: 17px; height: 17px; font-size: 0.66rem; }
  .label-top .pin-label { left: -8.5px; bottom: 5px; }
  .label-bottom .pin-label { left: -8.5px; top: 5px; }
  .label-right .pin-label { left: 5px; }
  .label-left .pin-label { right: 5px; }
}

/* ---------- Birthday popup (text in _data/birthday.yml) ---------- */
.bday { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.bday-backdrop { position: absolute; inset: 0; background: rgba(23, 34, 31, .45); animation: bday-fade .25s ease both; }
.bday-card {
  position: relative; overflow: hidden; width: min(440px, 100%);
  background: var(--surface); border-radius: 14px; border-top: 4px solid var(--straw);
  padding: 36px 32px 28px; text-align: center;
  box-shadow: 0 24px 60px rgba(23, 34, 31, .25);
  animation: bday-pop .35s cubic-bezier(.2, .9, .3, 1.2) both;
}
.bday-card:focus { outline: none; }
.bday-card h2 { font-size: clamp(1.7rem, 5vw, 2.1rem); font-weight: 500; position: relative; }
.bday-msg { margin: 14px auto 0; max-width: 32ch; color: var(--ink-2); line-height: 1.6; position: relative; }
.bday-sign { margin: 12px 0 0; font-family: var(--serif); font-style: italic; color: var(--straw-text); font-size: 1.05rem; position: relative; }
.bday-go { margin-top: 22px; position: relative; }
.bday-x {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.bday-x:hover { background: var(--line-soft); color: var(--ink); }
.bday-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bday-cake { width: 64px; height: 64px; display: block; margin: 0 auto 10px; position: relative; }
.bday-cake .flame { fill: var(--straw); transform-origin: 32px 16px; animation: bday-flicker 1.2s ease-in-out infinite; }
.bday-cake .candle { fill: var(--spruce-wash); stroke: var(--spruce); stroke-width: 1.5; }
.bday-cake .top { fill: var(--straw-wash); stroke: var(--straw); stroke-width: 1.5; }
.bday-cake .base { fill: var(--spruce); }
.bday-cake .icing { fill: none; stroke: var(--paper); stroke-width: 2; stroke-linecap: round; transform: translateY(8px); }
.bday-confetti { position: absolute; left: 0; right: 0; top: 0; height: 150px; pointer-events: none; }
.bday-confetti i {
  position: absolute; top: -12px; width: 7px; height: 11px; border-radius: 2px; opacity: .9;
  animation: bday-fall var(--d, 2.8s) var(--delay, 0s) cubic-bezier(.3, .6, .5, 1) both;
}
.bday.is-closing .bday-card { animation: bday-out .2s ease both; }
.bday.is-closing .bday-backdrop { animation: bday-fade .2s ease reverse both; }
@keyframes bday-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bday-pop { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes bday-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes bday-flicker { 0%, 100% { transform: scale(1); } 50% { transform: scale(.85, 1.08); } }
@keyframes bday-fall { from { transform: translate(0, 0) rotate(0); opacity: 0; } 10% { opacity: .9; } to { transform: translate(var(--x, 0), 150px) rotate(var(--r, 360deg)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .bday-card, .bday-backdrop, .bday-cake .flame { animation: none; }
  .bday-confetti { display: none; }
}
@media (max-width: 480px) { .bday-card { padding: 32px 22px 24px; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-top: 32px; padding-bottom: 32px; }
.footer-inner p { margin: 0; }
.footer-name { font-family: var(--serif); font-size: 1.15rem; }
.footer-meta { color: var(--muted); font-size: 0.9rem; }
.footer-right { text-align: right; }

.lead-404 { padding: 28px 0 80px; font-size: 1.1rem; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .theme { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; width: 140px; }
  .hero-photo::before { inset: -6px; transform: translate(6px, 5px); }
  .news-item { grid-template-columns: 1fr; gap: 2px; }
  .year-group { grid-template-columns: 1fr; gap: 8px; padding: 24px 0; }
  .year-label { position: static; font-size: 1.6rem; }
  .tl-item, .plain-list li, .skill-row { grid-template-columns: 1fr; gap: 4px; }
  .tl-dates { padding-left: 25px; }
  .tl-item { padding-bottom: 22px; }
  .footer-right { text-align: left; }
}

@media print {
  .site-header, .fiber-band, .pub-tools { display: none !important; }
  body { background: #fff; color: #000; }
}
