/* Page chrome: nav, sections, footer, layout containers */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }
section { padding: 80px 0; border-top: 1px solid var(--line); position: relative; }
section:first-of-type { border-top: none; }

.section-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  margin-bottom: 28px;
}

/* NAV */
nav.topnav {
  position: sticky;
  top: 0;
  background: rgba(240, 234, 214, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  padding: 14px 0;
}
nav.topnav .nav-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}
nav.topnav .nav-row > .brand { justify-self: start; }
nav.topnav .nav-row > .page-toggle { justify-self: center; }
nav.topnav .nav-row > .nav-links { justify-self: end; }
@media (max-width: 720px) {
  nav.topnav .nav-row { grid-template-columns: auto 1fr; gap: 12px; }
  nav.topnav .nav-row > .page-toggle { justify-self: end; }
}
@media (max-width: 520px) {
  /* Slimmer wrap padding to give toggle and other widgets more room */
  .wrap { padding: 0 16px; }
  nav.topnav .brand .brand-text { display: none; }
  /* On narrow phones, toggle gets its own row at full width — fixes
     iPhone SE (320px) where brand + toggle didn't fit side-by-side. */
  nav.topnav .nav-row {
    grid-template-columns: auto;
    grid-auto-rows: auto;
    row-gap: 8px;
  }
  nav.topnav .nav-row > .brand { justify-self: start; }
  nav.topnav .nav-row > .page-toggle {
    justify-self: stretch;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: stretch;
  }
  .page-toggle { font-size: 12px; }
  .page-toggle a { padding: 7px 10px; flex: 1; text-align: center; justify-content: center; }
}

/* PAGE-TOGGLE LABEL RESPONSIVE — full label by default, short on narrow */
.page-toggle .lbl-short { display: none; }
@media (max-width: 520px) {
  .page-toggle .lbl-full { display: none; }
  .page-toggle .lbl-short { display: inline; }
}

/* Page toggle — segmented pill between two main pages */
.page-toggle {
  display: inline-flex;
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px;
  position: relative;
  font-size: 13px;
}
.page-toggle a {
  padding: 8px 18px;
  text-decoration: none;
  color: var(--ink-soft);
  border-radius: 100px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.page-toggle a:hover { color: var(--ink); }
.page-toggle a.is-current {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 2px 8px rgba(26, 24, 21, 0.18);
}

/* Onboarding ping — draws attention to the inactive tab on first visit */
.page-toggle.is-pinging a:not(.is-current) {
  position: relative;
}
.page-toggle.is-pinging a:not(.is-current)::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 100px;
  border: 2px solid var(--accent);
  animation: pageTogglePing 1.4s var(--ease-out) infinite;
  pointer-events: none;
}
.page-toggle.is-pinging a:not(.is-current)::after {
  content: 'и тут ↑';
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  animation: pageToggleHint 4s ease-out 0.3s forwards;
  pointer-events: none;
}
.page-toggle.is-pinging a:not(.is-current)::after::before {
  content: '';
  /* small triangle tail above */
}
@keyframes pageTogglePing {
  0% { transform: scale(1); opacity: 0.85; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
/* English ping copy */
[lang="en"] .page-toggle.is-pinging a:not(.is-current)::after {
  content: 'this one too ↑';
}
@keyframes pageToggleHint {
  0% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  10%, 75% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(0); }
}

.brand {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 28px; height: 28px;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: 14px;
  border-radius: 4px;
}

.nav-links { display: flex; gap: 22px; font-size: 13px; color: var(--ink-soft); align-items: center; }
.nav-links a { text-decoration: none; transition: color 0.15s; }
.nav-links a:hover { color: var(--accent); }
@media (max-width: 900px) {
  .nav-links { display: none; }
}

/* FOOTER */
footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,0.75);
  padding: 60px 0 40px;
  border-top: 1px solid var(--line);
}
footer h4 {
  color: white;
  font-size: 16px;
  margin-bottom: 16px;
}
footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 700px) { footer .footer-grid { grid-template-columns: 1fr; } }
footer p { font-size: 13px; line-height: 1.7; color: rgba(255,255,255,0.6); }
footer a { color: rgba(255,255,255,0.85); display: block; padding: 4px 0; font-size: 13px; text-decoration: none; }
footer a:hover { color: white; text-decoration: underline; }
.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  flex-wrap: wrap;
  gap: 20px;
}

/* MOBILE general */
@media (max-width: 600px) {
  section { padding: 60px 0; }
}

/* === Sticky page-TOC (desktop only) — shared by index/vybory/tsenzura/partii === */
.main-toc {
  display: none;
}
@media (min-width: 1080px) {
  .main-toc {
    display: block;
    position: fixed;
    left: 24px;
    top: 100px;
    width: 200px;
    background: var(--bg-paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 12px;
    z-index: 50;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
  }
  .main-toc-h {
    font-size: 10px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 10px;
  }
  .main-toc a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
    border-radius: 5px;
    margin-bottom: 1px;
    transition: background .12s;
  }
  .main-toc a:hover { background: rgba(0,0,0,0.04); }
  .main-toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .main-toc a.toc-cur {
    background: var(--ink);
    color: var(--bg-card);
    font-weight: 600;
  }
  .main-toc a .num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-muted);
    min-width: 14px;
  }
  .main-toc a.toc-cur .num { color: var(--bg-card); }
  .main-toc-progress {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
  }
  .main-toc-progress-bar {
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    overflow: hidden;
  }
  .main-toc-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .15s linear;
  }
}

/* === Site development banner — shown on all pages while content
       is being authored by AI agents under human review. === */
.dev-banner {
  background: linear-gradient(90deg, rgba(190, 160, 80, 0.18), rgba(190, 160, 80, 0.10));
  border-bottom: 1px solid rgba(190, 160, 80, 0.45);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 16px;
  text-align: center;
}
.dev-banner strong { font-weight: 700; color: #7a5e1f; }
.dev-banner a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 28, 28, 0.3);
}
.dev-banner a:hover { border-bottom-color: var(--accent); }
@media (max-width: 600px) {
  .dev-banner { font-size: 12px; padding: 6px 12px; }
}

@media print {
  nav.topnav, .filter-btn, .main-toc, .dev-banner { display: none !important; }
}
