/* ================================
   GENERAL
   ================================ */

body {
  font-size: 1.05rem;
  line-height: 1.7;
}

main {
  position: relative;
}

.content {
  position: relative;
  z-index: 2;
}

h1,
h2,
h3 {
  font-weight: 500;
}

a {
  text-underline-offset: 4px;
}


/* ================================
   NAVIGATION
   ================================ */

.navbar {
  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.08);
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.navbar-nav .nav-link {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}


/* ================================
   ANIMATED BACKGROUND
   ================================ */

.hero-background {
  position: absolute;
  top: 60px;
  left: 0;
  width: 100%;
  height: 720px;

  overflow: hidden;

  pointer-events: none;

  z-index: 0;

  mask-image:
    linear-gradient(
      to bottom,
      black 0%,
      black 70%,
      transparent 100%
    );
}

#topology-animation {
  width: 100%;
  height: 100%;
}

.topology-node {
  fill: rgba(
    125,
    211,
    252,
    0.65
  );
}

.topology-edge {
  stroke: rgba(
    125,
    211,
    252,
    0.12
  );

  stroke-width: 1.1;
}

.topology-triangle {
  fill: rgba(
    125,
    211,
    252,
    0.025
  );

  stroke: none;
}


/* ================================
   HERO
   ================================ */

.hero-section {
  position: relative;
  z-index: 2;

  display: grid;

  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(260px, 0.65fr);

  gap: 5rem;

  align-items: center;

  min-height: 650px;

  padding:
    5rem
    max(5vw, 2rem)
    6rem;
}

.hero-eyebrow {
  margin-bottom: 1.3rem;

  font-size: 0.78rem;

  letter-spacing: 0.23em;

  font-weight: 600;

  opacity: 0.7;
}

.hero-text h1 {
  font-size:
    clamp(
      4.8rem,
      9vw,
      9rem
    );

  line-height: 0.82;

  letter-spacing: -0.055em;

  margin:
    0
    0
    2rem;
}

.hero-text h2 {
  margin-bottom: 0.1rem;

  font-family:
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-size: 1.35rem;

  font-weight: 500;
}

.hero-text h3 {
  margin-top: 0;

  font-family:
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-size: 1.05rem;

  opacity: 0.72;
}

.hero-text p {
  max-width: 680px;

  font-size: 1.15rem;

  margin-top: 2rem;
}

.hero-photo {
  display: flex;

  justify-content: center;

  align-items: center;
}

.profile-photo {
  width:
    min(
      100%,
      360px
    );

  aspect-ratio: 4 / 5;

  object-fit: cover;

  border-radius: 22px;

  box-shadow:
    0 30px 70px
    rgba(0, 0, 0, 0.35);

  border:
    1px solid
    rgba(255, 255, 255, 0.12);
}


/* ================================
   BUTTONS
   ================================ */

.btn {
  margin-right: 0.55rem;
  margin-top: 0.7rem;

  border-radius: 100px;

  padding:
    0.7rem
    1.3rem;

  font-size: 0.92rem;
}


/* ================================
   GENERAL SECTION STYLING
   ================================ */

.section-label {
  font-size: 0.72rem;

  letter-spacing: 0.23em;

  font-weight: 600;

  opacity: 0.58;

  margin-bottom: 1rem;
}

.research-section,
.equation-section,
.contact-section {
  position: relative;

  z-index: 2;

  padding:
    5rem
    max(6vw, 2rem);
}


/* ================================
   RESEARCH
   ================================ */

.research-section {
  background:
    rgba(
      255,
      255,
      255,
      0.018
    );
}

.research-section > h2 {
  max-width: 700px;

  font-size:
    clamp(
      2.3rem,
      4vw,
      4rem
    );

  margin-bottom: 3rem;
}

.research-grid {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 1.4rem;

  max-width: 1200px;
}

.research-card {
  position: relative;

  overflow: hidden;

  min-height: 260px;

  padding: 2.3rem;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.09
    );

  border-radius: 18px;

  background:
    rgba(
      255,
      255,
      255,
      0.025
    );

  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    background 0.3s ease;
}

.research-card:hover {
  transform:
    translateY(-5px);

  border-color:
    rgba(
      125,
      211,
      252,
      0.35
    );

  background:
    rgba(
      255,
      255,
      255,
      0.045
    );
}

.research-card h3 {
  position: relative;

  z-index: 2;

  font-size: 1.65rem;

  margin-top: 0;
}

.research-card p,
.research-card a {
  position: relative;

  z-index: 2;
}

.research-number {
  position: absolute;

  right: 1.2rem;
  bottom: -2rem;

  font-size: 9rem;

  line-height: 1;

  font-weight: 700;

  opacity: 0.035;
}


/* ================================
   EQUATIONS
   ================================ */

.equation-section {
  border-top:
    1px solid
    rgba(
      255,
      255,
      255,
      0.07
    );
}

.equation-grid {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      minmax(0, 1fr)
    );

  gap: 2rem;
}

.equation-grid > div {
  padding: 2rem;

  border-left:
    1px solid
    rgba(
      125,
      211,
      252,
      0.3
    );
}

.equation-grid h3 {
  font-size: 1.25rem;
}


/* ================================
   ABOUT PAGE
   ================================ */

.personal-section {
  margin-top: 2rem;
}

.personal-text {
  max-width: 760px;
}

