/* Research page: light companion to the one-pager (same navy, teal accent, Inter/Lora). */
:root {
  --bg: #f7f8fa;
  --surface: #fff;
  --navy: #0b1c2f;
  --text: #3b4652;
  --muted: #7d8794;
  --line: #e2e6eb;
  --accent: #47bec7;
  --accent-text: #1d8790;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Slim top bar, slides in after the header */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px max(24px, calc((100% - 1080px) / 2));
  background-color: rgba(11, 28, 47, 0.92);
  box-shadow: 0 6px 24px rgba(11, 28, 47, 0.18);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  transform: translateY(-100%);
  transition: transform 0.5s var(--ease);
}

.topnav.shown {
  transform: translateY(0);
}

.topnav .brand {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-arrow {
  display: inline-block;
  margin-right: 4px;
  color: var(--accent);
  transition: transform 0.3s var(--ease);
}

.topnav .brand:hover .brand-arrow {
  transform: translateX(-4px);
}

.topnav-links {
  display: flex;
  gap: 28px;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
}

.menu-toggle svg,
.hero-links svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
}

.menu-toggle .icon-close,
.topnav.menu-open .menu-toggle .icon-menu {
  display: none;
}

.topnav.menu-open .menu-toggle .icon-close {
  display: block;
}

.hero-links svg {
  display: none;
  width: 22px;
  height: 22px;
}

.topnav-links a,
.hero-links a {
  position: relative;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.topnav-links a {
  color: #848d96;
  transition: color 0.3s ease;
}

.topnav-links a:hover {
  color: #fff;
}

/* Underline that grows from the left on hover */
.topnav-links a::after,
.hero-links a::after,
.pub-links a::after,
.footer a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.topnav-links a:hover::after,
.hero-links a:hover::after,
.pub-links a:hover::after,
.footer a:hover::after {
  transform: scaleX(1);
}

/* Header */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 72vh;
  overflow: hidden;
  background-color: var(--navy);
  color: #fff;
}

.hero-bg {
  position: absolute;
  inset: -10% 0 0 0;
  will-change: transform;
}

.hero-bg::before,
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
}

.hero-bg::before {
  background: url('../images/pp-bg.jpg') center / cover no-repeat;
  animation: hero-zoom 2.4s var(--ease) both;
}

.hero-bg::after {
  background: linear-gradient(100deg, rgba(11, 28, 47, 0.92) 0%, rgba(11, 28, 47, 0.7) 45%, rgba(11, 28, 47, 0.35) 100%);
}

