:root {
  --green-950: #101c18;
  --green-900: #172a23;
  --green-800: #203b31;
  --green-700: #315344;
  --green-100: #e8eee9;
  --green-50: #f4f7f4;
  --red-900: #4a1f24;
  --red-800: #642a30;
  --red-600: #874047;
  --ink: #202623;
  --muted: #69736e;
  --paper: #f7f6f1;
  --paper-2: #efeee7;
  --line: #d9d8ce;
  --shadow: 0 16px 45px rgba(16, 28, 24, .10);
  --radius: 16px;
  --max: 980px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(49,83,68,.08), transparent 30rem),
    var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
}

button, input { font: inherit; }

a { color: var(--red-800); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(20px, calc((100vw - var(--max)) / 2));
  background: rgba(16, 28, 24, .96);
  color: white;
  box-shadow: 0 5px 22px rgba(0,0,0,.13);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: white;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  color: #efece0;
  font-size: 23px;
}

.brand strong, .brand small {
  display: block;
  line-height: 1.15;
}

.brand strong { font-size: 19px; letter-spacing: .03em; }
.brand small { margin-top: 4px; color: #bfc9c3; font-size: 12px; }

.header-actions { display: flex; gap: 6px; }

.icon-button, .close-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: #e7ece8;
  font-size: 28px;
}

.menu-button { font-size: 30px; }
.icon-button:hover { background: rgba(255,255,255,.08); }

.side-menu {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(370px, 92vw);
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
  background: #f2f1ea;
  box-shadow: -20px 0 55px rgba(0,0,0,.22);
  transform: translateX(105%);
  transition: transform .25s ease;
}

.side-menu.open { transform: translateX(0); }

.menu-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(0,0,0,.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.menu-backdrop.open { opacity: 1; pointer-events: auto; }

.menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: var(--green-950);
  font-size: 20px;
  font-weight: 700;
}

.close-button {
  color: var(--green-900);
  font-size: 31px;
  line-height: 1;
}

.nav-section {
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.nav-main {
  width: 100%;
  border: 0;
  padding: 7px 0;
  background: none;
  color: var(--green-950);
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
}

.nav-main::after {
  content: "⌄";
  float: right;
  color: var(--red-800);
  transition: transform .2s;
}

.nav-section.expanded .nav-main::after { transform: rotate(180deg); }

.nav-sub {
  display: none;
  padding: 6px 0 0 10px;
}

.nav-section.expanded .nav-sub { display: block; }

.nav-link {
  display: block;
  width: 100%;
  border: 0;
  border-left: 2px solid transparent;
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  border-left-color: var(--red-600);
  color: var(--red-900);
  background: rgba(135,64,71,.06);
}

.search-panel {
  position: relative;
  z-index: 20;
  max-height: 0;
  overflow: hidden;
  background: #e9ede9;
  transition: max-height .25s ease;
}

.search-panel.open { max-height: 520px; }

.search-inner {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.search-inner label {
  display: block;
  margin-bottom: 7px;
  color: var(--green-950);
  font-weight: 700;
}

.search-row { display: flex; gap: 8px; }

.search-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #c9cec9;
  border-radius: 10px;
  padding: 11px 13px;
  background: white;
  color: var(--ink);
  outline: none;
}

.search-row input:focus { border-color: var(--green-700); }

.primary-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  background: var(--green-800);
  color: white;
  cursor: pointer;
}

.search-results { margin-top: 10px; }

.search-result {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid rgba(49,83,68,.16);
  cursor: pointer;
}

.search-result strong { color: var(--red-900); }
.search-result small { color: var(--muted); }

.app {
  width: min(var(--max), calc(100% - 40px));
  min-height: calc(100vh - 190px);
  margin: 0 auto;
  padding: 18px 0 70px;
}

.hero {
  padding: clamp(18px, 4vw, 38px) 0 40px;
}

.eyebrow {
  color: var(--red-800);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 750px;
  margin: 10px 0 20px;
  color: var(--green-950);
  font-size: clamp(39px, 8vw, 68px);
  line-height: .98;
  font-weight: 600;
}

.hero p {
  max-width: 720px;
  color: #4e5753;
  font-size: clamp(17px, 2.3vw, 21px);
}

.note {
  margin: 28px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--red-600);
  background: #ecebe4;
  color: #4b514e;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
  margin-top: 38px;
}

.archive-card {
  min-height: 150px;
  padding: 21px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.45);
  text-decoration: none;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}

.archive-card:hover {
  transform: translateY(-3px);
  border-color: #aeb9b2;
  box-shadow: var(--shadow);
}

.archive-card .number { color: var(--red-600); font-size: 13px; }
.archive-card h2 { margin: 10px 0 4px; color: var(--green-950); font-size: 21px; }
.archive-card p { margin: 0; color: var(--muted); font-size: 14px; }

.page-heading {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.page-heading .eyebrow { margin-bottom: 6px; }
.page-heading h1 {
  margin: 0;
  color: var(--green-950);
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.05;
}

.page-heading p { color: var(--muted); margin: 10px 0 0; }

.post-list { display: grid; gap: 13px; }

.post-card {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.48);
  padding: 20px;
  text-align: left;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: #abb6af;
  box-shadow: var(--shadow);
}

