/* Shop storefront styles */
/* The storefront's single stylesheet: tokens, base, layout, cards and shop
   components. Consolidated from the parent site's main.css + cards.css +
   shop.css — only the rules the shop actually renders. Linked with
   ?v=<mtime> via shopAssetUrl() (config/paths.php), so edits and deploys
   are never served from browser cache. */

/* ================================
   CSS CUSTOM PROPERTIES
   ================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=Red+Hat+Mono:wght@400;500&display=swap');

:root {
    /* Colors */
    --color-blue: #003AA6;
    --color-orange: #C8501C;
    --color-brown: #430400;
    --color-peachy: #FAF5EF;

    --color-teal: #A8E5E5;
    --color-beige: #F5E8D3;

    --color-white: #ffffff;
    --color-border: #ddd;
    --color-gray: #666;
    --color-dark: #2d2626;

    /* Typography */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-heading: 'Fraunces', serif;
    --font-family-mono: 'Red Hat Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* Typography Scale */
    --font-size-xs: 0.82rem; /* 13px */
    --font-size-sm: 0.9rem; /* 14px */
    --font-size-base: 1rem; /* 16px */
    --font-size-md: 1.15rem; /* 18px */
    --font-size-lg: 1.2rem; /* 19px */
    --font-size-xl: 1.8rem; /* 21px */
    --font-size-2xl: 3rem; /* 48px */

    /* Line Heights */
    --line-height-tight: 1.1;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Letter Spacing */
    --letter-spacing-tight: -0.025em;
    --letter-spacing-wide: 0.025em;

    /* Layout Spacing */
    --container-wide: 1280px;
    --container-max: 1600px; /* hero band + top bar content edge */
    --container-normal: 1100px;
    --container-narrow: 800px;
    --container-spacing: 2rem;

    /* Misc Spacing */
    --spacing-xs: 0.23rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --border-radius-sm: 4px;
    --border-radius-lg: 6px;
    --border-radius-xl: 10px;

    /* Shadows */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

    /* Storefront chrome (top bar + footer). A merchant's look = these four. */
    --shop-bar-bg: var(--color-brown);
    --shop-bar-fg: var(--color-white);
    --shop-bar-logo-bg: var(--color-white);
    --shop-footer-bg: var(--color-orange);
    --shop-footer-fg: var(--color-white);
}

/* ================================
   RESET & BASE STYLES
   ================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* In-page anchors (homepage collection strip) must land below the sticky bar */
html {
    scroll-padding-top: calc(4rem + var(--spacing-md));
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    font-weight: var(--font-weight-normal);
    color: var(--color-brown);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container { padding-inline: var(--container-spacing); }
.header-container { padding-inline: var(--spacing-lg); margin-bottom: var(--spacing-sm); }
.page-header { margin-top: var(--spacing-lg); }

/* ================================
   TYPOGRAPHY
   ================================ */

/* Merchant rich text (listing descriptions, policies) can emit p, h3,
   strong, em, a, ul, ol, li — keep those element rules even where the
   templates themselves don't use the tag. */

h1 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-2xl);
    color: #390300;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: var(--spacing-xl);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis: none;
}

h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-snug);
    letter-spacing: var(--letter-spacing-tight);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

h3, h4 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-snug);
    color: var(--color-brown);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}
h3 { color: var(--color-blue); }

h6 {
    font-size: var(--font-size-sm);
}

h1:first-child, h2:first-child, h3:first-child, h4:first-child {
    margin-top: 0;
}

p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--spacing-lg);
}

section {
    margin-bottom: var(--spacing-xl);
}

section p:last-child {
    margin-bottom: 0;
}

strong {
    font-weight: var(--font-weight-semibold);
}

em {
    font-style: italic;
}

ul, ol {
    margin: var(--spacing-md) 0 var(--spacing-lg) 0;
    padding-left: var(--spacing-lg);
}

li {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--spacing-sm);
    max-width: 60ch;
}

ul ul, ol ol, ul ol, ol ul {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

p + ul, p + ol {
    margin-top: calc(-1 * var(--spacing-sm));
}

.subtitle {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-orange);
    margin-bottom: var(--spacing-xs);
}

.text-small {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    margin: var(--spacing-sm) 0;
}

.text-center {
    text-align: center;
}

/* ================================
   MEDIA STYLING
   ================================ */

img {
    width: 100%;
    height: auto;
}

/* ================================
   LINKS & BUTTONS
   ================================ */

