/* Buy strip on the product pages (includes/buy-strip.php), plus the page layout around it:
   on desktop the gallery stays put while the right column scrolls, and the strip sits
   at the bottom of the screen at the column's width. Phones: full-width strip at the bottom. */

/* ---------- desktop layout ---------- */
@media (min-width: 768px) {
  .wrapper:has(.cs-buy) { align-items: flex-start; }
  .wrapper:has(.cs-buy) .product-gallery { position: sticky; top: 40px; }
  /* One row of thumbnails that scrolls sideways, so the stuck gallery stays short */
  .wrapper:has(.cs-buy) .thumbnails {
    display: flex; gap: 8px; margin-top: 12px; padding: 2px;
    overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent);
  }
  .wrapper:has(.cs-buy) .thumbnails::-webkit-scrollbar { display: none; }
  .wrapper:has(.cs-buy) .fp-thumb { flex: none; margin: 0; }
  .wrapper:has(.cs-buy) .thumbnails img { display: block; flex: none; margin: 0; width: 64px; }

  /* The strip: last thing in the right column, stuck to the bottom of the screen */
  .cs-buy { position: sticky; bottom: 0; z-index: 5; margin-top: 24px; }
  /* Soft fade above it so the text scrolling underneath doesn't cut off hard */
  .cs-buy::before {
    content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 32px;
    background: linear-gradient(transparent, #000); pointer-events: none;
  }
}

/* ---------- the strip ---------- */
.cs-buy { font-family: 'Open Sans', sans-serif; color: #fff; }
.cs-buy *, .cs-buy *::before, .cs-buy *::after { box-sizing: border-box; }
.cs-buy-inner { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 0; background: #000; }
/* Hairline on top in the nav's pink-blue-cyan, fading out at both ends */
.cs-buy-inner::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252, 95, 173, .7) 18%, rgba(81, 100, 246, .9) 50%, rgba(33, 212, 253, .7) 82%, transparent);
}

/* License switch, each half with its price, and a glowing thumb that slides between them */
.cs-buy-seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; flex: 1; min-width: 0; max-width: 300px;
  padding: 3px; border-radius: 999px; border: 0.5px solid rgba(255, 255, 255, .22);
}
.cs-buy-seg::before {
  content: ''; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: #5164F6;
  box-shadow: 0 0 18px rgba(81, 100, 246, .6), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.cs-buy-seg[data-on="commercial"]::before { transform: translateX(100%); }
.cs-buy-seg--one { max-width: 160px; }
.cs-buy-seg--one::before { width: calc(100% - 6px); }
.cs-buy-seg--one button { cursor: default; }
.cs-buy-seg button {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin: 0; padding: 8px 10px; border: 0; border-radius: 999px; background: none;
  color: rgba(255, 255, 255, .5); cursor: pointer; transition: color .3s;
}
.cs-buy-lic { font: 500 10px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.cs-buy-price { font: 700 15px/1 'Open Sans', sans-serif; font-variant-numeric: tabular-nums; }
.cs-buy-seg button:hover, .cs-buy-seg button[aria-pressed="true"] { color: #fff; }
.cs-buy-seg button:focus-visible, .cs-buy-add:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Add to Cart: white on black, the gradient comes in on hover */
.cs-buy-add {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex: none;
  height: 50px; margin: 0 0 0 auto; padding: 0 22px 0 26px; border: 0; border-radius: 999px; overflow: hidden;
  background: #fff; color: #000; cursor: pointer; white-space: nowrap;
  font: 700 12px/1 'Open Sans', sans-serif; letter-spacing: .12em; text-transform: uppercase;
  transition: color .3s, box-shadow .3s, background-color .3s;
}
.cs-buy-add::before {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: 0;
  background: linear-gradient(135deg, #FC5FAD, #5164F6, #5164F6, #21D4FD); background-size: 300% 300%;
  transition: opacity .35s;
}
.cs-buy-add > * { position: relative; z-index: 1; }
.cs-buy-add:hover { color: #fff; box-shadow: 0 0 18px rgba(81, 100, 246, .6), 0 0 36px rgba(81, 100, 246, .35); }
.cs-buy-add:hover::before { opacity: 1; animation: gradientAnimation 5s ease infinite; }
.cs-buy-arrow, .cs-buy-down { flex: none; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.cs-buy-add:hover .cs-buy-arrow { transform: translateX(3px); }
.cs-buy-add:hover .cs-buy-down { transform: translateY(2px); }
.cs-buy-free, .cs-buy-in, .cs-buy-down { display: none; }
/* Free license: a download link instead of the basket */
.cs-buy-add.is-free .cs-buy-out, .cs-buy-add.is-free .cs-buy-arrow { display: none; }
.cs-buy-add.is-free .cs-buy-free, .cs-buy-add.is-free .cs-buy-down { display: inline; }
/* Already in the basket: outlined, and a click opens the basket */
.cs-buy-add.is-in { background: transparent; color: #fff; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, .5); }
.cs-buy-add.is-in .cs-buy-out { display: none; }
.cs-buy-add.is-in .cs-buy-in { display: inline; }
@keyframes gradientAnimation { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }

/* ---------- phones: one full-width strip along the bottom edge ---------- */
@media (max-width: 767px) {
  body:has(.cs-buy) { padding-bottom: 80px; }
  .cs-buy { position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; }
  .cs-buy-inner {
    gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, .9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .cs-buy-seg { max-width: none; }
  .cs-buy-seg--one { max-width: 140px; }
  .cs-buy-lic { font-size: 9px; letter-spacing: .08em; }
  .cs-buy-price { font-size: 14px; }
  .cs-buy-add { padding: 0 16px 0 20px; gap: 8px; }
  /* Corner pop-up and basket toast sit above the strip */
  body:has(.cs-buy) .cs-pop { bottom: 88px; }
  body:has(.cs-buy) .mnu-toast { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) { .cs-buy-seg::before, .cs-buy-add, .cs-buy-arrow, .cs-buy-down { transition: none; } }
