/* One catalogue dock: remaining budget and selection share a single surface.
 * The wave marks spent progress: expenses grow -> wave moves right. */
body{--selection-dock-bottom:max(14px,env(safe-area-inset-bottom));--selection-dock-gutter:20px}
.selection-dock{display:contents}
/* A static, non-interactive veil covers cards behind the dock through the
 * bottom safe area. The dock itself stays sharp in the next stacking layer. */
body:has(#selectionBar:not([hidden]))::after{
  content:"";position:fixed;z-index:39;inset:auto 0 0;pointer-events:none;
  height:calc(var(--selection-bar-height,180px) + var(--selection-dock-bottom) + 24px);
  background:linear-gradient(to bottom,#13151880,#131518f2);
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
  -webkit-mask-image:linear-gradient(to bottom,transparent,#000 24px);
  mask-image:linear-gradient(to bottom,transparent,#000 24px);
}
[data-theme=light] body:has(#selectionBar:not([hidden]))::after{background:linear-gradient(to bottom,#171a2029,#171a2073)}
.selection-bar{
  --budget-fill-color:#56baa92b;--budget-wave-size:32px;
  --budget-light:#b6ffe066;--budget-mint:#99e1ec44;--budget-light-strength:.5;
  --budget-wave-light:#b2ffe953;
  position:fixed;z-index:40;isolation:isolate;left:max(20px,env(safe-area-inset-left));right:max(20px,env(safe-area-inset-right));bottom:var(--selection-dock-bottom);
  --selection-columns:minmax(0,1.1fr) minmax(0,.9fr);
  display:grid;grid-template-columns:var(--selection-columns);
  align-items:center;gap:10px 24px;width:auto;max-width:1040px;margin-inline:auto;padding:16px 20px;
  border-radius:24px;background:var(--surface);box-shadow:0 10px 40px #0004;
  animation:selection-in .18s ease-out;font-variant-numeric:tabular-nums;
}
[data-theme=dark] .selection-bar{background:#161c1f;--muted:#f5f6f8}
[data-theme=light] .selection-bar{--muted:#4b555f;--budget-fill-color:#7dc7b72e;--budget-light:#72bca93b;--budget-mint:#7bc2d333;--budget-light-strength:.42;--budget-wave-light:#45988847}
[data-theme=light] .selection-bar[data-state=within]{--muted:#09212e;--budget-fill-color:#22b7c9;--budget-light:#e8ffff55;--budget-mint:#aefbf43b;--budget-wave-light:#dcffffb0}
.selection-bar .budget-track{position:absolute;z-index:-1;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}
.selection-bar .budget-track>#budgetFill{position:absolute;inset:0 auto 0 0;width:var(--budget-position,0%);overflow:hidden;background:var(--budget-fill-color);transition:width .58s cubic-bezier(.2,.7,.2,1)}
.selection-bar .budget-track>#budgetEdge{display:none;position:absolute;inset:0 auto 0 0;left:var(--budget-position,0%);width:min(var(--budget-wave-size),var(--budget-wave-room,0%));transform:translateX(-50%);overflow:hidden;transition:left .58s cubic-bezier(.2,.7,.2,1),width .58s cubic-bezier(.2,.7,.2,1);pointer-events:none}
/* The coast and its reflection share one phase. One visible period has
 * mean x=20 and at most 15% of the strip width in either direction. */
.budget-wave{position:absolute;inset:0 auto auto 0;display:block;width:100%;height:300%;overflow:visible;fill:none;stroke:none}
.budget-wave-fill{fill:var(--budget-fill-color);stroke:none}
.budget-wave-lip{fill:none;stroke:url(#budgetWaveLight);stroke-width:2.2}
#budgetWaveLight stop{stop-color:var(--budget-wave-light)}
@media(prefers-reduced-motion:no-preference){
  #budgetFill::before{content:"";position:absolute;inset:-40% max(40%,48px) -40% -40%;pointer-events:none;opacity:var(--budget-light-strength);background:radial-gradient(ellipse 72% 7% at 38% 34%,var(--budget-light),transparent 74%),radial-gradient(ellipse 90% 9% at 60% 68%,var(--budget-mint),transparent 70%),radial-gradient(ellipse 65% 5% at 28% 82%,var(--budget-light),transparent 75%);animation:budget-sea-current 16.8s ease-in-out -4.2s infinite alternate paused}
  /* Use the same geometry even at 0/100%, where the strip collapses
   * to zero. Both edges then interpolate together through either endpoint. */
  .selection-bar .budget-track>#budgetFill{width:calc(var(--budget-position,0%) - min(var(--budget-wave-size) / 2,var(--budget-wave-room,0%) / 2))}
  .selection-bar .budget-track>#budgetEdge{display:block}
  @starting-style{
    .selection-bar .budget-track>#budgetFill{width:0}
    .selection-bar .budget-track>#budgetEdge{left:0;width:0}
  }
  .budget-wave{animation:budget-sea-flow 13.6s linear -2.1s infinite paused}
  .selection-bar:not([hidden])[data-budget-animated=true][data-motion-paused=false] #budgetFill::before,
  .selection-bar:not([hidden])[data-budget-wave=true][data-motion-paused=false] .budget-wave{animation-play-state:running}
}
@keyframes budget-sea-flow{to{transform:translate3d(0,-33.333333%,0)}}
@keyframes budget-sea-current{
  0%{transform:translate3d(-8%,5%,0) rotate(-7deg) scale(1);opacity:calc(var(--budget-light-strength)*.4)}
  47%{transform:translate3d(6%,-8%,0) rotate(4deg) scale(1.08);opacity:var(--budget-light-strength)}
  100%{transform:translate3d(12%,4%,0) rotate(-3deg) scale(.96);opacity:calc(var(--budget-light-strength)*.65)}
}
.selection-bar .budget-track.is-unknown>span{visibility:hidden}
.selection-bar[data-state=over]{--budget-fill-color:#e96d5a20;--budget-light:#ffd2c066;--budget-mint:#e6a19355}
[data-theme=light] .selection-bar[data-state=over]{--budget-fill-color:#c3443514;--budget-light:#e59a824d;--budget-mint:#c9776744}
.selection-bar .live-budget{grid-column:1/-1;display:grid;grid-template-columns:var(--selection-columns);align-items:center;column-gap:24px;min-width:0}
.budget-limit,.budget-balance{min-width:0}
.budget-limit-label,.budget-balance-heading{font-size:14px;line-height:1.3;color:var(--muted);font-weight:400}
.budget-balance{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:flex-end;gap:0 8px}
.budget-balance-heading{min-width:0}
/* The numeric percentage remains available to screen readers without taking
 * space from the compact, visible remainder. */
#budgetPercent{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.selection-bar .budget-limit strong,.selection-bar .budget-balance strong{min-width:0;max-width:100%;font-size:22px;line-height:1.3;font-weight:700;letter-spacing:-.5px;overflow-wrap:anywhere}
.selection-bar .budget-balance strong{color:var(--lime)}
[data-theme=light] .selection-bar .budget-balance strong{color:#466100}
[data-theme=light] .selection-bar[data-state=within] .budget-balance strong{color:#172300}
.selection-bar[data-state=over] .budget-balance strong{color:var(--danger)}
.selection-bar[data-state=unknown] .budget-balance strong{color:var(--ink)}
.selection-bar .budget-edit{display:flex;align-items:center;justify-content:flex-start;gap:10px;width:100%;min-width:0;min-height:44px;max-width:100%;padding:0;border-radius:8px;color:var(--ink);text-align:left}
.selection-bar .budget-edit:hover{background:var(--surface-soft)}
.selection-bar .budget-edit svg{width:20px;height:20px;color:var(--muted)}
.selection-bar[data-state=none] .live-budget{grid-template-columns:minmax(0,1fr)}
.selection-discount,.cart-discount{
  display:flex;align-items:baseline;justify-content:space-between;gap:4px 12px;
  min-width:0;color:var(--muted);font-size:14px;line-height:1.35;
}
.selection-discount{grid-column:1/-1;padding-top:6px;border-top:1px solid color-mix(in srgb,var(--ink) 15%,transparent)}
.cart-discount{margin-top:8px;padding-top:8px;border-top:1px solid var(--line)}
.discount-value{flex:none;white-space:nowrap;font-weight:650;font-variant-numeric:tabular-nums;color:var(--card-selected-price)}
[data-theme=light] .selection-discount .discount-value{color:var(--ink)}
@media(max-width:759px){.selection-discount{font-size:12px;padding-top:4px;margin-top:2px}}
.selection-summary{display:grid;gap:3px;min-width:0}
#selectionTitle{color:var(--muted);font-size:14px;line-height:1.4}
#selectionSubtitle{display:grid;gap:2px;min-width:0}
.selection-amount{font-size:34px;line-height:1.2;font-weight:750;letter-spacing:-.8px;white-space:nowrap}
#selectionSubtitle[data-long=true] .selection-amount{white-space:normal;overflow-wrap:anywhere}
.selection-price-note{font-size:12px;line-height:1.35;color:var(--muted)}
.selection-bar .primary{min-height:56px;gap:18px;padding:12px 20px;border-radius:16px;font-size:20px;white-space:nowrap;justify-content:space-between}
.selection-bar .primary>span[aria-hidden]{font-size:29px;font-weight:400;line-height:1}
.selection-bar .primary:disabled{opacity:1;background:var(--surface-soft);color:var(--muted)}
.selection-budget-help{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 14px;min-width:0}
#budgetHint{min-width:0;flex:1 1 190px;color:var(--muted);font-size:12px;line-height:1.4;overflow-wrap:anywhere}
.selection-budget-help .fit-budget-trigger{width:auto;min-height:44px;padding:8px 12px;background:var(--surface-soft);color:var(--ink);font-size:12px}
body:has(#selectionBar:not([hidden])){padding-bottom:calc(var(--selection-bar-height,180px) + 44px + env(safe-area-inset-bottom))}
body:has(#selectionBar:not([hidden])) .toast{bottom:calc(var(--selection-bar-height,180px) + 28px + env(safe-area-inset-bottom))}
body:has(#selectionBar:not([hidden])) .service-card{scroll-margin-bottom:calc(var(--selection-bar-height,180px) + 40px)}
@media(max-width:759px){
  body{--selection-dock-bottom:max(12px,env(safe-area-inset-bottom));--selection-dock-gutter:10px}
  .selection-bar{--budget-wave-size:24px;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));padding:8px 12px;gap:2px 12px;border-radius:20px}
  .selection-bar .live-budget{column-gap:12px}
  .budget-limit-label,.budget-balance-heading{font-size:11px}
  .budget-balance{column-gap:6px}
  .selection-bar .budget-limit strong,.selection-bar .budget-balance strong{font-size:14px;letter-spacing:-.3px;line-height:1.35}
  .selection-bar .budget-edit{gap:5px}
  .selection-bar .budget-edit svg{width:17px;height:17px}
  #selectionTitle{font-size:11px}
  .selection-amount{font-size:22px;letter-spacing:-.5px}
  #selectionSubtitle[data-long=true] .selection-amount{font-size:17px}
  .selection-bar[data-large-budget=true] .budget-edit{display:grid;grid-template-columns:minmax(0,1fr) 17px;align-content:center;gap:1px 5px}
  .selection-bar[data-large-budget=true] .budget-limit-label{grid-column:1/-1}
  .selection-bar[data-large-budget=true] .budget-limit strong,.selection-bar[data-large-budget=true] .budget-balance strong{font-size:12px}
  .selection-price-note{font-size:11px}
  .selection-bar .primary{min-height:44px;gap:10px;padding:9px 12px;font-size:14px;border-radius:13px}
  .selection-open-label{display:inline}
  .selection-bar .primary>span[aria-hidden]{font-size:23px}
  .selection-budget-help{gap:4px 10px;margin-top:4px}
  #budgetHint{font-size:11px;flex-basis:140px}
  .selection-budget-help .fit-budget-trigger{font-size:11px;gap:5px;padding-inline:10px}
}
/* Safari extends the background of the fixed edge into its bottom toolbar.
 * Keep that edge on a solid full-width element, outside the animated panel. */
@media screen and (max-width:759px), screen and (pointer:coarse){
  .selection-dock:has(> .selection-bar:not([hidden])){
    display:block;
    position:fixed;
    z-index:40;
    inset:auto 0 0;
    padding:0 max(var(--selection-dock-gutter),env(safe-area-inset-right)) var(--selection-dock-bottom) max(var(--selection-dock-gutter),env(safe-area-inset-left));
    background-color:var(--bg);
    box-shadow:0 -4px 12px #0002;
  }
  body .selection-dock > #selectionBar{position:relative;inset:auto;box-shadow:none}
  body:has(#selectionBar:not([hidden]))::after{content:none}
}
@media screen and (max-width:759px){
  .tshirt-formats-route .selection-dock{--selection-dock-gutter:0px}
}
@media(max-width:359px){
  .selection-budget-help .budget-fit-extra{display:none}
  .selection-bar{padding-inline:10px;column-gap:8px}
  .selection-bar .live-budget{column-gap:8px}
  .selection-bar .budget-edit{display:grid;grid-template-columns:minmax(0,1fr) 17px;align-content:center;gap:1px 4px}
  .selection-bar .budget-limit-label{grid-column:1/-1}
  .budget-balance{display:grid;gap:1px;justify-items:end}
  .selection-bar .budget-limit strong,.selection-bar .budget-balance strong{font-size:13px;letter-spacing:-.3px}
  .selection-amount{font-size:18px}
  #selectionSubtitle[data-long=true] .selection-amount{font-size:14px}
  .selection-bar[data-large-budget=true] .budget-limit strong,.selection-bar[data-large-budget=true] .budget-balance strong{font-size:12px}
  .selection-bar .primary{padding-inline:10px;font-size:12px;gap:6px}
}
@media(max-height:480px) and (min-width:600px){
  .selection-bar{grid-template-columns:minmax(0,1.7fr) minmax(0,1fr) auto;gap:12px;padding:8px 12px;border-radius:16px}
  .selection-bar .live-budget{grid-column:auto;grid-template-columns:var(--selection-columns);column-gap:10px}
  .selection-bar .budget-edit{display:grid;grid-template-columns:minmax(0,1fr) 17px;align-content:center;gap:1px 4px}
  .selection-bar .budget-limit-label{grid-column:1/-1}
  .budget-balance{display:grid;gap:1px;justify-items:end}
  .selection-bar .budget-limit strong,.selection-bar .budget-balance strong{font-size:15px;letter-spacing:-.4px}
  .budget-limit-label,.budget-balance-heading,#selectionTitle{font-size:11px}
  .selection-amount{font-size:20px}
  .selection-bar .primary{min-height:46px;font-size:13px;padding:9px 12px;gap:10px}
  .selection-budget-help{grid-column:1/-1}
}
@media(forced-colors:active){
  body:has(#selectionBar:not([hidden]))::after{content:none}
  .selection-bar{border-color:CanvasText}
  .selection-bar .budget-balance strong{color:CanvasText}
  .selection-bar .budget-track{display:none}
  #budgetFill::before,.budget-wave{animation:none}
}
@media print{.selection-bar{display:none!important}body:has(#selectionBar:not([hidden]))::after{content:none}}

/* The SVG follows the same spent position as the CSS fill. */
.selection-bar .budget-track>#budgetGlass{
  --glass-deep:#082e35;--glass-mid:#0c4249;--glass-bright:#135e63;
  --glass-lines:#93ded3;--glass-light:#b7f8ed;
  position:absolute;inset:0;width:100%;height:100%;display:block;visibility:hidden;pointer-events:none;stroke:none
}
[data-theme=light] #selectionBar #budgetGlass{
  --glass-deep:#0da5bb;--glass-mid:#17b8c6;--glass-bright:#2bc9c6;
  --glass-lines:#e4fff8;--glass-light:#f0fffd
}
#selectionBar[data-state=over] #budgetGlass{
  --glass-deep:#392428;--glass-mid:#4a2c32;--glass-bright:#593339;
  --glass-lines:#e6a193;--glass-light:#ffd2c0
}
[data-theme=light] #selectionBar[data-state=over] #budgetGlass{
  --glass-deep:#edc7bd;--glass-mid:#f3d3c9;--glass-bright:#fae1d6;
  --glass-lines:#fff5e9;--glass-light:#fff9ee
}
#budgetGlass .budget-glass-deep{stop-color:var(--glass-deep)}
#budgetGlass .budget-glass-mid{stop-color:var(--glass-mid)}
#budgetGlass .budget-glass-bright{stop-color:var(--glass-bright)}
#budgetGlass .budget-glass-network{color:var(--glass-lines)}
#budgetGlass .budget-glass-rest{fill:var(--budget-fill-color)}
#budgetGlassSheen stop,#budgetGlassEdge stop{stop-color:var(--glass-light)}
@media(prefers-reduced-motion:no-preference){
  .selection-bar[data-budget-glass=true] #budgetGlass{visibility:visible}
  .selection-bar[data-budget-glass=true] .budget-track>#budgetFill,
  .selection-bar[data-budget-glass=true] .budget-track>#budgetEdge{visibility:hidden}
  .selection-bar[data-budget-glass=true] #budgetFill::before,
  .selection-bar[data-budget-glass=true] .budget-wave{animation:none}
}
