/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  text-align: center;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
}

.btn--secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn--secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.btn--ghost {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn--ghost:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}

.btn--danger:hover {
  background: #8f3030;
}

.btn--sm {
  min-height: 2.35rem;
  padding: 0.5rem 0.85rem;
  font-size: var(--fs-xs);
}

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

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.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--new {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.badge--soon {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

/* Product card */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.product-card:hover,
.product-card:focus-within {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.product-card:hover .product-card__media-inner,
.product-card:focus-within .product-card__media-inner {
  transform: scale(1.03);
}

.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
}

.product-card__media-inner {
  width: 100%;
  height: 100%;
  transition: transform var(--transition);
}

.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

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

.product-card__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: var(--space-6);
  text-align: center;
  background:
    linear-gradient(180deg, #f7f7f8 0%, #ececef 100%);
}

.product-card__placeholder-silhouette {
  width: 38%;
  max-width: 5.5rem;
  aspect-ratio: 1 / 2.2;
  margin-bottom: var(--space-3);
  border-radius: 999px 999px 0.4rem 0.4rem;
  background:
    linear-gradient(180deg, transparent 0 12%, var(--color-border-strong) 12% 14%, transparent 14% 22%),
    linear-gradient(180deg, var(--color-border) 0%, #cfcfd4 100%);
  opacity: 0.85;
  position: relative;
}

.product-card__placeholder-silhouette::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 50%;
  width: 160%;
  height: 0.35rem;
  transform: translateX(-50%);
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
}

.product-card__placeholder-silhouette::after {
  content: "";
  position: absolute;
  bottom: -6%;
  left: 50%;
  width: 130%;
  height: 18%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #d8d8dd;
}

.product-card__placeholder-text {
  color: var(--color-text-subtle);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
}

.product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-2);
  padding: var(--space-4);
}

.product-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--color-text);
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__title a {
  color: inherit;
}

.product-card__title a:hover,
.product-card__title a:focus-visible {
  color: var(--color-accent);
}

.product-card__desc {
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  min-height: calc(1.6em * 3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: none;
}

.product-card__footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-2);
}

.product-card__price {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  min-height: 1.5em;
}

.product-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  position: relative;
  z-index: 2;
}

.product-card__actions .btn {
  width: 100%;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 24rem;
  margin-left: auto;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  animation: toast-in 240ms ease;
}

.toast--success {
  border-color: rgba(47, 107, 79, 0.35);
}

.toast--error {
  border-color: rgba(163, 59, 59, 0.35);
}

.toast__message {
  flex: 1;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

.toast__close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.toast__close:hover,
.toast__close:focus-visible {
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.toast__close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section header */
.section-header {
  margin-bottom: var(--space-8);
  max-width: 40rem;
}

.section-eyebrow {
  margin-bottom: var(--space-2);
  color: var(--color-accent);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-text);
}

.section-lead {
  color: var(--color-text-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: calc(var(--z-toast) + 1);
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Form controls */
.field,
.select,
.search-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field__label,
.select__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
}

.input,
.select__control {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus,
.select__control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.input.is-invalid,
.select__control.is-invalid {
  border-color: var(--color-danger);
}

.input.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

.input--textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: var(--lh-normal);
}

.field__required {
  color: var(--color-text-subtle);
  font-weight: var(--fw-regular);
}

.field__error {
  color: var(--color-danger);
  font-size: var(--fs-xs);
  margin: 0;
}

.field-grid {
  display: grid;
  gap: var(--space-3);
}

.form-alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
  border: 1px solid var(--color-border);
}

.form-alert--error {
  background: var(--color-danger-soft);
  border-color: rgba(163, 59, 59, 0.35);
  color: var(--color-danger);
}

.form-alert--warning {
  background: var(--color-warning-soft);
  border-color: rgba(154, 107, 31, 0.35);
  color: var(--color-warning);
}

.form-alert--success {
  background: var(--color-success-soft);
  border-color: rgba(47, 107, 79, 0.35);
  color: var(--color-success);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent);
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.qty-control .input {
  width: 4.5rem;
  text-align: center;
}
