/* =============================================================================
 * PayNow Summit — Product Stacking styles
 *
 * Built from Summit's own design tokens (--primary-color, --content-color,
 * --content-light-color, --text-muted) and its existing shapes: 12px radius
 * panels, 0.2s transitions, muted labels with a rule beside them. If the store
 * changes its theme colours in the PayNow dashboard, these follow along.
 * ========================================================================== */

.pn-stack {
    margin-bottom: 1rem;
}

/* Section heading — mirrors Summit's ".small-title" / modal heading pattern. */
.pn-stack__heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    color: #fff;
}

.pn-stack__heading i {
    color: var(--primary-color);
}

.pn-stack__rule {
    flex: 1;
    height: 1px;
    background: rgb(255 255 255 / 10%);
}

/* Option grid: two columns on small screens, auto-fitting above that. */
.pn-stack__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.625rem;
    /* Wider row gap so a "Save 23%" badge never overlaps the row above it. */
    row-gap: 1.125rem;
}

@media (min-width: 480px) {
    .pn-stack__options {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* ---- Option button ------------------------------------------------------ */

.pn-stack__option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    min-height: 76px;
    padding: 0.75rem 0.625rem;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 0.75rem; /* matches Summit's rounded-xl */
    background: var(--content-light-color);
    color: #fff;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.pn-stack__option:hover:not(:disabled) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pn-stack__option:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.pn-stack__option.is-selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 6px 18px rgb(0 0 0 / 35%);
}

.pn-stack__option:disabled,
.pn-stack__option.is-unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pn-stack__label {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
}

.pn-stack__price {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
}

.pn-stack__option.is-selected .pn-stack__price,
.pn-stack__option.is-selected .pn-stack__sublabel {
    color: #fff;
}

.pn-stack__sublabel {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Corner badge, e.g. "Save 23%". */
.pn-stack__badge {
    position: absolute;
    top: -0.55rem;
    right: 0.25rem;
    padding: 0.125rem 0.4rem;
    border-radius: 999px;
    background: var(--secondary-color, var(--primary-color));
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgb(0 0 0 / 40%);
}

.pn-stack__option.is-selected .pn-stack__badge {
    background: rgb(0 0 0 / 45%);
}

/* Skeleton shown while the live price is being read back from PayNow. */
.pn-stack__price.is-loading {
    display: inline-block;
    width: 3.5rem;
    height: 0.8125rem;
    border-radius: 4px;
    background: rgb(255 255 255 / 15%);
    animation: pn-stack-pulse 1.2s ease-in-out infinite;
}

@keyframes pn-stack-pulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.8; }
}

/* ---- Billing note & warnings -------------------------------------------- */

.pn-stack__note {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.625rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.pn-stack__note i {
    margin-top: 0.15rem;
    color: var(--primary-color);
}

.pn-stack__warning {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgb(234 179 8 / 40%);
    border-radius: 0.5rem;
    background: rgb(234 179 8 / 10%);
    color: #fde68a;
    font-size: 0.75rem;
    line-height: 1.45;
}

/* Stack label shown on a cart line. */
/* An author `display` rule beats the UA's `[hidden] { display: none }`, so the
   hidden state has to be restated here — otherwise the empty placeholder on
   cart.html would take up space on every non-stacked line. */
.pn-stack-tag[hidden] {
    display: none;
}

.pn-stack-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ---- Compact variant for category-grid tiles ---------------------------- */
/* Pills only: no heading, no per-option price. A single large price sits under
   the row instead, so the tile stays readable at three-to-a-row. */
/* Tiles are much narrower than the product page, so the same selector is
   scaled down rather than restyled — same shapes, same colours, less padding. */

.pn-stack--card .pn-stack {
    margin: 0 0 1rem;
}

.pn-stack--card .pn-stack__heading {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.pn-stack--card .pn-stack__options {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    column-gap: 0.375rem;
    row-gap: 0.875rem;
}

.pn-stack--card .pn-stack__option {
    min-height: 54px;
    padding: 0.5rem 0.375rem;
    border-radius: 0.625rem;
}

.pn-stack--card .pn-stack__option:hover:not(:disabled) {
    transform: none; /* tiles already lift on hover; avoid a double movement */
}

.pn-stack--card .pn-stack__label {
    font-size: 0.8125rem;
}

.pn-stack--card .pn-stack__price {
    font-size: 0.6875rem;
}

.pn-stack--card .pn-stack__badge {
    top: -0.45rem;
    right: 0.15rem;
    padding: 0.05rem 0.3rem;
    font-size: 0.5625rem;
}

.pn-stack--card .pn-stack__sublabel {
    font-size: 0.625rem;
}

.pn-stack--card .pn-stack__note {
    margin-top: 0.5rem;
    font-size: 0.6875rem;
}

/* Compact pills: label only, centred, tighter. */
.pn-stack--card .pn-stack__option {
    min-height: 0;
    padding: 0.5rem 0.5rem;
}

.pn-stack--card .pn-stack__options {
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    justify-content: start;
    margin-bottom: 0.875rem;
}

/* Centre the billing note under a tile rather than left-aligning it. */
.pn-stack--card .pn-stack__note {
    justify-content: flex-start;
    text-align: left;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

/* Billing note as it appears on a tile, under the price. */
.pn-stack__note--tile {
    justify-content: flex-start;
    text-align: left;
    margin-top: 0.375rem;
    margin-bottom: 0;
}
