/* ==========================================================================
   Tokens 8bitV2 (escuro / claro)
   ========================================================================== */
:root,
:root[data-theme='escuro'] {
  --fundo: #0a0a0b;
  --fundo-card: rgba(10, 10, 11, 0.94);
  --tinta: #edebe4;
  --suave: #8a877f;
  --linha: rgba(237, 235, 228, 0.16);
  --acento: #c8ff2e;
  --acento-2: #ff3d7f;
  --sobre-acento: #0a0a0b;
  --f-px: 'Silkscreen', monospace;
  --f-txt: 'Inter Tight', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

:root[data-theme='claro'] {
  --fundo: #eceae3;
  --fundo-card: rgba(236, 234, 227, 0.94);
  --tinta: #111111;
  --suave: #6b6860;
  --linha: rgba(17, 17, 17, 0.16);
  --acento: #2b30ff;
  --acento-2: #ff4d1f;
  --sobre-acento: #eceae3;
  color-scheme: light;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fundo);
  color: var(--tinta);
  font: 400 16px/1.55 var(--f-txt);
  overflow-x: clip;
  transition: background-color 0.2s steps(3), color 0.2s steps(3);
}

h1,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

::selection {
  background: var(--acento);
  color: var(--sobre-acento);
}

:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 4px;
}

.mono {
  font: 500 11.5px/1.4 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ==========================================================================
   Fundo Animado: Nível / Horizonte Líquido Bayer 8x8 (8bitV2)
   ========================================================================== */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.82;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ==========================================================================
   Transição de Entrada em Pixels (8bitV2)
   ========================================================================== */
.pixel-intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--acento);
  pointer-events: none;
}

.pixel-intro canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ==========================================================================
   Grão Animado (8bitV2)
   ========================================================================== */
.grao {
  position: fixed;
  inset: -50%;
  z-index: 90;
  pointer-events: none;
  opacity: 0.06;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grao 0.5s steps(4) infinite;
}

@keyframes grao {
  25% {
    transform: translate(-3%, 2%);
  }
  50% {
    transform: translate(2%, -4%);
  }
  75% {
    transform: translate(-1%, 3%);
  }
}

/* ==========================================================================
   Layout Principal
   ========================================================================== */
.page {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--linha);
  margin-bottom: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 6px 10px;
  background: var(--fundo-card);
  border: 1px solid var(--linha);
  color: var(--tinta);
}

.logo-px {
  width: 12px;
  height: 12px;
  background: var(--acento);
  box-shadow: 12px 0 0 -3px var(--tinta);
}

.tema-bt {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--tinta);
  color: var(--tinta);
  background: var(--fundo-card);
  transition:
    background-color 0.15s steps(2),
    color 0.15s steps(2),
    border-color 0.15s steps(2);
}

.tema-bt:hover {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--sobre-acento);
}

.tema-bt svg {
  width: 16px;
  height: 16px;
  position: absolute;
}

[data-theme='escuro'] .icon-sun {
  opacity: 1;
}
[data-theme='escuro'] .icon-moon {
  opacity: 0;
}
[data-theme='claro'] .icon-sun {
  opacity: 0;
}
[data-theme='claro'] .icon-moon {
  opacity: 1;
}

/* ==========================================================================
   Perfil
   ========================================================================== */
.profile {
  margin-bottom: 28px;
  padding: 20px 18px;
  background: var(--fundo-card);
  border: 1px solid var(--linha);
  backdrop-filter: blur(8px);
}

.profile-kicker-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.px-cursor {
  width: 9px;
  height: 9px;
  background: var(--acento);
  box-shadow: 7px 7px 0 -2px var(--acento-2);
  animation: pisca 1s steps(2) infinite;
}

@keyframes pisca {
  50% {
    opacity: 0.2;
  }
}

.profile-kicker {
  color: var(--acento);
}

.profile-name {
  font: 700 clamp(38px, 9vw, 56px) / 0.9 var(--f-px);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.profile-bio {
  margin-top: 14px;
  max-width: 42ch;
  font-size: 16px;
  line-height: 1.5;
  color: var(--suave);
}

/* ==========================================================================
   Rótulos de Seção
   ========================================================================== */
.rotulo {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 14px;
  padding: 6px 10px;
  background: var(--fundo-card);
  border: 1px solid var(--linha);
  font: 500 11.5px/1 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tinta);
}

.rotulo-n {
  color: var(--acento);
}

/* ==========================================================================
   Cards de Links (Brutalista 8-bit)
   ========================================================================== */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid var(--linha);
  background: var(--fundo-card);
  backdrop-filter: blur(4px);
  transition:
    background-color 0.14s steps(2),
    color 0.14s steps(2),
    border-color 0.14s steps(2),
    transform 0.14s steps(2),
    box-shadow 0.14s steps(2);
}

.link-card--featured {
  border-color: var(--acento);
  box-shadow: 4px 4px 0 0 var(--acento);
}

.link-card:hover {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--sobre-acento);
  transform: translate(-3px, -3px);
  box-shadow: 5px 5px 0 0 var(--tinta);
}

