/* =========================================================
   MUSIC PAGE
   ========================================================= */

.music-intro {
  font-family: var(--font-serif);
  font-size: var(--font-size-prose);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 780px;
  margin-bottom: var(--space-xl);
}
.music-intro a {
  color: var(--accent-primary);
  border-bottom: 1px solid rgba(166, 132, 78, 0.35);
}

.music-section {
  margin-bottom: var(--space-xxl, 56px);
}
.music-section-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}
.music-section-blurb {
  font-family: var(--font-serif);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 var(--space-md);
  max-width: 720px;
}
.music-caption {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
  text-align: center;
}
.music-empty {
  padding: var(--space-lg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  text-align: center;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
}

/* "Under construction" banner beneath the intro. Subtle warm strip
   so it reads as a friendly notice, not an error. */
.music-wip {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(166, 132, 78, 0.06);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 6px 6px 0;
  padding: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-xl);
  max-width: 780px;
}
.music-wip .wip-tag {
  font-family: var(--font-mono);
  font-style: normal;
  color: var(--accent-primary);
  margin-right: 6px;
  font-size: 0.85em;
}

/* ─── Piece cards ─── */

.music-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.music-piece {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.piece-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-secondary);
  position: relative;
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}
.piece-media video,
.piece-media iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}
/* Local ropeflow video: letterbox inside the 16:9 card so portrait
   performances aren't cropped top/bottom. */
.piece-media--rope-local {
  background: #000;
}
.piece-media--rope-local video {
  object-fit: contain;
}
.piece-media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  letter-spacing: 0.05em;
}

/* Piano-of-Life-coupled piece: three-column layout,
   video · strip · GoL substrate. Video column sizes itself to the
   video's natural aspect (object-fit: contain) so portrait pieces get a
   narrow, tall column and landscape pieces get a wide short one, all
   at the same shared row height. */
.piece-media--with-gol {
  aspect-ratio: auto;
  height: 480px;
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr);
  gap: 0;
  background: var(--bg-primary);
}
.piece-media--with-gol .pol-video-wrap {
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
  /* Take the video's aspect ratio so the column width fits it snugly.
     The video element inside uses object-fit: contain to preserve
     aspect. */
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-subtle);
}
.piece-media--with-gol video {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.pol-strip {
  height: 100%;
  width: 100%;
  display: block;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
}
/* Wraps the GoL canvas plus its stop button so the button can sit
   absolute-positioned inside the same rectangle. */
.pol-substrate {
  position: relative;
  height: 100%;
  width: 100%;
  display: block;
}
.pol-gol {
  height: 100%;
  width: 100%;
  display: block;
  background: var(--bg-secondary);
}
.pol-stop {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 27, 31, 0.55);
  color: rgba(250, 248, 243, 0.95);
  border: 1px solid rgba(250, 248, 243, 0.25);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  z-index: 2;
}
.pol-stop:hover {
  color: #fff;
  border-color: rgba(250, 248, 243, 0.6);
  background: rgba(28, 27, 31, 0.8);
}
.pol-stop .ic {
  width: 12px;
  height: 12px;
  display: none;
  fill: currentColor;
}
/* Running: show pause icon (click to stop). Stopped: show play icon. */
.pol-stop[data-state="running"] .ic-pause { display: block; }
.pol-stop[data-state="stopped"] .ic-play  { display: block; }
/* Default (before JS runs): assume running, show pause */
.pol-stop:not([data-state]) .ic-pause     { display: block; }

.piece-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.piece-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}
.piece-year {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85em;
  margin-left: 6px;
}
.piece-desc {
  font-family: var(--font-serif);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
.piece-note {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin: var(--space-xs) 0 0;
  padding: var(--space-xs) var(--space-sm);
  border-left: 2px solid var(--border-default);
  background: rgba(0, 0, 0, 0.02);
}

/* ─── Ropeflow sim frame ─── */

.sim-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}
.sim-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ─── Responsive: stack the piano-of-life panel when narrow ─── */

@media (max-width: 780px) {
  .piece-media--with-gol {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 200px) 32px minmax(0, 200px);
    height: auto;
  }
  .pol-strip {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
  }
}
