/* Styles for the shop pages: /shop and every listing under it. */

/* The title band
   ========================================================================== */

/* The shop's second heading reads as the band's introduction. */
.shop-hero__sub {
    max-width: 40rem;
    font-family: var(--font-body);
    font-size: var(--text-lg);
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
}

.shop-hero .button-row {
    margin-top: var(--space-2);
}

/* Written after the title, so a screen reader meets the title first, but shown above it. */
.shop-crumbs {
    order: -1;
}

.shop-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: 0;
    padding: 0;
    font-size: var(--text-sm);
    list-style: none;
}

.shop-crumbs li + li::before {
    content: "/";
    margin-right: var(--space-2);
    opacity: 0.6;
}

.shop-crumbs a {
    color: inherit;
    text-decoration: none;
    opacity: 0.8;
}

.shop-crumbs a:hover {
    text-decoration: underline;
    opacity: 1;
}

.shop-crumbs a[aria-current] {
    font-weight: 600;
    opacity: 1;
}


/* Search
   ========================================================================== */

/* The shop's first page's search, on the title band as the parts search is (.hero-search in
   sections.css). Above what follows, so its results open over it. */
.shop-search {
    position: relative;
    z-index: 5;
    display: grid;
    width: 100%;
    max-width: 640px;
    margin-top: var(--space-2);
}

.shop-search__field {
    position: relative;
}

.shop-search__icon {
    position: absolute;
    top: 50%;
    left: var(--space-4);
    color: var(--color-hero-text);
    opacity: 0.7;
    pointer-events: none;
    translate: 0 -50%;
}

.shop-search__input.field__input {
    color-scheme: dark;
    min-height: 52px;
    padding-left: calc(var(--space-4) * 2 + 20px);
    border-color: var(--color-hero-line);
    background: var(--color-hero-chip);
    color: var(--color-hero-text);
    font-size: var(--text-lg);
}

.shop-search__input.field__input::placeholder {
    color: inherit;
    opacity: 0.7;
}

/* The page's own colours, before the title band makes its text white. */
:root {
    --shop-page-text: var(--color-text);
    --shop-page-focus: var(--color-focus);
}

/* The results are a light panel over the band, so they take the page's colours back. */
.shop-search__results {
    --color-text: var(--shop-page-text);
    --color-focus: var(--shop-page-focus);

    color: var(--color-text);
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    max-height: min(70vh, 34rem);
    margin-top: var(--space-1);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.18);
}

.shop-search__results[hidden] {
    display: none;
}

.shop-search__results ol {
    margin: 0;
    padding: var(--space-2) 0;
    list-style: none;
}

.shop-search__results li:empty {
    display: none;
}

.shop-search__empty {
    padding: var(--space-4) var(--space-5);
    color: var(--color-text-muted);
}

.shop-hit {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: var(--space-2) var(--space-5);
    color: var(--color-text);
    text-decoration: none;
}

.shop-hit:hover,
.shop-hit:focus-visible {
    background: var(--color-surface-raised);
}

.shop-hit img {
    flex: none;
    width: 56px;
    height: 56px;
    padding: 4px;
    background: #FFFFFF;
    object-fit: contain;
}

