:root {
  --ink: #222;
  --muted: #555;
  --line: #d7d7d7;
  --paper: #fff;
  --tint: #f5f5f5;
  --link: #0645ad;
  --accent-blue: #275b8c;
  --accent-light: #eef4fb;
  --tag-bg: #eaeff5;
  --active-ring: #0645ad;
}

:root,
body {
  transition: background-color 180ms ease, color 180ms ease;
}

html {
  color-scheme: light;
}

html.dark-mode {
  color-scheme: dark;
  background-color: #141414;
}

html.dark-mode,
body.dark-mode {
  --ink: #f1f1f1;
  --muted: #b0b0b0;
  --line: #383838;
  --paper: #141414;
  --tint: #1e1e1e;
  --link: #8db9ff;
  --accent-blue: #8db9ff;
  --accent-light: #1d2733;
  --tag-bg: #262c35;
  --active-ring: #8db9ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: 92px; /* space for fancy floating mobile bottom dock */
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0;
  }
}

a { color: var(--link); text-underline-offset: 0.15em; }
button { font: inherit; }

.shell {
  width: min(1260px, calc(100% - 48px));
  margin: 0 auto;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: -4rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }

/* Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(8px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.wordmark span { color: #0645ad; }
body.dark-mode .wordmark span { color: #8db9ff; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: 5.5rem; /* Reserve ample clear breathing room so no nav items reach the theme switch area */
}

.site-nav .nav-tab-btn,
.profile-links .nav-tab-btn,
.nav-tab-btn {
  font-size: 0.92rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 150ms ease;
  border-radius: 2px;
}

.site-nav .nav-tab-btn:hover,
.profile-links .nav-tab-btn:hover,
.nav-tab-btn:hover {
  background: var(--tint);
  border-color: var(--ink);
}

.site-nav .nav-tab-btn.active,
.profile-links .nav-tab-btn.active,
.nav-tab-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 600;
}

body.dark-mode .site-nav .nav-tab-btn,
body.dark-mode .profile-links .nav-tab-btn,
body.dark-mode .nav-tab-btn {
  background: #1a1a1a;
  color: #eee;
  border-color: #383838;
}

body.dark-mode .site-nav .nav-tab-btn:hover,
body.dark-mode .profile-links .nav-tab-btn:hover,
body.dark-mode .nav-tab-btn:hover {
  background: #252525;
  border-color: #555;
}

body.dark-mode .site-nav .nav-tab-btn.active,
body.dark-mode .profile-links .nav-tab-btn.active,
body.dark-mode .nav-tab-btn.active {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

/* Theme Switch (Fancy Vintage Lamp Beaded Pull-Cord & Dragging Switch) */
.theme-switch {
  position: fixed;
  z-index: 50;
  top: 96px; /* Suspended comfortably below the 64px navigation bar */
  right: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.8rem 0.42rem 0.65rem;
  border: 1px solid rgba(197, 160, 89, 0.45);
  border-radius: 9999px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf8f0 100%);
  color: #2c2518;
  cursor: grab;
  cursor: -webkit-grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 14px rgba(180, 140, 60, 0.16), 0 2px 4px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
  transform-origin: top center;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

/* Tactile ridges on pull fob */
.theme-switch::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 10px;
  background: repeating-linear-gradient(to bottom, currentColor 0, currentColor 1.5px, transparent 1.5px, transparent 3.5px);
  opacity: 0.35;
  margin-left: 0.15rem;
  pointer-events: none;
}

