:root {
  --bg: #fffaf0;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17, 24, 39, 0.12);
  --accent: #000077;
  --link: var(--accent);
  --link-hover: #111827;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
  --radius: 16px;
  --focus: rgba(0, 0, 119, 0.35);
}

html[data-theme="dark"] {
  --bg: #0b1020;
  --card: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.25);
  --accent: #93c5fd;
  --link: var(--accent);
  --link-hover: #ffffff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --focus: rgba(147, 197, 253, 0.4);
}

html {
  scroll-behavior: smooth;
}

/* Keep anchored headings/sections from hiding under the sticky top bar */
*[id] {
  scroll-margin-top: 84px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--link);
}

a:hover,
a:focus {
  color: var(--link-hover);
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 2000;
}

.skip-link:focus {
  top: 12px;
}

.site-topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

@supports not (background: color-mix(in srgb, white 50%, black)) {
  .site-topbar {
    background: var(--bg);
  }
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.topnav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.topnav-link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.topnav-link.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.icon-btn:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .icon-btn:hover {
    transform: none;
  }
}

.page-wrap {
  padding-top: 18px;
}

.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* Legacy CSS sets .fixed-posi { position: fixed; } which can overlap the main column.
   Keep the sidebar within its Bootstrap column by using sticky positioning instead. */
@media (min-width: 768px) {
  .fixed-posi.sidebar-card {
    position: sticky !important;
    top: 84px;
    width: 100%;
    max-height: calc(100vh - 100px);
    overflow: auto;
  }
}

.profile-photo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.name {
  color: var(--text) !important;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.social-links a {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  text-decoration: none;
}

.social-links a:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  .social-links a:hover {
    transform: none;
  }
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.pill-btn:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .pill-btn:hover {
    transform: none;
  }
}

.timeline {
  margin-top: 6px;
  position: relative;
  padding-left: 6px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 999px;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  /* Keep the dot centered over the vertical line even with a border */
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--border);
  z-index: 2;
  pointer-events: none;
}

.timeline-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 28px;
  border: 0;
  background: transparent;
  border-radius: 14px;
  text-align: left;
  color: inherit;
  position: relative;
  z-index: 1;
}

.timeline-btn:hover {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.timeline-item.is-active .timeline-btn {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.timeline-item.is-active .timeline-dot {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
}

.timeline-logo {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  display: block;
  border-radius: 12px;
  object-fit: contain;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 4px;
}

.timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.timeline-title {
  font-weight: 650;
  color: var(--text);
  line-height: 1.1;
}

.timeline-years {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.1;
}

.timeline-detail {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
}

.timeline-detail-title {
  font-weight: 650;
  color: var(--text);
}

.timeline-detail-years {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.timeline-detail-desc {
  margin-top: 8px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.35;
}

.institution-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}

.institution-item:first-child {
  border-top: 0;
}

.institution {
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.years {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.1;
}

.section-title {
  margin: 42px 0 12px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.lead-block {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px;
}

.paper {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 14px 14px;
}

.paper:hover {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.10);
}

.papertitle {
  color: var(--text);
  font-weight: 650;
}

.conf,
.confshort,
.tag,
.tagsep {
  color: var(--muted);
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 700ms ease, transform 700ms ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 1200;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
