/* ==========================================================================
   Jiahe (Chloe) Huang — personal academic homepage
   White & light-blue theme, with an optional dark theme.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f8fc;
  --surface: #ffffff;
  --surface-2: #f7fafd;
  --border: #e2ebf3;
  --border-strong: #cfdeec;

  --text: #1b2838;
  --text-2: #3c4b5e;
  --muted: #66778b;

  --accent: #2a7fc4;          /* links & interactive text (AA on white) */
  --accent-strong: #1c6aa8;
  --accent-soft: #e9f4fd;     /* tinted fills */
  --accent-soft-2: #d6eafa;
  --accent-light: #8fcaf2;    /* decorative light blue */
  --accent-glow: rgba(110, 182, 235, 0.35);

  --award: #e8590c;
  --award-text: #ffffff;

  --shadow-sm: 0 1px 2px rgba(27, 40, 56, 0.04), 0 1px 3px rgba(27, 40, 56, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(30, 90, 140, 0.22), 0 2px 6px rgba(27, 40, 56, 0.04);

  --nav-bg: rgba(255, 255, 255, 0.78);
  --flow-color: 120, 186, 235;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1040px;
  --nav-h: 60px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Newsreader", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1520;
  --bg-soft: #111c29;
  --surface: #142231;
  --surface-2: #172738;
  --border: #22364b;
  --border-strong: #2d4762;

  --text: #e4edf6;
  --text-2: #c3d1df;
  --muted: #8ea2b8;

  --accent: #7cc0ef;
  --accent-strong: #a3d4f6;
  --accent-soft: rgba(124, 192, 239, 0.1);
  --accent-soft-2: rgba(124, 192, 239, 0.18);
  --accent-light: #5aa9de;
  --accent-glow: rgba(90, 169, 222, 0.28);

  --award: #fd9a5b;
  --award-text: #2b1608;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, 0.6);

  --nav-bg: rgba(13, 21, 32, 0.78);
  --flow-color: 62, 118, 168;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-strong); text-decoration: underline; }

strong { font-weight: 600; color: var(--text); }
/* Bold or italic text inside a link keeps the link's color. */
a strong,
a em { color: inherit; }

code { font-family: var(--font-mono); font-size: 0.88em; }

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.3s ease;
}
.nav.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -14px rgba(30, 90, 140, 0.35);
}

.nav-inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-links a {
  position: relative;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 24px 40px;
  background:
    radial-gradient(1100px 420px at 85% -10%, var(--accent-soft-2), transparent 70%),
    radial-gradient(800px 380px at -10% 10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

/* Soft fade from the hero into the page below. */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.flow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
}

.hero-inner {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 56px;
  /* Both columns take the height of the taller one (normally the bio). */
  align-items: stretch;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.avatar-wrap {
  position: relative;
  width: 100%;
  max-width: 230px;
  aspect-ratio: 1;
  padding: 6px;
  border-radius: 32px;
  background: linear-gradient(140deg, var(--accent-light), var(--accent-soft-2) 45%, #ffffff 70%, var(--accent-light));
  box-shadow: 0 24px 50px -22px var(--accent-glow), var(--shadow-sm);
}
:root[data-theme="dark"] .avatar-wrap {
  background: linear-gradient(140deg, var(--accent-light), var(--border-strong) 55%, var(--accent-light));
}
.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 27px;
}

/* Labeled link list under the photo (a column on laptops, pills on phones). */
.socials {
  list-style: none;
  width: 100%;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  /* Fill the rest of the column and spread the rows, so the last link
     lines up with the end of the bio at any laptop width. */
  flex: 1 1 auto;
  justify-content: space-between;
  gap: 0;
}
.socials a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  border-radius: 9px;
  line-height: 1.5;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.socials a i {
  width: 18px;
  text-align: center;
  color: var(--accent);
  font-size: 1rem;
}
.socials a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(2px);
  text-decoration: none;
}

.intro { min-width: 0; padding-top: 6px; }

.pronouns {
  display: inline-block;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.intro h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.3rem, 5vw, 3.3rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--text);
}

