/* Global layout and overlap fixes */
*, *::before, *::after {
  box-sizing: border-box;
}

img,
video,
iframe {
  max-width: 100%;
}

img {
  height: auto;
}

h1, h2, h3, h4, h5, h6, p, li, a, span {
  /* break-word: перенос длинных слов без «дробления» на отдельные буквы как у anywhere */
  overflow-wrap: break-word;
}

/* Header row: positioning context for wide «Услуги» mega-menu */
.gk-nav-row {
  position: relative;
}

/* Keep content spacing visually consistent across pages */
.max-w-7xl.mx-auto.px-4,
.max-w-6xl.mx-auto.px-4,
.max-w-5xl.mx-auto.px-4,
.max-w-4xl.mx-auto.px-4 {
  padding-left: clamp(1rem, 2vw, 1.75rem) !important;
  padding-right: clamp(1rem, 2vw, 1.75rem) !important;
}

/* Desktop mega-menu should stay inside viewport */
@media (min-width: 1280px) {
  .gk-nav-item {
    position: relative;
  }

  /* Wide «Услуги» panel: anchor to full header row (content left), not the narrow tab */
  .gk-nav-item:has(.gk-mega-services) {
    position: static;
    /* Bridge hover gap between tab text and panel start */
    padding-bottom: 14px;
    margin-bottom: -14px;
  }

  .gk-mega {
    max-width: min(calc(100vw - 2rem), 1120px);
  }

  .gk-mega-about {
    width: min(760px, calc(100vw - 2rem));
    left: 0;
  }

  /* Left edge aligns with .gk-nav-row (same as logo / max-w-7xl block) */
  .gk-mega-services {
    width: min(1380px, calc(100vw - 2rem));
    /* Иначе общий .gk-mega { max-width: 1120px } обрезает панель — колонки слишком узкие, длинные слова рвутся по буквам */
    max-width: min(1380px, calc(100vw - 2rem));
    left: 0;
    right: auto;
    transform: none;
    /* Keep the dropdown baseline aligned with other top-level tabs. */
    top: calc(100% - 14px);
  }

  .gk-mega-specialists {
    width: min(560px, calc(100vw - 2rem));
    left: 0;
    right: auto;
    transform: none;
  }

  .gk-mega-patients {
    width: min(600px, calc(100vw - 2rem));
    left: 0;
    right: auto;
    transform: none;
  }

  .gk-mega-dms,
  .gk-mega-paid,
  .gk-mega-contacts {
    width: min(460px, calc(100vw - 2rem));
    right: 0;
    left: auto;
  }

  .gk-mega-dms {
    width: min(380px, calc(100vw - 2rem));
  }

  .gk-mega-contacts {
    width: min(380px, calc(100vw - 2rem));
  }
}

/* Hero slider: avoid text collision with arrows */
.hero-slide > .flex.flex-col.justify-center {
  position: relative;
  z-index: 2;
  padding-left: clamp(4rem, 7vw, 5.5rem) !important;
  padding-right: clamp(4rem, 7vw, 5.5rem) !important;
}

@media (max-width: 767px) {
  .hero-slide > .flex.flex-col.justify-center {
    padding-left: 3.75rem !important;
    padding-right: 3.75rem !important;
  }

  .hero-arrow {
    top: 38%;
  }
}

/* Decorative absolute SVG should not block text clicks or readability */
section > svg.absolute,
section .blob-bg.absolute,
section svg.blob-bg {
  pointer-events: none;
  z-index: 0;
}

section [class*="relative z-"] {
  z-index: 1;
}

/* Improve narrow layout behavior for service list cards */
@media (max-width: 640px) {
  .card.flex.items-center.justify-between {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .card.flex.items-center.justify-between > :last-child {
    width: 100%;
    justify-content: space-between;
  }
}

/* ===== Schema-aligned navigation accents (2026-04) ===== */
:root {
  --nav-red: #DA101B;
  --nav-red-dark: #A50914;
  --nav-red-soft: #FDECEC;
  --nav-orange: #F57C00;
  --nav-orange-dark: #BF5A00;
  --nav-orange-soft: #FFF3E0;
}

/* Red accent group — Telemedicine */
.gk-group-red {
  background: var(--nav-red-soft);
  border-left: 3px solid var(--nav-red);
  border-radius: 12px;
  padding: 12px 14px;
}
.gk-group-red .gk-mega-heading { color: var(--nav-red); border-bottom-color: rgba(218,16,27,0.25); }
.gk-group-red .gk-mega-link { color: var(--nav-red-dark); }
.gk-group-red .gk-mega-link:hover { background: rgba(218,16,27,0.12); color: var(--nav-red-dark); }

/* Orange accent — «и др.» */
.gk-mega-link.orange,
.gk-mobile-sub.orange {
  color: var(--nav-orange-dark) !important;
  background: var(--nav-orange-soft);
  border-left: 3px solid var(--nav-orange);
  font-weight: 600;
}
.gk-mega-link.orange:hover {
  background: rgba(245,124,0,0.18);
  color: var(--nav-orange-dark) !important;
}
.gk-mobile-heading.orange { color: var(--nav-orange-dark); }
.gk-mobile-sub.red { color: var(--nav-red-dark); }
.gk-mobile-heading.red { color: var(--nav-red); }

/* Mobile submenu hierarchy mirrors the desktop mega-menu without changing labels */
.gk-mobile-sub.child {
  padding-left: 24px;
  font-size: 14px;
}

.gk-mobile-sub.grandchild {
  padding-left: 38px;
  font-size: 13.5px;
}

.gk-mobile-body .gk-mobile-heading:not(:first-child) {
  margin-top: 8px;
}

/* Vertical list inside «Услуги» mega-menu — match the strict tree-like schema */
.gk-mega-services .gk-services-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 1100px) {
  .gk-mega-services .gk-services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* «Услуги»: длинные русские термины — без висячей одной буквы на строке (Chrome/Safari: text-wrap) */
.gk-mega-services .gk-mega-heading,
.gk-mega-services .gk-mega-link {
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
