/* Versos — lyrics cinéticas sobre fluido WebGL tingido pela capa do álbum. */

@property --c1 { syntax: '<color>'; inherits: true; initial-value: #4f46e5; }
@property --c2 { syntax: '<color>'; inherits: true; initial-value: #8b5cf6; }
@property --c3 { syntax: '<color>'; inherits: true; initial-value: #0e7490; }
@property --c2hi { syntax: '<color>'; inherits: true; initial-value: #d8ccff; }
@property --halo { syntax: '<color>'; inherits: true; initial-value: rgba(132, 108, 255, 0.16); }
@property --glow { syntax: '<color>'; inherits: true; initial-value: rgba(132, 108, 255, 0.32); }

:root {
  --bg: #07070b;
  --ink: rgba(255, 255, 255, 0.96);
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --spring: cubic-bezier(0.34, 1.45, 0.5, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --fs-quote: clamp(2rem, 3vw + 1rem, 4.2rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  color-scheme: dark;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  --c1: #4f46e5; --c2: #8b5cf6; --c3: #0e7490; --c2hi: #d8ccff;
  --halo: rgba(132, 108, 255, 0.16); --glow: rgba(132, 108, 255, 0.32);
  transition: --c1 1.6s ease, --c2 1.6s ease, --c3 1.6s ease, --c2hi 1.6s ease, --halo 1.6s ease, --glow 1.6s ease;
}

/* ---------- fundo ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

#flow {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body[data-bg='gl'] #flow { opacity: 1; }

/* blobs CSS: fundo imediato no boot e fallback sem WebGL; o fluido entra por cima em crossfade */
.cssbg { position: absolute; inset: 0; transition: opacity 1.2s ease; }
body[data-bg='gl'] .cssbg { opacity: 0; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.6;
  mix-blend-mode: screen;
  will-change: transform;
}
.blob-a {
  width: 80vmax; height: 80vmax; left: -26vmax; top: -32vmax;
  background: radial-gradient(closest-side, var(--c1), transparent 72%);
  animation: drift-a 21s ease-in-out infinite alternate;
}
.blob-b {
  width: 66vmax; height: 66vmax; right: -20vmax; top: 2vmax;
  background: radial-gradient(closest-side, var(--c2), transparent 72%);
  animation: drift-b 27s ease-in-out infinite alternate;
}
.blob-c {
  width: 74vmax; height: 74vmax; left: 6vmax; bottom: -36vmax;
  background: radial-gradient(closest-side, var(--c3), transparent 72%);
  animation: drift-c 33s ease-in-out infinite alternate;
}
@keyframes drift-a {
  50% { opacity: 0.44; }
  to { transform: translate(9vmax, 6vmax) scale(1.18) rotate(10deg); opacity: 0.7; }
}
@keyframes drift-b {
  50% { opacity: 0.72; }
  to { transform: translate(-8vmax, 9vmax) scale(0.86) rotate(-12deg); opacity: 0.48; }
}
@keyframes drift-c {
  50% { opacity: 0.48; }
  to { transform: translate(-7vmax, -9vmax) scale(1.15) rotate(8deg); opacity: 0.68; }
}

.halo {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 64% 46% at 50% 40%, var(--halo), transparent 70%);
  animation: breathe 8s ease-in-out infinite alternate;
}
@keyframes breathe {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 1; transform: scale(1.07); }
}

.grain {
  position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml;utf8,%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 type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  opacity: 0.04;
  mix-blend-mode: overlay;
}

.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 52%, rgba(2, 2, 7, 0.6) 100%);
}

/* ---------- stage ---------- */
.stage {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  padding: 48px 30px 16px;
  min-height: 0;
  touch-action: pan-y;
}

.quote {
  width: min(880px, 100%);
  font-size: var(--fs-quote);
  display: flex; flex-direction: column; gap: 0.36em;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
  will-change: transform;
}
.quote.grab { transition: none; }
.quote.out { animation: quote-out 0.2s ease both; }
@keyframes quote-out {
  to { opacity: 0; transform: translateY(-18px) scale(0.985); filter: blur(10px); }
}

/* linha = palavras cinéticas */
.line {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.3em;
  row-gap: 0.04em;
  font-weight: 800;
  font-size: 1em;
  line-height: 1.16;
  letter-spacing: -0.028em;
}

.w {
  display: inline-block;
  color: rgba(255, 255, 255, 0.93);
  animation: word-in 0.7s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 1ms);
}
.w.em {
  font-weight: 900;
  background: linear-gradient(118deg, #fff 45%, var(--c2hi));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes word-in {
  from { opacity: 0; transform: translateY(0.5em) scale(0.96); filter: blur(7px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

.ghost {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-weight: 600;
  font-size: 0.44em;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: rgba(255, 255, 255, 0.3);
  filter: blur(3px);
  animation: ghost-in 0.9s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 1ms);
  user-select: none;
}
.g-prev { margin-bottom: 0.5em; }
.g-next { margin-top: 0.5em; }
@keyframes ghost-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* skeleton */
.skeleton { display: flex; flex-direction: column; gap: 0.45em; }
.skel {
  display: block;
  width: var(--w, 70%);
  height: 0.95em;
  border-radius: 0.3em;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.11) 50%, rgba(255, 255, 255, 0.05) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* erro */
.oops { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.oops-text { font-size: 0.55em; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.oops-btn {
  font-family: var(--sans);
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background 0.3s, transform 0.35s var(--spring);
}
.oops-btn:hover { background: rgba(255, 255, 255, 0.14); }
.oops-btn:active { transform: scale(0.95); }

.hint {
  position: absolute;
  bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
  transition: opacity 0.6s;
  display: none;
  white-space: nowrap;
}
.hint kbd {
  font-family: var(--sans);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  padding: 2px 6px 3px;
  font-size: 9.5px;
  margin-right: 2px;
}
.hint.gone { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .hint { display: block; } }

/* ---------- dock (ilha) ---------- */
.dockwrap {
  position: relative; z-index: 2;
  display: flex; justify-content: center;
  padding: 0 14px calc(20px + env(safe-area-inset-bottom, 0px));
}

.glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.022));
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 22px 60px -20px rgba(0, 0, 0, 0.66),
    0 18px 60px -16px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);
  transition: box-shadow 1.6s ease;
}

.dock {
  width: min(520px, 100%);
  border-radius: 24px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 12px;
  position: relative;
  overflow: hidden;
}
.dock::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.08) 0%, transparent 20%, transparent 80%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}
.dock::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.07) 50%, transparent 58%);
  transform: translateX(-70%);
  animation: sheen 8.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 55% { transform: translateX(-70%); }
  85%, 100% { transform: translateX(70%); }
}