a {
    color: var(--color-orange);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* External-link icon — absolute links to our own domain (blog, legacy
   /ptwatercraft/ pages) are excluded so only truly-external links get it.
   .plain opts a link out (the top bar's business-name crumb). */
[href^="http"]:not([href*="//ptwatercraft.com"]):not([href*="//www.ptwatercraft.com"]):not(.plain)::after {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.2em;
    background-color: currentColor;
    mask-image: url(external.svg);
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    vertical-align: -0.13em;
}

.btn {
    display: inline-block;
    width: fit-content;
    margin-block: var(--spacing-sm) 0;
    margin-inline: 0;
    padding-block: var(--spacing-md);
    padding-inline: var(--spacing-lg);
    background: var(--color-brown);
    border-radius: var(--border-radius-sm);
    border: none;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    color: var(--color-white);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    line-height: 0.95;
    letter-spacing: var(--letter-spacing-wide);
    text-align: center;
    cursor: pointer;
    transition: scale 0.2s ease, filter 0.2s ease;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: auto;
}

.btn:hover, .btn-icon:hover {
    text-decoration: none;
    filter: brightness(0.97) sepia(0.05);
    scale: 1.01;
}

.btn-wide {
    width: 100%;
}

.btn-secondary {
    background: var(--color-beige);
    color: var(--color-dark);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    border: 0;
    border-radius: var(--border-radius-sm);
    background: white;
    line-height: 0;
    cursor: pointer;
    transition: scale 0.2s ease, filter 0.2s ease;
}

.btn-icon img, .btn-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0;
    box-shadow: none;
    color: var(--color-brown);
}

button:disabled {
    background: var(--color-gray);
    color: var(--color-white);
    cursor: not-allowed;
    opacity: 0.6;
}

button:disabled:hover {
    filter: none;
    scale: 1;
}

/* ================================
   LAYOUT
   ================================ */

/* Main content container */
.container {
    max-width: var(--container-normal);
    margin-inline: auto;
    margin-block: 0 3.125rem;
    padding-top: 5rem;
    text-align: left;
    position: relative;
    overflow: hidden;
}

body.has-page-header .container { padding-top: 0; }
.container.narrow, .header-content.narrow { max-width: var(--container-narrow); }

.page-content-centered {
    margin: 0 auto;
}

/* ================================
   SUB-NAV
   ================================ */

/* Homepage collection strip */
.sub-nav {
    font-family: var(--font-family-mono);
    margin-block: var(--spacing-2xl);
}

.sub-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: start;
    align-items: center;
    column-gap: var(--spacing-2xl);
    row-gap: var(--spacing-md);
}

.sub-nav li {
    padding: 0;
}

.sub-nav a {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
}

.sub-nav .btn {
    margin: 0;
}

/* ================================
   HEADERS
   ================================ */

/* Homepage hero — content centred in the band */
.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 375px;
    max-width: var(--container-max);
    margin-inline: auto;
    border-radius: var(--border-radius-lg);
}

.page-header .header-content {
    width: 100%;
}

.page-header h1 {
    margin-bottom: 0;
}

.page-header-tight {
    position: relative;
}

.header-content {
    max-width: var(--container-wide);
    margin: 0 auto;
}

/* ================================
   TOP BAR
   ================================ */

/* Sticky bar: logo tile (when the store has one) + breadcrumb trail left,
   Cart button right. Colours come from the --shop-bar-* tokens. */
.shop-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    height: 4rem;
    /* Background is full-bleed; content aligns to the hero's edges (the
       hero is capped at --container-max, inset by the page gutter) */
    padding-inline: max(var(--spacing-lg), (100% - var(--container-max)) / 2);
    background: var(--shop-bar-bg);
    color: var(--shop-bar-fg);
}

.shop-bar-start {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
    overflow: hidden;
}

.shop-bar-logo {
    display: flex;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: var(--spacing-xs);
    background-color: var(--shop-bar-logo-bg);
    border-radius: var(--border-radius-sm);
}

.shop-bar-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shop-bar nav {
    min-width: 0;
}

