/* ═══════════════════════════════════════════════════
   MELS TRAVEL — SITE STYLES v2.0
   Обновлено под Design System v3.0
   Исправлены конфликты с приложением /app
═══════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────
   01. DESIGN TOKENS (единый источник правды)
──────────────────────────────────────────────── */

:root {
  color-scheme: light;

  /* ФОНЫ */
  --bg-main: #F7F5F2;
  --bg-light: #F0F4F8;
  --bg-dark: #0D1B2A;
  --bg-card: #FFFFFF;
  --bg-dark-card: #162232;

  /* ТЕКСТ */
  --text-primary: #1E1E1E;
  --text-secondary: #515762;
  --text-muted: #8C919C;
  --text-hint: #B8BCC5;
  --text-on-dark: #FFFFFF;
  --text-on-dark-2: #94A3B8;
  --text-on-dark-3: #4A6380;

  /* БРЕНД #2DB7E8 */
  --brand: #2DB7E8;
  --brand-hover-lt: #1A9EC8;    /* hover на светлом */
  --brand-active-lt: #0E8CB4;   /* active на светлом */
  --brand-hover-dk: #45C5EE;    /* hover на тёмном */
  --brand-active-dk: #5CD0F4;   /* active на тёмном */
  --brand-text: #0A2540;        /* текст НА кнопке (9.4:1 контраст) */
  --brand-pale: #E6F7FD;
  --brand-light: #B8E5F6;
  --brand-dark: #0A7AA3;
  --brand-darkest: #065070;

  /* АКЦЕНТ #FF5A36 */
  --accent: #FF5A36;
  --accent-hover: #E84520;
  --accent-active: #CC3A18;
  --accent-pale: #FFF0EC;
  --accent-light: #FFBB9D;
  --accent-dark: #CC3A18;

  /* НЕЙТРАЛЬНЫЕ */
  --n-900: #1E1E1E;
  --n-800: #2D3340;
  --n-700: #3E4756;
  --n-600: #515762;
  --n-500: #6B7280;
  --n-400: #8C919C;
  --n-300: #B8BCC5;
  --n-200: #D5D8DF;
  --n-150: #E3E6EC;
  --n-100: #EFF1F5;
  --n-50: #F7F8FA;

  /* СЕМАНТИКА */
  --success: #0F7A4A;   --success-bg: #E6F5EF;
  --warning: #A86000;   --warning-bg: #FEF2D6;
  --error: #C41A1A;     --error-bg: #FDEAEA;

  /* ШРИФТ */
  --font: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* АДАПТИВНАЯ ТИПОГРАФИКА */
  --fs-xs:   clamp(11px, .75vw, 12px);
  --fs-sm:   clamp(12px, .9vw, 14px);
  --fs-base: clamp(14px, 1vw, 16px);
  --fs-lg:   clamp(16px, 1.25vw, 20px);
  --fs-xl:   clamp(20px, 1.9vw, 26px);
  --fs-2xl:  clamp(24px, 3vw, 34px);
  --fs-3xl:  clamp(30px, 4.6vw, 48px);
  --fs-4xl:  clamp(36px, 6vw, 56px);

  --lh-tight: 1.1;
  --lh-snug: 1.25;
  --lh: 1.6;
  --lh-loose: 1.65;

  /* ОТСТУПЫ */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px;
  --s-6:24px; --s-8:32px; --s-10:40px; --s-12:48px; --s-16:64px; --s-20:80px;

  /* СКРУГЛЕНИЯ */
  --r-xs:3px; --r-sm:6px; --r-md:8px; --r-lg:12px;
  --r-xl:16px; --r-2xl:24px; --r-full:9999px;

  /* ТЕНИ */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 12px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.11);
  --shadow-brand: 0 6px 20px rgba(45,183,232,.22);
  --shadow-accent: 0 6px 20px rgba(255,90,54,.22);

  --container-max: 1200px;
  --container-pad: clamp(16px, 3vw, 32px);
}

