@import url('https://fonts.googleapis.com/css2?family=Epilogue:ital,wght@0,100..900;1,100..900&display=swap');

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  max-width: 100%;
  background: #072332;
  font-family: "Epilogue", sans-serif;
  font-weight: 800;
  font-style: italic;
  overflow-x: hidden;
}

.flex-center {
  display: grid;
  place-items: center;
}

.scroll-x {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
  display: none;
}

*, *::before, *::after {
  box-sizing: border-box;
}

.background,
.background * {
  pointer-events: none;
}

.background {
  position: fixed;
  inset: -30%;
  background: #05080d;
  /* 
    Removed will-change here — applying it to a fixed full-viewport element
    forces a new GPU compositing layer for the entire page, which is expensive
    on low-end devices and causes repaints on Safari/iOS.
  */
  z-index: 0;
  /* 
    Use translate3d on a wrapper instead of will-change on the container.
    The filter is now applied per-frame via JS only (no CSS filter here) 
    so Safari doesn't create a stacking context prematurely.
  */
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

.background::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  transform: scale(1.4);
}

/* ─── Mobile: static gradient fallback ─── */
@media (max-width: 768px) {
  .background {
    width: 100%;
    height: 100%;
    inset: 0;
    /* No blur on mobile — avoids iOS/Android GPU compositing issues */
    background:
      radial-gradient(circle at 20% 30%, rgba(244,28,64,0.35), transparent 60%),
      radial-gradient(circle at 80% 70%, rgba(153,0,0,0.35), transparent 60%),
      #05080d;
  }

  .field {
    display: none !important;
  }


}

/* ─── iOS Safari quirk: blur on large fixed elements causes flicker ─── */
@supports (-webkit-touch-callout: none) {
  .field {
    /* Reduce blur radius substantially on WebKit iOS */
    filter: blur(4rem) !important;
    width: 100vmax;
    height: 100vmax;
    /* Promote each field to its own compositing layer to avoid full-page repaints */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }

  .field.dark {
    /* multiply blend glitches on iOS — use normal with lower opacity instead */
    mix-blend-mode: normal;
    opacity: 0.35;
  }
}

.field {
  position: absolute;
  width: 140vmax;
  height: 140vmax;
  /* 
    Removed will-change: transform, opacity, filter — having 6 elements all
    declaring will-change exhausts GPU texture memory on mid-range devices.
    Instead we promote with translate3d only where needed (iOS above).
  */
  opacity: 0.55;
  /* 
    Reduced blur from 8rem to 5rem:
    - 8rem blur on a 140vmax element = enormous GPU cost
    - 5rem is visually identical at viewing distance and ~40% cheaper
  */
  filter: blur(5rem);
  mix-blend-mode: normal;
}

.field.dark {
  mix-blend-mode: multiply;
  opacity: 0.58;
}

/* ─── Hero ─── */
.hero {
  position: relative;
  height: 100svh; /* svh fixes the iOS address-bar jump that 100vh causes */
  overflow: hidden;
}

.center {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
}

.logo {
  font-size: clamp(4rem, 30vw, 20rem);
  letter-spacing: 0.15em;
  color: #f5f5f5;
  transition: text-shadow 0.6s ease;
  text-shadow:
    0 0 1.5rem rgba(255,255,255,0.6);
}

.logo:hover {
  text-shadow:
    0 0 2.5rem rgba(255,255,255,0.8),
    0 0 7.5rem rgba(255,255,255,0.6);
}

.scroll-caret {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  font-style: normal;
  color: #EEEEF0;
  cursor: pointer;
  opacity: 0;
  animation:
    caretFadeIn 1s ease forwards 2s,
    caretFloat 2.5s ease-in-out infinite;
  z-index: 12;
}

@keyframes caretFadeIn {
  to { opacity: 1; }
}

@keyframes caretFloat {
  50% { transform: translate(-50%, 0.625rem); }
}

/* ─── Nav ─── */
.nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3rem;
  background: rgba(5,8,13,0.55);
  -webkit-backdrop-filter: blur(0.75rem); /* Safari needs the prefix */
  backdrop-filter: blur(0.75rem);
  transform: translateY(-100%);
  transition: transform 0.6s ease;
  z-index: 9999;
}

.nav.visible {
  transform: translateY(0);
}

.nav-inner {
  margin: 0 auto;
  width: 100%;
  max-width: 87.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
}

.nav-logo {
  margin-right: 3rem;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  color: #EEEEF0;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.nav.visible .nav-logo {
  opacity: 1;
  transform: scale(1);
}

.nav a {
  color: #EEEEF0;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.1em;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -0.375rem;
  left: 0;
  width: 0;
  height: 0.125rem;
  background: #EF2E2E;
  transition: width 0.3s ease;
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
}

.nav a.active {
  color: #EF2E2E;
  text-shadow:
    0 0 0.6rem rgba(244,28,64,0.9),
    0 0 1.6rem rgba(244,28,64,0.7);
}

