/* ============================================================
   MELIORIX SYSTEMS — main.css
   Design system, layout, components, animations
   ============================================================ */

/* ---------- Variables ---------- */
:root {
  --bg-deep:      #050D1A;
  --bg-card:      #0A1628;
  --bg-surface:   #0F1E35;
  --accent-blue:  #00AAFF;
  --accent-green: #39FF14;
  --text-primary: #E8F0FF;
  --text-muted:   #6B82A8;
  --border:       rgba(0, 170, 255, 0.15);

  /* unified glass card system */
  --glass:        rgba(13, 27, 48, 0.55);
  --hairline:     rgba(120, 180, 255, 0.14);

  --font-display: 'Montserrat', sans-serif;
  --font-body:    'Montserrat', sans-serif;

  --maxw: 1200px;
  --section-pad: 90px;      /* единый вертикальный отступ блока: 90px сверху и снизу */
  --nav-h: 88px;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; }
h1 { font-size: 64px; }
h2 { font-size: 42px; }
h3 { font-size: 24px; font-weight: 600; }

.section-title {
  text-align: center;
  margin-bottom: 16px;
}
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 56px;
  font-size: 18px;
}
.accent { color: var(--accent-green); }
.accent-blue { color: var(--accent-blue); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { padding: var(--section-pad) 0; position: relative; }
.bg-surface { background: var(--bg-surface); }

/* ---------- Единый вертикальный ритм блока ----------
   От края секции до первого и последнего текста/графики — ровно
   --section-pad (90px). Крайние элементы не добавляют своих отступов. */
section > :first-child,
section > .container > :first-child { margin-top: 0; }
section > :last-child,
section > .container > :last-child { margin-bottom: 0; }

/* Обёртки без фона и рамки съедают часть отступа своим внутренним
   padding — компенсируем, чтобы до контента оставалось ровно 90px. */
section > .adv-grid:last-child,
section > .container > .adv-grid:last-child { margin-bottom: -8px; }   /* .adv { padding: 8px } */

section > .reviews-marquee:last-child,
section > .container > .reviews-marquee:last-child { margin-bottom: -16px; } /* .reviews-track { padding: 16px 12px } */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-green);
  color: #03260a;
  box-shadow: 0 0 0 rgba(57,255,20,0);
}
.btn-primary:hover {
  box-shadow: 0 0 24px rgba(57,255,20,0.45);
  transform: translateY(-2px);
}
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--accent-blue);
}
.btn-outline:hover {
  box-shadow: 0 0 24px rgba(0,170,255,0.4);
  background: rgba(0,170,255,0.08);
  transform: translateY(-2px);
}
.btn-lg { padding: 18px 40px; font-size: 17px; }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(5,13,26,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
/* Страницы с подменю: шапка непрозрачна всегда — под ней двухуровневый хедер,
   и контент не должен просвечивать сквозь верхний ярус ни на каком скролле */
body:has(.subnav) .navbar {
  background: rgba(5,13,26,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
body:has(.subnav) .navbar,
body:has(.subnav) .navbar.scrolled { border-bottom-color: transparent; }

.navbar .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.logo { display: flex; flex-direction: column; line-height: 1; flex-shrink: 0; }
.logo .logo-main {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
}
.logo .logo-main .dot { color: var(--accent-green); }
.logo .logo-sub {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-links { display: flex; align-items: center; gap: 32px; flex-shrink: 0; }
.nav-links > li { flex-shrink: 0; }
.nav-links > li > a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s;
  position: relative;
  padding: 8px 0;
  white-space: nowrap;
}
.nav-links > li > a:hover { color: var(--accent-blue); }

/* Dropdown */
.has-dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: 6px; }
.dropdown-toggle .chev { transition: transform 0.3s; }
.has-dropdown:hover .dropdown-toggle .chev { transform: rotate(180deg); }
.dropdown {
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 260px;
  background: rgba(10,22,40,0.97);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.has-dropdown:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(8px);
}
.dropdown a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}
.dropdown a:hover { background: rgba(0,170,255,0.1); color: var(--accent-blue); }
.dropdown a svg { color: var(--accent-blue); flex-shrink: 0; }

/* Lang switcher */
.lang-switch { display: flex; align-items: center; gap: 4px; }
.lang-switch a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.lang-switch a:hover { color: var(--text-primary); }
.lang-switch a.active { color: var(--accent-green); }
.lang-sep { color: var(--border); }

.nav-right { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }
.lang-switch a, .lang-sep { white-space: nowrap; }

/* Hamburger */
.hamburger { display: none; flex-direction: column; gap: 5px; padding: 8px; z-index: 1100; }
.hamburger span {
  width: 24px; height: 2px; background: var(--text-primary);
  border-radius: 2px; transition: transform 0.3s var(--ease), opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--nav-h) + var(--section-pad));
  padding-bottom: var(--section-pad);
}
#particles {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero .container { position: relative; z-index: 2; text-align: center; }
.hero h1 {
  margin: 0 auto 24px;
  max-width: 900px;
  min-height: 1.1em;
}
.typewriter-cursor {
  display: inline-block;
  width: 3px;
  background: var(--accent-green);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: text-top;
  height: 0.9em;
}
.typewriter-cursor.hide { opacity: 0; animation: none; }
@keyframes blink { 50% { opacity: 0; } }

