/*
 * Crunch Pop Candy — supplemental styles
 * styles.css is the compiled design system exported from the original build (do not edit).
 * This file adds the few things the static version needs on top of it.
 * Design tokens (--berry, --ink, --mint …) come from styles.css.
 */

[hidden] { display: none !important; }

/* Lock page scroll while the cart drawer is open */
html.cpc-no-scroll, html.cpc-no-scroll body { overflow: hidden; }

/* Cart page: items + 360px summary column on desktop */
@media (min-width: 64rem) {
  .cpc-cart-grid { grid-template-columns: 1fr 360px; }
  .cpc-checkout-grid { grid-template-columns: 1fr 400px; }
  .cpc-sticky { position: sticky; top: 6rem; }
}

/* Favorite (heart) toggle */
[data-favorite].is-favorite { color: var(--berry); }
[data-favorite].is-favorite svg { fill: currentColor; }

/* Sold-out buttons */
.cpc-soldout,
.cpc-soldout:hover {
  cursor: not-allowed;
  background: var(--muted) !important;
  color: var(--muted-foreground) !important;
  box-shadow: none !important;
  transform: none !important;
}

button:disabled { cursor: not-allowed; opacity: .7; }

/* Current page in the nav */
header nav a[aria-current="page"] { color: var(--berry); }

/* Form fields: visible invalid state after a submit attempt */
form.cpc-was-validated :invalid { border-color: var(--destructive); }

/* ------------------------------------------------------------------ */
/* Toast notifications                                                 */
/* ------------------------------------------------------------------ */
#cpc-toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.cpc-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  border-radius: 1rem;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 4px oklch(0.4 0.05 20 / 0.04), 0 12px 28px -12px oklch(0.4 0.05 20 / 0.25);
  outline: 1px solid rgb(0 0 0 / .05);
  animation: cpc-toast-in .22s ease-out both;
}
.cpc-toast.is-leaving { animation: cpc-toast-out .2s ease-in both; }
.cpc-toast__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: color-mix(in oklab, var(--mint) 45%, transparent);
  color: var(--ink);
}
.cpc-toast--error .cpc-toast__icon {
  background: color-mix(in oklab, var(--berry) 18%, transparent);
  color: var(--berry);
}
.cpc-toast__body { flex: 1; min-width: 0; }
.cpc-toast__title { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.cpc-toast__desc { margin-top: .125rem; font-size: .8125rem; line-height: 1.35; color: var(--muted-foreground); }
.cpc-toast__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  color: color-mix(in oklab, var(--ink) 55%, transparent);
}
.cpc-toast__close:hover { background: var(--secondary); color: var(--ink); }

@keyframes cpc-toast-in { from { opacity: 0; transform: translateY(-.5rem) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cpc-toast-out { to { opacity: 0; transform: translateX(1rem); } }

@media (prefers-reduced-motion: reduce) {
  .cpc-toast, .cpc-toast.is-leaving { animation: none; }
  html { scroll-behavior: auto; }
}

/* Utility missing from the exported Tailwind build */
.underline { text-decoration-line: underline; }

/* Keep toasts clear of the open cart drawer (desktop) and of the header (phones) */
@media (min-width: 48rem) {
  html.cpc-no-scroll #cpc-toasts { right: calc(28rem + 1rem); }
}
@media (max-width: 47.99rem) {
  #cpc-toasts { top: auto; bottom: 1rem; left: 1rem; right: 1rem; width: auto; }
}
