@font-face {
  font-family: "Archivo Expanded";
  src: url("../fonts/archivo-800-expandido.woff") format("woff");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-500.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #0c0a09;
  --bg-2: #15110e;
  --ink: #f3eee6;
  --muted: #b9b0a4;
  --ember: 255, 132, 48;
  --pad: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(120% 80% at 50% 45%, transparent 40%, rgba(0, 0, 0, .75) 100%),
    radial-gradient(60% 45% at 50% 44%, #1d1612 0%, var(--bg) 70%);
}

/* grão sutil para o preto não ficar chapado */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .07;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.intro {
  position: relative;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding:
    max(var(--pad), env(safe-area-inset-top))
    var(--pad)
    max(clamp(18px, 3.5vh, 36px), env(safe-area-inset-bottom));
}

/* ---------- topo ---------- */
.intro__top, .intro__actions { position: relative; z-index: 2; }
.intro__top {
  display: flex;
  justify-content: center;
}
.intro__logo {
  width: clamp(64px, 9.5vh, 96px);
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .6));
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- palco 3D ---------- */
.stage {
  position: relative;
  min-height: 0;
  margin-inline: calc(var(--pad) * -1);
  touch-action: none;
  cursor: grab;
}
.stage.is-dragging { cursor: grabbing; }

/* brilho atrás da caixa, desenha as bordas pretas */
.stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 760px, 95vh);
  aspect-ratio: 1.25;
  transform: translate(-50%, -52%);
  background:
    radial-gradient(closest-side, rgba(255, 238, 215, .22), transparent 60%),
    radial-gradient(closest-side, rgba(var(--ember), .46), rgba(var(--ember), .14) 55%, transparent 100%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: .85; transform: translate(-50%, -52%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -52%) scale(1.05); }
}

.scene3d {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  opacity: 0;
  transition: opacity .6s ease;
  outline: none;
}
.is-ready .scene3d { opacity: 1; }
.is-leaving .scene3d { opacity: 0; }

.stage__fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: auto;
  max-width: min(94%, 680px);
  max-height: 100%;
  transform: translate(-50%, -50%);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
  user-select: none;
}
.is-ready .stage__fallback { opacity: 0; }
.no-3d .stage { cursor: default; touch-action: auto; }
.no-3d .stage__fallback { opacity: 1; animation: float 5s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, -53%); }
}

/* ---------- ações ---------- */
.intro__actions {
  display: grid;
  justify-items: center;
  gap: clamp(12px, 2vh, 18px);
}

.hint {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 800 11px/1 "Archivo Expanded", "Archivo", system-ui, sans-serif;
  letter-spacing: .26em;
  color: var(--muted);
  white-space: nowrap;
}
.hint span {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--ember), .9));
}
.hint span:last-child { transform: scaleX(-1); }
.no-3d .hint, .no-3d #reset { display: none; }

.btn-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  min-height: 62px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--ink);
  color: #0c0a09;
  text-decoration: none;
  font: 800 clamp(13px, 4.2vw, 18px)/1 "Archivo Expanded", "Archivo", system-ui, sans-serif;
  letter-spacing: .12em;
  white-space: nowrap;
  box-shadow:
    0 0 0 7px rgba(255, 255, 255, .06),
    0 14px 44px -8px rgba(var(--ember), .55),
    inset 0 -3px 0 rgba(0, 0, 0, .12);
  transition: transform .18s ease, box-shadow .25s ease, background .2s ease;
  touch-action: manipulation;
}
.btn-open:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow:
    0 0 0 9px rgba(255, 255, 255, .08),
    0 18px 54px -8px rgba(var(--ember), .7),
    inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.btn-open:active { transform: translateY(0) scale(.98); }
.btn-open:focus-visible,
.link:focus-visible {
  outline: 2px solid rgb(var(--ember));
  outline-offset: 5px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: clamp(20px, 6vw, 36px);
}
.link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  background: none;
  border: 0;
  color: var(--muted);
  font: 500 15px/1 "Archivo", system-ui, sans-serif;
  text-decoration: underline;
  text-decoration-color: rgba(185, 176, 164, .45);
  text-underline-offset: 5px;
  cursor: pointer;
  transition: color .2s ease, text-decoration-color .2s ease;
  touch-action: manipulation;
}
.link:hover { color: var(--ink); text-decoration-color: rgb(var(--ember)); }

/* ---------- saída ---------- */
.is-opening .intro__actions { opacity: .35; pointer-events: none; transition: opacity .3s ease; }
.is-opening .hint { opacity: 0; }

.curtain {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .38s ease;
}
.is-leaving .curtain { opacity: 1; pointer-events: auto; }

.no-3d.is-opening .stage__fallback {
  animation: none;
  transform: translate(-50%, -50%) scale(1.08);
  opacity: 0;
  transition: transform .45s ease, opacity .45s ease;
}

/* celulares bem estreitos */
@media (max-width: 359px) {
  .hint { letter-spacing: .18em; gap: 8px; font-size: 10px; }
  .hint span { width: 16px; }
  .btn-open { padding: 0 18px; letter-spacing: .09em; }
  .links { column-gap: 18px; }
  .link { font-size: 14px; }
}

/* celular deitado: caixa à esquerda, botões à direita */
@media (max-height: 520px) and (orientation: landscape) {
  .intro {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 12px;
    padding-left: max(var(--pad), env(safe-area-inset-left));
    padding-right: max(var(--pad), env(safe-area-inset-right));
  }
  .intro__top { grid-column: 2; grid-row: 1; padding-top: 4px; }
  .stage { grid-column: 1; grid-row: 1 / span 2; margin: 0; }
  .intro__actions { grid-column: 2; grid-row: 2; align-content: center; gap: 10px; }
  .intro__logo { width: 64px; }
  .btn-open { min-height: 54px; }
  .link { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage::before, .no-3d .stage__fallback { animation: none; }
  .btn-open, .curtain { transition: none; }
}
