/* Books & Store — layout only. Type lives in css/common.css. */

/* ==========================================================================
   Store — off-white base, dark gradient cap at the top.
   Maroon → dark gray. Never maroon → white (that's what makes pink).
   ========================================================================== */

.store {
    position: relative;
    isolation: isolate;
    overflow-x: clip;
    padding-block: var(--space-3xl);
    color: var(--color-text);
    background: var(--color-bg-white);
}

/* Gradient cap — maroon to dark gray, pinned to the top of the section. */
.store::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: var(--size-store-status);
    z-index: 0;
    pointer-events: none;
    background: var(--background-store-cap);
}

.page-books-store .store::before,
.store-status::before {
    content: none;
}

.books-introduction::before {
    content: "";
    position: absolute;
    inset: calc(-1 * var(--space-3xl)) calc((100% - var(--size-viewport)) / 2) calc(-1 * var(--space-xl));
    z-index: -1;
    pointer-events: none;
    background: var(--background-store-cap);
}

.store > .container {
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Banners
   ========================================================================== */

.store-banner {
    padding: var(--space-md);
    margin: 0 0 var(--space-lg) 0;
    border-radius: var(--space-sm);
}

.store-banner--test {
    background: var(--color-bg-luxury);
    color: var(--color-text);
    border: var(--border-width-thin) solid var(--color-border);
}

.store-banner--error {
    background: var(--color-bg-luxury);
    border: var(--border-width-thin) solid var(--color-primary);
    color: var(--color-primary);
}

/* ==========================================================================
   Intro copy
   ========================================================================== */

.books-intro {
    max-width: var(--size-books-intro);
    margin: 0 0 var(--space-xl) 0;
}

.books-feature {
    display: block;
    width: 100%;
    max-height: var(--size-books-feature-height);
    height: auto;
    object-fit: contain;
    margin: 0 0 var(--space-lg);
    border-radius: var(--space-sm);
}

.books-introduction {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-areas: "copy" "photo";
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
}

.books-introduction > .books-intro {
    grid-area: copy;
    max-width: none;
    margin: 0;
}

.books-intro-photo {
    grid-area: photo;
    display: block;
    width: 100%;
    max-width: var(--size-books-feature);
    height: auto;
    align-self: center;
    justify-self: center;
    border-radius: var(--space-sm);
}

/* ==========================================================================
   Product grid
   ========================================================================== */

.store-grid {
    display: grid;
    gap: var(--space-lg);
}

.store-grid + h2 {
    margin-top: var(--space-2xl);
}

.store-product {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-white);
    color: var(--color-text);
    border-radius: var(--space-md);
    border: var(--border-width-thin) solid color-mix(in srgb, var(--color-dark) 10%, transparent);
    box-shadow: var(--shadow-store-product);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.store-product:hover {
    box-shadow: var(--shadow-store-product-hover);
    transform: translateY(calc(-1 * var(--border-width-medium)));
}

.store-product__media {
    width: min(var(--size-book-cover-mobile), var(--size-book-cover-fluid));
    line-height: 0;
}

.store-product__cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    background: var(--color-bg-luxury);
    border-radius: var(--space-xs);
    box-shadow: var(--shadow-store-cover);
}

.store-product .price {
    margin: 0 0 var(--space-sm);
}

/* ==========================================================================
   Buy row
   ========================================================================== */

.store-buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
}

.store-buy__submit {
    flex: 1 1 100%;
    text-align: center;
}

.store-qty {
    display: inline-flex;
    align-items: center;
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: calc(var(--space-md) * 3.125);
    overflow: hidden;
    background: var(--color-bg-white);
}

.store-qty__btn {
    width: var(--size-store-quantity-button);
    height: var(--size-store-quantity-input);
    border: 0;
    background: transparent;
    color: var(--color-dark);
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s ease;
}

.store-qty__btn:hover {
    background: var(--color-bg-luxury);
}

.store-qty input {
    width: var(--size-store-quantity-input);
    height: var(--size-store-quantity-input);
    border: 0;
    text-align: center;
    background: transparent;
    -moz-appearance: textfield;
}

.store-qty input::-webkit-outer-spin-button,
.store-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.books-feature-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin: 0 0 var(--space-lg);
}

@media (min-width: 640px) {
    .books-feature-row {
        grid-template-columns: 1fr 1fr;
    }
}
/* ==========================================================================
   Footnote / status / receipt
   ========================================================================== */

.store-footnote {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    text-align: center;
}

.store-lock {
    width: var(--size-store-lock);
    height: var(--size-store-lock);
    color: var(--color-accent);
    fill: currentColor;
    flex: none;
}

