/* ==========================================================================
   SealedUp — components
   ========================================================================== */

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.button {
  --_bg: var(--btn-bg);
  --_fg: var(--btn-fg);
  --_shadow: var(--btn-shadow);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3.25rem;
  padding: 0.85rem 1.6rem;
  border: 2px solid var(--_bg);
  border-radius: var(--radius-pill);
  background: var(--_bg);
  color: var(--_fg);
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 0 0 var(--_shadow);
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 0 var(--_shadow);
}

.button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 0 var(--_shadow);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.button--secondary {
  --_bg: transparent;
  --_fg: var(--fg);
  border-color: currentColor;
  box-shadow: none;
}

.button--secondary:hover {
  box-shadow: none;
  background: var(--surface);
}

.button--accent {
  --_bg: var(--color-tangerine);
  --_fg: var(--color-dark-teal);
  --_shadow: var(--color-dark-teal);
}

.button--full {
  width: 100%;
}

.button--small {
  min-height: 2.5rem;
  padding: 0.55rem 1.1rem;
  font-size: var(--text-sm);
  box-shadow: 0 3px 0 0 var(--_shadow);
}

.button .icon {
  width: 1.15em;
  height: 1.15em;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-pill);
  color: inherit;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.icon-button:hover {
  background: var(--surface);
}

.icon-button .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: var(--text-md);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
}

.link-arrow .icon {
  transition: transform var(--duration) var(--ease-out);
}

.link-arrow:hover .icon {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Badges — modelled on the brand stickers (thick outline, slight tilt)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.38em 0.7em 0.32em;
  border: 2px solid var(--color-off-white);
  border-radius: var(--radius-xs);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 0 0 rgb(0 45 51 / 0.35);
}

.badge--new {
  background: var(--color-amber);
  color: var(--color-dark-teal);
  transform: rotate(-3deg);
}

.badge--restock {
  background: var(--color-dark-teal);
  color: var(--color-off-white);
  transform: rotate(2deg);
}

.badge--preorder {
  background: var(--color-tangerine);
  color: var(--color-dark-teal);
  transform: rotate(-2deg);
}

.badge--soldout {
  background: var(--color-off-white);
  color: var(--color-dark-teal);
  border-color: var(--color-dark-teal);
}

.badge--save {
  background: var(--color-aquamarine);
  color: var(--color-dark-teal);
  transform: rotate(2deg);
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   Price
   -------------------------------------------------------------------------- */
.price {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15em 0.5em;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Re-declared because an inherited em letter-spacing keeps the parent's computed px value. */
.price__compare {
  letter-spacing: var(--tracking-heading);
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.price--large {
  font-size: var(--text-2xl);
}

.price--large .price__compare {
  font-size: 0.6em;
}

/* --------------------------------------------------------------------------
   Product card
   -------------------------------------------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr));
  gap: clamp(1rem, 0.5rem + 1.5vw, 1.75rem) clamp(0.75rem, 0.4rem + 1vw, 1.5rem);
}

@media (max-width: 1099px) {
  .product-grid {
    --columns: 3;
  }
}

@media (max-width: 749px) {
  .product-grid {
    --columns: 2;
  }
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: var(--fg);
}

/* No stacking context here: the quick-add button must sit above the card's full-card link overlay. */
.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
}

/* Placeholder product artwork (snippet product-art) — same type rules as the rest of the site */
.product-art__display {
  font-family: var(--font-display);
  font-weight: var(--font-display-weight);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
}

.product-art__label {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Product media (snippet product-media)
   Photos sit on one neutral surface everywhere, so cut-out packshots from different
   suppliers read as a single, consistent set. Masters are pre-framed with ~12% padding
   (scripts/prepare-product-image.mjs), so images only need to be contained.
   -------------------------------------------------------------------------- */
.product-media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.product-media--photo,
.product-media--art {
  background: var(--color-product-surface);
}

.product-media .product-art {
  display: block;
  width: 100%;
  height: 100%;
}

.product-media__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--product-shadow);
}

.product-media__image--hover {
  opacity: 0;
}

.product-card__media .product-media__image,
.product-card__media .product-art {
  transition:
    transform 600ms var(--ease-out),
    opacity var(--duration) var(--ease-out);
}

.product-card:hover .product-art,
.product-card:hover .product-media__image {
  transform: scale(1.04);
}

@media (hover: hover) {
  .product-card:hover .product-media--has-hover .product-media__image:not(.product-media__image--hover) {
    opacity: 0;
  }

  .product-card:hover .product-media__image--hover {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-card:hover .product-art,
  .product-card:hover .product-media__image {
    transform: none;
  }
}

.product-card__badges {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  pointer-events: none;
}

.product-card__quick-add {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--color-off-white);
  border-radius: var(--radius-pill);
  background: var(--color-dark-teal);
  color: var(--color-off-white);
  box-shadow: 0 3px 0 0 rgb(0 45 51 / 0.4);
  transition:
    transform var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.product-card__quick-add:hover {
  transform: scale(1.08);
  background: var(--color-teal);
}

.product-card__quick-add.is-added {
  background: var(--color-teal);
}

.product-card__quick-add .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.product-card__info {
  display: grid;
  gap: var(--space-1);
}

.product-card__meta {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  color: var(--muted);
}

.product-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  line-height: 1.2;
}

.product-card__link {
  text-decoration: none;
}

.product-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
}

