/* Нижний регистр — оформление.
   Костяная бумага, глубокий тёмно-зелёный вместо чёрного, огненный акцент.
   Каждому разделу — свой цвет метки, всё остальное держится спокойным. */

:root {
    --bone: #FBF8F3;
    --bone-deep: #F2EDE4;
    --surface: #FFFFFF;
    --ink: #0F1B1A;
    --ink-2: #4A5654;
    --ink-3: #7C8785;
    --line: #E7E1D6;
    --flame: #FF4A1C;
    --flame-dark: #DB3910;
    --teal: #0E7C6B;
    --violet: #6248FF;
    --mustard: #E3A008;

    --display: "Unbounded", "Manrope", system-ui, sans-serif;
    --ui: "Manrope", system-ui, -apple-system, sans-serif;
    --read: "Lora", Georgia, serif;

    --wrap: 1240px;
    --narrow: 720px;
    --r-lg: 28px;
    --r-md: 18px;
    --r-sm: 10px;
    --shadow: 0 24px 50px -32px rgba(15, 27, 26, 0.45);
    --shadow-hi: 0 30px 60px -28px rgba(15, 27, 26, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bone);
    color: var(--ink);
    font-family: var(--ui);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, video, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

:focus-visible { outline: 3px solid var(--flame); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - 40px, var(--narrow)); margin-inline: auto; }

.skip {
    position: fixed; left: -9999px; top: 12px; z-index: 60;
    background: var(--ink); color: var(--bone); padding: 12px 18px; border-radius: 999px;
}
.skip:focus { left: 16px; }

/* Атрибут hidden всегда прячет элемент, какие бы стили ни стояли. */
[hidden] { display: none !important; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Шапка ----------
   Два яруса. Сверху знак, слоган, поиск и кнопка письма — всё на одной
   оси по высоте 42px. Снизу полоса разделов: цветная точка у каждого
   раздела повторяет метку на карточках. Полоса прилипает к верху. */

.masthead { background: var(--bone); }
.masthead__inner { display: flex; align-items: center; gap: 18px; min-height: 76px; }

.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand__mark { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.brand__name {
    font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em;
    line-height: 1; white-space: nowrap;
}

.slogan {
    display: flex; align-items: center; min-height: 26px;
    padding-left: 18px; border-left: 1px solid var(--line);
    font-family: var(--display); font-weight: 500; font-size: 14px; letter-spacing: -0.01em;
    color: var(--ink-3); white-space: nowrap;
}

.masthead__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.searchbox { position: relative; display: flex; align-items: center; }
.searchbox__icon { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.searchbox input[type="search"] {
    width: 230px; height: 42px; padding: 0 16px 0 40px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font-size: 15px; transition: width .2s, border-color .2s, box-shadow .2s;
}
.searchbox input[type="search"]:focus { width: 290px; }
.searchbox input::placeholder { color: var(--ink-3); }

.iconbtn {
    display: none; width: 42px; height: 42px; flex: none; place-items: center; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer;
}
.iconbtn:hover, .iconbtn[aria-expanded="true"] { border-color: var(--ink); }

.sectionbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(251, 248, 243, 0.9);
    backdrop-filter: saturate(140%) blur(12px);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sectionbar__inner { display: flex; align-items: center; gap: 4px; min-height: 54px; }
.sectionbar__link {
    display: inline-flex; align-items: center; gap: 9px; flex: none;
    height: 38px; padding: 0 15px 0 13px; border-radius: 999px;
    font-weight: 700; font-size: 15px; color: var(--ink-2); white-space: nowrap;
    transition: background .18s, color .18s;
}
.sectionbar__link::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--flame)); flex: none;
}
.sectionbar__link:first-child { margin-left: -13px; }
.sectionbar__link:hover { background: var(--bone-deep); color: var(--ink); }
.sectionbar__link.is-active { background: var(--ink); color: var(--bone); }
.sectionbar__link.is-active::before { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px rgba(251, 248, 243, .5); }

.flashes { padding-top: 18px; }
.flashes .flash { margin: 0 0 10px; }