.crumbs {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.crumbs li {
    flex-shrink: 0;
    margin: 0;
    max-width: none;
    white-space: nowrap;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    letter-spacing: var(--letter-spacing-wide);
}

/* Only the last crumb (a long listing title) gives way, with an ellipsis */
.crumbs li:last-child {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crumbs li + li::before {
    content: "/";
    margin-inline: var(--spacing-sm);
    opacity: 0.6;
}

.crumbs a {
    color: var(--shop-bar-fg);
    font-weight: var(--font-weight-normal);
}

/* Current page (no link) reads one step brighter than the trail */
.crumbs [aria-current] {
    font-weight: var(--font-weight-medium);
}

.shop-bar .cart {
    flex-shrink: 0;
    padding-block: 0.6rem;
    font-family: var(--font-family-mono);
}

/* ================================
   FOOTER
   ================================ */

.shop-footer {
    background: var(--shop-footer-bg);
    color: var(--shop-footer-fg);
}

.shop-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg) var(--spacing-2xl);
    width: min(var(--container-normal), 100% - 2 * var(--container-spacing));
    margin-inline: auto;
    padding-block: 3.75rem;
}

.shop-footer-name {
    margin: 0;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

.shop-footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm) var(--spacing-2xl);
    margin: 0;
    padding: 0;
    list-style: none;
}

.shop-footer li {
    margin: 0;
    max-width: none;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.shop-footer a {
    color: var(--shop-footer-fg);
    font-weight: var(--font-weight-normal);
}

/* ================================
   RESPONSIVE DESIGN (base)
   ================================ */

@media (max-width: 767px) {
    /* Typography */
    h1 {
        font-size: 2.2rem;
        margin-bottom: var(--spacing-xl);
    }

    h2 {
        font-size: var(--font-size-lg);
    }

    /* Sub nav */
    .sub-nav ul {
        justify-content: center;
        column-gap: var(--spacing-xl);
        row-gap: 0;
    }

    .sub-nav a { font-size: var(--font-size-sm); }

    /* Layout */
    .container {
        max-width: 100%;
        margin: 0;
        padding-top: 2.5rem;
    }

    p, li { max-width: none; }

    /* Page Header */
    .page-header {
        height: 17rem;
    }

    .page-header h1 br { display: none; }

    .header-content {
        padding-inline: var(--spacing-md);
    }

    /* Top bar + footer */
    .shop-bar {
        padding-inline: var(--spacing-md);
    }

    .shop-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .shop-footer ul {
        flex-direction: column;
    }
}

/* ================================
   CARDS
   ================================ */

.card {
    display: flex;
    min-height: fit-content;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-xl);
    background-color: var(--color-white);
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: var(--font-size-sm);
}

/* Size variant: spans two grid columns (first listing image) */
.card.wide {
    grid-column: span 2;
}

/* Card content */
.card h4 {
    margin-top: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.card p, .card ul li {
    line-height: var(--line-height-normal);
    margin-block: var(--spacing-sm) var(--spacing-md);
    margin-inline: 0;
}

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

/* Interactive variant (listing cards are links) */
.card.clickable {
    cursor: pointer;
    transition: scale 0.2s ease, background-color 0.2s ease;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: auto;
}

a.clickable:hover {
    text-decoration: none;
    background: rgb(255 255 255 / 0.8);
    scale: 1.01;
}

/* Info card (shop-paused banner) */
.card.info {
    text-align: left;
    justify-content: flex-start;
    align-items: flex-start;
}

/* Grids */
.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--spacing-lg);
    row-gap: var(--spacing-md);
    margin-bottom: var(--spacing-2xl);
    grid-auto-rows: min-content;
}

.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: var(--spacing-lg);
    row-gap: 0;
    margin-bottom: var(--spacing-xl);
    grid-auto-rows: min-content;
}

@media (max-width: 768px) {
    .grid-3col,
    .grid-2col {
        grid-template-columns: 1fr;
    }

    /* Reset spanning on mobile */
    .card.wide {
        grid-column: span 1;
    }

    /* Card content adjustments */
    .card {
        padding: var(--spacing-lg);
    }

    .card.info p {
        font-size: var(--font-size-sm);
    }

    .card h4 {
        font-size: var(--font-size-base);
    }
}

/* Background utilities */
.white { background-color: var(--color-white); }
.peachy { background-color: var(--color-peachy); }
.beige { background-color: var(--color-beige); }

/* ================================
   CART BUTTON
   ================================ */

.cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0.38rem var(--spacing-sm);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xs);
    color: var(--color-dark);
    margin: 0;
    min-width: 60px;
}

.cart:hover {
    scale: 1;
    filter: none;
}

