/* Pagina /music: lada cu viniluri + raftul cu toate discurile.
   Markup: helpers/products/musicCollections.phtml, comportament: js/musicCrate.js
   Limbajul vizual e cel al paginilor de categorie: fundalul paginii e negru, iar containerul de maximum 1600px e
   #101010, ca navbar-ul si #content. Carduri cu chenar subtire, pastile conturate, portocaliu doar ca accent. */

.crate-page {
    --c-bg: var(--clr-black, #101010);
    --c-surface: #161616;
    --c-border: var(--clr-border, #2B2C2E);
    --c-text: #ffffff;
    --c-muted: var(--clr-lightgrey, #ACAAAA);
    --c-accent: var(--clr-orange, #F16A52);
    --c-wood: #54392a;
    --c-wood-light: #6a4b34;
    --c-wood-shade: #3f2a1c;
    --c-wood-dark: #2a1c13;

    /* marimea discului din fata; restul lazii se calculeaza din ea */
    --cover: clamp(230px, min(33vh, 28vw), 400px);
    --step: calc(var(--cover) * .1);
    --plank: calc(var(--cover) * .14);

    max-width: 1600px;
    margin: 0 auto;
    padding: 0 51px 72px;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--ff-hg), Arial, sans-serif;
    box-sizing: border-box;
}

.crate-page *,
.crate-page *::before,
.crate-page *::after {
    box-sizing: border-box;
}

.crate-page button,
.crate-page input,
.crate-page select {
    font-family: inherit;
}

.crate-page a {
    color: inherit;
    text-decoration: none;
}

.crate-page :focus-visible {
    outline: 1px solid var(--c-accent);
    outline-offset: 2px;
}

/* TITLU SI UNELTE */

.crate-head {
    padding: 12px 0 16px;
}

.crate-head .breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    font-size: 11px;
    list-style: none;
}

.crate-head .breadcrumbs li + li::before {
    content: "›";
    margin-right: 10px;
    color: var(--c-muted);
}

.crate-head .breadcrumbs li:last-child a {
    color: var(--c-muted);
}

.crate-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 24px;
    margin-top: 24px;
}

.crate-title {
    margin: 0;
    color: var(--c-text);
    font-family: OpenSansLight, Arial, serif;
    font-size: 24px;
    font-weight: 400;
    text-transform: uppercase;
}

.crate-count {
    margin: 10px 0 0;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
}

.crate-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.crate-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 260px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--c-border);
    border-radius: 18px;
    color: var(--c-muted);
    transition: border-color .15s;
}

.crate-search:focus-within {
    border-color: var(--c-muted);
}

.crate-search svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.crate-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    outline: 0;
    box-shadow: none;
    color: var(--c-text);
    font-size: 14px;
}

.crate-search input::placeholder {
    color: var(--c-muted);
}

.crate-sort select {
    height: 36px;
    margin: 0;
    padding: 0 32px 0 14px;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' fill='none' stroke='%23ACAAAA' stroke-width='1.4'/%3E%3C/svg%3E") right 13px center / 9px no-repeat;
    border: 1px solid var(--c-border);
    border-radius: 18px;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.crate-sort select option {
    background: var(--c-bg);
    color: var(--c-text);
}

/* SEPARATOARELE DE GEN, ca in lada din magazin */

.crate-filters {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: 8px;
    background: var(--c-bg);
    border-bottom: 2px solid var(--c-accent);
}

.crate-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.crate-tabs::-webkit-scrollbar {
    display: none;
}

.crate-tab {
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
    height: 38px;
    padding: 10px 16px 0;
    background: #1f1f1f;
    border: 0;
    border-radius: 6px 6px 0 0;
    color: var(--c-text);
    font-size: 18px;
    letter-spacing: .03em;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, transform .15s;
    transform: translateY(5px);
}

.crate-page .crate-tab {
    font-family: var(--ff-aga), Arial, sans-serif;
}

.crate-tab small {
    color: var(--c-muted);
    font-family: var(--ff-hg), Arial, sans-serif;
    font-size: 11px;
    letter-spacing: 0;
}

.crate-tab:hover {
    background: #2a2a2a;
    transform: translateY(2px);
}

.crate-tab[aria-pressed="true"] {
    background: var(--c-accent);
    transform: none;
}

.crate-tab[aria-pressed="true"] small {
    color: rgba(255, 255, 255, .85);
}

/* FORMAT: pastile, ca sortarea din categorii */

.crate-format {
    display: flex;
    gap: 6px;
}

.crate-pill {
    flex-shrink: 0;
    height: 36px;
    padding: 0 14px;
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 18px;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.crate-pill:hover {
    color: var(--c-text);
}

.crate-pill[aria-pressed="true"] {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

/* SCENA: LADA + DISCUL DIN FATA, intr-un card ca produsele din categorii */

.crate-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr);
    align-items: center;
    gap: 24px 48px;
    margin-top: 20px;
    padding: 28px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
}

.crate-stage[hidden],
.crate-empty[hidden],
.crate-shelf[hidden] {
    display: none;
}

.crate-left {
    position: relative;
    min-width: 0;
}

.crate {
    position: relative;
    width: calc(var(--cover) * 1.24);
    max-width: 100%;
    height: calc(var(--cover) * 1.3 + var(--plank) * .55);
    margin: 0 auto;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.crate.is-dragging {
    cursor: grabbing;
}

.crate__back {
    position: absolute;
    inset: calc(var(--cover) * .2) 0 0;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 9px),
        linear-gradient(180deg, #1d140d, var(--c-wood-dark));
    clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
}

.crate__records {
    position: absolute;
    inset: 0;
}

.crate__front {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--plank);
    background:
        repeating-linear-gradient(92deg, rgba(0, 0, 0, .13) 0 1px, transparent 1px 6px, rgba(255, 255, 255, .025) 6px 7px, transparent 7px 13px),
        linear-gradient(180deg, var(--c-wood-light), var(--c-wood) 45%, var(--c-wood-shade));
    border-radius: 2px;
    box-shadow: 0 -6px 14px rgba(0, 0, 0, .5), 0 14px 24px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .12);
    pointer-events: none;
}

