/* ================================================
   MAURICIO DE SOUZA - PORTFOLIO
   Pixel Dark Theme
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:        #0d0d0d;
  --bg-alt:    #1a1a1a;
  --red:       #ff6b6b;
  --red-dark:  #cc4444;
  --yellow:    #feca57;
  --white:     #ffffff;
  --gray:      #888888;
  --pixel:     2px;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  color: var(--white);
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  image-rendering: pixelated;
}

/* ---- Canvas de estrelas ---- */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---- Scanlines overlay ---- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

/* ---- Pixel grid overlay sutil ---- */
.pixel-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ---- Tela principal ---- */
#screen {
  position: relative;
  z-index: 10;
  width: 100%;
  /* 100vh no celular conta a altura COM a barra de endereço recolhida,
     entao o conteudo centralizado cai abaixo da area visivel e o body
     (overflow: hidden) corta o START. 100dvh acompanha a altura real. */
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* ---- Logo / Badge superior ---- */
.badge {
  font-size: 0.5rem;
  letter-spacing: 0.3em;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 24px;
  animation: fadeIn 1s ease both;
}

/* ---- Título principal ---- */
.title-wrap {
  text-align: center;
  margin-bottom: 12px;
  animation: slideDown 0.8s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.title-pre {
  display: block;
  font-size: clamp(0.45rem, 1.2vw, 0.65rem);
  color: var(--yellow);
  letter-spacing: 0.25em;
  margin-bottom: 18px;
}

.title-name {
  display: block;
  font-size: clamp(1.1rem, 3.5vw, 2.4rem);
  color: var(--white);
  text-shadow:
    4px 4px 0px var(--red-dark),
    8px 8px 0px rgba(255, 107, 107, 0.2);
  line-height: 1.3;
  letter-spacing: 0.05em;
}

.title-name span {
  color: var(--red);
}

/* ---- Subtítulo / Profissões ---- */
.roles {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 28px;
  margin-bottom: 56px;
  animation: fadeIn 1.2s ease 0.5s both;
}

.role-item {
  font-size: clamp(0.35rem, 1vw, 0.5rem);
  color: var(--gray);
  letter-spacing: 0.15em;
  padding: 0 16px;
  position: relative;
}

.role-item:not(:last-child)::after {
  content: '▸';
  position: absolute;
  right: -2px;
  color: var(--red);
  font-size: 0.4rem;
}

/* ---- Botão START ---- */
.btn-start {
  position: relative;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.65rem, 1.8vw, 0.9rem);
  letter-spacing: 0.2em;
  color: var(--bg);
  background: var(--red);
  border: none;
  cursor: pointer;
  padding: 18px 44px;
  outline: none;

  /* Pixel border (shadow-based) */
  box-shadow:
    /* borda pixel direita/baixo */
    4px 4px 0 var(--red-dark),
    8px 8px 0 rgba(204, 68, 68, 0.3),
    /* borda branca topo/esquerda */
    inset 2px 2px 0 rgba(255, 255, 255, 0.3),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2);

  animation: fadeIn 1.4s ease 0.8s both, btnPulse 2.5s ease-in-out 2s infinite;
  transition: transform 0.08s, box-shadow 0.08s, background 0.08s;
  image-rendering: pixelated;
}

.btn-start:hover {
  background: var(--yellow);
  color: var(--bg);
  transform: translate(-2px, -2px);
  box-shadow:
    6px 6px 0 #c9922a,
    10px 10px 0 rgba(200, 130, 0, 0.3),
    inset 2px 2px 0 rgba(255, 255, 255, 0.4),
    inset -2px -2px 0 rgba(0, 0, 0, 0.2);
  animation: none;
}

.btn-start:active {
  transform: translate(4px, 4px);
  box-shadow:
    0px 0px 0 var(--red-dark),
    inset 2px 2px 0 rgba(0, 0, 0, 0.3);
}

/* Ícone play no botão */
.btn-start::before {
  content: '▶ ';
  font-size: 0.7em;
}

/* ---- Botão secundário: currículo ---- */
.btn-cv {
  display: inline-block;
  margin-top: 22px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1.1vw, 0.5rem);
  letter-spacing: 0.15em;
  text-decoration: none;
  color: var(--gray);
  background: transparent;
  border: 2px solid #2e2e2e;
  padding: 12px 22px;
  animation: fadeIn 1.6s ease 1s both;
  transition: color 0.12s, border-color 0.12s, transform 0.08s;
}