.personal-photos {
  display: grid;

  grid-template-columns:
    1.35fr 1fr;

  gap: 1.5rem;

  margin-top: 2.5rem;

  align-items: start;
}

.personal-photo {
  width: 100%;

  height: 420px;

  object-fit: cover;

  border-radius: 18px;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.1
    );
}


/* ================================
   FOOTER
   ================================ */

.nav-footer {
  font-size: 0.9rem;

  border-top:
    1px solid
    rgba(
      255,
      255,
      255,
      0.08
    );
}


/* ================================
   MOBILE
   ================================ */

@media (max-width: 850px) {

  .hero-section {
    grid-template-columns: 1fr;

    gap: 2rem;

    min-height: unset;

    padding-top: 3rem;
  }

  .hero-photo {
    order: -1;

    justify-content: flex-start;
  }

  .profile-photo {
    max-width: 250px;
  }

  .hero-text h1 {
    font-size:
      clamp(
        4rem,
        17vw,
        6rem
      );
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .equation-grid {
    grid-template-columns: 1fr;
  }

  .personal-photos {
    grid-template-columns: 1fr;
  }

  .personal-photo {
    height: auto;
  }
}


/* ================================
   ACCESSIBILITY
   ================================ */

@media (
  prefers-reduced-motion: reduce
) {

  .research-card {
    transition: none;
  }

}


/* =================================
   UPDATED TOPOLOGY ANIMATION
   ================================= */

.hero-background {
  position: absolute;
  top: 60px;
  left: 0;

  width: 100%;
  height: 700px;

  overflow: hidden;

  pointer-events: none;

  z-index: 0;

  opacity: 1;

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      black 0%,
      black 72%,
      transparent 100%
    );

  mask-image:
    linear-gradient(
      to bottom,
      black 0%,
      black 72%,
      transparent 100%
    );
}


#topology-canvas {
  display: block;

  width: 100%;
  height: 100%;
}


/* Give equations their own visual identity */

.equation-section {
  position: relative;
  z-index: 2;

  padding:
    5rem
    max(6vw, 2rem);

  border-top:
    1px solid
    rgba(255,255,255,0.07);
}


.equation-section > h2 {
  font-size:
    clamp(
      2rem,
      3vw,
      3.3rem
    );

  margin-bottom: 3rem;
}


.equation-grid {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      minmax(0,1fr)
    );

  gap: 1.5rem;
}


.equation-card {
  min-width: 0;

  padding: 2rem;

  border:
    1px solid
    rgba(255,255,255,0.08);

  border-radius: 16px;

  background:
    rgba(255,255,255,0.02);
}


.equation-card h3 {
  margin-top: 0;
  margin-bottom: 2rem;
}


.equation-card .math.display {
  overflow-x: auto;

  font-size: 1.05rem;
}


@media (max-width: 850px) {

  .equation-grid {
    grid-template-columns: 1fr;
  }

  .hero-background {
    height: 600px;
  }

}

/* Mathematical threads: stacked layout */

.equation-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 900px;
}

.equation-card {
  padding: 2rem 2.5rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.025);
}

.equation-card .math.display {
  overflow-x: auto;
  overflow-y: hidden;
}

.equation-card mjx-container[jax="CHTML"][display="true"] {
  margin: 1rem 0 !important;
  text-align: left !important;
}

/* Rainbow shimmer hover effect */

@keyframes rainbow-shimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero-text h1,
.navbar a,
.research-card a,
.contact-section a {
  transition: opacity 0.25s ease;
}

.hero-text h1:hover,
.navbar a:hover,
.research-card a:hover,
.contact-section a:hover {
  background-image: linear-gradient(
    90deg,
    #ff5f6d,
    #ffc371,
    #f9f871,
    #69f0ae,
    #40c9ff,
    #7c4dff,
    #ff5fd2,
    #ff5f6d
  );

  background-size: 300% 300%;

  -webkit-background-clip: text;
  background-clip: text;

  color: transparent !important;

  -webkit-text-fill-color: transparent;

  animation: rainbow-shimmer 2.5s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero-text h1:hover,
  .navbar a:hover,
  .research-card a:hover,
  .contact-section a:hover {
    animation: none;
  }
}

.hero-text h1 {
  cursor: default;
}


/* =================================
   FEATURED CURRENT RESEARCH
   ================================= */

.featured-work {
  position: relative;
  z-index: 2;

  padding:
    5rem
    max(6vw, 2rem);

  border-top:
    1px solid
    rgba(255,255,255,0.07);

  border-bottom:
    1px solid
    rgba(255,255,255,0.07);
}

.featured-work > h2 {
  max-width: 850px;

  font-size:
    clamp(
      2.4rem,
      4vw,
      4rem
    );

  margin-bottom: 1.2rem;
}

.featured-work p {
  max-width: 850px;
  font-size: 1.08rem;
}

.featured-work strong {
  opacity: 0.85;
}


/* Five research cards */

.research-grid {
  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );
}

.research-card:last-child {
  grid-column: 1 / -1;
}


/* =================================
   MATHEMATICAL THREADS FIX
   ================================= */

.equation-stack {
  display: grid !important;
  grid-template-columns: 1fr !important;

  max-width: 900px;

  gap: 1.5rem;
}

.equation-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.equation-card mjx-container {
  max-width: 100%;
}

.equation-card mjx-container[display="true"] {
  display: block !important;

  margin:
    1rem
    0 !important;

  text-align: left !important;

  overflow-x: auto;
  overflow-y: hidden;
}
