/* ==========================================================
   Барбершоп Прайм — стили
   Разделы: 1. Переменные  2. Основа  3. Кнопки  4. Шапка
            5. Главный экран  6. Секции  7. Цены и калькулятор
            8. Преимущества  9. Контакты  10. Мобильная версия
   ========================================================== */

/* 1. Переменные: цвета и шрифты меняются в одном месте */
:root {
  --ink: #1b3157;      /* тёмно-синий фон */
  --ink-2: #254377;    /* чуть светлее для карточек */
  --steel: #f3f7fc;    /* светлый фон секций */
  --red: #e8404c;
  --blue: #3d78d6;
  --brass: #e8b960;    /* золотистый акцент */
  --white: #ffffff;
  --muted: #dbe4f0;    /* приглушённый текст на тёмном */
  --muted-dark: #50617a;

  --font-head: 'Unbounded', 'Arial Black', Arial, sans-serif;
  --font-body: 'Manrope', 'Segoe UI', Arial, sans-serif;
}

/* 2. Основа */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;  /* телефон не увеличивает текст сам */
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

a { color: inherit; -webkit-tap-highlight-color: transparent; }

body { overflow-x: hidden; }  /* страница не должна прокручиваться вбок */

/* Контейнер, ограничивает ширину содержимого */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-left, 0px)) 0 max(24px, env(safe-area-inset-right, 0px));
}

/* Видимая обводка при навигации с клавиатуры */
:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 3px;
}

h2 {
  font-family: var(--font-head);
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.1;
  margin: 0 0 40px;
  letter-spacing: -0.01em;
}

/* 3. Кнопки */
.btn {
  display: inline-block;
  padding: 14px 26px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  transition: transform 0.15s, background 0.15s;
}
@media (hover: hover) {
  .btn:hover { background: #cf2f3b; transform: translateY(-2px); }
}
.btn:active { background: #cf2f3b; }

.btn-ghost {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
@media (hover: hover) {
  .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
}

.btn-small { padding: 10px 20px; font-size: 15px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* 4. Шапка (только текст, без значка) */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand small {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--brass);
  letter-spacing: 0.04em;
}

/* 5. Главный экран */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 56px 0 88px;
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(28px, 7vw, 78px);
  overflow-wrap: break-word;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.lead {
  max-width: 30em;
  margin: 0 0 32px;
  font-size: 19px;
  color: var(--muted);
}

/* Машинка для стрижки: качается и вибрирует, волосы разлетаются */
.clipper-wrap {
  display: flex;
  justify-content: center;
  padding: 24px 0;
  /* мягкое золотистое свечение за машинкой */
  background: radial-gradient(circle at 50% 55%, rgba(232, 185, 96, 0.28), transparent 62%);
}

.clipper-svg {
  width: min(310px, 50vw);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.35));
}

/* Плавное движение «слева направо», как будто стрижёт */
.clipper {
  transform-origin: 150px 480px;
  animation: sweep 3.2s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { transform: translateX(-16px) rotate(-5deg); }
  50%      { transform: translateX(16px)  rotate(5deg); }
}

/* Лёгкая вибрация корпуса */
.clipper-body-motion { animation: buzz 0.08s steps(2) infinite; }
@keyframes buzz {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(0.8px, -0.6px); }
}

/* Зубья ножа быстро ходят туда-сюда */
.teeth { animation: teeth 0.12s steps(2) infinite; }
@keyframes teeth {
  0%   { transform: translateX(0); }
  100% { transform: translateX(3px); }
}

/* Надписи на корпусе */
.logo-main { font-family: var(--font-head); font-weight: 700; font-size: 30px; fill: var(--brass); letter-spacing: 0.04em; }
.logo-sub  { font-family: var(--font-body); font-weight: 700; font-size: 11px; fill: var(--white); letter-spacing: 0.3em; }

/* Волосы: вылетают вверх и в стороны, затем падают и исчезают.
   Траектория каждой пряди задаётся переменными --dx, --up, --fall, --rot в index.html */
