/* Kottke.org Dry Goods - Unified Shop Styles */

/* Page Header */
.goods-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.goods-header h2 {
    margin: 0;
}

/* Item page header: back link on the left, cart toggle on the right. */
.goods-header-item {
    justify-content: space-between;
}

/* Products Grid - 2 columns */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* Product Card */
.product-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border: 0.5px solid rgba(var(--color-text-rgb), 0.2);
    border-radius: 0.75rem;
}

[data-theme="dark"] .product-card {
    border-color: rgba(var(--color-text-rgb), 0.1);
}

.product-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--goods-img-color-bk);
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    padding: var(--goods-img-pad);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.product-card[data-available="false"] .product-image img {
    filter: grayscale(0.5);
    opacity: 0.7;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: clamp(1.9rem, 2.0vw, 2.2rem);
    margin: 0 0 0.5rem 0;
    color: var(--color-text);
}

/* Fourthwall cards link through to the item detail page */
.product-image-link,
.product-title-link,
.product-title-link:link,
.product-title-link:visited {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image-link .product-image {
    transition: opacity 0.2s ease;
}

.product-image-link:hover .product-image {
    opacity: 0.85;
}

.product-title-link:hover .product-title {
    text-decoration: underline;
}

.product-description {
    font-size: 1.7rem;
    line-height: 1.3;
    color: var(--color-text-lighter);
    margin: 0 0 1rem 0;
}

.product-buy-btn {
    margin-top: auto;
}

/* Variant Select - Legacy dropdowns */
.variant-select {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(var(--color-text-rgb), 0.2);
    border-radius: 6px;
    font-size: 1.9rem;
    background: var(--color-background);
    color: var(--color-text);
    cursor: pointer;
}

.variant-select:focus {
    outline: none;
    border-color: var(--color-text);
}

/* Option Groups (chips and buttons) */
.variant-options,
.cb-variant-options,
.option-group {
    margin-bottom: 1.25rem;
}

.variant-options,
.cb-variant-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.option-label {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-lighter);
}

.selected-color-name {
    font-weight: 400;
    text-transform: none;
}

/* "Size guide" link next to the SIZE label (resets the label's uppercase) */
.size-guide-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-lighter);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.size-guide-link:hover {
    color: var(--color-text);
}

.cb-size-note {
    font-size: 1.4rem;
    color: var(--color-text-lighter);
    font-style: italic;
}

/* Color Chips */
.color-chips {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.3rem;
}

.color-chip {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(var(--color-text-rgb), 0.2);
    cursor: pointer;
    padding: 0;
    position: relative;
}

.color-chip:hover {
    border-color: rgba(var(--color-text-rgb), 0.5);
}

.color-chip.selected {
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px var(--color-background), 0 0 0 3px var(--color-text);
}

.color-chip.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
}

.color-chip.unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 1px;
    background: rgba(var(--color-text-rgb), 0.5);
    transform: rotate(-45deg);
}

/* Size Buttons */
.size-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.size-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(var(--color-text-rgb), 0.2);
    background: var(--color-background);
    color: var(--color-text);
    font-size: 1.4rem;
    font-weight: 500;
    cursor: pointer;
}

.size-btn:hover:not(.unavailable) {
    border-color: rgba(var(--color-text-rgb), 0.5);
}

.size-btn.selected {
    border-color: var(--color-text);
    background: var(--color-text);
    color: var(--color-background);
}

.size-btn.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Buy Button - Uses text/background colors */
.product-buy-btn,
a.product-buy-btn,
a.product-buy-btn:link,
a.product-buy-btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1.3rem 1.5rem;
    background: var(--color-text);
    color: var(--color-background) !important;
    border: 1px solid var(--color-text);
    border-radius: 0.75rem;
    font-size: 1.9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.product-buy-btn:hover,
a.product-buy-btn:hover {
    opacity: 0.8;
    color: var(--color-background) !important;
}

.product-buy-btn:disabled {
    background: rgba(var(--color-text-rgb), 0.3);
    color: rgba(var(--color-text-rgb), 0.5) !important;
    border-color: rgba(var(--color-text-rgb), 0.2);
    cursor: not-allowed;
}

.product-buy-btn .fa-arrow-up-right-from-square {
    font-size: 1.5rem;
    margin-left: 0.5rem;
}

.product-fine-print {
    display: none;
    font-size: 1.2rem;
    color: var(--color-text-lighter);
    text-align: center;
    margin: 0.5rem 0 0 0;
}

/* Loading State */
.loading-products {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-lighter);
    padding: 3rem;
    font-size: var(--main-font-size);
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-lighter);
    padding: 3rem;
}

/* Cart Modal */
.shop-cart-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--color-modal-bk);
}

.shop-cart-overlay.open {
    display: flex;
}

.shop-cart {
    background: var(--color-background);
    color: var(--color-text);
    width: calc(100% - 2rem);
    max-width: 42rem;
    max-height: calc(100vh - 4rem);
    padding: 2rem;
    border-radius: 1.2rem;
    display: flex;
    flex-direction: column;
}

.shop-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--color-text-rgb), 0.15);
}

.shop-cart-header h3 {
    margin: 0 0 0.5px 0;
    font-size: 2.2rem;
    font-weight: 400;
}

.shop-cart-close {
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-lighter);
    padding: 0;
}

.shop-cart-close:hover {
    color: var(--color-text);
}

.shop-cart-items {
    flex: 1;
    overflow-y: auto;
}