.affil {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 14px 0 22px;
  color: var(--text-2);
  font-size: 0.98rem;
}
.affil i { color: var(--accent); font-size: 0.9rem; }
.affil a { color: var(--text-2); }
.affil a:hover { color: var(--accent); }

.bio p {
  margin: 0 0 14px;
  color: var(--text-2);
  text-align: justify;
  hyphens: auto;
}
.bio p:last-child { margin-bottom: 0; }

/* Research lines inside the bio: bold label, description, paper links. */
.bio .research-lines {
  margin: -4px 0 14px;
  padding-left: 22px;
  color: var(--text-2);
}
.bio .research-lines li {
  margin-bottom: 8px;
  padding-left: 2px;
}
.bio .research-lines li:last-child { margin-bottom: 0; }
.bio .research-lines li::marker { color: var(--accent); }

/* ---------- Generic sections ---------- */
.section {
  max-width: calc(var(--maxw) + 48px);
  margin: 0 auto;
  padding: 34px 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 22px;
}
.section-head h2 {
  position: relative;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-head h2::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin-top: 8px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.section-note code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- News ---------- */
.news-box {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.news {
  list-style: none;
  margin: 0;
  padding: 10px 22px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  /* Fade the bottom edge to hint there is more to scroll. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3.5rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 3.5rem), transparent);
  transition: max-height 0.45s ease;
}
.news.at-end,
.news.expanded {
  -webkit-mask-image: none;
  mask-image: none;
}
.news.expanded { max-height: 2000px; overflow: visible; }

.news li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.news li:last-child { border-bottom: 0; }
.news time {
  align-self: start;
  justify-self: start;
  margin-top: 2px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.news p { margin: 0; color: var(--text-2); }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}
.text-btn i { font-size: 0.72rem; transition: transform 0.25s ease; }
.text-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.text-btn:hover { color: var(--accent-strong); }

/* ---------- Publications ---------- */
.pubs { display: grid; gap: 18px; }

.pub {
  position: relative;
  display: grid;
  grid-template-columns: 236px 1fr;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.pub:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* Representative work: light-blue tint and an accent edge. */
.pub-key {
  background:
    linear-gradient(115deg, var(--accent-soft), transparent 55%),
    var(--surface);
  border-color: var(--accent-soft-2);
}
.pub-key::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--accent), var(--accent-light));
}

.pub-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  aspect-ratio: 16 / 10;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: zoom-in;
}
.pub-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.35s ease;
}
.pub:hover .pub-thumb img { transform: scale(1.04); }
:root[data-theme="dark"] .pub-thumb img { filter: brightness(0.93); }

.pub-body { min-width: 0; }

.pub-title {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-authors {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.pub-authors .me {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent-light);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.pub-authors sup { font-size: 0.72em; margin-left: 1px; }

.pub-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--accent-soft-2);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.6;
}
.award {
  display: inline-block;
  margin-left: 7px;
  margin-right: -6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--award);
  color: var(--award-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.6;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.pill i { font-size: 0.78rem; color: var(--accent); }
.pill:hover,
.pill[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent-light);
  background: var(--accent-soft);
  text-decoration: none;
}

