/*
 * Public shop: a quiet, product-first showroom.
 * Shared layout, button, form, and typography primitives come from the public
 * design system; this file owns only catalog and product-detail presentation.
 */

/* ============================================================
   CATALOG — editorial heading, category rail, and full-width grid
   ============================================================ */
.ub-shop__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--ub-space-3xl);
    margin-bottom: var(--ub-space-3xl);
}

.ub-shop__heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--ub-space-l);
    max-width: var(--ub-container-narrow);
}

.ub-shop__heading .ub-eyebrow {
    margin: 0;
}

.ub-shop__title {
    margin: 0;
    color: var(--ub-color-heading);
    font-size: clamp(var(--ub-text-3xl), 4vw, var(--ub-text-4xl));
    font-weight: 600;
    line-height: var(--ub-leading-display);
    letter-spacing: var(--ub-tracking-display);
}

.ub-shop__intro {
    max-width: var(--ub-container-xs);
    margin: 0;
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-base);
    line-height: var(--ub-leading-body);
}

.ub-shop__count {
    flex-shrink: 0;
    margin: 0;
    padding: var(--ub-space-s) var(--ub-space-xl);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-section-soft);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-sm);
    font-weight: 500;
    line-height: var(--ub-leading-snug);
}

.ub-shop-nav {
    margin-bottom: var(--ub-space-5xl);
    padding-bottom: var(--ub-space-2xl);
    border-bottom: 1px solid var(--ub-color-divider);
}

.ub-shop-nav__track {
    display: flex;
    gap: var(--ub-space-s);
    overflow-x: auto;
    padding: var(--ub-space-xs);
    margin: calc(var(--ub-space-xs) * -1);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ub-shop-nav__track::-webkit-scrollbar {
    display: none;
}

.ub-shop-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--ub-size-icon-chip-md);
    flex: 0 0 auto;
    padding-inline: var(--ub-space-xl);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-page-bg);
    color: var(--ub-color-body);
    font-size: var(--ub-text-sm);
    font-weight: 500;
    line-height: var(--ub-leading-snug);
    text-decoration: none;
    scroll-snap-align: start;
    transition: background-color var(--ub-transition-fast),
                border-color var(--ub-transition-fast),
                color var(--ub-transition-fast);
}

.ub-shop-nav__link:hover,
.ub-shop-nav__link:focus-visible {
    border-color: var(--ub-color-brand);
    background-color: var(--ub-color-hover-tint);
    color: var(--ub-color-accent);
}

.ub-shop-nav__link.is-current {
    border-color: var(--ub-color-accent);
    background-color: var(--ub-color-accent);
    color: var(--ub-color-on-dark);
}

.ub-shop-nav__link.is-current:hover,
.ub-shop-nav__link.is-current:focus-visible {
    border-color: var(--ub-color-accent-hover);
    background-color: var(--ub-color-accent-hover);
    color: var(--ub-color-on-dark);
}

.ub-shop__grid,
.ub-related__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--ub-space-2xl);
    row-gap: var(--ub-space-6xl);
}

@media (min-width: 640px) {
    .ub-shop__grid,
    .ub-related__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .ub-shop__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ub-related__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .ub-shop__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        column-gap: var(--ub-space-3xl);
    }
}

.ub-shop__empty {
    display: grid;
    min-height: var(--ub-size-empty-panel);
    place-items: center;
    padding: var(--ub-space-5xl) var(--ub-space-2xl);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-lg);
    background-color: var(--ub-color-section-soft);
    color: var(--ub-color-body-muted);
    text-align: center;
}

.ub-shop__empty p {
    margin: 0;
}

.ub-shop__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ub-space-xl);
    padding-top: var(--ub-space-7xl);
}

.ub-shop__page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--ub-size-icon-chip-md);
    padding-inline: var(--ub-space-xl);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-pill);
    color: var(--ub-color-heading);
    font-size: var(--ub-text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--ub-transition-fast),
                border-color var(--ub-transition-fast),
                color var(--ub-transition-fast);
}

.ub-shop__page-link:hover,
.ub-shop__page-link:focus-visible {
    border-color: var(--ub-color-accent);
    background-color: var(--ub-color-accent);
    color: var(--ub-color-on-dark);
}

.ub-shop__page-info {
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-sm);
}

@media (max-width: 639px) {
    .ub-shop__header {
        align-items: flex-start;
        flex-direction: column;
        gap: var(--ub-space-xl);
    }
}

/* ============================================================
   PRODUCT CARD — one clear link, calm media, truthful metadata
   ============================================================ */
