/* ==========================================================================
   Reusable components (shared by storefront and admin)
   ========================================================================== */

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-ink);
  --btn-border: var(--color-ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 2px solid var(--btn-border);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background var(--dur-fast) ease,
    color var(--dur-fast) ease;
}
.btn:hover { box-shadow: var(--shadow-hard); }
.btn:active { transform: translate(0, 0); box-shadow: 0 0 0 var(--color-hard); }
.btn .icon { width: 20px; height: 20px; }

.btn-primary { --btn-bg: var(--color-accent); --btn-fg: var(--color-accent-ink); --btn-border: var(--color-ink); }
.btn-dark { --btn-bg: var(--color-ink); --btn-fg: var(--color-bg); --btn-border: var(--color-ink); }
.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
}
.btn-ghost:hover { background: var(--color-surface-2); box-shadow: none; transform: none; }
.btn-danger { --btn-bg: var(--color-danger); --btn-fg: #fff; --btn-border: var(--color-danger); }
.btn-danger-outline { --btn-fg: var(--color-danger); --btn-border: var(--color-danger); }
.btn-danger:hover, .btn-danger-outline:hover { box-shadow: 4px 4px 0 var(--color-danger); }

@media (prefers-color-scheme: dark) {
  .btn-primary { --btn-border: var(--color-accent); }
  .btn-primary:hover { box-shadow: 4px 4px 0 #f1f1ec; }
  .btn-dark { --btn-bg: var(--color-ink); --btn-fg: #111113; }
}

.btn-sm { min-height: 38px; padding: 0 16px; font-size: 0.9rem; gap: 8px; }
.btn-sm .icon { width: 17px; height: 17px; }
.btn-lg { min-height: 56px; padding: 0 30px; font-size: 1.0625rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 38px; }

.btn[disabled], .btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading state: label hidden, spinner centred, width preserved. */
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--btn-fg);
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

/* ---------- Badges, chips, pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-ink);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-accent { background: var(--color-accent); color: var(--color-accent-ink); }
.badge-ink { background: var(--color-ink); color: var(--color-bg); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-outline { background: transparent; border: 1.5px solid var(--color-line); }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-line);
  background: var(--color-surface);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.chip:hover {
  border-color: var(--color-ink);
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 var(--color-hard);
}
.chip[aria-pressed='true'], .chip[aria-current='true'] {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-bg);
  box-shadow: 2px 2px 0 var(--color-hard);
  transform: translateY(-1px);
}
.chip__count { font-size: 0.8rem; opacity: 0.6; font-variant-numeric: tabular-nums; }

.icon-badge {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border: 2px solid var(--color-ink);
}
.icon-badge .icon { width: 24px; height: 24px; }

/* ---------- Price ---------- */

.price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.price-compare {
  color: var(--color-ink-muted);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}
.price-save {
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Panels ---------- */

.panel {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px);
}
.panel-strong { border: var(--border-strong); box-shadow: var(--shadow-hard); }
.panel-title { font-size: 1.35rem; margin-bottom: 16px; }

/* ---------- Product card ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}
.product-grid > * { min-width: 0; }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: var(--border);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) ease;
  animation: card-reveal 420ms var(--ease-out) backwards;
  animation-delay: calc(var(--card-index, 0) * 45ms);
  will-change: transform, box-shadow;
}
.product-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-ink);
  box-shadow: 8px 8px 0 var(--color-hard);
}
.product-card__media {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 1 / 1;
  margin: 8px 8px 0;
  padding: 14%;
  border-radius: calc(var(--radius-lg) - 6px);
  background: color-mix(in oklab, var(--tint, #ddd) 26%, var(--color-surface));
  overflow: hidden;
}
.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgb(20 20 23 / 0.18));
  transition: transform var(--dur-slow) var(--ease-spring);
}
.product-card:hover .product-card__media img {
  transform: scale(1.09) rotate(-2deg);
}
.product-card__badge { position: absolute; top: 12px; left: 12px; }
/* Name on its own line with the price underneath: both get the full card width. */
.product-card__body {
  display: grid;
  gap: 4px;
  padding: 12px 14px 14px 16px;
}
.product-card__name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card__name a { text-decoration: none; }
/* Whole card is clickable via the title link. */
.product-card__name a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.product-card__prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.product-card__prices .price { font-size: 1.2rem; }
.product-card__prices .price-compare { font-size: 0.85rem; }
/* Add-to-cart sits on the image's top-right corner (above the card's click-through link). */
.product-card__add {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  box-shadow: 2px 2px 0 var(--color-hard);
  transition: transform var(--dur) var(--ease-spring), background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.product-card__add:hover {
  transform: scale(1.12);
  background: var(--color-accent-hover);
  box-shadow: 3px 3px 0 var(--color-hard);
}
.product-card__add:active {
  transform: scale(0.92);
  box-shadow: 0 0 0 var(--color-hard);
}
.product-card__add .icon { width: 18px; height: 18px; }
.product-card__add.is-added {
  background: var(--color-ink);
  color: var(--color-accent);
  animation: add-pop 450ms var(--ease-spring);
}
@media (prefers-color-scheme: dark) {
  .product-card__add { border-color: var(--color-accent); }
}

@keyframes card-reveal {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes add-pop {
  0% { transform: scale(0.85); }
  45% { transform: scale(1.25); }
  75% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ---------- Skeletons ---------- */

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-2) 0%, color-mix(in srgb, var(--color-surface-2) 40%, var(--color-surface)) 50%, var(--color-surface-2) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-card { pointer-events: none; }
.skeleton-card .product-card__media { background: none; padding: 0; }
.skeleton-card .product-card__media .skeleton { width: 100%; height: 100%; border-radius: calc(var(--radius-lg) - 6px); }
.skeleton-line { height: 14px; margin-top: 8px; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-70 { width: 70%; }

/* ---------- Empty / error states ---------- */

.state {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: clamp(40px, 7vw, 80px) 20px;
  text-align: center;
  border: 2px dashed var(--color-line);
  border-radius: var(--radius-lg);
}
.state__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-surface-2);
  rotate: -8deg;
}
.state__icon .icon { width: 34px; height: 34px; }
.state--error .state__icon { background: var(--color-danger-soft); color: var(--color-danger); }
.state h2, .state h3 { font-size: 1.5rem; }
.state p { color: var(--color-ink-soft); max-width: 42ch; }
.state .btn { margin-top: 8px; }

/* ---------- Notices ---------- */

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--color-info-soft);
  color: var(--color-ink);
  font-size: 0.95rem;
}
.notice .icon { width: 22px; height: 22px; color: var(--color-info); margin-top: 1px; }
.notice strong { display: block; }
.notice-warning { background: var(--color-warning-soft); }
.notice-warning .icon { color: var(--color-warning); }
.notice-danger { background: var(--color-danger-soft); }
.notice-danger .icon { color: var(--color-danger); }
.notice-success { background: var(--color-success-soft); }
.notice-success .icon { color: var(--color-success); }

.status-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  box-shadow: var(--shadow-hard);
}
.status-icon .icon { width: 40px; height: 40px; }
.status-icon--success { background: var(--color-accent); color: var(--color-accent-ink); }
.status-icon--waiting { background: var(--color-warning-soft); color: var(--color-warning); }
.status-icon--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.status-icon--muted { background: var(--color-surface-2); color: var(--color-ink-soft); }
@keyframes tip { 0%, 40% { transform: rotate(0); } 50%, 90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; align-content: start; }
.field label, .field .label { font-weight: 600; font-size: 0.925rem; }
.field .optional { font-weight: 400; color: var(--color-ink-muted); }
.hint { font-size: 0.85rem; color: var(--color-ink-muted); }
.field-error { font-size: 0.85rem; color: var(--color-danger); font-weight: 500; display: none; }
.field.has-error .field-error { display: block; }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 1rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--color-ink-muted); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-ink-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-ink);
  box-shadow: 0 0 0 3px var(--color-accent);
}
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--color-danger); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.input-prefix {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input-prefix:focus-within { border-color: var(--color-ink); box-shadow: 0 0 0 3px var(--color-accent); }
.input-prefix span {
  display: grid;
  place-items: center;
  padding: 0 4px 0 14px;
  color: var(--color-ink-muted);
  font-weight: 600;
}
.input-prefix .input { border: 0; box-shadow: none; padding-left: 6px; }
.field.has-error .input-prefix { border-color: var(--color-danger); }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}
.search-field .icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--color-ink-muted);
  pointer-events: none;
}
.search-field .input { padding-left: 46px; border-radius: var(--radius-pill); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
}
.check input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid var(--color-ink);
  border-radius: 7px;
  background: var(--color-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.check input::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2.5px solid var(--color-accent-ink);
  border-bottom: 2.5px solid var(--color-accent-ink);
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.check input:checked { background: var(--color-accent); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

/* Toggle switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 500;
}
.switch input {
  appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  border: 2px solid var(--color-line);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease-out), border-color var(--dur);
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-ink-muted);
  transition: transform var(--dur) var(--ease-spring), background var(--dur);
}
.switch input:checked { background: var(--color-accent); border-color: var(--color-ink); }
.switch input:checked::after { transform: translateX(20px); background: var(--color-accent-ink); }
.switch input:disabled { opacity: 0.5; cursor: progress; }

/* Selectable radio cards */
.radio-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.radio-card:has(input:checked) { border-color: var(--color-ink); box-shadow: var(--shadow-hard-sm); }
.radio-card input { accent-color: var(--color-ink); width: 20px; height: 20px; margin: 0; }
.radio-card__body { flex: 1; }
.radio-card__title { font-weight: 600; }
.radio-card__desc { font-size: 0.9rem; color: var(--color-ink-muted); }
.radio-card .icon { width: 28px; height: 28px; }

/* Quantity stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  height: 48px;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}
.stepper button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 100%;
  border: 0;
  background: transparent;
  border-radius: var(--radius-pill);
}
.stepper button:hover { background: var(--color-surface-2); }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
.stepper button .icon { width: 16px; height: 16px; }
.stepper input {
  width: 38px;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.stepper-sm { height: 36px; border-width: 1.5px; }
.stepper-sm button { width: 34px; }
.stepper-sm input { width: 30px; font-size: 0.9rem; }

/* ---------- Cart line (drawer + cart page + summaries) ---------- */

.cart-line {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: var(--border);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.cart-line.is-removing { opacity: 0; transform: translateX(24px); }
.cart-line.is-unavailable { opacity: 0.55; }
.cart-line__thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--tint, #ddd) 26%, var(--color-surface));
  padding: 8px;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}
.cart-line__thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-line__name { font-weight: 600; line-height: 1.3; text-decoration: none; }
.cart-line__name:hover { text-decoration: underline; }
.cart-line__unit { font-size: 0.875rem; color: var(--color-ink-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cart-line__controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cart-line__total { align-self: start; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; }
.cart-line__remove {
  border: 0;
  background: none;
  color: var(--color-ink-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 4px;
}
.cart-line__remove:hover { color: var(--color-danger); }

.summary-rows { display: grid; gap: 10px; margin-top: 16px; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.summary-row span:first-child { color: var(--color-ink-soft); }
.summary-row--total {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 2px dashed var(--color-line);
  font-weight: 700;
  font-size: 1.2rem;
}
.summary-row--total span:first-child { color: var(--color-ink); }
.summary-items { list-style: none; display: grid; gap: 12px; }
.summary-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.summary-item__thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  padding: 6px;
  background: color-mix(in oklab, var(--tint, #ddd) 26%, var(--color-surface-2));
}
.summary-item__thumb img { width: 100%; height: 100%; object-fit: contain; }
.summary-item__qty {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-bg);
  font-size: 0.75rem;
  font-weight: 700;
}
.summary-item__name { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.summary-item__unit { font-size: 0.85rem; color: var(--color-ink-muted); }
.summary-item__total { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Free shipping progress */
.ship-progress { margin-top: 4px; font-size: 0.9rem; }
.ship-progress__bar {
  height: 8px;
  margin-top: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  overflow: hidden;
}
.ship-progress__fill {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--color-accent);
  border-right: 2px solid var(--color-ink);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease-out);
}

/* ---------- Cart drawer ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  visibility: hidden;
  pointer-events: none;
}
.drawer.is-open { visibility: visible; pointer-events: auto; }
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.drawer.is-open .drawer__backdrop {
  opacity: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-left: var(--border-strong);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.drawer.is-open .drawer__panel {
  transform: none;
  box-shadow: -16px 0 40px rgb(0 0 0 / 0.28);
}
.drawer.is-open .cart-lines .cart-line {
  animation: cart-line-enter 300ms var(--ease-out) backwards;
}
.drawer.is-open .cart-lines .cart-line:nth-child(1) { animation-delay: 50ms; }
.drawer.is-open .cart-lines .cart-line:nth-child(2) { animation-delay: 90ms; }
.drawer.is-open .cart-lines .cart-line:nth-child(3) { animation-delay: 130ms; }
.drawer.is-open .cart-lines .cart-line:nth-child(4) { animation-delay: 170ms; }
.drawer.is-open .cart-lines .cart-line:nth-child(5) { animation-delay: 210ms; }

@keyframes cart-line-enter {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 16px 22px;
  border-bottom: var(--border);
}
.drawer__head h2 { font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 12px; }
.drawer__foot { padding: 16px 20px 20px; border-top: var(--border); background: var(--color-surface); display: grid; gap: 12px; }
.drawer__foot .summary-row--total { margin: 0; padding: 0; border: 0; }
.drawer__note { font-size: 0.85rem; color: var(--color-ink-muted); text-align: center; }
.drawer .state { border: 0; padding-block: 48px; }

/* ---------- Accordion ---------- */

.accordion { display: grid; gap: 10px; }
.accordion details {
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.accordion details:hover {
  border-color: var(--color-ink);
}
.accordion details[open] {
  border-color: var(--color-ink);
  box-shadow: 4px 4px 0 var(--color-hard);
}
.accordion summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .icon { transition: transform var(--dur) var(--ease-spring); }
.accordion details[open] summary .icon { transform: rotate(45deg); }
.accordion .accordion__body {
  padding: 0 20px 20px;
  color: var(--color-ink-soft);
  animation: accordion-enter 240ms var(--ease-out);
}

/* ---------- Toasts ---------- */

.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: 24px;
  translate: -50% 0;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-ink);
  color: var(--color-bg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 380ms var(--ease-spring) both;
}
.toast.is-leaving { animation: toast-out 220ms var(--ease-out) forwards; }
.toast__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--color-accent); color: var(--color-accent-ink); flex-shrink: 0; }
.toast__icon .icon { width: 18px; height: 18px; }
.toast--error .toast__icon { background: var(--color-danger); color: #fff; }
.toast__text { flex: 1; font-size: 0.95rem; font-weight: 500; }
.toast__action { color: var(--color-accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.toast__action:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  .toast { background: var(--color-surface-2); color: var(--color-ink); border: 1px solid var(--color-line); }
}
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Modal (dialog) ---------- */

.modal {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-hard), var(--shadow-lg);
}
.modal::backdrop { background: var(--color-overlay); }
.modal[open] { animation: toast-in 320ms var(--ease-out); }
.modal__body { padding: 24px; display: grid; gap: 14px; }
.modal__body h2 { font-size: 1.4rem; }
.modal__body p { color: var(--color-ink-soft); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 24px; flex-wrap: wrap; }

/* Spinner */
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--color-line);
  border-top-color: var(--color-ink);
  animation: spin 800ms linear infinite;
}

.skeleton-fill { width: 100%; height: 100%; }
.skeleton-title { height: 56px; margin-top: 16px; width: 80%; }
.skeleton-gap { margin-top: 24px; }
.summary-card .text-link { margin-top: 16px; }

/* Inline emphasis inside a notice sentence stays inline (only a leading title is a block). */
.notice span strong { display: inline; }

/* ---------- Quick view (side panel opened from a sticker card) ---------- */
/* No divider line down the panel's edge: a soft shadow separates it from the dimmed page instead. */
.qv-drawer .drawer__panel { border-left: 0; box-shadow: -16px 0 40px rgb(0 0 0 / 0.28); }

/* The panel fits the window instead of scrolling: the sticker picture takes whatever height is left over
   (never less than 80px), and everything else keeps its natural size. */
.qv-body { display: flex; flex-direction: column; align-content: normal; gap: 14px; padding: 16px 20px; min-height: 0; }
.qv-body > * { flex: none; }
.qv-body > .qv-media { flex: 1 1 0; min-height: 80px; max-height: 380px; }
.qv-media {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 100%;
  padding: 6%;
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--tint, #ddd) 26%, var(--color-surface));
}
.qv-media img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 14px rgb(20 20 23 / 0.2)); }
.qv-name { font-size: clamp(1.4rem, 3.4vw, 1.8rem); line-height: 1.05; }
.qv-prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 8px; }
.qv-prices .price { font-size: 1.5rem; }
/* Long descriptions are shortened to three lines here; "View full page" has the whole text. */
.qv-desc { color: var(--color-ink-soft); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qv-specs { margin: 0; display: grid; border: var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); }
.qv-spec { display: grid; grid-template-columns: 7rem 1fr; gap: 12px; padding: 10px 16px; }
.qv-spec + .qv-spec { border-top: var(--border); }
.qv-spec dt { color: var(--color-ink-muted); font-size: 0.9rem; }
.qv-spec dd { margin: 0; font-weight: 600; }
.qv-buy { display: flex; gap: 12px; }
.qv-buy .btn { flex: 1; }
.qv-full { justify-self: center; }
@media (max-width: 560px) {
  .qv-body { padding: 14px 16px; }
  .qv-media { padding: 4%; }
  .qv-spec { grid-template-columns: 6rem 1fr; padding: 9px 14px; }
}
/* Short windows: tighter spacing everywhere so the picture still gets a good share of the height. */
@media (max-height: 740px) {
  .qv-drawer .drawer__head { padding: 6px 8px 6px 20px; }
  .qv-drawer .drawer__head h2 { font-size: 1.25rem; }
  .qv-drawer .drawer__head .icon-btn { width: 40px; height: 40px; }
  .qv-body { gap: 10px; padding: 12px 16px; }
  .qv-name { font-size: 1.35rem; }
  .qv-prices { margin-top: 4px; }
  .qv-prices .price { font-size: 1.3rem; }
  .qv-spec { padding: 7px 14px; font-size: 0.92rem; }
  .qv-foot { padding: 10px 16px 12px; gap: 6px; }
  .qv-buy .btn-lg { min-height: 46px; }
  .qv-buy .stepper { height: 46px; }
}

