/* ==========================================================================
 * global.css — Mobile-first reset, base styles, .container, .section, .btn
 * ==========================================================================
 * Базовая стратегия: mobile-first. Базовые стили описывают дефолт
 * (≤575px), а бóльшие экраны переопределяются через min-width media.
 * Дизайн-токены — в variables.css, .container/.section/.btn — здесь.
 *
 * Гайдлайн: см. GLOBAL-STYLES-GUIDE.md.
 * ========================================================================== */

/* ===== Global Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Отключаем синюю подсветку тапов на iOS. */
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  /* Stable scrollbar gutter: предотвращает дёргание при появлении/исчезновении модалок. */
  scrollbar-gutter: stable;
  /* iOS safe-area — резервируем запас под notch и home indicator. */
  scroll-padding-top: env(safe-area-inset-top);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: var(--lh-base);
  color: var(--black);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Учёт safe-area на iOS: */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  /* Глобальный минимум ширины экрана: 360px. Меньше — лендинг
     не поддерживается (на совсем маленьких экранах верстка может
     ломаться, появляется горизонтальный скролл). Через min-width
     с overflow-x: hidden создаётся боковая "подложка", а
     контент центрируется. */
  min-width: 360px;
}

/* ===== Base Elements ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

ul, ol {
  list-style: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: transparent;
}

/* ===== Typography (fluid scale) ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-heading);
  line-height: var(--lh-heading);
  color: var(--black);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: clamp(16px, 0.95rem + 0.1vw, 18px); }
h6 { font-size: clamp(15px, 0.85rem + 0.1vw, 16px); }

p { font-size: var(--fs-base); }

/* Длина строки: 60–75 символов для текстовых блоков. */
p, .text-block { max-width: 65ch; }

a { font-size: inherit; }

small, .text-small { font-size: var(--fs-small); }

/* ===== Layout Primitives ===== */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section {
  padding-block: var(--section-padding-y);
  padding-inline: var(--container-padding);
  position: relative;
}

.section--teal {
  background: var(--primary-teal);
  color: var(--white);
}

.section--light-teal {
  background: var(--light-teal-2);
}

/* Скрытие оригинальной .float-cart-иконки (старая, статичная). */
.float-cart[hidden],
.float-cart[style*="display: none"] {
  display: none !important;
}

/* ===== Buttons (с учётом touch-targets) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: var(--fs-btn);
  padding: 14px 24px;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-align: center;
  /* Touch-target: гарантируем минимум 44px высоты. */
  min-height: var(--touch-min);
  user-select: none;
  -webkit-user-select: none;
  /* Сжимаем :active эффект для мобильных тапов. */
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent-red);
  color: var(--white);
}
.btn--primary:hover {
  background: var(--dark-red);
}

.btn--dark {
  background: var(--black);
  color: var(--white);
}
.btn--dark:hover {
  background: #333;
}

.btn--outline {
  background: transparent;
  border: 2px solid var(--white);
  color: var(--white);
}
.btn--outline:hover {
  background: var(--white);
  color: var(--primary-teal);
}

/* Тот же паттерн, но для секций со светлым фоном (.btn--outline рассчитан
   на тёмный/цветной фон — белый текст на белом был бы невидим). */
.btn--outline-dark {
  background: transparent;
  border: 2px solid var(--primary-teal);
  color: var(--primary-teal);
}
.btn--outline-dark:hover {
  background: var(--primary-teal);
  color: var(--white);
}

.btn--block {
  width: 100%;
  height: 50px;
  font-size: 16px;
}

.btn--lg {
  height: 56px;
  font-size: 15px;
  padding: 0 32px;
}

.btn--sm {
  height: 36px;
  font-size: 13px;
  padding: 0 16px;
}

/* ===== Focus visible (a11y) ===== */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Utility ===== */
.text-red  { color: var(--accent-red); }
.text-teal { color: var(--primary-teal); }
.text-center { text-align: center; }

.mb-30 { margin-bottom: 30px; }
.mb-50 { margin-bottom: 50px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Red divider (attached to bottom of .description). */
.divider-red {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--accent-red);
  width: 100%;
}

/* ==========================================================================
 * MOBILE-FIRST MEDIA QUERIES
 * База = стили без @media (mobile, ≤575px).
 * ========================================================================== */

/* === sm (≥576px) === */
@media (min-width: 576px) {
  .container { max-width: 540px; }
}

/* === md (≥768px) === */
@media (min-width: 768px) {
  .container { max-width: 720px; }
  h1 { letter-spacing: 0.01em; }
}

/* === lg (≥992px) === */
@media (min-width: 992px) {
  .container { max-width: 960px; }
  .section { padding-block: 100px; }
}

/* === xl (≥1200px) === */
@media (min-width: 1200px) {
  .container { max-width: var(--container-max); padding-inline: 40px; }
  .section { padding-inline: 0; }
}

/* ==========================================================================
 * ACCESSIBILITY MEDIA QUERIES
 * ========================================================================== */

/* Reduced motion: отключаем анимации и плавный скролл. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode (опционально — раскомментируйте, если нужен). */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --white: #1A1A1A;
    --black: #F5F5F5;
    --gray-text: #BBBBBB;
    --light-gray: #2A2A2A;
    --shadow-card:  0 4px 20px rgba(0, 0, 0, 0.4);
  }
}
*/