.ub-product-card {
    position: relative;
    isolation: isolate;
    display: flex;
    height: 100%;
    min-width: 0;
    flex-direction: column;
    gap: var(--ub-space-xl);
}

.ub-product-card__media {
    position: relative;
    min-height: 0;
    aspect-ratio: 4 / 3;
}

.ub-product-card__media-surface {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--ub-color-nav-border);
    border-radius: var(--ub-radius-md);
    transition: transform var(--ub-transition-base),
                border-color var(--ub-transition-base),
                box-shadow var(--ub-transition-base);
}

.ub-product-card__media-surface > .ub-product-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--ub-transition-slow);
}

.ub-product-card__image--placeholder {
    background-color: var(--ub-color-section-cool);
}

.ub-product-card__badge {
    position: absolute;
    z-index: 2;
    top: var(--ub-space-l);
    left: var(--ub-space-l);
    padding: var(--ub-space-xs) var(--ub-space-m);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-page-bg);
    color: var(--ub-color-accent);
    font-size: var(--ub-text-xs);
    font-weight: 600;
    pointer-events: none;
}

.ub-product-card__body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: var(--ub-space-xs);
    padding-inline: var(--ub-space-xs);
}

.ub-product-card__summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--ub-space-l);
}

.ub-product-card__info {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: var(--ub-space-xs);
}

.ub-product-card__name {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ub-color-heading);
    font-size: var(--ub-text-md);
    font-weight: 600;
    line-height: var(--ub-leading-snug);
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ub-product-card__link {
    color: inherit;
    text-decoration: none;
}

.ub-product-card__link::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    content: '';
}

.ub-product-card__sub {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-sm);
    line-height: var(--ub-leading-snug);
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ub-product-card__meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--ub-space-l);
}

.ub-product-card__price {
    margin: 0;
    color: var(--ub-color-heading);
    font-size: var(--ub-text-base);
    font-weight: 600;
    line-height: var(--ub-leading-snug);
}

.ub-product-card__variants {
    display: inline-flex;
    align-items: center;
    min-height: var(--ub-space-2xl);
    padding-inline: var(--ub-space-s);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-section-cool);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-xs);
    font-weight: 500;
    white-space: nowrap;
}

.ub-product-card__cart-form {
    position: relative;
    z-index: 2;
    align-self: center;
    flex: 0 0 auto;
    margin: 0;
}

.ub-product-card__cart {
    width: var(--ub-size-icon-chip-md);
    min-width: var(--ub-size-icon-chip-md);
    height: var(--ub-size-icon-chip-md);
    min-height: var(--ub-size-icon-chip-md);
    justify-content: center;
    padding: 0;
    border-color: var(--ub-color-accent);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-page-bg);
    color: var(--ub-color-accent);
}

.ub-product-card__cart:hover,
.ub-product-card__cart:focus-visible {
    border-color: var(--ub-color-accent-hover);
    background-color: var(--ub-color-page-bg);
    color: var(--ub-color-accent-hover);
}

.ub-product-card:focus-within .ub-product-card__media-surface {
    border-color: var(--ub-color-brand);
    box-shadow: var(--ub-shadow-card-hover);
}

@media (hover: hover) and (pointer: fine) {
    .ub-product-card:hover .ub-product-card__media-surface {
        border-color: var(--ub-color-divider);
        box-shadow: var(--ub-shadow-card-hover);
        transform: translateY(calc(var(--ub-space-xs) * -1));
    }

    .ub-product-card:hover .ub-product-card__image {
        transform: scale(1.015);
    }
}

/* ============================================================
   PRODUCT DETAIL — gallery-led composition and open information column
   ============================================================ */
.ub-product-page {
    padding-top: var(--ub-space-5xl);
    padding-bottom: var(--ub-space-7xl);
}

.ub-product__breadcrumb {
    margin-bottom: var(--ub-space-3xl);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-sm);
}

.ub-product__breadcrumb ol {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--ub-space-s);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ub-product__breadcrumb li {
    display: inline-flex;
    min-width: 0;
    align-items: center;
}

.ub-product__breadcrumb a {
    display: inline-flex;
    min-height: var(--ub-size-icon-chip-md);
    align-items: center;
    color: var(--ub-color-body);
    font-weight: 500;
    text-decoration: none;
}

.ub-product__breadcrumb a:hover,
.ub-product__breadcrumb a:focus-visible {
    color: var(--ub-color-brand-hover);
}

.ub-product__breadcrumb svg {
    color: var(--ub-color-body-muted);
}

.ub-product__breadcrumb-current {
    overflow: hidden;
    color: var(--ub-color-body-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ub-product__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--ub-space-5xl);
}

