:root[data-theme="dark"] {
  color-scheme: dark; /* native scrollbars and form controls follow the theme */
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --accent: #7db7ff;
  --accent-dark: #a8d0ff;
  --border: #2d333b;
  --bg: #0d1117;
  --bg-soft: #161b22;
  --official: #4ade80;
  --official-bg: #0f2b1a;
  --preprint: #fbbf24;
  --preprint-bg: #2b2107;
  --pending: #6b7280;
  --tag-bg: #1e2a4a;
  --map-land: #2d333b;

  /* categorical palette (validated with dataviz skill's validate_palette.js
     against this site's dark surface #0d1117 — see docs/DESIGN.md) */
  --series-1: #3987e5; /* blue   */
  --series-2: #c98500; /* yellow */
  --series-3: #199e70; /* aqua   */
  --series-4: #008300; /* green  */
  --series-5: #9085e9; /* violet */
  --series-other: #6b6a65; /* neutral "Other" bucket, outside the 5 validated slots */
  --viz-grid: #2c2c2a;
  --viz-ink: #c3c2b7;
}

:root {
  color-scheme: light;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --official: #15803d;
  --official-bg: #ecfdf3;
  --preprint: #b45309;
  --preprint-bg: #fffbeb;
  --pending: #9ca3af;
  --tag-bg: #eef2ff;
  --map-land: #e2e6ec;

  /* categorical palette (validated against this site's light surface #ffffff) */
  --series-1: #2a78d6;
  --series-2: #eda100;
  --series-3: #1baf7a;
  --series-4: #008300;
  --series-5: #4a3aa7;
  --series-other: #a8a7a0;
  --viz-grid: #e1e0d9;
  --viz-ink: #52514e;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  line-height: 1.65;
  transition: background 0.15s ease, color 0.15s ease;
}

img,
svg {
  max-width: 100%;
}

