/* The store module's own parts: the cart button and drawer, the price and button on cards, the buy box on the item page, the
   checkout page and the order page. It reads only the role tokens and the neutral tokens every site.css declares (--brand,
   --accent, --accent-hi, --on-accent, --accent-text, --bg, --surface, --field, --ink, --muted, --line, --danger, --r-sm, --r-md,
   --display, --text), so it follows the site's colors in both themes. Forms and main buttons are the site's own (.form, .field, .btn). */

/* ---- nothing the script fills paints before it is drawn: hidden with its room kept, and shown anyway after 4 s if the script never ran */
@keyframes shop-show{to{visibility:visible}}
[data-shop-wait]{visibility:hidden;animation:shop-show 0s 4s forwards}

/* ---- the cart button in the header */
.shop-cart-btn{position:relative;flex:none;display:inline-grid;place-items:center;width:2.75rem;height:2.75rem;margin-inline-start:.35rem;padding:0;background:transparent;border:0;border-radius:var(--r-sm);color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.shop-cart-btn svg{width:1.4rem;height:1.4rem;display:block}
.shop-cart-btn:focus-visible{outline:2px solid var(--accent-hi);outline-offset:2px}
.shop-cart-btn:active{transform:translateY(1px)}
.shop-count{position:absolute;top:.2rem;inset-inline-end:.05rem;min-width:1.2rem;height:1.2rem;padding:0 .3rem;display:grid;place-items:center;border-radius:999px;background:var(--accent-hi);color:var(--on-accent);font:600 .72rem/1 var(--text);font-variant-numeric:tabular-nums}
.shop-count.is-empty{visibility:hidden}
@media (max-width:23rem){.shop-cart-btn{margin-inline:-.75rem -.6rem}}   /* the smallest phones: the tap area leans into the page margin so the bar keeps its room */
.shop-cart-float{position:fixed;inset-inline-end:1rem;top:1rem;z-index:60;background:var(--surface);color:var(--ink);border:1px solid var(--line)}

/* ---- the drawer */
.shop-drawer{position:fixed;inset:0;inset-inline-start:auto;margin:0;width:min(27rem,100vw);max-width:100vw;height:100vh;height:100dvh;max-height:none;padding:0;border:0;border-inline-start:1px solid var(--line);background:var(--bg);color:var(--ink);font-family:var(--text);overflow:hidden}
.shop-drawer[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto}
.shop-drawer::backdrop{background:color-mix(in srgb,var(--ink) 48%,transparent)}
@media (prefers-reduced-motion:no-preference){
  .shop-drawer[open]{animation:shop-in .32s cubic-bezier(.2,.7,.2,1)}
  .shop-drawer[open]::backdrop{animation:shop-fade .32s ease}
}
@keyframes shop-in{from{transform:translateX(100%)}}
@keyframes shop-fade{from{opacity:0}}
.shop-drawer-top{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--line)}
.shop-drawer-top h2{margin:0;font-family:var(--display);font-size:1.35rem;line-height:1.2}
.shop-close{min-height:2.75rem;padding:.4rem .75rem;background:transparent;border:1px solid var(--line);border-radius:var(--r-sm);color:var(--ink);font:500 .95rem/1 var(--text);cursor:pointer}
.shop-close:active,.shop-x:active,.shop-add:active,.shop-qty button:active{background:var(--accent-hi);border-color:var(--accent-hi);color:var(--on-accent)}
.shop-drawer-body{overflow-y:auto;overscroll-behavior:contain;padding:.25rem 1.25rem}
.shop-drawer-foot{padding:1rem 1.25rem calc(1rem + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface);display:grid;gap:.75rem}
.shop-drawer-foot[hidden]{display:none}
.shop-drawer-foot .btn.is-off{opacity:.5;pointer-events:none}
.shop-empty{display:grid;gap:.75rem;justify-items:start;padding:2.5rem 0}
.shop-empty h3{margin:0;font-family:var(--display);font-size:1.3rem}
.shop-empty p{margin:0;color:var(--muted)}

