/* ==========================================================================
   KUTAY OS — Music app ("Studio Radio")
   A Spotify playlist library: browse public/personal playlists, add one by
   URL, listen in an embedded player. Kept as its own dark "listening room"
   regardless of the OS light/dark theme — like the Terminal, this page's
   mood is deliberately constant (the original never gave it a light-theme
   override either), not a token-system oversight.
   ========================================================================== */

.music-page {
  height: 100%; display: grid; grid-template-columns: 215px minmax(0, 1fr);
  padding: 0 !important; overflow: hidden !important; background: #121516;
}

.music-sidebar {
  background: #0c1010; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .04); padding: 28px 20px; overflow: auto; min-width: 0;
}
.music-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 35px; }
.music-brand .spotify-mark { background: rgba(154, 202, 154, .06); color: #b7d8ad; width: 35px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.music-brand b { font-size: 12px; letter-spacing: .08em; white-space: nowrap; }
.music-brand small { display: block; font-size: 10px; color: #7e9287; margin-top: 6px; line-height: 1.5; }
.music-navigation { display: grid; gap: 5px; margin-bottom: 25px; }
.music-navigation button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 43px; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 10px; font-size: 12px; color: #93a297; }
.music-navigation button.on { background: rgba(192, 212, 184, .05); color: #e0e9db; }
.music-navigation button span { font-size: 10px; color: #6d8175; }
.music-sidebar > [data-add-playlist] { background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .07); font-size: 12px; min-height: 43px; }
.music-sidebar-note { font-size: 10px; color: #667a6e; line-height: 1.7; margin: auto 5px 0; padding-top: 40px; }

.music-main {
  min-width: 0; overflow-y: auto; padding: 36px 40px 32px;
  background: radial-gradient(ellipse at 70% -20%, rgba(174, 149, 99, .17), transparent 55%);
}
.music-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.music-section-head .eyebrow { font-size: 9px; letter-spacing: .18em; color: #a89981; }
.music-section-head h1 { font-size: clamp(34px, 4vw, 60px); letter-spacing: -.05em; line-height: 1; margin: 17px 0 0; font-weight: 500; }
.music-section-head h1 span { color: #adb4a4; }
.music-section-head .btn { font-size: 11px; color: #849187; background: rgba(255, 255, 255, .01); border: 1px solid rgba(255, 255, 255, .04); white-space: nowrap; }

.playlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; margin-bottom: 30px; max-width: 1120px; }
.playlist-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0; border: 1px solid transparent; border-radius: var(--r-lg); padding: 8px; background: none; color: #e2e7e0; transition: background var(--dur-fast), border-color var(--dur-fast); }
.playlist-card.on .playlist-art { box-shadow: 0 0 0 1px rgba(255, 255, 255, .27), 0 8px 25px rgba(0, 0, 0, .25); }
.playlist-art { display: block; position: relative; aspect-ratio: 1.25; width: 100%; overflow: hidden; border-radius: var(--r-md); background: #453325; }
.playlist-art.orange { background: linear-gradient(135deg, #97734e, #3d3029); }
.playlist-art.sage { background: linear-gradient(145deg, #778b72, #293b37); }
.playlist-art.blue { background: linear-gradient(135deg, #647687, #28323c); }
.playlist-art.plum { background: linear-gradient(135deg, #897085, #403541); }
.record-grooves { position: absolute; width: 105%; aspect-ratio: 1; right: -20%; top: -19%; border-radius: 50%; background: repeating-radial-gradient(circle at center, #141516 0px, #141516 2px, #252727 3px, #161718 4px); box-shadow: -8px 8px 20px rgba(0, 0, 0, .2); }
.record-grooves::before { content: ""; position: absolute; inset: 34%; border-radius: 50%; background: #c6b090; box-shadow: 0 0 0 3px #0e1111; }
.sage .record-grooves::before { background: #aebca1; }
.blue .record-grooves::before { background: #9eafbc; }
.plum .record-grooves::before { background: #bda6b7; }
.record-grooves::after { content: ""; position: absolute; inset: 48.5%; border-radius: 50%; background: #242621; }
.record-label { position: absolute; bottom: 14px; left: 14px; font-size: 10px; font-family: var(--font-mono); letter-spacing: .1em; color: #e6d9c5; }
.record-play { position: absolute; right: 10px; bottom: 10px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; font-size: 12px; background: rgba(255, 255, 255, .04); backdrop-filter: blur(10px); }
.playlist-card b { font-weight: 500; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; margin: 12px 0 4px; }
.playlist-card small { font-size: 11px; color: #849689; }

.listening-deck { border-top: 1px solid rgba(255, 255, 255, .03); padding-top: 25px; max-width: 1120px; }
.deck-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.deck-heading .eyebrow { font-size: 9px; letter-spacing: .13em; color: #8c9c8d; }
.deck-heading h2 { font-size: 25px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; margin: 12px 0 7px; overflow-wrap: anywhere; }
.deck-heading p { font-size: 11px; color: #859586; margin: 0; }
.deck-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.deck-actions .btn { font-size: 11px; background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .04); }

.spotify-frame-host { position: relative; min-height: 352px; border-radius: var(--r-lg); background: #202923; }
.spotify-frame-host iframe { display: block; border: 0; border-radius: var(--r-lg); min-height: 352px; width: 100%; opacity: 0; transition: opacity var(--dur-base); }
.spotify-frame-host.is-ready iframe { opacity: 1; }
.spotify-fallback { position: absolute; inset: 0; z-index: 2; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; color: #aeb4c0; font-size: 14px; background: #12141a; border-radius: var(--r-lg); }
.spotify-fallback p { max-width: 36ch; margin: 0; line-height: 1.5; }
.spotify-frame-host.is-ready .spotify-fallback { display: none; }
.spotify-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .18); border-top-color: #f0c3a0; animation: musicSpin .9s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spotify-spinner { animation: none; } }
@keyframes musicSpin { to { transform: rotate(360deg); } }
.player-status { font-size: 11px; color: #788b7d; line-height: 1.6; margin: 10px 0 0; }
.music-main .player-fallback { display: block; font-size: 11px; color: #9bad9d; margin-top: 6px; text-decoration: underline; text-underline-offset: 3px; }

.playlist-form label { display: block; font-size: 12px; color: var(--text-muted); margin: 15px 0 8px; }
.playlist-form input, .playlist-form select { width: 100%; font-size: 16px; min-height: 42px; }
.playlist-form p { font-size: 12px; }
.playlist-form .muted { color: var(--text-dim); }
.playlist-form .form-error { color: #ff9b8a; min-height: 1.4em; }

@media (max-width: 1099px), (max-height: 639px) {
  .music-page { grid-template-columns: 180px minmax(0, 1fr); }
  .music-sidebar { padding: 24px 14px; }
  .music-main { padding: 25px 22px; }
  .playlist-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; }
  .deck-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
}
@media (max-width: 800px) {
  .music-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .music-sidebar { padding: 12px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .06); overflow: visible; }
  .music-brand { display: none; }
  .music-navigation { display: flex; overflow: auto; gap: 5px; margin: 0; }
  .music-navigation button { white-space: nowrap; font-size: 11px; padding: 8px; min-height: 38px; }
  .music-navigation button span { display: none; }
  .music-sidebar > [data-add-playlist] { font-size: 11px; min-height: 38px; padding: 8px; }
  .music-sidebar-note { display: none; }
  .music-section-head { margin-bottom: 20px; }
  .music-section-head h1 { font-size: 42px; }
  .music-main { padding: 24px 18px; }
  .playlist-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .playlist-card { padding: 5px; }
  .playlist-card b { font-size: 12px; }
  .playlist-card small { font-size: 10px; }
  .playlist-art { aspect-ratio: 1; }
  .record-grooves { width: 125%; right: -30%; top: -5%; }
  .deck-heading h2 { font-size: 23px; }
  .record-play { width: 26px; height: 26px; font-size: 10px; right: 6px; bottom: 6px; }
  .record-label { font-size: 9px; bottom: 10px; left: 10px; }
}
@media (max-width: 600px) {
  .music-sidebar { padding: 10px 12px; gap: 7px; grid-template-columns: 1fr; }
  .music-sidebar > [data-add-playlist] { justify-self: start; min-height: 36px; padding: 7px 10px; }
  .music-navigation { justify-content: space-between; }
  .music-navigation button { font-size: 12px; min-height: 38px; }
  .music-main { padding: 24px 14px; }
  .music-section-head .eyebrow { font-size: 8px; }
  .music-section-head h1 { font-size: 36px; }
  .music-section-head .btn { font-size: 10px; padding: 7px 8px; max-width: 105px; white-space: normal; }
  .playlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 7px; }
  .playlist-art { aspect-ratio: 1.25; }
  .deck-actions .btn { min-height: 40px; font-size: 11px; }
  .spotify-frame-host, .spotify-frame-host iframe { min-height: 280px; }
  .player-status, .music-main .player-fallback { font-size: 11px; }
}

/* ---- interaction + motion ------------------------------------------- */
.music-navigation button { transition: background var(--dur-base), color var(--dur-base); }
.music-section-head .btn { color: #a3b0a5; border-color: rgba(255, 255, 255, .08); }

/* record slides out of its sleeve on hover; the selected one keeps turning */
.record-grooves { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.playlist-card.on .record-grooves { animation: music-spin 7s linear infinite; }
@keyframes music-spin { to { transform: rotate(360deg); } }
.record-play { transition: transform var(--dur-base) var(--ease-out), background var(--dur-base); }
.playlist-card.on .record-play { background: #e6d9c5; color: #1b1a18; border-color: #e6d9c5; }
.playlist-card:active { transform: scale(.98); }
.playlist-card { transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast); }
.playlist-card.is-in { animation: pm-rise .32s var(--ease-out) both; }
.music-empty { grid-column: 1 / -1; color: #849689; font-size: 13px; padding: 24px 0; }

.deck-heading > div { transition: opacity .14s ease, transform .2s var(--ease-out); }
.spotify-frame-host iframe { transition: opacity .35s ease; }
.spotify-frame-host.is-slow .spotify-spinner { display: none; }
.spotify-frame-host.is-slow .spotify-fallback p { color: #d8dccf; }


/* hover affordances only where hover exists — no sticky rings after a tap */
@media (hover: hover) {
  .playlist-card:hover { background: rgba(255, 255, 255, .015); border-color: rgba(255, 255, 255, .07); }
  .music-navigation button:hover:not(.on) { background: rgba(192, 212, 184, .035); color: #cfdcc9; }
  .music-sidebar > [data-add-playlist]:hover { border-color: rgba(183, 216, 173, .3); background: rgba(183, 216, 173, .05); }
  .music-section-head .btn:hover, .deck-actions .btn:hover { border-color: rgba(255, 255, 255, .2); color: #e0e9db; filter: none; }
  .playlist-card:hover .record-grooves { transform: translateX(-6%) rotate(24deg); }
  .playlist-card:hover .record-play { transform: scale(1.1); background: rgba(255, 255, 255, .14); }
}.playlist-card.on { background: rgba(255, 255, 255, .015); border-color: rgba(255, 255, 255, .07); }
