/*
 * Página "em breve" da ARPA (arpa.gg). O mascote Terminal é um monitor
 * ligado num quarto escuro: a tela ilumina a parede e a mesa, e nela passam
 * os rostos da Equipe ARPA como canais. Paleta da identidade visual v1.0
 * (brand/arpa-id.pdf); o ciano é só luz.
 */
:root {
  --deep: #07060d;
  --led: #3df5ff;
  --white: #f3f0ff;
  --muted: #8f88ad;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Lado do monitor: o desenho é quadrado, na grade 64×64 do mascote. */
  --m: min(540px, 84vw, 58vh);

  color-scheme: dark;
}

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

html,
body {
  height: 100%;
}

/* A luz da sala é maior que a tela; sem isso, o celular rola para o lado. */
html {
  overflow-x: clip;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 38%, #120d26 0%, var(--deep) 70%),
    var(--deep);
  color: var(--white);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

/* Granulação de filme por cima de tudo: dá corpo ao escuro. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.07;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Barras do topo e do pé */

.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 36px) clamp(20px, 4vw, 48px);
}

.bar--bottom {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.logo__icon {
  width: 28px;
  height: 28px;
}

.logo__name {
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  transform: skewX(-12deg);
}

/* Cena */

.scene {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 2vh;
}

/* Luz da tela na parede: ciano no miolo, roxo nas bordas. */
.room-light {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--m) * 2.6);
  aspect-ratio: 1.4;
  translate: -50% -58%;
  background: radial-gradient(
    closest-side,
    rgb(61 245 255 / 0.16),
    rgb(124 77 255 / 0.12) 45%,
    transparent 100%
  );
  filter: blur(20px);
  pointer-events: none;
}

/* A sala pisca junto quando a tela troca de canal. */
.scene.is-switching .room-light {
  filter: blur(20px) brightness(1.8);
}

/* Monitor */

.monitor {
  position: relative;
  z-index: 1;
  width: var(--m);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 300ms var(--ease-out);
}

.monitor:hover {
  transform: translateY(-4px);
}

.monitor:active {
  transform: translateY(-1px) scale(0.99);
}

.monitor:focus-visible {
  outline: 2px solid var(--led);
  outline-offset: 8px;
  border-radius: 24px;
}

.monitor__body {
  position: absolute;
  inset: 0;
  overflow: visible;
  filter: drop-shadow(
    0 calc(var(--m) * 0.05) calc(var(--m) * 0.08) rgb(0 0 0 / 0.6)
  );
}

.monitor__led {
  fill: var(--led);
}

.monitor__led-halo {
  animation: led 2.6s ease-in-out infinite;
}

/* Tela: o visor na grade do mascote (x 13.25, y 20.25, 37.5 × 24.25). */
.screen {
  position: absolute;
  top: calc(20.25% / 0.64);
  left: calc(13.25% / 0.64);
  width: calc(37.5% / 0.64);
  height: calc(24.25% / 0.64);
  overflow: hidden;
  border-radius: calc(var(--m) * 3.4 / 64);
  background: radial-gradient(120% 120% at 50% 45%, #0c1424 0%, #030308 75%);
  box-shadow:
    inset 0 0 calc(var(--m) * 0.04) rgb(0 0 0 / 0.9),
    0 0 calc(var(--m) * 0.06) rgb(61 245 255 / 0.18);
}

.screen__static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: 0.08;
  mix-blend-mode: screen;
}

.scene.is-switching .screen__static {
  opacity: 0.9;
}

.face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  fill: var(--led);
  filter: drop-shadow(0 0 calc(var(--m) * 0.012) rgb(61 245 255 / 0.9))
    drop-shadow(0 0 calc(var(--m) * 0.04) rgb(61 245 255 / 0.45));
}

.face.is-on {
  opacity: 1;
}

.face__eyes {
  transition: transform 220ms var(--ease-out);
}

