/* New Albums — no build step, no framework. */

:root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --surface-2: #f2f2f0;
    --border: #e2e2dd;
    --text: #1a1a18;
    --muted: #6b6b66;
    --accent: #1a7f4b;
    --accent-text: #ffffff;
    --new: #b4531a;
    --danger: #a8301f;
    --radius: 10px;
    --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 12px rgb(0 0 0 / 4%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #131315;
        --surface: #1c1c1f;
        --surface-2: #26262a;
        --border: #33333a;
        --text: #ececf0;
        --muted: #9a9aa4;
        --accent: #29c274;
        --accent-text: #07130c;
        --new: #f0954a;
        --danger: #ef6b58;
        --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 25%);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2 { font-weight: 620; letter-spacing: -0.015em; }

.muted { color: var(--muted); }
.spacer { flex: 1; }
.error { color: var(--danger); }

/* ---- top bar --------------------------------------------------------- */

.topbar {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.status { font-size: 12.5px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ---- controls -------------------------------------------------------- */

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.control { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.control.grow { flex: 1; min-width: 180px; }
.control label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

select, input[type="text"], input[type="search"], input[type="password"] {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}
select:focus-visible, input:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.subcontrols {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.chips, .viewswitch { display: flex; gap: 6px; }

.chip {
    font: inherit;
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}
.chip.is-on {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 560;
}

.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }

.button {
    font: inherit;
    font-weight: 560;
    background: var(--accent);
    color: var(--accent-text);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.button.small { padding: 6px 12px; font-size: 13px; }
.button:disabled { opacity: 0.5; cursor: default; }

.linky {
    font: inherit;
    font-size: 13px;
    background: none;
    border: 0;
    padding: 0;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.linky:hover { color: var(--text); }

.summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    font-size: 13.5px;
    flex-wrap: wrap;
}

.notice {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13.5px;
}
.notice a { color: inherit; }

/* ---- results: list --------------------------------------------------- */

.results.view-list { display: flex; flex-direction: column; gap: 2px; }

.view-list .release {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 9px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}
.view-list .release:hover { background: var(--surface); border-color: var(--border); }
.view-list .cover { width: 52px; height: 52px; border-radius: 6px; }
.view-list .meta { min-width: 0; }
.view-list .date { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---- results: grid --------------------------------------------------- */

.results.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
}
.view-grid .release { text-decoration: none; color: inherit; display: block; }
.view-grid .cover { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; margin-bottom: 8px; }
.view-grid .release:hover .cover { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-grid .date { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- shared release bits --------------------------------------------- */

.cover {
    background: var(--surface-2);
    object-fit: cover;
    display: block;
    flex: none;
}
.title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--muted);
    vertical-align: 1px;
    margin-left: 6px;
}
.badge.is-new { color: var(--new); border-color: currentColor; }

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

/* ---- dialog ---------------------------------------------------------- */

dialog {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    padding: 0;
    max-width: 440px;
    width: calc(100% - 32px);
    box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h2 { margin: 0; font-size: 17px; }
.dialog-body > label {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); font-weight: 600; margin-bottom: -6px;
}
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.radios legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 0 0 8px; }
.radios label { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin-top: 4px; }

/* ---- login ----------------------------------------------------------- */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 28px;
    width: 100%;
    max-width: 360px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.login-card label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.login-card button { margin-top: 8px; }
.login-card .button, .login-card button[type="submit"] {
    font: inherit; font-weight: 560;
    background: var(--accent); color: var(--accent-text);
    border: 1px solid var(--accent); border-radius: 8px;
    padding: 9px 14px; cursor: pointer;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 520px;
}
.panel h2 { margin-top: 0; }

@media (max-width: 620px) {
    .control, .control.grow { min-width: 0; flex: 1 1 45%; }
    .view-list .release { grid-template-columns: 44px 1fr; }
    .view-list .cover { width: 44px; height: 44px; }
    .view-list .date { grid-column: 2; margin-top: 2px; }

    /* Keep "Sign out" on the title row and drop the scan status beneath it,
       rather than letting the two collide and wrap mid-word. */
    .topbar-inner { flex-wrap: wrap; row-gap: 2px; }
    .topbar h1 { flex: 1; }
    .topbar-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 0; }
    .topbar-right .linky { order: 1; white-space: nowrap; }
    .status { order: 2; flex-basis: 100%; text-align: right; }
}