.product-card__link:focus-visible {
  box-shadow: none;
}

.product-card__link:focus-visible::after {
  box-shadow: var(--focus-ring);
}

.product-card__price {
  font-size: var(--text-md);
}

.product-card__release {
  font-size: var(--text-sm);
  color: var(--muted);
}

.product-card--soldout .product-art {
  filter: saturate(0.35);
  opacity: 0.75;
}

.product-card--soldout .product-media__image {
  filter: saturate(0.35) var(--product-shadow);
  opacity: 0.75;
}

/* Horizontal scroller (home rows on mobile) */
.scroller {
  --columns: 4;
}

@media (max-width: 749px) {
  .scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 68%;
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--page-gutter);
    margin-inline: calc(var(--page-gutter) * -1);
    padding-inline: var(--page-gutter);
    padding-bottom: var(--space-2);
    scrollbar-width: none;
  }

  .scroller::-webkit-scrollbar {
    display: none;
  }

  .scroller > * {
    scroll-snap-align: start;
  }
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field {
  display: grid;
  gap: var(--space-2);
}

.field__label {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem 1.1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-dark-teal);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
  color: rgb(0 45 51 / 0.5);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: rgb(0 45 51 / 0.35);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgb(3 99 96 / 0.2);
}

.textarea {
  min-height: 9rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23002d33' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1rem;
  cursor: pointer;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  cursor: pointer;
}

.checkbox input {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
  accent-color: var(--color-teal);
}

.inline-form {
  display: flex;
  gap: var(--space-2);
}

.inline-form .input {
  flex: 1;
  min-width: 0;
}

@media (max-width: 479px) {
  .inline-form {
    flex-direction: column;
  }
}

.form-success {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-aquamarine);
  color: var(--color-dark-teal);
}

.form-note {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Quantity selector
   -------------------------------------------------------------------------- */
.quantity {
  display: inline-flex;
  align-items: center;
  height: 3.25rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-dark-teal);
}

.quantity--small {
  height: 2.5rem;
}

.quantity__button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 100%;
  border-radius: var(--radius-pill);
}

.quantity--small .quantity__button {
  width: 2.25rem;
}

.quantity__button:hover {
  background: rgb(0 45 51 / 0.06);
}

.quantity__button .icon {
  width: 1rem;
  height: 1rem;
}

.quantity__input {
  width: 2.5rem;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}

.quantity__input::-webkit-outer-spin-button,
.quantity__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Accordion
   -------------------------------------------------------------------------- */
.accordion {
  border-top: 2px solid var(--line);
}

.accordion__item {
  border-bottom: 2px solid var(--line);
}

.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  line-height: 1.2;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
}

.accordion__summary::-webkit-details-marker {
  display: none;
}

.accordion__icon {
  position: relative;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.accordion__icon::before,
.accordion__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.8rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform: translate(-50%, -50%);
  transition: transform var(--duration) var(--ease-out);
}

.accordion__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.accordion__item[open] .accordion__icon::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.accordion__content {
  padding-bottom: var(--space-5);
  color: var(--muted);
  max-width: 68ch;
}

.accordion__content a {
  color: inherit;
}

