/* ==========================================================================
 * MILLENOVA GLOBAL PLAYER — STAGE DESKTOP LAYOUT CONTRACT
 *
 * OWNER:
 * This file owns desktop-only expanded Stage composition: Stage grid, center media and black-cinema presentation, Home feed placement, Signal sidebar and desktop queue/sidebar composition.
 *
 * MUST NOT OWN:
 * Do not define mobile Stage behavior, queue-row internals, provider logic or reaction internals. The dated Wilder Ruiz black-cinema override must be preserved. Scrollbar chrome remains owned by
 * Styles/scrollbars.css. JavaScript state/queue/provider semantics stay
 * outside CSS.
 *
 * CASCADE CONTRACT:
 * Segment 6 of 6 for this owner. Phase 11A mechanical split: loaded at manifest position 26, after
 * 25-media-playback-providers--part-2-of-2.css. Rule order is unchanged from the former monolith (baseline
 * df93472, lines 4114–4255). New corrections go into the canonical owning
 * rule; never append dated Phase/fix blocks.
 *
 * DEPENDENCIES:
 * Depends on Stage state classes (has-stage-*, is-mplayer-stage-open) and the Home page markup.
 * ========================================================================== */


/* ==========================================================================
 * Phase 10 post-pass desktop sidebar natural-flow correction
 *
 * Desktop Stage right column is one independent vertical flow:
 *   From the signal -> Your signal -> UP NEXT / NEXT FROM
 *
 * It must not inherit dead height from the left media/feed grid rows. Mobile
 * keeps its existing composition: the wrapper is layout-transparent there.
 *
 * This block does not alter the dated Wilder Ruiz black-cinema override.
 * ========================================================================== */

.floating-playlist__stage-main,
.floating-playlist__stage-sidebar {
  display: contents;
}

@media (min-width: 901px) {
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage {
    /*
     * Search can shrink the Home feed to only a few cards while the Signal
     * sidebar remains tall. The old two-row left column let the spanning
     * sidebar donate intrinsic height into the focus/feed tracks, producing a
     * large black well below NOW PLAYING. Keep the left and right columns as
     * independent vertical flows instead: media + Home feed live inside one
     * main column; Signal + queues live inside the sibling sidebar column.
     */
    grid-template-rows:
      auto
      auto
      auto;
    grid-template-areas:
      "header header"
      "main sidebar"
      "status status";
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-main {
    grid-area: main;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-self: start;
  }

  /*
   * Stage focus remains packed to its real media + info-strip height. The
   * Home feed follows immediately inside the same left-column flow, so the
   * right sidebar height can no longer insert space between them.
   */
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-focus {
    width: 100%;
    min-width: 0;
    align-content: start;
    flex: 0 0 auto;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-feed {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar {
    grid-area: sidebar;
    width: var(--mn-stage-sidebar-width);
    min-width: 0;
    max-width: var(--mn-stage-sidebar-width);
    display: flex;
    flex-direction: column;
    align-self: start;
    gap: .7rem;
    background: #050608;
  }

  /* Signal owns only the height its actual content needs. The old contain:size
   * + stretch contract deliberately isolated it from media height, but also
   * created the large empty reservation now that NEXT FROM is a sibling below.
   */
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__stage-rail {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    align-self: auto;
    overflow: visible;
    contain: none;
    scrollbar-gutter: auto;
    flex: 0 0 auto;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .stage-home-rail {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
  }

  /* From the signal may scroll its own release stack, but no blank space is
   * reserved beneath it. Your Signal and NEXT FROM follow immediately.
   */
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .stage-home-rail__stack {
    width: 100%;
    max-height: min(40vh, 380px);
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .stage-home-user-menu {
    min-height: 0;
    height: auto;
    margin-bottom: 0;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .stage-home-user-playlists__panel {
    height: auto;
    max-height: min(36vh, 340px);
  }

  /* NEXT FROM / UP NEXT use the complete sidebar width. Do not change row
   * behavior or marquee rules: only remove the squeeze that left dead space
   * beside the list.
   */
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__tracks {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    flex: 0 0 auto;
    border-left: 0;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__up-next-viewport,
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__context-viewport {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__track,
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__track--up-next {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__track-copy {
    min-width: 0;
  }

  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__track-actions,
  .floating-playlist:not(.is-minimized).has-stage-home-feed.has-stage-signal-rail
    .floating-playlist__stage-sidebar
    .floating-playlist__track-menu {
    justify-self: end;
  }
}

@media (max-width: 900px) {
  .floating-playlist__stage-main,
  .floating-playlist__stage-sidebar {
    display: contents;
  }
}