.btn-cv:hover {
  color: var(--yellow);
  border-color: var(--yellow);
  transform: translate(-2px, -2px);
}

.btn-cv:active {
  transform: translate(0, 0);
}

/* ---- Texto piscante abaixo do botão ---- */
.press-hint {
  margin-top: 28px;
  font-size: 0.38rem;
  color: var(--gray);
  letter-spacing: 0.2em;
  animation: blink 1.2s step-end infinite, fadeIn 1.6s ease 1.2s both;
}

/* ---- Versão / Copyright ---- */
.footer-info {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.3rem;
  color: #333;
  letter-spacing: 0.15em;
  z-index: 10;
  animation: fadeIn 2s ease 1.5s both;
}

/* ---- Decoração de cantos (pixel corners) ---- */
.corner {
  position: fixed;
  z-index: 5;
  width: 32px;
  height: 32px;
  pointer-events: none;
  opacity: 0.4;
}
.corner::before,
.corner::after {
  content: '';
  position: absolute;
  background: var(--red);
}
.corner-tl { top: 16px; left: 16px; }
.corner-tl::before { width: 100%; height: 2px; top: 0; left: 0; }
.corner-tl::after  { width: 2px; height: 100%; top: 0; left: 0; }

.corner-tr { top: 16px; right: 16px; }
.corner-tr::before { width: 100%; height: 2px; top: 0; right: 0; }
.corner-tr::after  { width: 2px; height: 100%; top: 0; right: 0; }

.corner-bl { bottom: 16px; left: 16px; }
.corner-bl::before { width: 100%; height: 2px; bottom: 0; left: 0; }
.corner-bl::after  { width: 2px; height: 100%; bottom: 0; left: 0; }

.corner-br { bottom: 16px; right: 16px; }
.corner-br::before { width: 100%; height: 2px; bottom: 0; right: 0; }
.corner-br::after  { width: 2px; height: 100%; bottom: 0; right: 0; }

/* ---- Personagem jogável ---- */
.character-wrap {
  position: fixed;
  z-index: 20;
  /* JS define left/top; translate centra o sprite no ponto de origem */
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#char-sprite {
  height: 96px;
  width: auto;
  image-rendering: pixelated;
  display: block;
  user-select: none;
}

/* ---- Hint de controles ---- */
.controls-hint {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.28rem;
  color: #2a2a2a;
  letter-spacing: 0.12em;
  z-index: 10;
  animation: fadeIn 4s ease 3s both;
  white-space: nowrap;
  pointer-events: none;
}

/* ---- Efeito de canto pulsante ---- */
.corner-pulse {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255, 107, 107, 0.05);
  border-radius: 0;
  z-index: 2;
  pointer-events: none;
  animation: ringPulse 3s ease-out infinite;
}

/* ================================================
   KEYFRAMES
   ================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 4px 4px 0 var(--red-dark), 8px 8px 0 rgba(204,68,68,0.3), inset 2px 2px 0 rgba(255,255,255,0.3), inset -2px -2px 0 rgba(0,0,0,0.2); }
  50%       { box-shadow: 4px 4px 0 var(--red-dark), 8px 8px 0 rgba(204,68,68,0.5), 0 0 24px rgba(255,107,107,0.3), inset 2px 2px 0 rgba(255,255,255,0.3), inset -2px -2px 0 rgba(0,0,0,0.2); }
}

@keyframes ringPulse {
  0%   { transform: translate(-50%, -50%) scale(0.8); opacity: 0.15; }
  70%  { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}


@keyframes floatUp {
  0%   { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-30px); opacity: 0; }
}

/* ================================================
   TRANSIÇÃO DE SAÍDA (ao clicar Start)
   ================================================ */

.screen-flash {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.screen-flash.active {
  opacity: 1;
  pointer-events: all;
}

/* ================================================
   RESPONSIVO
   ================================================ */

@media (max-width: 600px) {
  .roles {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .role-item:not(:last-child)::after {
    display: none;
  }
.corner-pulse {
    width: 200px;
    height: 200px;
  }
}
