/* ===============================================================
   Шапка сайта — общий файл.

   Подключается и на главной (вместе с site.css), и в разделе
   материалов (вместе с materials.css). Раньше у каждого раздела
   была своя шапка со своей вёрсткой; теперь источник один.

   Используются только те CSS-переменные, которые объявлены и в
   site.css, и в materials.css: --terra, --terra-l, --ink,
   --ink-soft, --border, --white.
   =============================================================== */

nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 3rem;
  background: rgba(250,247,242,0.92); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { font-family: 'Lora', serif; font-size: 1.2rem; font-weight: 600; color: var(--terra); text-decoration: none; letter-spacing: -0.01em; }
.nav-logo span { color: var(--ink-soft); }
.nav-links { display: flex; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--terra); }
.nav-links a.active { color: var(--terra); font-weight: 600; }
.nav-cta { background: var(--terra); color: var(--white); padding: 0.65rem 1.5rem; border-radius: 50px; font-size: 0.82rem; font-weight: 600; text-decoration: none; transition: all 0.2s; }
.nav-cta:hover { background: var(--terra-l); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(155,79,42,0.3); }

.nav-container {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* ── Кнопка-бургер ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--terra);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-11px) rotate(-45deg);
}

@media(max-width:900px){
  nav { padding:1rem 1.5rem; position: relative; }
  .menu-toggle { display: flex; }
  .nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250,247,242,0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    z-index: 99;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 5rem 2rem 2rem;
    opacity: 0;
    visibility: hidden;
  }
  .nav-container.menu-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    list-style: none;
  }
  .nav-links a {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
  }
  .nav-links a.active { color: var(--terra); }
  .nav-cta {
    margin-top: 1rem;
  }
}
