/* Site coupons: $25 off an order of $500 or more, or $50 off $1,000 or more with the code's "50" sibling (codes in src/_data/siteCoupons.json).

   1. The coupon card (src/_includes/sections/coupon-card.njk): one calm ticket on every deal page with that
      page's code, "Apply to my cart", "Copy code", how it works and the fine print; on /coupons the list of
      every code under it. The partial links this sheet, so the build inlines it with the page's CSS.
   2. What assets/js/cart.js adds at runtime on any page: the confirmation toast (?coupon=CODE, Apply) and the
      coupon rows in the cart drawer. Off the deal pages cart.js loads this sheet on demand.

   The tokens below are this site's: one accent, the page's own font, the card radius of the deal pages. */
.pb-coupon-section,
.pb-coupon,
.pb-coupon-toast {
    --cpn-accent: #0071e3;
    --cpn-accent-ink: #fff;
    --cpn-ink: #1d1d1f;
    --cpn-muted: #6e6e73;
    --cpn-line: #d2d2d7;
    --cpn-soft: #f5f5f7;
    --cpn-card: #fff;
    --cpn-radius: 28px;
    --cpn-notch: #000;
    /* The toast sits over a dark site: a white chip with dark words. */
    --cpn-toast: #fff;
    --cpn-toast-ink: #1d1d1f;
}

/* ------------------------------------------------------------------ the card */
.pb-coupon-section {
    padding: clamp(2.5rem, 6vw, 4.5rem) 0;
    background: var(--cpn-notch);
}
.pb-coupon-section--list {
    padding-top: 0;
}
.pb-coupon-wrap {
    width: min(100% - 2.5rem, 1080px);
    margin: 0 auto;
}
.pb-coupon {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    margin: 0;
    border-radius: var(--cpn-radius);
    background: var(--cpn-card);
    color: var(--cpn-ink);
    text-align: left;
    overflow: hidden;
}
/* On a light page (the Black Friday page) the whole ticket is white, stub included, with the page showing
   through the notches. */
.pb-coupon--on-light {
    --cpn-notch: #f5f5f7;
    --cpn-radius: 24px;
    margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
}
.pb-coupon--on-light .pb-coupon-side { background: var(--cpn-card); }
.pb-coupon--on-light .pb-coupon-steps li::before { background: var(--cpn-soft); }
.pb-coupon-main,
.pb-coupon-side {
    padding: clamp(1.75rem, 4vw, 3rem);
}
.pb-coupon-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
/* The stub: a dashed tear line with a notch at each end, like a ticket. */
.pb-coupon-side {
    position: relative;
    border-left: 2px dashed var(--cpn-line);
    background: var(--cpn-soft);
}
.pb-coupon-side::before,
.pb-coupon-side::after {
    content: "";
    position: absolute;
    left: -13px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cpn-notch);
}
.pb-coupon-side::before { top: -12px; }
.pb-coupon-side::after { bottom: -12px; }

