/* ===================================================
   Soundsucker – Dark Vinyl Theme
   =================================================== */

/* ─── Reset & Base ─────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0b0b0d;
    --surface: #131317;
    --surface-2: #1c1c22;
    --border: rgba(255, 255, 255, 0.07);
    --accent: #e8a020;
    --accent-dim: #b07a10;
    --accent-glow: rgba(232, 160, 32, 0.18);
    --text-primary: #f0ede6;
    --text-muted: #7a7870;
    --text-subtle: #504e49;
    --vinyl-dark: #1a1a1f;
    --vinyl-shine: rgba(255, 255, 255, 0.04);
    --radius: 14px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --font-head: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

/* ─── Hero ─────────────────────────────────────── */
.hero {
    position: relative;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, #1d1408 0%, var(--bg) 70%);
    padding: 80px 24px 60px;
    overflow: hidden;
    flex-shrink: 0;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-radial-gradient(circle at 50% 50%,
            transparent 0px,
            transparent 30px,
            rgba(255, 255, 255, 0.012) 30px,
            rgba(255, 255, 255, 0.012) 31px);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 10px;
}

.vinyl-icon {
    font-size: 2.4rem;
    color: var(--accent);
    display: inline-block;
    animation: spin 8s linear infinite;
    text-shadow: 0 0 20px var(--accent-glow);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.brand-name {
    font-family: var(--font-head);
    font-size: clamp(2.4rem, 7vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.brand-name::after {
    content: '';
    display: block;
    width: 50%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    margin: 4px auto 0;
    border-radius: 2px;
}

.tagline {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 36px;
}

/* Search box */
.search-form {
    width: 100%;
}

.search-box {
    display: flex;
    gap: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    box-shadow: var(--shadow), 0 0 0 0 var(--accent-glow);
    transition: box-shadow var(--transition);
}

.search-box:focus-within {
    box-shadow: var(--shadow), 0 0 0 3px var(--accent-glow);
    border-color: var(--accent-dim);
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 24px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

#search-input::placeholder {
    color: var(--text-subtle);
}

/* Remove default search cancel button in webkit */
#search-input::-webkit-search-cancel-button {
    display: none;
}

#search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #0b0b0d;
    border: none;
    padding: 16px 28px;
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    white-space: nowrap;
}

#search-btn:hover {
    background: #f5b030;
}

#search-btn:active {
    transform: scale(0.98);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Decorative grooves */
.hero-grooves {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100vw;
    max-width: 900px;
    pointer-events: none;
    opacity: 0.12;
}

.groove {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
}

/* ─── Controls bar ──────────────────────────────── */
.controls-header {
    display: none;
}

.desktop-hidden {
    display: none;
}

.controls {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.controls-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius);
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.chip:hover {
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b0b0d;
    font-weight: 700;
}

/* Sort */
.sort-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius);
}

.sort-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--accent-dim);
}

.result-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.result-count-desktop {
    margin-left: auto;
}

/* ─── Main content ──────────────────────────────── */
#main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ─── Placeholder / Empty / Error states ────────── */
.state-placeholder,
.state-empty,
.state-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 100px 24px;
    text-align: center;
    color: var(--text-subtle);
}

.placeholder-icon,
.empty-icon {
    font-size: 4rem;
    opacity: 0.2;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(1);
    }

    50% {
        opacity: 0.35;
        transform: scale(1.05);
    }
}

.state-error {
    color: #e86040;
}

.error-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}

/* ─── Loading spinner ───────────────────────────── */
.state-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 100px 24px;
}

.spinner {
    position: relative;
    width: 56px;
    height: 56px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--accent);
    animation: spin-ring 1.1s linear infinite;
}

.spinner-ring:nth-child(2) {
    inset: 8px;
    border-top-color: rgba(232, 160, 32, 0.5);
    animation: spin-ring 1.4s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
    inset: 16px;
    border-top-color: rgba(232, 160, 32, 0.25);
    animation: spin-ring 1.8s linear infinite;
}

