/* Будка — «Журнал». Один файл стилей вместо style.css + link.css + login.css + плагинов. */

:root {
  --bg: #efefea;
  --paper: #ffffff;
  --ink: #111111;
  --ink-2: #3d3d38;
  --muted: #55554f;
  --line: #d9d9d2;
  --accent: #ff6a2b;
  --accent-ink: #111111;
  --dark: #111111;
  --dark-2: #222222;
  --dark-text: #f4f4ef;
  --dark-muted: #b9b9b2;
  --pos: #2f7a1f;
  --neg: #c0392b;
  --on-ink: #ffffff;      /* текст на кнопках цвета --ink */
  --ink-hover: #2a2a2a;
  --paper-2: #fafaf7;     /* панели инструментов, наведение на белом */
  --tint: #fff7f2;
  --error-bg: #ffe1d9;
  --error-ink: #7a1d0b;
  --shadow: var(--shadow);
  --backdrop: rgba(17,17,17,.55);
  --hover: rgba(0,0,0,.06);
  color-scheme: light;
  --radius: 22px;
  --radius-sm: 14px;
  --gap: 20px;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Темная тема: по настройке системы, либо выбрана вручную (html[data-theme], см. assets/theme.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --paper: #1f1f1d;
    --ink: #ecebe5;
    --ink-2: #cfcec7;
    --muted: #a6a59d;
    --line: #36362f;
    --accent: #ff6a2b;
    --accent-ink: #111111;
    --dark: #2c2c28;
    --dark-2: #3b3b36;
    --dark-text: #f4f4ef;
    --dark-muted: #bdbcb4;
    --pos: #7fcf62;
    --neg: #ff8a7a;
    --on-ink: #111111;
    --ink-hover: #d4d3cc;
    --paper-2: #282825;
    --tint: #2b1e17;
    --error-bg: #3d1b12;
    --error-ink: #ffb8a6;
    --shadow: rgba(0,0,0,.5);
    --backdrop: rgba(0,0,0,.7);
    --hover: rgba(255,255,255,.09);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312;
  --paper: #1f1f1d;
  --ink: #ecebe5;
  --ink-2: #cfcec7;
  --muted: #a6a59d;
  --line: #36362f;
  --accent: #ff6a2b;
  --accent-ink: #111111;
  --dark: #2c2c28;
  --dark-2: #3b3b36;
  --dark-text: #f4f4ef;
  --dark-muted: #bdbcb4;
  --pos: #7fcf62;
  --neg: #ff8a7a;
  --on-ink: #111111;
  --ink-hover: #d4d3cc;
  --paper-2: #282825;
  --tint: #2b1e17;
  --error-bg: #3d1b12;
  --error-ink: #ffb8a6;
  --shadow: rgba(0,0,0,.5);
  --backdrop: rgba(0,0,0,.7);
  --hover: rgba(255,255,255,.09);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 8px; color: var(--on-ink); }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 24px;
  border: 2px solid transparent; background: none; cursor: pointer;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn--ink { background: var(--ink); color: var(--on-ink); }
.btn--ink:hover { background: var(--ink-hover); color: var(--on-ink); }
.btn--line { border-color: var(--ink); color: var(--ink); }
.btn--line:hover { background: var(--paper); }
.btn--ghost { color: var(--ink); }
.btn--ghost:hover { background: var(--hover); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--big { min-height: 56px; padding: 0 36px; border-radius: 28px; border-color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 16px; }
.btn--big:hover { background: var(--ink); color: var(--on-ink); }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: inherit; }
.link--danger { color: var(--neg); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 22px; background: none; cursor: pointer; }
.icon-btn:hover { background: var(--hover); }

/* ---------------------------------------------------------------- шапка */
.site-head { padding-top: 28px; }
.site-head__top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo {
  font-family: var(--display); font-weight: 900; font-size: 44px; line-height: 1;
  letter-spacing: -0.04em; text-decoration: none; color: var(--ink);
}
.logo span { color: var(--accent); }
.logo--small { font-size: 26px; }
.tagline { margin: 0; max-width: 220px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.site-head__actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.cats {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 28px; padding-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 15px;
  border-radius: 22px; background: var(--paper); color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 15px; cursor: pointer; list-style: none;
}
.pill::-webkit-details-marker { display: none; }
.pill:hover { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.pill.is-active { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.pill--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }

.more { position: relative; }
.more summary::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.more[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.more__menu {
  position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; min-width: 220px;
  display: flex; flex-direction: column; padding: 8px; border-radius: 18px;
  background: var(--paper); box-shadow: 0 12px 40px var(--shadow);
}
.more__menu a { padding: 11px 14px; border-radius: 12px; text-decoration: none; font-weight: 500; }
.more__menu a:hover, .more__menu a.is-active { background: var(--bg); }

/* ---------------------------------------------------------------- лента */
main.wrap { padding-top: 28px; padding-bottom: 64px; }
.feed-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.feed-head h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; }
.feed-head .btn { margin-left: auto; }

/* Без JS — одна колонка в порядке записей; JS раскладывает «кирпичами» (см. app.js). */
.feed { display: grid; gap: var(--gap); max-width: 720px; margin: 0 auto; }
.feed.is-masonry { display: flex; align-items: flex-start; gap: var(--gap); max-width: none; }
.feed__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }

.feed-more { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 36px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; align-items: center; }
.pager__n { min-width: 40px; height: 40px; padding: 0 8px; display: grid; place-items: center; border-radius: 20px; text-decoration: none; font-size: 14px; color: var(--muted); }
.pager__n:hover { background: var(--paper); color: var(--ink); }
.pager__n.is-current { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.pager__gap { color: var(--muted); padding: 0 4px; }

/* ---------------------------------------------------------------- карточки */
.card { background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.card__inner { padding: 24px 26px 22px; }
.card__cover { display: block; background: var(--line); }
.card__cover img { display: block; width: 100%; max-height: 520px; object-fit: cover; }

.card__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.card__cat { font-weight: 600; color: var(--ink); text-decoration: none; }
.card__cat:hover { text-decoration: underline; }
.card__num { color: inherit; text-decoration: none; white-space: nowrap; }
.card__num:hover { color: var(--ink); text-decoration: underline; }

.card__foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-size: 14px; flex-wrap: wrap; }
.card__replies { font-weight: 600; }
.card__views { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-left: auto; font-size: 13px; }
.card__where { min-width: 0; }
.card__seen svg { vertical-align: -2px; margin-right: 4px; }
.card__sum { font-weight: 600; text-decoration: none; }
.sm-only, .card__sum, .write-bar { display: none; }
.card__more { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 14px; }

.card__thread { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.card__thread-more { font-size: 13px; color: var(--muted); }
.reply-mini { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 16px; }
.reply-mini__meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* плакат: короткий текст крупно на акцентном фоне */
.card--poster { background: var(--accent); color: var(--accent-ink); }
.card--poster .card__meta, .card--poster .card__cat, .card--poster .card__views { color: var(--accent-ink); }
.card--poster .card__meta { font-weight: 600; }
.card--poster .vote__btn { background: rgba(255,255,255,.35); }
.card--poster .vote__n.is-pos, .card--poster .vote__n.is-neg { color: var(--accent-ink); }

/* темная карточка — для ритма ленты */
.card--ink { background: var(--dark); color: var(--dark-text); }
.card--ink a, .card--ink .card__cat { color: var(--dark-text); }
.card--ink .card__meta, .card--ink .card__views, .card--ink .reply-mini__meta, .card--ink .card__thread-more { color: var(--dark-muted); }
.card--ink .reply-mini { background: var(--dark-2); }
.card--ink .vote__btn { background: var(--dark-2); color: var(--dark-text); }
.card--ink .vote__n.is-pos { color: #8fd16f; }
.card--ink .vote__n.is-neg { color: #ff8a7a; }
.card--ink .prose a.reply-ref { color: var(--accent); }

.card--invite { background: transparent; border: 2px dashed var(--ink); }
.invite__title { margin: 0 0 6px; font-family: var(--display); font-size: 20px; font-weight: 700; }
.invite__fake {
  display: block; width: 100%; margin-top: 14px; min-height: 84px; padding: 14px;
  border: 0; border-radius: var(--radius-sm); background: var(--paper); color: var(--muted);
  text-align: left; cursor: text; font-size: 15px;
}

.card--single { border-radius: 26px; }
.card--single .card__inner { padding: 30px 34px 26px; }

/* ---------------------------------------------------------------- текст поста */
.prose { overflow-wrap: anywhere; font-size: 16px; line-height: 1.6; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose details, .prose figure { margin: 0 0 .8em; }
.prose h3, .prose h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; margin: .2em 0 .5em; }
.prose h3 { font-size: 22px; }
.prose h4 { font-size: 18px; }
.prose img { display: block; margin: 12px auto; border-radius: 12px; cursor: zoom-in; }
.prose img[data-nolightbox] { cursor: default; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--ink-2); }
.prose pre { background: var(--bg); padding: 12px 14px; border-radius: 12px; overflow-x: auto; font-size: 14px; }
.prose .center { text-align: center; }
.prose details { background: var(--bg); border-radius: 12px; padding: 10px 14px; }
.prose summary { cursor: pointer; font-weight: 600; }
.prose details[open] summary { margin-bottom: 6px; }
.prose audio { width: 100%; margin: 6px 0; }
.prose figcaption { font-size: 14px; font-weight: 600; }
.prose .embed { position: relative; aspect-ratio: 16 / 9; margin: 12px 0; border-radius: 12px; overflow: hidden; background: #000; }
.prose .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose .table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 6px 10px; }
.card--ink .prose details, .card--ink .prose pre { background: var(--dark-2); }

.prose--poster { font-family: var(--display); font-weight: 700; font-size: 25px; line-height: 1.22; letter-spacing: -0.02em; }
.card--quote .prose--poster { font-weight: 500; font-size: 21px; line-height: 1.3; }
.prose--large { font-size: 18px; line-height: 1.65; }
.prose--small { font-size: 15px; line-height: 1.5; }
.prose--small img { max-height: 220px; width: auto; margin: 8px 0; }
.prose.is-clamped { max-height: 24em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* ---------------------------------------------------------------- голосование */
.vote { display: inline-flex; align-items: center; gap: 6px; }
.vote__btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 20px; background: var(--bg); color: var(--ink); cursor: pointer;
}
.vote__btn:hover:not(:disabled) { background: var(--ink); color: var(--on-ink); }
.vote__btn:disabled { opacity: .35; cursor: default; }
.vote__n { min-width: 34px; text-align: center; font-weight: 700; }
.vote__n.is-pos { color: var(--pos); }
.vote__n.is-neg { color: var(--neg); }

.own { position: relative; }
.own summary { list-style: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 18px; cursor: pointer; }
.own summary::-webkit-details-marker { display: none; }
.own summary:hover { background: var(--hover); }
.card--ink .own summary:hover, .card--poster .own summary:hover { background: rgba(255,255,255,.15); }
.own__menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 10; display: flex; flex-direction: column; min-width: 170px; padding: 6px; border-radius: 14px; background: var(--paper); box-shadow: 0 10px 30px var(--shadow); }
.own__menu--left { right: auto; left: 0; }
.own__menu--down { bottom: auto; top: calc(100% + 6px); }
.own__menu button { text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--ink); }
.own__menu button:hover { background: var(--bg); }
.own__menu button[data-delete] { color: var(--neg); }

/* редактирование на месте */
.inline-edit { display: flex; flex-direction: column; gap: 10px; }
.inline-edit__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------------------------------------------------------- страница записи */
.single { max-width: 780px; margin: 0 auto; }
.back { display: inline-block; margin-bottom: 16px; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.replies { margin-top: 34px; }
.replies h2 { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 0 0 16px; }
.reply { background: var(--paper); border-radius: 18px; padding: 18px 22px; margin-bottom: 10px; scroll-margin-top: 20px; }
.reply:target { box-shadow: 0 0 0 3px var(--accent); }
.reply__meta { display: flex; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.reply__num { font-weight: 600; color: var(--ink); text-decoration: none; }
.reply__foot { display: flex; align-items: center; gap: 16px; margin-top: 10px; font-size: 14px; flex-wrap: wrap; }
.reply__foot .vote__btn { width: 34px; height: 34px; }
.reply-form { margin-top: 22px; padding: 22px; border: 2px dashed var(--ink); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.reply-form h3 { margin: 0; font-family: var(--display); font-size: 18px; }
.reply-form .editor { width: 100%; }

/* ---------------------------------------------------------------- редактор */
.editor { border-radius: var(--radius-sm); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.editor:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.editor.is-drop { box-shadow: inset 0 0 0 3px var(--accent); background: var(--tint); }
.editor textarea[aria-busy="true"] { opacity: .6; }
.editor__bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.editor__bar button { min-width: 38px; height: 38px; padding: 0 8px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-size: 14px; color: var(--ink); display: grid; place-items: center; }
.editor__bar button:hover { background: var(--bg); }
.editor textarea { display: block; width: 100%; border: 0; padding: 14px; resize: vertical; min-height: 110px; background: transparent; outline: none; font-size: 16px; line-height: 1.55; }

/* ---------------------------------------------------------------- визуальный редактор (Quill) */
.rich { border-radius: var(--radius-sm); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.rich:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.rich__loading { margin: 0; padding: 16px; font-size: 14px; }
.rich textarea { display: block; width: 100%; border: 0; padding: 14px; min-height: 160px; resize: vertical; font-size: 16px; line-height: 1.55; outline: none; background: transparent; }
.rich textarea[hidden] { display: none; } /* поле для отправки формы; видно только в запасном режиме без Quill */
.rich .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); background: var(--paper-2); padding: 6px; font-family: var(--body); }
.rich .ql-toolbar.ql-snow .ql-formats { margin-right: 8px; }
.rich .ql-toolbar.ql-snow button { width: 36px; height: 36px; padding: 8px; border-radius: 10px; }
.rich .ql-toolbar.ql-snow button:hover { background: var(--bg); }
.rich .ql-toolbar.ql-snow button.ql-active { background: var(--bg); color: var(--ink); }
.rich .ql-toolbar.ql-snow button.ql-spoiler { width: auto; padding: 0 10px; font-size: 13px; color: var(--ink); }
.rich .ql-container.ql-snow { border: 0; font-family: var(--body); font-size: 16px; }
.rich .ql-editor { min-height: 220px; max-height: 55vh; overflow-y: auto; padding: 14px 16px; line-height: 1.6; color: var(--ink); }
.inline-edit .rich .ql-editor { max-height: 70vh; }
.rich .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; left: 16px; right: 16px; }
.rich .ql-editor img { display: block; max-width: 100%; max-height: 420px; margin: 10px 0; border-radius: 10px; }
.rich .ql-editor .ql-video { display: block; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 10px; margin: 10px 0; background: #111; }
.rich .ql-editor h3 { font-family: var(--display); font-size: 20px; }
.rich .ql-editor blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--ink-2); }
.rich .ql-editor[aria-busy="true"] { opacity: .6; cursor: progress; }
.rich .ql-snow .ql-tooltip { z-index: 5; border-radius: 12px; box-shadow: 0 8px 24px var(--shadow); border-color: var(--line); background: var(--paper); color: var(--ink); }
.rich .ql-snow .ql-tooltip input[type=text] { font-size: 15px; }

/* ---------------------------------------------------------------- формы, диалоги */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea { font-weight: 400; font-size: 16px; min-height: 48px; padding: 10px 14px; border: 0; border-radius: var(--radius-sm); background: var(--bg); }
.field textarea { resize: vertical; }
.modal { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 26px; background: var(--paper); color: var(--ink); }
.modal::backdrop { background: var(--backdrop); }
.modal__body { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__head h2 { margin: 0; font-family: var(--display); font-size: 22px; }
.modal__body > .muted { margin: -6px 0 0; font-size: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; }
.modal .field select { background: var(--bg); }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(0,0,0,.88); }
.lightbox img { display: block; max-width: 94vw; max-height: 90vh; border-radius: 10px; cursor: zoom-out; }
.lightbox__close { position: fixed; top: 12px; right: 12px; color: #fff; background: rgba(255,255,255,.12); }

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 16px; font-size: 15px; box-shadow: 0 10px 30px var(--shadow); max-width: min(480px, calc(100vw - 32px)); animation: toast-in .2s ease; }
.toast--error { background: var(--neg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.filters__row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.filters__row .muted { margin-right: 4px; }

.empty { text-align: center; padding: 60px 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.empty__big { margin: 0; font-family: var(--display); font-weight: 700; font-size: 28px; }
.empty__huge { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(64px, 14vw, 140px); line-height: 1; color: var(--accent); }
.empty__text { margin: 0; max-width: 460px; color: var(--ink-2); font-size: 17px; }

.narrow { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.form .card__inner { display: flex; flex-direction: column; gap: 14px; }
.form h1, .form h2, .narrow h1 { margin: 0; font-family: var(--display); font-size: 22px; }
.narrow form { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { margin: 0; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--paper); font-weight: 600; }
.alert--error { background: var(--error-bg); color: var(--error-ink); }

/* ---------------------------------------------------------------- подвал */
.site-foot { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 40px; border-top: 2px solid var(--ink); font-size: 14px; color: var(--muted); }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-foot p { margin: 0 0 0 auto; }

/* Quill в темной теме: иконки и выпадашки берут цвета темы */
.rich .ql-snow .ql-stroke { stroke: var(--ink); }
.rich .ql-snow .ql-fill { fill: var(--ink); }
.rich .ql-snow .ql-picker { color: var(--ink); }
.rich .ql-snow .ql-picker-options { background: var(--paper); border-color: var(--line); }
.rich .ql-snow .ql-tooltip input[type=text] { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
.rich .ql-snow a { color: var(--ink); }

/* Quill: подсказка ссылки по-русски */
.rich .ql-snow .ql-tooltip::before { content: "Ссылка:"; }
.rich .ql-snow .ql-tooltip[data-mode=link]::before { content: "Адрес ссылки:"; }
.rich .ql-snow .ql-tooltip[data-mode=video]::before { content: "Ссылка на видео:"; }
.rich .ql-snow .ql-tooltip a.ql-action::after { content: "Изменить"; border-right-color: var(--line); }
.rich .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Сохранить"; }
.rich .ql-snow .ql-tooltip a.ql-remove::before { content: "Убрать"; }

/* переключатель темы в подвале */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 20px; background: var(--paper); }
.theme-switch button { border: 0; background: none; padding: 6px 12px; border-radius: 16px; cursor: pointer; font-size: 13px; color: var(--muted); }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }

/* черновик и счетчик под полем ввода */
.draft-bar { display: flex; justify-content: space-between; gap: 12px; min-height: 20px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.draft-bar__count { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.draft-bar__count.is-over { color: var(--neg); font-weight: 600; }
.draft-bar .link { font-size: 13px; }

/* «Наверх» */
.to-top { position: fixed; right: 20px; bottom: 24px; z-index: 19; width: 48px; height: 48px; border-radius: 24px; border: 0; display: grid; place-items: center; background: var(--paper); color: var(--ink); box-shadow: 0 6px 20px var(--shadow); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.to-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--ink); color: var(--on-ink); }

/* очередь публикаций в админке */
.queue { margin: 28px 0 0; display: flex; flex-direction: column; gap: 14px; }
.queue__when, .queue__cats, .queue__recent { margin: 0; }
.queue .card h3 { margin: 0 0 8px; font-size: 17px; }
.queue__stream-meta { font-size: 14px; font-weight: 400; margin-left: 6px; }
.queue .card .queue__when { margin-bottom: 12px; }
.queue__cats { display: flex; gap: 6px; flex-wrap: wrap; }
.queue__cats .pill { cursor: default; }
.queue__list { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 12px; }
.queue__item summary { cursor: pointer; }
.queue__preview { margin: 10px 0; padding: 12px 16px; border-radius: 12px; background: var(--bg); max-height: 320px; overflow: auto; }
.queue__actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; font-size: 14px; }
.queue__add > summary { cursor: pointer; list-style: none; }
.queue__add > summary::-webkit-details-marker { display: none; }
.queue__add form { display: flex; flex-direction: column; gap: 14px; padding-top: 0; padding-bottom: 26px; }
.queue__add form .btn { align-self: flex-start; margin-top: 4px; }

/* статистика в админке */
.stats { margin: 28px 0; display: flex; flex-direction: column; gap: 16px; }
.stats h3 { margin: 0 0 12px; font-size: 17px; }
.stats__head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stats__head h2 { margin: 0; font-family: var(--display); font-size: 26px; }
.stats__period { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { background: var(--paper); border-radius: var(--radius-sm); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat-card__n { font-family: var(--display); font-weight: 700; font-size: 28px; font-variant-numeric: tabular-nums; }
.stat-card__label { color: var(--muted); font-size: 13px; }
.stat-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }
.stat-chart { margin: 0; }
.stat-chart figcaption { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.stat-chart figcaption b { color: var(--ink); }
.stat-chart__bars { display: block; width: 100%; height: 120px; border-bottom: 1px solid var(--line); }
.stat-chart__bars rect { fill: var(--ink); opacity: .85; }
.stat-chart__bars rect.is-today { fill: var(--accent); opacity: 1; }
.stat-chart__bars rect:hover { opacity: 1; }
.stat-chart__axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-cats { display: grid; grid-template-columns: max-content 1fr max-content; gap: 8px 14px; align-items: center; font-size: 14px; }
.stat-cats__bar { display: block; width: 100%; height: 10px; border-radius: 5px; overflow: hidden; }
.stat-cats__bar rect { fill: var(--accent); }
.stat-cats__bar rect.bg { fill: var(--bg); }
.stat-cats__n { font-variant-numeric: tabular-nums; text-align: right; }
.stat-tops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stat-top ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.stat-top li a { display: block; text-decoration: none; font-weight: 500; }
.stat-top li a:hover { text-decoration: underline; }
.stat-top .muted { font-size: 12px; }
.stat-top__more { margin-top: 14px; min-height: 40px; padding: 0 18px; font-size: 14px; }

/* поиск */
.btn--icon { width: 48px; padding: 0; justify-content: center; }
.search-form { display: flex; gap: 10px; margin-bottom: 18px; }
.search-form__input { flex: 1; min-width: 0; min-height: 52px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 26px; background: var(--paper); color: var(--ink); font: inherit; font-size: 17px; }
.search-form__input:focus { outline: none; box-shadow: 0 0 0 4px rgba(255,106,43,.35); }
.search-form .btn { min-height: 52px; padding: 0 26px; }
.search-note { margin: 0 0 18px; color: var(--muted); }

/* «Этот день в Будке» */
.archive { margin: 4px 0 24px; }
.archive__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.archive__title { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.archive__sub { color: var(--muted); font-size: 14px; }
.archive__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.archive__item { scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; min-height: 170px; padding: 18px 20px; border-radius: var(--radius-sm, 16px); background: var(--paper); color: var(--ink); text-decoration: none; transition: transform .15s; }
.archive__item:hover { transform: translateY(-2px); color: var(--ink); }
.archive__top { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.archive__ago { padding: 4px 10px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; }
.archive__item:first-child .archive__ago { background: var(--accent); color: var(--accent-ink); }
.archive__meta { font-size: 12px; color: var(--muted); }
.archive__img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }
.archive__text { font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- мобильный */
@media (max-width: 700px) {
  .wrap { padding: 0 12px; }
  .site-head { padding-top: 16px; }
  .logo { font-size: 30px; }
  .tagline { display: none; }
  .site-head__actions .btn--line span { display: none; }
  .site-head__actions .btn--line { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .site-head__actions .btn--ink { min-height: 44px; padding: 0 16px; }
  .cats { flex-wrap: nowrap; overflow-x: auto; margin: 14px -12px 0; padding: 0 12px 14px; scrollbar-width: none; border-bottom-width: 0; }
  .cats::-webkit-scrollbar { display: none; }
  .pill { flex: 0 0 auto; min-height: 40px; padding: 0 16px; font-size: 14px; }
  .more { position: static; }
  .more__menu { left: 12px; right: 12px; top: auto; }
  main.wrap { padding-top: 8px; padding-bottom: 40px; }
  .site-head__top { flex-wrap: nowrap; gap: 10px; }
  .site-head__actions { flex-wrap: nowrap; gap: 8px; }
  .hide-sm { display: none; }
  .card__inner { padding: 20px; }
  .card--single .card__inner { padding: 22px 20px; }
  .prose--poster { font-size: 21px; }
  .prose--large { font-size: 17px; }
  .feed-head h1 { font-size: 26px; }
  .site-foot { padding-top: 20px; padding-bottom: 28px; gap: 14px; }
  .site-foot p { margin-left: 0; }

  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tops { grid-template-columns: 1fr; }
  .stat-card__n { font-size: 22px; }

  /* компактно: шапка блока в строку, карточки низкие, следующая выглядывает справа — видно, что листается */
  .archive { margin: 0 0 18px; }
  .archive__head { gap: 8px; margin-bottom: 10px; }
  .archive__title { font-size: 17px; }
  .archive__sub { font-size: 13px; }
  .archive__row { grid-auto-columns: 82%; gap: 10px; align-items: stretch; margin: 0 -12px; padding: 0 12px 4px; scroll-padding: 0 12px; scrollbar-width: none; }
  .archive__row::-webkit-scrollbar { display: none; }
  .archive__item { min-height: 0; padding: 14px 16px; gap: 8px; display: grid; grid-template-columns: 1fr; align-content: start; }
  .archive__item.has-img { grid-template-columns: 64px 1fr; column-gap: 12px; }
  .archive__top { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
  .archive__ago { flex: 0 0 auto; padding: 3px 9px; font-size: 11px; }
  .archive__meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .archive__date { display: none; }
  .archive__img { width: 64px; height: 64px; border-radius: 10px; }
  .archive__text { font-size: 14px; line-height: 1.4; -webkit-line-clamp: 3; }

  /* как в макете C-mobile */
  .sm-only { display: inline; }
  .card__seen { white-space: nowrap; }
  .card__meta .card__cat { font-weight: 700; color: var(--ink); }
  .card--ink .card__meta .card__cat { color: var(--dark-text); }
  .card--poster .card__meta .card__cat { color: var(--accent-ink); }
  .card__foot { gap: 8px; }
  .card__foot .card__views { display: none; }
  .card__replies { margin-left: auto; text-decoration: none; }
  .card--poster .card__foot .vote, .card--poster .card__foot .card__replies { display: none; }
  .card--poster .card__sum { display: inline; font-size: 13px; color: var(--accent-ink); }
  .card--poster .card__foot { margin-top: 14px; }
  .card--poster .own { margin-left: auto; }
  .write-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 40%); }
  .write-bar .btn { width: 100%; min-height: 54px; border-radius: 27px; font-size: 16px; }
  body:has(.write-bar) .site-head__actions .btn--ink, body:has(.write-bar) .card--invite { display: none; }
  body:has(.write-bar) .site-foot { padding-bottom: 104px; }
  .to-top { right: 14px; bottom: 20px; width: 44px; height: 44px; }
  body:has(.write-bar) .to-top { bottom: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
