:root {
  --blue-900: #0b3d66;
  --blue-700: #0e6ba8;
  --blue-500: #2196d4;
  --blue-300: #7fc4ea;
  --blue-100: #eaf6fc;
  --ink: #14212b;
  --muted: #55707e;
  --white: #ffffff;
  --danger: #c0392b;
  --success: #1f8a4c;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(11, 61, 102, 0.1);
  --container: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.55;
}

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

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border-bottom: 1px solid rgba(219, 232, 239, 0.85);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.site-header.scrolled {
  box-shadow: 0 4px 20px rgba(11, 61, 102, 0.12);
  border-bottom-color: rgba(219, 232, 239, 0.5);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--blue-900);
}

.brand img { width: 40px; height: 40px; border-radius: 50%; }

.main-nav {
  display: none;
  gap: 18px;
}

.main-nav a {
  position: relative;
  color: var(--ink);
  font-size: 0.95rem;
  white-space: nowrap;
  padding-bottom: 4px;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-700));
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-nav a:hover {
  text-decoration: none;
}
.main-nav a:hover::after {
  right: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #dbe8ef;
  border-radius: 10px;
  background: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
}

@media (min-width: 860px) {
  .main-nav { display: flex; }
  .nav-toggle { display: none; }
}

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 8px 20px 16px;
  background: rgba(234, 246, 252, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #e3edf3;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 10px 0;
  border-bottom: 1px solid rgba(219, 232, 239, 0.7);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50% 50% 50% 0;
  background: var(--blue-500);
  transform: rotate(45deg);
  flex: none;
}

/* На узких экранах живой backdrop-filter рядом с непрерывно анимированными
   пузырьками пересчитывается на каждый кадр и заметно грузит слабые телефоны —
   это и есть основная причина "тормозящего" бургер-меню. На мобильных заменяем
   блюр плотным полупрозрачным фоном без потери вида; на десктопе стекло остаётся. */
@media (max-width: 859px) {
  .site-header {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .mobile-nav {
    background: rgba(234, 246, 252, 0.97);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.15s ease;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

/* Ripple "круг по воде" при клике — см. app/static/js/ripple.js */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: btn-ripple-spread 0.6s ease-out forwards;
  pointer-events: none;
}
.btn-outline .btn-ripple { background: rgba(14, 107, 168, 0.25); }

@keyframes btn-ripple-spread {
  to { transform: scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-ripple { display: none; }
}

.btn-primary {
  background: var(--blue-700);
  color: var(--white);
}
.btn-primary:hover { background: var(--blue-900); }

.btn-outline {
  background: transparent;
  border-color: var(--blue-700);
  color: var(--blue-700);
}
.btn-outline:hover { background: var(--blue-100); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--blue-100) 0%, var(--white) 100%);
  padding: 40px 0 60px;
}

.hero .container {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 28px;
  align-items: center;
}

/* Плавающие пузырьки — чистый CSS (transform/opacity), без canvas/JS.
   Отрицательный animation-delay в разметке "домотан" в середину цикла —
   пузырьки видны сразу при загрузке, а не появляются с нуля через паузу. */
.hero-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

/* Sitewide-слой — плывёт поверх всей страницы независимо от скролла (position:fixed),
   чтобы водная тема была видна и ниже hero. Пузырьки мельче и бледнее — фон, не солист.
   z-index выше шапки (50), иначе пузырьки прячутся под её полупрозрачным стеклом и
   выглядят так, будто не долетают до верха — тут они проходят поверх, ниже чата (100). */
.site-bubbles {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}

.bubble {
  --peak-opacity: 0.9;
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(14, 107, 168, 0.45));
  border: 1px solid rgba(14, 107, 168, 0.35);
  box-shadow: 0 2px 6px rgba(11, 61, 102, 0.15);
  animation-name: bubble-rise;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
}

.site-bubbles .bubble {
  --peak-opacity: 0.32;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), rgba(14, 107, 168, 0.3));
  border: 1px solid rgba(14, 107, 168, 0.18);
  box-shadow: none;
}

@keyframes bubble-rise {
  0%   { transform: translateY(0); opacity: 0; }
  8%   { opacity: var(--peak-opacity); }
  80%  { opacity: calc(var(--peak-opacity) * 0.6); }
  100% { transform: translateY(-100vh); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; opacity: 0.25; }
  .site-bubbles { display: none; }
}

/* Волна на границе hero — та же графика, что в логотипе, декоративный переход к следующей секции. */
.hero-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  z-index: 1;
  line-height: 0;
}
.hero-wave svg { width: 100%; height: 50px; display: block; }

@media (min-width: 900px) {
  .hero .container { grid-template-columns: 1.1fr 0.9fr; }
}

.hero h1 {
  font-size: 2rem;
  line-height: 1.2;
  color: var(--blue-900);
  margin: 0 0 12px;
}

.hero p.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 20px;
}

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

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.badge {
  background: var(--white);
  border: 1px solid #dbe8ef;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--blue-900);
}

.hero-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Sections ---------- */

section { padding: 44px 0; }
section.alt { background: var(--blue-100); }

