/* =============================================
   A CASU AD CASUM — базовые стили
   Шапка, подвал, переменные, сброс
   ============================================= */

:root {
  --color-bg: #FFFFFF;
  --color-white: #FFFFFF;
  --color-heading: #111827;
  --color-text: #2C3036;
  --color-text-muted: #4B5563;
  --color-label: #0F5A47;
  --color-nav: #111827;
  --color-nav-menu: #111827;
  --color-logo: #111111;
  --color-accent: #0F5A47;
  --color-olive: #0F5A47;
  --color-nav-hover: #0F5A47;
  --color-accent-hover: #0A4234;
  --color-accent-light: #E8F2EF;
  --color-gold: #0F5A47;
  --color-accent-rgb: 15, 90, 71;
  --color-border: #E5E7EB;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Montserrat', 'Inter', system-ui, sans-serif;
  --font-logo: 'Cinzel', 'Playfair Display', 'Cormorant Garamond', Georgia, serif;

  --container-max: 1200px;
  --container-padding-x: 20px;
  --header-max: 1200px;
  --header-height: 84px;
  --content-nav-strip-height: 42px;
  --transition: 0.2s ease;
  --transition-social: all 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  background-color: var(--color-bg);
  font-family: var(--font-body);
  color: var(--color-text);
  overflow-x: clip;
  max-width: 100%;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: lining-nums;
}

img,
video,
canvas {
  max-width: 100%;
  height: auto;
}

iframe,
embed,
object {
  max-width: 100%;
}

a {
  overflow-wrap: anywhere;
}

.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  width: max-content;
  max-width: none;
}

h1, h2, h3 {
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-stretch: normal;
  letter-spacing: -0.02em;
}

p, li, dd, blockquote,
.description,
.kb-description {
  color: var(--color-text);
}

[class*="__eyebrow"],
.hero-subtitle {
  color: var(--color-accent);
  font-weight: 600;
}

a {
  color: inherit;
}

/* ---- Заголовки страниц ---- */

.page-title {
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 600;
  font-stretch: normal;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 16px;
}

.page-title--lg {
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ---- ШАПКА ---- */

.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-container {
  padding-top: 16px;
  padding-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.site-logo {
  grid-column: 1;
  justify-self: start;
  font-family: var(--font-logo);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-logo);
  text-decoration: none;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  margin-left: 0;
  flex-shrink: 0;
  transition: opacity var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-logo:hover {
  opacity: 0.75;
}

.site-logo .line-2 {
  padding-left: 24px;
}

/* Гамбургер */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-white);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.nav-toggle:hover {
  border-color: var(--color-accent);
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-nav);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-overlay {
  display: none;
}

/* Панель: на десктопе «растворяется» в сетку из 3 зон */
.header-panel {
  display: contents;
}

.header-nav {
  grid-column: 2;
  justify-self: center;
}

.header-contacts {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 50px;
  padding-left: 50px;
  margin-right: 0;
  padding-right: 0;
}

.header-phone {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-nav-menu);
  text-decoration: none;
  white-space: nowrap;
  margin-left: 8px;
  transition: color 0.25s ease;
}

.header-phone:hover {
  color: var(--color-nav-hover);
}

.header-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  color: var(--color-white);
  background: var(--color-olive);
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition-social);
}

.header-social--whatsapp:hover,
.header-social--instagram:hover {
  background: var(--color-accent-hover);
  color: var(--color-white);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  list-style: none;
  margin: 0 auto;
}

.nav-item {
  position: relative;
}

.nav-link {
  position: relative;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-nav-menu);
  text-decoration: none;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.25s ease-in-out, transform 0.25s ease-in-out;
  white-space: nowrap;
  transform: none;
}

.nav-link:hover {
  color: var(--color-nav-hover);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--color-nav-hover);
  transform: none;
}

.nav-link-text {
  position: relative;
  display: inline-block;
}

.nav-link.active .nav-link-text::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--color-nav-hover);
  border-radius: 1px;
}

.nav-link.active:hover {
  transform: none;
}

.nav-link--toggle::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 0;
  margin-top: 1px;
  flex-shrink: 0;
  opacity: 0.45;
  transform: rotate(0deg);
  transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out;
}

.nav-item.has-dropdown:hover > .nav-link--toggle::after,
.nav-item.has-dropdown:focus-within > .nav-link--toggle::after,
.nav-item.is-open > .nav-link--toggle::after {
  opacity: 0.85;
  transform: rotate(180deg);
}

.nav-item.has-dropdown:hover > .nav-link--toggle:not(.active),
.nav-item.has-dropdown:focus-within > .nav-link--toggle:not(.active) {
  color: var(--color-nav-hover);
  transform: translateY(-1px);
}

.nav-item.is-open > .nav-link--toggle:not(.active) {
  color: var(--color-nav-hover);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-width: 360px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-white);
  border: 1px solid rgba(var(--color-accent-rgb), 0.1);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  list-style: none;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.32s ease,
    visibility 0.32s ease,
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.32s ease;
  z-index: 100;
}

.nav-item.has-dropdown:hover .dropdown-menu,
.nav-item.has-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  box-shadow: 0 20px 56px rgba(17, 24, 39, 0.1);
}

.dropdown-link {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.45;
  transition: background var(--transition), color var(--transition);
}

