/* Shop surfaces share the navigation's edition color; the fixed forest layer
   and display type come from the festival stylesheet and branding endpoint. */
:root {
    --shop-panel: var(--color-primary);
    --shop-text: var(--color-text);
    --shop-radius: .55rem;
    --shop-gap: clamp(1rem, 2.8vw, 2rem);
    --shop-padding: clamp(1rem, 3.5vw, 2.5rem);
    --shop-border: color-mix(in srgb, currentColor 35%, transparent);
}
@supports (color: contrast-color(red)) {
    :root { --shop-text: contrast-color(var(--shop-panel)); }
}
html { font-size: 100%; }
body { color: var(--shop-text); font: 1rem/1.5 'Segoe UI', system-ui, sans-serif; }
.page-bg { background-color: var(--shop-panel); }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, .choice input:focus-visible + span {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}
main {
    width: min(80%, 69rem);
    min-width: 0;
    margin: clamp(1.5rem, 5vw, 4rem) auto clamp(2.5rem, 7vw, 6rem);
}
h1, h2 { margin: 0; font-family: var(--font-display); font-weight: var(--font-weight-display, 700); line-height: 1.08; color: var(--color-heading); overflow-wrap: anywhere; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.65rem, 2.7vw, 2.25rem); }
.shop-panel { background-color: var(--shop-panel); border-radius: var(--shop-radius); }
.site-nav, .site-footer { background: var(--shop-panel); color: var(--shop-text); }
.site-nav { padding: .5rem clamp(1rem, 4vw, 3rem); }
.site-nav .brand { min-height: 44px; line-height: 1.1; }
.site-nav .brand img { height: 42px; max-width: min(26vw, 9rem); object-fit: contain; }
.shop-nav-links { display: flex; align-items: center; gap: clamp(.75rem, 3vw, 2rem); margin-left: auto; }
.festival-link, .back-link { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: .2em; }
.festival-link { font-size: .95rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 44px; border: 0; border-radius: .35rem; padding: .65rem 1.05rem;
    color: var(--shop-panel); background: var(--color-heading);
    font: 700 1rem/1.3 'Segoe UI', system-ui, sans-serif; text-decoration: none; cursor: pointer;
}
.btn:hover, .product-card:hover h2 { text-decoration: underline; text-underline-offset: .18em; }
.btn:disabled { opacity: .65; cursor: default; text-decoration: none; }
.bag-count, .price, .line-price, .cart-total { font-variant-numeric: tabular-nums; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.5rem; padding: .8rem 1rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; color: inherit; }

/* The gaps and outer margins expose the forest even with a full collection. */
.catalog { margin-top: clamp(2.4rem, 6vw, 5.5rem); }
.poster-title {
    width: fit-content; max-width: 100%; margin: 0 0 clamp(1.8rem, 4vw, 3.1rem);
    padding: .08em .23em .12em; background: var(--shop-panel);
    box-shadow: .055em .055em var(--color-secondary);
    transform: rotate(-2deg); transform-origin: left center;
    font-size: clamp(2.8rem, 6.5vw, 5.6rem); text-transform: uppercase;
}
.product-grid, .product-detail { display: grid; gap: var(--shop-gap); }
.product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.grid-pair, .product-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-card { overflow: hidden; min-width: 0; text-decoration: none; }
.product-card:focus-visible { outline-color: var(--color-heading); box-shadow: 0 0 0 6px var(--shop-panel); }
.product-card:only-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
.card-media, .detail-media, .line-photo {
    position: relative; display: grid; place-items: center;
    background: #f6f4f0; color: #483f40; overflow: hidden;
}
.card-media { aspect-ratio: 5 / 4; }
.card-media img, .detail-media img, .line-photo img { width: 100%; height: 100%; object-fit: contain; }
.badges { position: absolute; top: .75rem; left: .75rem; right: .75rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.badge { background: var(--color-heading); color: var(--shop-panel); padding: .2rem .58rem; border-radius: .25rem; font-weight: 700; font-size: .875rem; }
.badge.sale { background: var(--shop-panel); color: var(--shop-text); }
.card-copy { padding: clamp(1rem, 2vw, 1.6rem); }
.card-copy p, .line-info span { margin: .4rem 0 0; font-size: .95rem; }
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: .4em; margin-top: .45rem; font-size: 1.25rem; }
.price .from, .price del { font-size: .9rem; }
.image-missing { padding: 1rem; text-align: center; }