.face__eyes--stroke path,
.face__mouth--stroke {
  fill: none;
  stroke: var(--led);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.face__mouth {
  opacity: 0.7;
}

/* Terminal: o ">" e o cursor piscam em contratempo. */
.face__prompt {
  animation: blink 1.1s steps(1) infinite;
}

.face__cursor {
  animation: blink 1.1s steps(1) infinite 0.55s;
}

/* Os outros piscam os olhos de vez em quando, cada um do seu jeito. */
.face--bravo .face__eyes path {
  animation: flicker 3.2s linear infinite;
}

.face--pixel .face__eyes rect,
.face--headset .face__eyes path {
  transform-box: view-box;
  transform-origin: 32px 28.5px;
  animation: lid 3.4s ease-in-out infinite;
}

/* Troca de canal: a imagem rola e estoura de brilho por um instante. */
.scene.is-switching .face.is-on {
  animation: roll 300ms steps(6) both;
}

.screen__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgb(0 0 0 / 0.32) 2px,
    rgb(0 0 0 / 0.32) 3px
  );
  pointer-events: none;
}

/* Vidro: reflexo curvo no alto e cantos mais escuros. */
.screen__glass {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      130% 90% at 30% 0%,
      rgb(255 255 255 / 0.1),
      transparent 45%
    ),
    radial-gradient(100% 100% at 50% 50%, transparent 60%, rgb(0 0 0 / 0.55));
  pointer-events: none;
}

/* Mesa: sombra do pé e a poça de luz que a tela joga. */
.desk {
  width: calc(var(--m) * 1.5);
  height: calc(var(--m) * 0.12);
  margin-top: calc(var(--m) * -0.1);
  background:
    radial-gradient(closest-side, rgb(0 0 0 / 0.65), transparent),
    radial-gradient(closest-side, rgb(61 245 255 / 0.1), transparent);
  pointer-events: none;
}

.title {
  position: relative;
  z-index: 1;
  margin: calc(var(--m) * 0.04) 0 0;
  font-family: "Unbounded", "Arial Black", sans-serif;
  font-size: clamp(28px, 4.2vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Abertura: o monitor liga como TV de tubo e a sala acende junto. */

.monitor__body,
.title,
.bar,
.room-light,
.desk {
  animation: appear 900ms var(--ease-out) both;
}

.monitor__body {
  animation-delay: 100ms;
}

.screen {
  animation: power-on 900ms var(--ease-out) 500ms both;
}

.room-light,
.desk {
  animation-duration: 1600ms;
  animation-delay: 600ms;
}

.title {
  animation-delay: 1100ms;
}

.bar {
  animation-delay: 1300ms;
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

@keyframes power-on {
  0% {
    clip-path: inset(50% 50% 50% 50%);
    filter: brightness(4);
  }

  35% {
    clip-path: inset(49% 2% 49% 2%);
    filter: brightness(4);
  }

  100% {
    clip-path: inset(0 0 0 0);
    filter: none;
  }
}

@keyframes roll {
  0% {
    transform: translateY(-14%);
    filter: brightness(2.4);
  }

  50% {
    transform: translateY(9%) skewX(-6deg);
  }

  100% {
    transform: none;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes led {
  50% {
    opacity: 0.35;
  }
}

@keyframes flicker {
  0%,
  58%,
  70%,
  100% {
    opacity: 1;
  }

  61%,
  67% {
    opacity: 0.2;
  }

  64% {
    opacity: 0.9;
  }
}

@keyframes lid {
  0%,
  44%,
  54%,
  100% {
    transform: scaleY(1);
  }

  49% {
    transform: scaleY(0.1);
  }
}

/* Celular: só a dica no rodapé, centralizada. */
@media (max-width: 520px) {
  .bar--bottom {
    justify-content: center;
  }

  .copyright {
    display: none;
  }
}

/* Sem movimento: tudo no lugar e o Terminal parado. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .screen__static {
    display: none;
  }
}
