/* =====================================================
   Product page on phones (Current Storefront, every store): Quantity and Size Chart as two equal cards on one row, the open chart full width
   under them. Linked with media="(max-width: 767.98px)", so wider screens never apply any of it. Colours come from the store's own
   --pdp-primary; with the TeesBunker purple they are the approved purple/lavender.
   .has-qty / .has-chart say which cards this product shows: one card alone takes the whole row.
===================================================== */
body.tb-store .pdp-premium .pdp-qs {
  --qs-lav: color-mix(in srgb, var(--pdp-primary) 14%, #fff);
  --qs-lav-soft: color-mix(in srgb, var(--pdp-primary) 6%, #fff);
  --qs-edge: color-mix(in srgb, var(--pdp-primary) 26%, #fff);
  --qs-accent: color-mix(in srgb, var(--pdp-primary) 82%, #fff);
  --qs-radius: 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 clamp(8px, 2.6vw, 11px); margin: 0 0 10px;
}
@supports (color: hsl(from red h s l)) {
  body.tb-store .pdp-premium .pdp-qs {
    --qs-lav: hsl(from var(--pdp-primary) calc(h - 9) calc(s * .9) 91.500%);
    --qs-lav-soft: hsl(from var(--pdp-primary) calc(h - 9) calc(s * .75) 98%);
    --qs-edge: hsl(from var(--pdp-primary) calc(h - 6) calc(s * .62) 83%);
    --qs-accent: hsl(from var(--pdp-primary) calc(h - 7) calc(s * .58) 49%);
  }
}
/* anything else in the block (personalisation uploads) stays full width above the cards, as before */
body.tb-store .pdp-premium .pdp-qs > * { grid-column: 1 / -1; order: 1; }
body.tb-store .pdp-premium .pdp-qs > .pdp-qty-row { order: 2; grid-column: 1; }
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card { order: 2; grid-column: 2; }
body.tb-store .pdp-premium .pdp-qs > .sci { order: 3; }
body.tb-store .pdp-premium .pdp-qs:not(.has-chart) > .pdp-qty-row, body.tb-store .pdp-premium .pdp-qs:not(.has-qty) > .pdp-sc-card { grid-column: 1 / -1; }

/* combo boxes and phone cases show neither card: no row, no gap */
body.tb-store .pdp-premium .pdp-qs:not(.has-qty):not(.has-chart) { display: block; margin: 0; }

/* ---------- Quantity ---------- */
body.tb-store .pdp-premium .pdp-info .pdp-qs > .input-row.pdp-qty-row {
  position: relative; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 4px; min-width: 0; min-height: 64px; margin: 0; padding: 0 0 6px;
  border: 1px solid var(--qs-edge); border-radius: var(--qs-radius); overflow: hidden;
  background: var(--qs-lav); box-shadow: 0 2px 8px color-mix(in srgb, var(--pdp-primary) 10%, transparent);
}
body.tb-store .pdp-premium .pdp-qs .pdp-qty-row .label {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 7px; max-width: 100%; margin: -1px 0 0 -1px; padding: 4px 14px 4px 10px;
  border-radius: var(--qs-radius) 15px 18px 0; background: linear-gradient(100deg, var(--pdp-primary) 0%, color-mix(in srgb, var(--pdp-primary) 93%, #fff) 100%);
  font-size: clamp(12.5px, 3.6vw, 14px); font-weight: 700; line-height: 1.2; letter-spacing: 0; text-transform: none; color: #fff;
}
body.tb-store .pdp-premium .pdp-qs .pdp-qty-row .label::before {
  content: ""; flex: none; width: 15px; height: 15px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.900' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.500 2.500 7.500 12 12.500l9.500-5z'/%3E%3Cpath d='m2.500 12 9.500 5 9.500-5'/%3E%3Cpath d='m2.500 16.500 9.500 5 9.500-5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.900' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2.500 2.500 7.500 12 12.500l9.500-5z'/%3E%3Cpath d='m2.500 12 9.500 5 9.500-5'/%3E%3Cpath d='m2.500 16.500 9.500 5 9.500-5'/%3E%3C/svg%3E") center/contain no-repeat;
}
body.tb-store .pdp-premium .pdp-qs .pdp-qty-row quantity-wrapper.quantity-wrapper {
  display: flex; align-items: center; justify-content: space-between; height: 32px; margin: 0 clamp(7px, 2.4vw, 11px); padding: 0; border: 0; border-radius: 999px; overflow: visible; min-width: 0;
  background: #fff; box-shadow: 0 1px 5px color-mix(in srgb, var(--pdp-primary) 16%, transparent);
}
/* the whole end of the pill is the touch target (stretched to ~44px tall by ::after); the ring inside it is only drawn */
body.tb-store .pdp-premium .pdp-qs .quantity-btn { position: relative; flex: none; width: 44px; height: 32px; margin: 0; background: none; -webkit-tap-highlight-color: transparent; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn::before { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 1.5px solid var(--qs-lav); border-radius: 50%; transition: background .15s; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn:active::before { background: var(--qs-lav); }
body.tb-store .pdp-premium .pdp-qs .quantity-btn:focus-visible { outline: 0; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn:focus-visible::before { outline: 2px solid var(--pdp-primary); }
body.tb-store .pdp-premium .pdp-qs .quantity-btn::after { content: ""; position: absolute; inset: -6px 0; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn svg { position: relative; width: 16px; height: 16px; color: var(--pdp-primary); stroke-width: 2.600; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn.is-off { cursor: default; }
body.tb-store .pdp-premium .pdp-qs .quantity-btn.is-off svg { opacity: .32; }
body.tb-store .pdp-premium .pdp-qs .quantity-input {
  flex: 1 1 0; width: auto !important; min-width: 0; height: 32px !important; margin: 0; padding: 0; border: 0; background: none; box-shadow: none;
  font-size: 16px; font-weight: 700; text-align: center; color: var(--pdp-tb-ink); -moz-appearance: textfield; appearance: textfield;
}
body.tb-store .pdp-premium .pdp-qs .quantity-input::-webkit-outer-spin-button, body.tb-store .pdp-premium .pdp-qs .quantity-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* no size chart on this product: one slim full-width bar */
body.tb-store .pdp-premium .pdp-info .pdp-qs:not(.has-chart) > .input-row.pdp-qty-row { flex-direction: row; align-items: center; min-height: 46px; padding: 0; }
body.tb-store .pdp-premium .pdp-qs:not(.has-chart) .pdp-qty-row .label { align-self: stretch; padding: 0 20px 0 14px; border-radius: 0 var(--qs-radius) var(--qs-radius) 0; margin-bottom: -1px; }
body.tb-store .pdp-premium .pdp-qs:not(.has-chart) .pdp-qty-row quantity-wrapper.quantity-wrapper { flex: 0 1 180px; }

/* ---------- Size Chart: the whole card is the button ---------- */
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card {
  position: relative; display: flex !important; align-items: center; gap: clamp(5px, 1.9vw, 8px); width: 100%;   /* !important: the theme hides [hidden] with one, and sets capitals on buttons with another */ min-width: 0; min-height: 64px; margin: 0; padding: 5px clamp(7px, 2.5vw, 11px);
  border: 1px solid var(--qs-edge); border-radius: var(--qs-radius); overflow: hidden; background: linear-gradient(150deg, var(--qs-lav-soft) 0%, #fff 45%, var(--qs-lav-soft) 100%);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--pdp-primary) 10%, transparent); text-align: left; text-transform: none !important; letter-spacing: 0 !important; color: var(--pdp-tb-ink);
  cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card::after { content: ""; position: absolute; right: -22%; bottom: -50px; width: 88%; height: 70px; border-radius: 50%; background: var(--qs-lav); opacity: .8; transform: rotate(-7deg); pointer-events: none; }
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card > * { position: relative; z-index: 1; }
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card:active { background: var(--qs-lav-soft); }
body.tb-store .pdp-premium .pdp-qs > .pdp-sc-card:focus-visible { outline: 2px solid var(--pdp-primary); outline-offset: 2px; }
body.tb-store .pdp-premium .pdp-sc-card__tape { flex: none; width: clamp(22px, 7.4vw, 32px); height: auto; margin: 0; color: var(--pdp-primary); }
body.tb-store .pdp-premium .pdp-sc-card__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
body.tb-store .pdp-premium .pdp-sc-card__title { font-size: clamp(12.5px, 3.9vw, 16px); font-weight: 700; line-height: 1.2; white-space: nowrap; color: var(--pdp-tb-ink); }
body.tb-store .pdp-premium .pdp-sc-card__sub { font-size: clamp(10px, 2.85vw, 12px); font-weight: 500; line-height: 1.25; color: var(--pdp-tb-slate); }
body.tb-store .pdp-premium .pdp-sc-card__go { flex: none; display: flex; align-items: center; justify-content: center; width: clamp(22px, 7vw, 28px); height: clamp(22px, 7vw, 28px); border-radius: 50%; background: var(--qs-accent); color: #fff; }
body.tb-store .pdp-premium .pdp-sc-card__go svg { width: 60%; height: 60%; margin: 0; transition: transform .2s; }
body.tb-store .pdp-premium .pdp-sc-card[aria-expanded="true"] .pdp-sc-card__go svg { transform: rotate(90deg); }
body.tb-store .pdp-premium .pdp-qs:not(.has-qty) > .pdp-sc-card { min-height: 50px; }

/* ---------- the chart itself: same panel, opened by the card, full width under the row ---------- */
body.tb-store .pdp-premium .pdp-qs > #sciPanel { margin: 8px 0 0; border-color: var(--qs-edge); border-radius: var(--qs-radius); }
body.tb-store .pdp-premium .pdp-qs > #sciPanel:not([open]) { display: none; }
body.tb-store .pdp-premium .pdp-qs > #sciPanel > .sci__head { display: none; }

/* older charts (an accordion further down): the card replaces the small link beside the sizes */
body.tb-store .pdp-premium form:has(.pdp-sc-card) .pdp-size-guide-btn { display: none; }
@media (prefers-reduced-motion: reduce) { body.tb-store .pdp-premium .pdp-sc-card__go svg { transition: none; } }
