/* ===================== */
/* FONTS                */
/* ===================== */

@font-face {
  font-family: "Wild Words";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/Wild-Words-Roman.ttf") format("truetype");
}

/* ===================== */
/* RESET GLOBAL          */
/* ===================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================== */
/* HTML / BODY (SEGURO)  */
/* ===================== */

html,
body {
  width: 100%;
  /* Fallback para navegadores antigos */
  height: 100%;
  /* Viewport dinâmica - funciona com barra de endereço mobile */
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;

  background-color: #000;
  font-size: var(--fs-base);

  /* NADA de fixed aqui */
  position: relative;

  /* evita bug de viewport mobile */
  touch-action: none;

  /* Previne scroll bounce no iOS */
  overscroll-behavior: none;
}

/* ===================== */
/* ROOT DO JOGO          */
/* ===================== */
/* use esse container em TODAS as cenas */

#scene {
  width: 100vw;
  height: 100dvh; /* viewport dinâmica correta no mobile */
  position: relative;
  overflow: hidden;

  /* manipulation permite drag nos filhos que usam touch-action: none */
  touch-action: manipulation;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out;
}

#scene.scene-visible {
  opacity: 1;
  visibility: visible;
}

/* ===================== */
/* VARIÁVEIS GLOBAIS     */
/* ===================== */

:root {
  /* Fallback: será sobrescrito por JS para altura real em mobile */
  --real-vh: 1vh;

  --bp-xl: 1600px;
  --bp-lg: 1440px;
  --bp-md: 1024px;
  --bp-sm: 768px;
  --bp-xs: 480px;

  --fs-base: clamp(12px, 1.2vw + 0.6rem, 18px);

  --container-max: 1200px;
  --container-padding: clamp(0.5rem, 1.2vw, 2rem);

  --btn-radius: 0.5rem;
  --btn-padding-y: 0.6rem;
  --btn-padding-x: 1.1rem;
}

/* ===================== */
/* CONTAINERS            */
/* ===================== */

.container {
  width: min(95%, var(--container-max));
  max-width: var(--container-max);
  margin-inline: auto;
  padding: var(--container-padding);
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===================== */
/* NAV                  */
/* ===================== */

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--container-padding) / 1.2);
}

nav a {
  margin: 0.35rem 0.6rem;
  font-size: 0.98rem;
}

/* ===================== */
/* MEDIA QUERIES         */
/* ===================== */

@media (min-width: var(--bp-xl)) {
  :root {
    --container-max: 1400px;
  }
}

@media (max-width: 1024px) {
  :root {
    --fs-base: clamp(13px, 1.6vw + 0.4rem, 16px);
  }
}

@media (max-width: 768px) {
  :root {
    --fs-base: clamp(12px, 2.1vw + 0.25rem, 15px);
  }

  nav {
    flex-direction: column;
    gap: 0.4rem;
  }
}

@media (max-width: 480px) {
  :root {
    --fs-base: clamp(11px, 3.2vw, 14px);
  }
}

@media (max-width: 360px) {
  :root {
    --fs-base: clamp(10px, 4.2vw, 13px);
  }
}

/* ===================== */
/* BOTÃO VOLTAR          */
/* ===================== */

.btnback {
  position: absolute;
  top: 1.5vw;
  left: 1.5vw;
  font-size: min(5vw, 32px);
  font-weight: bold;
  z-index: 1000;

  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.35em 0.55em;
  border-radius: 0.6em;
  border: 2px solid rgba(255, 255, 255, 0.25);

  display: flex;
  justify-content: center;
  align-items: center;

  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* ===================== */
/* GPU FIX               */
/* ===================== */

.hidden-item img {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: opacity;
}