body.dark-mode .theme-switch {
  background: linear-gradient(180deg, #22262e 0%, #15181e 100%);
  color: #e2e8f0;
  border-color: rgba(141, 185, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(96, 165, 250, 0.18);
}

.theme-switch:hover {
  border-color: rgba(197, 160, 89, 0.85);
  box-shadow: 0 6px 18px rgba(180, 140, 60, 0.26), 0 2px 5px rgba(0, 0, 0, 0.08);
}

body.dark-mode .theme-switch:hover {
  border-color: rgba(141, 185, 255, 0.75);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(96, 165, 250, 0.28);
}

/* Active Dragging States */
.theme-switch.is-dragging {
  cursor: grabbing;
  cursor: -webkit-grabbing;
  transition: none !important;
  box-shadow: 0 8px 24px rgba(180, 140, 60, 0.35), 0 4px 10px rgba(0, 0, 0, 0.12);
}

body.dark-mode .theme-switch.is-dragging {
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.7), 0 0 22px rgba(96, 165, 250, 0.4);
}

.theme-switch.reached-threshold {
  border-color: #f59e0b;
  transform: scale(1.04);
}

body.dark-mode .theme-switch.reached-threshold {
  border-color: #60a5fa;
}

/* Spring snap physics */
.theme-switch.is-springing {
  animation: lampSpring 550ms cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.theme-switch.is-springing .theme-switch-cord {
  animation: cordSway 550ms ease-out forwards;
}

@keyframes lampSpring {
  0% { transform: translateY(22px); }
  25% { transform: translateY(-4px); }
  50% { transform: translateY(2px); }
  75% { transform: translateY(-1px); }
  100% { transform: translateY(0); }
}

@keyframes cordSway {
  0% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(2.5deg); }
  55% { transform: translateX(-50%) rotate(-1.5deg); }
  80% { transform: translateX(-50%) rotate(0.8deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

/* Realistic Vintage Brass Beaded Pull-Chain */
.theme-switch-cord {
  position: absolute;
  top: -32px; /* Starts exactly at the bottom edge of the 64px header (y=64px) down to the fob at y=96px */
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 32px;
  background: radial-gradient(circle at 50% 40%, #f7e186 28%, #c69f37 72%, #684f13 100%) repeat-y;
  background-size: 4px 7px;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.15));
  pointer-events: none;
  transform-origin: top center;
  transition: height 50ms linear, top 50ms linear;
}

body.dark-mode .theme-switch-cord {
  background: radial-gradient(circle at 50% 40%, #e2e8f0 28%, #94a3b8 72%, #475569 100%) repeat-y;
  background-size: 4px 7px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

/* Top Ceiling Mount / Chain Guide Rosette */
.theme-switch-cord::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 5px;
  background: linear-gradient(to right, #8c701e, #f5d77f, #8c701e);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

body.dark-mode .theme-switch-cord::before {
  background: linear-gradient(to right, #475569, #cbd5e1, #475569);
}

/* Lower Brass Coupler Bell attaching chain to fob */
.theme-switch-cord::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 5px;
  background: linear-gradient(to bottom, #f5d77f, #8c701e);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

body.dark-mode .theme-switch-cord::after {
  background: linear-gradient(to bottom, #cbd5e1, #475569);
}

/* Glowing Filament Bulb */
.theme-switch-bulb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b, 0 0 16px rgba(245, 158, 11, 0.45);
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 200ms ease, box-shadow 200ms ease, transform 150ms ease;
}

body.dark-mode .theme-switch-bulb {
  background: #60a5fa;
  box-shadow: 0 0 8px #60a5fa, 0 0 16px rgba(96, 165, 250, 0.5);
}

.theme-switch.reached-threshold .theme-switch-bulb {
  transform: scale(1.3);
  box-shadow: 0 0 14px #f59e0b, 0 0 24px rgba(245, 158, 11, 0.85);
}

body.dark-mode .theme-switch.reached-threshold .theme-switch-bulb {
  box-shadow: 0 0 14px #60a5fa, 0 0 24px rgba(96, 165, 250, 0.85);
}

.theme-switch-label {
  line-height: 1;
  letter-spacing: 0.02em;
}

/* Ambient Lamp Light Flare upon toggle */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 180px;
  background: radial-gradient(ellipse at 88% 0%, rgba(245, 158, 11, 0.35), transparent 70%);
  pointer-events: none;
  z-index: 45;
  opacity: 0;
  transition: opacity 350ms ease-out;
}

body.lamp-flash::before {
  opacity: 1;
  transition: none;
}

/* Hero Section */
.hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(380px, 490px);
  gap: 3.5rem;
  align-items: center;
}
.hero h1 {
  max-width: 700px;
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.hero h1 em {
  font-style: normal;
  font-weight: 300;
  color: var(--muted);
}
.hero-lede {
  max-width: 650px;
  margin-bottom: 0.9rem;
  font-size: 1.18rem;
  line-height: 1.5;
}
.hero-affiliation {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.hero-bio {
  max-width: 650px;
  margin-top: 1.25rem;
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
  padding: 1rem 1.15rem;
  background: var(--tint);
  border-left: 3px solid var(--ink);
}
body.dark-mode .hero-bio {
  border-left-color: #8db9ff;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border-radius: 2px;
  transition: all 160ms ease;
}
.button:hover {
  background: var(--ink);
  color: var(--paper);
}
.button.button-primary {
  background: var(--ink);
  color: var(--paper);
}
.button.button-primary:hover {
  opacity: 0.92;
}
body.dark-mode .button {
  border-color: #555;
  color: #fff;
}
body.dark-mode .button:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}
body.dark-mode .button.button-primary {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.portrait-frame {
  width: 100%;
  margin: 0;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border-radius: 4px;
}
.portrait-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: contain;
  border-radius: 2px;
}
.portrait-frame figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Page Header Banner */
.page-header-banner {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.page-header-banner h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-header-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 720px;
}

/* Sections */
.section { padding: 3.5rem 0; }
.section-tint { background: var(--tint); }
.split-heading {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
}
.split-heading h2 {
  max-width: 760px;
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
}
.intro-copy > p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-top: 0;
}

/* Interactive Research Fields Grid */
.fields-section {
  padding: 2.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}
.fields-instruction {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}
.research-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.field-card {
  text-align: left;
  padding: 1.5rem;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.field-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.field-card.active-field {
  border-color: var(--active-ring);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--active-ring), 0 8px 20px rgba(0,0,0,0.08);
}
body.dark-mode .field-card.active-field {
  background: #1a2330;
  border-color: #8db9ff;
  box-shadow: 0 0 0 2px #8db9ff;
}

.field-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}
.field-number {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}
.field-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.field-card.active-field .field-badge {
  background: var(--ink);
  color: var(--paper);
}
body.dark-mode .field-card.active-field .field-badge {
  background: #fff;
  color: #111;
}

.field-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 700;
}
.field-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  flex-grow: 1;
}
.field-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}
.field-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  background: var(--tint);
  color: var(--muted);
  border-radius: 2px;
  border: 1px solid var(--line);
}
.field-action-hint {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--link);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Active Filter Banner */
.active-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.2rem;
  background: var(--accent-light);
  border: 1px solid var(--line);
  border-left: 4px solid var(--active-ring);
  margin-bottom: 2rem;
  border-radius: 2px;
}
body.dark-mode .active-filter-banner {
  background: #18232e;
}

