/*
 * Повторно используемая оболочка «Лесная библиотека знаний».
 * Подключается только страницами с классом .forest-chrome и основана
 * на утверждённых параметрах шапки и подвала knigi.html.
 */
.forest-chrome {
  /* Design tokens shared by the three approved pilot pages. */
  --forest-ink: #04170f;
  --forest-panel: #082117;
  --forest-gold: #e8cf73;
  --forest-line: rgba(232, 207, 115, 0.38);
  --forest-text: #f6f0d6;
  --forest-muted: rgba(246, 240, 214, 0.72);
  --forest-heading: Georgia, 'Times New Roman', serif;
  --forest-radius-control: 10px;
  --forest-radius-chrome: 18px;
  --forest-shadow-raised: var(--btn-3d);
  --forest-shadow-pressed: var(--btn-3d-pressed);
  --forest-motion-control: 160ms ease;
  --forest-rise: -1px;
  --forest-press: 2px;
}

.forest-chrome .site-header {
  /* Геометрия эталонной шапки задана в common.css: компактная полоса 35 px. */
  padding: calc(var(--header-bar-height) * 0.15852) 0 0 !important;
  background: transparent;
}

.forest-chrome .site-header .header-main {
  width: auto;
  max-width: var(--header-width);
  padding: 0 var(--space-40);
}

.forest-chrome .site-header .header-bar {
  min-height: clamp(26px, 4vw, var(--header-bar-height));
  padding: 0 var(--space-60);
  gap: var(--space-40);
  flex-wrap: nowrap;
  border: 1px solid var(--forest-line);
  border-radius: 50px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 34%), rgba(4, 26, 17, 0.94) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 -1px rgba(232, 207, 115, 0.12);
  backdrop-filter: blur(14px);
}

.forest-chrome .site-header .header-logo { gap: 10px; min-width: 0; }
.forest-chrome .site-header .header-logo img { width: 37px; height: 37px; filter: drop-shadow(0 0 9px rgba(232, 207, 115, 0.22)); }
.forest-chrome .site-header .site-title {
  max-width: min(100%, 360px);
  font-family: var(--forest-heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: normal;
  text-transform: none;
  color: var(--forest-gold);
  white-space: nowrap;
}

.forest-chrome .site-header .nav-menu ul { justify-content: flex-end; gap: 1rem; }
.forest-chrome .site-header .nav-menu a,
.forest-chrome .site-header .nav-entry-link {
  position: relative;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(12px, 1.8vw, 18px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 160ms ease;
}
.forest-chrome .site-header .nav-menu a::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 2px;
  border-radius: 99px;
  background: var(--forest-gold);
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 160ms ease, transform 160ms ease;
}
.forest-chrome .site-header .nav-menu a:hover,
.forest-chrome .site-header .nav-menu a:focus-visible,
.forest-chrome .site-header .nav-menu a.nav-current { color: var(--forest-gold); }
.forest-chrome .site-header .nav-menu a:hover::after,
.forest-chrome .site-header .nav-menu a:focus-visible::after,
.forest-chrome .site-header .nav-menu a.nav-current::after { opacity: 1; transform: scaleX(1); }

.forest-chrome .site-header .header-cta { gap: 0.35rem !important; }
.forest-chrome .site-header .header-pin-btn,
.forest-chrome .site-header .search-form .search-toggle {
  width: 28px !important;
  height: 28px !important;
  border: 1px solid var(--forest-line) !important;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055) !important;
  color: var(--forest-gold) !important;
  box-shadow: var(--forest-shadow-raised) !important;
  transition: box-shadow 150ms ease, opacity 200ms ease, background var(--forest-motion-control), border-color var(--forest-motion-control), transform var(--forest-motion-control);
}
.forest-chrome .site-header .header-pin-btn:hover,
.forest-chrome .site-header .search-form .search-toggle:hover {
  border-color: var(--forest-gold) !important;
  background: rgba(232, 207, 115, 0.12) !important;
  transform: translateY(var(--forest-rise));
  filter: brightness(1.08);
  box-shadow: var(--forest-shadow-raised), 0 7px 14px rgba(0, 0, 0, 0.28) !important;
}
.forest-chrome .site-header .header-pin-btn:active { box-shadow: var(--forest-shadow-pressed) !important; transform: translateY(var(--forest-press)); }
.forest-chrome .site-header .search-form .search-toggle:active { box-shadow: var(--forest-shadow-pressed) !important; transform: translateY(var(--forest-press)); }
.forest-chrome.header-pinned .site-header .header-pin-btn { box-shadow: var(--forest-shadow-pressed) !important; }
.forest-chrome .site-header .header-pin-btn svg,
.forest-chrome .site-header .search-form .search-toggle svg { width: 14px !important; height: 14px !important; fill: currentColor; }

