/*
 * The store: the merch pages, cart, checkout and the account's orders (PageStylesheets.cs, #303).
 */

/* ---- Merch cards -----------------------------------------------------------
   Same treatment again: square product photo edge to edge, name in the
   display face, price in gold. A featured item keeps its highlighted edge. */
.merch-card {
    gap: var(--aq-space-2);
    padding: 0 0 var(--aq-space-4);
    overflow: hidden;
    box-shadow: var(--aq-shadow);
    transition: transform var(--aq-transition);
}

.merch-card:hover,
.merch-card:focus-within {
    transform: translateY(-4px);
}

/* Highlighted by colour rather than a larger cell, so the grid keeps its
   even rhythm. */
.merch-card--featured {
    border-color: var(--aq-accent);
}

.merch-card .merch-card__image {
    border-radius: 0;
}

.merch-card .merch-card__image img {
    aspect-ratio: 1;
}

.merch-card__link {
    color: inherit;
    text-decoration: none;
}

.merch-card__name {
    margin: var(--aq-space-4) var(--aq-space-4) 0;
    font-family: var(--aq-font-display);
    font-size: var(--aq-text-lg);
    font-weight: 700;
}

.merch-card .merch-card__price {
    color: var(--aq-accent-light);
    font-family: var(--aq-font-display);
    font-size: var(--aq-text-xl);
    font-weight: 700;
}

.merch-card__cta a:hover,
.merch-card__cta a:focus-visible {
    text-decoration: underline;
}

/* ---- A band's Merchandise on its page (TASK 01, phase 4; Figma page 52, Concept C) ------------------------------- */
.merch-product {
    max-width: 1128px;
    margin: 0 auto;
}

.merch-product__band {
    margin: 0 0 22px;
}

.merch-product__back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--aq-text-100);
    text-decoration: none;
}

.merch-product__back img {
    border-radius: 50%;
    object-fit: cover;
}

.merch-product__back strong {
    font-family: var(--aq-font-display);
}

.merch-product__crumb {
    color: var(--aq-accent);
}

.merch-product__main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--aq-space-10);
    align-items: start;
}

.merch-product__photos {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.merch-product__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border-radius: var(--aq-radius);
    background: var(--aq-bg-200);
}

.merch-product__photo--main {
    grid-column: 1 / -1;
    border-radius: var(--aq-radius-lg);
}

.merch-product__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.merch-product__info {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-3);
}

.merch-product__name {
    margin: 0;
    font-family: var(--aq-font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.2;
}

.merch-product__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--aq-space-2);
    margin: 0;
}

.merch-product__price {
    display: flex;
    align-items: baseline;
    gap: var(--aq-space-3);
    margin: 0;
}

.merch-product__price strong {
    color: var(--aq-accent);
    font-family: var(--aq-font-primary);
    font-size: 28px;
}

.merch-product__price s {
    color: var(--aq-text-300);
}

.merch-product__label {
    margin: var(--aq-space-1) 0 0;
    font-weight: 600;
}

.merch-product__description {
    color: var(--aq-text-200, var(--aq-text-100));
    line-height: 1.6;
    white-space: pre-line;
}

.merch-product__buy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.merch-product__button {
    width: 100%;
    padding-block: 14px;
    text-align: center;
}

.merch-product__note {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: var(--aq-space-3) 14px;
    border: 1px solid var(--aq-border);
    border-radius: var(--aq-radius-md);
    background: var(--aq-bg-200);
    color: var(--aq-text-200, var(--aq-text-100));
    font-size: 13px;
    line-height: 1.5;
}

.merch-product__note svg {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--aq-accent);
}

.merch-product__more {
    margin-top: var(--aq-space-10);
}

@media (width < 768px) {
    .merch-product__main {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .merch-product__photos {
        margin-inline: -16px;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .merch-product__photo--main {
        border-radius: 0;
    }

    /* The button stays at the bottom of the screen, with the store's name under it. */
    .merch-product__buy {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin-inline: -16px;
        padding: var(--aq-space-3) var(--aq-space-4) var(--aq-space-4);
        border-top: 1px solid var(--aq-border);
        background: var(--aq-bg-200);
    }

    .merch-product__note {
        padding: 0;
        border: 0;
        background: none;
        font-size: 12px;
    }
}

/* /merchandise: each product with the band that sells it. */
.realm-merch__item {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-2);
}

.realm-merch__band {
    color: var(--aq-text-300);
    font-size: var(--aq-text-sm);
    text-decoration: none;
}

.realm-merch__band:hover,
.realm-merch__band:focus-visible {
    color: var(--aq-accent-light);
}

/* The band's tax note under a product's price (merch store upgrade, phase 5b). */
.merch-product__tax {
    margin: 0;
    color: var(--aq-text-300);
    font-size: var(--aq-text-sm);
}

/* ── A band's product, the fan's storefront (merch store upgrade, phase 6; Figma page 60) ── */
.merch-product__price-note {
    margin: 0;
    color: var(--aq-text-300);
    font-size: var(--aq-text-sm);
}

.merch-product__no-price {
    font-size: var(--aq-text-lg);
}

.merch-product__currency {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aq-space-2);
    font-size: var(--aq-text-sm);
    color: var(--aq-text-300);
}

.merch-product__currency .form-select {
    width: auto;
}

.merch-pick {
    margin: 0;
    padding: 0;
    border: 0;
}

.merch-pick__legend {
    margin-bottom: var(--aq-space-2);
    font-size: var(--aq-text-sm);
    color: var(--aq-text-100);
}

