/* Reset & Base */
* {
  box-sizing: border-box;
}

b, strong {
  font-weight: 800;
}

body {
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #f8f9fa;
  font-family: 'Source Sans Pro', 'Lato', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: #0067cf;
  text-decoration: none;
}

a:focus,
a:hover {
  color: #9f5602;
  text-decoration: none;
}

h2 {
  color: #213c7a;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Layout */
.content {
  position: relative;
  max-width: 900px;
  margin: 30px auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

/* Background image overlay (toggle via data-bg="on" / "off" on .content) */
.content[data-bg="on"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('img/glacier.jpg') center / cover no-repeat;
  opacity: 0.075;
  border-radius: 8px;
  pointer-events: none;
  z-index: 0;
}

.content[data-bg="on"] > * {
  position: relative;
  z-index: 1;
}

/* Name */
.name {
  font-family: 'Source Sans Pro', 'Lato', Arial, sans-serif;
  font-size: 32px;
  font-weight: 500;
  display: block;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: #555;
  font-size: 14px;
  margin-bottom: 1rem;
}

/* Profile section */
.profile-section {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.profile-text {
  flex: 3;
  text-align: justify;
}

.profile-image {
  flex: 1;
  max-width: 190px;
  padding-top: 1.75rem;
}

.profile-image img {
  width: 100%;
  max-width: 100%;
  border-radius: 4px;
}

.profile-image .cmp-wrapper {
  transition: opacity 0.25s ease;
}

.profile-image .cmp-wrapper:hover {
  opacity: 0.85;
}

/* Social links bar */
.social-links {
  text-align: center;
  margin: 1rem 0;
}

.social-links a {
  margin: 0 0.3em;
  white-space: nowrap;
  padding: 6px 6px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.social-links a:hover,
.social-links a:focus {
  background-color: #f0f4f8;
  color: #0067cf;
  text-decoration: none;
}

.social-links a i {
  margin-right: 0.2em;
}

/* Hiring box */
.news-box {
  background-color: #def1ff;
  border-left: 4px solid #00229c;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 14px;
  line-height: 1.55;
}

/* News timeline */
.news-timeline {
  position: relative;
  padding-left: 20px;
  margin-left: 0px;
  max-height: 310px;
  overflow-y: auto;
  overflow-x: auto;
  padding-right: 18px;
}

.news-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0px;
  bottom: 12px;
  width: 2px;
  background: #c8d6e5;
  z-index: 0;
}

.news-item {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
}

.news-item::before {
  content: '';
  position: absolute;
  left: -16.5px;
  top: 7.5px;
  width: 5px;
  height: 5px;
  background: #213c7a;
  border-radius: 50%;
  z-index: 1;
}

.news-date {
  flex-shrink: 0;
  width: 70px;
  font-size: 14px;
  color: #555;
  font-weight: 600;
}

/* Scrollbar styling */
.news-timeline::-webkit-scrollbar {
  width: 6px;
}

.news-timeline::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.news-timeline::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 3px;
}

.news-timeline::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Research section */
.research {
  background: #def1ff;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 2.75rem 0 2rem;
}

.research h2 {
  margin-top: -4px;
}

.research-item {
  margin-bottom: 1.5rem;
  line-height: 1.35;
}

.research-item h3 {
  margin: 0;
  font-size: 15px;
}

.research-item p {
  margin: 0.2rem 0 0;
}

.research-item a {
  color: #b40101;
  text-decoration: none;
}

.research-item a:hover {
  text-decoration: underline;
}

/* Paper link buttons */
.paper-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.paper-btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background-color: #03417e;
  color: white !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.paper-btn:hover {
  background-color: #f09228;
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.paper-btn i {
  margin-right: 0.3rem;
}

/* Footer */
.footer {
  text-align: center;
  font-size: small;
  color: #888;
  padding: 1rem 0;
  margin-top: -2em;
}

.footer p:first-child {
  margin-bottom: 0;
}

.footer p:last-child {
  margin-top: 0.2em;
}

.footer a {
  color: #888;
}

.footer a:hover {
  color: #f09228;
}

/* Image comparison slider */
.cmp-wrapper {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  cursor: col-resize;
}

.cmp-base-img,
.cmp-top-img {
  display: block;
  width: 100%;
  border-radius: 4px;
  pointer-events: none;
}

.cmp-top-img {
  position: absolute;
  top: 0;
  left: 0;
  clip-path: inset(0 0% 0 0);
}

.cmp-divider {
  position: absolute;
  top: 0;
  left: 100%;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  transform: translateX(-50%);
}

.cmp-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.15);
}

.cmp-handle::before,
.cmp-handle::after {
  position: absolute;
  content: "";
  top: 50%;
  border: 7px solid transparent;
  border-bottom-width: 0;
  border-right-width: 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.cmp-handle::before {
  left: 38%;
  border-left-color: rgba(255, 255, 255, 0.9);
}

.cmp-handle::after {
  left: 62%;
  border-top-color: rgba(255, 255, 255, 0.9);
}

.cmp-range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: col-resize;
  margin: 0;
  -webkit-appearance: none;
}

/* Floating Table of Contents */
.toc {
  position: fixed;
  top: 30px;
  left: calc((100vw + 900px) / 2 + 20px);
  z-index: 100;
  width: 140px;
}

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

.toc li {
  margin-bottom: 0.25rem;
}

.toc-link {
  display: block;
  padding: 0.45rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  color: #555 !important;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.toc-link:hover {
  color: #213c7a !important;
  background: rgba(222, 241, 255, 0.6);
  border-left-color: #213c7a;
}

.toc-link.active {
  color: #213c7a !important;
  font-weight: 600;
  border-left-color: #213c7a;
  background: rgba(222, 241, 255, 0.8);
}

.toc-link i {
  width: 18px;
  text-align: center;
  margin-right: 0.35rem;
  font-size: 12px;
}

/* Hide TOC when viewport is too narrow for the sidebar */
@media screen and (max-width: 1200px) {
  .toc {
    display: none;
  }
}

/* Responsive */
@media screen and (max-width: 660px) {
  .profile-section {
    flex-direction: column-reverse;
    align-items: center;
  }

  .profile-image {
    max-width: 180px;
  }

  .profile-text {
    text-align: left;
  }

  .content {
    margin: 10px;
    padding: 20px;
  }

  .research {
    padding: 1rem;
  }
}

/* Background image toggle button */
.bg-toggle {
  position: fixed;
  top: 14px;
  right: 96px;
  z-index: 9999;
  background: #def1ff;
  border: 1.5px solid #213c7a;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #213c7a;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.bg-toggle:hover {
  background: #eee;
  border-color: #888;
}

/* TOC toggle button */
.toc-toggle {
  position: fixed;
  top: 14px;
  right: 56px;
  z-index: 9999;
  background: #def1ff;
  border: 1.5px solid #213c7a;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #213c7a;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.toc-toggle:hover {
  background: #eee;
  border-color: #888;
}

/* Dark-mode toggle button */
.dark-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 9999;
  background: #def1ff;
  border: 1.5px solid #213c7a;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #213c7a;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.dark-toggle:hover {
  background: #eee;
  border-color: #888;
}

/* Dark mode via filter inversion */
html.dark-mode {
  filter: invert(1) hue-rotate(180deg);
  background: #fff;
}

/* Counter-invert images / videos so they look normal */
html.dark-mode img,
html.dark-mode video,
html.dark-mode picture,
html.dark-mode svg,
html.dark-mode .content[data-bg="on"]::before {
  filter: invert(1) hue-rotate(180deg);
}
