/* ============================================================
   CAPONE — LINK HUB
   css/style.css
   ------------------------------------------------------------
   Índice:
   1. Fontes (@font-face)
   2. Tokens de design (:root)
   3. Reset e base
   4. Layout da página
   5. Cabeçalho de perfil (avatar, nome, bio, badge)
   6. Cartões de link
   7. Rodapé
   8. Acessibilidade e responsivo
   ============================================================ */

/* ---------- 1. FONTES ---------- */
/* Bebas Neue — título display */
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/bebas-neue-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/bebas-neue-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}

/* Manrope — texto e interface (fonte variável: pesos 400 a 800) */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../assets/fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../assets/fonts/manrope-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}

/* ---------- 2. TOKENS DE DESIGN ---------- */
:root {
  /* Paleta base */
  --black-0: #0A0A0B;
  --black-1: #131315;
  --black-2: #1B1B1E;
  --black-3: #232326;
  --gray-2: #6E6E76;
  --gray-3: #A8A8AE;
  --white-0: #FAFAF7;

  --yellow-0: #FFDE00;
  /* amarelo Capone */
  --yellow-1: #E6C700;
  --yellow-2: #FFF3AD;

  --red-0: #FF3B5C;
  /* AO VIVO */

  /* Superfícies */
  --surface-app: var(--black-0);
  --surface-raised: var(--black-1);
  --surface-card: var(--black-2);
  --surface-card-hover: var(--black-3);
  --surface-border: #29292D;

  /* Texto */
  --text-primary: var(--white-0);
  --text-secondary: var(--gray-3);
  --text-muted: var(--gray-2);
  --text-on-accent: var(--black-0);

  /* Acento */
  --accent: var(--yellow-0);
  --accent-hover: var(--yellow-2);
  --live: var(--red-0);
  --live-soft: rgba(255, 59, 92, 0.16);

  /* Tipografia */
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Raios e sombras */
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-raised: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-glow-accent: 0 0 0 1px rgba(255, 222, 0, 0.4), 0 0 32px rgba(255, 222, 0, 0.25);

  /* Movimento */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-base: 200ms;
}

/* ---------- 3. RESET E BASE ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--surface-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100%;
  /* UX mobile: sem flash cinza no toque e sem "puxar pra atualizar"
     interferindo nos gestos da página */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

a {
  color: inherit;
}

/* toque responde na hora (remove o atraso de duplo-toque do mobile) */
a,
button {
  touch-action: manipulation;
}

/* ---------- 4. LAYOUT DA PÁGINA ---------- */
.page {
  position: relative;
  /* referência para o espectro */
  display: flex;
  justify-content: center;
  padding: 88px 20px 60px;
  /* espaço extra no topo por causa do mini player fixo */
  min-height: 100vh;
  overflow-x: clip;
}

.hub {
  position: relative;
  z-index: 1;
  /* conteúdo acima do espectro */
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: center;
}

/* ---------- 4b. ESPECTRO DE ÁUDIO ---------- */
/* Canvas de largura total, centralizado verticalmente na altura da foto.
   Aparece com fade quando a música toca (classe .spectrum--on via JS). */
.spectrum {
  position: absolute;
  top: 10px;
  /* centro do canvas alinhado ao centro do avatar */
  left: 0;
  width: 100%;
  height: 300px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}

.spectrum--on {
  opacity: 1;
}

@media (max-width: 420px) {
  .spectrum {
    top: 12px;
    height: 240px;
  }
}

/* ---------- 5. CABEÇALHO DE PERFIL ---------- */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  /* o topo fica atrás dos cartões e é coberto no recolhimento (js/main.js) */
  position: relative;
  z-index: 0;
  will-change: transform, opacity;
  /* sem transition aqui: o js/main.js anima quadro a quadro */
}

/* ---- recolhimento progressivo do topo ----
   O movimento acompanha o gesto do usuário quadro a quadro: o
   js/main.js calcula a posição e aplica direto (transform/opacity no
   .profile e margin-top no .links) — sem transições de CSS aqui,
   senão elas brigariam com o acompanhamento em tempo real. */
.profile__avatar-wrap {
  position: relative;
  display: inline-block;
  width: 144px;
  height: 144px;
}

.profile__avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-card);
  box-shadow: 0 0 0 3px var(--surface-app), 0 0 0 5px var(--accent);
}

/* Bolinha de status "ao vivo" no avatar */
.profile__status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--live);
  border: 3px solid var(--surface-app);
  box-sizing: content-box;
  display: none;
  /* ativada via js/main.js quando AO_VIVO = true */
}

.profile__name {
  margin: 0;
  font: 700 56px/0.94 var(--font-display);
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.profile__bio {
  margin: 0;
  font: 500 16px/1.5 var(--font-body);
  color: var(--text-secondary);
  max-width: 340px;
}

/* Badge AO VIVO */
.badge-live {
  display: none;
  /* ativada via js/main.js quando AO_VIVO = true */
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 9px;
  border-radius: var(--radius-pill);
  background: var(--live-soft);
  color: var(--live);
  font: 700 11px/1.2 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-live__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

/* ---------- 6. CARTÕES DE LINK ---------- */
.links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  /* os cartões passam POR CIMA do topo no scroll */
  position: relative;
  z-index: 2;
}

.link-card {
  position: relative;
  /* referência para o canvas de raios */
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-l);
  text-decoration: none;
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-card);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    background var(--duration-base) var(--ease-out);
}