/* ────────────────────────────────────────────────
   02. SAFE BASE
──────────────────────────────────────────────── */

html {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-main);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-bottom: 0 !important; /* Тильда не должна добавлять отступ */
  background: var(--bg-main) !important;
  color: var(--text-primary);
  font-size: 15px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

img, svg, video { max-width: 100%; }
img { display: block; }
a { color: inherit; }

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

.section { padding: var(--s-12) 0; }
.section.soft { background: var(--bg-light); }
.muted { color: var(--text-secondary); }
.nowrap { white-space: nowrap; }

/* ────────────────────────────────────────────────
   03. TYPOGRAPHY
──────────────────────────────────────────────── */

h1, h2, h3 {
  margin: 0 0 var(--s-4);
  color: var(--text-primary);
  letter-spacing: -.01em;
  line-height: var(--lh-tight);
}

h1 { font-size: var(--fs-4xl); font-weight: 900; }
h2 { font-size: var(--fs-3xl); font-weight: 800; }
h3 { font-size: var(--fs-2xl); font-weight: 700; }

h4 {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

p, li { font-size: var(--fs-base); line-height: var(--lh-loose); }
p { margin: 0 0 var(--s-4); }

.eyebrow {
  display: inline-block;
  margin-bottom: var(--s-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--brand-dark);
  font-weight: 800;
}

/* ────────────────────────────────────────────────
   04. BUTTONS
   ВАЖНО: кнопки в приложении /app изолированы через #app-wrapper
   Эти стили работают только на основном сайте
──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .1px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .14s, color .14s, border-color .14s, transform .1s;
}
.btn:active { transform: scale(.97); }

/* Brand (основная кнопка) */
.btn.primary, .btn-brand, a.btn.primary, a.btn-brand {
  background: var(--brand);
  color: var(--brand-text) !important;
  border-color: var(--brand);
  box-shadow: var(--shadow-brand);
}
.btn.primary:hover, .btn-brand:hover, a.btn.primary:hover, a.btn-brand:hover {
  background: var(--brand-hover-lt);
  border-color: var(--brand-hover-lt);
}

/* Accent (главная CTA) */
.btn.accent, .btn-accent, a.btn.accent, a.btn-accent {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.btn.accent:hover, .btn-accent:hover, a.btn.accent:hover, a.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Ghost */
.btn.ghost, .btn-ghost, a.btn.ghost, a.btn-ghost {
  background: transparent;
  color: var(--text-secondary) !important;
  border-color: var(--n-200);
}
.btn.ghost:hover, .btn-ghost:hover, a.btn.ghost:hover, a.btn-ghost:hover {
  background: var(--n-100);
  color: var(--text-primary) !important;
  border-color: var(--n-300);
}

/* Outline */
.btn.outline, .btn-outline-brand, a.btn.outline, a.btn-outline-brand {
  background: transparent;
  color: var(--brand-dark) !important;
  border-color: var(--brand);
}
.btn.outline:hover, .btn-outline-brand:hover, a.btn.outline:hover, a.btn-outline-brand:hover {
  background: var(--brand-pale);
  color: var(--brand-darkest) !important;
}

/* Dark */
.btn.dark, .btn-dark, a.btn.dark, a.btn-dark {
  background: var(--text-primary);
  color: #fff !important;
  border-color: var(--text-primary);
}
.btn.dark:hover, .btn-dark:hover, a.btn.dark:hover, a.btn-dark:hover {
  background: var(--n-800);
  border-color: var(--n-800);
}

/* Secondary */
.btn.secondary, .btn-secondary, a.btn.secondary, a.btn-secondary {
  background: var(--brand-pale);
  color: var(--brand-darkest) !important;
  border-color: var(--brand-pale);
}
.btn.secondary:hover, .btn-secondary:hover, a.btn.secondary:hover, a.btn-secondary:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
}

/* Модификаторы */
.btn-pill { border-radius: var(--r-full) !important; }
.btn-xl { min-height: 48px; padding: 0 28px; border-radius: var(--r-lg); font-size: 15px; }
.btn-lg { min-height: 42px; padding: 0 22px; border-radius: var(--r-md); font-size: 14px; }
.btn-md { min-height: 36px; padding: 0 17px; border-radius: var(--r-md); font-size: 13px; }
.btn-sm { min-height: 30px; padding: 0 13px; border-radius: var(--r-sm); font-size: 12px; }

/* OTP кнопка */
.ButtonOtp {
  width: 275px; height: 56px; border: none;
  border-radius: var(--r-full);
  background: var(--brand); color: var(--brand-text);
  font-family: var(--font); font-size: 15px; font-weight: 800;
  text-transform: uppercase; cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: background-color .14s, transform .1s;
}
.ButtonOtp:hover { background: var(--brand-hover-lt); }
.ButtonOtp:active { transform: scale(.97); }

/* ────────────────────────────────────────────────
   05. HERO
──────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: clamp(56px, 12vw, 140px) 0;
  isolation: isolate;
  overflow: hidden;
}

.hero .bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1000px 520px at 82% -12%, rgba(45,183,232,.24), transparent 62%),
    linear-gradient(180deg, rgba(45,183,232,.10), transparent 45%);
}

.hero h1 { max-width: 16ch; }
.hero p { max-width: 56ch; margin: var(--s-4) 0 var(--s-6); color: var(--text-secondary); }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-media img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 45%;
  filter: saturate(1.05) contrast(1.02);
}

/* ────────────────────────────────────────────────
   06. GRID / CARDS
──────────────────────────────────────────────── */

.grid { display: grid; gap: clamp(16px, 2.2vw, 28px); }

@media (min-width: 720px)  { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px)  { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--n-150);
  border-radius: var(--r-xl);
  padding: clamp(16px, 2.4vw, 24px);
  box-shadow: var(--shadow-md);
}