/* ---------- Custom stickers page ---------- */
.cs-flow { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 28px; font-weight: 600; }
.cs-flow li { display: flex; align-items: center; gap: 10px; }
.custom-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: clamp(24px, 4vw, 48px); align-items: start; }
.custom-steps { display: grid; gap: 20px; }
.custom-steps .checkout-section + .checkout-section { margin-top: 0; }

.cs-drop {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 28px 20px;
  text-align: center;
  border: 2px dashed var(--color-ink-muted);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  cursor: pointer;
}
.cs-drop:hover, .cs-drop.is-dragover { border-color: var(--color-ink); background: var(--color-accent-soft); }
.cs-drop:focus-within { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.cs-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cs-drop__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--color-surface); border: var(--border); }
.cs-drop__icon .icon { width: 26px; height: 26px; }
.cs-drop__title { font-weight: 700; font-size: 1.05rem; }
.cs-drop__hint { color: var(--color-ink-muted); font-size: 0.9rem; max-width: 40ch; }

.cs-busy { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 160px; font-weight: 600; }

.cs-compare__tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.cs-frame {
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
  border: var(--border);
  border-radius: var(--radius-md);
  /* checkerboard so transparent areas are visible */
  background: conic-gradient(color-mix(in srgb, var(--color-ink) 9%, var(--color-surface)) 25%, var(--color-surface) 0 50%, color-mix(in srgb, var(--color-ink) 9%, var(--color-surface)) 0 75%, var(--color-surface) 0) 0 0 / 20px 20px;
}
.cs-frame img { max-width: 100%; max-height: 420px; width: auto; height: auto; object-fit: contain; }
.cs-note { margin: 14px 0; color: var(--color-ink-soft); font-size: 0.95rem; max-width: 62ch; }

