/* Повторяющиеся блоки: карточки, формы, пустые состояния. */

/* --- Карточка статьи --- */
.post-card {
	display: flex;
	flex-direction: column;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--r-md);
	overflow: hidden;
	box-shadow: var(--shadow-card);
}
.post-card__media { display: block; background: var(--c-surface-alt); }
.post-card__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.post-card__body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card__meta { display: flex; gap: 6px; }
.post-card__title { font-size: 20px; margin: 0; }
.post-card__title a { color: var(--c-text); }
.post-card__title a:hover { color: var(--c-accent); }
.post-card__excerpt { font-size: 15px; color: var(--c-text-body); margin: 0; }
.post-card__more { margin-top: auto; font-size: 15px; font-weight: 600; }

.post-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--gap);
}

/* --- Текст записи --- */
.entry__content { max-width: 760px; }
/* Статью держим в узкой колонке ради читаемости, а SEO-текст на посадочных —
   во всю ширину контейнера: он объёмный и в 760px растягивается на экраны. */
.entry__content--wide { max-width: none; }
.entry__content--wide > p,
.entry__content--wide > ul,
.entry__content--wide > ol { max-width: 78ch; }
.entry__content h2 { margin-top: 36px; }
.entry__content h3 { margin-top: 28px; }
.entry__content img { border-radius: var(--r-md); margin-block: 8px; }
.entry__content ul, .entry__content ol { color: var(--c-text-body); padding-left: 22px; }
.entry__content li { margin-bottom: 8px; }
.entry__content table { width: 100%; border-collapse: collapse; }
.entry__content th, .entry__content td { border: 1px solid var(--c-border); padding: 10px 12px; text-align: left; }

/* Старые статьи выровнены атрибутами align — не даём им ломать колонку */
.entry__content .alignleft  { float: left;  margin: 4px 24px 16px 0; }
.entry__content .alignright { float: right; margin: 4px 0 16px 24px; }
.entry__content .aligncenter { display: block; margin: 20px auto; }
.entry__content::after { content: ''; display: block; clear: both; }

/* Заголовок рядом с обтекаемой картинкой выглядел сдвинутым и обрезанным —
   секции всегда начинаются с новой строки. */
.entry__content h2,
.entry__content h3 { clear: both; }

/* Картинки в старом контенте вставлены с жёсткими width/height из 2013 года.
   Ограничиваем и приводим к общему виду темы. */
.entry__content img {
	height: auto;
	max-width: 100%;
	border-radius: var(--r-md);
}
.entry__content--wide img { max-width: min(100%, 560px); }
.entry__content--wide .alignleft,
.entry__content--wide .alignright { max-width: min(45%, 380px); }

/* --- Галерея каталога (пока разделы остаются страницами с [gallery]) --- */
.entry__content .gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--gap);
	margin: 28px 0;
}
.entry__content .gallery br { display: none; }
.entry__content .gallery-item {
	margin: 0 !important;
	width: auto !important;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--r-md);
	overflow: hidden;
}
.entry__content .gallery-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border: 0 !important; }
.entry__content .gallery-caption {
	display: block;
	padding: 10px 12px 12px;
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--c-text);
}

/* --- Видео --- */
.video-embed {
	position: relative;
	aspect-ratio: 16 / 9;
	margin: 24px 0;
	border-radius: var(--r-md);
	overflow: hidden;
	background: var(--c-dark);
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- Форма поиска --- */
.search-form { display: flex; gap: 10px; max-width: 560px; }
.search-form__input {
	flex: 1;
	font: inherit;
	font-size: 15px;
	padding: 12px 14px;
	border: 1px solid var(--c-border-strong);
	border-radius: var(--r-sm);
	background: var(--c-surface);
	color: var(--c-text);
}
.search-form__input::placeholder { color: var(--c-text-dim); }

/* --- Пустое состояние --- */
.empty-state {
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--r-md);
	padding: 40px;
	text-align: center;
}

/* --- 404 --- */
.error404 { padding-block: 56px 40px; max-width: 720px; }
.error404__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 24px; }
.error404__search { margin-top: 8px; }

/* --- Пагинация --- */
.pagination { margin-block: 40px; }
.pagination .page-numbers {
	display: inline-block;
	padding: 9px 14px;
	margin-right: 6px;
	border: 1px solid var(--c-border-strong);
	border-radius: var(--r-sm);
	color: var(--c-text-nav);
	font-size: 15px;
}
.pagination .page-numbers.current { background: var(--c-dark); border-color: var(--c-dark); color: var(--c-text-on-dark); }

@media (max-width: 767px) {
	.entry__content .alignleft,
	.entry__content .alignright { float: none; margin: 12px 0; }
	.search-form { flex-direction: column; }
}

/* --- Модальное окно --- */
body.has-modal { overflow: hidden; }

.modal {
	position: fixed;
	inset: 0;
	z-index: 95;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(26, 26, 25, 0.82); }

.modal__dialog {
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: 92vh;
	overflow-y: auto;
	background: var(--c-surface);
	border-radius: var(--r-md);
	padding: 32px;
}
.modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	border: 1px solid var(--c-border-strong);
	border-radius: var(--r-pill);
	background: var(--c-surface);
	cursor: pointer;
	font-size: 14px;
	color: var(--c-text);
}
.modal__title { margin: 0 0 8px; font-size: 26px; }
.modal__text { font-size: 15px; margin: 0 0 20px; }
.modal__phone { font-size: 15px; margin: 16px 0 0; color: var(--c-text-muted); }
.modal__phone a { font-weight: 600; }

.lead-form--modal { border: 0; padding: 0; background: transparent; }

/* --- Зона перетаскивания файлов --- */
.dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 26px 20px;
	margin-bottom: 20px;
	text-align: center;
	border: 1px dashed var(--c-border-strong);
	border-radius: var(--r-md);
	background: var(--c-surface-alt);
}
.dropzone.is-over { border-color: var(--c-accent); background: #efe9dd; }
.dropzone__hint { font-size: 16px; font-weight: 600; }
.dropzone__meta { font-family: var(--f-mono); font-size: 11px; color: var(--c-text-dim); }
.dropzone__button { margin-top: 6px; cursor: pointer; }
.dropzone__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.dropzone__file {
	font-size: 14px;
	padding: 8px 12px;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--r-sm);
	text-align: left;
}

@media (max-width: 767px) {
	.modal { padding: 12px; }
	.modal__dialog { padding: 22px 18px; }
}

/* --- Уведомление о cookie --- */
.cookie {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 80;
	padding: 16px var(--pad-x);
	background: var(--c-dark);
	color: var(--c-text-on-dark);
	transform: translateY(100%);
	transition: transform 0.25s ease;
}
.cookie[hidden] { display: none; }
.cookie.is-visible { transform: translateY(0); }

.cookie__inner {
	max-width: var(--maxw);
	margin-inline: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}
.cookie__text { margin: 0; font-size: 14px; line-height: 1.5; color: #cfccc4; max-width: 70ch; }
.cookie__text a { color: var(--c-accent-light); text-decoration: underline; }
.cookie__text a:hover { color: #fff; }

.cookie__actions { display: flex; gap: 10px; flex: none; }
.cookie__btn { font-size: 14px; padding: 10px 18px; white-space: nowrap; }
@media (max-width: 767px) {
	.cookie { padding: 14px var(--pad-x-sm); }
	.cookie__inner { flex-direction: column; align-items: stretch; gap: 14px; }
	.cookie__actions { justify-content: stretch; }
	.cookie__btn { flex: 1; }
}