.shop-lines{list-style:none;margin:0;padding:0}
.shop-line{display:grid;grid-template-columns:4.5rem minmax(0,1fr) auto;gap:.9rem;align-items:start;padding:1rem 0;border-bottom:1px solid var(--line)}
.shop-line.is-gone{grid-template-columns:minmax(0,1fr) auto;align-items:center}
.shop-thumb{display:grid;place-items:center;aspect-ratio:1;background:var(--tile,var(--surface));color:var(--accent-hi);border-radius:var(--r-sm);overflow:hidden}
.shop-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.shop-thumb svg{width:62%;height:auto}
.shop-line-main{display:grid;gap:.3rem;min-width:0}
.shop-line-name{font-family:var(--display);font-size:1.05rem;line-height:1.25;color:inherit;text-decoration:none;overflow-wrap:anywhere}
a.shop-line-name:hover{text-decoration:underline;text-underline-offset:.2em}
.shop-line-unit,.shop-line-note{font-size:.9rem;color:var(--muted)}
.shop-line-note{color:var(--accent-text)}
.shop-line-total{font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;padding-top:.1rem}
.shop-line-acts{display:flex;flex-wrap:wrap;align-items:center;gap:.6rem;margin-top:.25rem}
.shop-x{min-height:2.75rem;padding:.3rem .6rem;background:transparent;border:1px solid transparent;border-radius:var(--r-sm);color:var(--muted);font:500 .9rem/1 var(--text);text-decoration:underline;text-underline-offset:.2em;cursor:pointer}
.shop-x:hover{color:var(--ink)}

.shop-qty{display:inline-grid;grid-template-columns:2.75rem 2.5rem 2.75rem;align-items:stretch;height:2.75rem;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--field,var(--surface));color:var(--ink)}
.shop-qty[hidden]{display:none}
.shop-qty button{display:grid;place-items:center;padding:0;background:transparent;border:0;color:inherit;font:500 1.2rem/1 var(--text);cursor:pointer}
.shop-qty button:disabled{opacity:.35;cursor:not-allowed}
.shop-qty output{display:grid;place-items:center;font-weight:600;font-variant-numeric:tabular-nums;border-inline:1px solid var(--line)}
.shop-qty button:focus-visible,.shop-x:focus-visible,.shop-add:focus-visible,.shop-close:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.shop-totals{margin:0;display:grid;gap:.4rem}
.shop-totals div{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}
.shop-totals dt{color:var(--muted)}
.shop-totals dd{margin:0;font-variant-numeric:tabular-nums}
.shop-totals .shop-total{padding-top:.55rem;border-top:1px solid var(--line);font-weight:600}
.shop-totals .shop-total dt{color:var(--ink)}
.shop-free{margin:0;font-size:.9rem;color:var(--accent-text)}

/* ---- cards: the price, and the button under the card (outside its link) */
.shop-cell{display:flex;flex-direction:column;gap:.6rem;min-width:0}
.shop-cell>.shop-card-row{margin-top:auto}   /* the buttons of a row of cards sit on one line, whatever the names above them */
.shop-card-row{display:grid;grid-template-columns:minmax(0,1fr);gap:.45rem}
.shop-cell .shop-add{width:100%}
.shop-card-price{font-weight:600;font-variant-numeric:tabular-nums}
.shop-card-sold{display:flex;align-items:center;min-height:2.75rem;color:var(--muted);font-size:.95rem}
.shop-add{min-height:2.75rem;padding:.45rem .9rem;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);color:var(--ink);font:500 .92rem/1.1 var(--text);cursor:pointer;transition:border-color .2s,background-color .2s,color .2s}
@media (hover:hover){.shop-add:hover{border-color:var(--accent)}}

/* ---- the item page */
.shop-buy{display:grid;gap:.9rem;min-height:7.25rem;align-content:start}
.shop-buy[hidden]{display:none}
.shop-price{margin:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:.4rem .9rem}
.shop-price [data-shop-price]{font-family:var(--display);font-size:1.7rem;line-height:1.1;font-variant-numeric:tabular-nums}
.shop-price [data-shop-stock]{color:var(--accent-text);font-size:.95rem}
.shop-price [data-shop-stock].is-sold{color:var(--muted)}
.shop-buy-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}
.shop-buy-row .btn:disabled{opacity:.55;cursor:not-allowed}