.accordion--compact .accordion__summary {
  padding: var(--space-4) 0;
  font-size: var(--text-md);
}

/* --------------------------------------------------------------------------
   Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  color: var(--muted);
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: var(--space-2);
  opacity: 0.5;
}

.breadcrumbs a {
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   Drawer (cart, mobile menu, filters) and overlay
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(0 45 51 / 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration) var(--ease-out),
    visibility var(--duration);
}

.overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-soft);
  visibility: hidden;
  transition:
    transform 420ms var(--ease-out),
    visibility 420ms;
}

.drawer--right {
  right: 0;
  transform: translateX(100%);
}

.drawer--left {
  left: 0;
  transform: translateX(-100%);
}

.drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 2px solid var(--line);
}

.drawer__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-display-weight);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  color: var(--heading);
  line-height: var(--leading-display);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5);
}

.drawer__footer {
  padding: var(--space-5);
  border-top: 2px solid var(--line);
  background: var(--bg);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  z-index: 90;
  display: grid;
  gap: var(--space-2);
  transform: translateX(-50%);
  width: min(92vw, 460px);
  pointer-events: none;
}

/* On phones the bottom of the screen holds the drawer/sticky-bar actions, so toasts go on top. */
@media (max-width: 749px) {
  .toast-region {
    top: calc(var(--space-3) + env(safe-area-inset-top));
    bottom: auto;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-off-white);
  border-radius: var(--radius-sm);
  background: var(--color-dark-teal);
  color: var(--color-off-white);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-soft);
  animation: toast-in 360ms var(--ease-out);
  pointer-events: auto;
}

.toast .icon {
  color: var(--color-aquamarine);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* --------------------------------------------------------------------------
   Payment icons
   -------------------------------------------------------------------------- */
.payment-icons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.payment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  height: 2rem;
  padding: 0 0.6rem;
  border-radius: var(--radius-xs);
  background: var(--color-off-white);
  color: var(--color-dark-teal);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: var(--font-heading-weight);
  letter-spacing: var(--tracking-heading);
  text-transform: uppercase;
  white-space: nowrap;
}

.payment-icon--brand {
  min-width: 3.5rem;
  height: 2.25rem;
  padding: 0.35rem 0.5rem;
  border: 2px solid var(--line);
  background: var(--color-white);
  text-transform: none;
}

.payment-icon__svg,
.payment-icon__img {
  display: block;
  width: auto;
  height: auto;
  max-height: 1.35rem;
  max-width: 3.25rem;
  object-fit: contain;
}

.payment-icon--mbway .payment-icon__img {
  max-width: 4.25rem;
  max-height: 1.15rem;
}

.payment-icon--applepay .payment-icon__img {
  max-width: 2.85rem;
  max-height: 1.45rem;
}

.payment-icon--paypal .payment-icon__img {
  max-width: 1.35rem;
  max-height: 1.35rem;
}

.payment-icon--visa .payment-icon__img {
  max-width: 3.5rem;
}

.site-footer .payment-icon--brand {
  background: rgb(255 251 243 / 0.95);
  border-color: rgb(255 251 243 / 0.35);
}

.cart-summary .payment-icon--brand {
  background: var(--color-white);
}

/* --------------------------------------------------------------------------
   Stickers (snippet sticker)
   The shadow lives on the wrapper and the rotation on the image. Putting both on one
   element makes browsers rotate an already-rasterised bitmap, which visibly blurs it.
   -------------------------------------------------------------------------- */
.sticker {
  --sticker-rotate: 0deg;
  position: absolute;
  z-index: 2;
  display: block;
  filter: drop-shadow(0 10px 18px rgb(0 45 51 / 0.25));
  pointer-events: none;
  user-select: none;
}

.sticker--inline {
  position: relative;
  z-index: auto;
}

.sticker--flat {
  filter: none;
}

.sticker__image {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(var(--sticker-rotate));
}

/* --------------------------------------------------------------------------
   Notice / callout
   -------------------------------------------------------------------------- */
.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.notice .icon {
  margin-top: 0.15rem;
  color: var(--color-teal);
}

.notice--warning {
  background: rgb(255 176 0 / 0.18);
}

.notice--warning .icon {
  color: var(--color-dark-teal);
}

.prototype-note {
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--muted);
}
