/* ============================================================================
   Nyraa Skin Care — Components (BEM)
   Buttons, forms, cards, icons, nav. Tokens only.
   ============================================================================ */

/* ============================================================
   BUTTONS  (design-system.md §4 / ui-rules §3)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--btn-height);
  padding: var(--btn-padding-y) var(--btn-padding-x);
  font-family: var(--font-body);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  letter-spacing: var(--ls-normal);
  line-height: 1;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: var(--btn-transition);
  text-align: center;
}
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn--sm { min-height: var(--btn-height-sm); padding: var(--space-sm) var(--space-md); }
.btn--lg { min-height: var(--btn-height-lg); padding: var(--space-md) var(--space-xl); }

/* Primary */
.btn--primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn--primary:hover { background: var(--primary-600); color: var(--color-text-inverse); }
.btn--primary:active { background: var(--primary-700); }
.btn--primary:disabled { background: var(--primary-200); color: var(--color-text-inverse); opacity: 0.6; cursor: not-allowed; }

/* Secondary */
.btn--secondary { background: var(--color-surface); color: var(--color-neutral); }
.btn--secondary:hover { background: var(--neutral-200); color: var(--color-neutral); }
.btn--secondary:active { background: var(--neutral-300); }
.btn--secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inverted */
.btn--inverted { background: var(--color-neutral); color: var(--color-tertiary); }
.btn--inverted:hover { background: var(--neutral-700); color: var(--color-tertiary); }
.btn--inverted:active { background: var(--neutral-800); }
.btn--inverted:disabled { opacity: 0.5; cursor: not-allowed; }

/* Outline */
.btn--outline {
  background: transparent;
  color: var(--color-neutral);
  border: 1.5px solid var(--color-border);
}
.btn--outline:hover { background: var(--color-surface); border-color: var(--color-neutral); color: var(--color-neutral); }
.btn--outline:active { background: var(--neutral-100); }
.btn--outline:disabled { opacity: 0.5; cursor: not-allowed; }

/* Ghost */
.btn--ghost { background: transparent; color: var(--color-primary); }
.btn--ghost:hover { background: var(--primary-50); }
.btn--ghost:active { background: var(--primary-100); }
.btn--ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* Icon-only button */
.btn--icon {
  min-height: var(--btn-height-sm);
  width: var(--btn-height-sm);
  height: var(--btn-height-sm);
  padding: 0;
  background: var(--color-surface);
  color: var(--color-neutral);
  border-radius: var(--radius-sm);
}
.btn--icon:hover { background: var(--neutral-200); }

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

/* ============================================================
   ICONS  (design-system.md §5 / ui-rules §4)
   ============================================================ */
.icon { width: var(--icon-md); height: var(--icon-md); stroke-width: var(--icon-stroke); flex-shrink: 0; }
.icon--sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon--lg { width: var(--icon-lg); height: var(--icon-lg); }

.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-circle);
  height: var(--icon-circle);
  border-radius: var(--radius-full);
  color: var(--color-text-inverse);
}
.icon-circle--primary { background: var(--color-primary); }
.icon-circle--success { background: var(--color-success); }
.icon-circle--neutral { background: var(--neutral-500); }
.icon-circle--error   { background: var(--color-error); }

/* ============================================================
   FORMS  (design-system.md §7 / ui-rules §7)
   ============================================================ */
.field { margin-bottom: var(--space-md); }

.field__label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  color: var(--color-text);
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: var(--input-height);
  padding: var(--input-padding);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--color-text);
  background: var(--color-surface-alt);
  border: var(--input-border);
  border-radius: var(--input-radius);
  transition: var(--transition-color), box-shadow var(--dur-fast) var(--ease-standard);
}
textarea { min-height: 120px; resize: vertical; }

.input::placeholder,
input::placeholder,
textarea::placeholder { color: var(--color-text-muted); }

.input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--input-focus-ring);
}

/* Validation (ui-rules 30) */
.field--error .input,
.input--error { border-color: var(--color-error); box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }
.field--success .input,
.input--success { border-color: var(--color-success); box-shadow: 0 0 0 3px rgba(94,158,62,0.18); }

.field__message { margin-top: var(--space-xs); font-size: var(--fs-small); }
.field__message--error { color: var(--color-error); }
.field__message--success { color: var(--color-success); }

/* Checkbox / radio */
input[type="checkbox"],
input[type="radio"] {
  width: var(--icon-sm);
  height: var(--icon-sm);
  min-height: 0;
  accent-color: var(--color-primary);
}