@media (min-width: 1024px) {
    .ub-product__grid {
        grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
        align-items: start;
    }
}

@media (min-width: 1280px) {
    .ub-product__grid {
        gap: var(--ub-space-6xl);
    }
}

.ub-product__gallery {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--ub-space-xl);
}

.ub-product__hero {
    position: relative;
    display: flex;
    width: 100%;
    aspect-ratio: 4 / 3;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--ub-space-5xl);
    border: 1px solid var(--ub-color-nav-border);
    border-radius: var(--ub-radius-lg);
    background-color: var(--ub-color-section-soft);
    box-shadow: var(--ub-shadow-card);
}

.ub-product__hero--placeholder {
    background-color: var(--ub-color-section-cool);
}

.ub-product__hero-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ub-product__image-counter {
    position: absolute;
    right: var(--ub-space-xl);
    bottom: var(--ub-space-xl);
    display: inline-flex;
    min-height: var(--ub-space-3xl);
    align-items: center;
    padding-inline: var(--ub-space-l);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-page-bg);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-xs);
    font-weight: 600;
    box-shadow: var(--ub-shadow-card);
}

.ub-product__thumbs {
    display: flex;
    gap: var(--ub-space-s);
    overflow-x: auto;
    margin: 0;
    padding: var(--ub-space-xs);
    list-style: none;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.ub-product__thumbs li {
    flex: 0 0 var(--ub-space-7xl);
    scroll-snap-align: start;
}

.ub-product__thumb {
    display: flex;
    width: 100%;
    aspect-ratio: 4 / 3;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--ub-space-s);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-sm);
    background-color: var(--ub-color-page-bg);
    cursor: pointer;
    opacity: 0.72;
    transition: border-color var(--ub-transition-fast),
                opacity var(--ub-transition-fast),
                transform var(--ub-transition-fast);
}

.ub-product__thumb:hover,
.ub-product__thumb:focus-visible,
.ub-product__thumb.is-active {
    border-color: var(--ub-color-brand);
    opacity: 1;
}

.ub-product__thumb:focus-visible {
    outline: 2px solid var(--ub-color-brand);
    outline-offset: var(--ub-space-xs);
}

.ub-product__thumb-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (min-width: 1024px) {
    .ub-product__gallery--with-thumbs {
        position: relative;
        display: block;
        padding-inline-start: calc(var(--ub-space-8xl) + var(--ub-space-xl));
    }

    .ub-product__gallery--with-thumbs .ub-product__thumbs {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: var(--ub-space-8xl);
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .ub-product__gallery--with-thumbs .ub-product__thumbs li {
        flex-basis: auto;
        width: 100%;
    }
}

.ub-product__info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--ub-space-2xl);
}

@media (min-width: 1024px) {
    .ub-product__info {
        position: sticky;
        top: calc(var(--ub-header-height) + var(--ub-space-2xl));
        align-self: start;
        padding-top: var(--ub-space-s);
    }
}

.ub-product__head {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-l);
}

.ub-product__stock {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: var(--ub-space-s);
    margin: 0;
    color: var(--ub-color-accent);
    font-size: var(--ub-text-sm);
    font-weight: 600;
}

.ub-product__stock.is-unavailable {
    color: var(--ub-color-danger-text-strong);
}

.ub-product__stock-dot {
    width: var(--ub-space-s);
    height: var(--ub-space-s);
    flex-shrink: 0;
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-brand);
}

.ub-product__stock.is-unavailable .ub-product__stock-dot {
    background-color: var(--ub-color-danger-text-strong);
}

.ub-product__name {
    margin: 0;
    color: var(--ub-color-heading);
    font-size: clamp(var(--ub-text-2xl), 3vw, var(--ub-text-3xl));
    font-weight: 600;
    line-height: var(--ub-leading-display);
    letter-spacing: var(--ub-tracking-display);
}

.ub-product__price {
    margin: 0;
    color: var(--ub-color-heading);
    font-size: var(--ub-text-xl);
    font-weight: 600;
    line-height: var(--ub-leading-snug);
}

.ub-product__description {
    margin: 0;
    padding-top: var(--ub-space-2xl);
    border-top: 1px solid var(--ub-color-divider);
    color: var(--ub-color-body);
    font-size: var(--ub-text-base);
    line-height: var(--ub-leading-body);
}

.ub-product__variants {
    min-width: 0;
    margin: 0;
    padding: var(--ub-space-2xl) 0 0;
    border: 0;
    border-top: 1px solid var(--ub-color-divider);
}

