/*
  Artemilano — Base / Typography / Layout primitives (Stage 2)
  Подключать после tokens.css.
  ВАЖНО: стили ограничены префиксом .am- и явными контейнерами,
  чтобы не ломать существующие Bitrix-компоненты.
*/

/* Fonts (подключить в header.php Bitrix):
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Manrope:wght@400;500;600&display=swap" rel="stylesheet">
*/

.am-page {
  background: var(--am-bg);
  color: var(--am-text);
  font-family: var(--am-font-body);
  font-size: var(--am-size-md);
  line-height: var(--am-line-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.am-page *,
.am-page *::before,
.am-page *::after {
  box-sizing: border-box;
}

.am-page img {
  max-width: 100%;
  height: auto;
  display: block;
}

.am-page a {
  color: inherit;
  text-decoration: none;
  transition: color var(--am-transition), opacity var(--am-transition);
}

.am-page button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.am-page input,
.am-page select,
.am-page textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  min-width: 0;
}

/* Container */
.am-container {
  width: min(100% - (var(--am-gutter) * 2), var(--am-container));
  margin-inline: auto;
}
.am-container--narrow {
  width: min(100% - (var(--am-gutter) * 2), var(--am-container-narrow));
  margin-inline: auto;
}

/* Section spacing */
.am-section {
  padding: var(--am-space-8) 0;
  position: relative;
}
@media (max-width: 767px) {
  .am-section { padding: 56px 0; }
}

/* Eyebrow / headings / text */
.am-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--am-size-xs);
  font-weight: var(--am-weight-semibold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--am-accent);
  margin-bottom: var(--am-space-4);
}
.am-eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--am-accent), transparent);
  flex-shrink: 0;
}

.am-h1, .am-h2, .am-h3, .am-h4 {
  font-family: var(--am-font-display);
  font-weight: var(--am-weight-regular);
  line-height: var(--am-line-tight);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--am-text);
}
.am-h1 { font-size: var(--am-size-hero); line-height: 0.98; }
.am-h2 { font-size: var(--am-size-3xl); }
.am-h3 { font-size: var(--am-size-2xl); }
.am-h4 { font-size: var(--am-size-xl); line-height: var(--am-line-snug); }

.am-lead {
  font-size: var(--am-size-lg);
  color: var(--am-text-muted);
  line-height: 1.75;
  max-width: 680px;
}
.am-text-muted { color: var(--am-text-muted); }
.am-text-dim { color: var(--am-text-dim); }

.am-accent {
  color: var(--am-accent);
}

/* Section header */
.am-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--am-space-5);
  margin-bottom: var(--am-space-7);
  flex-wrap: wrap;
}
.am-section-head__text { max-width: 720px; }
.am-section-head__text .am-h2 { margin-bottom: var(--am-space-4); }
.am-section-head__action { flex-shrink: 0; }

/* Grid helpers */
.am-grid {
  display: grid;
  gap: 24px;
}
.am-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.am-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.am-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .am-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .am-grid--4, .am-grid--3, .am-grid--2 { grid-template-columns: 1fr; }
  .am-grid { gap: 16px; }
}

/* Divider */
.am-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--am-border-strong), transparent);
  border: 0;
  margin: 0;
}

/* Visually hidden (a11y) */
.am-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 1px, 1px, 0);
  white-space: nowrap; border: 0;
}

/* Focus visible */
.am-page :focus-visible,
.am-focus-visible:focus-visible {
  outline: 2px solid var(--am-accent);
  outline-offset: 3px;
}

/* Glass surface utility */
.am-glass {
  background: var(--am-surface-glass);
  border: 1px solid var(--am-border);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}

/* Warm glow utility (for "light turns on" effect) */
.am-glow {
  box-shadow: var(--am-glow);
}

/* Price formatting */
.am-price {
  font-family: var(--am-font-body);
  font-weight: var(--am-weight-semibold);
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  color: var(--am-text);
  white-space: nowrap;
}
.am-price__old {
  font-size: 0.95rem;
  font-weight: var(--am-weight-regular);
  color: var(--am-text-dim);
  text-decoration: line-through;
  margin-right: 10px;
}
.am-price__current { color: var(--am-text); }
.am-price--accent .am-price__current { color: var(--am-accent-2); }

/* Responsive helpers */
@media (max-width: 767px) {
  :root { --am-gutter: 16px; }
}