/* ============================================================
   CARDS  (design-system.md §8 / ui-rules §6)
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  box-shadow: var(--card-shadow);
  transition: var(--transition-base);
}
.card:hover {
  transform: translateY(var(--card-hover-lift));
  box-shadow: var(--card-shadow-hover);
}
.card__media {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--product { aspect-ratio: 1 / 1; }
.card__media--blog { aspect-ratio: 16 / 9; }
.card__media--category { aspect-ratio: 4 / 3; }

.card__eyebrow {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-xs);
}
.card__title { margin-bottom: var(--space-sm); }
.card__excerpt { color: var(--color-text-secondary); margin-bottom: var(--space-md); }
.card__meta { font-size: var(--fs-small); color: var(--color-text-muted); }

/* ============================================================
   NAVIGATION  (design-system.md §9)
   ============================================================ */
.nav__list {
  display: flex;
  align-items: center;
  gap: var(--nav-gap);
}
.nav__link {
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
  color: var(--color-text);
}
.nav__link:hover,
.nav__item.current-menu-item > .nav__link { color: var(--color-primary); }

/* ============================================================
   BADGES / TAGS / EYEBROW PILL
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  background: var(--secondary-100);
  color: var(--secondary-700);
  border-radius: var(--radius-pill);
}

/* ============================================================
   SEARCH FORM
   ============================================================ */
.search-form__row { display: flex; gap: var(--space-sm); }
.search-form__field { flex: 1 1 auto; }

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-area { margin-top: var(--space-2xl); }
.comments-area__title { margin-bottom: var(--space-lg); }
.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}
.comment-list ol.children { margin-top: var(--space-lg); padding-inline-start: var(--space-lg); }
.no-comments { margin-top: var(--space-md); }

/* ============================================================
   SECTION HEADER  (reusable — ui-rules 48)
   ============================================================ */
.section-header { max-width: var(--container-md); margin-bottom: var(--space-2xl); }
.section-header--center { margin-inline: auto; text-align: center; }
.section-header__eyebrow {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}
.section-header__title { margin-bottom: var(--space-md); }
.section-header__lead { font-size: var(--fs-body-lg); color: var(--color-text-secondary); }

/* ============================================================================
   Cookie consent banner
   ============================================================================ */
.cookie-consent {
  position: fixed;
  left: 50%;
  bottom: var(--space-lg);
  transform: translateX(-50%);
  z-index: var(--z-toast, 1000);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  width: min(720px, calc(100% - 2 * var(--space-lg)));
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: opacity var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-standard);
}
.cookie-consent.is-hidden { opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none; }
.cookie-consent__text { margin: 0; font-size: var(--fs-small); color: var(--color-text-secondary); line-height: var(--lh-body); }
.cookie-consent__link { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.cookie-consent__actions { display: flex; gap: var(--space-sm); flex-shrink: 0; }
@media (max-width: 575px) {
  .cookie-consent { flex-direction: column; align-items: stretch; bottom: 0; left: 0; transform: none; width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .cookie-consent.is-hidden { transform: translateY(12px); }
  .cookie-consent__actions { justify-content: flex-end; }
}

/* ============================================================================
   Toast — transient status message (wishlist saves; reusable elsewhere)
   Same surface as the cookie banner, but anchored under the fixed header so
   the two never collide. Kept in the a11y tree (opacity, not display) so
   role="status" announces reliably.
   ============================================================================ */
.toast {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  left: 50%;
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  /* Without an explicit width a fixed box with only `left` shrink-fits to the
     space right of that edge — barely half the viewport on phones. */
  width: max-content;
  max-width: calc(100% - 2 * var(--space-lg));
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(-50%) translateY(calc(-1 * var(--space-sm)));
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-standard);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast__icon { flex-shrink: 0; font-size: var(--icon-md); color: var(--color-text-muted); }
.toast--added .toast__icon { color: var(--color-primary); font-variation-settings: 'FILL' 1; }
/* Refusals (out of stock, sold individually). The message carries the meaning;
   the color only reinforces it (ui-rules 5). */
.toast--error .toast__icon { color: var(--color-error); }

/* Any control mid add-to-cart request (see navigation.js). */
.is-adding-to-cart { opacity: 0.6; pointer-events: none; }

.toast__text {
  margin: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--color-text);
}

.toast__link {
  flex-shrink: 0;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.toast__link:hover { color: var(--primary-600); }
