/* Added-to-cart snackbar · waterproofflooring.com
   Final "Refined" design. Reference implementation: plain CSS, no framework. */

.wpf-snackbar {
  --sb-full: 366px;          /* set by JS: min(378px, viewport - 24px) */
  --sb-btn: 122px;           /* set by JS: floor((full - 122) / 2) */
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Capsule: the raised surface. Collapsed = 60px circle; expanded = --sb-full. */
.wpf-snackbar__cap {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  overflow: hidden;
  pointer-events: auto;
  background: #fafafc;
  box-shadow:
    0 0 0 .5px rgba(0, 0, 0, .1),
    0 2px 8px rgba(0, 0, 0, .12),
    0 12px 32px rgba(0, 0, 0, .24);
  transform: translateY(84px);
  opacity: 0;
  visibility: hidden;      /* hidden state: not tappable, not focusable (JS switches it on) */
  pointer-events: none;
}

/* Fixed-width row, anchored left, revealed as the capsule widens.
   10px left inset keeps the 40px photo concentric with the capsule end;
   16px right inset centers the close disc on the opposite end. */
.wpf-snackbar__row {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sb-full);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 10px;
  box-sizing: border-box;
}

.wpf-snackbar__thumb {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #ececef;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06);
  transform: scale(.6);
  opacity: 0;
}

/* Shared slot: confirmation text, then the View cart pill. Same width as Checkout. */
.wpf-snackbar__mid {
  position: relative;
  flex: 0 0 var(--sb-btn);
  min-width: 0;
  height: 44px;
  margin-left: 4px;
}

.wpf-snackbar__info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  opacity: 0;
}
.wpf-snackbar__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -.01em;
  color: #1d1d1f;
  white-space: nowrap;
}
.wpf-snackbar__name {
  font-size: 13px;
  font-weight: 400;
  line-height: 17px;
  letter-spacing: -.003em;
  color: #626267;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pills: 44px touch target; the 2px transparent border draws a 40px pill. */
.wpf-snackbar__btn {
  box-sizing: border-box;
  height: 44px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
}
.wpf-snackbar__btn span {
  display: block;
  text-box: trim-both cap alphabetic; /* optical vertical centering; ignored where unsupported */
}

.wpf-snackbar__view {
  position: absolute;
  inset: 0;
  background-color: #e5e7eb;
  color: #0f4372;
  pointer-events: none;
}
.wpf-snackbar__view:hover,
.wpf-snackbar__view:active { background-color: #d9dde3; color: #0f4372; }

.wpf-snackbar__checkout {
  flex: 0 0 auto;
  width: var(--sb-btn);
  background-color: #0f4372;
  color: #fff;
}
.wpf-snackbar__checkout:hover,
.wpf-snackbar__checkout:active { background-color: #0b3358; color: #fff; }
.wpf-snackbar__checkout:active { transform: scale(.98); }
.wpf-snackbar--reduced .wpf-snackbar__checkout:active { transform: none; }

/* Close: 44px target, 28px disc, 10px glyph. */
.wpf-snackbar__close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: 0 -8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0;
}
.wpf-snackbar__close span {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(29, 29, 31, .055);
  color: #626267;
  transition: background-color .15s ease, color .15s ease;
}
.wpf-snackbar__close:hover span { background: rgba(29, 29, 31, .09); color: #48484d; }
.wpf-snackbar__close svg { display: block; width: 10px; height: 10px; shape-rendering: geometricPrecision; }

/* ---- NOT in the design: what our page has that the prototype does not (SNACKBAR-1031) ---------------------------
   Every value above is the handoff's, untouched. Only these four things are ours:
   1. STACKING: the handoff's z-index is 1000. On our page the compare bar is 9999 and the compare overlay 10000, so
      at 1000 an Order Sample tapped inside the compare view would show nothing (CD-IMPORT B1, 2026-10-29). 10001 sits
      above them and below the chat bubble (99990), the trim toast (99999) and any open <dialog> (top layer).
   2. THE COMPARE BAR: while it shows, the snackbar sits above it (wpf-snackbar.js publishes its height as
      --wpf-sb-lift when the snackbar is shown).
   3. THE CHAT BUBBLE (z-index 99990, bottom right) would sit over the close disc, so it moves up out from under the
      snackbar while it shows (html.wpf-snackbar-on: capsule top = 28 + 60, then 14px of air).
   4. PAGE ROOM: while it shows, the page is 88px taller so the footer links can be scrolled up from under it. The
      extra space is empty page background (footer navy); it goes when the exit has finished. */
.wpf-snackbar { z-index: 10001; }
body.compare-active .wpf-snackbar { bottom: calc(28px + var(--wpf-sb-lift, 0px) + env(safe-area-inset-bottom, 0px)); }
html.wpf-snackbar-on .wpf-chat-bubble { bottom: calc(var(--wpf-sb-lift, 0px) + 102px + env(safe-area-inset-bottom, 0px)) !important; }
html.wpf-snackbar-on { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); background-color: #0b2038; }
/* A keyboard focus ring (the resting look is unchanged; Checkout is navy on a pale capsule). */
.wpf-snackbar__btn:focus-visible, .wpf-snackbar__close:focus-visible { outline: 2px solid #0f4372; outline-offset: 2px; }

/* Research review 2026-10-31 (S1): the phone menu is a details panel (class menu-open, layer 18) and the compare overlay
   is layer 10000; the capsule is above both (10001), so it sat on top of them. Out of the way while either is open;
   it comes back when they close if it is still showing. */
html:has(details.menu-open) .wpf-snackbar,
html:has(#compare-overlay.is-visible) .wpf-snackbar {
  display: none;
}
