:root {
  --gap: 16px;
  --header-h: 60px;
}

* {
  box-sizing: border-box;
}

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

/* ==== HEADER ==== */
header.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 100% !important;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #eee;
}

/* Offset page content for fixed header */
body {
  padding-top: var(--header-h);
  min-width: 320px;
}

header.site-header > .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  width: 100%;
  padding: 0 50px;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* ==== LOGO ==== */
.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
  flex-shrink: 0;
}

.site-logo img,
.custom-logo {
  max-height: 36px;
  height: auto;
  width: auto;
  max-width: none;
  display: block;
  flex-shrink: 0; 
}

/* ==== CONTACT ==== */
.header-contact {
  display: none;
}

.header-contact__phone {
  display: inline;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #222;
  text-decoration: none;
  line-height: 1.2;
}

.header-contact__schedule {
  font-size: 0.75rem;
  color: #777;
  font-weight: 500;
  line-height: 1.2;
}

/* ==== BURGER / TOGGLE ==== */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  border: 0 !important;
  background: transparent !important;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 24px;
  height: 2px;
  background: #111;
}

/* ==== MOBILE NAV ==== */
.site-nav {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border-bottom: 1px solid #eee;
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s linear 0.25s;
  z-index: 900;
}

.site-nav.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition-delay: 0s, 0s, 0s;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
}

.menu li {
  position: relative;
}

.menu a {
  display: block;
  padding: 12px var(--gap);
  color: #222;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.menu a:hover {
  color: #0066ff;
  background-color: rgba(0, 102, 255, 0.06);
  border-radius: 6px;
}

.menu li.current-menu-item > a {
  color: #0066ff;
  background-color: rgba(0, 102, 255, 0.08);
  border-radius: 6px;
  font-weight: 700;
}

/* ==== SUBMENUS ==== */
.menu > li > .sub-menu,
.menu .sub-menu .sub-menu {
  position: absolute;
  list-style: none;
  margin: 0;
  padding: 6px 0;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #eee;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease 0.5s, transform 0.25s ease 0.5s, visibility 0s linear 0.75s;
  z-index: 1100;
}

.menu > li > .sub-menu {
  top: 100%;
  left: 0;
  min-width: 220px;
}

.menu .sub-menu .sub-menu {
  top: 0;
  left: calc(100% - 2px);
  min-width: 220px;
}

.menu .sub-menu li a {
  padding: 10px 16px;
  font-size: 0.95rem;
  color: #333;
}

.menu .sub-menu li a:hover {
  background: #f6f9ff;
  color: #0066ff;
}

/* ==== DESKTOP ==== */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: var(--gap);
  }

  header.site-header > .container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  .site-nav {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    border: 0;
    justify-self: center;
  }

  .menu {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 0;
  }

  .menu > li > a {
    padding: 8px 12px;
	  font-size: 20px;
  }

  .menu > li.menu-item-has-children:hover > .sub-menu,
  .menu .sub-menu li.menu-item-has-children:hover > .sub-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .menu li.current-menu-item > a {
    color: #0066ff;
    font-weight: 700;
    position: relative;
    background-color: transparent; 
  }

  .menu > li.menu-item-has-children > a::after {
    content: "▾";
    font-size: 1em;
    margin-left: 6px;
    transition: transform 0.25s ease;
  }

  .menu > li.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
  }

  .menu .sub-menu li.menu-item-has-children > a::after {
    content: "›";
    font-size: 0.7em;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
  }

  .header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #4a90e2 0%, #2563eb 100%);
    color: #fff !important;
    margin-top: 8px; /* Обратите внимание: margin-top в гриде/флексе может выглядеть странно, если элемент не выровнен */
    box-shadow: 0 3px 10px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    max-width: fit-content;
    height: 52px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    margin-top: 0; /* Я сбросил margin-top, так как в align-items: center он обычно мешает */
  }

  .header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  }

  .header-contact {
    display: block;
    justify-self: end;
    text-align: right;
    margin-left: var(--gap);
  }

  .header-contact__phone {
    font-weight: 700;
    font-size: 1.1rem;
    color: #222;
  }

  .header-contact__phone:hover {
    color: #0066ff;
  }

  .header-contact__schedule {
    font-size: 0.8rem;
    color: #777;
  }
}

/* ==== MOBILE ONLY ==== */
@media (max-width: 767px) {
  header.site-header > .container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--gap);
  }

  .site-logo {
    order: 1;
  }

  .nav-toggle {
    order: 3;
    margin-left: auto;
    display: inline-flex;
  }

  .header-actions {
    display: none;
  }

  .site-nav .header-actions--in-menu {
    display: block;
    text-align: center;
    padding: 8px 20px 0;
  }

  .site-nav .header-actions--in-menu .header-cta {
    display: block;
    width: 100%;
    padding: 16px 16px;
    border-radius: 9999px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    margin: 0;
    border-radius: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #4a90e2 0%, #2563eb 100%);
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    height: 52px !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }

  .site-nav .header-actions--in-menu .header-contact {
    display: block;
    margin-top: 6px;
    text-align: center;
    padding-bottom: 10px;
  }

  /* ==== MOBILE SUBMENUS (accordion) ==== */
  .menu > li > .sub-menu,
  .menu .sub-menu .sub-menu {
    position: static;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 8px;
    max-height: 0;
    overflow: hidden;
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: max-height .25s ease;
  }

  .menu li.is-sub-open > .sub-menu {
    max-height: 1000px;
  }

  .menu li > a {
    position: relative;
  }

  .menu li.menu-item-has-children > a::after {
    content: "▾";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform .2s ease;
  }

  .menu li.is-sub-open > a::after {
    transform: translateY(-50%) rotate(180deg);
  }
}

@media (min-width: 768px) and (max-width: 1150px) {
  header.site-header > .container {
    padding: 0 20px; 
    gap: 10px; 
  }

  .menu > li > a {
    font-size: 14px;
    padding: 8px 6px;
  }
  
  .menu {
    gap: 4px; 
  }
	
  .header-contact__schedule {
    display: none; 
  }

  .header-cta {
    padding: 0 15px;
    font-size: 14px;
    height: 40px !important;
  }

  .header-contact__phone {
    font-size: 1rem;
  }
}