:root {
  --spc-border-color: #d9d9d9;
  --spc-text-color: #1f1f1f;
  --spc-surface: #ffffff;
  --spc-overlay: rgba(0, 0, 0, 0.4);
  /*--spc-accent: #111111;*/
  --spc-accent: var(--color-primary-nav-links, #111111);
  --spc-accent-contrast: #ffffff;
  --spc-accent-contrast: contrast-color(var(--spc-accent));
}

/*.spc-buy { margin: 0 0 1rem; }*/

.spc-buy-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;

  .spc-buy.stacked & {
    display: grid;
    grid-template-columns: auto 1fr;
    max-width: 200px;

    add-to-cart {
      grid-column: span 2;
    }
  }
}

.spc-buy-box {
  display: inline-flex;
  gap: 0.5rem;
  align-items: stretch;
}

.spc-buy-price {
  align-self: center;
  font-weight: 600;
  white-space: nowrap;
}

add-to-cart {
  align-items: center;
  display: inline-flex;
  position: relative;
  text-align: center;
  white-space: nowrap;
}

add-to-cart > div {
  margin-inline: auto;
  padding-left: 2rem;
  position: relative;
  width: fit-content;
}

add-to-cart > div::before {
  background: currentColor;
  content: "";
  height: 1rem;
  left: 0;
  top: 50%;
  translate: 0 -50%;
  position: absolute;
  width: 1.5rem;
  mask-image: url('/wp-content/themes/ffws-brands/dist/img/icons.svg#cart');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('/wp-content/themes/ffws-brands/dist/img/icons.svg#cart');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

add-to-cart > div > span:first-child {
  display: inline-block;
}

add-to-cart > div > span:last-child {
  left: 0;
  opacity: 0;
  position: absolute;
  right: 0;
  text-align: center;
  translate: 0 calc(0.75 * var(--height, 20px));
}

qty-counter {
  --border-radius: 4px;
  --border-width: 1px;
  --button-width: 24px;
  --gap: .25rem;
  --padding: 2px;
  align-items: stretch;
  background: #fff;
  border: var(--border-width) solid hsl(from currentColor h s calc(l + 30));
  border-radius: var(--border-radius);
  /*color: var(--color-site-text, #000);*/
  color: hsl(from var(--color-site-text,#000) h s calc(l + 30));
  display: inline-grid;
  gap: var(--gap);
  grid-template-columns: min-content 1fr min-content;
  min-height: 32px;
  min-width: calc((var(--button-width) * 2) + 2ch + var(--border-width) * 2 + var(--padding) * 2 + var(--gap) * 2);
  padding: var(--padding);
  transition: all .2s ease-in-out;
    
}

qty-counter:hover {
  border-color: #aaa;
}

qty-counter input[type="number"] {
  background: transparent;
  border: unset;
  color: inherit;
  field-sizing: content;
  font-size: .875rem;
  outline: none;
  padding: 0;
  text-align: center;
}

qty-counter input[type="number"]::-webkit-inner-spin-button,
qty-counter input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

qty-counter button {
  align-items: center;
  background-color: rgb(from var(--color-site-text) r g b / 0.5);
  border: unset;
  background-color: currentColor;
  color: inherit;
  cursor: pointer;
  display: flex;
  font-size: 0;
  justify-content: center;
  mask-size: 10px auto;
  mask-repeat: no-repeat;
  mask-position: 50% 50%;
  -webkit-mask-size: 10px auto;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: 50% 50%;
  padding: 0;
  text-align: center;
  text-box: trim-both cap alphabetic;
  transition: all .2s ease-in-out;
  width: var(--button-width);
  white-space: nowrap;
}

qty-counter button:hover {
  /*background-color: rgb(from var(--color-site-text) r g b);*/
  background-color: hsl(from currentColor h s calc(l + 20));
}

qty-counter button:first-child {
  mask-image: url("/wp-content/themes/ffws-brands/dist/img/icons.svg#minus");
  mask-repeat: no-repeat;
  mask-size: 10px auto;
  mask-position: 50% 50%;
  -webkit-mask-image: url("/wp-content/themes/ffws-brands/dist/img/icons.svg#minus");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 10px auto;
  -webkit-mask-position: 50% 50%;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
}

qty-counter button:last-child {
  mask-image: url("/wp-content/themes/ffws-brands/dist/img/icons.svg#plus");
  mask-repeat: no-repeat;
  mask-size: 10px auto;
  mask-position: 50% 50%;
  -webkit-mask-image: url("/wp-content/themes/ffws-brands/dist/img/icons.svg#plus");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 10px auto;
  -webkit-mask-position: 50% 50%;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.spc-buy-qty {
  width: 5.5rem;
  border: 1px solid var(--spc-border-color);
  border-radius: 4px;
  padding: 0.45rem 0.55rem;
}

.spc-buy-button,
add-to-cart,
.spc-cart-button,
.spc-cart-checkout,
.spc-cart-close {
  cursor: pointer;
  font: inherit;
}

.spc-buy-button,
add-to-cart,
.spc-cart-checkout,
.spc-cart-close {
  background: var(--spc-surface);
  color: var(--spc-text-color);
  border-radius: 4px;
}

.spc-cart-button,
.spc-cart-close {
  border: none;
}

.spc-buy-button,
.spc-cart-checkout {
  padding: 0.55rem 0.8rem;
}

.spc-cart-button {
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 .375rem 0 0;
  position: relative;
}

.spc-cart-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--spc-accent);
  color: var(--spc-accent-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  position: absolute;
  right: 0;
  top: 0;
  translate: 50% -50%;
}

.spc-cart-button-label {
  background-color: var(--spc-accent);
  font-size: 0;
  height: 20px;
  -webkit-mask-image: url(/wp-content/themes/ffws-brands/dist/img/icons.svg#cart);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-image: url(/wp-content/themes/ffws-brands/dist/img/icons.svg#cart);
  mask-repeat: no-repeat;
  mask-size: contain;
  width: 30px;
}

.spc-cart-badge.is-empty {
  opacity: 0.6;
}

.spc-floating-cart-button {
  background: white;
  border-radius: 8px 0 0 8px;
  padding: 1.5rem 1rem 0.5rem 0.5rem;
  position: fixed;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  z-index: 9999;

  .spc-cart-button-label {
    background-color: var(--color-option-1);
  }

  .spc-cart-badge {
    background-color: var(--color-option-1);
    color: var(--color-primary-nav-links);
    right: 1rem;
    top: 1rem;
  }
}

.spc-cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--spc-overlay);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9998;
}

.spc-cart-overlay.is-open {
  opacity: 1;
}

.spc-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: var(--spc-surface);
  color: var(--spc-text-color);
  font-weight: 400;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 99999;
}

.spc-cart-drawer.is-open {
  transform: translateX(0);
}

.spc-cart-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.spc-cart-header {
  padding: 1rem;
  border-bottom: 1px solid var(--spc-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.spc-cart-header h2 {
  color: inherit;
  margin: 0;
  font-size: 1.1rem;
}

.spc-cart-close {
  width: 1.25rem;
  height: 1.25rem;
  line-height: 1;
  font-size: 0;
  background: url(/wp-content/themes/ffws-brands/dist/img/icons.svg#close) 50% 50% / contain no-repeat;
}

.spc-cart-items {
  flex: 1;
  overflow: auto;
  padding: 0.9rem 1rem;
}

.spc-cart-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--spc-border-color);
}

.spc-cart-item-image {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 4px;
}

.spc-cart-item-details {
  align-items: center;
  display: grid;
  gap: .25rem 1rem;
  grid-template-columns: 1fr min-content;
}

.spc-cart-item-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--spc-border-color);
  background: #f7f7f7;
  color: #666666;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.spc-cart-item-title,
.spc-cart-item-variant-title {
  grid-column: span 2;
}

.spc-cart-item-title {
  font-family: var(--font-family-headings);
  font-weight: 700;
  margin-bottom: 0;
}

.spc-cart-item-variant-title {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  opacity: 0.75;
}

.spc-cart-item-price {
  font-weight: 500;
}

.spc-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  align-self: center;
}

.spc-line-qty {
  width: 4.5rem;
  border: 1px solid var(--spc-border-color);
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
}

.spc-cart-empty {
  margin: 0;
  padding: 1rem;
}

.spc-cart-footer {
  border-top: 1px solid var(--spc-border-color);
  padding: 1rem;
}

.spc-cart-subtotal {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.spc-cart-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.spc-cart-checkout {
  /*background: var(--spc-accent);
  color: var(--spc-accent-contrast);
  border-color: var(--spc-accent);*/
}

.spc-cart-item.is-removing {
  animation: spc-cart-item-fade-out 0.24s ease forwards;
  pointer-events: none;
}

@keyframes spc-cart-item-fade-out {
  to {
    opacity: 0;
    transform: translateX(8px);
  }
}

body.spc-cart-open {
  overflow: hidden;
}

/*@media (max-width: 480px) {
  .spc-floating-cart-button {
    right: 0.9rem;
    bottom: 0.9rem;
  }
}*/
