/* =====================================================================
   MOBILE.CSS — адаптация под телефоны и мелкая полировка визуала.
   Подключается ПОСЛЕДНИМ (index.html и barber.html), поэтому только
   уточняет существующие стили и не меняет дизайн на компьютере.
   Чтобы откатить — достаточно убрать <link ... mobile.css> из HTML.
   ===================================================================== */

/* ---------- Общая полировка (все экраны, без смены дизайна) ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
/* Якоря из меню не прячутся под липкой шапкой */
section[id] { scroll-margin-top: 72px; }

/* Аккуратный фокус для клавиатуры (мышью не виден) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(160, 55, 75, 0.9);
  outline-offset: 3px;
}

/* Кнопки — мягкое нажатие */
.header-btn:active,
.assist-btn:active,
body .submit-btn:active,
body .time-slot:active {
  transform: scale(0.97);
}

/* Ссылки в контактах — в цвет сайта, а не синие по умолчанию */
.contact-main a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(160, 55, 75, 0.45);
  padding-bottom: 2px;
  transition: border-color .2s ease, color .2s ease;
}
.contact-main a:hover { color: #a0374b; border-color: #a0374b; }
.contact-item { transition: transform .2s ease; }
.contact-item:hover .contact-icon { transform: translateY(-2px); }
.contact-icon { transition: transform .2s ease; }

/* Строки цен — лёгкая подсветка при наведении */
.price-row { transition: background-color .2s ease; }
.price-row:hover { background-color: rgba(240, 232, 219, 0.035); }

/* Кнопка «Записаться в Telegram» — как ссылка-кнопка */
a.assist-btn { color: #2a2623; }

/* Баннер cookies не должен перекрывать окно записи */
body .cookie-wrapper { z-index: 9000; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* =====================================================================
   ГЛАВНАЯ — ТЕЛЕФОНЫ И ПЛАНШЕТЫ
   ===================================================================== */
@media (max-width: 768px) {

  /* --- Шапка --- */
  .header-inner {
    padding: 8px 14px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    min-height: 56px;
    gap: 8px;
  }
  .logo { font-size: 15px; letter-spacing: 0.12em; }
  .header-btn,
  .header-booking-btn,
  .barber-login-link {
    padding: 9px 13px;
    font-size: 11px;
    letter-spacing: 0.1em;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  }
  /* Кнопка «барбер» — второстепенная, делаем её спокойнее */
  .barber-login-link {
    background: transparent;
    color: #a0374b;
    border: 1.5px solid rgba(160, 55, 75, 0.55);
    box-shadow: none;
  }
  .header-inner > .header-booking-btn { margin-left: auto; }

  /* --- Первый экран --- */
  .hero-name { padding-bottom: 14px; letter-spacing: 0.04em; }
  .hero-butt {
    min-height: 48px;
    padding: 13px 30px;
    background: rgba(160, 55, 75, 0.35);
  }

  /* --- О нас --- */
  .slide2 {
    min-height: auto;
    padding: 44px 20px;
  }
  .media-img {
    max-height: none;
    aspect-ratio: 4 / 3;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  }
  .media-text h2 { font-size: 30px; margin: 22px 0 10px; }
  .media-text p { font-size: 16px; line-height: 1.6; margin: 0 0 12px; }

  /* --- Команда: фото сверху, текст под ним (раньше текст сжимался в узкую колонку) --- */
  .team {
    min-height: auto;
    padding: 48px 20px 56px;
  }
  .team-title { margin: 0 0 30px; font-size: 30px; }
  .team-grid { gap: 36px; max-width: 460px; }
  .team-card {
    display: block;
    text-align: center;
  }
  .team-card img {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 4 / 5;
    margin: 0 auto 16px;
    display: block;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
  .team-card:nth-child(even) img,
  .team-card:nth-child(even) h3,
  .team-card:nth-child(even) p { order: 0; }
  .team-card h3 { font-size: 19px; margin: 0 0 10px; }
  .team-card p {
    font-size: 15px;
    line-height: 1.55;
    max-width: 34ch;
    margin: 0 auto;
  }

  /* --- Галерея --- */
  .gallery {
    min-height: auto;
    padding: 48px 0 40px;
  }
  .gallery-title { font-size: 30px; margin-bottom: 8px; padding: 0 20px; }
  .gallery-grid { gap: 14px; padding-left: 20px; padding-right: 20px; scroll-padding: 0 20px; }
  .gallery-img { border-radius: 16px; }
  .gallery-cap { font-size: 14px; }

  /* --- Цены --- */
  .prices {
    min-height: auto;
    padding: 48px 20px;
  }
  .prices-title { font-size: 30px; }
  .prices-grid { gap: 26px; }
  .price-row { padding: 13px 0; align-items: baseline; }
  .service-name { font-size: 14px; letter-spacing: 0.04em; }
  .service-price { font-size: 14px; }
  /* Подсказка «цены по барберам» открывается по тапу и не вылезает за экран */
  .tooltip,
  .tooltip-wide {
    left: 0;
    right: 0;
    min-width: 0;
    max-width: none;
    font-size: 14px;
  }
  .prices-title.has-tooltip .tooltip {
    left: 0;
    right: 0;
    transform: translateY(-100%);
    font-size: 13px;
    letter-spacing: 0.04em;
  }
  .prices-title.has-tooltip:hover .tooltip { transform: translateY(-108%); }

  /* --- Запись --- */
  .assist { padding: 44px 20px 12px; }
  .assist-card { padding: 24px 18px; border-radius: 20px; }
  .assist-title { font-size: 22px; }
  .assist-actions {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0;
  }
  .assist-actions > *,
  .assist-actions .assist-btn {
    width: 100%;
    text-align: center;
  }
  .assist-btn {
    min-height: 48px;
    font-size: 13px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* --- Контакты: аккуратная сетка 2×2 --- */
  .contacts { padding: 40px 20px 48px; }
  .contacts-title { font-size: 30px; text-align: center; }
  .contacts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 14px;
    align-items: start;
  }
  .contact-icon { width: 54px; height: 54px; border-radius: 16px; }
  .contact-main {
    font-size: 13px;
    letter-spacing: 0.06em;
    overflow-wrap: anywhere;
  }

  /* --- Подвал --- */
  .footer {
    padding: 22px 18px;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
  .footer-sub { line-height: 1.6; }

  /* --- Баннер cookies: компактная плашка внизу, без огромных картинок --- */
  body .cookie-wrapper {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    max-width: 420px;
  }
  body .cookie-container { padding: 16px 18px; border-radius: 20px; border-width: 2px; }
  body .cookie-img-character,
  body .cookie-img-product { display: none; }
  body .cookie-title { font-size: 18px; margin-bottom: 4px; }
  body .cookie-text { font-size: 12px; margin-bottom: 12px; max-width: none; }
  body .cookie-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    max-width: none;
    gap: 8px;
  }
  body .btn-cookie { flex: 1 1 0; padding: 11px 10px; font-size: 13px; }
  body .btn-more { flex: 1 0 100%; margin-top: 0; }
  body .cookie-modal-content { padding: 26px 20px; border-radius: 24px; width: 92%; }

  /* --- Окно записи --- */
  body .booking-overlay { align-items: flex-end; }
  body .booking-window {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body .b-header { border-radius: 22px 22px 0 0; padding: 18px 16px 12px; }
  body .b-header h2 { font-size: 20px; margin-bottom: 12px; padding-right: 36px; }
  body .close-x {
    top: 10px; right: 10px;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    color: #F4EBDC;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
  }
  body .barber-list { gap: 14px; padding-bottom: 6px; scrollbar-width: none; }
  body .b-content { padding: 14px 16px; gap: 14px; }
  body .booking-window .calendar-grid { gap: 4px; }
  body .cal-day {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 15px;
  }
  body .calendar-nav-btn { min-width: 40px; min-height: 36px; }
  body .time-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: none; }
  body .time-slot { min-height: 44px; font-size: 15px; padding: 8px; font-family: 'Alegreya SC', serif; }
  body .b-footer { padding: 0 16px 18px; }
  /* 16px — иначе iPhone приближает страницу при вводе */
  body .b-input,
  body select.b-input { font-size: 16px; padding: 12px 16px; }
  body .submit-btn { width: 100%; min-height: 52px; padding: 14px 20px; }
  body .success-window { padding: 30px 20px; }
  body .success-window h2 { font-size: 30px; }

  /* --- Окно входа барбера --- */
  body .login-card { padding: 34px 20px; border-radius: 28px; }
  body .login-input { font-size: 16px; padding: 15px 22px; }
}

@media (max-width: 380px) {
  .logo { font-size: 13px; letter-spacing: 0.08em; }
  .header-btn,
  .header-booking-btn,
  .barber-login-link { padding: 8px 10px; font-size: 10px; }
  .hero-name { font-size: 32px; }
  body .time-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================
   КАБИНЕТ БАРБЕРА (barber.html) — ТЕЛЕФОНЫ
   ===================================================================== */
@media (max-width: 650px) {
  .barber-body { background: var(--white, #fff); }

  /* Кабинет на весь экран вместо «карточки» с полями */
  .barber-app {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    box-shadow: none;
    grid-template-columns: 56px 1fr;
  }
  .barber-side {
    padding: 10px 0;
    padding-top: max(10px, env(safe-area-inset-top));
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
  }
  .barber-side__btn { width: 42px; height: 42px; }
  .barber-top { padding: 0 12px; }

  /* Календарь помещается в ширину экрана — без горизонтальной прокрутки */
  #calendar-grid,
  .calendar-grid {
    min-width: 0 !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
  .barber-card,
  .schedule,
  .schedule-calendar { min-width: 0; max-width: 100%; }
  .calendar-day,
  .calendar-day-header { min-width: 0; }
  .calendar-header { flex-wrap: wrap; gap: 8px; padding: 8px 0 !important; }
  .calendar-scroll-container { overflow-x: visible !important; }
  .calendar-day {
    min-height: 52px;
    padding: 3px;
    align-items: center;
  }
  .calendar-day-header { padding: 6px 0; font-size: 11px; }
  .calendar-day-number { font-size: 14px; }
  .info-badge { font-size: 9px; padding: 1px 3px; min-width: 16px; }
  .day-info-wrapper { gap: 2px; align-items: center; }

  /* Окно дня — на весь экран */
  .time-picker-modal { align-items: flex-end; }
  .time-picker-modal .time-picker-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 18px 18px 0 0 !important;
    padding: 0 !important;
    overflow-y: auto;
  }
  .time-picker-modal .schedule-section { padding: 16px !important; }
  .time-picker-modal input { font-size: 16px !important; }

  /* Уведомления и модалки кабинета */
  .notification-content { width: calc(100% - 32px); }
  .modal-content { width: calc(100% - 24px) !important; max-width: none; }
  .modal-content input,
  .modal-content select { font-size: 16px; }
}

/* =====================================================================
   ШРИФТЫ И НАВИГАЦИЯ (все экраны)
   Alegreya SC — фирменные заголовки, меню, кнопки и цены.
   Alegreya Sans — из той же семьи шрифтов, для обычного текста: читается
   легче, чем капитель, особенно на телефоне.
   ===================================================================== */
:root {
  --font-text: "Alegreya Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
.hero-notice1, .hero-notice2, .hero-notice3,
.media-text p,
.team-card-text p,
.tooltip, .tooltip-wide,
.gallery-cap,
.footer-sub {
  font-family: var(--font-text);
}
.media-text p, .team-card-text p { font-size: 17px; line-height: 1.6; letter-spacing: 0; }
.hero-notice1, .hero-notice2, .hero-notice3 { font-size: 18px; letter-spacing: .01em; }
/* В описании мастеров сохраняем переносы строк из текста */
.team-card-text p { white-space: pre-line; }

/* Поля формы записи — обычным шрифтом, чтобы имя и телефон было легко читать */
body .b-input, body .booking-overlay select { font-family: var(--font-text); font-weight: 700; letter-spacing: .02em; }

@media (max-width: 910px) {
  /* Меню разделов не пропадает на телефоне: второй строкой, листается пальцем */
  .header-inner { flex-wrap: wrap; row-gap: 0; }
  .header .nav {
    display: flex;
    order: 3;
    flex: 1 0 100%;
    gap: 6px;
    margin: 0 -14px;
    padding: 2px 14px 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .header .nav::-webkit-scrollbar { display: none; }
  .header .nav-link {
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(42, 38, 35, .18);
    font-size: 12.5px;
    letter-spacing: .08em;
    opacity: 1;
  }
  .header .nav-link::after { display: none; }
  .header .nav-link:active { background: rgba(160, 55, 75, .1); }
  section[id] { scroll-margin-top: 112px; }
}

@media (max-width: 768px) {
  .media-text p, .team-card-text p { font-size: 16.5px; }
  .hero-notice1, .hero-notice2, .hero-notice3 { font-size: 16.5px; }
}

@media (max-width: 480px) {
  /* шапка растёт по содержимому (раньше была 40px и меню вылезало на фото) */
  .header { height: auto; padding: 0; }
  .header-inner { gap: 6px; padding-top: 6px; }
  .logo { font-size: 14px; letter-spacing: .1em; }
  .header-btn, .header-booking-btn, .barber-login-link { padding: 8px 11px; }
}
@media (max-width: 360px) {
  .logo { font-size: 12.5px; letter-spacing: .06em; }
}