.hair {
  fill: none;
  stroke-width: 4.5;
  stroke-linecap: round;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: fly 1.8s ease-out infinite;
}
.hair-a { stroke: #e9b87c; }
.hair-b { stroke: #c98d57; }
.hair-c { stroke: #f6dcb4; }

@keyframes fly {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  10%  { opacity: 1; }
  45%  { opacity: 1; transform: translate(calc(var(--dx) * 0.6), var(--up)) rotate(calc(var(--rot) * 0.5)); }
  100% { opacity: 0; transform: translate(var(--dx), var(--fall)) rotate(var(--rot)); }
}

/* 6. Секции */
.section { padding: 80px 0; }
.section-light { background: var(--steel); color: var(--ink); }
.section-dark { background: var(--ink-2); }

/* 7. Цены */
.prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.price {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 36px 32px;
  background: var(--white);
  border-left: 10px solid var(--red);
  border-radius: 22px;
}
.price-blue { border-left-color: var(--blue); }
.price h3 { margin: 0; font-size: 22px; }
.price p { margin: 0; color: var(--muted-dark); }

.sum {
  margin-top: 18px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(44px, 6vw, 64px);
  line-height: 1;
}
.sum span { margin-left: 6px; font-size: 0.4em; color: var(--muted-dark); }

/* Калькулятор */
.calc {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 24px;
  padding: 28px 32px;
  background: var(--ink);
  color: var(--white);
  border-radius: 22px;
}
.calc h3 { margin: 0 0 4px; font-size: 20px; }
.calc p { margin: 0; color: var(--muted); font-size: 15px; }

.calc-row { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }

.counter { display: flex; align-items: center; gap: 12px; }
.counter button {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: var(--white);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.counter button:hover { background: rgba(255, 255, 255, 0.12); }
.counter output { min-width: 24px; text-align: center; font-size: 22px; font-weight: 700; }

.calc-total { font-size: 15px; color: var(--muted); }
.calc-total strong {
  display: block;
  font-family: var(--font-head);
  font-size: 28px;
  color: var(--brass);
}

/* 8. Преимущества */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.feature { padding-top: 20px; border-top: 4px solid var(--brass); }
.feature h3 { margin: 0 0 8px; font-size: 20px; }
.feature p { margin: 0; color: var(--muted); }

/* 9. Контакты */
.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.contact dl { margin: 0 0 32px; }
.contact dt { margin-top: 20px; font-size: 14px; font-weight: 700; color: var(--brass); }
.contact dd { margin: 2px 0 0; font-size: 21px; overflow-wrap: anywhere; }

.copy {
  margin-left: 10px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.copy:hover { background: rgba(255, 255, 255, 0.1); }

.book {
  padding: 36px;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
}
.book h3 { margin: 0 0 12px; font-family: var(--font-head); font-size: 24px; }
.book p { margin: 0 0 24px; color: var(--muted); }

.stripe {
  height: 10px;
  margin-bottom: 28px;
  border-radius: 5px;
  background: repeating-linear-gradient(
    135deg,
    var(--red) 0 14px, var(--white) 14px 28px,
    var(--blue) 28px 42px, var(--white) 42px 56px
  );
}

.footer {
  padding: 32px 0 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #b9c6da;
  font-size: 14px;
  text-align: center;
}

/* Плавающая кнопка звонка: видна только на телефонах */
.call-fab { display: none; }

/* 10. Мобильная версия */
@media (max-width: 860px) {
  .calc { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .hero, .contact, .prices, .features { grid-template-columns: 1fr; }
  .hero { padding: 24px 0 56px; }
  .clipper-wrap { order: -1; }
  .clipper-svg { width: 160px; }
  .section { padding: 56px 0; }
  .brand { font-size: 14px; }
  .calc { grid-template-columns: 1fr; }

  .call-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 10;
    display: block;
    padding: 14px 22px;
    background: var(--brass);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
  .footer { padding-bottom: 90px; }
}

/* Узкие телефоны (до 480px) */
@media (max-width: 480px) {
  .wrap { padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
  .header { gap: 12px; }
  .brand { font-size: 13px; }
  .lead { font-size: 17px; }

  /* Кнопки на всю ширину — удобно нажимать большим пальцем */
  .actions .btn { flex: 1 1 100%; text-align: center; }

  .price { padding: 28px 22px; }
  .calc { padding: 24px 20px; }
  .book { padding: 26px 20px; }

  /* Кнопки «+» и «−» не меньше 44px — рекомендованный размер для касания */
  .counter button { width: 48px; height: 48px; }

  .copy { margin: 8px 0 0; padding: 8px 14px; }
  h2 { margin-bottom: 28px; }
}

/* Уважаем настройку «уменьшить анимацию» */
@media (prefers-reduced-motion: reduce) {
  .clipper, .clipper-body-motion, .teeth, .hair { animation: none; }
  .btn { transition: none; }
}