.art {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: block;
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.7), inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
  transform: translateZ(0);
}
.art::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.18), transparent 38%);
  z-index: 2;
  pointer-events: none;
}
.art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
  position: relative; z-index: 1;
}
.art img.on { opacity: 1; }
.art-skel {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.06) 30%, rgba(255, 255, 255, 0.13) 50%, rgba(255, 255, 255, 0.06) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meta-title {
  font-weight: 700; font-size: 13.5px; letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta-sub {
  font-size: 11.5px; font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }

.glass-soft {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.btn-yt {
  width: 40px; height: 40px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.3s, color 0.3s, transform 0.35s var(--spring);
}
.btn-yt:hover { background: rgba(255, 255, 255, 0.13); color: #fff; transform: scale(1.06); }
.btn-yt:active { transform: scale(0.92); }

.btn-next {
  width: 44px; height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0f;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px -10px rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.35s var(--spring), box-shadow 0.3s, background 0.3s;
}
.btn-next svg { transition: transform 0.35s var(--spring); }
.btn-next:hover { transform: scale(1.06); background: #fff; box-shadow: 0 12px 34px -8px var(--glow), inset 0 -1px 0 rgba(0, 0, 0, 0.06); }
.btn-next:hover svg { transform: translateX(2px); }
.btn-next:active { transform: scale(0.9); }
.btn-next:disabled { opacity: 0.6; cursor: default; transform: none; }

:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.65); outline-offset: 3px; border-radius: 8px; }
.btn-next:focus-visible, .btn-yt:focus-visible, .oops-btn:focus-visible { border-radius: 999px; }

::selection { background: var(--c2); color: #fff; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .stage { padding: 28px 24px 10px; }
  .quote { gap: 0.34em; }
  .dock { gap: 10px; border-radius: 22px; }
  .art { width: 42px; height: 42px; border-radius: 11px; }
  .meta-title { font-size: 13px; }
  .meta-sub { font-size: 11px; }
  .btn-yt { width: 38px; height: 38px; }
  .btn-next { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .halo, .dock::before { animation: none; }
  .w, .ghost { animation-duration: 0.01s; animation-delay: 0s; }
  .quote.out { animation-duration: 0.01s; }
  .quote { transition: none; }
  .skel, .art-skel { animation: none; }
}