.ub-product__variant-title,
.ub-product__specs-title {
    margin: 0 0 var(--ub-space-l);
    color: var(--ub-color-heading);
    font-size: var(--ub-text-sm);
    font-weight: 600;
    line-height: var(--ub-leading-snug);
}

.ub-product__variant-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--ub-space-s);
}

@media (min-width: 640px) {
    .ub-product__variant-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ub-product__variant-option {
    display: block;
    min-width: 0;
    cursor: pointer;
}

.ub-product__variant-option-content {
    display: flex;
    min-height: var(--ub-space-6xl);
    align-items: center;
    justify-content: space-between;
    gap: var(--ub-space-l);
    padding: var(--ub-space-l) var(--ub-space-xl);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-sm);
    background-color: var(--ub-color-page-bg);
    transition: background-color var(--ub-transition-fast),
                border-color var(--ub-transition-fast),
                box-shadow var(--ub-transition-fast);
}

.ub-product__variant-option:hover .ub-product__variant-option-content {
    border-color: var(--ub-color-brand);
    background-color: var(--ub-color-hover-tint);
}

.ub-product__variant-option input:checked + .ub-product__variant-option-content {
    border-color: var(--ub-color-brand);
    background-color: var(--ub-color-hover-tint);
}

.ub-product__variant-option input:focus-visible + .ub-product__variant-option-content {
    outline: 2px solid var(--ub-color-brand);
    outline-offset: var(--ub-space-xs);
}

.ub-product__variant-name {
    min-width: 0;
    color: var(--ub-color-heading);
    font-size: var(--ub-text-sm);
    font-weight: 600;
    line-height: var(--ub-leading-snug);
    overflow-wrap: anywhere;
}

.ub-product__variant-price {
    flex-shrink: 0;
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-xs);
    font-weight: 500;
    white-space: nowrap;
}

.ub-product__specs {
    padding-top: var(--ub-space-2xl);
    border-top: 1px solid var(--ub-color-divider);
}

.ub-product__dimensions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--ub-space-s);
    margin: 0;
}

.ub-product__dimensions > div {
    min-width: 0;
    padding: var(--ub-space-l);
    border-radius: var(--ub-radius-xs);
    background-color: var(--ub-color-section-soft);
}

.ub-product__dimensions dt,
.ub-product__dimensions dd {
    margin: 0;
}

.ub-product__dimensions dt {
    margin-bottom: var(--ub-space-xs);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-xs);
}

.ub-product__dimensions dd {
    color: var(--ub-color-heading);
    font-size: var(--ub-text-sm);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ub-product__actions {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-l);
    padding-top: var(--ub-space-2xl);
    border-top: 1px solid var(--ub-color-divider);
}

.ub-product__cart-form {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-xl);
}

.ub-product__cart {
    width: 100%;
    justify-content: center;
}

.ub-product__cart[disabled],
.ub-product__cart[aria-disabled='true'] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.ub-product__phone-order {
    display: inline-flex;
    min-height: var(--ub-size-icon-chip-md);
    align-items: center;
    justify-content: center;
    gap: var(--ub-space-s);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-sm);
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: color var(--ub-transition-fast);
}

.ub-product__phone-order:hover,
.ub-product__phone-order:focus-visible {
    color: var(--ub-color-brand-hover);
}

/* ============================================================
   RELATED PRODUCTS — a deliberate soft band, not a second page gap
   ============================================================ */
.ub-related-section {
    padding-block: var(--ub-space-7xl);
    border-bottom: 1px solid var(--ub-color-divider);
}

.ub-related {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-5xl);
}

.ub-related__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--ub-space-l);
}

.ub-related__header .ub-eyebrow {
    margin: 0;
}

.ub-related__title {
    margin: 0;
    color: var(--ub-color-heading);
    font-size: var(--ub-text-3xl);
    font-weight: 600;
    line-height: var(--ub-leading-display);
    letter-spacing: var(--ub-tracking-display);
}

@media (max-width: 639px) {
    .ub-product-page {
        padding-top: var(--ub-space-2xl);
    }

    .ub-product__breadcrumb {
        margin-bottom: var(--ub-space-2xl);
    }

    .ub-product__hero {
        padding: var(--ub-space-2xl);
        border-radius: var(--ub-radius-md);
    }

    .ub-product__dimensions {
        grid-template-columns: minmax(0, 1fr);
    }

    .ub-related-section {
        padding-block: var(--ub-space-6xl);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ub-product-card__media-surface,
    .ub-product-card__image,
    .ub-product__thumb {
        transition: none;
        transform: none;
    }
}
