/* ── Cart Drawer ──────────────────────────────────────────── */

/* Backdrop */
.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: 99;
}
.cart-backdrop.is-open {
  opacity: 1;
}
.cart-backdrop[hidden] {
  display: none;
}

/* Drawer shell */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100dvh;
  background: #060d1a;
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 100;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(78, 163, 227, 0.18);
}
.cart-drawer.is-open {
  transform: translateX(0);
}
/* Hidden override — must beat the display:flex above */
.cart-drawer[hidden] {
  display: none;
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1023px) {
  .cart-drawer {
    width: min(50vw, 480px);
  }
}

/* Mobile — full-screen takeover */
@media (max-width: 640px) {
  .cart-drawer {
    width: 100vw;
  }
}

/* ── Drawer Header ─────────────────────────────────────────── */

.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(78, 163, 227, 0.18);
  flex-shrink: 0;
}

.cart-drawer__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0;
  margin: 0;
}

.cart-drawer__title .section-label {
  font-family: 'Syne', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(78, 163, 227, 0.7);
}

.cart-drawer__count-inline {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0;
}

.cart-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid rgba(78, 163, 227, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 160ms, color 160ms;
  flex-shrink: 0;
}
.cart-drawer__close:hover {
  border-color: rgba(78, 163, 227, 0.5);
  color: #fff;
}

/* ── Items container (scrollable) ──────────────────────────── */

.cart-drawer__items {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px;
  background-image: radial-gradient(circle, rgba(78, 163, 227, 0.18) 1px, transparent 1px);
  background-size: 12px 12px;
  overscroll-behavior: contain;
  /* Allow empty state to fill height when cart is empty */
  display: flex;
  flex-direction: column;
}

/* ── Empty State ───────────────────────────────────────────── */

.cart-drawer__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  flex: 1;
  position: relative;
}
.cart-drawer__empty[hidden] {
  display: none;
}

.cart-drawer__empty-vial {
  width: 48px;
  height: 64px;
  color: rgba(78, 163, 227, 0.4);
  margin-bottom: 24px;
  /* Large ghost behind the content */
  position: relative;
  z-index: 1;
}

/* Giant ghost vial via ::before on the container */
.cart-drawer__empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32' fill='none' stroke='rgba(78%2C163%2C227%2C0.12)' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='1' width='10' height='3.5' rx='0.5'/%3E%3Cpath d='M9 4.5 L9 7 L7 9 L7 29 Q7 31 9 31 L15 31 Q17 31 17 29 L17 9 L15 7 L15 4.5'/%3E%3Cpath d='M7 17 Q12 16 17 17'/%3E%3Cline x1='8' y1='21' x2='16' y2='21' stroke-width='0.8' opacity='0.4'/%3E%3Cline x1='8' y1='24' x2='16' y2='24' stroke-width='0.8' opacity='0.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 400px 500px;
  opacity: 0.12;
  pointer-events: none;
}

.cart-drawer__empty-headline {
  font-family: 'PMNCaeciliaSans', 'CaeciliaSans', var(--font-display, serif);
  font-style: italic;
  font-size: 32px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 12px;
  position: relative;
  z-index: 1;
}

.cart-drawer__empty-sub {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 24px;
  line-height: 1.6;
  max-width: 280px;
  position: relative;
  z-index: 1;
}

.cart-drawer__empty-cta {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid rgba(78, 163, 227, 0.4);
  color: rgba(78, 163, 227, 0.9);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: border-color 160ms, color 160ms, background 160ms;
  position: relative;
  z-index: 1;
}
.cart-drawer__empty-cta:hover {
  border-color: rgba(78, 163, 227, 0.8);
  color: #4ea3e3;
  background: rgba(78, 163, 227, 0.06);
}

/* ── RUO disclaimer ────────────────────────────────────────── */

.cart-drawer__ruo {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding: 8px 24px;
  flex-shrink: 0;
}

/* ── Vial fill animation (nav cart icon) ───────────────────── */

.nav-cart__fill {
  transition: y 280ms cubic-bezier(0.22, 1, 0.36, 1),
              height 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .nav-cart__fill { transition: none; }
}

/* ── Nav cart: cyan-bordered vial frame + count text beside it ────────────
   Layout: [ ▭ vial ▭ ]  3
   The count is plain bold-white text to the right of the framed vial
   (no longer a circular pill in the corner). */

#nav-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--cyan, #4FA3E3);
}

#nav-cart .nav-cart__icon {
  border: 1.5px solid var(--cyan, #4FA3E3);
  border-radius: 4px;
  padding: 2px 3px;
  width: 20px;
  height: 28px;
  flex-shrink: 0;
  box-sizing: content-box;
}