@keyframes hero-zoom {
  from {
    transform: scale(1.12);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.hero-inner {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 96px;
}

.hero-back {
  align-self: flex-start;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: color 0.3s ease, transform 0.3s var(--ease);
}

.hero-back:hover {
  color: #fff;
  transform: translateX(-3px);
}

.hero-main {
  margin-top: auto;
}

/* Zero-height anchor right below the header; the portrait hangs half above, half below it */
.portrait-anchor {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  height: 0;
  margin: 0 auto;
}

.hero-portrait {
  position: absolute;
  top: -120px;
  right: 24px;
  width: 240px;
  height: 240px;
  border: 4px solid rgba(214, 98, 34, 0.85);
  border-radius: 50%;
  object-fit: cover;
  object-position: 52% 30%;
  animation: fade-up 1.2s 0.3s var(--ease) both, ring-pulse 2.8s 1.5s ease-out infinite;
  transition: transform 0.6s var(--ease);
}

.hero-portrait:hover {
  transform: scale(1.03);
}

/* Orange ring that pulses outward, matching the warm patches in the header image */
@keyframes ring-pulse {
  0% {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(214, 98, 34, 0.55);
  }
  70% {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 22px rgba(214, 98, 34, 0);
  }
  100% {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(214, 98, 34, 0);
  }
}

.hero-content > * {
  animation: fade-up 1s var(--ease) both;
}

.hero-content > :nth-child(2) {
  animation-delay: 0.12s;
}

.hero-content > :nth-child(3) {
  animation-delay: 0.24s;
}

.hero-content > :nth-child(4) {
  animation-delay: 0.36s;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  margin-bottom: 20px;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: 72px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1.5px;
}

.hero-sub {
  margin: 0 0 36px;
  color: rgba(255, 255, 255, 0.75);
  font-family: Lora, Georgia, serif;
  font-size: 20px;
  line-height: 1.5;
}

.hero-mail {
  position: relative;
  display: table;
  color: inherit;
  transition: color 0.3s ease;
}

.hero-mail:empty {
  display: none;
}

.hero-mail::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.hero-mail:hover {
  color: #fff;
}

.hero-mail:hover::after {
  transform: scaleX(1);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.hero-links a {
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.3s ease;
}

.hero-links a:hover {
  color: #fff;
}

/* Mouse icon: sits in the header, then floats at the bottom while scrolling; clicking jumps to the next section */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 15;
  width: 22px;
  height: 36px;
  margin-left: -11px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  background-color: transparent;
  /* backwards fill: once the entrance ends, the hidden state below can take over */
  animation: fade-up 1s 0.6s var(--ease) backwards;
  transition: opacity 0.4s ease, border-color 0.4s ease, background-color 0.4s ease, transform 0.3s var(--ease);
}

.scroll-cue.floating {
  position: fixed;
  animation: cue-in 0.5s var(--ease);
}

@keyframes cue-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.scroll-cue:hover {
  border-color: var(--accent);
  transform: translateY(2px);
}

.scroll-cue.on-light {
  border-color: rgba(11, 28, 47, 0.3);
  background-color: rgba(247, 248, 250, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.scroll-cue.on-light:hover {
  border-color: var(--accent-text);
}

.scroll-cue.hidden {
  opacity: 0;
  pointer-events: none;
}

.scroll-cue span {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background-color: var(--accent);
  animation: scroll-dot 1.8s ease-in-out infinite;
}

@keyframes scroll-dot {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Sections: sticky label on the left, content on the right */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 180px 24px 40px;
}

.section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  margin-bottom: 112px;
}

.section-label {
  position: sticky;
  top: 100px;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 0;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.section-label::before {
  content: "";
  width: 28px;
  height: 1px;
  background-color: var(--accent);
  transform-origin: left;
  transition: transform 0.8s 0.2s var(--ease);
}

.js .section-label:not(.visible)::before {
  transform: scaleX(0);
}

.about p {
  margin: 0 0 18px;
  color: var(--text);
  font-family: Lora, Georgia, serif;
  font-size: 19px;
  line-height: 1.7;
}

.about p:first-child::first-line {
  color: var(--navy);
}

/* Publications */
.year-group + .year-group {
  margin-top: 48px;
}

.year {
  margin: 0 0 8px;
  color: #cfd6de;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1px;
}

.pub {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 28px;
  margin: 0 -20px;
  padding: 20px;
  border-radius: 14px;
  transition: background-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s var(--ease), opacity 0.8s var(--ease);
}

.pub:hover {
  background-color: var(--surface);
  box-shadow: 0 14px 36px rgba(11, 28, 47, 0.08);
  transform: translateY(-2px);
}

.pub-no-thumb {
  grid-template-columns: 1fr;
}

.pub-media {
  overflow: hidden;
  width: 150px;
  height: 94px;
  border-radius: 8px;
  background-color: var(--line);
}

.pub-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}

.pub:hover .pub-media img {
  transform: scale(1.07);
}

.pub-title {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.pub-authors {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.pub-authors .me {
  color: var(--navy);
  font-weight: 600;
}

.pub-venue {
  margin-top: 2px;
  color: var(--muted);
  font-family: Lora, Georgia, serif;
  font-size: 14px;
  font-style: italic;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 10px;
}

.pub-links a,
.abstract-toggle {
  position: relative;
  color: var(--accent-text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.abstract-toggle::after {
  content: "+";
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.4s var(--ease);
}

.open .abstract-toggle::after {
  transform: rotate(45deg);
}

/* Smooth expand: animate the row from 0fr to 1fr */
.pub-abstract {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease);
}

.pub-abstract > div {
  overflow: hidden;
}

.open .pub-abstract {
  grid-template-rows: 1fr;
}

.pub-abstract p {
  margin: 0;
  padding-top: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.open .pub-abstract p {
  opacity: 1;
  transition-delay: 0.15s;
}

.pub-abstract .more-link {
  padding-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* Experience and education */
.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 1px;
  background-color: var(--line);
}

.timeline li {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 28px 32px;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background-color: var(--bg);
  transition: background-color 0.3s ease, transform 0.3s var(--ease);
}

.timeline li:hover::before {
  background-color: var(--accent);
  transform: scale(1.3);
}

.timeline .when {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.timeline strong {
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
}

.timeline .where {
  color: var(--muted);
  font-size: 14px;
}

.footer {
  padding: 40px 24px 56px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer a {
  position: relative;
  color: var(--navy);
}

/* Back-to-top button, appears with the top bar */
.to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background-color: var(--surface);
  color: var(--navy);
  box-shadow: 0 10px 28px rgba(11, 28, 47, 0.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease), background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.to-top.shown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.to-top:hover {
  border-color: var(--accent);
  background-color: var(--accent);
  color: #fff;
  transform: translateY(-3px);
}

.to-top svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Scroll reveal (only when JavaScript runs, so content never stays hidden) */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

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

.js .pub.reveal.visible:hover {
  transform: translateY(-2px);
}

@media screen and (max-width: 820px) {
  .menu-toggle {
    display: flex;
  }

  /* Dropdown under the top bar */
  .topnav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px 24px 16px;
    background-color: rgba(11, 28, 47, 0.97);
    box-shadow: 0 12px 24px rgba(11, 28, 47, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s var(--ease);
  }

  .topnav.menu-open .topnav-links {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .topnav-links a {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
  }

  .topnav-links a:last-child {
    border-bottom: 0;
  }

  .topnav-links a::after {
    display: none;
  }

  /* Header links: icons only */
  .hero-links {
    gap: 32px;
  }

  .hero-links svg {
    display: block;
  }

  .hero-links span {
    display: none;
  }

  .hero {
    min-height: 64vh;
  }

  .hero h1 {
    font-size: 52px;
  }

  .hero-portrait {
    top: -60px;
    width: 120px;
    height: 120px;
    border-width: 3px;
  }

  .page {
    padding-top: 100px;
  }

  .to-top {
    right: 16px;
    bottom: 16px;
  }

  .hero-sub {
    font-size: 17px;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 80px;
  }

  .section-label {
    position: static;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 0 -12px;
    padding: 16px 12px;
  }

  .pub-media {
    width: 100%;
    height: 180px;
  }
}

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

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

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