/*  The cart: the header icon, the drawer and the "it went in" disc. Built by
    site-js/cart.js on every page, so nothing here depends on a page's own markup.
    Light like the site, with the plug-in's dark plate behind each product photo. */

/* ── Header icon ───────────────────────────────────────────────────────── */
.header-cart {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.header-cart[hidden] { display: none; }
.header-cart:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.header-cart:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.header-cart.has-items { border-color: rgba(26, 147, 111, .45); box-shadow: 0 8px 22px rgba(26, 147, 111, .16); }
.header-cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--accent-solid);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}
.header-cart-count[hidden] { display: none; }
.header-cart.is-bumped { animation: cart-bump .5s cubic-bezier(.3, 1.6, .5, 1); }
.header-cart.is-bumped .header-cart-count { animation: cart-count-pop .5s cubic-bezier(.3, 1.6, .5, 1); }

@keyframes cart-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.16) rotate(-6deg); }
  70% { transform: scale(.96) rotate(3deg); }
  100% { transform: scale(1); }
}
@keyframes cart-count-pop {
  0% { transform: scale(.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* The disc that flies from the pressed button to the header icon. */
.cart-fly {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1200;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8fe3c2, var(--accent-solid) 70%);
  box-shadow: 0 6px 18px rgba(26, 147, 111, .45), 0 0 0 4px rgba(26, 147, 111, .14);
  pointer-events: none;
}

/* ── Layer and scrim ───────────────────────────────────────────────────── */
html.cart-open { overflow: hidden; }

.cart-layer {
  position: fixed;
  inset: 0;
  z-index: 1100;
}
.cart-layer[hidden] { display: none; }

.cart-scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 23, 28, .32);
  opacity: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity .32s ease;
}
.cart-layer.is-open .cart-scrim { opacity: 1; }

/* ── The drawer ────────────────────────────────────────────────────────── */
.cart-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  overflow: hidden;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(70% 40% at 100% 0%, rgba(26, 147, 111, .13), transparent 70%),
    radial-gradient(60% 35% at 0% 100%, rgba(213, 185, 66, .14), transparent 70%),
    #fbfbff;
  box-shadow: -30px 0 80px rgba(23, 23, 28, .18);
  color: var(--ink);
  transform: translateX(104%);
  transition: transform .44s cubic-bezier(.2, .85, .2, 1);
  outline: none;
}
.cart-layer.is-open .cart-drawer { transform: none; }

.cart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 28px 18px;
}
.cart-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.cart-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: ww-pulse 2.4s ease-in-out infinite;
}
.cart-title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.04em;
}
.cart-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, color .2s ease;
}
.cart-x:hover { transform: rotate(90deg); border-color: var(--ink); color: var(--ink); }

.cart-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 28px 20px;
}

/* ── Lines ─────────────────────────────────────────────────────────────── */
.cart-lines { display: grid; gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.cart-line,
.cart-suggest {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 14px 34px rgba(47, 47, 47, .07);
  animation: cart-line-in .5s cubic-bezier(.2, .85, .2, 1) both;
  transition: opacity .22s ease, transform .22s ease;
}
.cart-line.is-leaving { opacity: 0; transform: translateX(30px) scale(.97); }

@keyframes cart-line-in {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.cart-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: #141416;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(23, 23, 28, .22);
}
.cart-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: cart-thumb-float 6s ease-in-out infinite;
}
.cart-thumb.is-plate {
  background:
    radial-gradient(90% 90% at 100% 0%, rgba(26, 147, 111, .55), transparent 60%),
    radial-gradient(80% 80% at 0% 100%, rgba(125, 91, 214, .45), transparent 60%),
    #17171c;
}
@keyframes cart-thumb-float {
  0%, 100% { transform: scale(1.06) translateY(0); }
  50% { transform: scale(1.06) translateY(-3px); }
}

.cart-line-text { min-width: 0; }
.cart-line-name { margin: 0 0 3px; font-size: 16px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.cart-line-terms { margin: 0 0 6px; color: var(--ink-mut); font-size: 12.5px; line-height: 1.45; }
.cart-remove {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-mut);
  font: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cart-remove:hover { color: var(--coral-ink); }
.cart-line-price { display: grid; justify-items: end; gap: 2px; margin: 0; align-self: start; padding-top: 4px; white-space: nowrap; }
.cart-line-price s { color: var(--ink-mut); font-family: var(--mono); font-size: 11.5px; }
.cart-line-price strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }

