
/* top / bottom only - the container keeps its side gutter */
.cart-wrap {
  padding-top: 32px;
  padding-bottom: 56px;
}

/* phones only: the count in the title, the X remove */
.cart-title-count,
.cl-remove-ic {
  display: none;
}

.cart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: start;
}

.cart-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 29px;
  letter-spacing: -.01em;
  color: var(--ink-900);
}

.cart-lines {
  border-top: 1px solid var(--border);
}

.cl {
  display: grid;
  grid-template-columns: 88px 1fr 120px 120px;
  gap: 20px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

/* rounded, white photo backgrounds knocked out onto --ink-100 (#f5f6f5) */
.cl-thumb {
  display: block;
  width: 88px;
  height: 88px;
  background: var(--ink-100);
  border: none;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: opacity .15s;
}

.cl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: darken;
  display: block;
}

.cl-thumb:hover {
  opacity: .85;
}

/* a line with no product link (cart.php) */
.cl-thumb.is-static {
  cursor: default;
  opacity: 1;
}

.cl-mid {
  min-width: 0;
}

.cl-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin-bottom: 4px;
}

.cl-name {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  line-height: 21px;
  color: var(--ink-900);
  margin-bottom: 6px;
  display: block;
  transition: color .15s;
}

.cl-name:hover {
  color: var(--accent-600);
}

.cl-variant {
  font-size: 13px;
  color: var(--fg-secondary);
}

.cl-variant+.cl-variant {
  margin-top: 2px;
}

.cl-config {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--accent-600);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cl-config:hover {
  color: var(--accent-700);
  text-decoration-thickness: 2px;
}

.cl-qtywrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.cl-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 34px;
  overflow: hidden;
}

.cl-stepper button {
  width: 34px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--fg-secondary);
  transition: background .12s, color .12s;
}

.cl-stepper button:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

.cl-stepper input {
  width: 34px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border: none;
  outline: none
}

/* Chrome, Safari, Edge, Opera */
.cl-stepper input::-webkit-outer-spin-button,
.cl-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
.cl-stepper input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.cl-remove {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}

.cl-remove:hover {
  color: var(--sale-500);
}

.cl-price {
  text-align: right;
}

.cl-price-now {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
}

.cl-price-now.is-sale {
  color: var(--sale-500);
}

.cl-save {
  margin-top: 6px;
}

.cl-price-was {
  font-size: 13px;
  color: var(--fg-tertiary);
  text-decoration: line-through;
  margin-top: 4px;
}

/* Summary rail */
.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-totals {
  background: var(--ink-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
}

.cs-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  padding: 6px 0;
  color: var(--ink-900);
}

.cs-row .cs-label {
  color: var(--fg-secondary);
}

/* under "Discount - PRO20": "10% max on Tamahagane / Sashikomi A++ builds" (builder-discount-cap.php). The amount
   keeps "-$275" on one line next to the longer label (a hyphen is a break point) */
.cs-coupon-note {
  display: block;
  margin-top: 2px;
  padding-right: 12px;
  font-size: 12px;
  line-height: 1.35;
}

.cs-discount {
  white-space: nowrap;
}

.cs-row .cs-val {
  font-weight: 500;
}

.cs-discount {
  color: var(--sale-500);
  font-weight: 600;
}

.cs-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0 6px;
}

.cs-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
}

.cs-checkout {
  width: 100%;
  height: 52px;
  margin-top: 12px;
  background: var(--accent-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, transform .15s;
}

/* a link - keep the sitewide a:hover colour off it, only the button darkens */
.cs-checkout:hover,
.cs-checkout:focus {
  color: #fff;
  text-decoration: none;
  background: var(--accent-600);
}

.cs-checkout:hover {
  transform: translateY(-1px);
}

.cs-pay {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}

.cs-pay img {
  width: 44px;
  height: auto;
  display: block;
}

.cs-promo {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
}

.cs-promo-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink-900);
}

.cs-promo-title span {
  color: var(--fg-tertiary);
  font-weight: 400;
}

.cs-promo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.cs-promo-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.cs-promo-input:focus {
  border-color: var(--ink-900);
}

.cs-promo-input.is-error {
  border-color: var(--sale-500);
}

.cs-promo-apply {
  height: 40px;
  padding: 0 18px;
  background: var(--brand-700);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: background .15s;
}

.cs-promo-apply:hover {
  background: var(--ink-900);
}

.cs-promo-err {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fbe9e9;
  border: 1px solid var(--sale-500);
  border-radius: 4px;
  font-size: 13px;
  color: #c01414;
  line-height: 16px;
}

.cs-promo-err[hidden] {
  display: none;
}

.cs-applied {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ok-100);
  border: 1px dashed var(--ok-600);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--ink-900);
}

.cs-applied[hidden] {
  display: none;
}

.cs-applied .cs-applied-label {
  color: var(--fg-secondary);
}