.post-card h2 { margin: 0 0 5px; color: var(--green-950); font-size: 22px; }
.post-card p { margin: 0; color: var(--muted); }
.post-meta { margin-top: 10px; color: var(--red-800); font-size: 12px; }

.post {
  max-width: 840px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--red-800);
  text-decoration: none;
}

.post > h1 {
  margin: 0 0 10px;
  color: var(--green-950);
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1.04;
}

.post-lead { color: var(--muted); font-size: 17px; }

.post-image {
  width: 100%;
  max-height: 540px;
  object-fit: cover;
  margin: 25px 0;
  border: 1px solid var(--line);
}

.lore-block {
  margin: 20px 0;
  padding: 20px 22px;
  border: 1px solid #d4d3c8;
  border-left: 4px solid var(--green-700);
  background: rgba(255,255,255,.5);
}

.lore-block h2, .lore-block h3 {
  margin: 0 0 9px;
  color: var(--red-900);
  line-height: 1.2;
}

.lore-block p { margin: 0 0 12px; }
.lore-block p:last-child { margin-bottom: 0; }

.divider {
  height: 1px;
  margin: 30px 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.empty {
  padding: 35px 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px max(20px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--line);
  background: #e9e8e0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer div { display: flex; flex-wrap: wrap; gap: 12px; }
.site-footer strong { color: var(--green-950); }

@media (max-width: 700px) {
  .site-header { min-height: 64px; padding: 10px 16px; }
  .brand strong { font-size: 17px; }
  .brand-mark { width: 38px; height: 38px; }
  .app { width: min(100% - 28px, var(--max)); padding-top: 12px; }
  .archive-grid { grid-template-columns: 1fr; }
  .search-inner { width: calc(100% - 28px); }
  .search-row { flex-direction: column; }
  .site-footer { flex-direction: column; padding: 22px 16px; }
  .lore-block { padding: 17px 18px; }
}


.nav-home {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--green-950);
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
}
.nav-home.active, .nav-home:hover { color: var(--red-800); }

.home-return {
  display: inline-block;
  margin: 0 0 14px;
  color: var(--red-800);
  text-decoration: none;
  font-weight: 600;
}


/* Лорные медиа-блоки */
.post-image-wrap {
  margin: 30px 0 34px;
  padding: 7px;
  background: rgba(255,255,255,.48);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(16,28,24,.07);
}
.post-image-wrap .post-image { margin: 0; display: block; max-height: 560px; border: 0; }
.lore-image {
  margin: 30px 0;
  padding: 7px;
  background: rgba(255,255,255,.48);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(16,28,24,.07);
}
.lore-image img {
  display: block; width: 100%; max-height: 560px; object-fit: cover;
}
.lore-image figcaption {
  padding: 9px 10px 4px; color: var(--muted); font-size: 13px; font-style: italic; text-align: center;
}
.lore-quote {
  position: relative; display: flex; gap: 15px; margin: 30px 0; padding: 19px 22px 19px 20px;
  border: 1px solid #d2d1c7; border-left: 4px solid var(--red-600);
  background: #ecebe4; color: #454c48;
}
.quote-mark { color: var(--red-600); font-size: 40px; line-height: .7; font-family: Georgia, serif; flex: 0 0 auto; }
.lore-quote p { margin: 0 0 6px; }
.lore-quote p:last-child { margin-bottom: 0; }
@media (max-width:700px) {
  .post-image-wrap, .lore-image { margin: 24px 0 28px; padding: 5px; }
  .lore-quote { margin: 24px 0; padding: 17px 16px; }
}

/* ───────── Небольшая визуальная полировка архива ───────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: radial-gradient(rgba(32,38,35,.09) .55px, transparent .55px);
  background-size: 7px 7px;
  mix-blend-mode: multiply;
}

.site-header {
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.brand-mark {
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.archive-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 25px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.42);
  box-shadow: 0 8px 25px rgba(16,28,24,.045);
}

.toolbar-home {
  flex: 0 0 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green-900);
  color: #f3f1e8;
  text-decoration: none;
  font-size: 18px;
  transition: transform .18s, background .18s;
}
.toolbar-home:hover { transform: translateY(-1px); background: var(--green-800); }

.toolbar-sections {
  display: flex;
  flex: 1;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar-sections::-webkit-scrollbar { display: none; }

.toolbar-tab {
  position: relative;
  flex: 1 0 auto;
  padding: 9px 15px;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.toolbar-tab:hover { background: rgba(49,83,68,.07); color: var(--green-900); }
.toolbar-tab.active {
  background: var(--green-50);
  color: var(--red-800);
  box-shadow: 0 2px 8px rgba(16,28,24,.07);
}
.toolbar-tab.active::after {
  content: "";
  position: absolute;
  left: 25%; right: 25%; bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--red-600);
}

.heading-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}
.heading-top .home-return { margin: 0; font-size: 13px; }
.heading-path { color: #969b96; font-size: 12px; letter-spacing: .03em; }

.page-heading {
  position: relative;
  padding-bottom: 23px;
}
.page-heading::after {
  content: "✦";
  position: absolute;
  right: 3px;
  bottom: -8px;
  padding: 0 8px;
  background: var(--paper);
  color: var(--red-600);
  font-size: 12px;
}
.page-heading h1 {
  font-size: clamp(27px, 5vw, 43px);
  letter-spacing: -.015em;
}
.page-heading p { max-width: 680px; font-size: 15px; }

.post-card {
  position: relative;
  border-radius: 12px;
  padding: 19px 21px;
  background: rgba(255,255,255,.56);
}
.post-card::before {
  content: "";
  position: absolute;
  left: 0; top: 13px; bottom: 13px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background .18s;
}
.post-card:hover::before { background: var(--red-600); }
.post-card h2 { font-size: 19px; }
.post-card p { font-size: 14px; line-height: 1.55; }
.post-meta { opacity: .82; }

.archive-card { border-radius: 13px; }
.archive-card h2 { font-size: 20px; }

.post-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(217,216,206,.75);
}
.post-breadcrumb .back-link { margin: 0; font-size: 13px; }
.post-breadcrumb > span { color: #969b96; font-size: 12px; }
.post > h1 { font-size: clamp(30px, 6vw, 49px); }

.lore-block, .lore-quote, .lore-image, .post-image-wrap { border-radius: 10px; }

@media (max-width:700px) {
  .archive-toolbar { margin-bottom: 19px; padding: 5px; }
  .toolbar-home { flex-basis: 35px; height: 35px; }
  .toolbar-tab { padding: 8px 12px; font-size: 13px; }
  .heading-top { align-items: flex-start; flex-direction: column; gap: 4px; margin-bottom: 12px; }
  .heading-path { display: none; }
  .page-heading h1 { font-size: 29px; }
  .post-breadcrumb > span { display: none; }
  .post > h1 { font-size: 31px; }
}

/* ───────── Навигация по отделам: отдел → только его подразделы ───────── */
.archive-toolbar {
  position: relative;
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  margin: 2px 0 26px;
  background: rgba(247,246,241,.82);
  border-color: #d4d5cb;
}

.toolbar-home {
  flex-basis: 42px;
  min-width: 42px;
  height: auto;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(16,28,24,.08);
}

.toolbar-sections {
  min-width: 0;
  align-items: stretch;
}

.toolbar-tab {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 9px;
}

.toolbar-tab.active {
  background: var(--green-900);
  color: #f5f2e8;
  box-shadow: 0 3px 10px rgba(16,28,24,.10);
}
.toolbar-tab.active::after { display: none; }
.toolbar-tab.active:hover { color: #f5f2e8; background: var(--green-800); }

.section-picker {
  position: relative;
  flex: 0 0 auto;
  min-width: 170px;
}

.section-picker summary {
  list-style: none;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border: 1px solid #d5d7cf;
  border-radius: 9px;
  background: #f0f2ed;
  color: var(--green-900);
  cursor: pointer;
  user-select: none;
}
.section-picker summary::-webkit-details-marker { display: none; }
.section-picker summary::after {
  content: "⌄";
  color: var(--red-600);
  font-size: 16px;
  transition: transform .18s ease;
}
.section-picker[open] summary::after { transform: rotate(180deg); }
.section-picker summary span {
  display: block;
  color: #8a918c;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section-picker summary strong {
  display: block;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 700;
}

.section-menu {
  position: absolute;
  z-index: 25;
  top: calc(100% + 7px);
  right: 0;
  width: min(250px, 80vw);
  padding: 6px;
  border: 1px solid #d2d3ca;
  border-radius: 11px;
  background: #f7f6f1;
  box-shadow: 0 16px 35px rgba(16,28,24,.15);
}
.section-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.section-option span { width: 14px; color: #9ba29d; text-align: center; }
.section-option:hover { background: var(--green-50); color: var(--green-900); }
.section-option.active { background: rgba(135,64,71,.08); color: var(--red-900); font-weight: 700; }
.section-option.active span { color: var(--red-600); }

.heading-top { margin-bottom: 11px; }
.heading-path { font-size: 11px; color: #a0a49f; }

/* Более спокойная типографика списка */
.post-card h2 { font-size: 18px; line-height: 1.3; }
.page-heading h1 { font-size: clamp(25px, 4.5vw, 39px); }

@media (max-width:700px) {
  .archive-toolbar { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 7px; margin-bottom: 21px; }
  .toolbar-home { grid-row: 1; }
  .toolbar-sections { grid-column: 2; }
  .section-picker { grid-column: 1 / -1; min-width: 0; }
  .section-picker summary { min-height: 40px; }
  .section-menu { position: static; width: 100%; margin-top: 6px; box-shadow: 0 8px 22px rgba(16,28,24,.08); }
  .toolbar-tab { min-height: 40px; padding: 7px 12px; font-size: 12px; }
  .page-heading h1 { font-size: 27px; }
  .post-card h2 { font-size: 17px; }
}
