/* ============================================================
 * style.css — single stylesheet, organized by numbered sections
 *
 *  01. Design tokens (light + dark themes)
 *  02. Reset & base
 *  03. Header & dropdown menu
 *  04. Right-rail table of contents (wide screens)
 *  05. Hero / About
 *  06. Shared section styles
 *  07. News
 *  08. Publications & patents
 *  09. Experience, awards & compact lists
 *  10. Footer & back-to-top
 *  11. Animations & interactions
 *  12. Responsive
 *  13. Reduced motion & print
 * ============================================================ */

/* ===== 01. Design tokens ===== */
:root {
  --bg:               #ffffff;
  --bg-alt:           #f4f9f8;
  --text:             #1c2b2d;
  --text-muted:       #4f6266;
  --accent:           #0f766e;
  --accent-hover:     #115e59;
  --accent-soft:      #d9f2ee;
  --accent-soft-text: #134e4a;
  --border:           #e2e9e8;
  --shadow:      0 1px 3px rgba(15, 118, 110, 0.08), 0 8px 24px rgba(15, 118, 110, 0.06);
  --shadow-lift: 0 4px 12px rgba(15, 118, 110, 0.12), 0 12px 32px rgba(15, 118, 110, 0.10);

  --font-body: "Inter", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Apple SD Gothic Neo", sans-serif;
  --font-heading: "Source Serif 4", "Noto Sans KR", Georgia, serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Animated gradient stops for the hero name */
  --name-grad-1: #0f766e;
  --name-grad-2: #0e7490;

  --header-h: 4rem;
  --content-w: 51.25rem; /* 820px at full scale */
  --radius: 10px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:               #0f1719;
  --bg-alt:           #162224;
  --text:             #e6edec;
  --text-muted:       #94a8a9;
  --accent:           #2dd4bf;
  --accent-hover:     #5eead4;
  --accent-soft:      rgba(45, 212, 191, 0.12);
  --accent-soft-text: #7df0dd;
  --border:           #243335;
  --shadow:      0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.4);

  --name-grad-1: #2dd4bf;
  --name-grad-2: #22d3ee;

  color-scheme: dark;
}

/* ===== 02. Reset & base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Global scale: sized to look like ~93% browser zoom at default settings */
  font-size: 93%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.25;
  margin: 0;
}

p {
  margin: 0 0 var(--space-4);
}

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

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

/* Animated underline for in-text links */
.bio a,
.news-text a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1.5px;
  transition: background-size 0.25s ease, color 0.15s ease;
}

.bio a:hover,
.news-text a:hover {
  background-size: 100% 1.5px;
  color: var(--accent-hover);
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: var(--space-2);
}

/* ===== 03. Header & navigation ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--content-w);
  margin-inline: auto;
  padding-inline: var(--space-6);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
  margin-right: auto;
}

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

/* Dropdown menu — opened by the burger; replaced by the right-rail TOC on wide screens */
.site-nav {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: none;
}

.site-header.nav-open .site-nav {
  display: block;
}

.site-nav ul {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 var(--space-6);
  padding: var(--space-3) var(--space-6);
  max-width: var(--content-w);
  margin-inline: auto;
}