.cs-sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cs-qty { margin-top: 20px; }
.cs-empty { color: var(--color-ink-muted); }
[data-quality]:not(:empty) { margin-top: 18px; }
[data-quality] .notice strong { display: inline; }

/* ---------- Sign up / log in and account ---------- */
.account-btn { display: inline-flex; align-items: center; width: auto; gap: 8px; padding-inline: 12px 16px; font-weight: 600; }
.account-btn__label { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-wrap { display: grid; justify-items: center; padding-block: clamp(24px, 6vw, 72px); }
.auth-card { width: min(100%, 480px); display: grid; gap: 18px; padding: clamp(24px, 5vw, 40px); }
.auth-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.1; overflow-wrap: anywhere; }
.auth-lead { margin: 0; color: var(--color-ink-soft); }
.auth-card .notice { margin: 0; }
.btn-google { gap: 12px; background: var(--color-surface); color: var(--color-ink); border: var(--border-strong); box-shadow: var(--shadow-hard-sm); }
.btn-google:hover { background: var(--color-accent-soft); }
.btn-google .icon-google { width: 22px; height: 22px; }
.btn[aria-disabled='true'] { opacity: 0.5; pointer-events: none; box-shadow: none; }
.auth-perks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.auth-perks li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; }
.auth-perks .icon { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--color-success); }
.auth-fine { margin: 0; }
.account-head { display: flex; align-items: center; gap: 16px; }
.account-head > div { min-width: 0; }
.account-email { margin: 4px 0 0; color: var(--color-ink-muted); overflow-wrap: anywhere; }
.avatar {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--color-accent); color: var(--color-accent-ink); border: var(--border-strong);
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 800;
}
.auth-card .form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Several designs per order, and typed-in sizes */
.cs-designs { display: grid; gap: 16px; }
.cs-designs > h2, .cs-designs > .hint { margin: 0; }
.cs-items { display: grid; gap: 20px; }
.cs-item { display: grid; gap: 16px; }
.cs-item__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cs-item__title { font-size: 1.1rem; margin: 0; }
.cs-sub { font-size: 0.95rem; margin: 4px 0 -4px; }
.cs-own[hidden] { display: none; }
.cs-own { display: grid; gap: 8px; }
.cs-own__fields { display: flex; align-items: flex-end; gap: 12px; }
.cs-own__fields .field { flex: 1; margin: 0; max-width: 180px; }
.cs-own__x { padding-bottom: 12px; font-weight: 700; color: var(--color-ink-muted); }
.cs-own.has-error .field-error { display: block; }
.cs-own.has-error .input { border-color: var(--color-danger); }
.cs-line-price { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.cs-line-price:empty { display: none; }
.cs-qty { margin-top: 4px; }

/* Auth cards: let the card shrink below its content on the narrowest phones (320px) instead of overflowing. */
.auth-wrap { grid-template-columns: minmax(0, 1fr); }
.auth-card { min-width: 0; max-width: 100%; }
.auth-card .btn { max-width: 100%; white-space: normal; }

/* Images whose file could not be loaded keep their tinted tile instead of showing a broken-image icon. */
img.is-broken { visibility: hidden; }

/* ---------- Checkout coupon ---------- */
.coupon { display: grid; gap: 8px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--color-line); }
.coupon__label { font-weight: 700; font-size: 0.95rem; }
.coupon__row { display: flex; gap: 8px; }
.coupon__row .input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; }
.coupon__row .btn { flex: 0 0 auto; }
.coupon__applied { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coupon__chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 2px dashed var(--color-success); border-radius: var(--radius-pill); background: var(--color-success-soft); color: var(--color-success); font-size: 0.9rem; }
.coupon__chip .icon { width: 16px; height: 16px; }
.coupon__msg { margin: 0; font-size: 0.875rem; }
.coupon__msg[data-kind="error"] { color: var(--color-danger); }
.coupon__msg[data-kind="success"] { color: var(--color-success); }
.coupon__msg[data-kind="info"] { color: var(--color-ink-soft); }
.summary-row--discount span:last-child { color: var(--color-success); font-weight: 700; }

.coupon__offers { display: grid; gap: 6px; }
.coupon__offers-label { font-size: 0.8rem; color: var(--color-ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.coupon__offer-list { display: flex; flex-wrap: wrap; gap: 8px; }
.coupon__offer { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border: 2px dashed var(--color-line-strong); border-radius: var(--radius-sm); background: transparent; color: var(--color-ink); cursor: pointer; text-align: left; }
.coupon__offer strong { font-size: 0.9rem; letter-spacing: 0.04em; }
.coupon__offer span { font-size: 0.78rem; color: var(--color-ink-soft); }
.coupon__offer:hover, .coupon__offer:focus-visible { border-color: var(--color-success); }

/* Sign-in by mobile number, account preferences */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 2px 0; color: var(--color-muted, #78716c); font-size: 0.85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: 0.25; }
.auth-or[hidden] { display: none; }
.auth-form { display: grid; gap: 14px; }