/* Publications Filter Bar */
.pub-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.filter-tab {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 140ms ease;
}
.filter-tab:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.filter-tab.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 700;
}
body.dark-mode .filter-tab.active {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.pub-search-box {
  position: relative;
  width: min(300px, 100%);
}
.pub-search-box input {
  width: 100%;
  min-height: 38px;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.85rem;
  border-radius: 2px;
}
.pub-search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.pub-section-title {
  margin: 2.5rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pub-section-title span.count {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.publication-list { border-top: 1px solid var(--line); }
.publication {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 150ms ease;
}
.pub-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.pub-badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  width: fit-content;
  border-radius: 2px;
  background: var(--paper);
}
.pub-badge.tit {
  border-color: #275b8c;
  color: #275b8c;
  font-weight: 700;
}
body.dark-mode .pub-badge.tit {
  border-color: #8db9ff;
  color: #8db9ff;
}

.pub-main h3 {
  max-width: 760px;
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  line-height: 1.35;
}
.pub-authors {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.pub-field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.pub-tag-btn {
  background: var(--tint);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 120ms ease;
}
.pub-tag-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.pub-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--ink);
  color: var(--ink);
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  border-radius: 2px;
  transition: all 140ms ease;
}
.pub-link:hover {
  background: var(--ink);
  color: var(--paper);
}
body.dark-mode .pub-link {
  border-color: #4b4b4b;
  color: #fff;
}
body.dark-mode .pub-link:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}

/* Career Page Styles */
.career-section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 769px) {
  .career-section .split-heading {
    grid-template-columns: 280px 1fr;
    gap: 3.5rem;
    align-items: start;
  }
}

.career-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 0.75rem -0.85rem; /* Shift header further to the left, away from inside contents */
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  word-break: normal;
  overflow-wrap: break-word;
}

.career-heading svg {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
  stroke: var(--link);
  margin-top: 0.18rem; /* Aligns with cap height of the first line of text */
  display: inline-block;
}

.career-heading span {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .career-heading {
    margin-left: 0;
    margin-bottom: 0.75rem;
  }
}
.career-timeline {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}
.career-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.career-period {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.career-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}
.career-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.references-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.reference-card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--tint);
  border-radius: 4px;
}
.reference-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}
.reference-card .ref-role {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}
.reference-card p {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.reference-card a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* CV PDF Viewer Page */
.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.cv-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pdf-viewer-container {
  width: 100%;
  margin: 2rem 0 3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #525659;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  overflow: hidden;
}
.pdf-object-frame {
  width: 100%;
  height: 85vh;
  min-height: 700px;
  display: block;
  border: none;
}
.pdf-mobile-fallback {
  background: var(--paper);
  padding: 2rem;
  text-align: center;
}

/* Exact ModernCV Visual Rendering Component */
.moderncv-paper {
  background: #ffffff;
  color: #222222;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 2.5rem 3rem;
  border: 1px solid #d0d7de;
  margin: 2rem auto;
  max-width: 860px;
}
body.dark-mode .moderncv-paper {
  background: #1b1e22;
  color: #e6edf3;
  border-color: #383f47;
}

.cv-page-marker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #888;
  border-top: 1px solid #e0e0e0;
  padding-top: 0.75rem;
  margin-top: 2rem;
}
body.dark-mode .cv-page-marker {
  border-top-color: #383f47;
}