.link-card:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.link-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.card-index {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--linha);
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--f-px);
  color: var(--acento);
  transition:
    border-color 0.14s steps(2),
    color 0.14s steps(2),
    background-color 0.14s steps(2);
}

.link-card:hover .card-index {
  border-color: var(--sobre-acento);
  background: var(--sobre-acento);
  color: var(--acento);
}

.link-card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.link-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.link-title {
  font: 700 16px/1.15 var(--f-px);
  letter-spacing: -0.02em;
}

.link-badge {
  padding: 2px 6px;
  background: var(--acento);
  color: var(--sobre-acento);
  font: 500 10px/1.2 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.link-card:hover .link-badge {
  background: var(--sobre-acento);
  color: var(--acento);
}

.link-subtitle {
  font-size: 13.5px;
  color: var(--suave);
  transition: color 0.14s steps(2);
}

.link-card:hover .link-subtitle {
  color: var(--sobre-acento);
  opacity: 0.85;
}

.link-arrow {
  flex-shrink: 0;
  font: 700 18px/1 var(--f-px);
  color: var(--suave);
  transition:
    transform 0.14s steps(2),
    color 0.14s steps(2);
}

.link-card:hover .link-arrow {
  color: var(--sobre-acento);
  transform: translate(3px, -3px);
}

/* ==========================================================================
   Botão de Copiar E-mail
   ========================================================================== */
.email-section {
  margin-top: 12px;
}

.copy-email-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--tinta);
  background: var(--tinta);
  color: var(--fundo);
  text-align: left;
  transition:
    background-color 0.15s steps(2),
    color 0.15s steps(2),
    border-color 0.15s steps(2),
    transform 0.15s steps(2);
}

.copy-email-btn:hover {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--sobre-acento);
  transform: translate(-2px, -2px);
}

.copy-email-btn .card-index {
  border-color: currentColor;
  color: inherit;
}

.copy-email-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.copy-email-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.copy-email-label {
  opacity: 0.72;
}

.copy-email-address {
  font: 500 14.5px/1.2 var(--f-txt);
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid currentColor;
  font-size: 11px;
}

.copy-email-btn.is-copied {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--sobre-acento);
}

.copy-email-btn.is-copied .copy-badge {
  background: var(--sobre-acento);
  color: var(--acento);
  border-color: var(--sobre-acento);
}

/* ==========================================================================
   Divisor Pixelado & Rodapé
   ========================================================================== */
.pixel-divider {
  margin: 34px 0 24px;
  height: 4px;
  background: repeating-linear-gradient(
    to right,
    var(--linha) 0 6px,
    transparent 6px 12px
  );
}

.rotulo--footer {
  width: auto;
  margin-bottom: 16px;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--linha);
  background: var(--fundo-card);
  color: var(--tinta);
  font: 500 11.5px/1 var(--f-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition:
    background-color 0.14s steps(2),
    color 0.14s steps(2),
    border-color 0.14s steps(2),
    transform 0.14s steps(2);
}

.social-link:hover {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--sobre-acento);
  transform: translateY(-2px);
}

.social-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.footer-note {
  margin-top: 24px;
  padding: 5px 9px;
  background: var(--fundo-card);
  border: 1px solid var(--linha);
  color: var(--suave);
}

/* ==========================================================================
   Animação de Entrada (Stepped 8-bit) & Acessibilidade
   ========================================================================== */
.animate-px {
  opacity: 0;
  transform: translateY(10px);
  animation: pxIn 0.35s steps(4) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes pxIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .animate-px {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Ergonomia Mobile & Thumb Zone (Telas Touch)
   ========================================================================== */
@media (max-width: 640px), (hover: none) {
  .page {
    padding: 22px 18px calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .tema-bt {
    width: 44px;
    height: 44px;
  }

  .link-card,
  .copy-email-btn {
    min-height: 60px;
    padding: 16px;
  }

  .social-link {
    min-height: 44px;
    padding: 10px 14px;
  }

  .link-card:active {
    background: var(--acento);
    border-color: var(--acento);
    color: var(--sobre-acento);
  }
}

/* ==========================================================================
   Cursor Pixelado Inteligente (apenas desktop com mouse)
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  .com-cursor,
  .com-cursor a,
  .com-cursor button {
    cursor: none;
  }

  .cursor {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 250;
    pointer-events: none;
    opacity: 0;
    will-change: transform;
  }

  .cursor.on {
    opacity: 1;
  }

  .cursor::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -6px;
    width: 12px;
    height: 12px;
    background: var(--acento);
    box-shadow: 4px 4px 0 0 var(--acento-2);
    transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
  }

  .cursor.grande::before {
    transform: scale(0);
  }

  .cursor-txt {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    color: var(--sobre-acento);
    background: var(--acento);
    border: 1px solid var(--tinta);
    box-shadow: 3px 3px 0 0 var(--tinta);
    transform: scale(0);
    transform-origin: 0 0;
    transition: transform 0.22s cubic-bezier(0.19, 1, 0.22, 1);
  }

  .cursor.grande .cursor-txt:not(:empty) {
    transform: scale(1);
  }
}