.crate__label {
    overflow: hidden;
    max-width: 86%;
    color: rgba(0, 0, 0, .78);
    font-size: clamp(11px, calc(var(--cover) * .036), 13px);
    font-weight: 500;
    letter-spacing: .14em;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .1);
    text-transform: uppercase;
    white-space: nowrap;
}

.rec {
    --d: 0;

    position: absolute;
    bottom: calc(var(--plank) * .45);
    left: 50%;
    z-index: calc(100 - var(--d));
    display: block;
    width: var(--cover);
    height: var(--cover);
    margin-left: calc(var(--cover) / -2);
    background: #1b1b1b;
    border-radius: 2px;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, .4);
    filter: brightness(calc(1 - var(--d) * .13)) saturate(calc(1 - var(--d) * .08));
    transform: perspective(1500px) translateY(calc(var(--d) * var(--step) * -1)) scale(calc(1 - var(--d) * .032)) rotateX(0deg);
    transform-origin: 50% 100%;
    transition: transform .42s cubic-bezier(.22, .8, .3, 1), filter .42s, opacity .3s, translate .18s;
}

.rec img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    object-fit: cover;
    pointer-events: none;
}

/* muchia plicului */
.rec::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
    pointer-events: none;
}

.rec--behind {
    cursor: pointer;
}

.rec--behind:hover {
    translate: 0 -10px;
}

/* discul rasfoit: se apleaca spre client, peste urmatorul disc, si dispare spre final */
.rec--gone {
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transform: perspective(1500px) translateY(0) scale(1) rotateX(-82deg);
    transition: transform .42s cubic-bezier(.3, .1, .4, 1), filter .42s, opacity .16s .26s;
}

.rec--enter {
    opacity: 0;
}

/* vinilul iese putin din plic cand treci peste discul din fata */
.rec__disc {
    position: absolute;
    top: 3%;
    left: 6%;
    z-index: -1;
    width: 88%;
    height: 88%;
    background: repeating-radial-gradient(circle, #171717 0 2px, #0d0d0d 2px 4px);
    border-radius: 50%;
    box-shadow: 0 0 0 1px #000;
    transition: transform .4s cubic-bezier(.22, .8, .3, 1);
}

.rec__disc::after {
    content: "";
    position: absolute;
    inset: 35%;
    background: #3a3a3c;
    border-radius: 50%;
}

.rec--front:hover .rec__disc {
    transform: translateY(-24%);
}

.crate-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(100%, calc(var(--cover) * 1.24));
    margin: 18px auto 0;
}

.crate-arrow {
    /* pe ecrane late stau de o parte si de alta a lazii */
    position: absolute;
    top: calc(var(--cover) * .72);
    z-index: 210;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--c-border);
    border: 0;
    border-radius: 50%;
    color: var(--c-text);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.crate-arrow--prev {
    right: calc(50% + var(--cover) * .62 + 16px);
}

.crate-arrow--next {
    left: calc(50% + var(--cover) * .62 + 16px);
}

.crate-arrow svg {
    width: 12px;
    height: 12px;
}

