/*
  Artemilano — Components (Stage 2)
  Кнопки, ссылки, бейджи, карточки категорий/товаров, поля форм,
  модальные окна, шапка/футер-примитивы, состояния.
  Все классы с префиксом am- для безопасной интеграции в Bitrix.
*/

/* =========================
   BUTTONS
   ========================= */
.am-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: var(--am-radius-pill);
  border: 1px solid transparent;
  font-size: var(--am-size-sm);
  font-weight: var(--am-weight-semibold);
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: relative;
  transition: transform var(--am-transition), box-shadow var(--am-transition),
    background-color var(--am-transition), border-color var(--am-transition), color var(--am-transition);
  cursor: pointer;
  user-select: none;
}
.am-btn:hover { transform: translateY(-2px); }
.am-btn:active { transform: translateY(0); }
.am-btn:disabled,
.am-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Primary: warm light */
.am-btn--primary {
  background: linear-gradient(135deg, var(--am-accent-2), var(--am-accent));
  color: #1a140d;
  box-shadow: 0 8px 28px rgba(227, 180, 106, 0.25);
}
.am-btn--primary:hover {
  box-shadow: 0 12px 40px rgba(227, 180, 106, 0.38);
}

/* Secondary: glass outline */
.am-btn--secondary {
  background: rgba(255,255,255,0.03);
  border-color: rgba(245, 239, 231, 0.28);
  color: var(--am-text);
}
.am-btn--secondary:hover {
  border-color: var(--am-accent);
  background: rgba(227, 180, 106, 0.08);
}

/* Ghost */
.am-btn--ghost {
  background: transparent;
  color: var(--am-text-muted);
  padding-inline: 10px;
  min-height: 44px;
}
.am-btn--ghost:hover { color: var(--am-accent); transform: none; }

/* Small / icon */
.am-btn--sm { min-height: 42px; padding: 10px 20px; font-size: var(--am-size-xs); }
.am-btn--icon {
  width: 48px; min-width: 48px; height: 48px;
  padding: 0; border-radius: 50%;
}
.am-btn--icon.am-btn--sm { width: 40px; min-width: 40px; height: 40px; }

/* Link with arrow */
.am-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--am-accent);
  font-size: var(--am-size-sm);
  font-weight: var(--am-weight-medium);
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(227,180,106,0.3);
  padding-bottom: 2px;
  transition: gap var(--am-transition), border-color var(--am-transition);
}
.am-link:hover { gap: 14px; border-color: var(--am-accent); }
.am-link--muted {
  color: var(--am-text-muted);
  border-color: rgba(245,239,231,0.2);
}
.am-link--muted:hover { color: var(--am-text); border-color: var(--am-text-muted); }

/* =========================
   BADGES / STATUS
   ========================= */
.am-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--am-radius-pill);
  font-size: 11px;
  font-weight: var(--am-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--am-border);
  background: rgba(255,255,255,0.04);
  color: var(--am-text-muted);
}
.am-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.am-badge--in-stock { color: #9fd6ae; border-color: rgba(159,214,174,0.25); background: rgba(159,214,174,0.08); }
.am-badge--on-order { color: var(--am-accent-2); border-color: rgba(227,180,106,0.28); background: rgba(227,180,106,0.08); }
.am-badge--out { color: #d9a29a; border-color: rgba(217,162,154,0.25); background: rgba(217,162,154,0.08); }
.am-badge--sale { color: #1a140d; background: linear-gradient(135deg, var(--am-accent-2), var(--am-accent)); border-color: transparent; }
.am-badge--sale::before { display: none; }

/* =========================
   CATEGORY CARD
   ========================= */
.am-cat-card {
  display: block;
  position: relative;
  border-radius: var(--am-radius-lg);
  overflow: hidden;
  background: var(--am-bg-elevated);
  border: 1px solid var(--am-border);
  min-height: 420px;
  isolation: isolate;
  transition: transform var(--am-transition-slow), box-shadow var(--am-transition-slow), border-color var(--am-transition);
}
.am-cat-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--am-shadow-hover);
  border-color: rgba(227,180,106,0.25);
}
.am-cat-card__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.am-cat-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.62) saturate(0.75);
  transition: transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 600ms ease;
}
.am-cat-card:hover .am-cat-card__media img {
  transform: scale(1.04);
  filter: brightness(0.78) saturate(0.9);
}
/* warm light overlay on hover */
.am-cat-card__media::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(243, 213, 154, 0.28), transparent 70%),
    linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%);
  opacity: 0.65;
  transition: opacity var(--am-transition-slow);
}
.am-cat-card:hover .am-cat-card__media::after { opacity: 1; }

.am-cat-card__body {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px;
}
.am-cat-card__eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--am-accent-2);
  margin-bottom: 10px;
}
.am-cat-card__title {
  font-family: var(--am-font-display);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.05;
  margin: 0 0 16px;
  color: #fff;
}
.am-cat-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--am-size-sm);
  color: var(--am-text-muted);
  transition: color var(--am-transition), gap var(--am-transition);
}
.am-cat-card:hover .am-cat-card__cta { color: var(--am-accent); gap: 14px; }

@media (max-width: 767px) {
  .am-cat-card, .am-cat-card__body { min-height: 320px; }
  .am-cat-card__body { padding: 24px; }
}

/* =========================
   PRODUCT CARD
   ========================= */