@media (max-width: 768px) {
  .nav {
    padding: 1rem 1.25rem;
  }

  .nav-inner {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .nav-links {
    gap: 1.25rem;
    font-size: 0.9rem;
  }
}

/* ─── Sections ─── */
.section {
  min-height: 100vh;
  padding: 8rem 12vw;
  scroll-margin-top: 5rem;
  color: #EEEEF0;
  opacity: 0;
  transform: translateY(3.75rem);
  transition: opacity 0.8s ease, transform 0.8s ease;
  position: relative;
  z-index: 5;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section h2 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: #EF2E2E;
}

.section p,
.section ol {
  max-width: 100rem;
  font-size: 1.2rem;
  line-height: 1.6;
  font-weight: 300;
  font-style: normal;
}



@media (max-width: 768px) {
  .section {
    padding: 6rem 1.25rem;
    /* Override JS-driven opacity on mobile so content is always visible */
    opacity: 1 !important;
    transform: none !important;
  }
  .event-slide {
    width: 80vw;
    min-width: 80vw;
  }
}

/* ─── Events carousel ─── */
.carousel-wrapper {
  position: relative;
  width: 100%;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(5,8,13,0.5);
  color: #EF2E2E;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

@media (max-width: 768px) {
  .carousel-arrow {
    display: none;
  }
}

.carousel-arrow.left { left: 0; }
.carousel-arrow.right { right: 0; }

.event-slide {
  min-width: 20rem;
  height: 26.25rem;
  border-radius: 1rem;
  overflow: hidden;
  scroll-snap-align: center;
  position: relative;
  margin: 1rem;
  flex: 0 0 auto;
}

.event-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(153,0,0,0.85),
    rgba(153,0,0,0.2)
  );
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* ─── About / email ─── */
#emailLink {
  text-decoration: underline;
  color: #EEEEF0;
}

/* ─── Back to top button ─── */
#toTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  background: #EF2E2E;
  color: white;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 9999;
  cursor: pointer;
}

#toTop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Team grid ─── */
.team-track-wrapper {
  position: relative;
  margin-top: 4rem;
  max-width: 100%;
  overflow-x: hidden;
}

.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  scroll-padding-left: 1rem;
  overscroll-behavior-x: contain;
  gap: 1rem;
  height: 28rem;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.team-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  max-width: 100%;
  overflow-x: hidden;
}

.team-card {
  flex: 0 0 18rem;
  height: 28rem;
  width: 100%;
  margin: 0;
  border-radius: 1rem;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
}

.team-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.05);
  background: #072332;
}

.team-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7,35,50,0.95),
    rgba(7,35,50,0.3) 40%,
    transparent 65%
  );
}

.team-pill {
  position: relative;
  z-index: 2;
  margin: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: none;
  border-radius: 0;
  overflow: visible;
}

.team-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #EEEEF0;
  padding: 0;
  background: none;
  text-align: left;
}

.team-role {
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: rgba(238, 238, 240, 0.8);
  padding: 0;
  background: none;
  text-align: left;
}

.team-card:hover {
  opacity: 1;
  box-shadow:
    0 0 2rem rgba(239,46,46,0.35),
    0 0 6rem rgba(239,46,46,0.15);
}

.team-track-wrapper::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255,255,255,0.15),
    transparent
  );
}

.team-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(239,46,46,0.5);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.team-card:hover::before {
  opacity: 1;
}

@media (max-width: 1100px) {
  .team-track {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .team-track {
    grid-template-columns: 1fr;
  }

  .team-card {
    height: 26rem;
  }
}

/* ─── Team modal ─── */
.team-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.team-modal.active {
  display: block;
}

.team-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,8,13,0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.team-modal-content {
  position: fixed;
  inset: 5vh 5vw;
  width: auto;
  height: auto;
  max-width: 70rem;
  max-height: 90vh;
  margin: auto;
  background: rgba(7,35,50,0.85);
  color: #EEEEF0;
  border-radius: 2rem;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  overflow: hidden;
}

@media (max-width: 768px) {
  .team-modal-content {
    grid-template-columns: 1fr;
    /* Ensure modal doesn't get clipped by the iOS safe area */
    inset: 2vh 4vw;
  }

  .team-modal-left {
    display: none;
  }
}

.team-modal-left img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-modal-right {
  padding: 3rem;
  overflow-y: auto;
  /* iOS momentum scroll */
  -webkit-overflow-scrolling: touch;
}

.team-modal-right h3 {
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

.team-modal-right p {
  font-weight: 300;
  line-height: 1.6;
  font-style: normal;
}

.team-qa h4 {
  margin-top: 1.8rem;
  color: #EF2E2E;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.team-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #EEEEF0;
  cursor: pointer;
  /* Ensure tap target is large enough on mobile (44×44px minimum) */
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  z-index: 1;
}