.cs-applied-x {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--fg-tertiary);
  display: inline-flex;
  align-items: center;
  transition: color .15s;
}

.cs-applied-x:hover {
  color: var(--sale-500);
}

/* Similar products */
.cart-similar {
  margin: 0 0 48px 0;
}

.cart-similar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cart-similar-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  letter-spacing: -.01em;
  color: var(--ink-900);
}

/* Empty cart */
.cart-empty {
  padding: 72px 24px 96px;
}

.cart-empty[hidden] {
  display: none;
}

.cart-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.cart-empty-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -.015em;
  line-height: 1.1;
  color: var(--ink-900);
}

.cart-empty-sub {
  margin: 0 0 28px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--fg-secondary);
  max-width: 440px;
}

.cart-empty-ctas {
  display: flex;
  gap: 10px;
  margin-bottom: 48px;
}

.cart-empty-primary {
  height: 48px;
  padding: 0 24px;
  background: var(--ink-900);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cart-empty-primary:hover {
  background: var(--brand-900);
}

.cart-empty-ghost {
  height: 48px;
  padding: 0 24px;
  background: transparent;
  color: var(--ink-900);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
}

.cart-empty-ghost:hover {
  background: var(--ink-100);
  border-color: var(--ink-300);
}

/* the CTAs are links (cart-empty.php) - centred like the design's buttons, no link hover colour */
.cart-empty-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-empty-primary,
.cart-empty-ghost,
.cart-empty-primary:hover,
.cart-empty-ghost:hover {
  text-decoration: none;
}

.cart-empty-primary:hover {
  color: #fff;
}

.cart-empty-ghost:hover {
  color: var(--ink-900);
}

.cartm-checkout-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  display: none;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.cartm-checkout-bar-total {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex: 0 0 auto;
}

.cartm-checkout-bar-total small {
  font-size: 11px;
  color: var(--fg-tertiary);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cartm-checkout-bar-total b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink-900);
  margin-top: 2px;
}

/* a link - keep the sitewide a:hover colour off it */
.cartm-checkout-bar .btn:hover,
.cartm-checkout-bar .btn:focus {
  color: #fff;
  text-decoration: none;
}

.cartm-checkout-bar .btn {
  flex: 1 1 auto;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
}

/* ═══════════════════════════ CONFIG MODAL ══════════════════════ */
.cfg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(10, 15, 14, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cfg-overlay.is-open {
  display: flex;
}

.cfg-dialog {
  background: #fff;
  border-radius: 12px;
  width: min(640px, 100%);
  max-height: 90vh;
  /* phones: the visible height, without the browser's toolbars */
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .4);
}

.cfg-head {
  position: relative;
  padding: 24px 28px 8px;
}

.cfg-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-900);
}

.cfg-close:hover {
  background: var(--ink-100);
}

.cfg-title {
  margin: 0 0 16px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  line-height: 28px;
  letter-spacing: -.005em;
  color: var(--ink-900);
}

.cfg-tabs {
  display: flex;
  background: var(--ink-100);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  /* the narrowest phones scroll the tabs sideways instead of wrapping them */
  overflow-x: auto;
  scrollbar-width: none;
}

.cfg-tab {
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  color: var(--fg-tertiary);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-family: inherit;
}

.cfg-tab.is-active {
  font-weight: 600;
  background: #fff;
  color: var(--ink-900);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.cfg-body {
  padding: 8px 28px 24px;
  overflow-y: auto;
  flex: 1;
}

.cfg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.cfg-row-label {
  color: var(--fg-secondary);
}

.cfg-row-value {
  font-weight: 500;
  color: var(--ink-900);
}

.cfg-row-price {
  font-weight: 700;
  color: var(--ink-900);
  font-size: 16px;
  min-width: 48px;
  text-align: right;
}

.cfg-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 14px 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
}

.cfg-subtotal .cfg-subtotal-label {
  color: var(--fg-secondary);
}

.cfg-note-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: var(--fg-tertiary);
  margin: 16px 0 10px;
}

.cfg-note {
  padding: 14px 16px;
  background: var(--ink-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-900);
  font-style: italic;
  overflow-wrap: anywhere;
}

/* ═══════════════════ BUILDER CONFIG POPUP (plugin) ═════════════════
   The katana builder plugin's View Configuration popup (.skb-cfg-*, plugin
   katana-cart.css). On phones the plugin pins it to the bottom (align-items:
   flex-end) at max-height 88vh - but iOS measures vh with its toolbars hidden,
   so while they show, a long tab made the sheet taller than the screen. It ran
   out past the top, taking the X with it, and covered the whole backdrop: no
   way to close it. Same on landscape phones (centred, 90vh + 24px padding).
   Sized against the overlay (the visible area) instead, positioned with auto
   margins (overflow then goes downwards, not off the top) and the overlay
   scrolls if something still doesn't fit */
body .skb-cfg-overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* the overlay follows the visible area while the toolbars show/hide */
@supports (height: 100dvh) {
  body .skb-cfg-overlay {
    bottom: auto;
    height: 100dvh;
  }
}