.site-nav a {
  display: block;
  padding: var(--space-2);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-nav a.active {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cv-btn {
  gap: 0.4rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Theme toggle: show one icon per theme */
[data-theme="light"] .icon-sun,
:root:not([data-theme="dark"]) .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

/* Hamburger: visible until the right-rail TOC takes over; icon swaps when open */
.nav-burger .burger-close {
  display: none;
}

.site-header.nav-open .burger-open {
  display: none;
}

.site-header.nav-open .burger-close {
  display: block;
}

/* ===== 04. Right-rail table of contents (wide screens) ===== */
.toc {
  display: none;
}

@media (min-width: 1180px) {
  .nav-burger,
  .site-header.nav-open .site-nav,
  .site-nav {
    display: none;
  }

  .toc {
    display: block;
    position: fixed;
    z-index: 30;
    top: calc(var(--header-h) + var(--space-12));
    left: calc(50% + 26.45rem); /* just right of the content column */
    width: max-content;
    /* never reach past the viewport edge */
    max-width: calc(50vw - 26.45rem - 8px);
  }

  .toc-title {
    margin: 0 0 var(--space-2) var(--space-4);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
  }

  .toc ul {
    border-left: 2px solid var(--border);
  }

  .toc a {
    display: block;
    padding: 0.26rem var(--space-2) 0.26rem var(--space-4);
    margin-left: -2px;
    border-left: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  }

  .toc a:hover {
    color: var(--accent);
    transform: translateX(2px);
  }

  .toc a.active {
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
  }
}

/* ===== 05. Hero / About ===== */
.section {
  max-width: var(--content-w);
  margin-inline: auto;
  padding: var(--space-10) var(--space-6) var(--space-4);
}

.section-hero {
  padding-top: var(--space-16);
}

.hero {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.hero-text {
  flex: 1;
}

.hero-eyebrow {
  margin: 0 0 var(--space-1);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
}

.hero-name {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.hero-name .name-accent {
  position: relative;
  white-space: nowrap;
  /* Mostly text-colored, with a narrow teal-cyan sheen drifting through */
  background-image: linear-gradient(
    105deg,
    var(--text) 0%,
    var(--text) 40%,
    var(--name-grad-1) 50%,
    var(--name-grad-2) 56%,
    var(--text) 66%,
    var(--text) 100%
  );
  background-size: 300% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: name-gradient 6s ease-in-out infinite;
}

@keyframes name-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Soft teal brush under the name */
.hero-name .name-accent::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 0.08em;
  height: 0.32em;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 3px;
}

.hero-title {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.hero-affiliation {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.hero-affiliation .affil-line {
  display: block;
}

.affil-email {
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.chip svg {
  flex-shrink: 0;
}

/* Portrait flip card: photo on the front, signature on the back */
.flip-card {
  perspective: 1000px;
  width: fit-content;
  cursor: pointer;
}

.flip-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

/* Hover-flip only on devices with a real pointer — on touch screens a
   tap leaves :hover "stuck", which kept the card from flipping back */
@media (hover: hover) {
  .flip-card:hover .flip-inner {
    transform: rotateY(180deg);
  }
}

.flip-card.flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
}

.hero-portrait img {
  display: block;
  width: 11.875rem; /* 190px at full scale */
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
}

.flip-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  /* deep teal — dark enough for white ink in both themes */
  background: linear-gradient(150deg, #115e59 0%, #0f3f44 55%, #0c2b30 100%);
  box-shadow: var(--shadow-lift);
}

.flip-back-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.signature {
  font-family: "Allura", cursive;
  font-size: 2.4rem;
  line-height: 1.1;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  transform: rotate(-4deg);
  user-select: none;
}

.motto {
  margin-top: 0.9rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  user-select: none;
}

.motto::before {
  content: "";
  display: block;
  width: 1.75rem;
  height: 1px;
  margin: 0 auto 0.7rem;
  background: rgba(255, 255, 255, 0.35);
}

.bio {
  font-size: 1.02rem;
  margin-bottom: var(--space-6);
}

.bio p {
  margin: 0 0 var(--space-4);
}

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

.interests {
  margin-bottom: var(--space-6);
}

.interests-label {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag-list + .tag-list {
  margin-top: var(--space-2);
}

.tag {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  transition: transform 0.15s ease;
}

.tag--sub {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tag:hover {
  transform: translateY(-2px);
}

.edu-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.edu-item:last-child {
  border-bottom: none;
}

.edu-school {
  font-weight: 600;
}

.edu-degree,
.edu-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.edu-side {
  text-align: right;
  padding-top: 2px;
}

.edu-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.edu-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== 05. Shared section styles ===== */
.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.25rem;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.subsection-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: var(--space-8) 0 var(--space-4);
}

.subsection-title:first-child {
  margin-top: 0;
}

/* ===== 06. News ===== */
.news-list {
  display: flex;
  flex-direction: column;
}

.news-item {
  display: flex;
  gap: var(--space-4);
  padding: 0.6rem var(--space-3);
  border-left: 2px solid var(--border);
  margin-left: var(--space-1);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.news-item:hover {
  background: var(--bg-alt);
  border-left-color: var(--accent);
}

.news-item.highlight {
  border-left-color: var(--accent);
}

.news-date {
  flex: 0 0 6.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-top: 2px;
  white-space: nowrap;
}

.news-text {
  margin: 0;
  font-size: 0.95rem;
}

.news-text b {
  color: var(--accent);
  font-weight: 600;
}

/* ===== 07. Publications & patents ===== */
.pub-card {
  position: relative;
  padding: 0.3rem var(--space-6) 0.6rem;
  margin-bottom: var(--space-3);
  line-height: 1.4;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  border-left-color: var(--accent);
}

/* Small circular C1/C2/P1/P2 marker in the top-right corner */
.pub-id {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 0.68rem;
  font-weight: 700;
}

.pub-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  padding-right: 2.2rem; /* keep clear of the .pub-id circle */
}

.pub-authors {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.pub-authors strong,
.patent-meta strong {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.pub-venue {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.pub-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
}

.pub-venue-tag,
.pub-award {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  white-space: nowrap;
}

.pub-venue-tag {
  background: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .pub-venue-tag {
  color: #0f1719;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.pub-link {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

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

[data-theme="dark"] .pub-link:hover {
  color: #0f1719;
}

.pub-legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
}

.patent-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.patent-item:last-child {
  border-bottom: none;
}

.patent-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

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

/* ===== 08. Experience, awards & compact lists ===== */
.timeline-item {
  position: relative;
  padding: 0 0 var(--space-6) var(--space-6);
  border-left: 2px solid var(--border);
  margin-left: var(--space-1);
}

.timeline-item:last-child {
  padding-bottom: var(--space-2);
}

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

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  /* tight row gap so the period/location row hugs the org line when it
     wraps below on narrow screens; normal column gap side by side */
  gap: 0.15rem var(--space-4);
  flex-wrap: wrap;
}

.timeline-role {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
}

.timeline-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.timeline-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-org {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.timeline-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
}

/* Compact rows: fellowships, awards, talks, teaching, activities */
.row-list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  padding: 0.6rem var(--space-2);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.row-list .row:hover {
  background: var(--bg-alt);
}

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

.row-main {
  min-width: 0;
}

.row-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.row-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.row-note {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

.row-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

/* ===== 09. Footer & back-to-top ===== */
.site-footer {
  margin-top: 4.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer-inner {
  max-width: var(--content-w);
  margin-inline: auto;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.footer-copyright {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-1);
}

.footer-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 40;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.15s ease;
}

[data-theme="dark"] .back-to-top {
  color: #0f1719;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-hover);
}

/* ===== 10. Animations & interactions ===== */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ===== 11. Responsive ===== */
@media (max-width: 720px) {
  .header-inner {
    gap: var(--space-2);
  }

  .section {
    padding: var(--space-8) var(--space-4) var(--space-2);
  }

  .section-hero {
    padding-top: var(--space-8);
  }

  .hero {
    flex-direction: column-reverse;
    text-align: center;
    gap: var(--space-6);
  }

  .hero-portrait .flip-card {
    margin-inline: auto;
  }

  .hero-portrait img {
    width: 9.375rem; /* 150px at full scale */
  }

  .signature {
    font-size: 2rem; /* keep side margins on the narrower card */
  }

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

  .news-date {
    flex-basis: 5.2rem;
  }

  .pub-card {
    padding: 0.3rem var(--space-4) 0.6rem;
  }

  .edu-item,
  .row-list .row {
    flex-direction: column;
    gap: var(--space-1);
  }

  .row-date,
  .edu-side {
    text-align: left;
  }

  .timeline-side {
    align-items: flex-start;
  }

  .back-to-top {
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

@media (max-width: 480px) {
  .site-nav ul {
    grid-template-columns: 1fr;
  }

  /* Keep the header on one line on very small screens */
  .header-inner {
    padding-inline: var(--space-3);
    gap: var(--space-1);
  }

  .header-actions {
    gap: var(--space-1);
  }

  .cv-btn span {
    display: none; /* icon-only CV button */
  }

  .icon-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-1);
  }

  .news-item {
    flex-direction: column;
    gap: var(--space-1);
  }

  /* flex-basis was sized for the horizontal layout; in column
     direction it would become a 5.2rem-tall date box */
  .news-date {
    flex-basis: auto;
  }

  .timeline-item {
    padding-left: var(--space-4);
  }
}

/* ===== 12. Reduced motion & print ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

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

@media print {
  .site-header,
  .toc,
  .back-to-top,
  .skip-link {
    display: none;
  }

  .hero-name .name-accent {
    background: none;
    animation: none;
    color: #000;
    -webkit-text-fill-color: initial;
  }

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

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

  .pub-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
