/* THV cart: drawer, toast and add-to-cart CTAs.
   Ported 1:1 from design/v2/home.css (drawer/toast lines 200-255, CTA lines
   45-48 and 281-291); tokens come from base.css. */

/* ---------- add-to-cart CTAs (markup contract: inc/cart.php thv_add_button) */
.prod__add{position:relative;display:inline-flex;flex-direction:row-reverse;align-items:center;justify-content:center;height:44px;min-width:44px;padding:0 12px;
  border-radius:999px;background:var(--grad-btn);color:#fff;font-size:15px;font-weight:600;line-height:1;white-space:nowrap;flex:none;
  transition:transform .2s var(--ease),background .25s var(--ease),box-shadow .3s var(--ease);}
.prod__add:active{transform:scale(.94);}
.prod__add-ic{position:relative;display:grid;place-items:center;width:20px;height:20px;flex:none;}
/* the label is in the DOM, collapsed at rest; it grows out to the left of the bag */
.prod__add-l{display:inline-block;overflow:hidden;max-width:0;opacity:0;margin-right:0;transition:max-width .28s var(--ease),opacity .2s var(--ease),margin .28s var(--ease);}
.prod__add:focus-visible .prod__add-l{max-width:9em;opacity:1;margin-right:8px;}
@media (hover:hover){
  .prod__add:hover{background:var(--navy);}
  .prod__add:hover .prod__add-l{max-width:9em;opacity:1;margin-right:8px;}
}
/* "Kies": the label is the information, so it is always shown */
.prod__add--choose{padding:0 14px 0 16px;gap:8px;flex-direction:row;}
.prod__add--choose .prod__add-l,.prod__add--choose:hover .prod__add-l{max-width:none;opacity:1;margin:0;}
/* busy: the request is in flight */
.prod__add-busy{display:none;gap:3px;align-items:center;}
.prod__add-busy i{width:4px;height:4px;border-radius:50%;background:currentColor;animation:prodPulse .9s ease-in-out infinite;}
.prod__add-busy i:nth-child(2){animation-delay:.15s;}
.prod__add-busy i:nth-child(3){animation-delay:.3s;}
.prod__add[aria-busy="true"]{cursor:progress;}
.prod__add[aria-busy="true"] .thv-ico{display:none;}
.prod__add[aria-busy="true"] .prod__add-busy{display:inline-flex;}
@keyframes prodPulse{0%,100%{opacity:.35;transform:scale(.8);}50%{opacity:1;transform:scale(1.15);}}
/* success: green pill, the check draws, one ripple */
.prod__add.added{background:#1A7A50;}
.prod__add.added,.prod__add.added:hover{background:#1A7A50;}
.prod__add.added .prod__add-l{max-width:9em;opacity:1;margin-right:8px;}
.prod__add.added .thv-ico--done path{stroke-dasharray:24;stroke-dashoffset:24;animation:prodDraw .3s var(--ease) forwards;}
.prod__add.added::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:prodRipple .7s ease-out forwards;}
@keyframes prodDraw{to{stroke-dashoffset:0;}}
@keyframes prodRipple{from{box-shadow:0 0 0 0 rgba(26,122,80,.55);}to{box-shadow:0 0 0 14px rgba(26,122,80,0);}}
/* the card hover wiggles the bag once */
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .prod:hover .prod__add:not(.added):not(.prod__add--choose) .thv-ico--idle svg{animation:prodWiggle .6s var(--ease) 1;}
}
@keyframes prodWiggle{0%,100%{transform:rotate(0);}25%{transform:rotate(-6deg);}60%{transform:rotate(6deg);}}
/* card stepper: "- n +" once the product is in the cart (same 44px pill height as the add button) */
.prod__step{display:inline-flex;align-items:center;height:44px;border:1.5px solid var(--navy);border-radius:999px;background:#fff;flex:none;}
.prod__step button{width:40px;height:100%;display:grid;place-items:center;color:var(--navy);border-radius:999px;}
.prod__step button:hover:not(:disabled){background:var(--pale-2);}
.prod__step button:disabled{color:var(--muted);opacity:.45;cursor:not-allowed;}
.prod__step-n{min-width:22px;text-align:center;font-weight:700;font-size:15px;color:var(--navy);font-variant-numeric:tabular-nums;}
/* header bag: one bounce when an add lands (cart.js sets .is-bump) */
.cart-btn.is-bump{animation:cartBump .5s var(--ease);}
@keyframes cartBump{0%{transform:scale(1);}35%{transform:scale(1.18);}70%{transform:scale(.96);}100%{transform:scale(1);}}
/* fly-to-cart clone of the card photo */
.prod-fly{position:fixed;z-index:140;left:0;top:0;width:28px;height:28px;border-radius:8px;object-fit:cover;pointer-events:none;box-shadow:0 6px 16px -4px rgba(12,40,80,.5);}

.btile__cta{flex:none;height:54px;min-width:54px;padding:0;border-radius:27px;background:#fff;color:var(--blue);
  display:inline-flex;align-items:center;justify-content:center;gap:9px;
  box-shadow:0 12px 26px -10px rgba(0,0,0,.55);transition:transform .25s var(--ease),background .25s,color .25s;}
.btile__cta svg{flex:none;}
.btile__cta:hover{background:#eef5fa;}
.btile__cta.is-done{background:var(--green);color:#fff;}
@media (max-width:520px){
  .btile__cta{height:44px;min-width:44px;}
}

/* the success check ships inside the button; the success class swaps icons */
.thv-ico{display:grid;place-items:center;}
.thv-ico--done{display:none;}
.added .thv-ico--idle,.is-done .thv-ico--idle{display:none;}
.added .thv-ico--done,.is-done .thv-ico--done{display:grid;}

/* labelled variant (product page): both labels ship too, swapped the same way */
.thv-lbl--done{display:none;}
.added .thv-lbl--idle{display:none;}
.added .thv-lbl--done{display:inline;}
.btn.added{background:var(--green);background-image:none;box-shadow:0 12px 26px -12px rgba(31,138,91,.7);}
.btn.added:hover{background:var(--green);box-shadow:0 12px 26px -12px rgba(31,138,91,.7);}

/* ---------- cart drawer */
.scrim{position:fixed;inset:0;z-index:90;background:rgba(10,22,44,.42);backdrop-filter:blur(3px);opacity:0;visibility:hidden;transition:opacity .4s var(--ease),visibility .4s;}
.scrim.is-open{opacity:1;visibility:visible;}
/* visibility, not just the off-screen transform: a translated panel is still
   in the tab order, so before card 21 the closed drawer leaked its close
   button and CTA into every page's Tab sequence. aria-hidden hid it from a
   screen reader but not from the keyboard. Same transition shape as .modal —
   visibility flips instantly on open and only after the slide-out on close. */
.drawer{position:fixed;top:0;right:0;bottom:0;width:min(440px,100vw);z-index:100;background:#fff;display:flex;flex-direction:column;
  box-shadow:-30px 0 60px -30px rgba(0,0,0,.4);transform:translateX(100%);visibility:hidden;
  transition:transform .5s var(--ease),visibility 0s .5s;}
.drawer.is-open{transform:none;visibility:visible;transition:transform .5s var(--ease),visibility 0s;}
#thv-drawer-body{display:contents;}
.drawer__head{display:flex;align-items:center;justify-content:space-between;padding:24px 24px 16px;border-bottom:1px solid var(--line);}
.drawer__head h3{font-size:21px;font-weight:600;} .drawer__head span{color:var(--muted);font-weight:400;font-size:15px;margin-left:8px;}
.icon-btn{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;color:var(--ink);transition:background .2s;}
.icon-btn:hover{background:var(--pale-2);}
.drawer__scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;}
.drawer__items{padding:4px 24px;}
.citem{display:flex;gap:13px;padding:16px 0;border-bottom:1px solid var(--line);}
.citem__img{width:66px;height:66px;border-radius:10px;overflow:hidden;flex:none;background:var(--pale-2);display:grid;place-items:center;color:#fff;font-size:9px;}
.citem__img img{width:100%;height:100%;object-fit:cover;}
.citem__main{flex:1;min-width:0;}
.citem__name{font-size:15px;font-weight:500;line-height:1.2;}
.citem__row{display:flex;align-items:center;justify-content:space-between;margin-top:10px;}
.citem__price{font-weight:600;color:var(--navy);font-size:15px;}
.citem__rm{font-size:12.5px;color:var(--muted);margin-top:7px;}.citem__rm:hover{color:#e0556a;}
.drawer__empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:var(--muted);text-align:center;padding:40px;}
.drawer__empty .big{width:64px;height:64px;border-radius:50%;background:var(--pale-2);display:grid;place-items:center;color:var(--blue);}
.drawer__empty-t{font-weight:600;color:var(--ink);font-size:17px;}
.drawer__empty-x{margin-top:6px;}
.drawer__foot{padding:20px 24px 24px;border-top:1px solid var(--line);background:var(--pale-2);}
.drawer__line{display:flex;justify-content:space-between;font-size:14.5px;color:var(--muted);margin-bottom:8px;}
.drawer__total{display:flex;justify-content:space-between;align-items:baseline;font-size:15px;margin:10px 0 16px;}
.drawer__total b{font-size:24px;font-weight:600;color:var(--navy);}
.drawer__foot .btn{width:100%;}

/* "Toegevoegd: ..." strip, shown only in the response to an add */
.cadded{display:flex;align-items:center;gap:10px;padding:12px 24px;background:var(--pale);color:var(--navy);font-size:14px;line-height:1.3;}
.cadded svg{color:var(--green);flex:none;}
.cadded span{min-width:0;overflow-wrap:anywhere;}

/* free-shipping progress */
.cship{padding:14px 24px 16px;border-bottom:1px solid var(--line);}
.cship__t{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted);}
.cship__t b{color:var(--navy);font-weight:600;}
.cship__bar{height:8px;border-radius:4px;background:var(--pale);overflow:hidden;margin-top:9px;}
.cship__bar span{display:block;height:100%;border-radius:4px;background:var(--blue);transition:width .5s var(--ease);}
.cship.is-reached .cship__t{color:var(--green);font-weight:600;}
.cship.is-reached .cship__bar span{background:var(--green);}

/* drawer lines: image box, brand over name, stepper, trash; total on the right */
.citem--drawer{gap:14px;padding:18px 0;align-items:flex-start;}
.citem--drawer .citem__img{width:84px;height:84px;border-radius:var(--r-card);background:var(--pale-2);border:1px solid var(--line);font-size:12px;}
.citem--drawer .citem__img img{object-fit:contain;padding:6px;}
.citem--drawer .citem__brand{font-size:11.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);}
.citem--drawer .citem__name{font-size:15.5px;font-weight:500;line-height:1.25;margin:2px 0 10px;overflow-wrap:anywhere;}
.citem--drawer .citem__name a:hover{color:var(--blue);}
.citem--drawer .qty--light{display:inline-flex;border-radius:12px;}
.citem--drawer .qty--light button{width:36px;height:36px;}
.citem--drawer .qty--light span{min-width:30px;font-size:15px;}
.citem__side{flex:none;align-self:stretch;display:flex;flex-direction:column;align-items:flex-end;text-align:right;}
.citem--drawer .citem__price{font-size:16px;}
.citem--drawer .citem__unit{margin-top:3px;font-size:12.5px;color:var(--muted);white-space:nowrap;}
.citem__trash{margin-top:auto;width:36px;height:36px;border-radius:12px;border:1px solid var(--line);color:var(--muted);display:grid;place-items:center;transition:color .2s,background .2s,border-color .2s;}
.citem__trash:hover{color:#e0556a;border-color:#e0556a;background:var(--pale-2);}

/* Vaak samen besteld */
.csug{padding:18px 24px 24px;border-top:1px solid var(--line);}
.csug__t{font-size:15px;font-weight:600;color:var(--ink);margin-bottom:12px;}
.csug__item{display:flex;align-items:center;gap:13px;padding:10px;border:1px solid var(--line);border-radius:var(--r-card);margin-bottom:10px;}
.csug__img{width:56px;height:56px;flex:none;border-radius:10px;background:var(--pale-2);display:grid;place-items:center;overflow:hidden;}
.csug__img img{width:100%;height:100%;object-fit:contain;padding:4px;}
.csug__main{flex:1;min-width:0;}
.csug__name{display:block;font-size:14.5px;font-weight:500;line-height:1.25;overflow-wrap:anywhere;}
.csug__name:hover{color:var(--blue);}
.csug__price{margin-top:3px;font-size:14px;font-weight:600;color:var(--navy);}
.csug__price ins{text-decoration:none;}
.csug__price del{font-weight:400;color:var(--muted);margin-right:4px;}
.csug__add{width:40px;height:40px;flex:none;border-radius:12px;background:var(--green);color:#fff;display:grid;place-items:center;transition:transform .25s var(--ease),box-shadow .25s var(--ease);}
.csug__add:hover{transform:translateY(-1px);box-shadow:0 10px 18px -10px rgba(31,138,91,.8);}
.csug__add--link{background:var(--pale);color:var(--navy);}

@media (max-width:520px){
  .drawer{width:100vw;}
  .drawer__head{padding:18px 16px 14px;}
  .cadded{padding:12px 16px;}
  .cship{padding:12px 16px 14px;}
  .drawer__items{padding:0 16px;}
  .citem--drawer{gap:12px;}
  .citem--drawer .citem__img{width:72px;height:72px;}
  .csug{padding:16px 16px 20px;}
  .drawer__foot{padding:16px 16px calc(18px + env(safe-area-inset-bottom));}
}

/* ---------- toast */
.toast{position:fixed;left:50%;bottom:30px;transform:translate(-50%,20px);z-index:130;background:var(--navy);color:#fff;
  padding:14px 22px;border-radius:30px;font-size:14.5px;font-weight:500;display:flex;align-items:center;gap:11px;
  box-shadow:0 18px 40px -16px rgba(0,0,0,.5);opacity:0;visibility:hidden;transition:opacity .35s var(--ease),transform .35s var(--ease),visibility .35s;}
.toast.is-on{opacity:1;visibility:visible;transform:translate(-50%,0);}
.toast .dot{width:22px;height:22px;border-radius:50%;background:var(--green);display:grid;place-items:center;flex:none;}
.toast--err .dot{background:#e0556a;}

@media (prefers-reduced-motion:reduce){
  .scrim,.drawer,.toast,.prod__add,.prod__add-l,.btile__cta{transition:none;}
  .prod__add:active{transform:none;}
  .prod__add.added::after,.cart-btn.is-bump{animation:none;}
  .prod__add.added .thv-ico--done path{animation:none;stroke-dashoffset:0;}
  .prod__add-busy i{animation:none;opacity:.8;}
}

/* ---------- Villager invitation (inc/cart-villager.php): calm, never blocking */
.vinv--card{position:relative;display:grid;grid-template-columns:150px 1fr;gap:22px;align-items:center;margin-top:28px;padding:22px 24px;
  border:1px solid var(--line);border-radius:var(--r-card);background:var(--pale-2);}
.vinv--card[hidden],.vinv--line[hidden]{display:none;}
.vinv__pass{min-width:0;filter:drop-shadow(0 8px 14px rgba(12,40,80,.16));}
.vinv__body{min-width:0;padding-right:56px;}
.vinv__eyebrow{font-size:12px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--blue);margin-bottom:6px;}
.vinv__title{font-size:20px;font-weight:600;line-height:1.3;color:var(--navy);}
.vinv__title b{color:var(--blue);white-space:nowrap;}
.vinv__text{margin-top:8px;font-size:14.5px;line-height:1.5;color:var(--muted);}
.vinv__actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px 20px;margin-top:16px;}
.vinv__actions .mb-join{margin:0;}
.vinv__link{font-size:14px;font-weight:600;color:var(--blue);text-decoration:underline;text-underline-offset:3px;}
.vinv__link:hover{color:var(--navy);}
.vinv__x{position:absolute;top:14px;right:16px;padding:4px 6px;font-size:13px;color:var(--muted);text-decoration:underline;text-underline-offset:3px;}
.vinv__x:hover{color:var(--navy);}
.vinv--member{display:flex;align-items:center;gap:8px;margin:20px 0 0;font-size:14.5px;color:var(--navy);}
.vinv--member svg{flex:none;color:var(--green);}
.vinv--member b{font-weight:600;}
/* drawer: one compact line above the totals */
.vinv--line{display:flex;align-items:center;justify-content:space-between;gap:6px 12px;flex-wrap:wrap;margin:0 0 12px;padding:9px 12px;border-radius:var(--r-control);background:#fff;border:1px solid var(--line);font-size:13px;line-height:1.35;color:var(--navy);}
.vinv--line.vinv--member{justify-content:flex-start;background:none;border:0;padding:0;margin:0 0 10px;font-size:13.5px;color:var(--muted);}
.vinv--line .mb-join{margin:0;}
.vinv__go{padding:0;font-size:13px;font-weight:600;color:var(--blue);text-decoration:underline;text-underline-offset:3px;display:inline-flex;align-items:center;gap:4px;}
.vinv__go svg{width:14px;height:14px;}
@media (max-width:640px){
  .vinv--card{grid-template-columns:1fr;gap:12px;padding:18px 16px;}
  .vinv__pass{display:none;}
  .vinv__body{padding-right:0;}
  .vinv__title{font-size:18px;padding-right:64px;}
  .vinv__x{top:12px;right:12px;}
  .vinv__eyebrow{display:none;}
}