.skb-cfg-overlay .skb-cfg-dialog {
  margin: auto;
  max-height: min(90vh, 100%);
}

@media (max-width: 640px) {
  /* the bottom sheet - the top 12% stays backdrop, a tap there closes it */
  .skb-cfg-overlay .skb-cfg-dialog {
    margin: auto 0 0;
    max-height: 88%;
  }
}

/* ═══════════════════════════ TABLET ════════════════════════════ */
@media (min-width: 721px) and (max-width: 1024px) {
  .cart-wrap.container,
  .cart-similar .container {
    padding-left: 40px;
    padding-right: 40px;
  }
}

/* 900–1024px: two columns still fit — just tighten the summary rail. */
@media (min-width: 901px) and (max-width: 1024px) {
  .cart-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
  }

}

/* 721–900px: stack — items full width, then the summary as a wide card. */
@media (min-width: 721px) and (max-width: 900px) {
  .cart-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .cart-summary {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .cs-totals {
    flex: 1 1 300px;
    order: 2;
  }

  .cs-promo {
    flex: 1 1 300px;
    align-self: stretch;
    order: 1;
  }

  .cs-checkout {
    max-width: 100%;
  }

}

/* ═══════════════════════════ PHONES ════════════════════════════
   handoff/cart.html .cart-mobile on the same markup as desktop: thumb left, X top right,
   stepper + price on the bottom row; promo, totals, pay icons; total + checkout pinned below */
@media (max-width: 720px) {
  .cart-wrap.container {
    padding: 0 16px 24px;
  }

  .cart-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .cart-title {
    margin: 0;
    padding: 18px 0 10px;
    font-size: 24px;
  }

  .cart-title-count {
    display: inline;
    color: var(--fg-tertiary);
    font-weight: 400;
    font-size: 18px;
  }

  .cl {
    position: relative;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb mid mid"
      "thumb qty price";
    column-gap: 12px;
    row-gap: 10px;
    align-items: start;
    padding: 16px 0;
  }

  .cl-thumb {
    grid-area: thumb;
    width: 72px;
    height: 72px;
  }

  .cl-mid {
    grid-area: mid;
    padding-right: 28px;
  }

  .cl-brand {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .cl-name {
    font-size: 15px;
    line-height: 18px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cl-qtywrap {
    grid-area: qty;
    align-self: center;
    align-items: flex-start;
  }

  .cl-stepper {
    height: 30px;
  }

  .cl-stepper button {
    width: 30px;
    height: 28px;
  }

  .cl-stepper input {
    width: 28px;
  }

  /* Remove -> X at the top right */
  .cl-remove {
    position: absolute;
    top: 12px;
    right: -4px;
    padding: 4px;
    display: inline-flex;
    color: var(--fg-tertiary);
    text-decoration: none;
  }

  .cl-remove-label {
    display: none;
  }

  .cl-remove-ic {
    display: block;
  }

  /* price, was-price on one line, the save chip under them */
  .cl-price {
    grid-area: price;
    align-self: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: baseline;
    column-gap: 6px;
  }

  .cl-price-now {
    order: 1;
  }

  .cl-price-was {
    order: 2;
    margin-top: 0;
  }

  .cl-save {
    order: 3;
    flex-basis: 100%;
    text-align: right;
    margin-top: 2px;
    line-height: 1;
  }

  .cart-summary {
    padding: 20px 0 8px;
    gap: 14px;
  }

  .cs-promo {
    order: -1;
    padding: 14px;
  }

  .cs-totals {
    padding: 14px;
  }

  /* the pinned bar has the checkout button */
  .cs-totals .cs-checkout {
    display: none;
  }

  .cartm-checkout-bar {
    display: flex;
  }

  /* room for the pinned bar at the end of the page */
  body.woocommerce-cart {
    padding-bottom: 72px;
  }

  .cart-similar {
    margin-top: 24px;
  }

  .cart-similar .container {
    padding: 0 16px;
  }

  .cart-similar-head h2 {
    font-size: 20px;
  }
}
/* empty cart on phones: the two CTAs stack, full width */
.cart-empty-primary,
.cart-empty-ghost {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .cart-empty {
    padding: 48px 16px 64px;
  }

  .cart-empty-ctas {
    flex-direction: column;
    align-self: stretch;
  }

  .cart-empty-title {
    font-size: 32px;
  }

  /* config modal - all four tabs (blade, handle, scabbard, order note) on one row */
  .cfg-overlay {
    padding: 16px;
  }

  .cfg-head {
    padding: 22px 16px 8px;
  }

  .cfg-title {
    font-size: 20px;
    line-height: 26px;
    padding: 0 24px;
  }

  .cfg-tab {
    padding: 7px 11px;
    font-size: 13px;
  }

  .cfg-body {
    padding: 8px 18px 20px;
  }
}