.product-page, .cart-panel, .reading-panel { padding: var(--shop-padding); }
.cart-panel, .reading-panel { max-width: 46rem; }
.back-link { margin-bottom: .7rem; font-size: .95rem; }
.detail-media { aspect-ratio: 1; border-radius: .3rem; }
.thumbs, .choices { display: flex; flex-wrap: wrap; gap: .6rem; }
.thumbs { margin-top: .75rem; }
.thumbs a { padding: 3px; border: 2px solid transparent; border-radius: .3rem; }
.thumbs a[aria-current=true] { border-color: var(--color-heading); }
.thumbs img { width: 3.5rem; height: 3.5rem; background: #f6f4f0; object-fit: contain; }
.purchase { min-width: 0; overflow-wrap: anywhere; }
.detail-price { margin: .25rem 0 1.2rem; }
.detail-price .price { font-size: 1.5rem; }
.order-note { display: grid; gap: .15rem; padding-left: .8rem; border-left: 3px solid var(--color-heading); margin-bottom: 1.4rem; }
.purchase-form fieldset { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
.purchase-form legend { padding: 0; margin: 0 0 .55rem; font-weight: 700; }
.choice { position: relative; display: grid; min-width: 0; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-label {
    min-height: 44px; min-width: 44px; padding: .45rem .65rem; display: grid; place-content: center;
    border: 1px solid currentColor; border-radius: .35rem; text-align: center; cursor: pointer;
}
.choice-label small { font-size: .875rem; }
.choice input:checked + span { color: var(--shop-panel); background: var(--color-heading); border-color: var(--color-heading); }
.choice input:disabled + span { border-style: dashed; cursor: default; }
.choice input:disabled + span strong { text-decoration: line-through; }
.description { white-space: pre-line; }
.empty-state { padding: 1.25rem; }
.cart-panel .empty-state, .reading-panel .empty-state { padding: 0; }

.cart-lines { margin: 1.25rem 0; padding: 0; list-style: none; }
.cart-line {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem 1rem;
    align-items: start; padding: 1rem 0; border-bottom: 1px solid var(--shop-border);
}
.line-photo { grid-column: 1; grid-row: 1 / 3; width: clamp(3rem, 8vw, 5rem); aspect-ratio: 1; border-radius: .25rem; }
.line-info { grid-column: 2; display: grid; overflow-wrap: anywhere; }
.cart-line:not(:has(.line-photo)) .line-info { grid-column: 1 / 3; }
.line-price { grid-column: 3; white-space: nowrap; }
.line-actions { grid-column: 2 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.25rem; }
.quantity-form, .quantity-form label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.quantity-form input { width: 3.8rem; min-height: 44px; padding: .35rem; border: 0; border-radius: .25rem; font: inherit; color: #211822; background: #fffaf3; }
.text-button { min-height: 44px; padding: 0; border: 0; color: inherit; background: transparent; text-decoration: underline; text-underline-offset: .2em; font: inherit; cursor: pointer; }
.cart-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; font-size: 1.25rem; }
.flash-success, .flash-error { padding: .75rem 1rem; border-radius: .3rem; }
.flash-success { background: #dff1e8; color: #1c4c37; }
.flash-error { background: #ffe2dc; color: #69251f; }
.legal-content { overflow-wrap: anywhere; }
.maintenance-page { text-align: center; }

@media (max-width: 60rem) {
    main { width: 88%; }
}
@media (max-width: 44rem) {
    main { width: calc(100% - 2rem); }
    .site-nav { gap: .4rem; }
    .site-nav .brand { font-size: 1.1rem; }
    .product-grid, .product-detail, .product-card:only-child { grid-template-columns: minmax(0, 1fr); }
    .card-media { aspect-ratio: 4 / 3; }
    .detail-media { aspect-ratio: 4 / 3; }
    .cart-line { gap: .45rem .6rem; }
    .line-actions { grid-column: 1 / -1; }
    .line-photo { grid-row: 1; }
    .purchase-form .buy { width: 100%; }
}
