/* Queye Music — built on the Queye Daily shell (Contacts / Calendar / Mail).
   White sidebar with one big action, fixed top bar (pill search + avatar), flat boxless
   rows, large fluid type, heavy group headings with a rule, and an accent bloom behind
   detail pages. Per-service accent is Music coral. */

:root {
    --sidebar-w: clamp(260px, 19vw, 340px);
    --topbar-h: 67px;
    --pad-x: clamp(22px, 2.4vw, 38px);
    --line: #1b1b1b;
    --row-art: clamp(58px, 3.9vw, 75px);
    --row-name: clamp(20px, 1.5vw, 29px);
    --row-sub: clamp(14px, 0.95vw, 18px);
    --group-title: clamp(28px, 1.9vw, 36px);
    --detail-art: clamp(190px, 14.5vw, 278px);
    --detail-name: clamp(38px, 2.55vw, 49px);
}

@media (prefers-color-scheme: dark) { :root { --line: #e6e6e6; } }

body.sidebar-collapsed { --sidebar-w: 96px; }

body { padding-bottom: 0; overflow-x: hidden; }
body.has-player { padding-bottom: 96px; }
body:not(.has-player) #player { display: none; }

.eyebrow { display: none; }

/* =============== Desktop shell =============== */
@media (min-width: 901px) {
    .sidebar {
        width: var(--sidebar-w);
        padding: 126px var(--pad-x) 70px;
        gap: 0;
        border-right: 0;
        background: var(--card-background);
        transition: width 140ms ease, padding 140ms ease;
    }

    .sidebar-logo { position: absolute; top: 19px; left: var(--pad-x); padding: 0; margin: 0; }
    .sidebar-logo-link { display: inline-flex; }
    .sidebar-logo-img { width: 62px; height: 52px; object-fit: contain; }
    .sidebar-logo-text { display: none; }

    .sidebar-nav { width: min(258px, 100%); gap: 4px; margin-bottom: 36px; }

    .sidebar-nav a {
        min-height: 52px;
        padding: 0 13px;
        border-radius: 10px;
        gap: 16px;
        font-size: 20px;
        font-weight: 700;
        color: var(--text-color);
        background: transparent;
    }

    .sidebar-nav a i { width: 26px; font-size: 24px; color: inherit; text-align: center; }
    .sidebar-nav a:hover,
    .sidebar-nav a:focus-visible,
    .sidebar-nav a.active { background: var(--nav-active); color: var(--text-color); }

    .sidebar-nav a.sidebar-cta {
        min-height: 52px;
        margin: 0 0 28px;
        padding: 0 14px;
        background: var(--accent-music);
        color: #000;
        font-weight: 800;
    }

    .sidebar-nav a.sidebar-cta:hover,
    .sidebar-nav a.sidebar-cta:focus-visible { background: var(--accent-music); filter: brightness(.96); color: #000; }

    .sidebar-lists { width: min(232px, 100%); padding-left: 15px; }

    .sidebar-lists-head { height: 28px; display: flex; align-items: center; justify-content: space-between; }
    .sidebar-lists-head h2 { margin: 0; font-family: var(--heading-font); font-size: 22px; line-height: 1; font-weight: 800; }
    .sidebar-lists-head a { width: 28px; height: 28px; display: grid; place-items: center; color: var(--text-color); font-size: 18px; text-decoration: none; }

    .sidebar-lists-items { margin-top: 18px; display: grid; gap: 10px; }

    .sidebar-list-pill {
        display: block;
        color: var(--text-color);
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
        text-decoration: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar-list-pill:hover,
    .sidebar-list-pill:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

    body.sidebar-collapsed .sidebar { padding-left: 17px; padding-right: 17px; }
    body.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 0; }
    body.sidebar-collapsed .sidebar-nav a .nav-text,
    body.sidebar-collapsed .sidebar-lists { display: none; }

    .app-main { margin-left: var(--sidebar-w); transition: margin-left 140ms ease; }

    .topbar {
        position: fixed;
        top: 0;
        left: var(--sidebar-w);
        right: 0;
        z-index: 110;
        height: var(--topbar-h);
        display: flex;
        align-items: center;
        padding: 0 clamp(24px, 2.5vw, 44px) 0 34px;
        background: var(--card-background);
        border: 0;
        gap: 16px;
        transition: left 140ms ease;
    }

    #content { padding: calc(var(--topbar-h) + clamp(20px, 1.4vw, 26px)) clamp(18px, 1.5vw, 28px) 64px clamp(16px, 1.1vw, 20px); }

    /* collapse toggle: pinned bottom of the sidebar */
    .topbar .sidebar-toggle {
        position: fixed;
        left: calc(var(--sidebar-w) / 2 - 17px);
        top: auto;
        bottom: 24px;
        width: 34px;
        height: 34px;
        z-index: 120;
        box-shadow: none;
        background: var(--card-background);
        transition: left 140ms ease;
    }

    body.sidebar-collapsed .topbar .sidebar-toggle .icon { transform: rotate(180deg); }

    #player { left: var(--sidebar-w); right: 0; margin: 0; transition: left 140ms ease; }
}

/* =============== Top bar =============== */
.topbar { display: flex; align-items: center; }

.topbar-search {
    position: relative;
    flex: 1;
    max-width: 700px;
    min-width: 0;
    margin: 0;
    height: 39px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--card-background);
}

.topbar-search:focus-within { border-color: var(--accent-music); }
.topbar-search-icon { flex: none; color: var(--footer-text); }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--text-color); padding: 0; }
.topbar-search #sidebar-search-btn { display: none; }

