/* Shared base formatting for all pages */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  color: #fff;
  background: #252933;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

main {
  padding-top: calc(80px + 2rem);
  position: relative;
  z-index: 2;
  overflow-x: clip;
}



.navbar {
  position: fixed;
  top: 2rem;
  left: 0;
  width: 100%;
  height: 80px;
  padding: 0 5vw;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background: transparent;
  z-index: 100;
  transition: top 0.3s ease, transform 0.3s ease, background 0.3s ease;
  transform: none;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  outline: none;
}

.navbar-left:focus-visible {
  outline: 2px solid oklch(60% 0.12 250 / 0.4);
  border-radius: 6px;
}

.navbar-left .logo {
  width: 40px;
  height: 40px;
}

.nav-title {
  font-size: 1.6rem;
  margin-left: 0;
  user-select: none;
  text-decoration: none;
  color: inherit;
}

.navbar-center {
  position: absolute;
  top: 0;
  left: 50vw;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  align-items: center;
  height: 80px;
  pointer-events: auto;
  z-index: 2;
  max-width: calc(100vw - 420px);
}

.navbar-center a {
  margin: 0 1.5rem;
  color: #aaa;
  text-decoration: none;
  font-size: 1rem;
  text-transform: uppercase;
  transition: color 0.2s, transform 0.3s, box-shadow 0.3s, background 0.3s;
  user-select: none;
  padding: 0.75em 1.5em;
  border-radius: 0.75em;
  display: inline-block;
}

.navbar-center a.active {
  color: #43b7ce!important;
}

.navbar-center a:hover {
  color: #e3e9eb;
}

.nav-back {
  position: fixed;
  top: 0.65rem;
  left: 1rem;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem 0.3rem 0.72rem;
  line-height: 1;
  background: oklch(20% 0.01 250 / 0.65);
  border: 1px solid oklch(42% 0.025 250 / 0.35);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: oklch(68% 0.025 250);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-back::before {
  content: '←';
  display: inline-block;
  font-size: 0.85em;
  transition: transform 0.18s cubic-bezier(0.25, 0, 0, 1);
}

.nav-back:hover {
  background: oklch(26% 0.02 250 / 0.85);
  border-color: oklch(52% 0.04 250 / 0.5);
  color: oklch(86% 0.04 250);
}

.nav-back:hover::before {
  transform: translateX(-3px);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-right: 0;
  user-select: none;
  position: absolute;
  right: clamp(12px, 2vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  height: auto;
  z-index: 9999;
}

.navbar-center { z-index: 1; }

/* Ensure avatar images in the navbar display correctly and are not clipped */
.navbar-right {
  z-index: 3; /* sit above centered nav when space is tight */
  align-items: center;
}
.navbar-right img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.navbar-right #logout-btn,
.navbar-right #login-btn {
  white-space: nowrap;
}

.mobile-menu-toggle {
  display: none;
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(67, 183, 206, 0.28);
  border-radius: 999px;
  background: rgba(20, 26, 34, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
  gap: 0;
  z-index: 8;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(67, 183, 206, 0.1);
  border-color: rgba(67, 183, 206, 0.55);
}

.mobile-menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: #43b7ce;
  border-radius: 2px;
  margin: 2px 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 16, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 130;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(86vw, 340px);
  height: 100vh;
  padding: 6.2rem 1rem 1rem 1rem;
  box-sizing: border-box;
  background: rgba(20, 25, 33, 0.98);
  border-right: 1px solid rgba(67, 183, 206, 0.24);
  transform: translateX(-104%);
  transition: transform 0.24s ease;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mobile-nav-drawer .mobile-nav-link {
  color: #dbe7f4;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 10px;
  padding: 0.85em 0.95em;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(67, 183, 206, 0.12);
  font-size: 0.92rem;
}

.mobile-nav-drawer .mobile-nav-link:hover,
.mobile-nav-drawer .mobile-nav-link.active {
  color: #43b7ce;
  border-color: rgba(67, 183, 206, 0.45);
}

.mobile-nav-drawer .mobile-nav-back {
  color: #8da0b0;
  font-size: 0.82rem;
}

.mobile-nav-sep {
  border: none;
  border-top: 1px solid rgba(67, 183, 206, 0.18);
  margin: 0.2rem 0;
}

body.mobile-nav-open {
  overflow: hidden;
}

body.mobile-nav-open .mobile-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.mobile-nav-open .mobile-nav-drawer {
  transform: translateX(0);
}

body.mobile-nav-open .mobile-menu-toggle span:nth-child(1) {
  transform: translateY(4.5px) rotate(45deg);
}

body.mobile-nav-open .mobile-menu-toggle span:nth-child(2) {
  opacity: 0;
}

body.mobile-nav-open .mobile-menu-toggle span:nth-child(3) {
  transform: translateY(-4.5px) rotate(-45deg);
}

.navbar::before {
  content: '';
  position: absolute;
  top: -2rem;
  left: 0;
  width: 100%;
  height: calc(80px + 2rem);
  background: rgba(26,28,32,0.55);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.navbar.scrolled::before {
  opacity: 1;
}

.navbar.scrolled {
  top: 1rem;
  transform: translateY(-1em);
  background: transparent;
}

.navbar.scrolled a,
.navbar.scrolled a:hover {
  transition: color 0.2s, transform 0.3s, box-shadow 0.3s, background 0.3s;
}

.navbar.scrolled a {
  background: none!important;
}

.navbar.scrolled a:hover {
  box-shadow: 0 0 0 0;
}

/* --- Cascading animation for hero section --- */
.cascade {
  opacity: 0;
  transform: translateY(70px);
  animation: cascadeIn 0.5s cubic-bezier(0.4,0,0.2,1) forwards;
}
.cascade.delay-1 { animation-delay: 0.1s; }
.cascade.delay-2 { animation-delay: 0.20s; }
.cascade.delay-3 { animation-delay: 0.3s; }
.cascade.delay-4 { animation-delay: 0.4s; }
.cascade.delay-5 { animation-delay: 0.5s; }
.cascade.delay-6 { animation-delay: 0.6s; }

@keyframes cascadeIn {
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Scroll-in animation for other sections --- */
.scroll-in {
  opacity: 0;
  transform: translateY(80px);
  transition: opacity 0.5s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
.scroll-in.in-view {
  opacity: 1;
  transform: none;
}

/* Responsive navbar adjustments */
@media (max-width: 1000px) {
  .navbar {
    padding: 0 4vw;
    height: 72px;
    justify-content: space-between;
    gap: 0.8rem;
  }
  .navbar-center {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    left: auto;
    display: flex;
    flex: 1 1 auto;
    justify-content: center;
    gap: 0.3rem;
    max-width: none;
    height: auto;
  }
  .navbar-center a {
    margin: 0 0.15rem;
    padding: 0.55em 0.7em;
    font-size: 0.82rem;
  }
  .navbar-right {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    z-index: 4;
    gap: 0.5rem;
  }
  .nav-title { font-size: 1.2rem; }
}

@media (max-width: 700px) {
  .navbar {
    top: 1rem;
    padding: 0 3vw;
    height: 64px;
    align-items: center;
  }
  .navbar-center { display: none; }
  .navbar-right { gap: 0.5rem; }
  .nav-title { font-size: 1rem; }
  main { padding-top: calc(64px + 1rem); }
}

@media (max-width: 900px) {
  .navbar {
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .navbar-center {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .navbar-left {
    min-width: 0;
    margin-right: auto;
  }

  .navbar-right {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    max-width: 54vw;
    overflow: hidden;
  }

  .nav-back {
    display: none;
  }
}
