/* === CSS Custom Properties (Theme) === */
:root {
    --color-text: #000;
    --color-bg: transparent;
    --color-border: #333;
    --color-invert-bg: #000;
    --color-invert-text: #fff;
    --color-artwork-bg: #fff;
    --space-xs: 4px;
    --space-sm: 6px;
    --space-md: 8px;
    --space-lg: 12px;
    --artwork-size: 60px;
    --column-min: 250px;
    --widget-max-height: 210px;
    --mobile-max-height: 120px;
    --font-family: 'Courier', monospace;
    --font-size: 13px;
    --line-height: 1.3;
}

/* === Base Styles === */
body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    padding: var(--space-lg);
    text-transform: lowercase;
    overflow: hidden;
    max-width: 100%;
}

/* === Filter Bar === */
.filters {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px 0;
    margin-bottom: var(--space-md);
    font-family: var(--font-family);
    font-size: var(--font-size);
    text-transform: lowercase;
    scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filter-link {
    cursor: pointer;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 80ms ease, color 80ms ease;
}

.filter-link.active { text-decoration: underline; }

.filter-link:not(.active):hover {
    background-color: var(--color-invert-bg);
    color: var(--color-invert-text);
}

.filter-sep { margin: 0 4px; }

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-sm) 0;
}

/* === Widget Container === */
.top-sellers-widget {
    text-align: left;
    border: 1px solid var(--color-border);
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.1);
    container-type: inline-size;
    container-name: widget;
}

/* === Grid Layout === */
.columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-lg);
    max-height: var(--widget-max-height);
    overflow-y: auto;
    scrollbar-width: none;
}
.columns::-webkit-scrollbar { display: none; }

.column {
    display: grid;
    gap: var(--space-md);
    align-content: start;
    min-width: 0;
}

/* === Item Styling === */
a.release-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-md);
    padding: var(--space-sm);
    text-decoration: none;
    color: var(--color-text);
    background-color: #e8e8e8;
    transition: background-color 0.1s ease;
    min-width: 0;
}

a.release-item:hover {
    background-color: var(--color-invert-bg);
    color: var(--color-invert-text);
}

/* === Album Artwork === */
.artwork {
    width: var(--artwork-size);
    height: var(--artwork-size);
    aspect-ratio: 1;
    flex-shrink: 0;
    background-color: var(--color-artwork-bg);
    display: grid;
    place-items: center;
    padding: var(--space-xs);
}

a.release-item:hover .artwork {
    background-color: var(--color-invert-bg);
}

.artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === Text Layout === */
.info {
    font-size: var(--font-size);
    line-height: var(--line-height);
    min-width: 0;
}

.row1, .row2, .row3 {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    overflow: hidden;
    white-space: nowrap;
}

.row2, .row3 {
    margin-block-start: 2px;
}

/* === Text Elements === */
.artist-text {
    flex-shrink: 1;
    min-width: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
}

.title-text {
    flex-shrink: 2;
    min-width: 0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.styles-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 11px;
    opacity: 0.7;
}

.price-text,
.stock-text,
.sep {
    flex-shrink: 0;
    white-space: nowrap;
}

/* === Container Queries === */
@container widget (max-width: 600px) {
    .columns {
        grid-template-columns: 1fr;
        max-height: var(--mobile-max-height);
    }

    .artist-text,
    .title-text {
        max-width: 100%;
    }
}

/* === More Link === */
.more-link {
    display: none;
    color: var(--color-text);
    text-decoration: underline;
    font-size: var(--font-size);
    padding: var(--space-sm);
}

@container widget (max-width: 600px) {
    .more-link { display: block; }
}

/* Fallback for browsers without container query support */
@supports not (container-type: inline-size) {
    @media (max-width: 600px) {
        .columns {
            grid-template-columns: 1fr;
            max-height: var(--mobile-max-height);
        }
    }
}