#nav-cart .nav-cart__count {
  position: static;
  bottom: auto; right: auto; top: auto; left: auto;
  transform: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-width: auto;
  height: auto;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#nav-cart .nav-cart__count[hidden] { display: none; }
@media (max-width: 640px) {
  #nav-cart .nav-cart__count { font-size: 15px; }
}

/* ── Qty picker (reveal-actions swap) ──────────────────────── */

.reveal-qty-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}
.reveal-qty-picker__label {
  font-family: 'Syne', sans-serif;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.reveal-qty-picker__stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(78, 163, 227, 0.3);
}
.reveal-qty-btn {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: var(--cyan, #4FA3E3);
  font-size: 18px;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.reveal-qty-btn:hover { background: rgba(78, 163, 227, 0.1); }
.reveal-qty-num {
  min-width: 28px;
  text-align: center;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  color: #FFFFFF;
  padding: 0 4px;
}
.reveal-qty-confirm {
  flex: 1;
  min-height: 44px;
  background: var(--cyan, #4FA3E3);
  color: #060d1a;
  border: 1px solid var(--cyan, #4FA3E3);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-weight: 700;
  transition: background 160ms, border-color 160ms, color 160ms;
}
.reveal-qty-confirm.is-flashed {
  background: #1f7a3e;
  border-color: #1f7a3e;
  color: #FFFFFF;
}
.reveal-qty-cancel {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: border-color 160ms, color 160ms;
}
.reveal-qty-cancel:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #FFFFFF;
}

/* ── Line items ────────────────────────────────────────────── */

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(78, 163, 227, 0.18);
  align-items: center;
}

.cart-line__thumb {
  width: 56px;
  height: 64px;
  background: #0a0f18;
  border: 1px solid rgba(78, 163, 227, 0.18);
  display: grid;
  place-items: center;
  padding: 8px;
  flex-shrink: 0;
}
.cart-line__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
}

.cart-line__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-line__name {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
}

.cart-line__total {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan, #4FA3E3);
}

.cart-line__remove {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Figtree', sans-serif;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: color 160ms;
  text-align: left;
}
.cart-line__remove:hover {
  color: rgba(255, 100, 100, 0.8);
}

/* qty column: small image + stepper side by side */
.cart-line__qty-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-line__qty-img {
  width: 28px;
  height: 36px;
  background: #0a0f18;
  border: 1px solid rgba(78, 163, 227, 0.12);
  padding: 4px;
  object-fit: contain;
  opacity: 0.6;
  flex-shrink: 0;
}

.cart-line__qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(78, 163, 227, 0.3);
}

.cart-line__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  background: transparent;
  border: 0;
  color: var(--cyan, #4FA3E3);
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms;
  line-height: 1;
}
.cart-line__qty-btn:hover {
  background: rgba(78, 163, 227, 0.1);
}

.cart-line__qty-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  text-align: center;
  border-left: 1px solid rgba(78, 163, 227, 0.2);
  border-right: 1px solid rgba(78, 163, 227, 0.2);
  padding: 0 4px;
  height: 32px;
}

@media (max-width: 480px) {
  .cart-line { grid-template-columns: 48px 1fr auto; gap: 8px; }
  .cart-line__qty-btn { min-width: 44px; min-height: 44px; }
}

/* ── Footer ────────────────────────────────────────────────── */

.cart-drawer__footer {
  border-top: 1px solid rgba(78, 163, 227, 0.18);
  padding: 20px 24px max(20px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-drawer__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-drawer__summary > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.cart-drawer__summary-muted > span:first-child,
.cart-drawer__summary-muted > span:last-child {
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

.cart-drawer__total {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
}
.cart-drawer__total span:first-child {
  color: rgba(255, 255, 255, 0.9);
}
.cart-drawer__total span:last-child {
  color: #4ea3e3;
}

.hairline {
  border: none;
  border-top: 1px solid rgba(78, 163, 227, 0.18);
  margin: 12px 0;
}

.cart-drawer__checkout {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 20px;
  background: #4ea3e3;
  color: #060d1a;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: background 160ms, transform 100ms;
  cursor: pointer;
  border: none;
}
.cart-drawer__checkout:hover {
  background: #6db8f0;
}
.cart-drawer__checkout:active {
  transform: scale(0.98);
}

.cart-drawer__continue {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  transition: color 160ms;
  text-decoration: underline;
}
.cart-drawer__continue:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ── Prevent body scroll when drawer is open ──────────────── */
body.cart-open {
  overflow: hidden;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cart-drawer,
  .cart-backdrop {
    transition: none;
  }
}