.drawer {
  position: relative;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  animation: drawer-in 0.25s ease;
}
.drawer p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.9rem;
  text-align: justify;
  hyphens: auto;
}
.drawer pre {
  margin: 0;
  padding-right: 70px;
  overflow-x: auto;
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.55;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent-light); }
.copy-btn.copied { color: #1f9d55; border-color: #a7e3c0; }

@keyframes drawer-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.callout {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 0 0;
  padding: 13px 18px;
  border: 1px solid var(--accent-soft-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 0.92rem;
}
.callout i { color: var(--accent); }

/* ---------- Experience & Teaching ---------- */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.role {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 18px;
  align-items: start;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.role:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.role-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}
.role-logo img { width: 100%; height: 100%; object-fit: contain; }

.role-body { min-width: 0; }
.role-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
}
.role h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}
.role h3 .course-link { color: inherit; }
.role h3 .course-link:hover { color: var(--accent); }
.role h3 .course-link i {
  margin-left: 4px;
  color: var(--accent);
  font-size: 0.55em;
  vertical-align: 0.3em;
  opacity: 0.8;
}
.role-date {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.role-org {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 0.92rem;
}
.role-org .sep { margin: 0 6px; color: var(--muted); }
.role-loc { color: var(--muted); }
.role-loc i { font-size: 0.8rem; margin-right: 3px; }
.role-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Misc ---------- */
.misc-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.misc-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.misc-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.misc-card p { margin: 0; color: var(--text-2); font-size: 0.94rem; }
.misc-icon {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Contact ---------- */
.contact {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 220px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}
.contact-lead { margin: 0 0 18px; color: var(--text-2); }

.contact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.contact-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}
.contact-tile:hover {
  border-color: var(--accent-light);
  background: var(--accent-soft);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text);
}
.tile-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tile-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tile-value {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.disclosure {
  border-top: 1px solid var(--border);
}
.disclosure summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 2px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { color: var(--accent-strong); }
.disclosure .chev {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.25s ease;
}
.disclosure[open] .chev { transform: rotate(180deg); }
.disclosure-panel { padding: 0 0 16px; animation: drawer-in 0.25s ease; }

.calendar-embed {
  display: block;
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-inner p { margin: 0; }
.to-top {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
}
.to-top:hover { background: var(--accent-soft); text-decoration: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35);
}
.lightbox::backdrop {
  background: rgba(15, 30, 48, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.lightbox img {
  margin: 0 auto;
  max-height: calc(100vh - 140px);
  border-radius: 10px;
  background: #fff;
}
.lightbox-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}
.lightbox-close { position: absolute; top: 8px; right: 8px; background: var(--surface); }

/* ---------- Scroll reveal (only when JS is running) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }

  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 30px -20px rgba(30, 90, 140, 0.4);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .nav-links.open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .nav-links a { padding: 10px 14px; border-radius: 10px; font-size: 0.98rem; }
  .nav-actions { margin-left: auto; }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .profile { gap: 18px; }
  .avatar-wrap { max-width: 210px; }
  .socials {
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-top: 0;
    border-top: 0;
  }
  /* Phones: icon-only round buttons; labels stay for screen readers. */
  .socials a {
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
  }
  .socials a i { width: auto; font-size: 1.05rem; }
  .socials a span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .socials a:hover { transform: none; border-color: var(--accent-light); }
  .intro { text-align: left; }
}

@media (max-width: 640px) {
  .nav-inner,
  .section { padding-left: 16px; padding-right: 16px; }
  .hero { padding: 36px 16px 28px; }
  .brand span { font-size: 1.05rem; }

  .section { padding-top: 34px; padding-bottom: 34px; }
  .section-head h2 { font-size: 1.7rem; }

  .bio p { text-align: left; }

  .news { padding: 6px 16px; max-height: 340px; }
  .news li { grid-template-columns: 1fr; gap: 4px; }

  .pub { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .pub-thumb { aspect-ratio: 2 / 1; }

  .role { grid-template-columns: 44px 1fr; gap: 14px; padding: 14px 16px; }
  .role-logo { width: 44px; height: 44px; padding: 6px; }

  .misc-grid,
  .contact-actions { grid-template-columns: 1fr; }
  .contact { padding: 18px 16px; }
  .calendar-embed { height: 450px; }

  .footer-inner { padding: 18px 16px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .nav, .flow-canvas, .footer .to-top, .text-btn, .pub-links, .disclosure { display: none !important; }
  .news { max-height: none; -webkit-mask-image: none; mask-image: none; }
  .js .reveal { opacity: 1; transform: none; }
}
