/* ===========================
   1. FONTS
   =========================== */
@font-face {
  font-family: 'AyrBlufy-Regular';
  src: url('fonts/AyrBlufy-Regular.otf') format('opentype');
  ascent-override: 80%;
  descent-override: 20%;
  line-gap-override: 0%;
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'AyrBlufy-Oblique';
  src: url('fonts/AyrBlufy-Oblique.otf') format('opentype');
  ascent-override: 80%;
  descent-override: 20%;
  line-gap-override: 0%;
  font-weight: normal;
  font-style: normal;
}

/* ===========================
   2. GLOBAL / RESET / BODY
   =========================== */
body,
html {
  margin: 0;
  padding: 0;
  font-family: 'AyrBlufy-Regular', sans-serif;
  scroll-behavior: smooth;
  background: #5c21a0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  backface-visibility: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: radial-gradient(ellipse at center,
      rgba(0, 0, 0, 0) 40%,
      rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

/* ===========================
   3. LAYOUT: HEADER / NAVIGATION
   =========================== */
header {
  background: transparent;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  padding-left: 40px;
  padding-right: 40px;
  height: 90px;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
}

.logo img {
  width: 52px;
  cursor: pointer;
}

#nav-bar ul {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

#nav-bar a {
  color: #fff5de;
  font-family: 'AyrBlufy-Oblique', sans-serif;
  text-decoration: none;
  font-size: 1.1rem;
  transition: opacity 0.2s ease;
}

#nav-bar a:hover {
  opacity: 0.7;
}

#nav-bar a.active {
  position: relative;
  z-index: 1;
  pointer-events: none;
  cursor: default;
}

#nav-bar a.active::before {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: -10px;
  right: -10px;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
  transform: skewX(-6deg);
  transform-origin: left center;
  animation: pop-active 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pop-active {
  0% {
    transform: scaleX(0) skewX(-6deg);
  }

  60% {
    transform: scaleX(1.1) skewX(-6deg);
  }

  100% {
    transform: scaleX(1) skewX(-6deg);
  }
}

#nav-bar .careers {
  color: #ffc700;
}

/* ===========================
   4. MAIN LAYOUT: SECTION
   =========================== */
.site-section {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 0 0 0;
  box-sizing: border-box;
  scroll-snap-align: start;
}

.section-content {
  position: fixed;
  bottom: 40px;
  left: 40px;
  right: 40px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  font-family: 'AyrBlufy-Regular', sans-serif;
  color: #fff5de;
  font-size: 1.75rem;
  line-height: 1.05;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.section-content h1 {
  margin: 0;
  width: 100%;
}

.section-intro {
  top: 110px;
  container-type: size;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.section-intro h1 {
  margin-top: auto;
  font-size: clamp(1.5rem, min(6.5cqw, 12cqh), 8rem);
}

/* ===========================
   5. THREE.JS CANVAS
   =========================== */
.section-canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: auto;
}

/* ===========================
   6. COMPONENTS: WAVING HAND
   =========================== */
.wave-wrapper {
  display: inline-block;
  transform-origin: bottom center;
}

.wave-hand {
  width: 0.9em;
  height: auto;
  display: inline-block;
  animation: wave 1.8s infinite;
  transform-origin: bottom center;
  margin-left: 0.1em;
}

@keyframes wave {

  /* resting position */
  0% {
    transform: rotate(0deg) scaleX(1);
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* big enthusiastic swing outward */
  15% {
    transform: rotate(28deg) scaleX(0.92);
    animation-timing-function: cubic-bezier(0.6, 0, 0.4, 1);
  }

  /* swing back past neutral — overshoot (cartoony!) */
  35% {
    transform: rotate(-18deg) scaleX(1.05);
    animation-timing-function: cubic-bezier(0.6, 0, 0.4, 1);
  }

  /* second wave out, a little smaller */
  50% {
    transform: rotate(20deg) scaleX(0.95);
    animation-timing-function: cubic-bezier(0.6, 0, 0.4, 1);
  }

  /* settle back, smaller overshoot */
  65% {
    transform: rotate(-10deg) scaleX(1.02);
    animation-timing-function: cubic-bezier(0.6, 0, 0.4, 1);
  }

  /* tiny final flick */
  80% {
    transform: rotate(8deg) scaleX(0.98);
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* settle back to rest */
  100% {
    transform: rotate(0deg) scaleX(1);
  }
}

/* ===========================
   7. ABOUT SECTION CONTENT
   =========================== */
.section-about {
  gap: 16px;
}

.about-logo {
  width: clamp(140px, 18vw, 240px);
  height: auto;
  display: block;
  margin-bottom: 8px;
}

.about-p {
  margin: 0;
  color: #fff5de;
  font-family: 'AyrBlufy-Regular', sans-serif;
  font-size: 2em;
  line-height: 1.25;
}

/* ===========================
   8. CONTACT SECTION CONTENT
   =========================== */
.contact-email {
  color: #ffc700;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.contact-email:hover {
  opacity: 0.75;
}

/* ===========================
   9. GAMES MOBILE INFO
   =========================== */
.games-mobile-info {
  display: none;
}

/* ===========================
   10. LOADING SPINNER
   =========================== */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #5c21a0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 245, 222, 0.25);
  border-top-color: #fff5de;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   11. HAMBURGER BUTTON
   =========================== */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 20;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff5de;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

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

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

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

/* ===========================
   12. RESPONSIVE
   =========================== */
@media (max-width: 700px) {
  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 64px;
  }

  .nav-toggle {
    display: flex;
  }

  #nav-bar {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(50, 8, 110, 0.98);
    z-index: 19;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  #nav-bar.open {
    display: flex;
  }

  #nav-bar ul {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  #nav-bar a {
    font-size: 2rem;
  }

  .section-content {
    bottom: 24px;
    left: 20px;
    right: 20px;
    font-size: 1.2rem;
  }

  .section-intro h1 {
    font-size: clamp(1.2rem, 7vw, 2.5rem);
  }

  .about-p {
    font-size: 1.2em;
  }

  .about-logo {
    width: clamp(100px, 36vw, 160px);
  }

  .section-about {
    gap: 10px;
  }

  .games-mobile-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .games-title {
    margin: 0;
    font-family: 'AyrBlufy-Regular', sans-serif;
    font-size: 2.2rem;
    color: #fff5de;
    line-height: 1.05;
  }

  .games-year {
    margin: 0;
    font-family: 'AyrBlufy-Oblique', sans-serif;
    font-size: 1.4rem;
    color: #ffc700;
  }

  .games-desc {
    margin: 0;
    font-family: 'AyrBlufy-Regular', sans-serif;
    font-size: 1rem;
    color: #fff5de;
    line-height: 1.4;
  }

  .games-badges {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 4px;
  }

  .store-badge {
    height: 36px;
    width: auto;
  }
}