.merch-pick__legend span {
    color: var(--aq-text-300);
}

.merch-pick__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--aq-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.merch-pick__chip {
    display: inline-flex;
    align-items: center;
    gap: var(--aq-space-2);
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--aq-space-4);
    border: 1px solid var(--aq-border);
    border-radius: var(--aq-radius-md);
    color: var(--aq-text-100);
    text-decoration: none;
    justify-content: center;
    transition: border-color var(--aq-transition);
}

.merch-pick__chip:hover,
.merch-pick__chip:focus-visible {
    border-color: var(--aq-accent);
}

.merch-pick__chip.is-picked {
    border-color: var(--aq-accent);
    box-shadow: inset 0 0 0 1px var(--aq-accent);
    background: var(--aq-bg-300);
    color: var(--aq-accent-light);
    font-weight: 600;
}

.merch-pick__chip.is-off {
    border-style: dashed;
    color: var(--aq-text-300);
    cursor: not-allowed;
}

.merch-pick__chip.is-off small {
    color: var(--aq-danger-text);
    font-size: var(--aq-text-xs);
}

.merch-product__stock {
    display: flex;
    align-items: center;
    gap: var(--aq-space-2);
    margin: 0;
    font-size: var(--aq-text-sm);
    color: var(--aq-text-100);
}

.merch-product__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aq-text-300);
    flex: none;
}

.merch-product__stock--in .merch-product__dot {
    background: var(--aq-success);
}

.merch-product__stock--low .merch-product__dot {
    background: var(--aq-warning);
}

.merch-product__stock--out .merch-product__dot {
    background: var(--aq-danger);
}

.merch-ship {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-3);
    padding: var(--aq-space-4);
    border: 1px solid var(--aq-border);
    border-radius: var(--aq-radius-lg);
    background: var(--aq-bg-200);
}

.merch-ship__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aq-space-2);
}

.merch-ship__country {
    width: auto;
    max-width: 100%;
}

.merch-ship__hint,
.merch-ship__fine,
.merch-ship__note {
    margin: 0;
    color: var(--aq-text-300);
    font-size: var(--aq-text-xs);
}

.merch-ship__note {
    font-size: var(--aq-text-sm);
}

.merch-ship__warning {
    margin: 0;
    color: var(--aq-warning-text);
    font-size: var(--aq-text-sm);
}

.merch-ship__title {
    margin: 0;
    padding-top: var(--aq-space-3);
    border-top: 1px solid var(--aq-border);
    font-weight: 600;
    font-size: var(--aq-text-sm);
}

.merch-ship__methods {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.merch-ship__methods li {
    display: flex;
    justify-content: space-between;
    gap: var(--aq-space-3);
}

.merch-ship__methods small {
    color: var(--aq-text-300);
}

.merch-ship__amount {
    color: var(--aq-accent);
    font-weight: 600;
    white-space: nowrap;
}

.merch-ship__amount.is-free {
    color: var(--aq-success-text);
}

.merch-product__soon {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-1);
    margin: 0 0 var(--aq-space-3);
    padding: var(--aq-space-3) var(--aq-space-4);
    border: 1px dashed var(--aq-accent);
    border-radius: var(--aq-radius-md);
    font-size: var(--aq-text-sm);
}

.merch-product__soon span {
    color: var(--aq-text-300);
}

/* "Comprar" on a band's product (Stripe phase 2) */
.merch-buy {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-3);
}

.merch-buy__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aq-space-2);
    font-size: var(--aq-text-sm);
}

.merch-buy__fields .form-select {
    width: auto;
}

/* A fan's band order (Stripe phase 2) */
.band-order {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-4);
    max-width: 720px;
}

.band-order__lines td {
    text-align: right;
    white-space: nowrap;
}

.band-order__total th,
.band-order__total td {
    border-top: 1px solid var(--aq-border);
    padding-top: var(--aq-space-2);
}

.band-order__address {
    margin: 0;
}

/* A band order's messages (Stripe phase 12): the reader's own on the right, the other side's on the left */
.order-messages {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-2);
    margin: 0 0 var(--aq-space-3);
    padding: 0;
    list-style: none;
}

.order-messages__item {
    max-width: 85%;
    border: 1px solid var(--aq-border);
    border-radius: var(--aq-radius-md);
    padding: var(--aq-space-2) var(--aq-space-3);
}

.order-messages__item--mine {
    align-self: flex-end;
    border-color: var(--aq-accent);
}

.order-messages__who {
    margin: 0 0 var(--aq-space-1);
    font-size: var(--aq-text-sm);
}

.order-messages__body {
    margin: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* A fan's cart at a band (Stripe phase 6): each line, its quantity and amount; one total below */
.band-cart {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-4);
    max-width: 720px;
}

.band-cart__lines {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.band-cart__line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--aq-space-3);
}

.band-cart__line + .band-cart__line {
    border-top: 1px solid var(--aq-border);
    padding-top: var(--aq-space-3);
}

.band-cart__what {
    display: flex;
    flex-direction: column;
    gap: var(--aq-space-1);
    min-width: 0;
}

.band-cart__quantity,
.band-cart__method {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aq-space-2);
}

.band-cart__quantity .form-select,
.band-cart__method .form-select {
    width: auto;
}

.band-cart__amount {
    text-align: right;
    white-space: nowrap;
}

@media (width < 768px) {
    .band-cart__line {
        grid-template-columns: 1fr auto;
    }

    .band-cart__quantity {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}