/* ---- checkout */
.shop-co{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);gap:clamp(1.5rem,4vw,3.5rem);align-items:start;min-height:70vh}
.shop-co>[hidden]{display:none}
.shop-co-msg{grid-column:1/-1;display:grid;gap:.9rem;justify-items:start;max-width:36rem}
.shop-co-msg h2{margin:0}
.shop-order-n{font-size:clamp(1.7rem,3.2vw,2.3rem)}
.shop-co-msg p{margin:0;color:var(--muted)}
.shop-co h2{font-size:1.35rem}
.shop-co-form .form-head{margin-top:.5rem}
.shop-paystep{display:grid;gap:.4rem;padding:1rem 1.1rem;border:1px solid var(--line);border-radius:var(--r-md);background:var(--surface)}
.shop-paystep h2,.shop-paystep p{margin:0}
.shop-sum{display:grid;gap:1rem;padding:1.25rem;border:1px solid var(--line);border-radius:var(--r-md);background:var(--surface)}
.shop-sum h2{margin:0;font-size:1.25rem}
.shop-sum-lines{list-style:none;margin:0;padding:0;display:grid;gap:.6rem}
.shop-sum-lines li{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}
.shop-sum-lines li>span:last-child{font-variant-numeric:tabular-nums;white-space:nowrap}
.shop-sum-name{min-width:0;overflow-wrap:anywhere}
.shop-sum-name small{color:var(--muted);white-space:nowrap}
@media (max-width:56rem){.shop-co{grid-template-columns:minmax(0,1fr)}.shop-co #coSum{order:-1}}

/* ---- the order page */
.shop-order{display:grid;gap:1.25rem;max-width:44rem;min-height:70vh;align-content:start}
.shop-order>[hidden],#orMain[hidden]{display:none}
#orMain{display:grid;gap:1.25rem}
#orMain>*{margin:0}
.shop-status{justify-self:start;padding:.4rem .8rem;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);color:var(--ink);font-weight:600;font-size:.95rem}
.shop-status.is-awaiting_payment{border-color:var(--accent);color:var(--accent-text)}
.shop-status.is-canceled{color:var(--muted)}
.shop-pay,.shop-ship{display:grid;gap:.9rem;padding:1.25rem;border:1px solid var(--accent);border-radius:var(--r-md);background:var(--surface)}
.shop-pay h2,.shop-ship h2{margin:0;font-size:1.3rem}
.shop-pay>*,.shop-ship>*{margin:0}
.shop-pay-amt{font-size:1.1rem;font-weight:600}
.shop-pay-facts{margin:0;display:grid;grid-template-columns:max-content minmax(0,1fr);gap:.55rem 1.25rem;align-items:baseline}
.shop-pay-facts div{display:contents}
.shop-pay-facts dt{color:var(--muted)}
.shop-pay-facts dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.shop-pay-note p{margin:0 0 .5rem}
.shop-qr{width:min(13.75rem,100%);height:auto;border:1px solid var(--line);border-radius:var(--r-sm);background:#fff}   /* a QR code only scans on white */
.shop-order-foot{display:flex;flex-wrap:wrap;align-items:center;gap:1rem}
@media (max-width:30rem){.shop-pay-facts{grid-template-columns:minmax(0,1fr);gap:.15rem}.shop-pay-facts dd{margin-bottom:.5rem}}
@media print{.shop-cart-btn,.shop-drawer,.shop-order-foot{display:none!important}}
/* the paid warranty at checkout: one tick box, the price beside its words; the cart's tax note */
.shop-tick{display:flex;align-items:flex-start;gap:.65rem;font-weight:700;cursor:pointer;min-height:2.75rem;padding-block:.35rem}
.shop-tick input{flex:none;width:1.35rem;height:1.35rem;margin:.1rem 0 0;accent-color:var(--accent)}
.shop-tick strong{white-space:nowrap;font-weight:800}
.shop-warranty p{color:var(--muted);font-size:.95rem}
.shop-tax-note{margin:.35rem 0 .6rem;font-size:.88rem}
.shop-totals dd.hint{font-size:.9rem;font-weight:400}

/* an empty cart shows the cart's own bag, big, in the site's corner-mark frame (Nov 26: "it looks empty") */
.shop-empty-ic{display:grid;place-items:center;width:6.5rem;height:6.5rem;margin-bottom:.4rem;color:var(--chrome,var(--muted));background-color:var(--surface)}
.shop-empty-ic svg{width:2.9rem;height:2.9rem}
html.js .shop-empty .shop-empty-ic svg{animation:emptyBag .7s var(--out,ease-out) both}
@keyframes emptyBag{from{opacity:0;transform:translateY(.4rem) scale(.92)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){html.js .shop-empty .shop-empty-ic svg{animation:none}}