/* Contact */
.contact-section { padding: 4rem 0; border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; }
.contact-grid h2 { max-width: 550px; margin: 0; font-size: 2.3rem; line-height: 1.2; }
.contact-links { border-top: 1px solid var(--line); }
.contact-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 48px;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem;
  text-decoration: none;
  color: var(--ink);
  transition: padding-left 150ms ease;
}
.contact-links a:hover {
  padding-left: 0.4rem;
  color: var(--link);
}

/* Site Footer */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--line); }
.footer-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Mobile Quick Navigation Bar */
.mobile-bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  .shell { width: calc(100% - 32px); }
  .nav-wrap { min-height: 56px; }
  .site-nav { display: none; }
  .theme-switch {
    top: 86px; /* Suspended below the 56px mobile bar */
    right: 1.25rem;
    padding: 0.35rem 0.65rem 0.35rem 0.55rem;
  }
  .theme-switch-cord {
    top: -30px;
    height: 30px;
  }

  .hero { padding: 2rem 0 1.5rem; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); }
  .portrait-frame {
    width: 100%;
    max-width: 460px;
    margin: 1.5rem auto 0;
  }

  .split-heading,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .research-fields-grid,
  .references-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .pub-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .pub-search-box {
    width: 100%;
  }

  .publication {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1.25rem 0;
  }
  .pub-meta {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }
  .pub-actions {
    margin-top: 0.5rem;
  }

  .career-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .footer-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .moderncv-paper {
    padding: 1.5rem 1.25rem;
    margin: 1rem auto;
  }

  /* Fancy Floating Dock on Mobile */
  .mobile-bottom-bar {
    position: fixed;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    left: 12px;
    right: 12px;
    margin: 0 auto;
    max-width: 480px;
    width: calc(100% - 24px);
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    padding: 6px 6px;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.14),
                0 4px 12px -2px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  }

  body.dark-mode .mobile-bottom-bar {
    background: rgba(22, 22, 26, 0.88);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 38px -4px rgba(0, 0, 0, 0.7),
                0 4px 12px -2px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .mobile-tab,
  .mobile-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 6px 2px 5px;
    background: transparent;
    border: none;
    border-radius: 16px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 180ms ease, background-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-tab svg,
  .mobile-bottom-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8px;
    margin-bottom: 2px;
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), stroke-width 180ms ease, color 180ms ease;
  }

  .mobile-tab:active,
  .mobile-bottom-btn:active {
    transform: scale(0.92);
  }

  .mobile-tab.active,
  .mobile-bottom-btn.active {
    color: var(--link);
    background: var(--tag-bg);
    font-weight: 700;
  }

  .mobile-tab.active svg,
  .mobile-bottom-btn.active svg {
    stroke-width: 2.2px;
    transform: translateY(-1px) scale(1.06);
    color: var(--link);
  }

  /* Tiny glowing dot indicator on active tab */
  .mobile-tab.active::after,
  .mobile-bottom-btn.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--link);
    box-shadow: 0 0 6px var(--link);
  }
}

/* PWA Mobile Installation & Offline UI */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  cursor: pointer;
  background: var(--tint);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.4rem 0.75rem;
  border-radius: 2px;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.pwa-install-btn:hover {
  background: var(--line);
}

.pwa-install-btn svg {
  width: 14px;
  height: 14px;
}

body.dark-mode .pwa-install-btn {
  background: #1e1e1e;
  border-color: #383838;
  color: #f1f1f1;
}

body.dark-mode .pwa-install-btn:hover {
  background: #2a2a2a;
  border-color: #555;
}

.pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.pwa-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pwa-modal {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  padding: 1.5rem;
  position: relative;
  transform: translateY(12px);
  transition: transform 200ms ease;
}

.pwa-modal-backdrop.is-open .pwa-modal {
  transform: translateY(0);
}

.pwa-modal h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-modal p {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}

.pwa-modal ol {
  margin: 0 0 1.25rem;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.6;
}

.pwa-modal ol li {
  margin-bottom: 0.5rem;
}

.pwa-modal .pwa-modal-close-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.pwa-modal .pwa-modal-close-btn:hover {
  opacity: 0.9;
}

.pwa-offline-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 9999;
  background: #2b2b2b;
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 250ms ease, opacity 250ms ease;
  pointer-events: none;
}

.pwa-offline-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media print {
  .site-header,
  .site-footer,
  .theme-switch,
  .mobile-bottom-bar,
  .cv-toolbar,
  .hero-actions,
  .pub-actions {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
    padding-bottom: 0 !important;
  }
  .moderncv-paper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
}
