/*
Theme Name: Доска Дружный
Theme URI: https://doska.drugniy.info/
Description: Лёгкая и быстрая тема доски объявлений. Совместима с данными ClassiPress: объявления, категории, фото, просмотры и адреса страниц сохраняются. Без jQuery и внешних шрифтов.
Version: 1.4.6
Requires at least: 6.3
Requires PHP: 7.4
Author: Drugniy.info
License: GPL-2.0-or-later
Text Domain: doska
*/

/* ---------- Основа ---------- */
:root {
	--accent: #0e9f6e;
	--accent-ink: #fff;
	--bg: #f4f5f7;
	--card: #fff;
	--ink: #16181d;
	--muted: #6b7280;
	--line: #e5e7eb;
	--soft: #eef1f4;
	--danger: #dc2626;
	--warn: #d97706;
	--vip: #f59e0b;
	--r: 14px;
	--r-sm: 10px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
	--wrap: 1240px;
	color-scheme: light;
}
/* Тёмная тема: по настройке устройства или по кнопке (data-theme на <html>) */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme=light]) {
		--bg: #0f1115;
		--card: #181b21;
		--ink: #eceef2;
		--muted: #9aa1ad;
		--line: #2a2f38;
		--soft: #222630;
		--shadow: 0 1px 2px rgba(0, 0, 0, .4);
		--shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
		color-scheme: dark;
	}
}
:root[data-theme=dark] {
	--bg: #0f1115;
	--card: #181b21;
	--ink: #eceef2;
	--muted: #9aa1ad;
	--line: #2a2f38;
	--soft: #222630;
	--shadow: 0 1px 2px rgba(0, 0, 0, .4);
	--shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
	color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem); }
.h2 { font-size: 1.35rem; }
.h2--sm { font-size: 1.05rem; color: var(--muted); }
.h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; margin-top: 24px; }
.i { flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.wrap--narrow { max-width: 820px; }
.wrap--auth { max-width: 440px; padding-top: 24px; }
.main { min-height: 60vh; padding-bottom: 40px; }

/* ---------- Кнопки ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 42px; padding: 0 16px; border-radius: var(--r-sm);
	border: 1px solid var(--line); background: var(--card); color: var(--ink);
	font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
	transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn--ghost { background: transparent; }
.btn--danger:hover { border-color: var(--danger); color: var(--danger); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn--lg { min-height: 50px; padding: 0 22px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn.is-disabled { opacity: .55; pointer-events: none; }
.btn small { display: block; font-weight: 400; font-size: .8rem; opacity: .85; }
.btn span { text-align: left; line-height: 1.2; }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }
.link:hover { color: var(--danger); }

/* ---------- Шапка ---------- */
.hdr { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.admin-bar .hdr { top: 32px; }
.hdr__in { position: relative; display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; flex: none; }
.logo__mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.15rem; }
.logo__img { max-height: 40px; width: auto; }
.logo--sm .logo__mark { width: 30px; height: 30px; font-size: 1rem; }
.hright { margin-left: auto; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.hnav { display: flex; align-items: center; gap: 6px; flex: none; }
/* Поиск-лупа: по нажатию поле выезжает влево */
.hsearch { position: relative; display: flex; align-items: center; height: 44px; width: 44px; flex: 0 0 auto; border-radius: 12px; border: 2px solid transparent; background: transparent; overflow: hidden; transition: width .28s ease, background .2s, border-color .2s; }
.hsearch.is-open { width: min(440px, 100%); flex: 0 1 440px; background: var(--soft); }
.hsearch.is-open:focus-within { border-color: var(--accent); background: var(--card); }
.hsearch input.hsearch__input { flex: 1; min-width: 0; width: 0; height: 40px; min-height: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0; opacity: 0; outline: 0; transition: opacity .2s; }
.hsearch.is-open input.hsearch__input { padding: 0 6px 0 14px; opacity: 1; }
.hsearch__btn, .hsearch__close { flex: none; border: 0; background: transparent; color: var(--ink); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.hsearch__btn:hover { background: var(--soft); }
.hsearch.is-open .hsearch__btn { background: var(--accent); color: #fff; }
.hsearch__close { display: none; color: var(--muted); width: 32px; }
.hsearch.is-open .hsearch__close { display: grid; }
.hsearch__close .i { width: 16px; height: 16px; }
.hnav__ico { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; font-weight: 500; }
.hnav__ico:hover { background: var(--soft); }
.fav-count { position: absolute; top: 2px; left: 22px; background: var(--danger); color: #fff; font-size: .68rem; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }

/* ---------- Главная ---------- */
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), var(--card) 70%); border-bottom: 1px solid var(--line); padding: 32px 0 28px; }
.hero__title { font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.6rem); margin-bottom: 8px; }
.hero__sub { color: var(--muted); max-width: 620px; font-size: 1.05rem; margin: 0; }
.hero__add-m { display: none; }

.sec { margin-top: 32px; }
.sec__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec__head .h2 { margin: 0; }
.sec__more { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 600; font-size: .95rem; }

.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cat { background: var(--card); border-radius: var(--r); padding: 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.cat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--ink); }
.cat__ico { grid-row: span 2; font-size: 1.8rem; width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; }
.cat__name { font-weight: 600; line-height: 1.2; font-size: .93rem; overflow-wrap: anywhere; hyphens: auto; }
.cat__cnt { color: var(--muted); font-size: .8rem; }