.cart-badge {
    display: inline-flex;
    width: 0;
    height: 16px;
    align-items: center;
    justify-content: center;
    background: var(--color-orange);
    color: var(--color-white);
    border-radius: 50%;
    font-family: var(--font-family-mono);
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    text-align: center;
    line-height: 1;
    overflow: hidden;
}

/* ================================
   CARDS VARIANTS
   ================================ */

/* Product card */
.product-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: fit-content;
    background-color: var(--color-white);
    text-decoration: none;
    text-align: left;
    border: 1px solid #F9F2EA;
    padding-top: var(--spacing-xl);
}

.product-card img {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: contain;
}

.product-card .product-info {
    width: 100%;
    padding-top: var(--spacing-xl);
}

.product-card h4 {
    color: var(--color-dark);
}

.product-card p {
    margin: 0;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    color: var(--color-dark);
}

.product-card .btn {
    margin-top: var(--spacing-xl);
}

/* Card title row: listing title left, Sale/Sold-out badge right */
.product-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
}

.card-badge.sale {
    background: var(--color-orange);
    color: var(--color-white);
}

.card-badge.sale img {
    width: 14px;
    height: 14px;
    /* sale.svg is orange — render it white on the orange badge */
    filter: brightness(0) invert(1);
}

.card-badge.sold-out {
    background: var(--color-dark);
    color: var(--color-white);
}

/* ================================
   LISTING PAGE
   ================================ */

/* Category link back to its storefront section (.subtitle supplies the
   orange mono treatment) */
.listing-category {
    display: inline-block;
    text-decoration: none;
}

@media (hover: hover) {
    .listing-category:hover {
        text-decoration: underline;
    }
}

/* Narrow info column left, image gallery right */
.listing-grid {
    display: grid;
    grid-template-columns: minmax(0, 360px) 1fr;
    gap: var(--spacing-2xl);
    align-items: start;
}

.purchase-options {
    margin-top: var(--spacing-xl);
}

/* Visually matches h3 without being one — these are purchase-form labels,
   not document headings, so they stay out of the heading outline. */
.options-label,
.quantity-label {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-snug);
    color: var(--color-blue);
}

.options-label {
    margin-bottom: var(--spacing-sm);
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.variant-option {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-peachy);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    color: var(--color-dark);
    cursor: pointer;
}

.variant-option.selected {
    background: var(--color-teal);
    border-color: var(--color-teal);
}

.variant-option:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* "Ships to …" / "Delivered via email." — follows the selected variant */
.options-caption {
    margin-top: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-dark);
}

.quantity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-block: var(--spacing-lg);
}

.quantity-stepper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.quantity-stepper button {
    padding: 0 var(--spacing-sm);
    background: none;
    border: none;
    font-size: var(--font-size-md);
    color: var(--color-dark);
    cursor: pointer;
}

.quantity-stepper button:disabled {
    opacity: 0.3;
    cursor: default;
}

.quantity-stepper span {
    min-width: 1.5rem;
    text-align: center;
}

/* Add to Cart: label left, mono price right (price tracks quantity) */
.add-to-cart {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    letter-spacing: normal;
    /* Base .btn compresses to line-height 0.95 — match the variant
       buttons' normal text height so equal padding reads equal */
    line-height: var(--line-height-normal);
}

.add-to-cart .add-to-cart-price {
    font-family: var(--font-family-mono);
}

/* Struck base price when a discount reduces the line total */
.add-to-cart-price s {
    margin-right: var(--spacing-sm);
    color: rgb(255 255 255 / 0.55);
}

.add-to-cart:disabled {
    background: #333333; /* sold out */
    cursor: not-allowed;
}

.add-to-cart:disabled:hover {
    scale: 1;
    filter: none;
}

/* Discount callout under the Add to Cart button; .unmet = condition not
   yet satisfied (grey icon, condition copy) */
.discount-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    color: var(--color-dark);
}

.discount-note-corner {
    width: 13px;
    height: 13px;
    /* The corner stroke hangs above the text baseline */
    margin-top: -4px;
}

.discount-note-icon {
    width: 18px;
    height: 18px;
}

.discount-note.unmet .discount-note-icon {
    filter: grayscale(1) opacity(0.6);
}

/* Simple visibility utility (shop pages) */
.hidden {
    display: none;
}

/* ================================
   CART MODAL
   ================================ */

#modal-bg {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(40 0 0 / 0.3);
    z-index: 1000;
    color: var(--color-dark);
    animation: fadeIn 0.3s ease;
}

#modal-bg.closing {
    animation: fadeOut 0.3s ease forwards;
}

