/* Arka on a wide window. The phone layout is the app; from 1024px the same parts are laid out for a
   desk: the tabs go to a sidebar, the mini player becomes a bar along the bottom carrying the transport
   and the scrubber (moved there by app.js, so they're the same buttons), Now playing opens as a panel
   beside the page instead of a sheet over it, and option sheets open as dialogs in the middle. Nothing
   here applies below 1024px: there the phone layout is exactly as style.css draws it. */

.mini-ctl { display: none; }   /* the bar's transport slot: empty, and out of the way, on a phone */

@media (min-width: 1024px) {
  :root {
    --side-w: clamp(184px, 15vw, 232px);
    --np-w: clamp(320px, 27vw, 420px);
    --content-max: 1000px;
    --tabs-h: 0px;          /* the tabs no longer sit at the bottom: every sum that cleared them drops them */
    --mini-h: 88px;
  }
  body { --np-room: 0px; }
  body.np-side { --np-room: var(--np-w); }
  /* the page's column: what's left between the sidebar and the panel, at most --content-max, centred */
  body { --pad-x: max(0px, (100% - var(--side-w) - var(--np-room) - var(--content-max)) / 2); }

  main {
    padding-left: calc(var(--side-w) + var(--pad-x));
    padding-right: calc(var(--np-room) + var(--pad-x));
  }
  .bar { left: calc(var(--side-w) + var(--pad-x)); right: calc(var(--np-room) + var(--pad-x)); padding-left: 4px; padding-right: 4px; }
  .toast { left: var(--side-w); right: var(--np-room); }
  .ll-ret.fixed { left: var(--side-w); right: var(--np-room); }
  .ll-retb { max-width: calc(100% - 2 * var(--gut)); }

  /* ---------------------------------------------------------- sidebar */
  .tabs {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-dock);
    width: var(--side-w); height: auto; padding: 8px 0;
    display: flex; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line);
  }
  body.has-mini .tabs { bottom: var(--mini-h); }
  .tabs::after { content: none; }
  .tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 20px; }
  .tabs a > span:nth-child(2) { margin-right: 0; }
  .tabs a:focus-visible { outline-offset: -2px; }
  .badge { position: static; margin-left: auto; }

  /* ---------------------------------------------------------- player bar */
  .mini {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px) minmax(0, 1fr); column-gap: 24px; align-items: center;
    padding: 0 16px;
  }
  .mini-open { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; }
  .mini-art { width: 56px; height: 56px; }
  #mini-toggle, #mini-skip, .mini-bar { display: none; }
  .mini.live::after { content: none; }   /* the scrubber's own red dot says live */
  .mini-ctl {
    grid-column: 2; grid-row: 1; display: grid; align-content: center; row-gap: 4px; column-gap: 12px;
    grid-template-columns: 56px minmax(0, 1fr) 56px; grid-template-areas: "tr tr tr" "pos sc dur";
  }
  .mini-ctl .transport { grid-area: tr; display: flex; justify-content: center; gap: 8px; margin: 0; }
  .mini-ctl .t-btn, .mini-ctl .t-play { width: 48px; height: 40px; flex: none; }
  .mini-ctl .t-btn svg, .mini-ctl .t-play svg { width: 18px; height: 18px; }
  .mini-ctl #t-back svg, .mini-ctl #t-fwd svg { width: 24px; height: 24px; }
  body:has(#np.is-live) #t-back, body:has(#np.is-live) #t-fwd { display: none; }
  .mini-ctl .scrub { grid-area: sc; height: 20px; margin: 0; }
  .mini-ctl .scrub-track { top: 8px; }
  .mini-ctl .scrub-thumb { top: 4px; }
  .mini-ctl .scrub.live::after { top: 6px; }
  .mini-ctl .times { display: contents; }
  .mini-ctl #t-pos { grid-area: pos; justify-self: end; }
  .mini-ctl #t-dur { grid-area: dur; justify-self: start; }

  /* ---------------------------------------------------------- Now playing, beside the page */
  .np { top: 0; right: 0; bottom: 0; left: auto; width: var(--np-w); }
  body.has-mini .np { bottom: var(--mini-h); }
  .np-backdrop { display: none; }
  .np-sheet {
    padding: 0 24px 24px; border-left: 1px solid var(--line); box-shadow: none;
    translate: none; opacity: 0; transition: opacity 120ms ease;
    scroll-padding-top: 72px;
  }
  .np.open .np-sheet { opacity: 1; }
  .np-top { margin: 0 -24px; padding: 0 24px; touch-action: auto; }
  .np-top .grabber { display: none; }
  .np-head { height: 52px; }   /* its rule level with the top bar's */
  #np-close svg { rotate: -90deg; }   /* the chevron points the way the panel goes */
  .np-drag { touch-action: auto; }
  .np-art { width: 100%; }
  .np-sheet .np-id { margin-top: 20px; }

  /* ---------------------------------------------------------- option sheets as dialogs */
  .sheet-wrap { justify-content: center; align-items: center; padding: 24px; }
  .sheet {
    width: min(480px, 100%); max-height: min(760px, calc(100dvh - 48px));
    padding: 16px var(--gut); border: 1px solid var(--line); box-shadow: none;
    translate: none; opacity: 0; scale: .98;
    transition: opacity 140ms ease, scale 140ms var(--ease-out);
  }
  .sheet-wrap.open .sheet { opacity: 1; scale: 1; }
  .sheet-wrap.closing .sheet, .sheet-wrap.closing .sheet-backdrop { transition-duration: 120ms; }
  .sheet-backdrop { transition-duration: 140ms; }
  .sheet-grab .grabber { display: none; }
  .sheet-grab { touch-action: auto; }

  /* ---------------------------------------------------------- the extra width */
  .rail { grid-auto-columns: 184px; }
  .rail.sm { grid-auto-columns: 148px; }
  .genre-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail > .actions { max-width: 480px; }   /* an episode's Play now stays a button, not a band */
}

@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
  .sheet { scale: none; }
}