/* ---------- Сетка объявлений ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.layout__main .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid--vip { margin-bottom: 24px; }
.card { position: relative; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card--vip { outline: 2px solid var(--vip); }
.card--sold .card__img img { filter: grayscale(.8); opacity: .7; }
.card__img { position: relative; aspect-ratio: 4 / 3; background: var(--soft); display: block; overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { position: absolute; inset: 0; overflow: hidden; background: var(--soft); }
.noimg img { width: 100%; height: 100%; object-fit: cover; }
.noimg__lbl { position: absolute; right: 8px; bottom: 8px; background: rgba(255, 255, 255, .82); color: #374151; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(4px); }
.noimg--sm .noimg__lbl { display: none; }
.noimg--lg .noimg__lbl { font-size: .85rem; padding: 4px 12px; right: 14px; bottom: 14px; }
.gallery--empty { position: relative; width: 100%; height: min(72vh, 560px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .noimg img { filter: brightness(.85); } }
:root[data-theme=dark] .noimg img { filter: brightness(.85); }
.themebtn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.themebtn:hover { background: var(--soft); }
.themebtn .i-moon { display: none; }
:root[data-theme=dark] .themebtn .i-sun { display: none; }
:root[data-theme=dark] .themebtn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme=light]) .themebtn .i-sun { display: none; }
	:root:not([data-theme=light]) .themebtn .i-moon { display: block; }
}
/* Панель администратора на странице объявления */
.adminbox { border: 2px dashed color-mix(in srgb, var(--danger) 35%, var(--line)); }
.adminbox__head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.adminbox__who { color: var(--muted); font-size: .9rem; margin: 0 0 12px; overflow-wrap: anywhere; }
.adminbox__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover { color: #fff; filter: brightness(1.08); border-color: var(--danger); }
.card__noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); opacity: .5; }
.card__noimg .i { width: 36px; height: 36px; }
.card__badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.card__cnt { position: absolute; bottom: 8px; left: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; padding: 2px 7px; border-radius: 6px; display: flex; align-items: center; gap: 4px; }
.card__cnt .i { width: 14px; height: 14px; }
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__price { font-size: 1.1rem; font-weight: 800; }
.card__title { overflow-wrap: anywhere; font-size: .95rem; font-weight: 500; margin: 0; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card__meta { margin-top: auto; color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: 2px 8px; }
.badge { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .02em; }
.badge--vip { background: var(--vip); color: #3b2300; }
.badge--sold { background: #111; color: #fff; }
.price--muted { color: var(--muted); font-weight: 600; font-size: .95rem; }
.price--free { color: var(--accent); }

.fav { position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: #374151; display: grid; place-items: center; cursor: pointer; transition: transform .1s; }
.fav:active { transform: scale(.9); }
.fav[aria-pressed=true], .btn[data-fav][aria-pressed=true] { color: var(--danger); }
.fav[aria-pressed=true] .i, .btn[data-fav][aria-pressed=true] .i { fill: currentColor; }

/* ---------- Список + фильтры ---------- */
.crumbs { font-size: .85rem; color: var(--muted); padding: 14px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs span { opacity: .5; }
.pagehead { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 16px; }
.pagehead h1 { margin: 0; }
.pagehead__cnt { color: var(--muted); }
.pagehead__acts { margin-left: auto; display: flex; gap: 8px; }
.termdesc { color: var(--muted); max-width: 760px; }
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
.filters__toggle { display: none; }
.filters__form { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.fgroup { display: flex; flex-direction: column; gap: 6px; }
.flabel { font-weight: 600; font-size: .85rem; color: var(--muted); }
.frange { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fcats { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.fcats a { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 8px; font-size: .92rem; }
.fcats a:hover, .fcats a.is-on { background: var(--soft); }
.fcats a.is-on { color: var(--accent); font-weight: 600; }
.fcats small { color: var(--muted); }
.fcheck { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.factions { display: flex; gap: 8px; }
.factions .btn { flex: 1; }

input[type=text], input[type=search], input[type=email], input[type=url], input[type=tel], input[type=password], input[type=number], select, textarea {
	width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-sm);
	padding: 10px 12px; min-height: 44px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea { resize: vertical; min-height: 120px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }

.pagination, .navigation.pagination { margin-top: 24px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.page-numbers { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; padding: 0 10px; }
.page-numbers.current { background: var(--accent); color: #fff; }
.page-numbers.dots { background: none; box-shadow: none; }

.empty { text-align: center; padding: 48px 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.empty__ico { font-size: 3rem; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto 18px; }

/* ---------- Объявление ---------- */
.box { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.ad { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; margin-top: 8px; }
.box--sticky { position: relative; }
.ad__price { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin-bottom: 8px; }
.ad__price .price--muted { font-size: 1.3rem; }
.ad__title { font-size: 1.3rem; font-weight: 600; overflow-wrap: anywhere; }
.ad__where { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 16px; }
.ad__acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.ad__desc { white-space: normal; word-wrap: break-word; font-size: 1.02rem; }
.ad__desc a { color: var(--accent); text-decoration: underline; }
.ad__props { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.ad__props dt { color: var(--muted); font-size: .82rem; }
.ad__props dd { margin: 0; font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags a { background: var(--soft); padding: 3px 10px; border-radius: 20px; font-size: .85rem; }
.soldbar { background: #111; color: #fff; text-align: center; padding: 6px; border-radius: 8px; font-weight: 700; margin-bottom: 12px; }
.contact__list { display: flex; flex-direction: column; gap: 8px; }
.phone { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.phone__num { font-size: 1.35rem; font-weight: 800; color: var(--accent); letter-spacing: .01em; }
.phone__msg { display: flex; gap: 6px; }
.phone__msg a { font-size: .82rem; padding: 4px 10px; border-radius: 20px; background: var(--soft); font-weight: 600; }
.owner { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.owner__acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.seller { display: flex; gap: 14px; align-items: center; }
.seller__ava { width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, var(--card)); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; flex: none; }
.seller__name { font-weight: 700; }
.seller__meta { color: var(--muted); font-size: .85rem; }
.seller__all { color: var(--accent); font-weight: 600; font-size: .9rem; }
.seller--head { margin: 20px 0; }
.seller--head h1 { margin: 0; }
.popular__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.popular__item { display: flex; gap: 12px; align-items: center; padding: 6px; margin: 0 -6px; border-radius: 10px; }
.popular__item:hover { background: var(--soft); color: var(--ink); }
.popular__img { position: relative; flex: none; width: 60px; height: 60px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.popular__img img { width: 100%; height: 100%; object-fit: cover; }
.popular__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.popular__title { font-size: .9rem; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.popular__meta { display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 700; }
.popular__meta .price--muted { font-size: .8rem; }
.popular__views { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 400; font-size: .8rem; }
.popular__views .i { width: 14px; height: 14px; }
.filters__popular { margin-top: 16px; }
.filters__popular .box { margin: 0; }
.tips ul { padding-left: 18px; margin: 8px 0 12px; color: var(--muted); font-size: .9rem; }

.gallery { position: relative; background: var(--soft); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; }
.gallery__track { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; height: min(72vh, 560px); }
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; border: 0; padding: 0; background: none; cursor: zoom-in; overflow: hidden; }
.gallery__slide img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.gallery__count { position: absolute; top: 12px; right: 12px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8rem; padding: 3px 9px; border-radius: 12px; }
.gallery__nav { position: absolute; top: calc(min(72vh, 560px) / 2 - 22px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); color: #111; font-size: 1.6rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.gallery__nav--prev { left: 12px; }
.gallery__nav--next { right: 12px; }
.gallery__thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: var(--card); }
.gallery__thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--soft); opacity: .7; }
.gallery__thumbs button.is-on { border-color: var(--accent); opacity: 1; }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.lightbox::backdrop { background: #000; }
.lightbox__track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lightbox__track { overflow-y: hidden; }
.lightbox__track img { flex: 0 0 100%; width: 100%; height: 100%; max-width: none; object-fit: contain; scroll-snap-align: center; scroll-snap-stop: always; }
.lightbox__x { position: fixed; top: 14px; right: 14px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox__count { position: fixed; bottom: 18px; left: 0; right: 0; text-align: center; font-size: .9rem; opacity: .8; }

.modal { border: 0; border-radius: var(--r); padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal__in { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.modal__acts { display: flex; justify-content: flex-end; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: center; cursor: pointer; }

.mbar { display: none; }

/* ---------- Форма ---------- */
.adform .box { padding: 20px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .85rem; margin-right: 6px; vertical-align: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: .92rem; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-size: .82rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suffix { display: flex; align-items: center; max-width: 260px; }
.suffix input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.suffix span { min-height: 44px; display: grid; place-items: center; padding: 0 14px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--soft); font-weight: 600; }
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.seg label { position: relative; padding: 8px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .92rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--card); box-shadow: var(--shadow); color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: .9rem; }
.chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.submitbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between; background: var(--card); border-radius: var(--r); padding: 16px 20px; box-shadow: var(--shadow); position: sticky; bottom: 12px; z-index: 5; }
.submitbar .btn--accent { margin-left: auto; }

.uploader__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 8px; }
.up { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--soft); }
.up img { width: 100%; height: 100%; object-fit: cover; }
.up:first-child:not(.up--add)::after { content: "Обложка"; position: absolute; left: 6px; bottom: 6px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.up:first-child .up__cover { display: none; }
.up__del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.up__cover { position: absolute; left: 6px; bottom: 6px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: .7rem; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.up--add { border: 2px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); cursor: pointer; font-size: .85rem; font-weight: 600; text-align: center; }
.up--add:hover { border-color: var(--accent); color: var(--accent); }
.up--add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.up--add[hidden] { display: none; }
.up.is-busy::before { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .6) linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent) 0 0 / 200% 100%; animation: shimmer 1s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Уведомления ---------- */
.notice { border-radius: var(--r-sm); padding: 12px 16px; margin: 12px 0; border: 1px solid; overflow-wrap: anywhere; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice--ok { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.notice--err { background: color-mix(in srgb, var(--danger) 8%, var(--card)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice--info { background: var(--card); border-color: var(--line); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 90; max-width: calc(100vw - 32px); animation: toast .25s ease-out; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Кабинет ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.is-on { color: var(--ink); border-color: var(--accent); }
.tabs span { background: var(--soft); border-radius: 10px; padding: 0 7px; font-size: .8rem; margin-left: 4px; }
.mylist { display: flex; flex-direction: column; gap: 10px; }
.myad { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; background: var(--card); padding: 12px; border-radius: var(--r); box-shadow: var(--shadow); }
.myad__img { width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--soft); position: relative; }
.myad__img img { width: 100%; height: 100%; object-fit: cover; }
.myad__body { min-width: 0; }
.myad__title { font-weight: 600; display: block; overflow-wrap: anywhere; }
.myad__price { margin: 2px 0 4px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.myad__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .85rem; }
.myad__meta span { display: inline-flex; align-items: center; gap: 4px; }
.myad__meta .i { width: 15px; height: 15px; }
.myad__meta .warn { color: var(--warn); font-weight: 600; }
.myad__acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 330px; }
.myad--sold .myad__img img { filter: grayscale(1); }

.auth { padding: 28px; }
.auth__links { text-align: center; color: var(--muted); margin: 16px 0 0; font-size: .92rem; }
.auth__links a { color: var(--accent); }

.catlist { columns: 3 280px; column-gap: 16px; }
.catlist__item { break-inside: avoid; }
.catlist ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.catlist ul a:hover { color: var(--accent); }
.catlist small { color: var(--muted); }

.prose { font-size: 1.02rem; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose img { border-radius: 10px; }
.comments__list { list-style: none; padding: 0; }
.comments__list li { border-top: 1px solid var(--line); padding: 12px 0; }
.comment-meta { font-size: .85rem; color: var(--muted); }
.comment-reply-link { font-size: .85rem; color: var(--accent); }
.comment-form { display: flex; flex-direction: column; gap: 12px; }
.comment-form p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.comment-form p.logged-in-as, .comment-form p.comment-notes, .comment-form p.form-submit { display: block; }
.comment-form p.logged-in-as { color: var(--muted); font-size: .9rem; }
.comment-form p.logged-in-as a { color: var(--accent); }
.comment-form label { font-weight: 600; font-size: .92rem; }
.comment-form .comment-form-cookies-consent { flex-direction: row; align-items: center; gap: 8px; }
.comment-form .comment-form-cookies-consent label { font-weight: 400; color: var(--muted); }
.comment-reply-title { font-size: 1.05rem; margin: 8px 0 0; }

/* ---------- Подвал ---------- */
.ftr { background: var(--card); border-top: 1px solid var(--line); padding: 28px 0 16px; margin-top: 24px; }
.ftr__in { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.ftr__about { max-width: 380px; color: var(--muted); }
.ftr__about .logo { color: var(--ink); margin-bottom: 8px; }
.ftr__nav { margin-top: 18px; }
.ftr__menu { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 22px; }
.ftr__menu a { color: var(--muted); font-weight: 500; }
.ftr__menu a:hover { color: var(--accent); }
.ftr__bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.ftr__copy { color: var(--muted); font-size: .85rem; display: inline-flex; align-items: center; gap: 8px; }
.ftr__flag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--muted); opacity: .3; transition: opacity .2s, color .2s, transform .2s; }
.ftr__flag:hover, .ftr__flag:focus-visible { opacity: 1; color: #f5b800; transform: scale(1.15); }
.ftr__counters { margin-left: auto; display: flex; align-items: center; gap: 8px; line-height: 0; }
.ftr__counters img { display: inline-block; }
.tabbar { display: none; }
.flash-slot:empty { display: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1024px) {
	.hnav__lbl { display: none; }
	.ad { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 860px) {
	.layout { grid-template-columns: 1fr; }
	.filters { position: static; max-height: none; overflow: visible; }
	.filters__popular { display: none; }
	.filters__toggle { display: inline-flex; margin-bottom: 10px; }
	.filters__form { display: none; }
	.filters.is-open .filters__form { display: flex; }
	.ad { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
	.ad__main, .ad__side { display: contents; }
	.gallery { order: 1; margin: 0 -16px 16px; border-radius: 0; }
	.gallery__track { height: auto; aspect-ratio: 4 / 3; max-height: 70vh; }
	.gallery--empty { width: auto; height: auto; aspect-ratio: 4 / 3; max-height: 70vh; }
	.gallery__nav, .gallery__thumbs { display: none; }
	.ad__side > .box--sticky { order: 2; position: static; }
	.ad__main > .box { order: 3; }
	.ad__side > .seller, .ad__side > .tips, .ad__side > .popular { order: 4; }
	.ad__main > .adminbox { order: 5; }
	.mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-between; gap: 12px; }
	.mbar__price { font-weight: 800; font-size: 1.15rem; }
	.mbar .btn { flex: 0 0 auto; min-width: 150px; }
	.single-ad_listing .tabbar { display: none !important; }
	.single-ad_listing .main { padding-bottom: 80px; }
}
@media (max-width: 720px) {
	.hdr__in { height: 58px; gap: 10px; }
	.hnav { display: none; }
	.hsearch.is-open { position: absolute; left: 12px; right: 12px; top: 7px; width: auto; z-index: 2; background: var(--card); border-color: var(--accent); box-shadow: var(--shadow-lg); }
	.admin-bar .hdr { top: 0; position: relative; }
	.hero { padding: 24px 0 20px; }
	.hero__sub { font-size: .95rem; margin-bottom: 0; }
	.hero__add-m { display: flex; margin-top: 16px; }
	.hero__title { font-size: 1.45rem; margin-bottom: 6px; }
	.sec { margin-top: 22px; }
	.cats { grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: 84px; grid-template-columns: none; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
	.cats::-webkit-scrollbar { display: none; }
	.cat { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 10px 4px; row-gap: 6px; scroll-snap-align: start; }
	.cat__ico { grid-row: auto; width: 44px; height: 44px; font-size: 1.5rem; }
	.cat__name { font-size: .74rem; font-weight: 500; overflow-wrap: anywhere; hyphens: auto; }
	.cat__cnt { display: none; }
	.grid, .layout__main .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.card__body { padding: 8px 10px 10px; }
	.card__price { font-size: 1rem; }
	.card__title { font-size: .88rem; }
	.row2 { grid-template-columns: 1fr; }
	.myad { grid-template-columns: 72px 1fr; }
	.myad__img { width: 72px; height: 72px; }
	.myad__acts { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
	.submitbar { bottom: 72px; padding: 12px; }
	.submitbar .btn--accent { width: 100%; }
	.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 44; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
	.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: .68rem; color: var(--muted); }
	.tabbar a.is-on { color: var(--accent); }
	.tabbar__add .i { background: var(--accent); color: #fff; border-radius: 10px; width: 36px; height: 26px; padding: 3px; }
	.main { padding-bottom: 76px; }
	.ftr { padding-bottom: 80px; }
	.toast { bottom: 140px; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