/* ---------- Кнопки ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
    padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
    background: var(--bone-deep); color: var(--ink); cursor: pointer;
    transition: transform .16s ease, background .18s, box-shadow .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--accent { background: var(--flame); color: #fff; box-shadow: 0 12px 24px -14px rgba(255, 74, 28, 0.9); }
.btn--accent:hover { background: var(--flame-dark); }
.btn--ink { background: var(--ink); color: var(--bone); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--lg { font-size: 17px; padding: 15px 26px; }
/* Компактная кнопка: та же высота, что у поиска, — шапка стоит на одной линии. */
.btn--sm { height: 42px; padding: 0 18px 0 16px; font-size: 14px; gap: 8px; }
.btn--sm svg { flex: none; }
.btn--sm.btn--accent { box-shadow: 0 8px 18px -12px rgba(255, 74, 28, 0.9); }
.btn--block { width: 100%; }
.btn--danger { background: #C4320A; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Метки разделов ---------- */

.chip {
    display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
    font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
    color: var(--ink-2);
}
.chip::before {
    content: ""; width: 9px; height: 9px; border-radius: 50%;
    background: var(--chip, var(--flame));
}
.chip--solid {
    background: var(--chip, var(--flame)); color: #fff;
    padding: 7px 14px; border-radius: 999px; font-size: 13px;
}
.chip--solid::before { display: none; }

.badge {
    position: absolute; left: 14px; top: 14px;
    background: rgba(15, 27, 26, 0.82); color: #fff; backdrop-filter: blur(6px);
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 6px 11px; border-radius: 999px;
}
.badge--letter { background: var(--flame); }

/* ---------- Главный материал ---------- */

.hero { padding: 40px 0 46px; }

.hero__card {
    display: grid; grid-template-columns: 1.05fr 1fr; gap: 42px; align-items: center;
    background: var(--surface); border-radius: var(--r-lg); padding: 22px;
    box-shadow: var(--shadow);
}

.hero__media {
    position: relative; display: block; border-radius: var(--r-md); overflow: hidden;
    aspect-ratio: 5 / 4; background: var(--bone-deep);
}
.hero__media img, .hero__media video { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.hero__card:hover .hero__media img { transform: scale(1.03); }

.hero__text { display: flex; flex-direction: column; gap: 16px; padding: 10px 18px 10px 0; }
.hero__title {
    margin: 0; font-family: var(--display); font-weight: 700;
    font-size: clamp(30px, 3.6vw, 52px); line-height: 1.04; letter-spacing: -0.035em;
}
.hero__title a { background-image: linear-gradient(var(--flame), var(--flame)); background-size: 0 3px;
    background-repeat: no-repeat; background-position: 0 100%; transition: background-size .35s ease; }
.hero__title a:hover { background-size: 100% 3px; }
.hero__sub { margin: 0; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.5; color: var(--ink-2); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-3); }
.meta__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); opacity: .5; }

/* ---------- Заголовок ленты ---------- */

.rail { display: flex; align-items: baseline; gap: 18px; margin-bottom: 22px; }
.rail__title {
    margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.03em;
    font-size: clamp(22px, 2.4vw, 30px);
}
.rail__line { flex: 1; height: 1px; background: var(--line); }
.rail__more { font-weight: 700; font-size: 15px; color: var(--flame); }

/* ---------- Карточки ---------- */

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 26px; }
.cards--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card { display: flex; flex-direction: column; gap: 14px; }

.card__media {
    position: relative; display: block; border-radius: var(--r-md); overflow: hidden;
    aspect-ratio: 16 / 10; background: var(--bone-deep);
    box-shadow: 0 16px 30px -26px rgba(15, 27, 26, 0.7);
}
.card__media img, .card__media video { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__media--empty::after {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 74, 28, .16), transparent 60%),
        radial-gradient(circle at 75% 70%, rgba(98, 72, 255, .14), transparent 55%);
}

.card__body { display: flex; flex-direction: column; gap: 9px; }
.card__title {
    margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.03em;
    font-size: 21px; line-height: 1.18;
}
.card__title a { background-image: linear-gradient(var(--ink), var(--ink)); background-size: 0 2px;
    background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s ease; }
.card__title a:hover { background-size: 100% 2px; }
.card__sub { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.card__foot { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); margin-top: auto; padding-top: 4px; }

.card--wide { flex-direction: row; gap: 22px; align-items: flex-start; }
.card--wide .card__media { flex: 0 0 46%; aspect-ratio: 16 / 11; }

/* ---------- Реакции ---------- */

