/* ==========================================================================
   refresh.css — подключается ПОСЛЕ styles.css и pastel.css
   1. Тема: системная / светлая / тёмная
   2. Чёткие иконки (целые размеры, постоянная толщина линий)
   3. Главный экран с фото Регистана (день / ночь)
   4. Адаптивность под телефоны
   ========================================================================== */

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* --------------------------------------------------------------------------
   2. Иконки
   -------------------------------------------------------------------------- */
svg { shape-rendering: geometricPrecision; }

/* линейные иконки: линия всегда ровно 2 экранных пикселя, любой размер */
svg[fill="none"] { stroke-width: 2px; overflow: visible; }
svg[fill="none"] :is(path, circle, rect, line, polyline, polygon, ellipse) {
  vector-effect: non-scaling-stroke;
}

/* фирменные значки WhatsApp / Telegram — заливкой, без обводки */
.ic-brand { fill: currentColor !important; stroke: none !important; }
.ic-brand--tg { color: #229ED9; }
.ic-brand--wa { color: #25D366; }
.btn-wa .ic-brand--wa,
.mobile-bar .mb-wa .ic-brand--wa { color: #fff; }

/* целые размеры вместо 17.3 / 17.7 / 19.7 / 20.6 / 22.9 / 25.6 px */
.ic { width: 20px; height: 20px; flex: none; }
.ic-lg { width: 24px; height: 24px; }
.btn svg,
.header-icon-btn svg,
.header-cabinet-link svg,
.burger-btn svg,
.icon-btn svg,
.fc-icon svg,
.pill-dot svg,
.cta-arrow,
.svc-chev svg,
.svc-shot-icon,
.ring-ic { width: 20px; height: 20px; flex: none; }
.lang-chevron { width: 16px; height: 16px; flex: none; }
.contact-card-icon svg { width: 24px; height: 24px; flex: none; }
.partner-ico { width: 28px; height: 28px; flex: none; }

/* плитки под иконки — тоже целые размеры */
.fc-icon { width: 36px; height: 36px; border-radius: 10px; }

/* кнопки-иконки в шапке: крупная зона нажатия */
.header-icon-btn,
.burger-btn,
.header-cabinet-link {
  width: 44px;
  height: 44px;
  min-width: 44px;
}
.header-icon-btn { border-radius: 12px; }
.header-icon-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.header-icon-btn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

/* видимый фокус с клавиатуры */
:where(a, button, input, textarea, select, [role="radio"], summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   1. Меню темы
   -------------------------------------------------------------------------- */
.pal-menu {
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 28px 60px -18px rgba(8, 16, 36, 0.45);
  overscroll-behavior: contain;
}
:root[data-theme="dark"] .pal-menu {
  background: var(--bg-elevated, #121D33);
  border-color: rgba(148, 163, 184, 0.22);
}
.pal-h {
  margin: 4px 4px 10px;
  font: 700 12px/1.2 var(--font-display, inherit);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-muted);
}
.pal-menu .pal-h:not(:first-child) { margin-top: 18px; }

/* переключатель режима: Системная / Светлая / Тёмная */
.theme-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: var(--bg-alt);
}
.theme-seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 68px;
  padding: 10px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font: 600 13px/1.1 var(--font-body, inherit);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.theme-seg-btn .ic { width: 24px; height: 24px; }
.theme-seg-btn:hover { color: var(--text-primary); background: color-mix(in srgb, var(--bg-surface) 70%, transparent); }
.theme-seg-btn.is-on {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(10, 20, 40, 0.12), 0 0 0 2px var(--accent);
}
:root[data-theme="dark"] .theme-seg-btn.is-on { background: var(--bg-dark-elevated, #121D33); }
.theme-hint {
  margin: 10px 4px 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
}
.theme-hint b { color: var(--text-primary); font-weight: 700; }

/* палитры */
.pal-list { display: grid; gap: 2px; }
.pal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
}
.pal-row:hover { background: var(--bg-alt); }
.pal-row.is-on { background: color-mix(in srgb, var(--accent) 10%, var(--bg-surface)); }
.pal-dots { padding-left: 6px; flex: none; }
.pal-dots i { width: 20px; height: 20px; box-shadow: 0 0 0 2px var(--bg-surface); }
.pal-name { font-size: 14px; font-weight: 600; }
.pal-check { width: 20px; height: 20px; margin-left: auto; color: var(--accent); }

@media (max-width: 480px) {
  .pal-menu { padding: 12px; border-radius: 18px; }
  .theme-seg-btn { min-height: 72px; font-size: 13px; }
}

/* кнопки выбора темы в панели настроек (если открыта) */
.theme-swatch-system {
  background: linear-gradient(90deg, #FFFFFF 0 50%, #0B1426 50% 100%);
}

/* --------------------------------------------------------------------------
   3. Главный экран: фото Регистана
   -------------------------------------------------------------------------- */
.hero-section::before { background-position: center 58%; transform: none; }

:root[data-theme="light"] .hero-section::after {
  background:
    linear-gradient(90deg, rgba(244, 248, 255, 0.94) 0%, rgba(244, 248, 255, 0.80) 30%, rgba(244, 248, 255, 0.28) 52%, rgba(244, 248, 255, 0) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.40) 0%, rgba(255, 255, 255, 0) 20%, rgba(244, 247, 252, 0) 78%, var(--bg-canvas) 100%);
}
:root[data-theme="dark"] .hero-section::after {
  background:
    linear-gradient(90deg, rgba(5, 10, 26, 0.90) 0%, rgba(6, 13, 32, 0.74) 30%, rgba(8, 18, 44, 0.20) 54%, rgba(10, 24, 56, 0) 74%),
    linear-gradient(180deg, rgba(6, 12, 30, 0.55) 0%, rgba(6, 12, 30, 0) 22%, rgba(6, 12, 30, 0) 76%, var(--bg-canvas) 100%);
}

/* --------------------------------------------------------------------------
   4. Телефоны и планшеты
   -------------------------------------------------------------------------- */
@media (max-width: 800px) {
  /* фото прижато к низу, сверху плавно уходит в фон — текст лежит на чистом небе */
  .hero-section::before {
    background-size: 100% auto;
    background-position: center bottom;
    background-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(180deg, transparent calc(100% - 125vw), #000 calc(100% - 92vw));
            mask-image: linear-gradient(180deg, transparent calc(100% - 125vw), #000 calc(100% - 92vw));
  }
  :root[data-theme="light"] .hero-section::before { background-image: url("../images/hero-day-m.webp"); }
  :root[data-theme="dark"] .hero-section::before { background-image: url("../images/hero-night-m.webp"); }

  :root[data-theme="light"] .hero-section::after {
    background: linear-gradient(180deg, rgba(244, 248, 255, 0.92) 0%, rgba(244, 248, 255, 0.78) 46%, rgba(244, 248, 255, 0) 64%);
  }
  :root[data-theme="dark"] .hero-section::after {
    background: linear-gradient(180deg, rgba(6, 12, 30, 0.55) 0%, rgba(6, 12, 30, 0.25) 46%, rgba(6, 12, 30, 0) 64%);
  }

  /* карточки с цифрами: компактнее, текст не вылезает за края */
  .hero-proof-bar { gap: 8px; padding-top: 16px; }
  .hero-proof-bar .proof-card { padding: 12px 12px 13px; min-width: 0; }
  .hero-proof-bar .proof-item-value {
    font-size: clamp(15px, 4.5vw, 22px);
    line-height: 1.2;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .hero-proof-bar .proof-item-label { font-size: 12.5px; line-height: 1.35; }
}

/* нижняя панель «Позвонить / WhatsApp / Telegram» не должна закрывать контент */
@media (max-width: 767px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .mobile-bar .btn { min-height: 52px; }
  .mobile-bar .btn svg { width: 22px; height: 22px; }
  .mobile-bar { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* --------------------------------------------------------------------------
   Зоны нажатия не меньше 44 px (телефоны и планшеты)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px), (pointer: coarse) {
  li > a[href*="google.com/maps"],
  .footer-policy,
  .text-link.svc-more,
  .footer-links a,
  .site-footer a:not(.btn):not(.footer-brand) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .consent-row { align-items: flex-start; gap: 12px; }
  .consent-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--accent);
  }
  .consent-row label { cursor: pointer; padding-block: 2px; }
}

@media (max-width: 1024px), (pointer: coarse) {
  .breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }
  .text-link:not(p .text-link):not(li .text-link) { display: inline-flex; align-items: center; min-height: 44px; }
  .filter-tab { min-height: 44px; }
  .btn { min-height: 48px; }
  .offer-domain, p.offer-domain { font-size: 12px !important; }
}

/* --------------------------------------------------------------------------
   Навбар: исправление поломки шапки
   1. «Кабинет» больше не зажат в квадрат 44×44 (текст вылезал наружу)
   2. Сетка шапки не требует симметричных колонок — не переполняется
   3. На ширине 981–1279 px кнопка «Кабинет» — иконка, «Обсудить задачу» скрыта
   -------------------------------------------------------------------------- */
.header-cabinet-link { width: auto; min-width: 44px; }

@media (min-width: 981px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .header-inner .main-nav {
    justify-self: center;
    min-width: 0;
  }
  .header-actions { flex-wrap: nowrap; }
}

@media (min-width: 981px) and (max-width: 1279px) {
  .header-cabinet-link {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .header-cabinet-link span { display: none; }
  .header-cta { display: none; }
  .main-nav { gap: 20px; }
}

/* --------------------------------------------------------------------------
   Главный экран: текст по центру
   -------------------------------------------------------------------------- */
.hero-content {
  margin-inline: auto;
  align-items: center;
  text-align: center;
}
.hero-meta { justify-content: center; }
.hero-title .hero-h1-top { justify-content: center; }
.hero-lead { margin-inline: auto; }
.hero-actions { justify-content: center; }

/* затемнение/осветление фона теперь по центру, а не слева — текст остаётся читаемым */
@media (min-width: 801px) {
  :root[data-theme="light"] .hero-section::after {
    background:
      linear-gradient(90deg, rgba(244, 248, 255, 0.55) 0%, rgba(244, 248, 255, 0.84) 28%, rgba(244, 248, 255, 0.84) 72%, rgba(244, 248, 255, 0.55) 100%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.40) 0%, rgba(255, 255, 255, 0) 20%, rgba(244, 247, 252, 0) 78%, var(--bg-canvas) 100%);
  }
  :root[data-theme="dark"] .hero-section::after {
    background:
      linear-gradient(90deg, rgba(5, 10, 26, 0.55) 0%, rgba(6, 13, 32, 0.80) 28%, rgba(6, 13, 32, 0.80) 72%, rgba(5, 10, 26, 0.55) 100%),
      linear-gradient(180deg, rgba(6, 12, 30, 0.55) 0%, rgba(6, 12, 30, 0) 22%, rgba(6, 12, 30, 0) 76%, var(--bg-canvas) 100%);
  }
}
