@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0b0810;
  --accent-1: #6b2f7c;
  --accent-2: #3b2a58;
  --muted: #bfb3d6;
  --overlay: rgb(48, 21, 65);
  --overlay-w-opacity: rgba(0, 0, 0, 0.7);
  --radius: 14px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 80px;
  width: 100%;
}

.hero iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 1;
}

@media (max-aspect-ratio: 16/9) {
  .hero iframe { height: 56.25vw; }
}
@media (min-aspect-ratio: 16/9) {
  .hero iframe { width: 177.78vh; }
}

.color-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  opacity: 0.6;
  z-index: 2;
}

.content {
  background: var(--overlay-w-opacity);
  width: 65%;
  margin: 0 auto;
  padding: 50px;
  z-index: 100;
}

/* ===== NAV / BRAND ===== */
.topnav {
  position: fixed;
  top: 20px;
  width: 80%;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--accent-2);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 12px;
}

/* Brand typography */
.brand {
  font-family: "Protest Riot", sans-serif;
  font-weight: 400;
  font-size: 1.75rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  gap: 0.18em;
  animation: brandReveal 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-math {
  color: #fff;
  position: relative;
}

/* Animated underline on "Math" */
.brand-math::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #c084e0, #6b2f7c);
  transform: scaleX(0);
  transform-origin: left;
  animation: underlineGrow 0.6s 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.brand-with {
  color: rgba(255,255,255,0.55);
  font-size: 1rem;
  font-weight: 700;
  font-style: italic;
}

.brand-maegan {
  color: #c084e0;
  position: relative;
  /* Soft glow pulse */
  animation: maeganglow 3s 1.4s ease-in-out infinite alternate;
}

@keyframes brandReveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes underlineGrow {
  to { transform: scaleX(1); }
}

@keyframes maeganglow {
  from { text-shadow: 0 0 0px rgba(192, 132, 224, 0); }
  to   { text-shadow: 0 0 16px rgba(192, 132, 224, 0.55); }
}

.navlinks {
  display: flex;
  align-items: center;
}

.navlinks a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.navlinks a:hover {
  background: var(--accent-1);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 47, 124, 0.3);
}

.menu-toggle { display: none; }

/* ===== WORKS SECTION ===== */
.works-section {
  margin-top: 100px;
}

.works-section h2 {
  color: white;
}

/* ===== PUBLICATION CARDS ===== */
.card {
  background: var(--overlay);
  border-radius: var(--radius);
  color: var(--muted);
  border: none;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(107, 47, 124, 0.35);
}

/* Background image layer */
.card-img-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 0;
}

/* Overlay over the image when expanded */
.card-img-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(11, 8, 16, 0.55) 0%,
    rgba(11, 8, 16, 0.88) 60%,
    rgba(11, 8, 16, 0.97) 100%
  );
}

/* Show image when card is open */
.card.open .card-img-bg {
  opacity: 1;
}

.card-body-inner {
  position: relative;
  z-index: 1;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  height: 100%;
}

/* Tag label e.g. "Co-Author" */
.card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c084e0;
  background: rgba(107, 47, 124, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(192, 132, 224, 0.3);
}

.card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 16px;
  flex-grow: 1;
}

.expand {
  background: transparent;
  color: #c084e0;
  border: 1.5px solid rgba(192, 132, 224, 0.45);
  padding: 7px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 0;
  align-self: flex-start;
}

.expand:hover {
  background: rgba(107, 47, 124, 0.35);
  border-color: #c084e0;
  transform: translateY(-2px);
}

/* Expandable details */
.details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s ease, margin-top 0.45s ease;
}

.card.open .details {
  max-height: 600px;
  margin-top: 14px;
}

.details p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(191, 179, 214, 0.9);
  margin-bottom: 10px;
}

.details a {
  color: #c084e0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.details a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ===== HEADSHOT ===== */
.headshot {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 1;
}

.headshot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent-1);
  transform: translate(20px, 20px);
  z-index: -1;
  transition: transform 0.3s ease, background 0.3s ease;
}

.headshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  position: relative;
  z-index: 2;
  filter: brightness(0.95) contrast(1.05);
}

.headshot:hover::before {
  transform: translate(14px, 14px);
  background: var(--accent-2);
}

/* ===== ABOUT SECTION ===== */
.about .bio,
.about aside {
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  max-width: 720px;
  text-align: justify;
}

/* ===== FOOTER ===== */
footer {
  margin-top: 60px;
  text-align: center;
  padding: 30px 0;
  color: rgba(255, 255, 255, 0.7);
}

.footer-social {
  margin-top: 10px;
}

.footer-social a {
  color: var(--accent-1);
  font-size: 1.5rem;
  margin: 0 10px;
  transition: color 0.3s ease, transform 0.2s ease;
  display: inline-block;
}

.footer-social a:hover {
  color: #c084e0;
  transform: translateY(-3px);
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.modal-show {
  opacity: 1;
}

.modal-backdrop.modal-show .custom-modal {
  animation: slideDown 0.3s ease;
}

.custom-modal {
  background: #1a1124;
  padding: 24px;
  border-radius: var(--radius);
  color: white;
  width: 90%;
  max-width: 480px;
  z-index: 1000;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

#submitBtn {
  background-color: var(--accent-1);
}

/* ===== FADE-IN ON SCROLL ===== */
.fade-in-element {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-element.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ===== NAV SCROLL EFFECT ===== */
.topnav.scrolled {
  background: rgba(11, 8, 16, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* smooth transitions */
a, button, .expand {
  transition: all 0.3s ease;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .topnav {
    top: 15px;
    left: 16px;
    right: 16px;
    width: auto;
  }

  .brand {
    font-size: 1.15rem;
  }

  .navlinks a { display: none; }

  .navlinks a:last-child {
    display: block;
    margin-left: 0;
    padding: 10px 20px;
    background: var(--accent-1);
    text-align: center;
    font-weight: 600;
  }

  .navlinks a:last-child:hover {
    background: var(--accent-2);
    transform: translateY(-2px);
  }

  .hero {
    height: 50vh;
    min-height: 400px;
  }

  .content {
    width: 90%;
    padding: 30px 20px;
    margin-top: 60px;
  }

  .headshot {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  .headshot::before { transform: translate(12px, 12px); }
  .headshot:hover::before { transform: translate(8px, 8px); }

  .works-section {
    margin-top: 60px;
    padding: 0 16px;
  }

  .works-section h2 { font-size: 1.5rem; }

  .card { margin-bottom: 20px; }

  .about .bio,
  .about aside {
    padding: 16px;
    text-align: left;
    max-width: 100%;
  }

  .modal, .custom-modal {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  footer {
    padding: 20px 16px;
    margin-top: 40px;
  }

  .footer-social a {
    font-size: 1.3rem;
    margin: 0 8px;
  }
}

@media (max-width: 480px) {
  .hero {
    height: 45vh;
    min-height: 350px;
    padding-top: 110px;
  }

  .content {
    width: 95%;
    padding: 20px 15px;
    margin-top: 70px;
  }

  .brand { font-size: 1rem; }

  .navlinks a:last-child {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .headshot { width: 160px; height: 160px; }
  .headshot::before { transform: translate(8px, 8px); }
  .headshot:hover::before { transform: translate(6px, 6px); }

  .works-section {
    margin-top: 40px;
    padding: 0 12px;
  }

  .works-section h2 { font-size: 1.3rem; }

  .expand {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    text-align: center;
  }

  .about .bio, .about aside {
    padding: 14px;
    font-size: 0.95rem;
  }

  .footer-social a {
    font-size: 1.2rem;
    margin: 0 6px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    height: 50vh;
    min-height: 400px;
    padding-top: 100px;
  }
  .topnav { top: 15px; padding: 10px 16px; }
  .content { padding: 20px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .brand, .brand-maegan, .brand-math::after {
    animation: none;
  }
  .brand-math::after { transform: scaleX(1); }
}