a, button {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

a,
a:visited {
  color: var(--accent);
}

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

/* ---- Top nav ---- */
.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1200px;
  min-width: 0;
  margin: 0 auto;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* ---- Layout ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ---- Hero ---- */
.hero {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.profile-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

:root:not([data-theme="dark"]) .profile-photo {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.hero-text h1 {
  margin: 0 0 0.25rem;
  font-size: 2.1rem;
}

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

.name-ko {
  color: var(--muted);
  font-weight: 400;
  font-size: 1.2rem;
}

.identity-tag {
  color: var(--accent);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0.2rem 0 0.6rem;
}

.tagline {
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 0.15rem;
}

.contact {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0.3rem 0;
  overflow-wrap: anywhere;
}

.contact a {
  color: var(--accent);
  text-decoration: none;
}

.bio {
  font-size: 0.95rem;
  margin: 0.75rem 0;
}

.interests {
  margin: 0.6rem 0;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8rem;
  margin: 0 0.3rem 0.3rem 0;
}

/* ---- Social links ---- */
.social-links {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg-soft);
}

.social-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.social-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Brand-colored icon per platform, visible by default (not just on hover) —
   text stays var(--fg) per the design system's "text never wears the series
   color" rule; only the icon (and border, on hover) pick up the brand hue,
   so identity isn't color-only. */
.social-btn.scholar .social-icon { color: #4285f4; }
.social-btn.scholar:hover { border-color: #4285f4; }
.social-btn.orcid .social-icon { color: #a6ce39; }
.social-btn.orcid:hover { border-color: #a6ce39; }
.social-btn.rg .social-icon { color: #00ccbb; }
.social-btn.rg:hover { border-color: #00ccbb; }
.social-btn.linkedin .social-icon { color: #0a66c2; }
.social-btn.linkedin:hover { border-color: #0a66c2; }
.social-btn.github .social-icon { color: var(--fg); }
.social-btn.github:hover { border-color: var(--fg); }
.social-btn.instagram .social-icon { color: #e1306c; }
.social-btn.instagram:hover { border-color: #e1306c; }
.social-btn.facebook .social-icon { color: #1877f2; }
.social-btn.facebook:hover { border-color: #1877f2; }
.social-btn.cv .social-icon { color: var(--accent); }
.social-btn.cv:hover { border-color: var(--accent); }

/* ---- Sections ---- */
section h2, main > h1 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-head h2 {
  border: none;
  padding: 0;
  margin: 0;
}

.see-all {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.page-intro {
  color: var(--muted);
  font-size: 0.95rem;
}

.page-intro a {
  color: var(--accent);
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-top: 0;
}

.section-nav {
  position: sticky;
  top: 4.1rem;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0 0 0.55rem;
  overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.section-nav a {
  flex: 0 0 auto;
  padding: 0.35rem 0.7rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  border-bottom: 2px solid transparent;
}

.section-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.section-nav-grid a {
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

#insights,
#browse,
.cv-panel[id] {
  scroll-margin-top: 8rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.home-panel {
  min-width: 0;
  padding: 0;
}

.home-panel > section > h2,
.home-panel .section-head {
  margin-top: 0;
}

/* ---- Timeline (Home page) ---- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 1.4rem 1.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item.timeline-education::before {
  background: var(--series-5);
}

.timeline-period {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.1rem;
}

.timeline-title a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}

.timeline-title a:hover {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.timeline-body .timeline-title {
  font-weight: 600;
}

.timeline-title-ko,
.timeline-detail-ko,
.timeline-subitem-title-ko {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.timeline-subitem-title-ko {
  margin: 0.08rem 0 0.12rem;
}

.timeline-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-detail a,
.timeline-detail a:visited,
.timeline-dissertation a,
.timeline-dissertation a:visited {
  color: inherit;
  text-decoration: none;
}

.timeline-detail a:hover,
.timeline-detail a:focus-visible,
.timeline-dissertation a:hover,
.timeline-dissertation a:focus-visible {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.timeline-dissertation {
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.timeline-dissertation span {
  margin-right: 0.45rem;
  color: var(--fg);
  font-weight: 600;
}

.timeline-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.timeline-focus span {
  color: var(--fg);
  font-weight: 600;
}

.timeline-subitems {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.timeline-subitem {
  position: relative;
  padding: 0.3rem 0 0.3rem 0.9rem;
  font-size: 0.85rem;
}

.timeline-subitem::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.55rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.timeline-subitem-period {
  color: var(--muted);
  margin-right: 0.5rem;
}

.timeline-subitem-title {
  font-weight: 600;
  margin-right: 0.4rem;
}

.timeline-subitem-detail {
  color: var(--muted);
}

/* ---- Charts (viz.py) ---- */
.viz-block {
  margin: 0;
  padding: 1rem;
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.viz-block h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--fg);
}

.viz-svg {
  width: 100%;
  max-width: none;
  height: auto;
  display: block;
}

.viz-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin: 1.5rem 0;
}

.publication-quick-actions {
  display: none;
  margin: -0.25rem 0 1rem;
}

.browse-publications-cta,
.browse-publications-cta:visited {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-width: 15rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: var(--bg);
  background: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.browse-publications-cta:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.browse-publications-cta span:last-child {
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.84;
}

.publication-insights {
  margin: 0 0 1rem;
}

.insights-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  background: var(--bg-soft);
  cursor: pointer;
  list-style: none;
}

.insights-summary::-webkit-details-marker {
  display: none;
}

.insights-summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
}

.publication-insights[open] > .insights-summary::after {
  content: "\2212";
}

.insights-summary > span,
.insights-summary > .insights-title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

.insights-summary > small {
  grid-column: 1;
  margin-top: -0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.publication-insights > .viz-dashboard {
  margin: 1rem 0 1.5rem;
}

@media (min-width: 901px) {
  .publication-insights > .insights-summary {
    display: none;
  }
}

.viz-note {
  margin: -0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.venue-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.75rem;
}

.venue-group {
  min-width: 0;
}

.venue-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.venue-group-head h4 {
  margin: 0;
  font-size: 0.9rem;
}

.venue-group-head span {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.venue-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.venue-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1.8fr) minmax(4rem, 1fr) 1.5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.8rem;
}

.venue-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.venue-bar-track {
  height: 0.38rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.venue-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--series-1);
}

.venue-count {
  color: var(--fg);
  text-align: right;
}

.viz-grid {
  stroke: var(--viz-grid);
  stroke-width: 1;
}

.viz-axis-label {
  fill: var(--viz-ink);
  font-size: 11px;
}

.viz-value-label {
  fill: var(--fg);
  font-size: 11px;
  font-weight: 600;
}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.viz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.viz-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.viz-table-toggle {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-x: auto;
}

.viz-table-toggle summary {
  cursor: pointer;
  color: var(--accent);
}

.viz-table {
  margin-top: 0.75rem;
  border-collapse: collapse;
  font-size: 0.82rem;
  width: 100%;
}

.viz-table th,
.viz-table td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: center;
}

.viz-table th:first-child,
.viz-table td:first-child {
  text-align: left;
}

/* ---- View toggle (Publications page) ---- */
.view-toggle {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 0.35rem;
  margin: 0;
}

.view-control {
  flex: 0 0 auto;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.view-toggle-label {
  display: block;
  margin: 0 0 0.35rem 0.15rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.view-toggle-btn {
  min-height: 2.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 7px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.view-toggle-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

.view-toggle-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ---- Legend ---- */
.legend {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
}

.publication-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

/* ---- Publication categories ---- */
.pub-category {
  margin-top: 2.5rem;
}

.pub-category .count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
}

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

.paper-list.compact li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

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

/* Representative figure: thumbnail beside each list entry, full width on the
   paper page. Figures are black-on-white scans of the paper, so they sit on a
   white plate in both themes. */
.paper.has-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  column-gap: 1.1rem;
  align-items: start;
}
.paper.has-figure > :not(.paper-thumb) {
  grid-column: 1;
}
.paper.has-figure > .paper-meta-secondary,
.paper.has-figure > .paper-abstract-toggle,
.paper.has-figure > .paper-badges {
  grid-column: 1 / -1;
}
.paper-thumb {
  grid-column: 2;
  grid-row: 1 / span 4;
  display: block;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.thumb-stack {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
.thumb-stack img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Cross-fade through a paper's figures: 3.5 s per figure. */
.thumb-stack.n2 img { animation: thumb-fade-2 7s infinite; }
.thumb-stack.n3 img { animation: thumb-fade-3 10.5s infinite; }
.thumb-stack.n2 img:nth-child(2) { animation-delay: -3.5s; }
.thumb-stack.n3 img:nth-child(2) { animation-delay: -7s; }
.thumb-stack.n3 img:nth-child(3) { animation-delay: -3.5s; }
@keyframes thumb-fade-2 { 0%, 42% { opacity: 1; } 50%, 92% { opacity: 0; } 100% { opacity: 1; } }
@keyframes thumb-fade-3 { 0%, 28% { opacity: 1; } 33%, 95% { opacity: 0; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .thumb-stack img { animation: none !important; opacity: 0; }
  .thumb-stack img:first-child { opacity: 1; }
}
.paper-thumb:hover {
  border-color: var(--accent);
}
.paper-figures {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0 0.4rem;
}
@media (min-width: 901px) {
  .paper-figures.n2,
  .paper-figures.n3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .paper-figures.n3 .paper-figure:first-child {
    grid-column: 1 / -1;
  }
}
.paper-figure {
  margin: 0;
}
.figure-credit {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}
.paper-figure img {
  display: block;
  max-width: 100%;
  max-height: 460px;
  width: auto;
  height: auto;
  margin: 0 auto;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.paper-figure figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.paper-page-title {
  font-size: clamp(1.35rem, 1rem + 1.8vw, 2rem);
  line-height: 1.25;
  text-wrap: balance;
}

@media (max-width: 640px) {
  .paper.has-figure {
    grid-template-columns: minmax(0, 1fr) 92px;
    column-gap: 0.75rem;
  }
  .paper-thumb {
    padding: 3px;
    border-radius: 6px;
  }
  .paper-badges .badge {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
  }
  .section-nav {
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
}

.paper-index {
  color: var(--muted);
}

.paper-title a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
}

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

.paper-title-secondary {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
  line-height: 1.45;
}

.paper-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.3rem 0 0.1rem;
}

.paper-venue {
  color: var(--muted);
  font-size: 0.86rem;
  font-style: italic;
}

.paper-meta-secondary {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.18rem;
  opacity: 0.82;
}

.paper-sub {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.paper-compact.has-thumb {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
.home-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.home-thumb:hover {
  border-color: var(--accent);
}
.thumb-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: 5px;
  background: var(--tag-bg);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  padding: 0.3rem;
}
.home-paper-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (max-width: 640px) {
  .paper-compact.has-thumb {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 0.7rem;
  }
}

.paper-compact a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}

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

/* ---- Badges ---- */
.paper-badges {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.paper-badges.large {
  margin: 1.25rem 0;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
}

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

.badge-official {
  background: var(--official-bg);
  color: var(--official);
  border-color: var(--official);
}

.badge-official:hover {
  background: var(--official);
  color: var(--bg);
}

.badge-preprint {
  background: var(--preprint-bg);
  color: var(--preprint);
  border-color: var(--preprint);
}

.badge-preprint:hover {
  background: var(--preprint);
  color: var(--bg);
}

.badge-pending {
  background: var(--bg-soft);
  color: var(--pending);
  border-color: var(--border);
}

.badge-bibtex {
  background: var(--bg-soft);
  color: var(--muted);
  border-color: var(--border);
}

.badge-bibtex:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.badge-doi {
  background: var(--bg-soft);
  color: var(--muted);
  border-color: var(--border);
}

.badge-doi:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-tooltip-wrap {
  display: inline-flex;
  position: relative;
}

.copy-tooltip-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.65rem;
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  width: max-content;
  min-width: 16rem;
  max-width: min(430px, calc(100vw - 2rem));
  visibility: hidden;
  opacity: 0;
  z-index: 80;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s linear 0.14s;
}

.copy-tooltip-panel::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 10px;
}

/* On compact phone and tablet layouts the badge-anchored panel can hang off
   the right edge (and, even while hidden, widen the page into a horizontal
   scroll), so it becomes a fixed bottom sheet inside the viewport instead. */
@media (max-width: 900px) {
  .copy-tooltip-panel {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .copy-tooltip-panel::after {
    display: none;
  }
}

.copy-tooltip-wrap:hover .copy-tooltip-panel,
.copy-tooltip-wrap:focus-within .copy-tooltip-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

/* Reduced motion: keep hover colour/shadow feedback, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .social-btn:hover,
  a.badge:hover,
  .copy-tooltip-panel {
    transform: none;
  }
}

.copy-tooltip-text {
  display: block;
  max-height: 16rem;
  overflow: auto;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  cursor: text;
  user-select: text;
}

.copy-tooltip-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.9rem;
  padding: 0.28rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--bg);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.copy-tooltip-button:hover,
.copy-tooltip-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-tooltip-button.is-copied {
  border-color: var(--official);
  color: var(--official);
}

.copy-tooltip-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.life-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.life-photo-link {
  display: block;
  min-width: 0;
}

.life-photo-link-featured {
  grid-column: 1 / -1;
}

.life-photo-link-featured .life-photo {
  aspect-ratio: 16 / 9;
}

.life-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.life-section {
  min-width: 0;
  margin: 0;
  padding: 1.35rem 1.5rem 1.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.life-section-wide {
  grid-column: 1 / -1;
}

.life-section h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.7rem;
  padding: 0;
  border: none;
  font-size: 1.2rem;
}

.life-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--tag-bg);
  font-size: 1.1rem;
  flex: none;
}

.life-section > p {
  margin: 0;
  line-height: 1.65;
}

.life-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.life-section-wide .life-stats {
  grid-template-columns: repeat(auto-fill, minmax(150px, 200px));
}

.life-stat {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.life-stat-sub {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.life-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.life-stat-label {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

/* Training log (Garmin summary): two charts side by side, stacked on phones */
.training-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
}

.life-training .viz-block {
  background: var(--bg);
}

.life-training .viz-block h3 {
  margin: 0 0 0.25rem;
}

.life-training .viz-note {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
}

.training-charts .viz-axis-label,
.training-charts .viz-value-label {
  font-size: 13px;
}

.training-avg-line {
  stroke: var(--fg);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  opacity: 0.55;
  pointer-events: none;
}

/* Halo in the card color so the label stays legible where it crosses bars */
.training-avg-label {
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.life-training > .training-source {
  margin: 0.9rem 0 0;
}

.life-stat[title] {
  cursor: help;
}

.life-list h3 {
  margin: 1.2rem 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.life-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}

.life-list li:last-child {
  border-bottom: none;
}

.life-item-name {
  font-weight: 600;
}

.life-item-detail {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.travel-map {
  margin: 1.2rem 0 0;
}

.travel-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.travel-map path {
  stroke: var(--bg-soft);
  stroke-width: 0.5;
  stroke-linejoin: round;
}

.map-land { fill: var(--map-land); }
.map-visited { fill: var(--accent); }
.map-home { fill: var(--preprint); }
.travel-map path.map-visited:hover,
.travel-map path.map-home:hover { opacity: 0.8; }

.map-visited-dot,
.map-home-dot {
  stroke: var(--bg-soft);
  stroke-width: 1.2;
}

.map-visited-dot { fill: var(--accent); }
.map-home-dot { fill: var(--preprint); }

.travel-legend {
  display: flex;
  gap: 1.1rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.travel-legend span::before {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.4rem;
  border-radius: 2px;
  vertical-align: -0.05rem;
}

.legend-visited::before { background: var(--accent); }
.legend-home::before { background: var(--preprint); }

.travel-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}

.travel-countries .flag {
  margin-right: 0.35em;
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
.travel-countries li {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--accent);
  font-size: 0.8rem;
}

.life-social-section {
  margin-top: 1.25rem;
}

.life-photo {
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

@media (max-width: 700px) {
  .life-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
}

.life-training .life-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .training-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .life-training .life-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* The 480-unit chart shrinks to ~0.6x on a phone; larger glyphs land near 10px on screen */
  .training-charts .viz-axis-label,
  .training-charts .viz-value-label {
    font-size: 17px;
  }
}

.scholar-search {
  font-size: 0.9rem;
}

.scholar-search a {
  color: var(--accent);
}

/* ---- Wiki ---- */
.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.wiki-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.wiki-card h2 {
  margin: 0.35rem 0 0.65rem;
  font-size: 1.15rem;
}

.wiki-card p {
  margin: 0.45rem 0;
}

.wiki-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.wiki-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.wiki-article {
  max-width: 1100px;
}

.wiki-header {
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.wiki-notice {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-size: 0.92rem;
}

.wiki-section {
  margin-top: 2rem;
}

.wiki-section li + li {
  margin-top: 0.45rem;
}

/* ---- Blog (added 2026-11-04) ----
   Article column is narrower than the 1200px site container: long-form text
   reads best at ~70 characters per line. */
.post-index,
.post-article {
  max-width: 780px;
}

.post-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.post-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
}

.post-card h2 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.35;
}

.post-card p {
  margin: 0.4rem 0;
}

.post-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.post-back {
  margin: 0 0 1rem;
}

.post-header {
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 0.4rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-body {
  font-size: 1.06rem;
  line-height: 1.75;
}

.post-body h2 {
  font-size: 1.4rem;
  margin: 2.4rem 0 0.75rem;
  line-height: 1.3;
}

.post-body h3 {
  font-size: 1.15rem;
  margin: 1.8rem 0 0.5rem;
}

.post-body p,
.post-body ul,
.post-body ol {
  margin: 0.9rem 0;
}

.post-body li + li {
  margin-top: 0.4rem;
}

.post-body figure {
  margin: 1.75rem 0;
  text-align: center;
}

.post-body figure img {
  border-radius: 6px;
  background: #fff; /* paper figures are drawn on white */
  border: 1px solid var(--border);
}

.post-body figcaption {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

.post-body blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 1.1rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
}

.post-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
}

.post-body pre code {
  background: none;
  border: 0;
  padding: 0;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.7rem;
  text-align: left;
}

.post-body .arithmatex {
  overflow-x: auto;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .post-header h1 {
    font-size: 1.6rem;
  }

  .post-body {
    font-size: 1rem;
  }
}

/* ---- CV / plain lists ---- */
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plain-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.experience-group {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

.experience-company {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.experience-company-ko,
.experience-name-ko,
.education-school-ko,
.education-degree-ko,
.award-title-ko {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.experience-company-ko {
  margin: -0.16rem 0 0.28rem;
}

.experience-name-ko {
  margin-top: 0.08rem;
}

.education-school-ko,
.education-degree-ko {
  margin-top: 0.12rem;
}

.award-title-ko {
  margin-top: 0.1rem;
}

.collaborator-name-ko {
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.experience-roles {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.experience-roles li {
  padding: 0.5rem 0 0.5rem 0.8rem;
  border-bottom: none;
  font-size: 0.95rem;
}

.experience-entry {
  padding: 0.85rem 0 !important;
}

.experience-role-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.experience-role-head strong {
  color: var(--fg);
}

.experience-role-head > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.experience-position {
  margin-top: 0.15rem;
  color: var(--fg);
  font-size: 0.9rem;
}

.experience-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.experience-focus span {
  color: var(--accent);
  font-weight: 700;
}

.experience-highlights {
  list-style: disc;
  margin: 0.5rem 0 0;
  padding-left: 1.4rem;
}

.experience-highlights li {
  padding: 0.2rem 0;
  border-bottom: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.skill-table {
  margin: 0.5rem 0 1.5rem;
}

.related-label {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.project-entry {
  padding: 0.9rem 0 !important;
}

.project-heading {
  display: grid;
  grid-template-areas:
    "title period"
    "title-ko period"
    "sponsor sponsor";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.18rem 1rem;
}

.project-title-en {
  grid-area: title;
  color: var(--fg);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
}

.project-title-en a {
  color: inherit;
}

.project-period {
  grid-area: period;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.project-title-ko {
  grid-area: title-ko;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.project-sponsor {
  grid-area: sponsor;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.project-sponsor span,
.project-collaborators span {
  opacity: 0.86;
}

.project-collaborators {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.project-collaborators strong {
  color: var(--text);
  font-weight: 600;
}

.related-publications {
  margin: 0.3rem 0 0;
  padding-left: 1.35rem;
  list-style: decimal;
}

.related-publications li {
  padding: 0.15rem 0;
  border: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.related-publications a {
  color: var(--accent);
}

.related-publication-venue {
  color: var(--muted);
}

.related-publications li::marker {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.cv-panel {
  min-width: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.cv-panel > section > h2 {
  margin-top: 0;
}

.cv-span {
  grid-column: 1 / -1;
}

.cv-grid a,
.cv-grid a:visited {
  color: inherit;
  text-decoration: none;
}

.cv-grid a:hover,
.cv-grid a:focus-visible {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.skill-row {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.skill-cat {
  flex: 0 0 140px;
  font-weight: 600;
  color: var(--muted);
}

.abstract {
  color: var(--fg);
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.92rem;
}

.abstract p,
.paper-abstract-toggle p {
  margin: 0;
}

.abstract p + p,
.paper-abstract-toggle p + p {
  margin-top: 0.75rem;
}

.abstract-secondary {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88em;
  opacity: 0.88;
}

.abstract-language-label {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.paper-abstract-toggle {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.paper-abstract-toggle summary {
  cursor: pointer;
  color: var(--accent);
}

.paper-abstract-toggle p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.pending {
  color: var(--preprint);
  font-size: 0.9rem;
}

footer.site-footer {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.5rem 2rem 3rem;
  color: var(--muted);
  font-size: 0.8rem;
}

footer.site-footer a {
  color: var(--muted);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-text {
    width: 100%;
  }

  .hero-text .contact,
  .hero-text .social-links,
  .hero-text .interests {
    justify-content: center;
  }

  .social-links {
    justify-content: center;
  }

  .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    text-align: left;
    padding: 0.5rem 1.25rem;
  }

  .brand {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  .nav-links {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.35rem 0.15rem;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    width: 2.75rem;
    height: 2.75rem;
  }

  .container {
    padding: 2rem 1.25rem 4rem;
  }

  .section-nav {
    top: 7rem;
  }

  #insights,
  #browse,
  .cv-panel[id] {
    scroll-margin-top: 10.75rem;
  }

  .skill-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .skill-cat {
    flex: none;
  }

  .home-grid,
  .cv-grid,
  .life-grid {
    grid-template-columns: 1fr;
  }

  .cv-span,
  .life-section-wide {
    grid-column: auto;
  }

  .home-panel:first-child,
  .home-panel:last-child {
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
  }

  .publication-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .publication-quick-actions {
    display: flex;
    justify-content: stretch;
  }

  .browse-publications-cta {
    width: 100%;
  }

  .insights-summary {
    align-items: start;
  }

  .view-control {
    width: 100%;
  }

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

  .view-toggle-btn,
  .badge,
  .social-btn {
    min-height: 2.75rem;
  }

  .badge,
  .social-btn {
    display: inline-flex;
    align-items: center;
  }

  .paper-title,
  .paper-meta,
  .paper-venue,
  .paper-title-secondary,
  .page-header h1 {
    overflow-wrap: anywhere;
  }

  .life-section {
    padding: 1.15rem 1rem 1.25rem;
  }

  .life-list li {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.1rem;
  }

  .life-item-detail {
    white-space: normal;
  }

  .viz-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .section-nav {
    display: flex;
    gap: 0.4rem;
    padding: 0.35rem 0 0.55rem;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }

  .section-nav::-webkit-scrollbar {
    display: none;
  }

  .publication-section-nav {
    display: none;
  }

  .section-nav-grid {
    grid-template-columns: none;
  }

  .section-nav a {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    line-height: 1.2;
  }

  .section-nav a:hover {
    border-color: var(--accent);
  }

  .venue-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .project-heading {
    grid-template-areas:
      "title"
      "title-ko"
      "sponsor"
      "period";
    grid-template-columns: minmax(0, 1fr);
    gap: 0.16rem;
  }

  .project-period {
    margin-top: 0.05rem;
    white-space: normal;
  }

  .experience-role-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .experience-role-head > span {
    white-space: normal;
  }

  .venue-group-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.1rem;
  }

  .venue-row {
    grid-template-columns: minmax(0, 1fr) 3rem 1.25rem;
    gap: 0.45rem;
  }
}

/* ---- Print (primarily for cv.html — "print to PDF" a clean CV) ---- */
@media print {
  .site-nav,
  .section-nav,
  .publication-quick-actions,
  .insights-summary,
  .theme-toggle,
  footer.site-footer,
  .profile-photo,
  .social-links,
  .interests {
    display: none !important;
  }

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

  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .cv-grid {
    display: block;
  }

  .cv-panel {
    border: 0;
    padding: 0;
    background: transparent;
  }

  h1 {
    margin-top: 0;
  }

  section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #555;
  }
}

/* ---- Hero at-a-glance numbers ---- */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 640px;
  margin-top: 1.25rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.hero-stat:hover {
  border-color: var(--accent);
}

.hero-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hero-stat-label {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-stats-note {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- 404 ---- */
.not-found {
  padding-block: 3rem 4rem;
}
.not-found-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  list-style: none;
}

/* ---- Skip link (keyboard users) ---- */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 0.75rem;
}

/* ---- CV download buttons ---- */
.cv-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
