/* Base components. One class block per component in /assets/js/components/. */

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 1.5px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--text); background: var(--surface); }
.btn--ghost { background: transparent; color: var(--link); padding-inline: var(--space-3); }
.btn--ghost:hover { text-decoration: underline; }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--small { min-height: 36px; padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn:active:not([disabled]) { transform: translateY(1px); }

/* ---------- Form fields ---------- */
.field { display: grid; gap: var(--space-1); margin-bottom: var(--space-4); }
.field__label { font-weight: 600; font-size: var(--text-sm); }
.field__required { color: var(--danger); font-weight: 600; }
.field__hint { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }
.field__error { display: flex; align-items: flex-start; gap: var(--space-1); font-size: var(--text-sm); color: var(--danger); font-weight: 600; margin: 0; }
.field__error svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

.input, .select {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  transition: border-color var(--duration) var(--ease-out);
}
.input::placeholder { color: var(--text-placeholder); opacity: 1; }
.input:hover, .select:hover { border-color: var(--text-muted); }
.input:focus-visible, .select:focus-visible { outline-offset: 1px; border-color: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
/* Password with a show/hide button inside the field */
.password { position: relative; }
.password__input { padding-right: 52px; }
.password__toggle {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; border: 0; border-radius: var(--radius-input); background: none;
  color: var(--text-muted); cursor: pointer;
}
.password__toggle:hover { color: var(--text); }
.password__toggle svg { width: 22px; height: 22px; }
.password__toggle[aria-pressed="true"] { color: var(--text); }
.select {
  appearance: none;
  cursor: pointer;
  padding-right: var(--space-7);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); /* taste-skill-ignore: the drop-down arrow of a form field */
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.checkbox { display: flex; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.checkbox__input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--crimson);
  cursor: pointer;
}
.checkbox__label { font-weight: 400; cursor: pointer; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-5);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-muted);
}
.badge--accent { background: var(--crimson); color: var(--white); }
.badge--success { color: var(--success); }
.badge--warning { color: var(--warning); }
.badge--danger { color: var(--danger); }

/* ---------- Modal (native <dialog>) ---------- */
.modal {
  width: min(32rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 2 * var(--gutter));
  padding: 0;
  border: 0;
  border-radius: var(--radius-panel);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-dialog); /* taste-skill-ignore: a dialog floats above the page */
}
.modal::backdrop { background: var(--backdrop); }
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) 0;
}
.modal__title { margin: 0; font-size: var(--text-xl); }
.modal__close {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) 0 0;
  border: 0;
  border-radius: var(--radius-button);
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
.modal__close:hover { background: var(--surface); }
.modal__body { padding: var(--space-4) var(--space-5) var(--space-5); }
.modal__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  z-index: 50;
  inset: auto var(--gutter) var(--gutter) var(--gutter);
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  pointer-events: none;
}
@media (min-width: 48rem) {
  .toast-region { inset: auto var(--gutter) var(--gutter) auto; justify-items: end; }
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 26rem;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--near-black);
  color: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-dialog); /* taste-skill-ignore: a toast floats above the page */
  pointer-events: auto;
}
.toast__mark { flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--crimson-tint); }
.toast--success .toast__mark { background: #8fd6a8; }
.toast__close {
  flex: none;
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}
.toast__close:hover { background: var(--graphite); }
.toast__close:focus-visible { outline-color: var(--white); }

/* ---------- Skeleton loader ---------- */
.skeleton {
  display: block;
  background: var(--skeleton);
  border-radius: var(--radius-button);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton--text { height: 1em; margin-bottom: var(--space-2); }
.skeleton--block { aspect-ratio: 1; }
@keyframes skeleton-pulse { 50% { opacity: 0.55; } }

/* ---------- Empty state ---------- */
.empty-state {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-5);
  background: var(--surface);
  border-radius: var(--radius-card);
}
.empty-state__title { margin: 0; font-size: var(--text-xl); }
.empty-state p { margin-bottom: var(--space-3); color: var(--text-muted); }

/* ---------- Price: Barlow with aligned digits, always with "incl. VAT" ---------- */
.price {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.price--large { font-size: var(--text-2xl); }
.price__note { display: block; margin-top: 2px; font-weight: 400; font-size: var(--text-sm); color: var(--text-muted); }

/* ---------- Product grid (tags are styled in store.css) ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-5) var(--space-4);
  padding: 0;
  margin: 0 0 var(--space-7);
  list-style: none;
}