.pb-coupon .pb-coupon-eyebrow {
    margin: 0 0 0.6rem;
    color: var(--cpn-accent);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pb-coupon .pb-coupon-title {
    margin: 0;
    color: var(--cpn-ink);
    font-family: inherit;
    font-size: clamp(1.75rem, 4.2vw, 2.75rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-transform: none;
}
.pb-coupon .pb-coupon-note {
    margin: 0.9rem 0 0;
    max-width: 34em;
    color: var(--cpn-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
}
.pb-coupon .pb-coupon-code {
    display: inline-flex;
    align-items: baseline;
    align-self: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    max-width: 100%;
    margin: 1.5rem 0 0;
    padding: 0.8rem 1.25rem;
    border: 1px solid var(--cpn-line);
    border-radius: 16px;
    background: var(--cpn-soft);
}
.pb-coupon .pb-coupon-code-label {
    color: var(--cpn-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.pb-coupon .pb-coupon-code code {
    padding: 0;
    border: 0;
    background: none;
    color: var(--cpn-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: clamp(1.2rem, 3.4vw, 1.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}
.pb-coupon-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 1.5rem 0 0;
}
.pb-coupon .pb-coupon-apply,
.pb-coupon-row .pb-coupon-row-apply {
    min-height: 48px;
    margin: 0;
    padding: 0.8rem 1.75rem;
    border: 1px solid var(--cpn-accent);
    border-radius: 980px;
    background: var(--cpn-accent);
    color: var(--cpn-accent-ink);
    font-family: inherit;
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}
.pb-coupon .pb-coupon-apply:hover,
.pb-coupon-row .pb-coupon-row-apply:hover { opacity: 0.88; }
.pb-coupon .pb-coupon-apply:focus-visible,
.pb-coupon .pb-coupon-copy:focus-visible,
.pb-coupon .pb-coupon-undo:focus-visible,
.pb-coupon-row .pb-coupon-row-apply:focus-visible,
.pb-coupon-toast button:focus-visible {
    outline: 2px solid var(--cpn-accent);
    outline-offset: 3px;
}
.pb-coupon .pb-coupon-apply[aria-busy="true"],
.pb-coupon-row .pb-coupon-row-apply[aria-busy="true"] { opacity: 0.6; cursor: progress; }
/* Applied: the button goes quiet, the status line under it says what happened. */
.pb-coupon .pb-coupon-apply.is-applied,
.pb-coupon-row .pb-coupon-row-apply.is-applied {
    background: transparent;
    color: var(--cpn-accent);
}
.pb-coupon .pb-coupon-copy {
    min-height: 48px;
    margin: 0;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 980px;
    background: transparent;
    color: var(--cpn-ink);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: underline;
    text-decoration-color: var(--cpn-line);
    text-underline-offset: 0.25em;
    cursor: pointer;
}
.pb-coupon .pb-coupon-copy:hover { text-decoration-color: currentColor; }
.pb-coupon .pb-coupon-status {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: var(--cpn-soft);
    color: var(--cpn-ink);
    font-size: 0.9375rem;
    line-height: 1.45;
}
.pb-coupon .pb-coupon-status[hidden] { display: none; }
.pb-coupon .pb-coupon-undo {
    margin: 0 0 0 0.5rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cpn-muted);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.pb-coupon .pb-coupon-sub {
    margin: 0 0 0.75rem;
    color: var(--cpn-ink);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pb-coupon .pb-coupon-steps,
.pb-coupon .pb-coupon-fine {
    margin: 0;
    padding: 0;
    list-style: none;
}
.pb-coupon .pb-coupon-steps {
    margin-bottom: 1.75rem;
    counter-reset: pb-coupon-step;
}
.pb-coupon .pb-coupon-steps li {
    position: relative;
    margin: 0 0 0.7rem;
    padding-left: 2.4rem;
    color: var(--cpn-ink);
    font-size: 0.9375rem;
    line-height: 1.5;
    counter-increment: pb-coupon-step;
}
.pb-coupon .pb-coupon-steps li::before {
    content: counter(pb-coupon-step);
    position: absolute;
    left: 0;
    top: 0.02rem;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid var(--cpn-line);
    border-radius: 50%;
    background: var(--cpn-card);
    color: var(--cpn-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5rem;
    text-align: center;
}
.pb-coupon .pb-coupon-fine li {
    margin: 0 0 0.45rem;
    padding-left: 1rem;
    color: var(--cpn-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
    text-indent: -1rem;
}
.pb-coupon .pb-coupon-fine li::before {
    content: "\2013";
    display: inline-block;
    width: 1rem;
    text-indent: 0;
}
.pb-coupon .pb-coupon-fine li:last-child,
.pb-coupon .pb-coupon-steps li:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ /coupons: every code */
.pb-coupon-list-card {
    padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 3rem);
    border-radius: var(--cpn-radius);
    background: var(--cpn-card);
    color: var(--cpn-ink);
    text-align: left;
}
.pb-coupon-list-card .pb-coupon-list-title {
    margin: 0;
    color: var(--cpn-ink);
    font-family: inherit;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-transform: none;
}
.pb-coupon-list-card .pb-coupon-list-intro {
    margin: 0.5rem 0 1.25rem;
    color: var(--cpn-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
}
.pb-coupon-list-card .pb-coupon-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.pb-coupon-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0.7rem 0;
    border-top: 1px solid var(--cpn-line);
}
.pb-coupon-row .pb-coupon-row-name {
    color: var(--cpn-ink);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: underline;
    text-decoration-color: var(--cpn-line);
    text-underline-offset: 0.25em;
}
.pb-coupon-row .pb-coupon-row-name:hover { text-decoration-color: currentColor; }
.pb-coupon-row .pb-coupon-row-code {
    padding: 0;
    border: 0;
    background: none;
    color: var(--cpn-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}
.pb-coupon-row .pb-coupon-row-apply {
    min-height: 40px;
    min-width: 6.5rem;
    padding: 0.5rem 1.1rem;
    font-size: 0.9375rem;
}

@media (max-width: 47.937em) {
    .pb-coupon { grid-template-columns: minmax(0, 1fr); }
    .pb-coupon-side {
        border-left: 0;
        border-top: 2px dashed var(--cpn-line);
    }
    .pb-coupon-side::before,
    .pb-coupon-side::after { top: -13px; bottom: auto; }
    .pb-coupon-side::before { left: -12px; }
    .pb-coupon-side::after { left: auto; right: -12px; }
    .pb-coupon .pb-coupon-apply { flex: 1 1 100%; }
    .pb-coupon .pb-coupon-copy { flex: 1 1 100%; }
    .pb-coupon-row { grid-template-columns: minmax(0, 1fr) auto; }
    .pb-coupon-row .pb-coupon-row-name { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ the toast (cart.js) */
.pb-coupon-toast {
    position: fixed;
    left: 50%;
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-sizing: border-box;
    width: max-content;
    max-width: min(34rem, calc(100vw - 2rem));
    padding: 0.85rem 1rem 0.85rem 1.25rem;
    border-radius: 18px;
    background: var(--cpn-toast);
    color: var(--cpn-toast-ink);
    font-size: 0.9375rem;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.pb-coupon-toast.is-shown {
    opacity: 1;
    transform: translate(-50%, 0);
}
.pb-coupon-toast p { flex: 1 1 auto; min-width: 0; margin: 0; color: inherit; font: inherit; }
.pb-coupon-toast strong { font-weight: 600; letter-spacing: 0.02em; }
.pb-coupon-toast button {
    flex: none;
    min-height: 36px;
    margin: 0;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--cpn-accent);
    border-radius: 980px;
    background: var(--cpn-accent);
    color: var(--cpn-accent-ink);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
    .pb-coupon-toast { transition: none; }
}

/* ------------------------------------------------------------------ the cart drawer rows (cart.js) */
/* A coupon that is on the cart but not taking money off yet (under the minimum, or beaten by another code):
   shown, never silently dropped. Sits in the same block as the applied codes (cart-coupons.css). */
.cart-coupon--waiting .cart-coupon-status { color: #8a5a00; }
.cart-coupon-note {
    grid-column: 1 / -1;
    margin: 0.15rem 0 0.35rem;
    color: #525b61;
    font-size: 0.78rem;
    line-height: 1.4;
}

/* ------------------------------------------------------------------ two tiers, one card */
/* "$25 off orders of $500 or more" and "$50 off orders of $1,000 or more": one quiet row each, the deal over
   its code, a Copy button at the end of the row. */
.pb-coupon .pb-coupon-tiers {
    display: grid;
    gap: 0.6rem;
    margin: 1.4rem 0 0;
    padding: 0;
    list-style: none;
}
.pb-coupon .pb-coupon-tier {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.1rem 0.75rem;
    margin: 0;
    padding: 0.8rem 0.5rem 0.8rem 1.15rem;
    border: 1px solid var(--cpn-line);
    border-radius: 16px;
    background: var(--cpn-soft);
}
.pb-coupon .pb-coupon-tier-deal {
    grid-column: 1;
    color: var(--cpn-muted);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
}
.pb-coupon .pb-coupon-tier-code {
    grid-column: 1;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cpn-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: clamp(1.05rem, 2.9vw, 1.375rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}
.pb-coupon .pb-coupon-tier .pb-coupon-copy {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    white-space: nowrap;
}
.pb-coupon--on-light .pb-coupon-tier {
    background: var(--cpn-soft);
}

/* /coupons: both codes of a pair in the row, each with what it takes off. */
.pb-coupon-row .pb-coupon-row-codes {
    display: grid;
    gap: 0.2rem;
    justify-items: start;
}
.pb-coupon-row .pb-coupon-row-tier {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
}
.pb-coupon-row .pb-coupon-row-deal {
    color: var(--cpn-muted);
    font-size: 0.8125rem;
    line-height: 1.3;
    white-space: nowrap;
}
.pb-coupon-row .pb-coupon-row-name--plain,
.pb-coupon-row .pb-coupon-row-name--plain:hover {
    text-decoration: none;
}
@media (min-width: 48em) {
    .pb-coupon-row { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto; }
}
@media (max-width: 47.937em) {
    .pb-coupon .pb-coupon-tier { padding-left: 0.95rem; }
    /* On a phone the code gets a line to itself, so a long one never breaks; Copy sits beside the deal. */
    .pb-coupon .pb-coupon-tier .pb-coupon-copy { flex: none; grid-row: 1; padding: 0.5rem 0.6rem; }
    .pb-coupon .pb-coupon-tier-code { grid-column: 1 / -1; grid-row: 2; font-size: clamp(0.95rem, 4.6vw, 1.2rem); overflow-wrap: normal; white-space: nowrap; }
    .pb-coupon-row .pb-coupon-row-codes { grid-column: 1; }
}

/* The drawer: "Add $X more for $50 off with CODE50" under the applied code. */
.cart-coupons > .cart-coupon-note {
    margin: 0.1rem 0 0.4rem;
}
