/* ===== Мобильная навигация (бургер → полноэкранное меню по клику) ===== */

.nav-overlay {
  display: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 52;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
  pointer-events: none;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
}

@media (max-width: 900px) {
  html {
    overflow-x: hidden;
  }

  .site-header {
    z-index: 100;
  }

  .header-inner {
    display: flex;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: auto !important;
    min-height: 3.75rem;
    padding: 0.5rem 0 !important;
  }

  .site-title {
    flex: 1;
    min-width: 0;
    font-size: 1.35rem !important;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-toggle {
    display: inline-flex;
    order: 2;
    margin-left: 0;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--surface);
    z-index: 51;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav .nav-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    min-height: 3.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .site-nav .nav-panel-title {
    font-family: "Playfair Display", serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
  }

  .site-nav .nav-panel-title span {
    color: var(--primary);
  }

  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .nav-close svg {
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
  }

  .site-nav .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
    padding: 1rem 1rem 1.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .site-nav .nav-link {
    display: block;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    min-height: 44px;
    line-height: 1.3;
  }

  .site-nav .nav-link::after {
    display: none !important;
  }

  .site-nav .nav-link.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
  }

  .site-nav .accessibility-controls {
    margin: 0.5rem 1rem 1.5rem;
    justify-content: flex-start;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    touch-action: none;
  }

  .nav-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
  }
}

@media (min-width: 901px) {
  .site-nav .nav-panel-head,
  .nav-close {
    display: none;
  }

  .site-header.hidden {
    transform: translateY(-100%);
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1.2rem !important;
  }
}
