/*
================================================================
Space Vanta Theme 2.0
Module: Product purchase (styles)
Path: public/product/product/purchase.css
Version: PDP-PURCHASE-002

Same structure and class names as before. The look moves to the
brand language used in the cart: warm paper ground, metal edges,
chamfered corners, a blue part sitting on an offset metal plate,
blue as the single accent. One motion at a time; all of it off
under prefers-reduced-motion and <html data-sv-motion="calm">.
================================================================
*/

.sv-product-information-purchase,
.sv-pdp-dock {
  --svp-ink: var(--sv-ink, #252321);
  --svp-muted: #5f574d;
  --svp-line: #cfc8bb;
  --svp-paper: #fbf7f0;
  --svp-blue: var(--sv-blue, #1d6bff);
  --svp-blue-hi: var(--sv-blue-2, #4d8dff);
  --svp-blue-lo: #1458e0;
  --svp-metal: linear-gradient(135deg, #f7f8fa 0%, #c9cbd1 26%, #eef0f4 50%, #b9c1ce 76%, #f4f5f8 100%);
  --svp-mono: ui-monospace, "IBM Plex Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

.sv-product-information-purchase {
  width: 100%;
  min-width: 0;
  margin-top: 32px;
}

.sv-product-information-purchase__content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- quantity ---------- */

.sv-product-purchase-quantity {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sv-product-purchase-quantity__label {
  display: block;
  width: fit-content;
  margin: 0;
  font-family: var(--svp-mono);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--svp-muted);
}

.sv-product-purchase-quantity__control {
  position: relative;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--svp-line);
  color: var(--svp-ink);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: border-color 0.2s ease;
}

/* the two cut corners keep a line, so the shape reads as a plate */
.sv-product-purchase-quantity__control::before,
.sv-product-purchase-quantity__control::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  pointer-events: none;
  opacity: 1;
  background: linear-gradient(135deg, transparent calc(50% - 0.5px), var(--svp-line) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}
.sv-product-purchase-quantity__control::before { left: -1px; top: -1px; }
.sv-product-purchase-quantity__control::after { right: -1px; bottom: -1px; }

.sv-product-purchase-quantity__control:focus-within { border-color: var(--svp-blue); }

.sv-product-purchase-quantity__button {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sv-product-purchase-quantity__button:hover { background: rgba(37, 35, 33, 0.06); color: var(--svp-blue); }
.sv-product-purchase-quantity__button:active { transform: scale(0.9); }

.sv-product-purchase-quantity__input {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  appearance: textfield;
  -moz-appearance: textfield;
}

.sv-product-purchase-quantity__input::-webkit-inner-spin-button,
.sv-product-purchase-quantity__input::-webkit-outer-spin-button { margin: 0; appearance: none; -webkit-appearance: none; }
.sv-product-purchase-quantity__input:focus { outline: none; }

/* ---------- buttons: a part on a plate ---------- */

.sv-product-purchase-add-to-cart,
.sv-product-purchase-shop-now { width: 100%; }

.sv-product-purchase-add-to-cart__plate,
.sv-product-purchase-shop-now__plate {
  position: relative;
  padding: 0 7px 7px 0;
}

/* the plate behind: offset down and right */
.sv-product-purchase-add-to-cart__plate::before,
.sv-product-purchase-shop-now__plate::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  right: 0;
  bottom: 0;
  background: var(--svp-metal);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: opacity 0.2s ease;
}

.sv-product-purchase-add-to-cart__button,
.sv-product-purchase-shop-now__button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  border: 0;
  border-radius: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.18s ease, background 0.25s ease, color 0.25s ease, filter 0.25s ease;
}

.sv-product-purchase-add-to-cart__button {
  min-height: 58px;
  color: #fff;
  background: linear-gradient(180deg, #2273ff 0%, var(--svp-blue) 55%, var(--svp-blue-lo) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.sv-product-purchase-shop-now__button {
  min-height: 50px;
  font-size: 12.5px;
  color: var(--svp-ink);
  background: var(--svp-paper);
  box-shadow: inset 0 0 0 1.5px #aeb6c2;
}

/* a light that follows the pointer on the blue part; a sweep on press */
.sv-product-purchase-add-to-cart__button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(170px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 62%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.sv-product-purchase-add-to-cart__button:hover::before { opacity: 1; }

.sv-product-purchase-add-to-cart__button::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -35%;
  width: 24%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.sv-product-purchase-add-to-cart__plate:hover .sv-product-purchase-add-to-cart__button,
.sv-product-purchase-shop-now__plate:hover .sv-product-purchase-shop-now__button { transform: translate(-2px, -2px); }

.sv-product-purchase-add-to-cart__plate:active .sv-product-purchase-add-to-cart__button,
.sv-product-purchase-shop-now__plate:active .sv-product-purchase-shop-now__button { transform: translate(2px, 2px); }

.sv-product-purchase-shop-now__button:hover { box-shadow: inset 0 0 0 1.5px var(--svp-blue); color: var(--svp-blue); }

.sv-product-purchase-add-to-cart__button:focus-visible,
.sv-product-purchase-shop-now__button:focus-visible,
.sv-product-purchase-quantity__button:focus-visible,
.sv-pdp-dock__button:focus-visible {
  outline: 2px solid var(--svp-blue);
  outline-offset: 3px;
}

/* the check mark that appears on success */
.sv-product-purchase-add-to-cart__check {
  position: absolute;
  width: 0;
  height: 18px;
  opacity: 0;
  overflow: hidden;
  flex: none;
}

/* loading: the light runs along the part */
.sv-product-purchase-add-to-cart__button.is-loading,
.sv-product-purchase-shop-now__button.is-loading { cursor: wait; filter: saturate(0.8); }
.sv-product-purchase-add-to-cart__button.is-loading::after { opacity: 1; animation: svp-sweep 0.95s ease-in-out infinite; }

/* added: the blue steps back, the metal comes forward, a ring leaves the button */
.sv-product-purchase-add-to-cart__button.is-added {
  color: var(--svp-blue);
  background: linear-gradient(180deg, #ffffff, #eef0f4);
  box-shadow: inset 0 0 0 1.5px var(--svp-blue);
  cursor: default;
}
.sv-product-purchase-add-to-cart__button.is-added .sv-product-purchase-add-to-cart__check {
  position: static;
  width: 18px;
  opacity: 1;
  animation: svp-check 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.sv-product-purchase-add-to-cart__plate:has(.is-added)::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 7px;
  bottom: 7px;
  border: 1.5px solid var(--svp-blue);
  pointer-events: none;
  animation: svp-ring 0.8s ease-out both;
}

.sv-product-purchase-add-to-cart__button.is-error,
.sv-product-purchase-shop-now__button.is-error {
  color: #8a1f1f;
  background: #fbeaea;
  box-shadow: inset 0 0 0 1.5px #c9565a;
}

/* sold out: flat, no part left to press */
.sv-product-purchase-add-to-cart__button.is-soldout,
.sv-product-purchase-shop-now__button.is-soldout {
  color: #8d867a;
  background: #ebe6db;
  box-shadow: inset 0 0 0 1px var(--svp-line);
  cursor: not-allowed;
  transform: none !important;
}
.sv-product-purchase-add-to-cart__plate:has(.is-soldout)::before,
.sv-product-purchase-shop-now__plate:has(.is-soldout)::before { opacity: 0.4; }

.sv-product-purchase-add-to-cart__button:disabled,
.sv-product-purchase-shop-now__button:disabled { cursor: not-allowed; }
.sv-product-purchase-add-to-cart__button.is-loading:disabled,
.sv-product-purchase-shop-now__button.is-loading:disabled { cursor: wait; }

/* ---------- delivery note ---------- */

.sv-product-purchase__note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 2px 0 0;
  font-family: var(--svp-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--svp-muted);
}
.sv-product-purchase__note-mark { width: 13px; height: 13px; flex: none; color: var(--svp-blue); }
.sv-product-purchase__note-sep { width: 1px; height: 12px; background: var(--svp-line); transform: skewX(-24deg); }

/* ---------- phone dock ---------- */

.sv-pdp-dock { display: none; }

@media (max-width: 749px) {
  .sv-pdp-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--svp-paper);
    box-shadow: 0 -10px 24px rgba(37, 35, 33, 0.08);
    transform: translateY(110%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.3s;
  }

  .sv-pdp-dock::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, #b9c1ce, #f4f5f8 45%, #b9c1ce);
  }

  .sv-pdp-dock.is-on { transform: none; visibility: visible; transition-delay: 0s; }

  .sv-pdp-dock__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .sv-pdp-dock__title { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--svp-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sv-pdp-dock__price { font-family: var(--svp-mono); font-size: 12px; color: var(--svp-muted); }

  .sv-pdp-dock__plate { position: relative; flex: none; padding: 0 5px 5px 0; }
  .sv-pdp-dock__plate::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 5px;
    right: 0;
    bottom: 0;
    background: var(--svp-metal);
    clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  }

  .sv-pdp-dock__button {
    position: relative;
    min-width: 148px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #2273ff 0%, var(--svp-blue) 55%, var(--svp-blue-lo) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
    cursor: pointer;
  }
  .sv-pdp-dock__button.is-loading { cursor: wait; filter: saturate(0.8); }
  .sv-pdp-dock__button.is-added { color: var(--svp-blue); background: linear-gradient(180deg, #fff, #eef0f4); box-shadow: inset 0 0 0 1.5px var(--svp-blue); }
  .sv-pdp-dock__button.is-error { color: #8a1f1f; background: #fbeaea; box-shadow: inset 0 0 0 1.5px #c9565a; }
  .sv-pdp-dock__button.is-soldout { color: #8d867a; background: #ebe6db; box-shadow: inset 0 0 0 1px var(--svp-line); cursor: not-allowed; }

  /* keep the last lines of the page clear of the dock */
  html.sv-pdp-dock-on body { padding-bottom: 76px; }

  .sv-product-information-purchase { margin-top: 28px; }
  .sv-product-information-purchase__content { gap: 16px; }
  .sv-product-purchase-add-to-cart__button { min-height: 56px; }
  .sv-product-purchase-shop-now__button { min-height: 50px; }
  .sv-product-purchase-quantity__button { width: 44px; height: 44px; }
  .sv-product-purchase-quantity__input { width: 48px; height: 44px; }
}

/* ---------- motion ---------- */

@keyframes svp-sweep { from { left: -35%; } to { left: 115%; } }
@keyframes svp-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.06, 1.22); } }
@keyframes svp-check { from { opacity: 0; transform: scale(0.5) rotate(-12deg); } to { opacity: 1; transform: none; } }

html[data-sv-motion="calm"] .sv-product-information-purchase *,
html[data-sv-motion="calm"] .sv-product-information-purchase *::before,
html[data-sv-motion="calm"] .sv-product-information-purchase *::after,
html[data-sv-motion="calm"] .sv-pdp-dock,
html[data-sv-motion="calm"] .sv-pdp-dock * {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .sv-product-information-purchase *,
  .sv-product-information-purchase *::before,
  .sv-product-information-purchase *::after,
  .sv-pdp-dock,
  .sv-pdp-dock * {
    animation: none !important;
    transition: none !important;
  }
}