/* ── Empty ─────────────────────────────────────────────────────────────── */
.cart-empty[hidden] { display: none; }
.cart-empty { display: grid; gap: 14px; }
.cart-empty-lede { margin: 0 0 4px; color: var(--ink-dim); font-size: 15px; }
.cart-suggest-add {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-solid);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cart-suggest-add:hover { background: #136b4e; }
.cart-empty-trial { color: var(--accent-ink); font-size: 14px; font-weight: 500; }

/* ── Code, totals, sale ────────────────────────────────────────────────── */
.cart-code[hidden],
.cart-sum[hidden] { display: none; }
.cart-code { margin: 0 0 20px; }
.cart-code-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.cart-code-row { display: flex; gap: 8px; }
.cart-code-row input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cart-code-row input::placeholder { color: #a9a9b2; text-transform: none; }
.cart-code-row input:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.cart-code-apply {
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cart-code-apply:hover { background: var(--ink); color: #fff; }
.cart-code-note { margin: 8px 0 0; font-size: 13px; }
.cart-code-note[hidden] { display: none; }
.cart-code-note.is-good { color: var(--accent-ink); }
.cart-code-note.is-bad { color: var(--coral-ink); }

.cart-sum {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  margin: 0;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.cart-sum dt { color: var(--ink-dim); }
.cart-sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.cart-sum .is-saving { color: var(--accent-ink); font-weight: 600; }
.cart-sum dt.is-total { align-self: end; color: var(--ink); font-weight: 600; }
.cart-sum dd.is-total { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }

.cart-sale {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(254, 94, 65, .09);
  color: var(--coral-ink);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
}
.cart-sale[hidden] { display: none; }
.cart-sale::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  animation: ww-pulse 1.6s ease-in-out infinite;
}

/* ── Foot ──────────────────────────────────────────────────────────────── */
.cart-foot {
  display: grid;
  gap: 12px;
  padding: 18px 28px max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(251, 251, 255, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cart-checkout {
  position: relative;
  min-height: 58px;
  padding: 14px 24px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--accent-solid);
  color: #fff;
  font: inherit;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  box-shadow: 0 18px 38px rgba(26, 147, 111, .3);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.cart-checkout[hidden] { display: none; }
.cart-checkout::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-18deg);
  animation: cart-shine 3.6s ease-in-out infinite;
}
.cart-checkout:hover { background: #136b4e; transform: translateY(-2px); box-shadow: 0 22px 44px rgba(26, 147, 111, .36); }
.cart-checkout:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.cart-checkout[aria-busy="true"] { cursor: progress; transform: none; }
.cart-checkout[aria-busy="true"]::after { animation-duration: 1.1s; }

@keyframes cart-shine {
  0%, 55% { left: -40%; }
  100% { left: 130%; }
}

.cart-status { margin: 0; color: var(--ink-dim); font-size: 13px; text-align: center; }
.cart-status[hidden] { display: none; }
.cart-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(254, 94, 65, .09); color: var(--coral-ink); font-size: 13.5px; line-height: 1.5; }
.cart-error[hidden] { display: none; }
.cart-error-link { color: inherit; font-weight: 600; }

.cart-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin: 2px 0 0;
  padding: 0;
  color: var(--ink-dim);
  font-size: 12px;
  list-style: none;
}
.cart-trust[hidden] { display: none; }
.cart-trust li { display: inline-flex; align-items: center; gap: 6px; }
.cart-trust li::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%) 3px 5px / 4px 4px no-repeat,
    linear-gradient(-45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%) 5px 3px / 7px 7px no-repeat,
    var(--accent);
}
.cart-fine { margin: 0; color: var(--ink-mut); font-size: 12px; line-height: 1.55; text-align: center; }
.cart-fine[hidden] { display: none; }
.cart-keep {
  justify-self: center;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cart-keep:hover { color: var(--accent-ink); }

/* ── Add-to-cart buttons anywhere on the site ──────────────────────────── */
[data-add-to-cart][hidden] { display: none !important; }
[data-add-to-cart].is-in-cart { position: relative; }

/* ── Phones: a bottom sheet ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-cart { width: 40px; height: 40px; }
  .cart-drawer {
    top: auto;
    width: 100%;
    max-height: min(88vh, 88dvh);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -24px 60px rgba(23, 23, 28, .2);
    transform: translateY(104%);
  }
  .cart-drawer::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 42px;
    height: 4px;
    margin-left: -21px;
    border-radius: 999px;
    background: var(--line-2);
  }
  .cart-head { padding: 24px 20px 14px; }
  .cart-title { font-size: 24px; }
  .cart-body { padding: 2px 20px 16px; }
  .cart-foot { padding: 14px 20px max(18px, env(safe-area-inset-bottom)); }
  .cart-line,
  .cart-suggest { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; padding: 10px; }
  .cart-keep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer,
  .cart-scrim,
  .cart-line { transition: none; animation: none; }
  .cart-thumb img,
  .cart-checkout::after,
  .cart-kicker::before,
  .cart-sale::before { animation: none; }
}
