/* ============================================================
   SpectraLight site coupons (coupons.css), loaded on every page.
   Two codes per deals page, one per tier ($25 off $500+, $50 off
   $1,000+; src/_data/siteCoupons.json), applied in one tap by
   assets/js/coupons.js. Four parts:
     1. the coupon card      store/promo/coupon-card.njk
     2. the list on /coupons store/promo/coupon-list.njk
     3. the cart drawer's coupon row and the confirmation toast
        (both drawn by coupons.js)
     4. the small "apply it" links (hero chip, product pages)
   One accent colour (the store's blue), white space, no badges.
   The tokens fall back to the store's values, so the parts look
   the same outside .store-modern (the cart drawer, the toast).
   ============================================================ */

/* ---------- 1. The coupon card: a clean pass, the codes on the left, the how-to on the stub ---------- */
.coupon-section { padding: clamp(1.5rem, 3.5vw, 2.5rem) 0; }
.promo-hero + .coupon-section { padding-top: clamp(0.5rem, 2vw, 1.25rem); }
.coupon-card {
  --cp-accent: var(--sm-accent, #1a73e8);
  --cp-accent-2: var(--sm-accent-2, #1666d0);
  --cp-ink: var(--sm-ink, #1d1d1f);
  --cp-muted: var(--sm-muted, #6e6e73);
  --cp-line: var(--sm-line, #e8e8ed);
  --cp-page: #fff;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  margin: 0;
  background: #fff;
  border: 1px solid var(--cp-line);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(10, 16, 24, 0.04), 0 14px 44px rgba(10, 16, 24, 0.06);
  overflow: hidden;
  text-align: left;
  color: var(--cp-ink);
  scroll-margin-top: 6rem;
}
.coupon-card * { box-sizing: border-box; }
.coupon-card__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.7rem;
  padding: clamp(1.6rem, 3.6vw, 2.75rem);
}
.coupon-card__eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--cp-accent);
}
.coupon-card__title {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--cp-ink);
}
.coupon-card__note { margin: 0; max-width: 46ch; font-size: 1rem; line-height: 1.55; color: var(--cp-muted); }

/* One tile per tier: what it takes off, then its code (a tap copies it). Both tiles are laid out alike. */
.coupon-card__tiers { list-style: none; display: grid; gap: 0.6rem; width: 100%; margin: 0.5rem 0 0.15rem; padding: 0; }
.coupon-tier {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.85rem 0.85rem 0.85rem;
  border: 1px solid var(--cp-line);
  border-radius: 16px;
  background: #fff;
}
.coupon-tier__terms { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; margin: 0; padding: 0 0.2rem; line-height: 1.25; color: var(--cp-muted); }
.coupon-tier__terms strong { font-size: 1.18rem; font-weight: 700; letter-spacing: -0.02em; color: var(--cp-ink); }
.coupon-tier__terms span { font-size: 0.92rem; }
.coupon-tier__code {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  margin: 0;
  height: auto;
  max-height: none;
  padding: 0.7rem 0.9rem 0.7rem 0.95rem;
  border: 0;
  border-radius: 12px;
  background: #eef4fe;
  color: var(--cp-ink);
  font-family: inherit;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.coupon-tier__code:hover { background: #e1ecfd; color: var(--cp-ink); }
.coupon-tier__code code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}
.coupon-tier__copy { flex: 0 0 auto; font-size: 0.8rem; font-weight: 600; color: var(--cp-accent); }
.coupon-tier__code[data-copied] { background: var(--cp-accent); color: #fff; }
.coupon-tier__code[data-copied] .coupon-tier__copy { color: #fff; }
/* The tier that is on the cart right now. */
.coupon-tier__code[data-applied] { box-shadow: inset 0 0 0 1.5px #1d7a46; background: #e6f5ec; }
.coupon-tier__code[data-applied] .coupon-tier__copy { color: #1d7a46; }

.coupon-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 0.35rem; }
.coupon-card__apply,
.coupon-list__apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  height: auto;
  max-height: none;
  padding: 0.85rem 1.6rem;
  border: 0;
  border-radius: 980px;
  background: var(--cp-accent, #1a73e8);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.coupon-card__apply:hover,
.coupon-list__apply:hover { background: var(--cp-accent-2, #1666d0); color: #fff; }
.coupon-card__apply:focus-visible,
.coupon-list__apply:focus-visible,
.coupon-tier__code:focus-visible,
.coupon-list__code:focus-visible { outline: 2px solid var(--cp-accent, #1a73e8); outline-offset: 3px; }
.coupon-card__apply[aria-busy="true"],
.coupon-list__apply[aria-busy="true"] { opacity: 0.7; cursor: progress; }
/* Applied: the button turns into a quiet confirmation (a tap on it opens the cart). */
.coupon-card__apply[data-on],
.coupon-list__apply[data-on] { background: #e6f5ec; color: #1d7a46; box-shadow: inset 0 0 0 1px rgba(29, 122, 70, 0.25); }
.coupon-card__apply[data-on]::before,
.coupon-list__apply[data-on]::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.85rem;
  margin: -0.2rem 0.1rem 0 0;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.coupon-card__status {
  margin: 0.35rem 0 0;
  max-width: 48ch;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  background: #e6f5ec;
  color: #14532d;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
}
.coupon-card__status[data-kind="wait"] { background: #f5f5f7; color: var(--cp-ink); }
.coupon-card__status[data-kind="warn"] { background: #fff4e5; color: #7a4a06; }
.coupon-card__status[hidden] { display: none; }

/* The stub: how it works and the fine print, behind a perforation with a notch at each end. */
.coupon-card__side {
  position: relative;
  display: grid;
  align-content: center;
  gap: 1.5rem;
  padding: clamp(1.6rem, 3.6vw, 2.75rem);
  border-left: 2px dashed var(--cp-line);
  background: #fbfbfd;
}
.coupon-card__side::before,
.coupon-card__side::after {
  content: "";
  position: absolute;
  left: -14px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--cp-line);
  border-radius: 50%;
  background: var(--cp-page);
}
.coupon-card__side::before { top: -14px; }
.coupon-card__side::after { bottom: -14px; }
.coupon-card__h {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--cp-ink);
}
.coupon-card__steps { list-style: none; counter-reset: coupon-step; display: grid; gap: 0.6rem; margin: 0; padding: 0; }
.coupon-card__steps li {
  counter-increment: coupon-step;
  position: relative;
  margin: 0;
  padding: 0.12rem 0 0 2.3rem;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--cp-ink);
}
.coupon-card__steps li::before {
  content: counter(coupon-step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #eef4fe;
  color: var(--cp-accent);
  font-size: 0.82rem;
  font-weight: 700;
}
.coupon-card__fine { list-style: none; display: grid; gap: 0.4rem; margin: 0; padding: 0; }
.coupon-card__fine li { position: relative; margin: 0; padding: 0 0 0 1rem; font-size: 0.84rem; line-height: 1.5; color: var(--cp-muted); }
.coupon-card__fine li::before { content: ""; position: absolute; left: 0.1rem; top: 0.62em; width: 4px; height: 4px; border-radius: 50%; background: #c7c7cc; }

/* Where the card sits on a tinted section, the notches take that section's colour. */
.sm-section--alt .coupon-card,
.sm-why .coupon-card,
.sm-listing-hero .coupon-card,
.bf-more .coupon-card { --cp-page: #f5f5f7; }
.bf-more .coupon-card { margin: 0 0 clamp(1.75rem, 4vw, 3rem); border: 0; }
.bf-more .coupon-card__eyebrow { color: var(--bf-warm, #f68a1f); }
.promo-callout-section + .coupon-section { padding-bottom: 0; }

@media screen and (max-width: 860px) {
  .coupon-card { grid-template-columns: 1fr; border-radius: 20px; }
  .coupon-card__side { border-left: 0; border-top: 2px dashed var(--cp-line); align-content: start; }
  .coupon-card__side::before,
  .coupon-card__side::after { top: -14px; bottom: auto; }
  .coupon-card__side::before { left: -14px; }
  .coupon-card__side::after { left: auto; right: -14px; }
}
@media screen and (max-width: 520px) {
  .coupon-card__actions { width: 100%; }
  .coupon-card__apply { width: 100%; }
  .coupon-tier { padding: 0.8rem; }
  .coupon-tier__code code { font-size: 0.98rem; letter-spacing: 0.04em; }
}

/* ---------- 2. /coupons: every page's two codes, one quiet row each ---------- */
.coupon-list-section { padding: clamp(1.5rem, 3.5vw, 2.5rem) 0 clamp(2rem, 4vw, 3rem); }
.coupon-list-section .sm-head { margin-bottom: 1.25rem; }
.coupon-list {
  --cp-accent: var(--sm-accent, #1a73e8);
  --cp-accent-2: var(--sm-accent-2, #1666d0);
  list-style: none;
  margin: 0;
  padding: 0 clamp(1rem, 2.5vw, 1.75rem);
  border: 1px solid var(--sm-line, #e8e8ed);
  border-radius: 20px;
  background: #fff;
}
.coupon-list * { box-sizing: border-box; }
.coupon-list__row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0.95rem 0;
  border-top: 1px solid var(--sm-line, #e8e8ed);
}
.coupon-list__row:first-child { border-top: 0; }
.coupon-list__label { font-size: 1rem; font-weight: 600; line-height: 1.35; color: var(--sm-ink, #1d1d1f); }
.coupon-list__label a { color: inherit; text-decoration: underline; text-decoration-color: rgba(29, 29, 31, 0.25); text-underline-offset: 3px; }
.coupon-list__label a:hover { color: var(--cp-accent); text-decoration-color: currentColor; }
.coupon-list__label small { display: block; margin-top: 0.1rem; font-size: 0.78rem; font-weight: 500; color: var(--sm-muted, #6e6e73); }
.coupon-list__codes { display: grid; gap: 0.4rem; min-width: 0; }
.coupon-list__code {
  display: grid;
  grid-template-columns: 6.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  height: auto;
  max-height: none;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: #f5f7fb;
  color: var(--sm-ink, #1d1d1f);
  font-family: inherit;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.coupon-list__code:hover { background: #eef4fe; color: var(--sm-ink, #1d1d1f); }
.coupon-list__code small { font-size: 0.78rem; font-weight: 500; color: var(--sm-muted, #6e6e73); white-space: nowrap; }
.coupon-list__code code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}
.coupon-list__copy { font-size: 0.78rem; font-weight: 600; color: var(--cp-accent); }
.coupon-list__code[data-copied] { background: var(--cp-accent); color: #fff; }
.coupon-list__code[data-copied] small,
.coupon-list__code[data-copied] .coupon-list__copy { color: #fff; }
.coupon-list__code[data-applied] { box-shadow: inset 0 0 0 1.5px #1d7a46; background: #e6f5ec; }
.coupon-list__actions { display: inline-flex; align-items: center; }
.coupon-list__apply { padding: 0.55rem 1.05rem; background: #f5f5f7; color: var(--sm-ink, #1d1d1f); font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.coupon-list__apply:hover { background: #e8e8ed; color: var(--sm-ink, #1d1d1f); }
.coupon-list__status { grid-column: 1 / -1; font-size: 0.86rem; line-height: 1.45; color: #14532d; }
.coupon-list__status[data-kind="wait"] { color: var(--sm-muted, #6e6e73); }
.coupon-list__status[data-kind="warn"] { color: #7a4a06; }
.coupon-list__status[hidden] { display: none; }
@media screen and (max-width: 780px) {
  .coupon-list__row { grid-template-columns: minmax(0, 1fr) auto; }
  .coupon-list__codes { grid-column: 1 / -1; grid-row: 2; }
  .coupon-list__label small { display: inline; margin: 0 0 0 0.4rem; }
}
@media screen and (max-width: 420px) {
  .coupon-list__code { grid-template-columns: minmax(0, 1fr) auto; }
  .coupon-list__code small { grid-column: 1 / -1; }
}

/* ---------- 3a. The cart drawer: the coupon under the subtotal ---------- */
.cart-coupon { margin: 0 0 0.85rem; padding: 0.75rem 0 0; border-top: 1px solid #e8e8ed; font-size: 0.92rem; line-height: 1.4; color: #1d1d1f; }
.cart-coupon[hidden] { display: none; }
.cart-coupon__row { display: flex; align-items: center; gap: 0.6rem; }
.cart-coupon__code {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.22rem 0.55rem;
  border-radius: 7px;
  background: #eef4fe;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}
.cart-coupon__amount { margin-left: auto; font-weight: 700; color: #1d7a46; white-space: nowrap; }
.cart-coupon__state { margin-left: auto; font-size: 0.82rem; font-weight: 600; color: #6e6e73; white-space: nowrap; }
.cart-coupon__remove {
  flex: 0 0 auto;
  margin: 0;
  height: auto;
  max-height: none;
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: #6e6e73;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cart-coupon__remove:hover { background: none; color: #1d1d1f; }
.cart-coupon__note { margin: 0.45rem 0 0; font-size: 0.84rem; line-height: 1.45; color: #6e6e73; }
.cart-coupon[data-state="under"] .cart-coupon__note,
.cart-coupon[data-state="applied"] .cart-coupon__note { color: #1d1d1f; }
.cart-coupon[data-state="blocked"] .cart-coupon__note,
.cart-coupon[data-state="failed"] .cart-coupon__note { color: #7a4a06; }
.cart-coupon__total { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0.6rem 0 0; font-weight: 700; }
.cart-coupon__total span:last-child { font-size: 1.1rem; }

/* ---------- 3b. The confirmation after ?coupon=CODE (and after a tap outside a card) ---------- */
.coupon-toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vw, 2rem);
  z-index: 2147482000;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: max-content;
  max-width: min(92vw, 620px);
  padding: 0.85rem 1rem 0.85rem 1.15rem;
  border-radius: 16px;
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 10px 40px rgba(10, 16, 24, 0.28);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.coupon-toast[data-show] { opacity: 1; transform: translate(-50%, 0); }
.coupon-toast__text { margin: 0; }
.coupon-toast__text strong { font-weight: 700; letter-spacing: 0.03em; }
.coupon-toast__btn,
.coupon-toast__close {
  flex: 0 0 auto;
  margin: 0;
  height: auto;
  max-height: none;
  border: 0;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
}
.coupon-toast__btn { padding: 0.5rem 0.9rem; border-radius: 980px; background: #fff; color: #1d1d1f; font-size: 0.86rem; font-weight: 600; }
.coupon-toast__btn:hover { background: #e8e8ed; color: #1d1d1f; }
.coupon-toast__close { padding: 0.3rem 0.4rem; background: none; color: rgba(255, 255, 255, 0.7); font-size: 1.2rem; }
.coupon-toast__close:hover { background: none; color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .coupon-toast,
  .coupon-card__apply,
  .coupon-list__apply,
  .coupon-tier__code,
  .coupon-list__code { transition: none; }
}

/* ---------- 4. Small links to a coupon: the hero chip and the product pages' "apply it" ---------- */
.coupon-chip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding: 0.62rem 1rem;
  border-radius: 12px;
  background: #eef4fe;
  color: var(--sm-ink, #1d1d1f);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}
.coupon-chip strong { color: var(--sm-accent, #1a73e8); font-weight: 700; letter-spacing: 0.01em; }
.coupon-chip:hover { background: #e1ecfd; color: var(--sm-ink, #1d1d1f); text-decoration: none; }
.coupon-chip:focus-visible { outline: 2px solid var(--sm-accent, #1a73e8); outline-offset: 2px; }
.pdp-promo .pdp-promo__apply {
  display: inline;
  margin: 0;
  height: auto;
  max-height: none;
  padding: 0;
  border: 0;
  background: none;
  color: #1a73e8;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.pdp-promo .pdp-promo__apply:hover { background: none; color: #1666d0; }
.pdp-promo .pdp-promo__apply[data-on] { color: #1d7a46; }
.pdp-promo .pdp-promo__status { margin-top: 0.2rem; color: #14532d; font-weight: 500; }
.pdp-promo .pdp-promo__status[data-kind="warn"] { color: #7a4a06; }
.pdp-promo .pdp-promo__status[hidden] { display: none; }