.crate-arrow:hover:not(:disabled) {
    color: var(--c-accent);
}

.crate-arrow:disabled {
    opacity: .35;
    cursor: default;
}

.crate-range {
    --p: 0%;

    flex: 1;
    min-width: 0;
    height: 20px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.crate-range::-webkit-slider-runnable-track {
    height: 3px;
    background: linear-gradient(90deg, var(--c-accent) var(--p), var(--c-border) var(--p));
    border-radius: 2px;
}

.crate-range::-moz-range-track {
    height: 3px;
    background: linear-gradient(90deg, var(--c-accent) var(--p), var(--c-border) var(--p));
    border-radius: 2px;
}

.crate-range::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5.5px;
    background: #ffffff;
    border: 0;
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
}

.crate-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 0;
    border-radius: 50%;
}

.crate-position {
    margin: 6px 0 0;
    color: var(--c-muted);
    font-size: 13px;
    text-align: center;
}

/* DETALII DISC */

.crate-detail {
    min-width: 0;
    max-width: 460px;
}

.crate-detail__meta {
    margin: 0 0 10px;
    color: var(--c-muted);
    font-size: 14px;
}

.crate-detail__artist {
    margin: 0;
    color: var(--c-text);
    font-family: var(--ff-hg), Arial, sans-serif;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.crate-detail__album {
    margin: 4px 0 0;
    color: var(--c-muted);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.crate-detail__price {
    margin: 22px 0 16px;
    color: var(--c-accent);
    font-family: var(--ff-aga), Arial, sans-serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 1;
}

.crate-detail__price small {
    margin-left: 3px;
    font-size: 14px;
    vertical-align: top;
}

.crate-detail__actions {
    display: flex;
    gap: 8px;
}

.crate-cart {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 240px;
    min-height: 44px;
    padding: 3px 24px 0;
    background: var(--c-accent);
    border: 0;
    border-radius: 4px;
    color: #ffffff;
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter .15s, background .2s;
}

.crate-page .crate-cart {
    font-family: var(--ff-aga), Arial, sans-serif;
}

.crate-cart:hover {
    filter: brightness(1.06);
}

.crate-cart.is-added {
    background: #2e8b57;
}

.crate-cart[hidden] {
    display: none;
}

.crate-cart svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: -3px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.crate-heart {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    color: var(--c-muted);
    cursor: pointer;
    transition: color .15s;
}

.crate-heart svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.crate-heart:hover {
    color: var(--c-text);
}

.crate-heart[aria-pressed="true"] {
    color: var(--c-accent);
}

.crate-heart[aria-pressed="true"] svg {
    fill: currentColor;
}

.crate-detail__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    margin-top: 18px;
}

.crate-detail__links a,
.crate-random {
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline !important;
    text-decoration-color: #4a4a4a !important;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color .15s;
}

.crate-detail__links a:hover,
.crate-random:hover {
    color: var(--c-text);
}

/* NICIUN REZULTAT */

.crate-empty {
    padding: 80px 16px;
    color: var(--c-muted);
    font-size: 16px;
    text-align: center;
}

.crate-empty p {
    margin: 0 0 16px;
}

/* RAFTUL: fiecare rand e o nisa de biblioteca, luminata de sus, cu discurile sprijinite pe scandura */

.crate-shelf {
    margin-top: 56px;
}

.crate-shelf__title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 14px;
    color: var(--c-text);
    font-family: OpenSansLight, Arial, serif;
    font-size: 24px;
    font-weight: 400;
    text-transform: uppercase;
}

.crate-shelf__title b {
    font-weight: 400;
}

.crate-shelf__title span {
    color: var(--c-muted);
    font-family: var(--ff-hg), Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
}

.crate-shelf__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    row-gap: 34px;
}

.shelf-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.shelf-item__niche {
    position: relative;
    padding: 30px 18px 0;
    background:
        radial-gradient(ellipse 72% 62% at 50% 0, rgba(255, 214, 165, .11), transparent 100%),
        linear-gradient(180deg, rgba(38, 28, 20, 0), #2a1f17 46%, #33261b);
}

.shelf-item__cover {
    position: relative;
    z-index: 1;
    isolation: isolate;
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: 2px;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, .05), 10px 0 18px -10px rgba(0, 0, 0, .75), -10px 0 18px -10px rgba(0, 0, 0, .75);
    transform-origin: 50% 100%;
    transition: transform .25s cubic-bezier(.22, .8, .3, 1);
}

.shelf-item__cover img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    background: #1b1b1b;
    border-radius: 2px;
    object-fit: cover;
}