.card-dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  border-radius: var(--r-xl);
  padding: clamp(18px, 2.6vw, 28px);
}

.card h4 { margin: 0 0 var(--s-2); }

.kpi { display: flex; align-items: center; gap: 12px; }
.kpi .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }

.thumb {
  position: relative; overflow: hidden; border-radius: var(--r-xl);
  aspect-ratio: 3/2;
  background: linear-gradient(135deg, var(--brand-pale), #fff);
  border: 1px dashed var(--n-150);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* ────────────────────────────────────────────────
   07. LISTS / PILLS / BADGES
   ВАЖНО: .badge НЕ применяется внутри .phone (приложение)
──────────────────────────────────────────────── */

.list { display: grid; gap: 10px; margin: 0; padding: 0; }
.list li { list-style: none; position: relative; padding-left: 26px; }
.list li::before {
  content: ""; position: absolute;
  left: 0; top: .6em;
  width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand);
}

.pills { display: flex; flex-wrap: wrap; gap: 10px; }

.pill, .badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  font-weight: 700; line-height: 1.2;
}

.pill {
  padding: 8px 14px; font-size: var(--fs-sm);
  background: var(--brand-pale);
  border: 1px solid var(--brand-light);
  color: var(--brand-darkest);
}

/* Глобальный .badge — только вне .phone */
:not(.phone) > .badge {
  gap: 4px; padding: 3px 9px; font-size: 11px;
  background: var(--brand-pale);
  color: var(--brand-darkest);
}