.cart-empty {
    color: var(--color-text-lighter);
    text-align: center;
    padding: 2rem 0;
    font-size: 1.7rem;
}

.cart-line-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0 1.5rem;
    border-bottom: 1px solid rgba(var(--color-text-rgb), 0.15);
}

.cart-line-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    display: block;
    font-size: 2.0rem;
    line-height: 1;
    font-weight: 400;
    margin-bottom: 0.3rem;
}

.cart-item-variant {
    display: block;
    font-size: 1.5rem;
    color: var(--color-text-lighter);
}

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

.cart-qty-widget {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid rgba(var(--color-text-rgb), 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.cart-qty-btn {
    background: rgba(var(--color-text-rgb), 0.05);
    border: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--color-text-lighter);
}

.cart-qty-btn:hover {
    background: rgba(var(--color-text-rgb), 0.1);
    color: var(--color-text);
}

.cart-qty-value {
    font-size: 1.4rem;
    min-width: 28px;
    text-align: center;
    padding: 0 0.25rem;
}

.cart-item-price {
    font-size: 2.0rem;
    font-weight: 400;
    white-space: nowrap;
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: rgba(var(--color-text-rgb), 0.4);
    cursor: pointer;
    padding: 0;
}

.cart-item-remove:hover {
    color: #c53030;
}

.cart-item-remove i {
    margin-right: 0.3rem;
}

.shop-cart-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(var(--color-text-rgb), 0.15);
}

.shop-cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-size: 2.0rem;
    font-weight: 500;
}

.shop-cart-checkout {
    width: 100%;
    padding: 1rem;
    background: var(--color-text);
    color: var(--color-background);
    border: none;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.shop-cart-checkout:hover:not(:disabled) {
    opacity: 0.8;
}

.shop-cart-checkout:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cart Toggle Button - Header */
.shop-cart-toggle {
    position: relative;
    background: none;
    color: var(--color-text);
    border: none;
    font-size: 2.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-right: 1rem;
    transition: color 0.2s ease;
}

.shop-cart-toggle:hover {
    color: var(--color-text-lighter);
}

.shop-cart-count {
    position: absolute;
    top: -10px;
    right: -12px;
    background: #c53030;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 400;
    min-width: 21px;
    height: 21px;
    border-radius: 50%;
    border: 2px solid var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 20px;
}

/* ===== Size Guide Modal ===== */
.size-guide-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--color-modal-bk);
}

.size-guide-overlay.open {
    display: flex;
}

.size-guide-modal {
    background: var(--color-background);
    color: var(--color-text);
    width: calc(100% - 2rem);
    max-width: 48rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 2rem;
    border-radius: 1.2rem;
}

.size-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.size-guide-header h3 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 400;
}

.size-guide-close {
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-lighter);
    padding: 0;
}

.size-guide-close:hover {
    color: var(--color-text);
}

.size-guide-shirt-type {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.size-guide-desc {
    font-size: 1.6rem;
    line-height: 1.45;
    color: var(--color-text-lighter);
    margin: 0 0 1.75rem 0;
}

.size-guide-tabs {
    display: flex;
    gap: 1.75rem;
    border-bottom: 1px solid rgba(var(--color-text-rgb), 0.15);
    margin-bottom: 0.5rem;
}

.size-guide-tab {
    background: none;
    border: none;
    padding: 0 0 0.75rem 0;
    margin-bottom: -1px;
    font-size: 1.6rem;
    color: var(--color-text-lighter);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.size-guide-tab.selected {
    color: var(--color-text);
    font-weight: 600;
    border-bottom-color: var(--color-text);
}

.size-guide-table {
    width: 100%;
    border-collapse: collapse;
}

.size-guide-table th {
    text-align: left;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-lighter);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(var(--color-text-rgb), 0.15);
}

.size-guide-table td {
    font-size: 1.6rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(var(--color-text-rgb), 0.08);
}

.size-guide-table tr:last-child td {
    border-bottom: none;
}

.size-guide-note {
    font-size: 1.3rem;
    color: var(--color-text-lighter);
    margin: 1.25rem 0 0 0;
}

/* ===== Item Detail Page ===== */
.product-detail {
    margin-bottom: 4rem;
}

.detail-back {
    font-size: 1.5rem;
    margin: 0;
}

/* Side padding shrinks the square photo (so it's shorter) on wide screens,
   easing to zero as the column — and the window — gets narrower. */
.detail-gallery {
    padding-inline: clamp(0rem, calc((100% - 44rem) / 2), 6rem);
}

/* Full-width main photo */
.detail-main-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--goods-img-color-bk);
    border-radius: 0.75rem;
    padding: var(--goods-img-pad);
}

.detail-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Info block sits underneath the photo, full container width */
.detail-info {
    margin-top: 2rem;
}

.detail-title {
    font-size: 2.8rem;
    line-height: 1.1;
    margin: 0 0 1rem 0;
    color: var(--color-text);
}

.detail-description {
    font-size: 1.8rem;
    line-height: 1.4;
    color: var(--color-text-lighter);
    margin: 0 0 2rem 0;
}

.detail-description p {
    margin: 0 0 1rem 0;
}

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

.detail-info .variant-options {
    margin-bottom: 2rem;
}

.detail-info .product-buy-btn {
    margin-top: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .shop-cart {
        max-width: 100%;
        max-height: calc(100vh - 2rem);
        padding: 1.5rem;
    }

}