.shelf-item__disc {
    position: absolute;
    top: 4%;
    right: 4%;
    z-index: -1;
    width: 92%;
    height: 92%;
    background: repeating-radial-gradient(circle, #171717 0 2px, #0d0d0d 2px 4px);
    border-radius: 50%;
    box-shadow: 0 0 0 1px #000;
    transition: transform .3s cubic-bezier(.22, .8, .3, 1);
}

.shelf-item__disc::after {
    content: "";
    position: absolute;
    inset: 35%;
    background: #3a3a3c;
    border-radius: 50%;
}

@media (hover: hover) {
    .shelf-item:hover .shelf-item__cover {
        transform: translateY(-6px);
    }

    .shelf-item:hover .shelf-item__disc {
        transform: translateX(13%);
    }
}

.shelf-item__format {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 7px;
    background: rgba(16, 16, 16, .85);
    border-radius: 3px;
    color: var(--c-text);
    font-size: 11px;
    font-weight: 500;
}

.shelf-item .crate-heart {
    position: absolute;
    top: 38px;
    right: 26px;
    z-index: 2;
    width: 32px;
    height: 32px;
    background: rgba(16, 16, 16, .85);
    border: 0;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .15s, color .15s;
}

.shelf-item .crate-heart svg {
    width: 15px;
    height: 15px;
}

.shelf-item:hover .crate-heart,
.shelf-item .crate-heart:focus-visible,
.shelf-item .crate-heart[aria-pressed="true"] {
    opacity: 1;
}

/* scandura e continua: fiecare celula isi deseneaza bucata ei */
.shelf-item__plank {
    position: relative;
    z-index: 1;
    height: 13px;
    background:
        repeating-linear-gradient(92deg, rgba(0, 0, 0, .13) 0 1px, transparent 1px 7px),
        linear-gradient(180deg, #7a5639, var(--c-wood-light) 22%, var(--c-wood-shade));
    box-shadow: 0 10px 14px -2px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.shelf-item__text {
    display: block;
    padding: 16px 18px 0;
}

.shelf-item__artist {
    display: block;
    overflow: hidden;
    color: var(--c-text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shelf-item__album {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shelf-item__buy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding: 12px 18px 0;
}

.shelf-item__price {
    color: var(--c-accent);
    font-family: var(--ff-aga), Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.shelf-item__price small {
    margin-left: 2px;
    font-size: 12px;
    vertical-align: top;
}

.shelf-item .crate-cart {
    flex: none;
    width: 38px;
    min-height: 38px;
    height: 38px;
    padding: 0;
}

.shelf-item .crate-cart svg {
    width: 18px;
    height: 18px;
    margin-top: 0;
}

.crate-sentinel {
    height: 1px;
}

@media (hover: none) {
    .shelf-item .crate-heart {
        opacity: 1;
    }
}

@media screen and (max-width: 1100px) {
    .crate-page {
        padding: 0 24px 56px;
    }

    .crate-stage {
        gap: 24px 28px;
        padding: 20px;
    }
}

@media screen and (max-width: 850px) {
    .crate-page {
        --cover: min(62vw, 300px);

        padding: 0 16px 48px;
    }

    .crate-tools,
    .crate-search {
        width: 100%;
    }

    .crate-sort,
    .crate-sort select {
        width: 100%;
    }

    .crate-head__row {
        margin-top: 16px;
    }

    .crate-arrow {
        position: static;
    }

    .crate-stage {
        grid-template-columns: minmax(0, 1fr);
        padding: 20px 16px;
    }

    .crate-detail {
        max-width: none;
    }

    .crate-detail > p,
    .crate-detail > h2 {
        text-align: center;
    }

    .crate-detail__artist {
        font-size: 22px;
    }

    .crate-detail__album {
        font-size: 18px;
    }

    .crate-detail__price {
        margin: 14px 0;
    }

    .crate-detail__actions,
    .crate-detail__links {
        justify-content: center;
    }
}

@media screen and (max-width: 600px) {
    .crate-shelf__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 28px;
    }

    .shelf-item__niche {
        padding: 22px 10px 0;
    }

    .shelf-item__plank {
        height: 10px;
    }

    .shelf-item .crate-heart {
        top: 28px;
        right: 16px;
    }

    .shelf-item__text {
        padding: 12px 10px 0;
    }

    .shelf-item__artist {
        font-size: 14px;
    }

    .shelf-item__album {
        font-size: 13px;
    }

    .shelf-item__buy {
        padding: 10px 10px 0;
    }

    .shelf-item__price {
        font-size: 24px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .rec,
    .rec__disc,
    .shelf-item__disc,
    .shelf-item__cover {
        transition: none;
    }
}
