/* mpv-song.css — per-song landing pages of the MIDI Piano Visualizer Library
   (/midi-piano-visualizer-library/<slug>). Layered on the vanilla cosmic
   shell (cosmic-shell.css supplies the rail, starfield, theme tokens:
   --bg --surface --ink --sub --accent --accent2 --line --cta --cta-glow
   --font-body --font-display). Everything themes from tokens — both modes. */

/* The .cosmic-shell-content.cosmic-tool wrapper already provides the whole
   page geometry (1080px column, margin auto, rail gutter). Adding another
   gutter here pushed the hero right of center — keep this box neutral. */
.mpvs-main {
  width: 100%;
  margin: 0;
  padding: 0;
}

/* ── Hero card with the live falling-notes scene ─────────────────────────── */
.mpvs-hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card, 0 30px 70px -30px rgba(0, 0, 0, .45));
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}

/* The scene sits behind the copy: falling note bars + a piano-key strip. */
.mpvs-scene { position: absolute; inset: 0; pointer-events: none; }
.mpvs-note {
  position: absolute;
  top: -110px;
  width: 12px;
  border-radius: 7px;
  opacity: 0;
  animation: mpvs-fall linear infinite;
  will-change: transform, opacity;
}
.mpvs-note.t0 { background: linear-gradient(to bottom, transparent, var(--accent)); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent); }
.mpvs-note.t1 { background: linear-gradient(to bottom, transparent, var(--accent2)); box-shadow: 0 0 18px color-mix(in srgb, var(--accent2) 55%, transparent); }
.mpvs-note.t2 { background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 50%, var(--accent2))); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent); }
@keyframes mpvs-fall {
  0%   { transform: translateY(0); opacity: 0; }
  8%   { opacity: .85; }
  86%  { opacity: .85; }
  100% { transform: translateY(min(78vh, 560px)); opacity: 0; }
}

/* Piano-key strip pinned to the hero's bottom edge. */
.mpvs-keys {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  display: flex;
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.mpvs-keys .wk {
  flex: 1;
  position: relative;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .92), rgba(235, 235, 240, .88));
  border-right: 1px solid rgba(0, 0, 0, .22);
}
.mpvs-keys .wk.has-bk::after {
  content: ""; position: absolute; top: 0; right: -21%;
  width: 46%; height: 58%; z-index: 1;
  background: linear-gradient(to bottom, #17171f, #2b2b38);
  border-radius: 0 0 3px 3px;
}
.mpvs-glow {
  position: absolute; left: 0; right: 0; bottom: 40px; height: 90px;
  background: radial-gradient(60% 100% at 50% 100%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%);
}

/* Copy — sits above the scene, CENTERED in the hero (user rule). */
.mpvs-hero-inner {
  position: relative; z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  padding: clamp(30px, 5.5vw, 64px) clamp(20px, 5vw, 60px) clamp(78px, 10vw, 110px);
}
.mpvs-crumb {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--sub); text-decoration: none;
  margin-bottom: 20px;
  transition: color .16s ease;
}
.mpvs-crumb:hover { color: var(--accent); }
.mpvs-tag {
  margin: 0 0 10px;
  font-family: var(--font-body); font-weight: 700; font-size: 12px;
  letter-spacing: .16em; color: var(--accent);
}
.mpvs-title {
  margin: 0;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.04; letter-spacing: -.02em;
  color: var(--ink);
  text-wrap: balance;
  animation: mpvs-rise .7s cubic-bezier(.2, .7, .3, 1) both;
}
.mpvs-composer {
  margin: 12px 0 0;
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(17px, 2.4vw, 23px);
  color: var(--sub);
  animation: mpvs-rise .7s .08s cubic-bezier(.2, .7, .3, 1) both;
}
.mpvs-desc {
  margin: 18px auto 0;
  font-family: var(--font-body); font-size: 15.5px; line-height: 1.65;
  color: var(--sub); max-width: 56ch;
  animation: mpvs-rise .7s .14s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes mpvs-rise {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Metadata chips ──────────────────────────────────────────────────────── */
.mpvs-meta {
  list-style: none; margin: 26px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  animation: mpvs-rise .7s .2s cubic-bezier(.2, .7, .3, 1) both;
}
.mpvs-meta li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  font-family: var(--font-body); font-size: 12.5px;
}
.mpvs-meta .k { color: var(--sub); font-weight: 500; }
.mpvs-meta .v { color: var(--ink); font-weight: 650; }

/* ── The gateway CTA ─────────────────────────────────────────────────────── */
.mpvs-gate {
  position: relative;
  display: inline-flex;
  margin-top: 34px;
  text-decoration: none;
  border-radius: 999px;
  animation: mpvs-rise .7s .26s cubic-bezier(.2, .7, .3, 1) both;
}
.mpvs-gate .ring {
  position: absolute; inset: -7px;
  border-radius: inherit;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
  animation: mpvs-pulse 2.4s ease-out infinite;
}
@keyframes mpvs-pulse {
  0%   { transform: scale(.94); opacity: .9; }
  70%  { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}
.mpvs-gate .core {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 17px 34px;
  border-radius: inherit;
  font-family: var(--font-body); font-weight: 700; font-size: 16.5px;
  color: var(--accent-ink, #fff);
  background: var(--cta, linear-gradient(135deg, var(--accent2), var(--accent)));
  box-shadow: var(--cta-glow, 0 22px 50px -18px rgba(0, 0, 0, .5));
  transition: transform .18s cubic-bezier(.3, .7, .4, 1), filter .2s ease;
}
[data-palette="mono"] .mpvs-gate .core { color: var(--bg); }
.mpvs-gate:hover .core { transform: translateY(-3px) scale(1.02); filter: brightness(1.06); }
.mpvs-gate:active .core { transform: none; }
.mpvs-gate-hint {
  margin: 14px 0 0;
  font-family: var(--font-body); font-size: 12.5px; color: var(--sub);
  animation: mpvs-rise .7s .3s cubic-bezier(.2, .7, .3, 1) both;
}

/* ── Related pieces ──────────────────────────────────────────────────────── */
.mpvs-related { margin-top: 42px; }
.mpvs-related h2 {
  margin: 0 0 16px;
  font-family: var(--font-body); font-weight: 700;
  font-size: clamp(18px, 2.2vw, 23px); letter-spacing: -.015em; color: var(--ink);
}
.mpvs-rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.mpvs-rel {
  display: flex; flex-direction: column; gap: 4px;
  padding: 15px 17px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform .18s cubic-bezier(.3, .7, .4, 1), border-color .18s ease;
}
.mpvs-rel:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.mpvs-rel .t { font-family: var(--font-body); font-weight: 650; font-size: 14.5px; color: var(--ink); }
.mpvs-rel .c { font-family: var(--font-body); font-size: 12.5px; color: var(--sub); }

/* ── Motion safety ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mpvs-note, .mpvs-gate .ring { animation: none; }
  .mpvs-note { opacity: .35; transform: translateY(120px); }
  .mpvs-title, .mpvs-composer, .mpvs-desc, .mpvs-meta, .mpvs-gate, .mpvs-gate-hint { animation: none; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mpvs-hero { border-radius: 20px; }
  .mpvs-hero-inner { padding-bottom: 84px; }
  .mpvs-keys { height: 38px; }
  .mpvs-meta li { padding: 7px 12px; }
  .mpvs-gate .core { padding: 15px 26px; font-size: 15.5px; }
  .mpvs-rel-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) { .mpvs-rel-grid { grid-template-columns: 1fr; } }