#cart-modal {
    display: flex;
    flex-direction: column;
    position: absolute;
    width: 475px;
    height: 100vh;
    top: 0;
    right: 0;
    padding: var(--spacing-lg);
    background: white;
    box-shadow: var(--shadow);
    animation: slideInRight 0.3s ease;
}

#cart-modal.closing {
    animation: slideOutRight 0.3s ease forwards;
}

.cart-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: start;
}

.cart-header p {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-badge {
    color: var(--color-orange);
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--spacing-md);
    display: flex;
    flex-direction: column;
}

#cart-modal .cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-lg);
    background-color: var(--color-peachy);
    border-radius: var(--border-radius-sm);
}

#cart-modal .cart-item s {
    color: var(--color-gray);
}

.cart-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xs);
}

.cart-actions .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--color-white);
    border-radius: var(--border-radius-sm);
}

.cart-actions span {
    min-width: 1.5rem;
    text-align: center;
}

/* Discount callout under a cart item (shares .discount-note styles,
   centered like the listing page's) */
.cart-item-note {
    margin: calc(-1 * var(--spacing-xs)) 0 var(--spacing-md);
}

/* ================================
   CART SUMMARY & COUPON
   ================================ */

.cart-summary {
    margin-bottom: var(--spacing-md);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.cart-summary-row .summary-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.cart-summary-row .summary-amount {
    font-family: var(--font-family-mono);
}

.cart-summary-row.cart-total {
    margin-top: var(--spacing-sm);
    font-weight: var(--font-weight-semibold);
}

.discount-row-icon {
    width: 16px;
    height: 16px;
}

.cart-summary-row.unmet .discount-row-icon {
    filter: grayscale(1) opacity(0.6);
}

.cart-summary-row.unmet .summary-label {
    color: var(--color-gray);
}

/* Collapsed "Discount code" label → entry field → applied chip */
.coupon-toggle {
    padding: 0;
    margin-bottom: var(--spacing-md);
    background: none;
    border: none;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    color: var(--color-gray);
    cursor: pointer;
}

@media (hover: hover) {
    .coupon-toggle:hover {
        color: var(--color-dark);
        text-decoration: underline;
    }
}

.coupon-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.coupon-input {
    flex: 1;
    max-width: 220px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-peachy);
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    color: var(--color-dark);
    text-transform: uppercase;
}

.coupon-input:focus {
    outline: 2px solid var(--color-teal);
}

.coupon-apply {
    background: none;
    border: none;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    color: var(--color-dark);
    cursor: pointer;
}

@media (hover: hover) {
    .coupon-apply:hover {
        text-decoration: underline;
    }
}

.coupon-error {
    margin: calc(-1 * var(--spacing-sm)) 0 var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--color-orange);
}

.cart-empty {
    margin: auto;
    transform: translateY(-50px);
    text-align: center;
}

.cart-warnings {
    justify-self: start;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-lg);
    background: rgb(203 85 33 / 0.2);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgb(203 85 33 / 0.3);
    font-size: var(--font-size-xs);
    color: var(--color-dark);
    text-align: left;
}

.cart-warnings p { margin-bottom: 0; }

.cart-subtotal {
    margin-top: auto;
}

/* ================================
   ANIMATIONS
   ================================ */

@keyframes fadeIn {
    from {
        background: rgb(40 0 0 / 0);
    }
    to {
        background: rgb(40 0 0 / 0.3);
    }
}

@keyframes fadeOut {
    from {
        background: rgb(40 0 0 / 0.3);
    }
    to {
        background: rgb(40 0 0 / 0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

/* ================================
   RESPONSIVE DESIGN (shop)
   ================================ */

@media (max-width: 768px) {
    #cart-modal {
        width: 100%;
    }

    /* Under 16px, mobile Safari zooms the page when the field is focused */
    .coupon-input {
        font-size: 16px;
    }

    /* Product page: stack + reorder columns (images first) */
    .listing-grid {
        grid-template-columns: 1fr;
        row-gap: var(--spacing-lg);
    }

    .listing-grid section:first-child {
        order: 2;
    }

    .listing-grid section:last-child {
        order: 1;
    }

    /* Product page: horizontal image gallery */
    .product-images {
        display: flex;
        overflow-x: auto;
        gap: var(--spacing-md);
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0;
    }

    .product-images .card {
        flex: 0 0 85%;
        scroll-snap-align: start;
    }
}