.forest-chrome .site-header .header-cta .btn.btn-accent {
  min-height: 0;
  padding: 0.9px 7.6px !important;
  border: 1px solid rgba(232, 207, 115, 0.78) !important;
  border-radius: var(--forest-radius-control) !important;
  background:
    radial-gradient(circle at 28% 16%, rgba(255, 249, 205, 0.32), transparent 36%),
    linear-gradient(160deg, #2c8057 0%, #145039 58%, #0a3023 100%) !important;
  color: #fff4c5 !important;
  font-size: 18px !important;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  box-shadow: var(--forest-shadow-raised), 0 7px 15px rgba(0, 0, 0, 0.22) !important;
  transform: none;
}
.forest-chrome .site-header .header-cta .btn.btn-accent:hover { color: #fff9de !important; filter: brightness(1.07); transform: translateY(-2px); box-shadow: var(--forest-shadow-raised), 0 11px 20px rgba(0, 0, 0, 0.3) !important; }
.forest-chrome .site-header .header-cta .btn.btn-accent:active { box-shadow: var(--forest-shadow-pressed), 0 3px 8px rgba(0, 0, 0, 0.22) !important; transform: scale(1.05) translateY(2px); }

.forest-chrome .lang-switch { margin: 0; color: var(--forest-muted); }
.forest-chrome .lang-switch a { min-width: 28px; padding: 6px 3px; color: var(--forest-muted); border-radius: 7px; }
.forest-chrome .lang-switch a:hover,
.forest-chrome .lang-switch a:focus-visible { color: var(--forest-gold); text-decoration: none; }
.forest-chrome .lang-switch .lang-switch-active { color: var(--forest-gold); background: rgba(232, 207, 115, 0.09); }

.forest-chrome .site-footer {
  padding-top: 40px;
  border-top: 1px solid var(--forest-line);
  background: radial-gradient(circle at 12% 0%, rgba(232, 207, 115, 0.1), transparent 28%), #04170f;
  color: var(--forest-text);
}
.forest-chrome .site-footer .footer-inner { max-width: 1180px; padding: 24px 28px 36px; }
.forest-chrome .site-footer .footer-brand h1 { font-family: var(--forest-heading); font-size: 26px; text-transform: none; color: var(--forest-gold); }
.forest-chrome .site-footer a { color: rgba(255, 255, 255, 0.88); }
.forest-chrome .site-footer a:hover,
.forest-chrome .site-footer a:focus-visible { color: var(--forest-gold); }
.forest-chrome .site-footer .footer-bottom {
  margin: 0;
  padding: 14px 20px !important;
  border-top: 1px solid rgba(232, 207, 115, 0.28);
  background: #03120c !important;
  color: var(--forest-muted) !important;
  font-size: 13px;
}
.forest-chrome .site-footer .footer-marquee {
  border: 1px solid rgba(232, 207, 115, 0.3);
  background: rgba(8, 33, 23, 0.98);
  color: var(--forest-muted);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.forest-chrome .site-footer .footer-marquee__label,
.forest-chrome .site-footer .footer-marquee__paren { color: var(--forest-gold); }

@media (max-width: 768px) {
  /* Все исходные действия остаются доступны: на узком экране они занимают отдельную строку. */
  .forest-chrome .site-header { padding-top: 8px !important; }
  .forest-chrome .site-header .header-main { padding: 0 10px; }
  .forest-chrome .site-header .header-bar { padding: 8px 10px; gap: 8px; border-radius: 14px; flex-wrap: wrap; }
  .forest-chrome .site-header .header-logo { flex: 1 1 calc(100% - 56px); }
  .forest-chrome .site-header .header-logo img { width: 40px; height: 40px; }
  .forest-chrome .site-header .site-title { max-width: min(240px, 55vw); font-size: 14px; }
  .forest-chrome .site-header .header-cta { order: 2; display: flex !important; flex: 1 1 100%; width: 100%; margin: 0; justify-content: center; flex-wrap: wrap !important; }
  .forest-chrome .site-header .header-burger,
  .forest-chrome .site-header .header-pin-btn,
  .forest-chrome .site-header .search-form .search-toggle { width: 44px !important; min-width: 44px !important; height: 44px !important; border-radius: 50% !important; }
  .forest-chrome .site-header .header-burger::before { display: none; }
  .forest-chrome .site-header .header-cta .btn.btn-accent { min-height: 44px; padding: 8px 12px !important; font-size: 11px !important; }

  .forest-chrome.has-mobile-menu.mobile-menu-open .site-header .nav-menu {
    border-color: var(--forest-line); background: rgba(4, 25, 17, 0.98); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  }
  .forest-chrome .site-footer .footer-inner { padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 520px) {
  .forest-chrome .site-header .site-title { max-width: 205px; font-size: 13px; }
  .forest-chrome .site-header .header-cta { gap: 6px !important; }
  .forest-chrome .site-header .header-cta .btn.btn-accent { padding: 7px 9px !important; font-size: 10px !important; }
  .forest-chrome .lang-switch { font-size: 11px; }
}