.topbar-account { margin-left: auto; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--dropdown-hover); }
.topbar-account img { width: 36px; height: 36px; object-fit: cover; display: block; }

/* =============== Page & groups =============== */
.page { max-width: none; padding: 0; gap: clamp(22px, 1.55vw, 30px); }

.page-hero { align-items: flex-end; }
.page-hero h1 { margin: 0; font-size: var(--group-title); line-height: 1; letter-spacing: -0.01em; font-weight: 800; }
.page-hero .subhead { margin: 8px 0 0; font-size: 14px; color: var(--footer-text); }
.page-tabs { display: none; }
.card-panel { padding: 0; }

.group { display: grid; gap: clamp(12px, .85vw, 16px); margin-bottom: clamp(22px, 1.55vw, 30px); }
.group[hidden] { display: none; }

.group-heading {
    display: flex;
    align-items: center;
    gap: clamp(18px, 1.25vw, 24px);
    padding-left: 3px;
    margin-bottom: clamp(12px, .85vw, 16px);
}

.group-heading h2 { margin: 0; font-family: var(--heading-font); font-size: var(--group-title); line-height: 1; font-weight: 800; }
.group-heading::after { content: ""; order: 1; flex: 1; height: 2px; background: var(--line); }
.group-heading a { order: 2; font-size: 15px; font-weight: 700; color: var(--text-color); text-decoration: underline; text-underline-offset: 3px; }
.group-heading a:hover { color: var(--accent-music-text); }

.group-items { display: grid; gap: clamp(14px, 1.05vw, 20px); }