.reactions { margin: 46px 0 10px; }
.reactions__label { margin: 0 0 14px; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.reactions__row { display: flex; gap: 10px; flex-wrap: wrap; }

.react {
    display: inline-flex; align-items: center; gap: 9px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
    padding: 10px 16px; cursor: pointer; font-weight: 700; font-size: 15px; color: var(--ink);
    transition: transform .15s ease, border-color .2s, background .2s;
}
.react:hover { transform: translateY(-2px); border-color: var(--ink); }
.react.is-picked { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.react.is-picked .react__icon { color: #fff; }
.react__icon { width: 20px; height: 20px; flex: none; }
.react__name { color: var(--ink-3); font-weight: 600; font-size: 14px; }
.react.is-picked .react__name { color: rgba(251, 248, 243, .7); }

.reactions__hint { margin: 12px 0 0; font-size: 14px; color: var(--ink-3); }

.mini-reactions { display: inline-flex; gap: 8px; align-items: center; }
.mini-reactions span { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-3); }
.mini-reactions svg { width: 15px; height: 15px; }

/* ---------- Полоса писем ---------- */

.band {
    margin: 56px 0; padding: 34px; border-radius: var(--r-lg);
    background: var(--ink); color: var(--bone);
    display: flex; gap: 28px; align-items: center; flex-wrap: wrap;
    position: relative; overflow: hidden;
}
.band::after {
    content: ""; position: absolute; right: -60px; top: -80px; width: 320px; height: 320px;
    border-radius: 50%; background: rgba(255, 74, 28, .18);
}
.band__text { flex: 1 1 380px; position: relative; }
.band__text h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 600; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.03em; }
.band__text p { margin: 0; color: rgba(251, 248, 243, .74); font-size: 16px; }
.band__actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; }
.band .btn--ghost { border-color: rgba(251, 248, 243, .35); color: var(--bone); }
.band .btn--ghost:hover { border-color: var(--bone); }

/* ---------- Заголовки страниц ---------- */

.pagehead { padding: 44px 0 30px; display: flex; flex-direction: column; gap: 14px; }
.pagehead__title {
    margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.04em;
    font-size: clamp(34px, 5vw, 62px); line-height: 1.02;
}
.pagehead__lead { margin: 0; max-width: 60ch; font-size: 19px; line-height: 1.55; color: var(--ink-2); }
.pagehead__title--dot { display: flex; align-items: center; gap: 18px; }
.pagehead__title--dot::before {
    content: ""; flex: none; width: .32em; height: .32em; border-radius: 50%;
    background: var(--dot, var(--flame)); transform: translateY(.04em);
}
.pagehead__aside { margin: 0; font-size: 15px; color: var(--ink-3); }
.pagehead__aside a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.pagehead__aside a:hover { color: var(--flame); }

.empty {
    border: 1px dashed var(--line); border-radius: var(--r-md); padding: 40px;
    text-align: center; color: var(--ink-3); background: var(--surface);
}

/* ---------- Статья ---------- */

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; background: transparent; }
.progress__bar { height: 100%; width: 0; background: var(--flame); transition: width .1s linear; }

.post { padding-bottom: 40px; }
.post__head { padding: 44px 0 26px; display: flex; flex-direction: column; gap: 18px; }
.post__title {
    margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.04em;
    font-size: clamp(32px, 4.6vw, 58px); line-height: 1.03;
}
.post__sub { margin: 0; font-size: clamp(18px, 2vw, 22px); line-height: 1.45; color: var(--ink-2); }

/* Обложка: по центру, не шире 960px и не выше 70% экрана.
   Вертикальная картинка не займёт весь экран, горизонтальная не растянется на 1240px. */