.section-title {
  font-size: 1.6rem;
  color: var(--blue-900);
  margin: 0 0 8px;
}

.section-subtitle {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 640px;
}

.grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--white);
  border: 1px solid #e3edf3;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card h3 { margin-top: 0; color: var(--blue-900); font-size: 1.1rem; }
.card p { color: var(--muted); margin-bottom: 0; }

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

/* ---------- Product / price ---------- */

.price-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--blue-900);
}

.price-note { color: var(--muted); font-size: 0.9rem; }

/* ---------- Zones ---------- */

.zone-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.zone-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid #e3edf3;
}
.zone-list .dot { width: 10px; height: 10px; border-radius: 50%; background: #cfd9de; flex: none; }
.zone-list li.active .dot { background: var(--success); }
.zone-list .status { margin-left: auto; font-size: 0.82rem; color: var(--muted); }

/* ---------- FAQ ---------- */

.faq-item {
  border-bottom: 1px solid #e3edf3;
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  color: var(--blue-900);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--blue-700); }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Forms ---------- */

.form-card {
  background: var(--white);
  border: 1px solid #e3edf3;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.form-row { margin-bottom: 14px; }

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue-900);
  margin-bottom: 6px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #cfe0e9;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(33, 150, 212, 0.15);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.checkbox-row input { margin-top: 3px; width: auto; }
.checkbox-row a { color: var(--blue-700); }

/* honeypot — скрыт визуально и от скринридеров, но остаётся в DOM/табах отключён */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-msg { margin-top: 14px; font-size: 0.9rem; display: none; }
.form-msg.show { display: block; }
.form-msg.success { color: var(--success); }
.form-msg.error { color: var(--danger); }

/* ---------- Phone placeholder ---------- */

.phone-cta {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
.phone-cta .placeholder-note {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  background: var(--blue-900);
  color: #cfe4f2;
  padding: 40px 0 24px;
  margin-top: 40px;
}

.footer-wave {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translateY(-99%);
  line-height: 0;
  pointer-events: none;
}
.footer-wave svg { width: 100%; height: 50px; display: block; }

.site-footer a { color: #eaf6fc; }

.footer-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

@media (min-width: 720px) {
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

.footer-grid h4 { color: var(--white); margin: 0 0 10px; font-size: 0.95rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 18px;
  font-size: 0.78rem;
  color: #9fc0d6;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 14px 0 0;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs .sep { margin: 0 6px; }

/* ---------- Chat widget ---------- */

#chat-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--blue-700);
  color: var(--white);
  border: none;
  box-shadow: 0 6px 20px rgba(11, 61, 102, 0.35);
  font-size: 1.5rem;
  cursor: pointer;
  animation: chat-launcher-bob 2.4s ease-in-out infinite;
}

/* Лёгкое покачивание, чтобы иконка ассистента привлекала взгляд, но не раздражала —
   останавливается, пока диалог открыт (см. .chat-open в chat.js), и уважает reduced-motion. */
@keyframes chat-launcher-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

#chat-launcher.chat-open {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #chat-launcher { animation: none; }
}

#chat-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 100;
  width: min(360px, calc(100vw - 36px));
  height: min(500px, calc(100vh - 140px));
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(11, 61, 102, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e3edf3;
}
#chat-panel.open { display: flex; }

/* На мобильных чат разворачивается на весь экран — так проще держать поле ввода
   и последнее сообщение над появляющейся клавиатурой (см. app/static/js/chat.js,
   который подгоняет высоту под window.visualViewport). */
@media (max-width: 640px) {
  #chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

.chat-header {
  background: var(--blue-700);
  color: var(--white);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.chat-header button {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7fbfd;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--blue-700);
  color: var(--white);
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid #e3edf3;
  border-bottom-left-radius: 3px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e3edf3;
  background: var(--white);
}
.chat-input-row textarea {
  flex: 1;
  min-height: 40px;
  max-height: 100px;
  resize: none;
}
.chat-input-row button {
  border: none;
  background: var(--blue-700);
  color: var(--white);
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
}

.chat-disabled-note {
  padding: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Placeholder note (для внутреннего использования, не для прода без наполнения) ---------- */
.placeholder-flag {
  display: inline-block;
  font-size: 0.72rem;
  color: #b06a00;
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
}

.page-hero {
  background: var(--blue-100);
  padding: 32px 0;
}
.page-hero h1 { color: var(--blue-900); margin: 8px 0 8px; font-size: 1.7rem; }
.page-hero p { color: var(--muted); margin: 0; max-width: 640px; }

table.simple-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
table.simple-table th, table.simple-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e3edf3;
  font-size: 0.9rem;
}
table.simple-table th { color: var(--blue-900); }

/* ---------- Scroll-reveal ---------- */
/* Прогрессивное усиление: без JS (.js на <html> не появится) секции видны как обычно.
   С JS — плавно проявляются при попадании во вьюпорт, см. app/static/js/reveal.js.
   Hero (первый экран) намеренно исключён — виден сразу, без зависимости от JS/скролла:
   контент над сгибом не должен ждать ни observer, ни чего-либо ещё. */
.js main section:not(.hero) {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js main section.in-view {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js main section:not(.hero) {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