.badge-hot, .badge-accent { background: var(--accent); color: #fff; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* ────────────────────────────────────────────────
   08. FAQ
──────────────────────────────────────────────── */

details {
  border: 1px solid var(--n-150);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  background: var(--bg-card);
}
details + details { margin-top: 12px; }
details[open] { box-shadow: var(--shadow-md); }

summary {
  cursor: pointer; font-weight: 700;
  font-size: var(--fs-base);
  list-style: none; display: flex; align-items: center; outline: none;
}
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
summary::before {
  content: "▾"; margin-right: 8px;
  font-size: 18px; line-height: 1;
  color: var(--brand-dark);
  transform: rotate(-90deg); transform-origin: center;
  transition: transform .28s ease;
}
details[open] summary::before { transform: rotate(0deg); }

.faq-content {
  margin-top: 8px; overflow: hidden;
  max-height: 0; opacity: 0; transform: translateY(-4px);
  transition: max-height .28s ease, opacity .28s ease, transform .28s ease;
}
details[open] .faq-content { max-height: 420px; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .faq-content { transition: none !important; } }
summary:focus-visible, details:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ────────────────────────────────────────────────
   09. SECTION HEAD
   ПЕРЕИМЕНОВАНО из .section-head чтобы не конфликтовать с приложением
   В Тильде используйте класс .site-section-head
──────────────────────────────────────────────── */

.site-section-head {   /* ← ПЕРЕИМЕНОВАНО! было .section-head */
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: var(--s-6);
}
.site-section-head p { margin: 0; color: var(--text-secondary); }

/* Обратная совместимость — старый класс тоже работает вне .phone */
:not(.phone) > .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: var(--s-6);
}

/* ────────────────────────────────────────────────
   10. CONTACT BAR
   ВАЖНО: на странице /app отключить через body.page-app .contact-bar { display:none }
──────────────────────────────────────────────── */

.contact-bar {
  position: sticky; bottom: 12px;
  display: flex; justify-content: center;
  padding: 0 var(--container-pad);
  z-index: 50;
}

/* Скрываем contact-bar на странице приложения */
body.page-app .contact-bar { display: none !important; }

.contact-bar .inner {
  background: var(--bg-card);
  border: 1px solid var(--n-150);
  border-radius: var(--r-full);
  padding: 8px;
  display: flex; justify-content: center; align-items: center; gap: 8px;
  box-shadow: var(--shadow-md);
}

.contact-bar .btn { background: transparent; border-color: var(--brand); color: var(--brand-dark) !important; box-shadow: none; }
.contact-bar .btn.primary { background: var(--brand); color: var(--brand-text) !important; box-shadow: var(--shadow-brand); }
.contact-bar .inner .btn:hover { background: var(--brand); color: var(--brand-text) !important; box-shadow: var(--shadow-brand); }

/* ────────────────────────────────────────────────
   11. FOOTER CTA
──────────────────────────────────────────────── */

.footer-cta { text-align: center; padding: var(--s-16) 0 var(--s-12); }

/* ────────────────────────────────────────────────
   12. MOBILE
──────────────────────────────────────────────── */

@media (max-width: 767px) {
  body { padding-bottom: 0 !important; }
  h1 { font-size: clamp(32px, 10vw, 40px); }
  h2 { font-size: clamp(22px, 7vw, 28px); }
  .section { padding: var(--s-10) 0; }
  .hero { padding: var(--s-16) 0 var(--s-12); }
  .hero .cta { flex-direction: column; }
  .site-section-head { flex-direction: column; align-items: stretch; gap: var(--s-4); }
  .site-section-head .btn, .section .btn { display: flex; width: 100%; justify-content: center; }

  .contact-bar {
    position: static;
    padding: 0 var(--container-pad);
    margin: var(--s-6) 0 var(--s-8);
  }
  .contact-bar .inner {
    width: 100%; padding: 0; background: transparent;
    border: none; box-shadow: none;
    border-radius: var(--r-xl);
    flex-direction: column; align-items: stretch; gap: 12px;
  }
  .contact-bar .btn {
    width: 100%; justify-content: center;
    padding-inline: 16px; font-size: var(--fs-sm);
  }
  .ButtonOtp { width: 100%; max-width: 275px; }
  .t-btn { display: block; text-align: center; width: 100% !important; max-width: 100% !important; }
}