.dropdown-link:hover {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

/* Отступ под фиксированную шапку */
.page-content {
  margin-top: var(--header-height);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

/* Если page-класс стоит на том же элементе — сохраняем боковые отступы контейнера */
.container[class*="-page"],
.container.kb-hub,
.container.services-hub,
.container.service-landing,
.container.dev-page {
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

/* ---- ПОДВАЛ ---- */

.site-footer {
  background-color: #F8FAFC;
  color: var(--color-text-muted);
  padding: 32px 0 18px;
  border-top: 1px solid #E5E7EB;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  margin: 0;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--color-border);
}

.footer-col {
  min-width: 0;
  text-align: left;
}

.footer-col-1,
.footer-col:first-child {
  flex: 0 1 330px;
  max-width: 330px;
  margin: 0;
  padding: 0;
}

.footer-col-1 .footer-title {
  white-space: nowrap;
}

.footer-col-1 .footer-text {
  max-width: 330px;
  white-space: normal;
  overflow-wrap: break-word;
}

.footer-col:nth-child(2),
.footer-col:nth-child(3) {
  flex: 0 0 auto;
}

.footer-title {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.footer-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.footer-links {
  list-style: none;
}

.footer-links--nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 5px 30px;
}

.footer-links--nav li {
  margin-bottom: 0;
}

.footer-links li {
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--color-text-muted);
}

.footer-links li:last-child {
  margin-bottom: 0;
}

.footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-copy {
  line-height: 1.35;
}

.footer-legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer-legal a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition);
}

.footer-legal a:hover {
  color: var(--color-accent);
}

/* ---- Кнопка «Наверх» ---- */

.whatsapp-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 998;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0f5a47;
  color: #fff;
  box-shadow: 0 6px 18px rgba(15, 90, 71, 0.28);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float:hover {
  background: #0a4234;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 90, 71, 0.34);
}

.whatsapp-float:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.back-to-top {
  position: fixed;
  bottom: 84px;
  right: 20px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1.5px solid #0f5a47;
  border-radius: 50%;
  background: #fff;
  color: #0f5a47;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 90, 71, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease,
    background 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #0f5a47;
  color: #fff;
  box-shadow: 0 8px 22px rgba(15, 90, 71, 0.34);
  transform: translateY(-2px) scale(1.06);
}

.back-to-top.is-visible:hover {
  transform: translateY(-2px) scale(1.06);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ---- АДАПТИВ ---- */

@media (max-width: 1320px) {
  .main-nav {
    gap: 18px;
  }

  .nav-link {
    font-size: 15px;
  }

  .header-contacts {
    margin-left: 40px;
    padding-left: 40px;
  }
}

@media (max-width: 1280px) {
  .main-nav {
    gap: 16px;
  }

  .nav-link {
    font-size: 14px;
  }

  .header-contacts {
    margin-left: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 1200px) {
  .main-nav {
    gap: 20px;
  }

  .nav-link {
    font-size: 14px;
  }

  .header-phone {
    font-size: 14px;
  }

  .header-social {
    width: 36px;
    height: 36px;
  }

  .header-social svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 1100px) {
  .header-phone {
    display: none;
  }
}

@media (max-width: 992px) {
  .site-logo {
    margin-left: 0;
  }

  .header-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .header-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    grid-column: unset;
  }

  .header-nav {
    grid-column: unset;
    justify-self: stretch;
    width: 100%;
  }

  .header-contacts {
    grid-column: unset;
    justify-self: stretch;
    margin-left: 0;
    margin-right: 0;
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 9998;
  }

  body.nav-open .nav-overlay {
    opacity: 1;
    visibility: visible;
  }

  .nav-wrapper,
  .header-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: min(360px, 100%);
    max-width: 100vw;
    height: calc(100vh - var(--header-height));
    background: var(--color-white);
    border-left: 1px solid var(--color-border);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
    overflow-y: auto;
    z-index: 9999;
    gap: 0;
  }

  body.nav-open .nav-wrapper,
  body.nav-open .header-panel {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 0 24px;
  }

  .nav-item {
    border-bottom: 1px solid var(--color-border);
  }

  .nav-link,
  .nav-link--toggle {
    width: 100%;
    justify-content: space-between;
    padding: 16px 24px;
    white-space: normal;
    text-align: left;
  }

  .nav-link-text {
    flex: 0 1 auto;
  }

  .dropdown-menu {
    position: static;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .nav-item.has-dropdown.is-open .dropdown-menu {
    display: block;
  }

  .nav-item.has-dropdown:hover .dropdown-menu {
    display: none;
  }

  .nav-item.has-dropdown.is-open:hover .dropdown-menu {
    display: block;
  }

  .dropdown-link {
    padding: 12px 24px 12px 36px;
    font-size: 14px;
  }

  .header-contacts {
    margin-top: auto;
    padding: 20px 24px 28px;
    border-top: 1px solid var(--color-border);
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-phone {
    display: block;
    width: 100%;
    font-size: 16px;
    margin-left: 0;
  }

  .page-content {
    margin-top: var(--header-height);
  }
}

@media (max-width: 992px) {
  .footer-container {
    flex-direction: column;
    gap: 18px;
  }

  .footer-col-1 {
    flex: none;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .footer-col-1 .footer-title {
    white-space: normal;
  }

  .footer-col-1 .footer-text {
    max-width: none;
  }
}

@media (max-width: 768px) {
  :root {
    --container-padding-x: 16px;
  }

  .header-container {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .footer-container {
    gap: 16px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .back-to-top {
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
  }

  .whatsapp-float {
    width: 48px;
    height: 48px;
  }

  .hero-btn,
  .partners-hero__btn,
  .service-accordion__btn,
  .case-docs-cta__btn,
  .case-cta__btn,
  .ld-cta__btn,
  .dev-page__btn,
  .contacts-card__btn,
  .template-doc__btn,
  .article-sidebar-cta__btn,
  .article-paywall__btn {
    min-height: 44px;
  }
}

@media (max-width: 992px) {
  body.nav-open .whatsapp-float,
  body.nav-open .back-to-top,
  body.nav-open .content-nav-strip {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

/* Согласие под кнопками заявок */
.form-consent {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.form-consent a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
