:root {
    --wr-paper: #f3eee6;
    --wr-ink: #183f40;
    --wr-rose: #b83f58;
    --wr-rose-deep: #9a3048;
    --wr-muted: #6d615a;
    --wr-product-rule: rgba(24, 63, 64, 0.2);
}

.wr-products-page,
.wr-product-detail-page {
    background: var(--wr-paper);
}

.products-hero {
    border-bottom: 1px solid var(--wr-product-rule);
    padding: 1.4rem 0 1.15rem;
}

.products-hero__copy {
    max-width: 42rem;
}

.products-hero h1 {
    color: var(--wr-ink);
    font-family: "Noto Sans TC", sans-serif;
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin: 0;
}

.products-hero__copy > p {
    color: var(--wr-muted);
    font-size: 1rem;
    line-height: 1.65;
    margin: 0.55rem 0 0;
}

.products-page,
.product-detail-page {
    max-width: 1320px;
}

.products-page {
    padding-bottom: 6.5rem;
    padding-top: 1rem;
}

.shopping-layout,
.shopping-layout__main,
.shopping-layout__aside {
    min-width: 0;
}

.shopping-layout {
    display: grid;
    gap: 2rem;
}

.shopping-layout__aside {
    display: none;
}

.products-toolbar {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto minmax(0, 1fr);
    margin-bottom: 0.9rem;
}

