/*
Theme Name: Cassette
Author: You
Description: A dead minimal, chill, interactive music player. Publish songs with optional playlists.
Version: 1.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cassette
*/

:root {
    --bg: #faf7f2;
    --fg: #1a1a1a;
    --muted: #8a857c;
    --border: #ebe5da;
    --accent: #c44536;
    --player-bg: rgba(250, 247, 242, 0.92);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14110f;
        --fg: #eae5dc;
        --muted: #8a857c;
        --border: #29251f;
        --accent: #d97757;
        --player-bg: rgba(20, 17, 15, 0.9);
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--fg);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: 96px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

button { font: inherit; }

img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--accent); color: var(--bg); }

/* Header */
.site-header {
    max-width: 720px;
    margin: 0 auto;
    padding: 56px 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
}
.site-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
}
.site-nav ul {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    gap: 18px;
}
.site-nav a {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Main */
.site-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 24px 64px;
}
.site-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 24px;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

/* Song list */
.song-list {
    list-style: none;
    margin: 0; padding: 0;
    counter-reset: song;
}
.song {
    counter-increment: song;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.song:last-child { border-bottom: none; }
.song-num {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    width: 1.8em;
    flex-shrink: 0;
}
.song-play {
    background: none;
    border: 1px solid var(--border);
    width: 32px; height: 32px;
    border-radius: 50%;
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
}
.song-play svg { width: 11px; height: 11px; transform: translateX(1px); }
.song-play:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.song-meta {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}
.song-title-link {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.song-artist {
    color: var(--muted);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.song.is-playing .song-num,
.song.is-playing .song-title-link { color: var(--accent); }
.song.is-playing .song-play { border-color: var(--accent); color: var(--accent); }

/* Single song */
.song-single { text-align: center; padding: 16px 0; }
.song-cover {
    max-width: 320px;
    margin: 0 auto 28px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
    background: var(--border);
}
.song-cover img { width: 100%; height: 100%; object-fit: cover; }
.song-single .song-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.song-single .artist-line {
    color: var(--muted);
    margin: 0 0 24px;
}
.song-play.big {
    width: auto; height: auto;
    padding: 10px 22px 10px 24px;
    border-radius: 999px;
    font-size: 0.85rem;
    gap: 8px;
    margin: 0 auto 36px;
    border-color: var(--fg);
}
.song-play.big svg { width: 10px; height: 10px; }
.song-body {
    text-align: left;
    max-width: 560px;
    margin: 0 auto;
    color: var(--fg);
}
.song-body p { margin: 0 0 1em; }
.song-playlists {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.song-playlists a { color: var(--accent); margin: 0 4px; }

/* Playlist header */
.playlist-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.playlist-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.playlist-desc { color: var(--muted); font-size: 0.9rem; }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 48px 0;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Player bar */
.player {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto minmax(220px, 320px);
    gap: 14px;
    align-items: center;
    padding: 10px 20px;
    background: var(--player-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
}
.player[hidden] { display: none; }
.player-cover {
    width: 44px; height: 44px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.player-cover img { width: 100%; height: 100%; object-fit: cover; }
.player-info { min-width: 0; }
.player-title {
    font-weight: 500;
    font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-artist {
    color: var(--muted);
    font-size: 0.78rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-controls {
    display: flex;
    gap: 2px;
    align-items: center;
}
.player-controls button {
    background: none;
    border: none;
    color: var(--fg);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
.player-controls button:hover { color: var(--accent); }
.player-controls button svg { display: block; }
#cassette-toggle { padding: 6px; }
#cassette-toggle .icon-pause { display: none; }
.player.is-playing #cassette-toggle .icon-play { display: none; }
.player.is-playing #cassette-toggle .icon-pause { display: block; }

.player-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.player-time {
    color: var(--muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    width: 36px;
    flex-shrink: 0;
}
.player-time:last-child { text-align: right; }
#cassette-seek {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    height: 3px;
    border-radius: 2px;
    cursor: pointer;
    margin: 0;
    min-width: 0;
}
#cassette-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
#cassette-seek::-moz-range-thumb {
    width: 12px; height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

@media (max-width: 640px) {
    .site-header { padding-top: 36px; }
    .player {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-areas:
            "cover info controls"
            "progress progress progress";
        gap: 10px 14px;
        padding: 10px 16px;
    }
    .player-cover { grid-area: cover; }
    .player-info { grid-area: info; }
    .player-controls { grid-area: controls; }
    .player-progress { grid-area: progress; }
    body { padding-bottom: 116px; }
}
