:root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f6f6f6;
    --surface-strong: #ffffff;
    --text: #111111;
    --muted: #555555;
    --border: #dddddd;
    --field-bg: #ffffff;
    --field-text: #111111;
    --field-border: #c9c9c9;
    --button-bg: #111111;
    --button-text: #ffffff;
    --link: #111111;
    --focus: #1a5fb4;
    --label-bg: #111111;
    --label-text: #ffffff;
    --label-new-bg: #0b6b3a;
    --label-new-text: #ffffff;
    --label-promo-bg: #a1143a;
    --label-promo-text: #ffffff;
    --logo-back: transparent;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-strong: #1a1a1a;
    --text: #f2f2f2;
    --muted: #b3b3b3;
    --border: #3a3a3a;
    --field-bg: #1c1c1c;
    --field-text: #f2f2f2;
    --field-border: #4a4a4a;
    --button-bg: #f2f2f2;
    --button-text: #111111;
    --link: #eaeaea;
    --focus: #7fb2ff;
    --label-bg: #f2f2f2;
    --label-text: #111111;
    --label-new-bg: #35c06f;
    --label-new-text: #052b16;
    --label-promo-bg: #ff7b96;
    --label-promo-text: #3a0413;
    --logo-back: #f5f5f5;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #121212;
        --surface: #1e1e1e;
        --surface-strong: #1a1a1a;
        --text: #f2f2f2;
        --muted: #b3b3b3;
        --border: #3a3a3a;
        --field-bg: #1c1c1c;
        --field-text: #f2f2f2;
        --field-border: #4a4a4a;
        --button-bg: #f2f2f2;
        --button-text: #111111;
        --link: #eaeaea;
        --focus: #7fb2ff;
        --label-bg: #f2f2f2;
        --label-text: #111111;
        --label-new-bg: #35c06f;
        --label-new-text: #052b16;
        --label-promo-bg: #ff7b96;
        --label-promo-text: #3a0413;
        --logo-back: #f5f5f5;
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--link);
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--button-bg);
    color: var(--button-text);
    padding: 0.5rem 1rem;
    z-index: 100;
}

.skip-link:focus {
    left: 0;
}

/* Header */

.site-header {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

.site-header__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo z przezroczystymi marginesami w pliku: kadrujemy je przez cover,
   aby widoczna grafika miała ~160 px szerokości przy niskim nagłówku. */
.site-header__logo {
    order: 1;
    margin-right: auto;
    flex: 0 0 auto;
    display: block;
    width: 178px;
    height: 96px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--logo-back);
}

.site-header__logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 44%;
}

.theme-toggle {
    order: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.theme-toggle__icon {
    display: inline-flex;
}

.theme-toggle__icon--sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__icon--moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__icon--sun {
    display: inline-flex;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle__icon--moon {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-toggle__icon--sun {
        display: inline-flex;
    }
}

.site-nav {
    order: 4;
    flex: 1 1 100%;
    margin: 0;
}

.site-nav__list,
.site-nav__sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.site-nav__sublist {
    width: 100%;
    padding-left: 1rem;
    font-size: 0.95rem;
}

.site-nav__item > a {
    text-decoration: none;
}

.search {
    order: 3;
    display: flex;
    flex: 1 1 100%;
    gap: 0.4rem;
}

.search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--field-border);
    border-radius: 4px;
    background: var(--field-bg);
    color: var(--field-text);
    font: inherit;
}

.search button,
.filters button,
.offer-select button {
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--button-bg);
    border-radius: 4px;
    background: var(--button-bg);
    color: var(--button-text);
    font: inherit;
    cursor: pointer;
}

@media (min-width: 960px) {
    .site-header__bar {
        flex-wrap: nowrap;
    }

    .site-header__logo {
        margin-right: 0;
    }

    .site-nav {
        order: 2;
        flex: 1 1 auto;
        min-width: 0;
        margin: 0 0.5rem;
    }

    .search {
        order: 3;
        flex: 0 1 320px;
        max-width: 320px;
    }

    .theme-toggle {
        order: 4;
    }
}

/* Layout */

.site-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer p {
    max-width: 1200px;
    margin: 0 auto;
}