.link-card:hover,
.link-card:focus-visible {
  background: var(--surface-card-hover);
  box-shadow: var(--shadow-raised);
  transform: translateY(-2px) scale(1.005);
}

.link-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* feedback tátil: o cartão afunda de leve ao ser pressionado */
.link-card:active {
  transform: scale(0.98);
  transition-duration: 80ms;
}

.link-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-m);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  color: var(--white-0);
  /* cor do ícone (SVG usa currentColor) */
}

.link-card__icon svg {
  width: 22px;
  height: 22px;
}

.link-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.link-card__label {
  font: 700 22px/1.25 var(--font-body);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card__subtitle {
  font: 500 14px/1.45 var(--font-body);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card__arrow {
  font: 500 16px/1 var(--font-body);
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
}

.link-card:hover .link-card__arrow {
  transform: translateX(3px);
}

/* Variante destaque (AO VIVO): cartão amarelo — aplicada via js/main.js */
.link-card--live {
  background: var(--accent);
  border-color: transparent;
}

.link-card--live:hover,
.link-card--live:focus-visible {
  background: var(--accent);
  box-shadow: var(--shadow-glow-accent);
}

.link-card--live .link-card__icon {
  background: rgba(10, 10, 11, 0.14);
  color: var(--black-0);
}

.link-card--live .link-card__label,
.link-card--live .link-card__arrow {
  color: var(--text-on-accent);
}

.link-card--live .link-card__subtitle {
  color: rgba(10, 10, 11, 0.65);
}

.link-card--live .badge-live {
  display: inline-flex;
  background: rgba(10, 10, 11, 0.85);
}

/* ---- Efeito "eletrocutado" do cartão da Twitch (ativo com a música) ---- */
.zap {
  position: absolute;
  left: -16px;
  top: -16px;
  width: calc(100% + 32px);
  height: calc(100% + 32px);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}

.zap--on {
  opacity: 1;
}

/* micro-vibração do cartão, como se estivesse tomando choque */
@keyframes zap-shake {
  0% {
    transform: translate(0, 0);
  }

  20% {
    transform: translate(0.7px, -0.5px);
  }

  40% {
    transform: translate(-0.6px, 0.4px);
  }

  60% {
    transform: translate(0.5px, 0.6px);
  }

  80% {
    transform: translate(-0.4px, -0.6px);
  }

  100% {
    transform: translate(0, 0);
  }
}

.zap-shake {
  animation: zap-shake 110ms linear infinite;
}

/* Variante "em breve": sem link ativo, aparência atenuada */
.link-card--soon {
  cursor: default;
  opacity: 0.75;
}

.link-card--soon:hover {
  transform: none;
  box-shadow: var(--shadow-card);
  background: var(--surface-card);
}

.link-card--soon:hover .link-card__arrow {
  transform: none;
}

/* ---------- 7. RODAPÉ ---------- */
.footer {
  font: 700 11px/1.2 var(--font-body);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 8px;
  text-transform: uppercase;
  text-align: center;
}

/* ---------- 7b. MINI PLAYER (faixa fixa no topo) ---------- */
.music-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(40px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  /* respeita o notch/status bar do iPhone */
  padding: env(safe-area-inset-top, 0px) 12px 0;
  background: rgba(19, 19, 21, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--surface-border);
  z-index: 30;
  transition: transform 320ms var(--ease-out);
}

/* escondido durante a rolagem pra baixo (celular) — volta ao rolar pra cima */
.music-bar--oculta {
  transform: translateY(-105%);
}

/* Botão play/pause */
.music-bar__btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out);
}

.music-bar__btn svg {
  width: 14px;
  height: 14px;
}

.music-bar__btn:hover {
  color: var(--text-primary);
}

.music-bar__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tocando: botão fica amarelo */
.music-bar--playing .music-bar__btn {
  background: var(--accent);
  color: var(--text-on-accent);
}

/* Letreiro */
.music-bar__marquee {
  flex: 1;
  overflow: hidden;
  /* esmaece as pontas do letreiro */
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.music-bar__track {
  display: flex;
  width: max-content;
  animation: marquee 22s linear infinite;
  animation-play-state: paused;
  /* parado até a música tocar */
}

.music-bar--playing .music-bar__track {
  animation-play-state: running;
}

.music-bar__text {
  font: 700 11px/1 var(--font-body);
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.music-bar--playing .music-bar__text {
  color: var(--accent);
}

/* Letras andando da esquerda para a direita */
@keyframes marquee {
  from {
    transform: translateX(-50%);
  }

  to {
    transform: translateX(0);
  }
}

/* Barrinha de progresso na base da faixa */
.music-bar__progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0%;
  background: var(--accent);
}

/* ---------- 8. ACESSIBILIDADE E RESPONSIVO ---------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 420px) {
  .page {
    padding: 72px 16px 48px;
  }

  .profile__avatar-wrap {
    width: 120px;
    height: 120px;
  }

  .profile__name {
    font-size: 48px;
  }
}

/* Telas de toque: alvos maiores (mínimo confortável de 44px) */
@media (pointer: coarse) {
  .music-bar {
    height: calc(48px + env(safe-area-inset-top, 0px));
  }

  .music-bar__btn {
    width: 36px;
    height: 36px;
  }

  .music-bar__btn svg {
    width: 16px;
    height: 16px;
  }

  /* hover não existe no toque — desliga o levitar pra não "grudar" */
  .link-card:hover {
    transform: none;
  }

  .link-card:active {
    transform: scale(0.98);
  }
}