/* =============== Shelves & cards =============== */
.shelf-row { display: flex; gap: 20px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.shelf-row .album-card { flex: 0 0 176px; scroll-snap-align: start; }
.album-grid { margin-top: 6px; gap: 24px 20px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }

.album-card { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; outline: none; }
.album-card:hover { transform: none; box-shadow: none; border: 0; }
.album-card .album-cover { border-radius: 8px; box-shadow: none; transition: opacity 140ms ease; }
.album-card:hover .album-cover { opacity: .88; transform: none; }
.album-card:focus-visible .album-cover { outline: 2px solid var(--accent-music); outline-offset: 3px; }
.album-meta { padding: 10px 2px 0; }
.album-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-artist { margin-top: 3px; font-size: 14px; font-weight: 500; color: var(--footer-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============== Rows (songs, tracks) — flat, boxless =============== */
.album-tracks,
.library-track-list { border: 0; border-radius: 0; background: none; overflow: visible; }

.library-track-row {
    position: relative;
    display: grid;
    grid-template-columns: var(--row-art) minmax(0, 1fr) minmax(0, .8fr) 56px 32px;
    align-items: center;
    gap: clamp(14px, 1.1vw, 20px);
    min-height: var(--row-art);
    padding: 0;
    border: 0;
    background: none;
}

.library-track-row[hidden] { display: none; }
.library-track-row:hover { background: none; opacity: .88; }
.library-track-row .track-thumb { width: var(--row-art); height: var(--row-art); border-radius: 8px; box-shadow: none; }
.library-track-meta { gap: clamp(6px, .47vw, 9px); }
.library-track-meta .track-title { font-family: var(--heading-font); font-size: var(--row-name); line-height: 1; font-weight: 500; }
.library-track-artist { font-size: var(--row-sub); line-height: 1; font-weight: 500; color: var(--footer-text); }
.library-track-album { font-size: var(--row-sub); font-weight: 500; color: var(--footer-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-track-row .track-duration { font-size: var(--row-sub); color: var(--footer-text); text-align: right; font-variant-numeric: tabular-nums; }

.album-tracks .track-row {
    position: relative;
    display: grid;
    grid-template-columns: var(--row-art) minmax(0, 1fr) 64px 32px;
    align-items: center;
    gap: clamp(14px, 1.1vw, 20px);
    min-height: clamp(52px, 3.4vw, 64px);
    padding: 0;
    border: 0;
    background: none;
}

.album-tracks .track-row:hover { background: none; opacity: .88; }
.track-row .track-title { font-family: var(--heading-font); font-size: var(--row-name); line-height: 1.05; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-row .track-title small { display: block; margin-top: 6px; font-size: var(--row-sub); font-weight: 500; color: var(--footer-text); }
.track-row .track-duration { font-size: var(--row-sub); color: var(--footer-text); text-align: right; font-variant-numeric: tabular-nums; }
.track-row .track-thumb { width: var(--row-art); height: var(--row-art); border-radius: 8px; box-shadow: none; }

.track-number { position: relative; height: 24px; display: grid; place-items: center; text-align: center; color: var(--footer-text); font-size: var(--row-sub); font-weight: 700; font-variant-numeric: tabular-nums; }
.track-number .icon { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; opacity: 0; color: var(--text-color); }
.track-row:hover .track-number span { opacity: 0; }
.track-row:hover .track-number .icon { opacity: 1; }

.list-toolbar { margin-bottom: clamp(18px, 1.3vw, 24px); }
.list-toolbar input { width: 100%; max-width: 700px; height: 39px; padding: 0 15px; border: 1px solid var(--border-color); border-radius: 24px; background: var(--card-background); color: var(--text-color); font: inherit; font-size: 16px; outline: 0; }
.list-toolbar input:focus { border-color: var(--accent-music); }
.list-empty { padding: 26px 0; font-size: 17px; }

@media (hover: hover) {
    .track-menu-btn { opacity: .35; }
    .track-row:hover .track-menu-btn,
    .library-track-row:hover .track-menu-btn,
    .track-menu-btn:focus-visible { opacity: 1; }
}

/* now playing, marked in the lists */
.track-row.is-current .track-title,
.library-track-row.is-current .track-title { color: var(--accent-music-text); font-weight: 800; }
.track-row.is-current::before,
.library-track-row.is-current::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent-music); }
.track-row.is-current .track-number span { opacity: 0; }
.track-row.is-current .track-number::before {
    content: "";
    width: 15px; height: 15px;
    background:
        linear-gradient(var(--accent-music), var(--accent-music)) 0 100% / 3px 40% no-repeat,
        linear-gradient(var(--accent-music), var(--accent-music)) 50% 100% / 3px 90% no-repeat,
        linear-gradient(var(--accent-music), var(--accent-music)) 100% 100% / 3px 60% no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
    body.is-playing .track-row.is-current .track-number::before { animation: music-eq .9s steps(5, end) infinite alternate; }
}

@keyframes music-eq {
    from { background-size: 3px 30%, 3px 100%, 3px 55%; }
    to   { background-size: 3px 100%, 3px 35%, 3px 90%; }
}

/* =============== Detail pages: art + name + accent bloom =============== */
.album-page { position: relative; isolation: isolate; }

.album-page::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: calc(var(--detail-art) / 2 - 45vmax);
    top: calc(var(--detail-art) / 2 - 45vmax);
    width: 90vmax;
    height: 90vmax;
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%,
            color-mix(in srgb, var(--accent-color) 62%, white) 0%,
            color-mix(in srgb, var(--accent-color) 40%, white) 24%,
            color-mix(in srgb, var(--accent-color) 14%, transparent) 44%,
            transparent 62%);
    transition: opacity 280ms ease;
}

.detail-hero {
    display: grid;
    grid-template-columns: var(--detail-art) minmax(0, 1fr);
    gap: clamp(22px, 1.45vw, 28px);
    align-items: start;
    padding: 0 0 clamp(14px, 1.2vw, 22px);
    border: 0;
    border-radius: 0;
    background: none;
}

.detail-hero .back-link-top { grid-column: 1 / -1; justify-self: start; margin-bottom: 0; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-color); background: var(--card-background); color: var(--text-color); text-decoration: none; font-size: 16px; }
.icon-btn:hover { border-color: var(--accent-music); }

.detail-cover { width: var(--detail-art); height: var(--detail-art); border-radius: 8px; background-size: cover; background-position: center; background-color: var(--dropdown-hover); box-shadow: none; }
.detail-text { min-width: 0; padding-top: clamp(8px, .65vw, 12px); }
.detail-text h1 { margin: 0; font-family: var(--heading-font); font-size: var(--detail-name); line-height: 1.02; letter-spacing: -0.01em; font-weight: 800; overflow-wrap: anywhere; }
.detail-meta { margin: clamp(10px, .8vw, 14px) 0 0; font-size: clamp(17px, 1.18vw, 23px); line-height: 1.3; color: var(--text-color); }
.detail-meta strong { font-weight: 800; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: clamp(22px, 1.8vw, 34px); }

/* Daily "big action button" recipe in Music coral */
.play-fab {
    min-height: 52px;
    padding: 0 22px 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--accent-music);
    color: #000;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: filter 140ms ease;
}

