/* Норка — общий стиль сайта */
:root {
  --olive: #B3C07E;
  --green: #8BBF7E;
  --green-b: #78A86C;
  --green-d: #6E8F3E;
  --green-dd: #56742c;
  --cream: #F4F6E6;
  --cream-2: #EEF2D8;
  --cream-3: #E9EFCF;
  --line: #dfe5c4;
  --brown: #5a3410;
  --brown-2: #4a2a0c;
  --link: #7a3d14;
  --ink: #2b2a1c;
  --muted: #5d6640;
  --earth: #8C5E0C;
  --serif: Alice, Georgia, "Times New Roman", serif;
  --sans: "PT Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--olive); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { color: #4a240a; text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--brown); line-height: 1.2; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* каркас: дерево слева */
.frame { display: flex; min-height: 100vh; }
.tree { flex: 0 0 220px; background: url(../img/tree.svg) repeat-y left top / 220px auto; }
.main { flex: 1 1 auto; min-width: 0; padding: 24px 40px 36px 24px; }
.wrap { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 760px) {
  .tree { display: none; }
  .main { padding: 16px; }
}

/* шапка */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.top.end { justify-content: flex-end; }
.logo { font: 40px/1 var(--serif); color: var(--brown); text-shadow: 0 1px 0 #e4ebc4, 0 2px 6px rgba(70,60,10,.18); }
.logo:hover { text-decoration: none; color: var(--brown-2); }
.menu { display: flex; flex-wrap: wrap; gap: 8px; }
.btn, .menu a {
  display: inline-block; font: 17px/1.2 var(--serif); color: var(--brown); background: var(--green);
  border: 2px solid var(--green-b); border-radius: 12px; padding: 8px 16px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 1px 0 rgba(255,255,255,.3);
}
.btn:hover, .menu a:hover { text-decoration: none; background: #98c98b; color: var(--brown-2); }
.menu a.on, .btn.primary { color: var(--cream); background: var(--green-d); border-color: var(--green-dd); text-shadow: none; }
.btn.small { font-size: 15px; padding: 6px 12px; border-radius: 10px; }
.crumbs { font-size: 14px; color: #3f4a1c; }
.crumbs a + a::before, .crumbs a + span::before { content: "›"; margin: 0 6px; color: var(--muted); }

/* карточки */
.card { background: var(--cream); border-radius: 18px; padding: 22px 26px; box-shadow: 0 2px 0 #9cae63; }
.card h2 { margin: 0; font-size: 26px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head a { font-size: 14px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > * { flex: 1 1 400px; min-width: 0; }
.dated { list-style: none; margin: 12px 0 0; padding: 0; }
.dated li { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.dated .d { flex: 0 0 84px; font-size: 13px; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }

/* главная */
.welcome { background: var(--green); border: 2px solid var(--green-b); border-radius: 26px; padding: 30px 32px 34px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.welcome h1 { margin: 0; font-size: 44px; color: var(--brown-2); text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.welcome p { margin: 0; font-size: 18px; color: #24301a; }
.welcome img { margin-top: 8px; width: 544px; border-radius: 16px; border: 4px solid var(--cream); box-shadow: 0 6px 18px rgba(50,60,20,.25); }
.foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 10px; font-size: 14px; color: #3f4a1c; }
.mush { display: flex; align-items: flex-end; gap: 10px; font: 18px var(--serif); color: var(--brown); }
.mush span { padding-bottom: 14px; }
.mush img { width: 260px; transition: filter .15s, transform .15s; }
.mush:hover { text-decoration: none; }
.mush:hover img { filter: drop-shadow(0 0 8px #ffd860); transform: scale(1.04); }

/* статья */
.layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.layout > article { flex: 999 1 560px; min-width: 0; }
.layout > aside { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
article.card { padding: 28px 32px; display: flex; flex-direction: column; gap: 14px; }
article h1 { margin: 0; font-size: 36px; }
.meta { margin: -6px 0 0; font-size: 14px; color: var(--muted); }
.text { font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; max-width: 82ch; }
.text > :first-child { margin-top: 0; }
.text h1 { font-size: 30px; } .text h2 { font-size: 25px; margin: 1.2em 0 .4em; } .text h3 { font-size: 21px; }
.text table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; }
.text td, .text th { border: 1px solid var(--line); padding: 4px 8px; vertical-align: top; }
.text blockquote { margin: 0; padding: 8px 16px; background: var(--cream-3); border-radius: 10px; }
.text pre, .text code { background: var(--cream-2); border-radius: 6px; font-size: 14px; }
.text pre { padding: 10px 12px; overflow-x: auto; }
.text iframe, .text video { max-width: 100%; }
.text iframe[src*="youtube"] { width: 640px; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.side { background: var(--green); border: 2px solid var(--green-b); border-radius: 16px; padding: 16px 18px; }
.side h2 { margin: 0 0 8px; font-size: 21px; color: var(--brown-2); }
.side ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.side li a { display: block; padding: 6px 10px; border-radius: 8px; color: #3a2008; }
.side li a.on { background: var(--cream); font-weight: 700; }
.side.light { background: var(--cream); border: 0; box-shadow: 0 2px 0 #9cae63; font-size: 15px; }
.section { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.section h2 { margin: 0; font-size: 24px; }

/* галерея */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery.few { grid-template-columns: repeat(auto-fill, minmax(260px, 380px)); }
.gallery a { display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 2px solid #9cae63; background: var(--cream-2);
  transition: transform .15s, box-shadow .15s; cursor: zoom-in; }
.gallery a:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(60,70,20,.25); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb { position: fixed; inset: 0; background: rgba(28,32,14,.92); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; z-index: 50; }
.lb.open { display: flex; }
.lb-row { display: flex; align-items: center; gap: 14px; width: 100%; justify-content: center; }
.lb img { max-width: calc(100vw - 180px); max-height: calc(100vh - 140px); border-radius: 10px; border: 3px solid var(--cream); background: #222; }
.lb .round { flex: 0 0 52px; height: 52px; border-radius: 50%; border: 2px solid var(--green-b); background: var(--green); cursor: pointer; font-size: 26px; color: var(--brown-2); }
.lb-bar { display: flex; gap: 18px; align-items: center; color: var(--cream-2); font-size: 15px; }
.lb-bar a { color: #cfe0a0; }
@media (max-width: 700px) { .lb img { max-width: 100vw; } .lb .round { display: none; } }

/* файлы */
.file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--cream); border: 1px solid #c3cf96; border-radius: 12px; padding: 10px 14px; margin: 8px 0; color: var(--ink); text-decoration: none; }
.file:hover { text-decoration: none; border-color: var(--green-d); }
.file .ic { flex: 0 0 40px; height: 40px; border-radius: 10px; background: var(--green); display: flex; align-items: center; justify-content: center; }
.file .t { flex: 1 1 170px; min-width: 0; overflow-wrap: anywhere; }
.file b { display: block; color: var(--link); }
.file small { font-size: 13px; color: var(--muted); display: block; line-height: 1.35; }
.file .n { font-size: 13px; color: var(--muted); white-space: nowrap; margin-left: auto; }
/* в узкой боковой колонке — карточка в столбик */
.side .file { flex-direction: column; align-items: flex-start; }
.side .file .t { flex: none; width: 100%; }
.side .file .n { margin-left: 0; }
.side .file .ic { flex: none; width: 40px; }
.side .file small { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.files-list { list-style: none; padding: 0; margin: 0; }

/* дочерние страницы */
.entries { display: flex; flex-direction: column; gap: 4px; }
.entry { padding: 10px 0; border-top: 1px solid var(--line); }
.entry h3 { margin: 0; font-size: 21px; }
.entry .info { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.entry .ex { margin: 6px 0 0; font-size: 15px; color: #3f4a1c; }

/* комментарии */
.comment { padding: 10px 0; border-top: 1px solid var(--line); }
.comment .who { font-weight: 700; } .comment .when { font-size: 13px; color: var(--muted); margin-left: 8px; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.form input, .form textarea, .form select, .input {
  font: inherit; font-size: 16px; color: var(--ink); padding: 9px 11px; border-radius: 9px; border: 1px solid #b7c48a; background: #fff; }
.form .row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hp { position: absolute; left: -5000px; }
.notice { background: var(--cream-2); border: 1px dashed #8fa35a; border-radius: 12px; padding: 12px 16px; font-size: 15px; }

/* карта норки */
.earth { background: linear-gradient(var(--olive), var(--olive)) 0 0 / 100% 9px no-repeat, url(../img/map/map-rap.png) 0 9px repeat-x, var(--earth);
  padding: 0 24px 32px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.burrow { position: relative; width: 800px; max-width: 100%; }
.burrow > img { display: block; width: 100%; height: auto; }
.room { position: absolute; display: block; }
.room img { display: block; width: 100%; height: auto; transition: filter .15s, transform .15s; }
.room:hover img, .room:focus-visible img { filter: drop-shadow(0 0 2px #fff6c8) drop-shadow(0 0 9px #ffd860) brightness(1.1); transform: scale(1.05); }
.room .lbl { position: absolute; left: 50%; top: calc(100% - 4px); transform: translateX(-50%); white-space: nowrap; font: 17px var(--serif); color: var(--brown-2);
  background: var(--cream-2); border: 2px solid var(--green-b); border-radius: 10px; padding: 2px 10px; z-index: 2; opacity: 0; transition: opacity .15s; pointer-events: none; }
.room:hover .lbl, .room:focus-visible .lbl { opacity: 1; }
.room:hover { text-decoration: none; }
.hint { display: flex; align-items: center; gap: 10px; background: var(--cream-2); border: 2px solid var(--green-b); border-radius: 999px; padding: 10px 20px; font-size: 16px; color: #3f4a1c; max-width: 800px; }
.earth .menu { justify-content: center; max-width: 900px; }
.earth .foot { width: 100%; max-width: 1000px; border-top: 1px solid rgba(255,233,166,.35); color: #F7EED2; }
.earth .foot a { color: #FFE9A6; }

/* каталог книг */
.books { display: flex; flex-direction: column; gap: 14px; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #b7c48a; border-radius: 10px; padding: 0 12px; height: 44px; }
.search input { border: 0; outline: none; flex: 1; font: inherit; font-size: 16px; background: transparent; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 14px; padding: 6px 13px; border-radius: 999px; border: 1px solid #a9b87a; background: #fff; color: var(--ink); }
.pill:hover { text-decoration: none; border-color: var(--green-d); }
.pill.on { border: 2px solid var(--green-dd); background: var(--green-d); color: var(--cream); }
.selects { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; font-size: 14px; }
.selects label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.selects select { font: inherit; padding: 7px; border-radius: 8px; border: 1px solid #b7c48a; background: #fff; color: var(--ink); max-width: 240px; }
.booklist { border-top: 1px solid var(--line); }
.book { border-bottom: 1px solid var(--line); }
.book summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 11px 8px; cursor: pointer; }
.book summary::-webkit-details-marker { display: none; }
.book summary:hover { background: var(--cream-2); }
.spine { flex: 0 0 34px; height: 46px; border-radius: 3px 6px 6px 3px; box-shadow: inset 3px 0 0 rgba(0,0,0,.2); }
.bt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bt b { font-size: 17px; color: var(--brown-2); }
.bt small { font-size: 14px; color: #3f4a1c; }
.bp { flex: 0 0 170px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.bp em { font-style: normal; align-self: flex-start; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #E9D9CF; color: #6e2f14; }
.bs { font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.br { flex: 0 0 74px; color: #a8650f; letter-spacing: 1px; }
.bd { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 2px 8px 16px 56px; font-size: 14px; color: #3f4a1c; }
.bd .wide { flex-basis: 100%; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn.danger { background: transparent; border: 1px solid #c79a8a; color: #8a2f14; text-shadow: none; box-shadow: none; }
@media (max-width: 700px) { .bp, .br { display: none; } .bd { padding-left: 8px; } }

dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 480px; max-width: 100vw; border: 0; padding: 22px 24px; background: var(--cream); box-shadow: -8px 0 24px rgba(0,0,0,.2); overflow-y: auto; }
dialog.drawer::backdrop { background: rgba(40,44,20,.45); }
dialog .card-head h2 { margin: 0; font-size: 26px; }
.x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #a9b87a; background: transparent; cursor: pointer; font-size: 20px; line-height: 1; }
.x:disabled { opacity: .35; cursor: not-allowed; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 4px; }
.radios label { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 14px !important; color: var(--ink) !important;
  border: 1px solid #a9b87a; border-radius: 999px; padding: 6px 12px; background: #fff; cursor: pointer; }
.radios input { accent-color: var(--green-d); }
.stars { align-items: center; }
.stars label { flex-direction: row !important; cursor: pointer; font-size: 26px !important; color: #c9b68a !important; }
.stars label.none { font-size: 13px !important; color: var(--muted) !important; margin-left: 6px; gap: 4px !important; align-items: center; }
.stars input { position: absolute; opacity: 0; }
.stars label.lit { color: #b8741c !important; }
.place { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.place .input { flex: 1; min-width: 0; }
.place .cnt { font-size: 13px; color: var(--muted); width: 56px; text-align: right; }
.place .pub { display: flex !important; flex-direction: row !important; align-items: center; gap: 4px !important; font-size: 13px !important; color: #3f4a1c !important; }
.err { color: #8a2f14; margin: 0; min-height: 1em; font-size: 14px; }

/* файлы и ссылки под текстом */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.files-grid .file { margin: 0; align-items: flex-start; }
.files-grid .file small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.links { margin: 0; padding: 0; list-style: none; columns: 2 320px; column-gap: 28px; }
.links li { break-inside: avoid; padding: 6px 0 6px 22px; position: relative; font-size: 16px; line-height: 1.4; }
.links li::before { content: "→"; position: absolute; left: 0; color: var(--muted); }
.links small { color: var(--muted); font-size: 13px; }
