/* Bag: a wide sheet that rises over the page (and the same layout on /cart). Lines on the left with
   sizes you can change in place and "finish the fit" add-ons; the summary column on the right. */
.cd-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(4,30,66,.55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.cd-overlay.open { opacity: 1; pointer-events: auto; }
.bag-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-height: calc(100% - env(safe-area-inset-top, 0px) - 48px); display: flex; justify-content: center; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.bag-sheet.open { transform: none; }
/* Closed: also out of the accessibility tree and tab order (cart.js sets `inert` too). */
.bag-sheet:not(.open) { visibility: hidden; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s; }
.bag-sheet .bag-sheet-inner { pointer-events: auto; width: min(1180px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--white); border-radius: 12px 12px 0 0; box-shadow: 0 -24px 60px -30px rgba(0,0,0,.6); padding-bottom: env(safe-area-inset-bottom, 0px); }
body.cart-open { overflow: hidden; }
body.cart-open .promo, body:has(.bag-page) .promo { display: none; }

.bag-head { position: sticky; top: 0; z-index: 2; background: var(--white); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 20px max(20px, 3vw); border-bottom: 1px solid var(--line); }
.bag-head h1, .bag-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); color: var(--navy); line-height: 1; }
.bag-head h1 span, .bag-head h2 span { color: var(--muted); font-weight: 600; font-size: .55em; vertical-align: middle; margin-left: 6px; }
.bag-keep { flex: none; display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--white); color: var(--navy); font: 600 14px var(--body); cursor: pointer; white-space: nowrap; }
.bag-keep:hover { border-color: var(--navy); }
.bag-empty { padding: 3.5rem 1.5rem 4rem; text-align: center; }
.bag-empty p { font: 700 1.4rem var(--display); color: var(--navy); margin: 0 0 1.2rem; }
.bag-error { background: #fdecec; color: #8a1c1c; padding: .8rem 1rem; border-radius: var(--radius); margin: 16px 0 0; }

.bag-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.bag-lines { padding: 4px max(20px, 3vw) 32px; min-width: 0; }
.bag-line { display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.bag-img { display: block; width: 124px; aspect-ratio: 4/5; border-radius: var(--radius); overflow: hidden; background: var(--plate); }
.bag-img img { width: 100%; height: 100%; object-fit: cover; }
.bag-info { min-width: 0; }
.bag-line-h { font-size: 20px; line-height: 1.1; color: var(--navy); }
.bag-kind { font-size: 13px; color: var(--muted); margin: 4px 0 12px; min-height: 1em; }
.bag-sizes { margin-bottom: 12px; }
.bag-sizes-in { display: flex; flex-wrap: wrap; gap: 5px; }
.bag-sizes button { min-width: 40px; height: 32px; padding: 0 8px; border: 1px solid var(--line); background: var(--white); border-radius: 2px; font: 600 12.5px var(--body); color: var(--ink); cursor: pointer; }
.bag-sizes button:hover:not(:disabled) { border-color: var(--navy); }
.bag-sizes button.on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.bag-sizes button:disabled { color: #b7c0cc; text-decoration: line-through; cursor: default; }
.bag-acts { display: flex; align-items: center; gap: 16px; }
.bag-qty { display: inline-flex; align-items: center; height: 36px; border: 1px solid var(--line); border-radius: var(--radius); }
.bag-qty button { width: 34px; height: 100%; border: 0; background: none; font-size: 17px; color: var(--navy); cursor: pointer; }
.bag-qty button:disabled { color: #b7c0cc; cursor: not-allowed; }
.bag-qty span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.bag-remove { min-height: 24px; border: 0; background: none; padding: 0; font: 500 13px var(--body); color: var(--muted); text-decoration: underline; cursor: pointer; }
.bag-remove:hover { color: var(--navy); }
.bag-amt { font: 800 19px var(--display); color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }

.bag-fit { margin-top: 28px; }
.bag-fit-h { margin: 0 0 12px; font: 700 12px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--blue-ink); }
.bag-fit-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bag-fit-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.bag-fit-card img { width: 64px; height: auto; aspect-ratio: 4/5; object-fit: cover; border-radius: 2px; background: var(--plate); }
.bag-fit-card b { display: block; font-size: 14px; line-height: 1.25; }
.bag-fit-card span { font-size: 13px; color: var(--muted); }
.bag-fit-card form, .bag-fit-choose { grid-column: 1 / -1; }
.bag-fit-card form button, .bag-fit-choose { display: grid; place-items: center; width: 100%; height: 34px; border: 1px solid var(--navy); background: var(--white); color: var(--navy); border-radius: var(--radius); font: 600 13px var(--body); cursor: pointer; }
.bag-fit-card form button:hover, .bag-fit-choose:hover { background: var(--navy); color: var(--white); }

.bag-sum { background: var(--mist); padding: 28px max(20px, 2.4vw); border-left: 1px solid var(--line); }
.bag-goal { margin-bottom: 24px; }
.bag-goal p { margin: 0 0 10px; font: 700 18px/1.25 var(--display); color: var(--navy); }
.bag-goal em { font-style: normal; background: var(--gold); padding: 0 4px; }
.bag-track { height: 10px; border-radius: 99px; background: #dde3ea; overflow: hidden; }
.bag-track i { display: block; height: 100%; border-radius: inherit; background: var(--navy); }
.bag-ends { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.bag-sum dl { margin: 0; display: grid; gap: 8px; font-size: 15px; }
.bag-sum dl div { display: flex; justify-content: space-between; }
.bag-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.bag-total { border-top: 2px solid var(--navy); padding-top: 14px; margin-top: 8px; align-items: baseline; }
.bag-total dt { font: 800 14px var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--navy); }
.bag-total dd { font: 800 32px var(--display); color: var(--navy); }
.bag-checkout { width: 100%; height: 56px; margin-top: 18px; font-size: 16px; }
.bag-total dt span { display: block; font: 600 11px var(--body); letter-spacing: .06em; text-transform: none; color: var(--muted); }
.bag-disc dd, .bag-disc dt span, .bag-free dd { color: #1f6b3a; }
.bag-disc dt span { font-size: 13px; }

/* Discount code box */
.bag-code { margin: 0 0 20px; }
.bag-code-form label { display: block; font: 600 13px var(--body); color: var(--navy); margin-bottom: 6px; }
.bag-code-form div { display: flex; gap: 8px; }
.bag-code-form input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid #8a97a8; border-radius: var(--radius); background: var(--white); font: 600 15px var(--body); text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.bag-code-form input[aria-invalid="true"] { border-color: #b3261e; }
.bag-code-form button { flex: none; height: 44px; padding: 0 18px; border: 1px solid var(--navy); border-radius: var(--radius); background: var(--white); color: var(--navy); font: 700 14px var(--body); cursor: pointer; }
.bag-code-form button:hover { background: var(--navy); color: var(--white); }
.bag-code > * + * { margin-top: 8px; }
.bag-credit { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px dashed #1f6b3a; border-radius: var(--radius); background: #eef7f0; }
.bag-credit p { margin: 0; }
.bag-credit span { color: var(--muted, #4d5d73); }
.bag-code-on { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px dashed #1f6b3a; border-radius: var(--radius); background: #eef7f0; }
.bag-code-on p { margin: 0; font-size: 13.5px; line-height: 1.4; color: #1f4a2c; }
.bag-code-on b { display: inline-block; margin-right: 4px; letter-spacing: .05em; color: var(--navy); }
.bag-code-bad { border-color: #b3261e; background: #fdecec; }
.bag-code-bad p { color: #8a1c1c; }
.bag-code-msg { margin: 8px 0 0; font-size: 13px; color: #1f4a2c; }
.bag-code-err { color: #8a1c1c; }

/* PayPal: buttons render into .bag-paypal; the form is the no-JS / blocked-SDK fallback. */
.bag-pay { margin-top: 18px; scroll-margin: 24px; }
.bag-paypal { min-height: 48px; position: relative; z-index: 0; }
.bag-optin { display: flex; gap: .55rem; align-items: flex-start; margin: 0 0 12px; font-size: 14px; line-height: 1.35; color: var(--ink); cursor: pointer; }
.bag-optin input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--navy); }
.bag-paypal[hidden], .bag-pay form[hidden], .bag-pay-err[hidden] { display: none; }
.bag-pay .bag-checkout { margin-top: 0; }
.bag-pay-err { margin: 10px 0 0; padding: .7rem .9rem; border-radius: var(--radius); background: #fdecec; color: #8a1c1c; font-size: 13.5px; }
.bag-offline { margin: 0; padding: 12px 14px; border-radius: var(--radius); background: #fff7e0; border: 1px solid var(--gold-line, #e2a32a); color: var(--ink); font-size: 13.5px; line-height: 1.45; }
.bag-offline b { display: block; color: var(--navy); margin-bottom: 2px; }
.bag-sum small { display: block; margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

.bag-page { background: var(--mist); padding: clamp(16px, 3vw, 40px) max(0px, env(safe-area-inset-left, 0px)) clamp(32px, 5vw, 64px); }
.bag-page .bag-sheet-inner { width: min(1180px, 100%); margin-inline: auto; background: var(--white); border-radius: 12px; overflow: clip; border: 1px solid var(--line); }
.bag-page .bag-head { position: static; }

.bag-dock { display: none; }
[data-cart-form].busy { opacity: .55; pointer-events: none; }

@media (max-width: 860px) {
  .bag-body { grid-template-columns: 1fr; }
  .bag-sum { border-left: 0; border-top: 1px solid var(--line); }
  .bag-line { grid-template-columns: 92px minmax(0, 1fr); gap: 14px; }
  .bag-img { width: 92px; }
  .bag-amt { grid-column: 2; text-align: left; font-size: 17px; }
  .bag-fit-row { grid-template-columns: 1fr; }
  .bag-dock { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px max(20px, 3vw) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -18px rgba(4,30,66,.45); }
  .bag-dock b { display: block; font: 800 20px var(--display); color: var(--navy); }
  .bag-dock span { font-size: 12.5px; color: var(--muted); }
  .bag-dock .btn { height: 48px; }
  .bag-head h1 span, .bag-head h2 span { display: block; margin: 4px 0 0; }
}
@media (prefers-reduced-motion: reduce) { .bag-sheet, .cd-overlay { transition: none; } }

/* Order confirmation (/checkout/success) */
.cart-page { padding-block: clamp(2rem, 5vw, 3.2rem) clamp(3rem, 7vw, 5rem); }
.thanks .wrap { max-width: 760px; }
.thanks h1 { font-size: clamp(2rem, 4vw, 2.8rem); color: var(--navy); }
.thanks > .wrap > p { color: var(--muted); margin: .6rem 0 1.6rem; }
.cart-row { display: grid; align-items: center; gap: 1rem; padding: 14px 0; border-bottom: 1px solid var(--line); }
.thanks-row { grid-template-columns: 96px 1fr auto 100px; }
.cart-img { width: 96px; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--plate); }
.cart-img img { width: 100%; height: 100%; object-fit: cover; }
.thanks-title { display: block; font-size: 15.5px; color: var(--ink); }
.cart-info span { display: block; font-size: 14px; color: var(--muted); }
.cart-price, .cart-line { font-size: 15px; font-variant-numeric: tabular-nums; }
.cart-line { text-align: right; }
.thanks-totals { margin: 1.4rem 0 0; display: grid; gap: 10px; }
.thanks-totals div { display: flex; justify-content: space-between; font-size: 14px; }
.thanks-totals dt { font-weight: 700; color: var(--navy); }
.thanks-totals dd { margin: 0; }
.cart-total dt, .cart-total dd { font: 800 18px var(--display); color: var(--navy); }
.thanks .btn { margin-top: 1.6rem; }
@media (max-width: 720px) {
  .thanks-row { grid-template-columns: 70px 1fr auto; }
  .thanks-row .cart-line { display: none; }
}
/* Wholesale shop note in place of the discount code box (App\Wholesale). */
.bag-wholesale p { margin: 0; padding: 12px 14px; background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13.5px; line-height: 1.5; }
.bag-wholesale b { color: var(--navy); }
.bag-wholesale a { color: var(--blue-ink); font-weight: 600; white-space: nowrap; }

/* Checkout paid with credit (templates/checkout-credit.php) */
.cc-wrap { max-width: 640px; }
.cc-lines { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.cc-lines b { float: right; }
.cc-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.cc-form label { display: flex; flex-direction: column; gap: 4px; width: 100%; font-weight: 600; }
.cc-form label span { font-weight: 400; color: var(--muted, #4d5d73); }
.cc-form input { font: inherit; padding: 10px 12px; border: 1px solid #c9d2de; border-radius: var(--radius, 6px); width: 100%; }
.cc-form fieldset { border: 0; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.cc-form legend { font-weight: 700; margin-bottom: 8px; }
.cc-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; width: 100%; }
@media (max-width: 560px) { .cc-row { grid-template-columns: 1fr 1fr; } .cc-row label:first-child { grid-column: 1 / -1; } }