.store-status__inner {
    max-width: var(--size-store-status);
    margin: 0 auto;
    text-align: center;
}

.store-status--paid {
    padding: var(--space-lg);
    background: var(--color-bg-luxury);
    color: var(--color-text);
    border-radius: var(--space-xs);
    border-left: var(--border-width-strong) solid var(--color-accent);
}

.store-receipt {
    list-style: none;
    margin: 0 0 var(--space-xl) 0;
    padding: var(--space-md);
    background: var(--color-bg-luxury);
    color: var(--color-text);
    border-radius: calc(var(--space-sm) + var(--space-xs));
    text-align: left;
}

.store-receipt li {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.store-receipt__total {
    border-top: var(--border-width-thin) solid var(--color-border);
    margin-top: var(--space-xs);
    padding-top: var(--space-sm);
}

.store-status__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
}

/* ==========================================================================
   Color pass — everything above the first .store-grid is on the dark cap
   and gets white text. Everything from the first .store-grid down is on
   off-white and gets dark text.
   ========================================================================== */

/* --- Top block: first h2 + first .books-intro live on the dark cap --- */

/* "The Message Goes Beyond the Workplace" */
.books-introduction h2 {
    color: var(--color-bg-white);
}

/* Every paragraph / list item inside the first intro block */
.books-introduction :is(p, li) {
    color: color-mix(in srgb, var(--color-bg-white) 92%, transparent);
}

/* Links inside the first intro block — white with underline */
.store .books-introduction p a:not(.btn):not(.h-btn) {
    color: var(--color-bg-white);
    text-decoration: underline;
    text-underline-offset: var(--border-width-strong);
}

.store .books-introduction p a:not(.btn):not(.h-btn):hover {
    color: var(--color-bg-luxury);
}

/* --- Everything else on off-white gets dark text --- */

.store > .container :is(h1, h2, h3, h4, h5, h6, .kicker):not(
    :is(.store-banner, .store-product, .store-status--paid, .store-receipt, .books-introduction) *
):not(:first-of-type) {
    color: var(--color-text);
}

.store > .container :is(p, li, .text-muted):not(
    :is(.store-banner, .store-product, .store-status--paid, .store-receipt),
    :is(.store-banner, .store-product, .store-status--paid, .store-receipt) *
):not(.books-introduction *) {
    color: var(--color-text-muted);
}

/* Inline links on the light half */
.store p a:not(.btn, .h-btn, :is(.store-banner, .store-product, .store-status--paid, .store-receipt) *):not(.books-introduction a) {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: var(--border-width-strong);
}

.store p a:not(.btn, .h-btn, :is(.store-banner, .store-product, .store-status--paid, .store-receipt) *):not(.books-introduction a):hover {
    color: var(--color-red-bright);
}

/* Banners stay dark-on-light regardless */
.store > .container > .store-banner,
.store > .container > .store-banner * {
    color: var(--color-text);
}

.store > .container > .store-banner--error,
.store > .container > .store-banner--error * {
    color: var(--color-primary);
}

/* CTAs inside cards — primary red */
.store-product .btn-primary,
.store-status--paid .btn-primary {
    background: var(--color-primary);
    color: var(--color-bg-white);
}

.store-product .btn-primary:hover,
.store-status--paid .btn-primary:hover {
    background: var(--color-red-bright);
    color: var(--color-bg-white);
}

.store .store-lock {
    color: var(--color-accent);
}

/* ==========================================================================
   Breakpoints
   ========================================================================== */

@media (min-width: 640px) {
    .store-banner {
        padding: var(--space-md) var(--space-lg);
    }

    .books-intro {
        margin-bottom: var(--space-2xl);
    }

    .store-product {
        grid-template-columns: var(--size-book-cover) 1fr;
        justify-items: start;
        text-align: left;
        gap: var(--space-lg);
        padding: var(--space-lg);
    }

    .store-product__media {
        width: var(--size-book-cover);
    }

    .store-buy {
        justify-content: flex-start;
        width: auto;
    }

    .store-buy__submit {
        flex: 1 1 calc(var(--space-xl) * 5);
    }

    .store-footnote {
        margin-top: var(--space-2xl);
        flex-wrap: nowrap;
    }

    .store-receipt {
        padding: var(--space-md) var(--space-lg);
    }
}

@media (min-width: 900px) {
    .books-introduction {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        grid-template-areas: "photo copy";
        gap: var(--space-2xl);
    }

    .store-grid {
        grid-template-columns: 1fr 1fr;
    }

    .store-grid:has(.store-product:nth-child(3):last-child) .store-product:last-child {
        grid-column: 1 / -1;
        justify-self: center;
        width: 100%;
        max-width: calc(50% - var(--space-lg) / 2);
    }
}