.post__cover { width: min(100% - 40px, 960px); margin: 6px auto 12px; text-align: center; }
.post__cover-link { display: inline-block; max-width: 100%; cursor: zoom-in; }
.post__cover img, .post__cover video {
    display: block; margin: 0 auto; max-width: 100%; width: auto; height: auto;
    max-height: min(70vh, 640px); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.post__cover video { width: 100%; background: #000; }
.post__cover figcaption, .embed figcaption {
    margin: 12px auto 0; max-width: 560px; font-family: var(--ui); font-size: 14px; line-height: 1.5;
    color: var(--ink-3); text-align: center;
}
.embed figcaption a { color: inherit; }

.post__body { font-family: var(--read); font-size: 19px; line-height: 1.75; margin-top: 34px; }
.post__body p { margin: 0 0 24px; }
.post__body h2 {
    font-family: var(--display); font-weight: 600; letter-spacing: -0.03em;
    font-size: clamp(24px, 3vw, 32px); line-height: 1.2; margin: 44px 0 16px;
}
.post__body a { color: var(--flame); text-decoration: underline; text-underline-offset: 4px; }
.post__body blockquote {
    margin: 34px 0; padding: 0 0 0 26px; border-left: 4px solid var(--flame);
    font-family: var(--display); font-weight: 500; font-style: normal;
    font-size: clamp(21px, 2.4vw, 27px); line-height: 1.3; letter-spacing: -0.02em;
}
.post__body blockquote p { margin: 0; }
.post__body h3 {
    font-family: var(--display); font-weight: 600; letter-spacing: -0.02em;
    font-size: clamp(20px, 2.2vw, 24px); line-height: 1.25; margin: 36px 0 12px;
}
.post__body ul, .post__body ol { margin: 0 0 24px; padding-left: 1.4em; }
.post__body li { margin: 0 0 8px; padding-left: .2em; }
.post__body ul li::marker { color: var(--flame); }
.post__body ol li::marker { font-family: var(--ui); font-weight: 700; color: var(--ink-3); font-size: .85em; }
.post__body mark { background: #FFE58A; color: inherit; padding: 0 .12em; border-radius: 3px; }
.post__body s { text-decoration-thickness: 1.5px; color: var(--ink-2); }
.post__body .rule, .rule { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* Картинки в тексте — всегда по центру.
   Обычная: не шире колонки текста и не выше 70% экрана.
   Маленькая: до 380px. Широкая: выходит за колонку до 1040px. */
.embed { margin: 36px 0; }
.embed--img { text-align: center; }
.embed__zoom { position: relative; display: inline-block; max-width: 100%; cursor: zoom-in; vertical-align: top; }
.embed--img img {
    display: block; margin: 0 auto; max-width: 100%; width: auto; height: auto;
    max-height: min(70vh, 620px); border-radius: var(--r-md); box-shadow: var(--shadow);
}
.embed--small img { max-width: min(380px, 100%); max-height: 420px; }
.embed--wide { width: min(100vw - 40px, 1040px); margin-left: 50%; transform: translateX(-50%); }
.embed--wide img { max-height: min(78vh, 720px); }
.embed--video video, .embed video {
    display: block; width: 100%; max-height: 75vh; border-radius: var(--r-md); box-shadow: var(--shadow); background: #000;
}

.gallery { display: grid; gap: 8px; }
.gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery__item { display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--bone-deep); cursor: zoom-in; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.gallery__item:hover img { transform: scale(1.03); }
.embed--gallery { width: min(100vw - 40px, 880px); margin-left: 50%; transform: translateX(-50%); }
.embed__flag {
    position: absolute; left: 14px; top: 14px; background: var(--flame); color: #fff;
    font-family: var(--ui); font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 5px 11px; border-radius: 999px;
}
.embed__frame { position: relative; padding-top: 56.25%; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); }
.embed__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.crumbs { display: flex; gap: 10px; align-items: center; padding-top: 26px; font-size: 14px; color: var(--ink-3); }
.crumbs a:hover { color: var(--flame); }

.notice {
    margin: 0; background: #FFF4E5; border: 1px solid #F3D7AC; color: #6B4A06;
    padding: 14px 18px; border-radius: var(--r-sm); font-size: 15px;
}
.notice a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.meta__letter { color: var(--flame); font-weight: 700; }
.meta a:hover { color: var(--flame); }

.related { margin-top: 56px; }

/* Увеличение картинок по клику. */
.lightbox {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: 56px 72px; background: rgba(15, 27, 26, .92); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 12px; box-shadow: 0 30px 80px -30px #000; cursor: default; }
.lightbox__close, .lightbox__nav {
    position: absolute; display: grid; place-items: center; border: 0; cursor: pointer;
    width: 48px; height: 48px; border-radius: 50%; background: rgba(251, 248, 243, .12); color: var(--bone);
    font: 400 30px/1 var(--ui); transition: background .15s;
}
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(251, 248, 243, .24); }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__nav--prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox__nav[hidden] { display: none; }

/* ---------- Формы ---------- */

.form { display: flex; flex-direction: column; gap: 20px; }
.form__row { display: flex; gap: 18px; flex-wrap: wrap; }
.form__row > .field { flex: 1 1 240px; }
.form__foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.form__note { margin: 0; font-size: 14px; color: var(--ink-3); max-width: 58ch; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.field__hint { font-size: 13px; color: var(--ink-3); }
.field--check { flex-direction: row; align-items: center; gap: 10px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
    width: 100%; font: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 14px 16px; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(15, 27, 26, .07);
}
textarea { resize: vertical; line-height: 1.6; }
.field__big { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; }
input[type="file"] { border: 1px dashed var(--line); background: var(--surface); padding: 14px; border-radius: var(--r-sm); }

.trap { position: absolute; left: -9999px; opacity: 0; height: 1px; width: 1px; }

select {
    appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%234A5654' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
}

.fieldset { border: 0; margin: 0; padding: 26px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.fieldset__title { padding: 0; margin-bottom: 4px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }

/* Выбор темы сообщения — кнопки-метки. */
.topics { border: 0; margin: 0; padding: 0; }
.topics__row { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { position: relative; }
.topic input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.topic span {
    display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font-weight: 600; font-size: 15px; color: var(--ink-2); transition: background .15s, color .15s, border-color .15s;
}
.topic input:hover + span { border-color: var(--ink); }
.topic input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bone); }
.topic input:focus-visible + span { outline: 3px solid var(--flame); outline-offset: 2px; }

/* Обложка с предпросмотром. */
.coverpick { display: flex; flex-direction: column; gap: 10px; }
.coverpick__preview:empty { display: none; }
.coverpick__preview img, .coverpick__preview video {
    width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--r-sm); background: var(--bone-deep);
}
.coverpick__drop {
    position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 64px; padding: 12px 16px; border: 2px dashed var(--line); border-radius: var(--r-sm);
    background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.coverpick__drop:hover, .coverpick.is-over .coverpick__drop { border-color: var(--ink-3); background: var(--bone); }
.coverpick__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.coverpick__text { display: flex; flex-direction: column; font-size: 14px; color: var(--ink-3); }
.coverpick__text strong { color: var(--ink); font-size: 15px; }
.coverpick__input:focus-visible + .coverpick__text { outline: 3px solid var(--flame); outline-offset: 4px; border-radius: 6px; }

.captcha { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.captcha__img { width: 260px; height: 76px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bone); }
.captcha__question {
    display: inline-flex; align-items: center; background: var(--bone-deep);
    border-radius: var(--r-sm); padding: 12px 16px; font-weight: 700;
}
.captcha__reload {
    display: grid; place-items: center; padding: 0;
    border: 1px solid var(--line); background: var(--surface); border-radius: 50%;
    width: 42px; height: 42px; cursor: pointer; color: var(--ink-2);
}
.captcha__reload.is-spinning svg { animation: nr-spin .5s ease; }
@keyframes nr-spin { to { transform: rotate(360deg); } }
.captcha__reload:hover { color: var(--flame); border-color: var(--ink); }
.captcha input { flex: 1 1 160px; }

.flash {
    border-radius: var(--r-md); padding: 14px 20px; margin: 18px 0; font-weight: 600;
    background: #E8F5EF; color: #0B5540; border: 1px solid #C5E6D8;
}
.flash--error { background: #FDECE7; color: #8C2A0E; border-color: #F6C8B9; }

/* ---------- Карточка формы письма ---------- */

.letterform { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 34px; align-items: start; padding-bottom: 60px; }
.letterform__form { padding: 36px 30px 30px; gap: 28px; }
.contact { max-width: 820px; margin-bottom: 60px; }
.panel { background: var(--surface); border-radius: var(--r-lg); padding: 30px; box-shadow: var(--shadow); }
.side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 78px; }
.side__box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px; }
.side__box h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.side__box p { margin: 0 0 14px; font-size: 15px; color: var(--ink-2); }
.side__box p:last-child { margin-bottom: 0; }
.side__box--ink { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.side__box--ink p { color: rgba(251, 248, 243, .75); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.steps li { display: flex; gap: 12px; font-size: 15px; color: var(--ink-2); }
.steps li::before {
    counter-increment: step; content: counter(step);
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--bone-deep); color: var(--ink); font-weight: 700; font-size: 13px;
    display: grid; place-items: center;
}

/* ---------- Комментарии ---------- */

.comments { margin-top: 56px; }
.comments__form { background: var(--surface); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--shadow); margin-bottom: 30px; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.comment { display: flex; gap: 14px; }
.comment__avatar {
    flex: none; width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 16px;
}
.comment__meta { margin: 0 0 4px; font-size: 14px; color: var(--ink-3); }
.comment__name { color: var(--ink); font-weight: 700; }
.comment__body { margin: 0; font-size: 16px; line-height: 1.6; }

/* ---------- Пагинация и подвал ---------- */

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 46px 0 60px; }
.pager__pos { font-size: 14px; color: var(--ink-3); }

.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 40px 0 54px; }
.footer__grid { display: flex; gap: 28px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.footer__brand { display: flex; gap: 14px; align-items: center; }
.footer__mark { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.footer__name { display: block; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.03em; line-height: 1.2; }
.footer__slogan { display: block; font-family: var(--display); font-weight: 500; font-size: 14px; color: var(--ink-3); letter-spacing: -0.01em; }
.footer__links { display: flex; gap: 22px; flex-wrap: wrap; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.footer__links a:hover { color: var(--flame); }
.footer__note { font-size: 14px; color: var(--ink-3); }

/* ---------- Адаптив ---------- */

@media (max-width: 1080px) {
    .slogan { display: none; }
    .searchbox input[type="search"] { width: 200px; }
    .searchbox input[type="search"]:focus { width: 240px; }
    .hero__card { grid-template-columns: 1fr; gap: 24px; }
    .hero__text { padding: 0 6px 10px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .letterform { grid-template-columns: 1fr; }
    .side { position: static; }
}

/* Узкий экран: поиск прячется за кнопку, разделы листаются пальцем. */
@media (max-width: 760px) {
    .masthead__inner { min-height: 64px; gap: 10px; position: relative; }
    .masthead__actions { gap: 8px; }
    .iconbtn { display: grid; }
    .searchbox {
        display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 45;
        padding: 0 0 12px; background: var(--bone);
    }
    .searchbox.is-open { display: flex; }
    .searchbox input[type="search"], .searchbox input[type="search"]:focus { width: 100%; }
    .masthead__letter { width: 42px; padding: 0; }
    .masthead__letter span { display: none; }

    .sectionbar__inner {
        overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
        -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
        mask-image: linear-gradient(90deg, #000 88%, transparent);
        padding-right: 30px;
    }
    .sectionbar__inner::-webkit-scrollbar { display: none; }
    .sectionbar__link { scroll-snap-align: start; font-size: 14px; height: 36px; }
    .sectionbar__link:first-child { margin-left: -6px; }
    .embed--wide, .embed--gallery { width: 100%; margin-left: 0; transform: none; }
    .lightbox { padding: 56px 10px; }
    .lightbox__nav { top: auto; bottom: 16px; transform: none; }
}

@media (max-width: 680px) {
    body { font-size: 16px; }
    .wrap, .narrow { width: min(100% - 28px, var(--wrap)); }
    .brand__name { font-size: 17px; }
    .brand__mark { width: 36px; height: 36px; }
    .cards { grid-template-columns: 1fr; gap: 26px; }
    .card--wide { flex-direction: column; }
    .card--wide .card__media { flex: none; width: 100%; }
    .hero { padding: 26px 0 32px; }
    .hero__card { padding: 14px; border-radius: var(--r-md); }
    .band { padding: 26px; }
    .panel { padding: 22px 18px; }
    .letterform__form { padding: 26px 18px 22px; }
    .post__body { font-size: 18px; }
    .post__cover { width: min(100% - 28px, 960px); }
    .gallery--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .captcha__img { width: 208px; height: auto; }
    .footer__grid { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .card:hover .card__media img, .hero__card:hover .hero__media img { transform: none; }
}

@media print {
    .masthead, .sectionbar, .reactions, .comments, .band, .footer, .pager, .progress, .lightbox { display: none; }
    body { background: #fff; }
    .post__cover img { box-shadow: none; }
}