.products-toolbar__count {
    color: var(--wr-muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.product-filter-form {
    justify-self: end;
    width: min(100%, 14rem);
}

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

.product-filter-form__controls {
    display: flex;
    gap: 0.45rem;
}

.product-filter-form .form-select {
    background-color: rgba(255, 253, 248, 0.78);
    border: 1px solid rgba(24, 63, 64, 0.4);
    border-radius: 6px;
    color: var(--wr-ink);
    font-size: 1rem;
    min-height: 46px;
    min-width: 0;
    width: 100%;
}

.product-filter-submit,
.products-empty .btn {
    align-items: center;
    background: transparent;
    border: 1px solid var(--wr-ink);
    border-radius: 6px;
    color: var(--wr-ink);
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 46px;
    padding: 0.55rem 0.8rem;
    white-space: nowrap;
}

.product-filter-submit.visually-hidden {
    display: none !important;
}

.product-filter-submit:hover,
.product-filter-submit:focus-visible,
.products-empty .btn:hover,
.products-empty .btn:focus-visible {
    background: var(--wr-ink);
    border-color: var(--wr-ink);
    color: var(--wr-paper);
}

.product-grid {
    border-top: 1px solid var(--wr-product-rule);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.product-card {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--wr-product-rule);
    border-radius: 0;
    display: grid;
    gap: 0.9rem;
    grid-template-columns: 7.25rem minmax(0, 1fr);
    min-width: 0;
    padding: 1rem 0;
}

.product-card__media {
    align-self: start;
    aspect-ratio: 1;
    background: rgba(24, 63, 64, 0.06);
    border: 1px solid rgba(24, 63, 64, 0.16);
    border-radius: 6px;
    display: block;
    overflow: hidden;
    position: relative;
}

.product-card__image {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.product-image-placeholder {
    align-items: center;
    color: var(--wr-muted);
    display: flex;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 700;
    height: 100%;
    justify-content: center;
    letter-spacing: 0.08em;
    min-height: 7rem;
    width: 100%;
}

.product-image-placeholder .bi::before {
    content: "WR";
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.product-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-type-pill {
    color: var(--wr-muted);
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card__heading {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.product-card__title {
    font-family: "Noto Sans TC", sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.45;
    margin: 0;
    min-width: 0;
}

.product-card__title a {
    color: var(--wr-ink);
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.product-card__title a:hover,
.product-card__title a:focus-visible {
    color: var(--wr-rose-deep);
}

.product-price,
.product-detail-card__price,
.product-detail-mobile-purchase strong {
    color: var(--wr-rose-deep);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    white-space: nowrap;
}

.product-card__description {
    color: var(--wr-muted);
    display: none;
    font-size: 0.9375rem;
    line-height: 1.65;
    margin: 0.6rem 0 0;
}

.product-card__actions {
    margin-top: 0.75rem;
}

.product-add-button,
.product-variant-link,
.product-detail-mobile-purchase .btn {
    align-items: center;
    background: var(--wr-rose);
    border: 1px solid var(--wr-rose);
    border-radius: 6px;
    box-shadow: none;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    gap: 0.3rem;
    justify-content: center;
    min-height: 46px;
    padding: 0.55rem 0.75rem;
    text-decoration: none;
}

.product-add-button:hover,
.product-add-button:focus-visible,
.product-variant-link:hover,
.product-variant-link:focus-visible,
.product-detail-mobile-purchase .btn:hover,
.product-detail-mobile-purchase .btn:focus-visible {
    background: var(--wr-rose-deep);
    border-color: var(--wr-rose-deep);
    box-shadow: none;
    color: #fff;
    transform: none;
}

.product-cart-control .quantity-stepper {
    width: 100%;
}

.product-cart-control [hidden] {
    display: none !important;
}

.product-purchase-closed {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.product-purchase-closed a {
    align-content: center;
    color: var(--wr-rose-deep);
    min-height: 44px;
}

.products-empty {
    align-items: flex-start;
    border-bottom: 1px solid var(--wr-product-rule);
    border-top: 1px solid var(--wr-product-rule);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 15rem;
    padding: 2rem 0;
}

.products-empty h2 {
    color: var(--wr-ink);
    font-family: "Noto Sans TC", sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.products-empty p {
    color: var(--wr-muted);
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 1.1rem;
    max-width: 34rem;
}

.mobile-cart-bar {
    align-items: center;
    background: var(--wr-ink);
    border: 1px solid var(--wr-ink);
    border-radius: 6px;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    color: var(--wr-paper);
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(0, 1fr) auto auto;
    left: max(0.75rem, env(safe-area-inset-left));
    min-height: 58px;
    padding: 0.7rem 0.9rem;
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right));
    text-decoration: none;
    z-index: 1025;
}

.mobile-cart-bar:hover,
.mobile-cart-bar:focus-visible {
    background: var(--wr-rose-deep);
    border-color: var(--wr-rose-deep);
    color: var(--wr-paper);
}

.mobile-cart-bar > span:first-child {
    font-weight: 700;
}

.mobile-cart-bar > span:nth-child(2) {
    font-size: 0.875rem;
}

.mobile-cart-bar strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-align: right;
}

.wr-products-page .wr-site-footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

.wr-products-page .cart-toast-container {
    bottom: calc(max(0.75rem, env(safe-area-inset-bottom)) + 4.6rem);
}

.product-detail-page {
    padding-bottom: 7rem;
    padding-top: 0.6rem;
}

.product-breadcrumb {
    margin-bottom: 0.6rem;
}

.product-breadcrumb a {
    align-items: center;
    color: var(--wr-muted);
    display: inline-flex;
    font-size: 0.9375rem;
    font-weight: 500;
    gap: 0.35rem;
    min-height: 44px;
    text-decoration: none;
}

.product-breadcrumb a:hover,
.product-breadcrumb a:focus-visible {
    color: var(--wr-rose-deep);
}

.product-detail-card {
    display: grid;
    gap: 1.2rem;
    padding-bottom: 1.5rem;
}

.product-detail-card__media {
    aspect-ratio: 4 / 3;
    background: rgba(24, 63, 64, 0.06);
    border: 1px solid rgba(24, 63, 64, 0.16);
    border-radius: 6px;
    display: grid;
    overflow: hidden;
    place-items: center;
}

.product-detail-card__media img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.product-detail-card__content {
    min-width: 0;
}

.product-detail-card h1 {
    color: var(--wr-ink);
    font-family: "Noto Sans TC", sans-serif;
    font-size: clamp(1.8rem, 8vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin: 0.25rem 0 0.35rem;
    overflow-wrap: anywhere;
}

.product-detail-card__price {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.product-detail-card__description {
    border-top: 1px solid var(--wr-product-rule);
    color: var(--wr-muted);
    font-size: 1rem;
    line-height: 1.75;
    margin: 0;
    padding: 1rem 0;
}

.product-detail-card__description p:last-child {
    margin-bottom: 0;
}

.product-detail-card__purchase {
    border-top: 1px solid var(--wr-product-rule);
    margin-top: 0.9rem;
    padding-top: 1rem;
}

.product-variant-picker {
    border: 0;
    margin: 0.8rem 0 0;
    min-width: 0;
    padding: 0;
}

.product-variant-picker legend,
.product-variant-preview > p {
    color: var(--wr-ink);
    float: none;
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 0.55rem;
    width: auto;
}

.product-variant-picker legend span {
    color: var(--wr-rose-deep);
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

.product-variant-options {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-variant-option {
    cursor: pointer;
    min-width: 0;
    position: relative;
}

.product-variant-option input {
    height: 1px;
    left: 0.75rem;
    opacity: 0;
    position: absolute;
    top: 50%;
    width: 1px;
}

.product-variant-option > span {
    align-items: center;
    background: rgba(255, 253, 248, 0.65);
    border: 1px solid rgba(24, 63, 64, 0.35);
    border-radius: 6px;
    color: var(--wr-ink);
    display: flex;
    gap: 0.45rem;
    justify-content: space-between;
    min-height: 46px;
    padding: 0.55rem 0.7rem;
}

.product-variant-option b {
    font-size: 0.9375rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.product-variant-option small {
    color: var(--wr-muted);
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
}

.product-variant-option input:checked + span {
    background: rgba(184, 63, 88, 0.09);
    border-color: var(--wr-rose);
    box-shadow: inset 0 0 0 1px var(--wr-rose);
    color: var(--wr-rose-deep);
}

.product-variant-option input:focus-visible + span {
    outline: 3px solid rgba(184, 63, 88, 0.3);
    outline-offset: 2px;
}

.product-variant-picker__help,
.product-variant-prompt {
    color: var(--wr-muted);
    font-size: 0.875rem;
    line-height: 1.55;
    margin: 0.5rem 0 0;
}

.product-variant-purchases {
    display: grid;
    gap: 0.7rem;
}

.product-variant-purchase {
    border: 1px solid var(--wr-product-rule);
    border-radius: 6px;
    padding: 0.75rem;
}

.product-variant-purchase[hidden] {
    display: none;
}

.product-variant-purchase h2 {
    color: var(--wr-ink);
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.product-variant-purchases.is-enhanced .product-variant-purchase {
    border: 0;
    padding: 0;
}

.product-variant-purchases.is-enhanced .product-variant-purchase h2 {
    display: none;
}

.product-variant-preview {
    margin-top: 0.8rem;
}

.product-variant-unavailable {
    background: rgba(24, 63, 64, 0.06);
    border: 1px solid var(--wr-product-rule);
    border-radius: 6px;
    color: var(--wr-muted);
    display: grid;
    font-size: 0.875rem;
    gap: 0.15rem;
    margin-top: 0.8rem;
    padding: 0.7rem 0.8rem;
}

.product-variant-unavailable strong {
    color: var(--wr-ink);
}

.product-variant-preview ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.product-variant-preview li {
    border: 1px solid var(--wr-product-rule);
    border-radius: 999px;
    color: var(--wr-ink);
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
}

.product-variant-preview > span {
    color: var(--wr-muted);
    font-size: 0.875rem;
}

.product-detail-card .product-cart-control .quantity-stepper {
    grid-template-columns: 3rem minmax(3.5rem, 1fr) 3rem;
    width: min(100%, 11.5rem);
}

.product-detail-card__purchase-label {
    color: var(--wr-ink);
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.product-detail-card__helper {
    color: var(--wr-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0.7rem 0 0;
}

.product-detail-mobile-purchase {
    display: none;
}

.wr-product-detail-page .wr-site-footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

.wr-product-detail-page .cart-toast-container {
    bottom: calc(max(0.75rem, env(safe-area-inset-bottom)) + 4.75rem);
}

@media (max-width: 359.98px) {
    .product-card {
        gap: 0.75rem;
        grid-template-columns: 6.35rem minmax(0, 1fr);
    }

    .mobile-cart-bar {
        gap: 0.4rem;
        padding-inline: 0.7rem;
    }
}

@media (max-width: 767.98px) {
    .cart-enhanced .product-detail-card__purchase {
        display: none;
    }

    .cart-enhanced .product-detail-mobile-purchase {
        align-items: center;
        background: rgba(243, 238, 230, 0.98);
        border-top: 1px solid var(--wr-ink);
        bottom: 0;
        display: flex;
        gap: 0.75rem;
        justify-content: space-between;
        left: 0;
        padding: 0.65rem max(1rem, env(safe-area-inset-left)) max(0.65rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
        position: fixed;
        right: 0;
        z-index: 1025;
    }

    .product-detail-mobile-purchase > div {
        min-width: 0;
    }

    .product-detail-mobile-purchase span {
        color: var(--wr-muted);
        display: block;
        font-size: 0.875rem;
        max-width: 9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .product-detail-mobile-purchase .btn {
        flex: 0 0 auto;
        min-height: 48px;
    }

    .product-detail-mobile-purchase .btn:disabled {
        background: #867b74;
        border-color: #867b74;
        cursor: not-allowed;
        opacity: 1;
    }
}

@media (min-width: 576px) {
    .product-grid {
        gap: 1.5rem 1rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-card {
        border: 0;
        border-bottom: 1px solid var(--wr-product-rule);
        display: flex;
        flex-direction: column;
        padding: 0 0 1.2rem;
    }

    .product-card__media {
        aspect-ratio: 4 / 3;
        width: 100%;
    }

    .product-card__body {
        flex: 1;
        padding-top: 0.8rem;
    }

    .product-card__heading {
        align-items: baseline;
        flex-direction: row;
        gap: 0.75rem;
        justify-content: space-between;
    }

    .product-card__description {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .product-card__actions {
        margin-top: auto;
        padding-top: 1rem;
    }

    .mobile-cart-bar {
        left: 50%;
        max-width: 34rem;
        right: auto;
        transform: translateX(-50%);
        width: calc(100% - 2rem);
    }
}

@media (min-width: 768px) {
    .products-hero {
        padding: 2rem 0 1.6rem;
    }

    .products-page,
    .product-detail-page {
        padding-top: 1.5rem;
    }

    .products-toolbar {
        margin-bottom: 1.25rem;
    }

    .product-detail-card {
        align-items: start;
        gap: 2rem;
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    }

    .product-detail-card__media {
        aspect-ratio: 1;
        max-height: min(32rem, calc(100svh - 10rem));
    }
}

@media (min-width: 1200px) {
    .shopping-layout {
        align-items: start;
        grid-template-columns: minmax(0, 2fr) minmax(21rem, 1fr);
    }

    .shopping-layout__aside {
        display: block;
        position: sticky;
        top: 6rem;
    }

    .mobile-cart-bar {
        display: none;
    }

    .products-page {
        padding-bottom: 4rem;
    }

    .wr-products-page .wr-site-footer,
    .wr-product-detail-page .wr-site-footer {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .product-detail-card {
        gap: clamp(1.25rem, 2vw, 2rem);
        grid-template-columns: minmax(16rem, 0.95fr) minmax(18rem, 1.05fr);
    }

    .product-detail-card__media {
        aspect-ratio: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-card__image,
    .product-detail-mobile-purchase {
        transition: none;
    }
}