.hero-subtitle {
  font-size: 20px;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 40px;
  opacity: 0;
  transition: opacity 1s ease 0.3s;
}
.hero-subtitle.show { opacity: 1; }
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 1s ease 0.6s;
}
.hero-actions.show { opacity: 1; }

.scroll-indicator {
  position: absolute;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--text-muted);
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-12px); }
  60% { transform: translateX(-50%) translateY(-6px); }
}

/* ---------- Cards / Services grid ---------- */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 18%),
    var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 24px 50px -28px rgba(0,0,0,0.85);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}
/* gradient hairline border that brightens on hover */
.card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(0,170,255,0.55), transparent 40%, transparent 60%, rgba(57,255,20,0.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.card:hover::after { opacity: 1; }
.card:hover {
  border-color: transparent;
  transform: translateY(-6px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 30px 60px -26px rgba(0,170,255,0.45);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.service-card .icon-box {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(0,170,255,0.1);
  color: var(--accent-blue);
  margin-bottom: 20px;
  transition: background 0.4s, color 0.4s;
}
.service-card:hover .icon-box { background: rgba(57,255,20,0.12); color: var(--accent-green); }
.service-card h3 { margin-bottom: 12px; }
.service-card p { color: var(--text-muted); margin-bottom: 20px; }
.service-card .more-link {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.3s, color 0.3s;
}
.service-card:hover .more-link { color: var(--accent-green); gap: 12px; }

/* ---------- Numbers / Counters ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
.stat .num {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 700;
  color: var(--accent-green);
  line-height: 1;
}
.stat .label { color: var(--text-muted); margin-top: 12px; font-size: 16px; }

/* ---------- Advantages ---------- */
.adv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.adv .icon-lg {
  width: 64px; height: 64px;
  color: var(--accent-blue);
  margin-bottom: 24px;
}
.adv h3 { margin-bottom: 12px; }
.adv p { color: var(--text-muted); }

/* ---------- Testimonials ---------- */
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.review-card .stars { display: flex; gap: 4px; color: var(--accent-green); margin-bottom: 16px; }
.review-card .review-text { color: var(--text-primary); margin-bottom: 24px; font-size: 15px; }
.review-author { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #03260a;
  flex-shrink: 0;
}
.review-author .name { font-weight: 600; font-size: 15px; }
.review-author .role { color: var(--text-muted); font-size: 13px; }

/* ---------- CTA section ---------- */
.cta-final {
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-surface));
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-final h2 { margin-bottom: 16px; }
.cta-final p { color: var(--text-muted); font-size: 18px; max-width: 560px; margin: 0 auto 40px; }
.cta-deco {
  position: absolute;
  opacity: 0.15;
  color: var(--accent-blue);
  pointer-events: none;
}
.cta-deco.left { top: 20%; left: -40px; }
.cta-deco.right { bottom: 15%; right: -40px; }

/* ---------- Footer ---------- */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}
.footer-brand .logo { margin-bottom: 16px; }
.footer-brand p { color: var(--text-muted); font-size: 14px; max-width: 280px; }
.footer-col h4 { font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 18px; font-weight: 600; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { font-size: 14px; color: var(--text-primary); transition: color 0.2s; }
.footer-col ul li a:hover { color: var(--accent-blue); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Forms ---------- */
.contact-form { max-width: 560px; margin: 0 auto; text-align: left; }
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.form-row input:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,170,255,0.12);
}
.form-row input.error, .form-row textarea.error { border-color: #ff4d5e; box-shadow: 0 0 0 3px rgba(255,77,94,0.12); }
.form-success {
  display: none;
  text-align: center;
  padding: 32px;
  border: 1px solid rgba(57,255,20,0.4);
  border-radius: var(--radius);
  background: rgba(57,255,20,0.06);
  color: var(--accent-green);
  font-weight: 600;
  font-size: 18px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s, transform 0.5s;
}
.form-success.show { display: block; opacity: 1; transform: translateY(0); }

/* ---------- Liquid Glass submit (форма заявки) ---------- */
.contact-form button[type="submit"] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #05210a;
  background: linear-gradient(110deg, #2fb00a 0%, #39FF14 22%, #aeff7a 50%, #39FF14 78%, #2fb00a 100%);
  background-size: 240% 100%;
  animation: form-sweep 3.5s linear infinite;
  border: 1px solid rgba(180,255,140,0.7);
  box-shadow: inset 0 2px 1px rgba(255,255,255,0.85),
              inset 0 -3px 6px rgba(0,80,0,0.45),
              0 0 24px rgba(57,255,20,0.55),
              0 12px 30px rgba(57,255,20,0.4);
  transition: transform 0.3s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
@keyframes form-sweep { 0% { background-position: 0% 0; } 100% { background-position: 240% 0; } }
.contact-form button[type="submit"]::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 40%);
  pointer-events: none;
}
.contact-form button[type="submit"]::after {
  content: "";
  position: absolute; top: 0; left: -60%; z-index: -1;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.38), transparent);
  transform: skewX(-18deg);
  transition: left 0.7s var(--ease);
  pointer-events: none;
}
.contact-form button[type="submit"]:hover {
  transform: translateY(-2px);
  animation-duration: 1.6s;
  border-color: rgba(180,255,140,0.85);
  box-shadow: inset 0 2px 1px rgba(255,255,255,0.95),
              inset 0 -3px 6px rgba(0,80,0,0.5),
              0 0 38px rgba(57,255,20,0.85),
              0 18px 42px rgba(57,255,20,0.45);
}
.contact-form button[type="submit"]:hover::after { left: 120%; }
.contact-form button[type="submit"]:active { transform: translateY(0) scale(0.99); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Mobile nav panel ---------- */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: rgba(5,13,26,0.98);
  backdrop-filter: blur(20px);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease);
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav a { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.mobile-nav .mobile-services { display: flex; flex-direction: column; gap: 14px; text-align: center; }
.mobile-nav .mobile-services a { font-size: 18px; color: var(--text-muted); font-family: var(--font-body); }
.mobile-nav .lang-switch { margin-top: 16px; }

/* ============================================================
   Responsive
   ============================================================ */
/* Tablet range: keep the desktop nav on one line by tightening spacing */
@media (max-width: 1024px) and (min-width: 769px) {
  .navbar .container { gap: 16px; }
  .nav-links { gap: 22px; }
  .nav-links > li > a { font-size: 14px; }
  .nav-right { gap: 14px; }
  .lang-switch a { padding: 4px 5px; }
}

@media (max-width: 768px) {
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
  :root { --section-pad: 64px; }
  .hero-subtitle { font-size: 17px; }

  .nav-links, .nav-right .lang-switch { display: none; }
  .hamburger { display: flex; }

  .services-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 40px 24px; }
  .stat .num { font-size: 56px; }
  .adv-grid { grid-template-columns: 1fr; gap: 40px; }

  .reviews-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 85%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 16px;
    margin: 0 -24px;
    padding-left: 24px; padding-right: 24px;
  }
  .review-card { scroll-snap-align: start; }
  /* карусель отзывов: свой padding-bottom не должен добавляться к отступу блока */
  section > .container > .reviews-grid:last-child { margin-bottom: -16px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  h1 { font-size: 30px; }
  .stats-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; justify-content: center; }
  .hero-actions { flex-direction: column; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-subtitle, .hero-actions { opacity: 1; }
}