.breadcrumbs {
    font-size: 0.9rem;
    margin: 1rem 0;
}

.breadcrumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    color: var(--muted);
}

.breadcrumbs li + li::before {
    content: "→";
    margin-right: 0.35rem;
}

.catalog {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.catalog__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.catalog__heading {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 1.9rem);
}

.catalog__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.catalog__filters-toggle {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.sort {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sort__label {
    color: var(--muted);
}

.sort a[aria-current="true"] {
    font-weight: 700;
    text-decoration: underline;
}

/* Cards */

.cards {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    background: var(--surface-strong);
}

.card__link {
    text-decoration: none;
    display: block;
}

.card__media {
    position: relative;
    display: block;
}

.card__image,
.card__placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
}

.card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.card__title {
    margin: 0.5rem 0 0;
    font-size: 1rem;
}

.card__artists {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.card__meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.card__price {
    margin: auto 0 0;
    font-weight: 700;
}

.card__price--unavailable {
    color: var(--muted);
    font-weight: 400;
}

/* Oznaczenia ofert */

.labels {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.label {
    font-size: 0.72rem;
    line-height: 1.25;
    padding: 0.14rem 0.45rem;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.label--bestseller {
    background: var(--label-bg);
    color: var(--label-text);
}

.label--new {
    background: var(--label-new-bg);
    color: var(--label-new-text);
}

.label--promotion {
    background: var(--label-promo-bg);
    color: var(--label-promo-text);
}

/* Filters */

.filters {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    align-self: start;
    background: var(--surface-strong);
}

.filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filters__title {
    margin: 0;
    font-size: 1.1rem;
}

.filters__close {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    padding: 0.3rem 0.6rem;
    font: inherit;
    cursor: pointer;
}

.filters__form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 0.75rem;
}

.filters__group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 0;
    padding: 0;
    margin: 0;
}

.filters__group legend {
    padding: 0;
    font-weight: 600;
}

.filters__group select,
.filters__group input[type="number"] {
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--field-border);
    border-radius: 4px;
    background: var(--field-bg);
    color: var(--field-text);
    font: inherit;
    width: 100%;
}

.filters__check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
}

.filters__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters__clear {
    font-size: 0.9rem;
}

@media (min-width: 900px) {
    .catalog {
        grid-template-columns: 1fr 280px;
    }

    .catalog__filters-toggle,
    .filters__close {
        display: none;
    }

    .filters {
        order: 2;
    }
}

@media (max-width: 899px) {
    .filters {
        display: none;
    }

    .filters.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        border-radius: 0;
        overflow-y: auto;
        background: var(--bg);
    }
}

/* Release page */

.release {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.release__media {
    position: relative;
    display: block;
}

.release__image,
.release__placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.release__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.release__thumbs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
}

.release__thumb {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    width: 64px;
    height: 64px;
    overflow: hidden;
}

.release__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.release__title {
    margin: 0;
    font-size: clamp(1.5rem, 5vw, 2.1rem);
}

.release__artists {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.release__offer {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    background: var(--surface-strong);
}

.release__offer h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.offer-select {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.offer-select select {
    padding: 0.5rem;
    border: 1px solid var(--field-border);
    border-radius: 4px;
    background: var(--field-bg);
    color: var(--field-text);
    font: inherit;
}

.release__price {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.release__availability {
    margin: 0;
}

.release__availability--unavailable {
    color: var(--muted);
}

.release__sku,
.release__handling,
.release__condition,
.release__comparison {
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
}

.release__data {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.release__data dt {
    color: var(--muted);
}

.release__data dd {
    margin: 0;
}

.release__text {
    margin-top: 1rem;
}

@media (min-width: 760px) {
    .release {
        grid-template-columns: minmax(0, 420px) 1fr;
    }
}

/* Artists */

.artists {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    columns: 2;
}

.artists__item {
    margin-bottom: 0.4rem;
}

@media (min-width: 700px) {
    .artists {
        columns: 3;
    }
}

/* Shared */

.empty {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination__status {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Legacy home */

.home {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1.25rem;
    text-align: center;
}

.home__logo {
    max-width: min(320px, 80vw);
    height: auto;
}
