/*
 * Sets.LIVE v2.1 public features (FE): account controls in the top bar, the auth sheet, prompts,
 * Show info, action-sheet extras, the playlists grid and the playlist detail header.
 * Consumes the design system in app.css (STYLE.md): tokens and base components are never redefined
 * here, only extended with namespaced classes.
 */

/* ----------------------------------------------------------- top-bar account */
.acct { display: flex; align-items: center; margin-left: 4px; }
.acct-avatar { display: none; }
.is-auth .acct-avatar { display: inline-flex; }
.is-auth .acct-signin { display: none; }
.acct-signin .icon { width: 16px; height: 16px; }
.avatar-btn .avatar { pointer-events: none; }

/* ------------------------------------------------------------ menus, sheets */
.menu--sub { transform-origin: left top; }
.menu__item .spinner { width: 16px; height: 16px; margin: 1px; }
.menu__cancel { justify-content: center; font-weight: 600; }
.menu__cancel > .menu__text { flex: none; }
.menu.is-sheet { max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
/* Long-press opens the action sheet: no text selection or iOS link callout under the finger. */
@media (pointer: coarse) {
  .row, .pl-tile, .pl-head { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* ----------------------------------------------------------------- auth sheet */
.auth { width: min(420px, 100%); }
.auth .dialog__head { align-items: center; margin-bottom: 6px; }
.auth__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.auth__mark {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 .5px var(--accent-line);
}
.auth__mark .icon { width: 22px; height: 22px; }
.auth__reason { margin: 2px 0 14px; }
.auth__tabs { margin: 8px 0 18px; }
.auth__form { display: grid; gap: 0; }
.auth__form .field + .field { margin-top: 14px; }
.auth__submit { margin-top: 20px; }
.auth__error {
  margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-xs); font-size: 14px; line-height: 19px;
  color: var(--danger-text); background: var(--danger-soft);
}
.auth__note { margin-top: 14px; color: var(--text-dim); font-size: 13px; line-height: 18px; text-align: center; }
.auth__closed { display: grid; gap: 10px; padding: 6px 0 2px; color: var(--text-dim); font-size: 15px; line-height: 21px; }
.auth__closed strong { color: var(--text); font-weight: 600; }
.auth__closed .btn { margin-top: 8px; }
/* Honeypot: invisible to people and assistive tech, still submitted by naive bots. */
.auth__hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.auth [aria-busy="true"] .auth__submit { opacity: .7; }

/* -------------------------------------------------------------------- prompts */
.dialog--prompt { width: min(380px, 100%); }
.dialog--prompt .dialog__head { margin-bottom: 4px; }
.dialog--prompt .field { margin-top: 12px; }
.dialog--prompt .dialog__actions { margin-top: 20px; }

/* ------------------------------------------------------------------ show info */
.dialog--info { width: min(480px, 100%); }
.info__top { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; }
.info__top .thumb { --s: 88px; width: 88px; height: 88px; border-radius: var(--radius-sm); }
.info__heads { min-width: 0; }
.info__title { color: var(--text); font: 600 17px/22px var(--font-display); overflow-wrap: anywhere; }
.info__sub { margin-top: 3px; color: var(--text-dim); font-size: 14px; line-height: 19px; overflow-wrap: anywhere; }
.info .group__row { min-height: 40px; gap: 16px; font-size: 14px; }
.info .group__label { flex: 0 0 auto; color: var(--text); }
.info .group__value { flex: 1 1 auto; color: var(--text-dim); }
.info__path { font-size: 12.5px; word-break: break-all; }
.info[aria-busy="true"] .group__body { min-height: 120px; }

/* ------------------------------------------------------------ search extras */
.sugg-status--note { padding: 8px 12px; font-size: 13px; }
.sugg-status--note .icon { width: 16px; height: 16px; color: var(--accent); flex: none; }
.thumb--dir.has-art img { z-index: 1; }

/* Rows that only download (AIFF/WMA in browsers that cannot play them) */
.row.is-download .row__title .badge--warn { margin-left: 2px; }

/* ------------------------------------------------------------- playlists grid */
.pl-overview__head { margin-bottom: 12px; }
.pl-import { margin: 0 0 18px; }
.pl-import .meta-note__row { flex-wrap: wrap; }
.pl-import .meta-note__row > span { flex: 1 1 200px; }
.pl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 20px;
  list-style: none; margin: 4px 0 0; padding: 0;
}
.pl-tile { position: relative; min-width: 0; }
.pl-tile__link { display: grid; gap: 2px; color: inherit; text-decoration: none; border-radius: var(--radius); }
.pl-tile__link:hover { text-decoration: none; }
.pl-tile__link:focus-visible { outline: none; }
.pl-tile__link:focus-visible .mosaic { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-tile .mosaic { border-radius: var(--radius); margin-bottom: 8px; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.pl-tile .mosaic.art-ph > .icon { width: 34%; height: 34%; }
@media (hover: hover) {
  .pl-tile__link:hover .mosaic { transform: scale(1.02); box-shadow: var(--shadow); }
}
.pl-tile__name { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; line-height: 19px; text-overflow: ellipsis; white-space: nowrap; }
.pl-tile__meta { color: var(--text-dim); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
/* The tile's "more" button floats on its artwork: visible on hover/focus, always on touch. */
.pl-tile__more {
  position: absolute; top: 8px; right: 8px; z-index: 1; color: var(--text);
  background: var(--material-thick); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: 50%; opacity: 0; transition: opacity .15s var(--ease);
}
.pl-tile:hover .pl-tile__more, .pl-tile:focus-within .pl-tile__more, .pl-tile__more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .pl-tile__more { opacity: 1; } }
.pl-tile--skel .mosaic { margin-bottom: 10px; }
.pl-tile--skel .skeleton:last-child { width: 70%; height: 12px; }

/* ------------------------------------------------------- playlist detail head */
.pl-head { grid-template-columns: 184px minmax(0, 1fr); align-items: end; gap: 24px; margin: 16px 0 20px; }
.pl-head .mosaic { width: 184px; border-radius: var(--radius); box-shadow: var(--shadow); }
.pl-head .mosaic.skeleton { height: 184px; }
.pl-head__main { min-width: 0; }
.pl-head__actions { margin-top: 14px; }
.pl-head__actions .btn { border-radius: var(--radius-pill); }
.pl-head__actions .btn--play { padding: 0 22px; }

/* ====================================================================== MOBILE */
@media (max-width: 899.98px) {
  .acct { margin-left: 0; }
  .acct-signin { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .acct-signin .icon { width: 20px; height: 20px; margin: 0; }
  .acct-signin__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .avatar-btn { width: 44px; height: 44px; }

  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
  .pl-head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 16px; margin-top: 12px; }
  .pl-head .mosaic { width: min(220px, 62vw); }
  .pl-head .mosaic.skeleton { height: min(220px, 62vw); }
  .pl-head .head__stats { justify-content: center; }
  .pl-head__actions { justify-content: center; }
  .pl-head__actions .btn--play, .pl-head__actions [data-act="shuffle-all"] { flex: 1 1 0; max-width: 170px; }
  .info__top .thumb { --s: 72px; width: 72px; height: 72px; }
}

/* Desktop: the auth sheet, prompts and Change password keep their top edge when hints or errors change their
   height, instead of re-centring under the pointer (UX21-09). The max-height keeps short windows scrolling
   inside the dialog, never past the viewport. Browsers without :has() centre Change password as before. */
@media (min-width: 900px) {
  .backdrop > .auth, .backdrop > .dialog--prompt {
    align-self: start; margin-top: clamp(0px, 14vh - 16px, 124px);
    max-height: calc(100vh - 32px - clamp(0px, 14vh - 16px, 124px)); max-height: calc(100dvh - 32px - clamp(0px, 14vh - 16px, 124px));
  }
  .backdrop > .dialog:has(> .auth__form) {
    align-self: start; margin-top: clamp(0px, 14vh - 16px, 124px);
    max-height: calc(100vh - 32px - clamp(0px, 14vh - 16px, 124px)); max-height: calc(100dvh - 32px - clamp(0px, 14vh - 16px, 124px));
  }
}

/* Landscape phones: artwork beside the title, so Play and the first sets stay on the first screen (UX21-14) */
@media (max-width: 899.98px) and (orientation: landscape) and (max-height: 540px) {
  .pl-head { grid-template-columns: 120px minmax(0, 1fr); justify-items: stretch; align-items: center; text-align: left; }
  .pl-head .mosaic { width: 120px; }
  .pl-head .mosaic.skeleton { height: 120px; }
  .pl-head .head__stats, .pl-head__actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .pl-tile .mosaic, .pl-tile__more { transition: none; }
  .pl-tile__link:hover .mosaic { transform: none; }
}