.shop-hit__text {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.shop-hit__name mark {
    background: none;
    color: inherit;
    font-weight: 700;
}

.shop-hit__meta {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.shop-hit__price {
    flex: none;
    font-weight: 700;
    white-space: nowrap;
}

.shop-hit__price s {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 400;
}

/* A product with no photo keeps the names in line. */
.shop-hit__blank {
    flex: none;
    width: 56px;
    height: 56px;
    background: var(--color-surface-raised);
}


/* The shop's first page
   ========================================================================== */

/* The main categories the brand sells (shop_categories), often only one or two, so they share
   the row; each category's photo fills its tile. */
.shop-tiles {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* One category on its own isn't stretched across the page. */
.shop-tiles > :only-child {
    width: 100%;
    max-width: 560px;
}

.shop-tiles .type-tile img,
.shop-tile__blank {
    width: 100%;
    max-height: 420px;
    aspect-ratio: 16 / 9;
}

.shop-tiles .type-tile img {
    object-fit: cover;
}

/* A tile without a photo keeps the same shape. */
.shop-tile__blank {
    display: grid;
    place-items: center;
    background: var(--color-media);
    color: var(--color-text-muted);
}

.shop-offer .section__head {
    margin-bottom: var(--space-5);
}


/* Products
   ========================================================================== */

/* Two to a row even on a phone: product photos are small and square. */
.card-grid--products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

@media (min-width: 900px) {
    .card-grid--products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-5);
    }
}

@media (min-width: 1200px) {
    .card-grid--products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.product-card .model-card__media {
    aspect-ratio: 1;
    background: #FFFFFF;
}

.product-card .model-card__media img {
    padding: 8%;
}

.product-card .model-card__media .model-card__logo {
    padding: 22%;
    opacity: 0.5;
}

.product-card .model-card__body {
    gap: var(--space-2);
    padding: var(--space-4);
}

/* Long product names stop at three lines, so the prices stay level. */
.product-card__title {
    display: -webkit-box;
    overflow: hidden;
    font-size: var(--text-md);
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.product-card__rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.product-card__stars {
    display: inline-flex;
    gap: 1px;
    color: var(--color-warning);
}

.product-card__stars .is-on {
    fill: currentColor;
}

.product-card .model-card__footer {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
    min-height: 0;
    padding-top: var(--space-3);
}

.product-card .model-card__price {
    font-size: var(--text-lg);
}

.product-card .model-card__was {
    display: inline-block;
    margin-left: 0;
}

@media (max-width: 639.98px) {
    .product-card .model-card__body {
        padding: var(--space-3);
    }

    .product-card__title {
        font-size: var(--text-sm);
    }

    .product-card .model-card__more {
        display: none;
    }
}


/* Listing: the count and the words
   ========================================================================== */

.shop-results {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    margin-bottom: var(--space-5);
}

.shop-about {
    max-width: 52rem;
}

.shop-about h2 {
    margin-bottom: var(--space-3);
    font-size: var(--text-2xl);
}

.shop-about p {
    color: var(--color-text-muted);
}


/* Quick view
   The dialog comes from x-ui.quick-view-dialog, its content from livewire/shop/shop-quick-view.
   ========================================================================== */

.shop-dialog {
    width: min(100% - 2rem, 980px);
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    color: var(--color-text);
}

.shop-dialog::backdrop {
    background: rgb(0 0 0 / 0.6);
}

.quick-view {
    position: relative;
    padding: var(--space-5);
}

.quick-view__close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.quick-view__grid {
    display: grid;
    gap: var(--space-5);
}

@media (min-width: 800px) {
    .quick-view {
        padding: var(--space-6);
    }

    .quick-view__grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--space-6);
    }
}

.quick-view__gallery {
    display: grid;
    gap: var(--space-2);
    align-content: start;
}

/* One photo at a time, swiped on a phone. The thumbnails choose one on a computer. */
.quick-view__track {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    background: #FFFFFF;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.quick-view__track::-webkit-scrollbar {
    display: none;
}

.quick-view__track img {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 1;
    padding: 6%;
    object-fit: contain;
    scroll-snap-align: start;
}

.quick-view__thumbs {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: thin;
}

.quick-view__thumbs button {
    flex: none;
    width: 64px;
    height: 64px;
    padding: 4px;
    border: 2px solid var(--color-border);
    background: #FFFFFF;
    cursor: pointer;
}

.quick-view__thumbs button[aria-current] {
    border-color: var(--color-primary);
}

.quick-view__thumbs img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.quick-view__info {
    display: grid;
    gap: var(--space-4);
    align-content: start;
}

/* Clear of the close button. */
.quick-view__title {
    padding-right: var(--space-7);
    font-size: var(--text-2xl);
}

.quick-view__price {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: var(--heading-weight);
    line-height: 1.1;
}

.quick-view__price s {
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: var(--text-md);
    font-weight: 400;
}

.quick-view__text {
    color: var(--color-text-muted);
}

.quick-view__label {
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
}

.quick-view__size-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.quick-view__size {
    display: inline-grid;
    place-items: center;
    min-width: 56px;
    min-height: 48px;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-button);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
}

.quick-view__size small {
    color: var(--color-accent-text);
    font-size: 0.75rem;
}

.quick-view__size:hover {
    border-color: var(--color-text);
}

.quick-view__size[aria-pressed="true"] {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.quick-view__size[aria-pressed="true"] small {
    color: inherit;
}

/* Still choosable, to see when it is due. */
.quick-view__size.is-out:not([aria-pressed="true"]) {
    border-style: dashed;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.quick-view__status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
}

.quick-view__status::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.quick-view__status.is-in {
    color: var(--color-success);
}

.quick-view__status.is-low {
    color: var(--color-warning);
}

.quick-view__status.is-out {
    color: var(--color-danger);
}

.quick-view__loading {
    color: var(--color-text-muted);
}

.quick-view__delivery {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.quick-view__info .btn {
    justify-self: start;
    gap: var(--space-2);
}

.quick-view__waiting {
    display: grid;
    place-items: center;
    min-height: 320px;
}

.quick-view__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: quick-view-spin 0.8s linear infinite;
}

@keyframes quick-view-spin {
    to {
        rotate: 360deg;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quick-view__spinner {
        animation-duration: 2.4s;
    }
}