.am-product-card {
  display: flex;
  flex-direction: column;
  background: var(--am-bg-elevated);
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  overflow: hidden;
  transition: transform var(--am-transition), box-shadow var(--am-transition), border-color var(--am-transition);
  position: relative;
}
.am-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--am-shadow-hover);
  border-color: rgba(227,180,106,0.2);
}
.am-product-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #1a1816;
  overflow: hidden;
}
.am-product-card__media a { display: block; height: 100%; }
.am-product-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 400ms ease;
}
/* secondary image on hover (if present) */
.am-product-card__img--alt {
  position: absolute; inset: 0;
  opacity: 0;
}
.am-product-card:hover .am-product-card__img--main { transform: scale(1.04); }
.am-product-card:hover .am-product-card__img--alt { opacity: 1; }
.am-product-card:hover .am-product-card__img--main.am-has-alt { opacity: 0; }

.am-product-card__top {
  position: absolute;
  top: 14px; left: 14px; right: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  z-index: 2;
  pointer-events: none;
}
.am-product-card__top > * { pointer-events: auto; }

.am-product-card__fav {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(14,13,11,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--am-text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-left: auto;
  transition: background var(--am-transition), color var(--am-transition), border-color var(--am-transition);
}
.am-product-card__fav:hover { color: var(--am-accent); border-color: rgba(227,180,106,0.4); }
.am-product-card__fav.is-active { color: var(--am-accent); background: rgba(227,180,106,0.14); }

.am-product-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.am-product-card__name {
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--am-text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3em;
}
.am-product-card__name a:hover { color: var(--am-accent-2); }

.am-product-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 6px;
}
.am-product-card__price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.am-product-card__price .am-price__old { margin-right: 0; font-size: 0.85rem; }
.am-product-card__price .am-price__current { font-size: 1.2rem; font-weight: 600; }

.am-product-card__cart {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--am-border-strong);
  background: transparent;
  color: var(--am-accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--am-transition), color var(--am-transition), transform var(--am-transition);
}
.am-product-card__cart:hover {
  background: var(--am-accent);
  color: #1a140d;
  transform: scale(1.05);
}

.am-product-card__stock {
  margin-top: 2px;
}

/* =========================
   FORM CONTROLS
   ========================= */
.am-field { display: flex; flex-direction: column; gap: 8px; }
.am-label {
  font-size: var(--am-size-xs);
  font-weight: var(--am-weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--am-text-muted);
}
.am-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(245,239,231,0.16);
  border-radius: var(--am-radius-sm);
  color: var(--am-text);
  transition: border-color var(--am-transition), box-shadow var(--am-transition), background var(--am-transition);
}
.am-input::placeholder { color: #7f766c; }
.am-input:hover { border-color: rgba(245,239,231,0.32); }
.am-input:focus {
  outline: none;
  border-color: var(--am-accent);
  box-shadow: 0 0 0 4px rgba(227,180,106,0.1);
  background: rgba(255,255,255,0.05);
}
.am-input--error { border-color: rgba(229,139,122,0.7); }
.am-help { font-size: var(--am-size-xs); color: var(--am-text-dim); line-height: 1.5; }
.am-error { font-size: var(--am-size-xs); color: #f0a89b; line-height: 1.5; }

/* Checkbox */
.am-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--am-size-sm);
  color: var(--am-text-muted);
  cursor: pointer;
}
.am-check input {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--am-accent);
  flex-shrink: 0;
}
.am-check a { color: var(--am-accent); text-decoration: underline; text-underline-offset: 3px; }

/* =========================
   MODAL (overlay for Bitrix modals)
   ========================= */
.am-modal {
  background: #161412;
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius-lg);
  box-shadow: 0 30px 100px rgba(0,0,0,0.6);
  color: var(--am-text);
  max-width: 560px;
  width: min(100% - 32px, 560px);
  padding: 40px;
}
.am-modal__title {
  font-family: var(--am-font-display);
  font-size: 2.2rem;
  line-height: 1.1;
  margin: 0 0 12px;
}
.am-modal__text {
  color: var(--am-text-muted);
  margin: 0 0 28px;
  line-height: 1.7;
}
.am-modal__form { display: flex; flex-direction: column; gap: 18px; }
.am-modal__actions { margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .am-modal { padding: 28px 20px; }
}

/* =========================
   TRUST / STAT CARD
   ========================= */
.am-stat {
  padding: 28px 0;
  border-top: 1px solid var(--am-border);
}
.am-stat__value {
  font-family: var(--am-font-display);
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1;
  color: var(--am-accent);
  margin-bottom: 10px;
}
.am-stat__label {
  color: var(--am-text-muted);
  font-size: var(--am-size-sm);
  line-height: 1.6;
  max-width: 220px;
}

/* =========================
   HEADER / FOOTER PRIMITIVES
   ========================= */
.am-header {
  position: sticky;
  top: 0;
  z-index: var(--am-z-header);
  background: rgba(14, 13, 11, 0.82);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  border-bottom: 1px solid rgba(245,239,231,0.06);
}
.am-header__inner {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.am-header__nav {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0; padding: 0;
}
.am-header__nav a {
  font-size: var(--am-size-sm);
  color: var(--am-text-muted);
  padding: 8px 0;
  position: relative;
}
.am-header__nav a:hover,
.am-header__nav a.is-active { color: var(--am-text); }
.am-header__nav a::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--am-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--am-transition);
}
.am-header__nav a:hover::after,
.am-header__nav a.is-active::after { transform: scaleX(1); }

.am-footer {
  background: var(--am-bg-deep);
  border-top: 1px solid var(--am-border);
  padding: 72px 0 32px;
  color: var(--am-text-muted);
}
.am-footer a:hover { color: var(--am-accent); }
.am-footer__bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--am-border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: var(--am-size-sm);
  color: var(--am-text-dim);
}

/* =========================
   REDUCED MOTION
   ========================= */
@media (prefers-reduced-motion: reduce) {
  .am-page *, .am-page *::before, .am-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .am-product-card:hover,
  .am-cat-card:hover,
  .am-btn:hover { transform: none; }
}