@keyframes spin-ring {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ─── Results grid ──────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* ─── Product card ──────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    animation: card-in 0.3s ease both;
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent-dim);
    border-color: var(--accent-dim);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger children */
.card:nth-child(1) {
    animation-delay: 0.02s;
}

.card:nth-child(2) {
    animation-delay: 0.05s;
}

.card:nth-child(3) {
    animation-delay: 0.08s;
}

.card:nth-child(4) {
    animation-delay: 0.11s;
}

.card:nth-child(5) {
    animation-delay: 0.14s;
}

.card:nth-child(6) {
    animation-delay: 0.17s;
}

.card:nth-child(7) {
    animation-delay: 0.20s;
}

.card:nth-child(8) {
    animation-delay: 0.23s;
}

.card:nth-child(9) {
    animation-delay: 0.26s;
}

.card:nth-child(10) {
    animation-delay: 0.29s;
}

/* Cover image area */
.card-cover {
    position: relative;
    aspect-ratio: 1;
    background: var(--vinyl-dark);
    overflow: hidden;
}

.card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.card:hover .card-cover-img {
    transform: scale(1.05);
}

/* Placeholder grooves when no image */
.card-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vinyl-dark);
    position: relative;
}

.card-cover-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-radial-gradient(circle at 50% 50%,
            transparent 0, transparent 18px,
            rgba(255, 255, 255, 0.03) 18px, rgba(255, 255, 255, 0.03) 19px);
}

.card-cover-placeholder::after {
    content: '●';
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}

/* Media type badge */
.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(11, 11, 13, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.badge-vinyl {
    color: var(--accent);
    border-color: var(--accent-dim);
}

.badge-cd {
    color: #60aaff;
    border-color: #3060a0;
}

.badge-cassette {
    color: #c8a060;
    border-color: #7a5a30;
}

/* Card body */
.card-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.card-artist {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.card-title {
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card footer */
.card-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-price {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-shop {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.card-shipping {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.shipping-free {
    color: #50c878;
}

.shipping-extra {
    color: var(--text-muted);
}

.card-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--accent);
    color: #0b0b0d;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 100%;
}

.card-link:hover {
    background: #f5b030;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* ─── Scraper error banner ──────────────────────── */
.scraper-errors {
    max-width: 1200px;
    margin: -20px auto 20px;
    padding: 0 24px;
}

.scraper-errors p {
    background: rgba(232, 96, 64, 0.1);
    border: 1px solid rgba(232, 96, 64, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.82rem;
    color: #e86040;
}

/* ─── Footer ─────────────────────────────────────  */
.site-footer {
    padding: 32px 24px;
    text-align: center;
    color: var(--text-subtle);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 600px) {
    .desktop-hidden {
        display: flex;
    }

    .mobile-hidden {
        display: none !important;
    }

    .controls-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .controls-body {
        display: none;
        width: 100%;
        padding-top: 14px;
        margin-top: 14px;
        border-top: 1px solid var(--border);
    }

    .controls-body.expanded {
        display: block;
    }

    .filters-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--text-primary);
        border-radius: var(--radius-pill);
        padding: 6px 14px;
        font-family: var(--font-body);
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        outline: none;
        transition: all var(--transition);
    }

    .filters-toggle:hover {
        border-color: var(--accent-dim);
    }

    .filters-toggle .chevron {
        transition: transform var(--transition);
    }

    .filters-toggle[aria-expanded="true"] .chevron {
        transform: rotate(180deg);
    }

    .hero {
        padding: 60px 16px 48px;
    }

    .controls-inner {
        gap: 10px;
    }

    .sort-group {
        margin-left: 0;
    }

    #main-content {
        padding: 24px 16px 60px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    #search-btn .btn-label {
        display: none;
    }

    #search-btn {
        padding: 16px 20px;
        border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    }
}