/* ===== Fonte Margem ===== */
@font-face {
  font-family: "Margem";
  src: url("fonts/MargemTest-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Margem";
  src: url("fonts/MargemTest-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Margem";
  src: url("fonts/MargemTest-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ===== Tokens ===== */
:root {
  --bg: #F1F0E8;      /* off-white */
  --ink: #020305;     /* near-black */
  --accent: #F6EA60;  /* yellow */
  --font: "Margem", "Montserrat", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* barra de rolagem sempre reservada: a tela não "treme" ao abrir a lista */
  overflow-y: scroll;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 5vw, 40px) 12px 24px;
  -webkit-font-smoothing: antialiased;
}

/* ===== Fundo: capa borrada, escurecida, fixa ===== */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #101010 var(--cover, none) center / cover no-repeat;
  filter: blur(34px) brightness(0.5);
  transform: scale(1.15);
}

/* ===== Card ===== */
.card {
  width: 100%;
  max-width: 340px;
  border-radius: 6px;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

/* ===== Cover / player ===== */
.cover {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--ink);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}
.cover__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* badge ≡ 4 (toggle da lista de faixas) */
.cover__toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 0;
  border-radius: 4px;
  background: rgba(2, 3, 5, 0.85);
  color: var(--bg);
  cursor: pointer;
  transition: background 0.15s ease;
}
.cover__toggle:hover { background: rgba(2, 3, 5, 0.95); }
.cover__toggle-icon { width: 17px; height: 17px; display: block; }
.cover__toggle-num { font-size: 12px; font-weight: 700; line-height: 1; }
.card.tracks-open .cover__toggle { background: var(--accent); color: var(--ink); }

/* botão play central (fiel à referência: círculo translúcido escuro) */
.cover__play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 76px; height: 76px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.cover__play svg { grid-area: 1 / 1; width: 30px; height: 30px; }
.cover__play .icon-play { margin-left: 4px; }
.cover__play .icon-pause { display: none; margin-left: 0; }
.cover__play:hover { background: rgba(0, 0, 0, 0.6); transform: translate(-50%, -50%) scale(1.06); }
.card.playing .cover__play .icon-play { display: none; }
.card.playing .cover__play .icon-pause { display: block; }

/* ===== Tracklist (colapsável) ===== */
.tracklist {
  background: var(--ink);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.tracklist[hidden] { display: none; }
.tracks { list-style: none; margin: 0; padding: 0;background: #212121; }
.track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 20px;
  color: var(--bg);
  font-size: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.12s ease;
}
.track:first-child { border-top: 0; }
.track:hover { background: rgba(255, 255, 255, 0.05); }
.track__title { font-weight: 700; }
.track__time { font-variant-numeric: tabular-nums; opacity: 0.85; }
.track.active { color: var(--accent); }
.track.active .track__time { opacity: 1; }

/* equalizador (só na faixa ativa); barras ancoradas embaixo, crescem pra cima */
.track__meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 13px;
}
.track.active .eq { display: inline-flex; }
.eq i {
  display: block;
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transform: scaleY(0.28);
  transform-origin: bottom;
  animation: eq-bar 0.9s ease-in-out infinite;
  animation-play-state: paused;   /* congela quando pausado */
}
.eq i:nth-child(1) { animation-delay: -0.15s; }
.eq i:nth-child(2) { animation-delay: -0.55s; }
.eq i:nth-child(3) { animation-delay: -0.30s; }
.card.playing .track.active .eq i { animation-play-state: running; }

@keyframes eq-bar {
  0%, 100% { transform: scaleY(0.28); }
  50%      { transform: scaleY(1); }
}

/* ===== Painel do título ===== */
.song-info {
  background: var(--ink);
  color: var(--bg);
  text-align: center;
  padding: 15px;
}
.song-info__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.song-info__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

/* ===== Serviços ===== */
.services {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg);
  border-radius: 0 0 6px 6px;
}
.services li + li .service { border-top: 1px solid rgba(2, 3, 5, 0.10); }
.service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease;
}
.service:hover { background: rgba(2, 3, 5, 0.04); }
.service__logo {
  height: 28px;
  width: auto;
  max-width: 172px;
  object-fit: contain;
}
.service__cta {
  flex: none;
  min-width: 80px;
  text-align: center;
  padding: 7px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, color 0.15s ease;
}
/* hover: inverte amarelo/preto */
.service:hover .service__cta { background: var(--ink); color: var(--accent); }

/* ===== Footer disclaimer ===== */
.footer-disclaimer {
  width: 100%;
  max-width: 340px;
  text-align: center;
  margin-top: 16px;
  color: rgba(241, 240, 232, 0.72);
  font-size: 12px;
  line-height: 1.5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.footer-policy { margin: 0; }
.footer-policy a { color: rgba(241, 240, 232, 0.92); font-weight: 700; text-decoration: none; }
.footer-policy a:hover { text-decoration: underline; }
.manage-privacy { display: block; margin-top: 2px; }
.report-a-problem { margin-top: 10px; }
.report-a-problem span { color: rgba(241, 240, 232, 0.6); cursor: default; }

/* pilha vertical: card + footer centralizados; em telas altas, centraliza melhor */
@media (min-width: 700px) {
  body { justify-content: center; }
}

/* botão menor em telas bem estreitas (igual à referência) */
@media (max-width: 330px) {
  .service__cta { font-size: 11px; min-width: 72px; padding: 6px 10px; }
  .service { padding: 14px 16px; }
}

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