.play-fab .icon { width: 24px; height: 24px; }
.play-fab:hover, .play-fab:focus-visible { filter: brightness(.96); }

.action-btn { min-height: 52px; padding: 0 20px; border-radius: 10px; font-size: 17px; font-weight: 700; background: var(--card-background); }
.action-btn.primary { background: var(--accent-music); border-color: var(--accent-music); color: #000; }
.action-btn.primary:hover:not(:disabled) { background: var(--accent-music); border-color: var(--accent-music); color: #000; filter: brightness(.96); }
.hero-actions { gap: 10px; }
.hero-actions .pill { display: none; }

/* =============== Player: flat bar =============== */
#player {
    bottom: 0;
    height: 84px;
    padding: 0 clamp(18px, 1.6vw, 28px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 460px) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    border: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    background: var(--card-background);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

#player:hover, #player:focus-within { box-shadow: none; }
#miniCover, .mini-cover { width: 56px; height: 56px; flex-basis: 56px; border-radius: 8px; box-shadow: none; }
.mini-title { font-family: var(--heading-font); font-size: 17px; font-weight: 800; }
.mini-artist { font-size: 14px; font-weight: 500; }
.mini-center { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.mini-controls { gap: 10px; }
.mini-controls button { border-color: transparent; background: none; }
.mini-controls #btn-play-pause { width: 44px; height: 44px; background: var(--text-color); border-color: var(--text-color); color: var(--background-color); }
.mini-scrub { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--footer-text); }
#mini-bar { position: relative; flex: 1; height: 14px; cursor: pointer; touch-action: none; }
#mini-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 6px; border-radius: 999px; background: var(--dropdown-hover); box-shadow: inset 0 0 0 1px var(--border-color); }
#mini-bar-fill { position: absolute; left: 0; top: 4px; height: 6px; width: 0; border-radius: 999px; background: var(--accent-music); }
#mini-bar:focus-visible { outline: 2px solid var(--accent-music); outline-offset: 2px; }
.mini-extra { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
#mini-volume { width: 100px; accent-color: var(--accent-music); }
#mini-expand { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border-color); background: none; color: var(--text-color); display: grid; place-items: center; cursor: pointer; }
#mini-expand:hover { background: var(--dropdown-hover); }

/* containment */
.app-main, #content, .page, .page > *, .shelf, .group { min-width: 0; }

/* =============== Tablet / phone =============== */
@media (max-width: 1100px) {
    #player { grid-template-columns: minmax(0, 1fr) minmax(240px, 400px) auto; }
    #mini-volume { display: none; }
    .library-track-row { grid-template-columns: var(--row-art) minmax(0, 1fr) 56px 32px; }
    .library-track-album { display: none; }
}

@media (max-width: 900px) {
    .topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); padding: 0 16px; background: var(--card-background); z-index: 60; }
    .topbar .sidebar-toggle { display: none; }
    .topbar-search { max-width: none; }
    .sidebar-logo, .sidebar-lists { display: none; }
    #content { padding: calc(var(--topbar-h) + 14px) 16px 32px; }
    .page { gap: 18px; }
    .page-hero { align-items: flex-start; text-align: left; }
    .page-hero > div { text-align: left; }
    .hero-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 10px; }
    .hero-actions .action-btn { flex: 1 1 0; }

    .detail-hero { grid-template-columns: 1fr; justify-items: start; }
    .detail-cover { width: min(260px, 72vw); height: min(260px, 72vw); }
    .album-page::before { left: -40vmax; top: -30vmax; }
    .album-tracks .track-row { grid-template-columns: 40px minmax(0, 1fr) 48px 28px; gap: 12px; }
    .track-row.is-current::before, .library-track-row.is-current::before { left: -8px; }

    .sidebar-nav a { min-height: 60px; padding: 8px 2px; color: var(--text-color); font-size: 10px; }
    .sidebar-nav a:hover, .sidebar-nav a.active { background: var(--nav-active); color: var(--text-color); }
    .sidebar-nav a.sidebar-cta, .sidebar-nav a.sidebar-cta:hover { min-height: 60px; margin: 0; background: transparent; font-size: 10px; font-weight: 650; gap: 4px; }
    .sidebar-nav a.sidebar-cta:hover { background: var(--nav-active); }

    body.has-player { padding-bottom: calc(76px + 76px + env(safe-area-inset-bottom)); }
    #player { left: 0; right: 0; margin: 0; bottom: calc(76px + env(safe-area-inset-bottom)); height: 68px; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 0 12px; }
    .mini-scrub, .mini-extra { display: none; }
    #miniCover, .mini-cover { width: 46px; height: 46px; flex-basis: 46px; }
    .mini-artist { display: block; }
}
