/*
 * Тема «ФМ Фарм».
 * Ориентир по вёрстке — оригинал fmpharm.co.rs (скриншоты в C:\Сайт ФАРМА).
 */

:root {
	--brand: #1a1a8c;
	--brand-dark: #131369;
	--brand-light: #2f2fb5;
	--accent: #e2342c;
	--text: #333;
	--text-muted: #6b6b6b;
	--surface: #fff;
	--surface-alt: #f7f8fa;
	--border: #e2e5ea;
	--radius: 4px;
	--shadow: 0 2px 10px rgba(26, 26, 140, .08);
	--wrap: 1180px;
	--nav-h: 56px;
}

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

body {
	margin: 0;
	font-family: 'Liberation Sans', Arial, 'Helvetica Neue', Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.65;
	color: var(--text);
	background: var(--surface-alt);
	-webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; }
a:hover, a:focus-visible { color: var(--brand-light); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--brand); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); }
h3 { font-size: 1.25rem; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute; left: -9999px;
	background: var(--brand); color: #fff;
	padding: .75rem 1.25rem; z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

:focus-visible { outline: 3px solid var(--brand-light); outline-offset: 2px; }

/* ---------- Шапка ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }

.site-header__inner {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 1rem 1.25rem;
	display: flex; align-items: center; justify-content: space-between;
	gap: 1.5rem; flex-wrap: wrap;
}

.site-brand__link {
	display: flex; align-items: center; gap: .875rem;
	text-decoration: none;
}
.site-brand__link:hover { text-decoration: none; }

.site-brand__logo img { display: block; max-height: 56px; width: auto; }

.site-brand__name {
	font-size: clamp(1.5rem, 3.5vw, 2.25rem);
	font-weight: 700;
	color: var(--brand);
	letter-spacing: -.01em;
}

.site-header__search { flex: 0 1 280px; }

.search-form { display: flex; }
.search-form label { flex: 1; margin: 0; }
.search-form .search-field {
	width: 100%;
	padding: .55rem .75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius) 0 0 var(--radius);
	font-size: .9375rem;
	background: var(--surface);
}
.search-form .search-submit {
	padding: .55rem 1rem;
	border: 1px solid var(--brand);
	background: var(--brand);
	color: #fff;
	border-radius: 0 var(--radius) var(--radius) 0;
	cursor: pointer;
	font-size: .9375rem;
}
.search-form .search-submit:hover { background: var(--brand-light); }

/* ---------- Меню ---------- */

.site-nav { background: var(--brand); position: sticky; top: 0; z-index: 100; }

.site-nav__inner { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

.site-nav__list {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; justify-content: center;
}

.site-nav__list a {
	display: block;
	padding: 1rem 1.375rem;
	color: #fff;
	font-weight: 700;
	font-size: .9375rem;
	text-decoration: none;
	transition: background .15s;
}
.site-nav__list a:hover,
.site-nav__list a:focus-visible { background: var(--brand-light); color: #fff; text-decoration: none; }

.site-nav__list .current-menu-item > a,
.site-nav__list .current_page_item > a { background: var(--brand-dark); }

/* подменю */
.site-nav__list li { position: relative; }
.site-nav__list .sub-menu {
	list-style: none; margin: 0; padding: 0;
	position: absolute; left: 0; top: 100%;
	min-width: 240px;
	background: var(--brand-dark);
	box-shadow: var(--shadow);
	display: none; z-index: 10;
}
.site-nav__list li:hover > .sub-menu,
.site-nav__list li:focus-within > .sub-menu { display: block; }
.site-nav__list .sub-menu a { padding: .75rem 1.25rem; font-weight: 400; }

.site-nav__toggle {
	display: none;
	width: 100%;
	padding: .875rem 0;
	background: none; border: 0; color: #fff;
	font: inherit; font-weight: 700;
	align-items: center; gap: .625rem;
	cursor: pointer;
}
.site-nav__toggle-bars {
	width: 22px; height: 2px; background: #fff; position: relative; display: block;
}
.site-nav__toggle-bars::before,
.site-nav__toggle-bars::after {
	content: ''; position: absolute; left: 0;
	width: 22px; height: 2px; background: #fff;
}
.site-nav__toggle-bars::before { top: -7px; }
.site-nav__toggle-bars::after  { top: 7px; }

/* ---------- Плашка о регистрации ---------- */

.reg-notice { background: #fff8e6; border-bottom: 1px solid #f0dfae; }
.reg-notice__inner {
	max-width: var(--wrap); margin: 0 auto;
	padding: .875rem 1.25rem;
	display: flex; gap: .75rem; align-items: flex-start;
}
.reg-notice__icon {
	flex: 0 0 auto;
	width: 22px; height: 22px; border-radius: 50%;
	background: #c98a00; color: #fff;
	font-weight: 700; font-size: .875rem;
	display: grid; place-items: center;
}
.reg-notice__text { margin: 0; font-size: .9375rem; color: #6b5417; }

/* ---------- Баннер-шапка (custom-header) ---------- */

.site-hero {
	width: 100%;
	height: clamp(160px, 22vw, 300px);
	background-size: cover;
	background-position: center 40%;
	background-repeat: no-repeat;
	background-color: var(--brand-dark);
	position: relative;
}
.site-hero::after {
	content: '';
	position: absolute; inset: 0;
	background: linear-gradient(rgba(26, 26, 140, 0) 55%, rgba(19, 19, 105, .35));
	pointer-events: none;
}
.site-hero--home { height: clamp(240px, 34vw, 460px); }

@media (max-width: 600px) {
	.site-hero,
	.site-hero--home { height: clamp(130px, 40vw, 200px); }
}

/* ---------- Раскладка ---------- */

.site-main { min-height: 50vh; }

.layout {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 2.5rem 1.25rem 4rem;
	display: grid;
	gap: 2.5rem;
}
.layout--with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
.layout--full { grid-template-columns: minmax(0, 1fr); }

.entry__title { margin-bottom: 1.25rem; }
.entry__content > * + * { margin-top: 1.15em; }

/* ---------- Боковая плашка ---------- */

.sidebar-box {
	background: var(--surface);
	border: 2px solid var(--brand);
	box-shadow: var(--shadow);
}
.sidebar-box__title {
	margin: 0;
	background: var(--brand);
	color: #fff;
	font-size: 1rem;
	padding: .75rem 1rem;
}
.sidebar-box__body { padding: 1rem; font-size: .9375rem; }
.sidebar-box__body p { margin: 0 0 .5em; }
.sidebar-box__body p:last-child { margin-bottom: 0; }

/* ---------- Лента новостей ---------- */

.archive-header { margin-bottom: 2rem; }
.archive-header__title { margin: 0; }

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

.post-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	display: flex; flex-direction: column;
	transition: box-shadow .15s, transform .15s;
}
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.post-card__media img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.post-card__body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.post-card__date { font-size: .8125rem; color: var(--text-muted); }
.post-card__title { font-size: 1.125rem; margin: .375rem 0 .5rem; }
.post-card__title a { text-decoration: none; }
.post-card__excerpt { margin: 0 0 1rem; font-size: .9375rem; color: var(--text-muted); }
.post-card__more { margin-top: auto; font-weight: 600; font-size: .9375rem; }

.pagination { margin-top: 2.5rem; }
.pagination .page-numbers {
	display: inline-block; padding: .5rem .875rem;
	border: 1px solid var(--border); background: var(--surface);
	margin-right: .25rem; border-radius: var(--radius);
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

.no-results { background: var(--surface); padding: 1.5rem; border: 1px solid var(--border); }

/* ---------- Панель связи ---------- */

.social-bar {
	position: fixed; right: 12px; top: 50%;
	transform: translateY(-50%);
	display: flex; flex-direction: column; gap: .5rem;
	z-index: 90;
}
.social-bar__item {
	width: 44px; height: 44px; border-radius: 50%;
	display: grid; place-items: center;
	background: var(--surface); color: var(--brand);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	font-weight: 700; font-size: .8125rem;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.social-bar__item:hover {
	background: var(--brand); color: #fff;
	border-color: var(--brand); text-decoration: none;
}
.social-bar__item--vk:hover { background: #07f; border-color: #07f; }
.social-bar__item--tg:hover { background: #29a9eb; border-color: #29a9eb; }
.social-bar__item--wa:hover { background: #25d366; border-color: #25d366; }

/* ---------- Подвал ---------- */

.site-footer { background: var(--brand); color: #fff; margin-top: auto; }

.site-footer__inner {
	max-width: var(--wrap); margin: 0 auto;
	padding: 3rem 1.25rem;
	display: grid; gap: 2rem;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.site-footer__title {
	color: #fff; font-size: 1rem;
	text-transform: uppercase; letter-spacing: .04em;
	margin: 0 0 1rem;
}
.site-footer__text { font-size: .9375rem; }
.site-footer__text p { margin: 0 0 .5em; }
.site-footer__text a { color: #fff; text-decoration: underline; }

.site-footer__bottom { background: var(--brand-dark); }
.site-footer__bottom-inner {
	max-width: var(--wrap); margin: 0 auto;
	padding: 1rem 1.25rem;
	font-size: .8125rem; color: rgba(255,255,255,.75);
}

.to-top {
	position: fixed; right: 12px; bottom: 20px;
	width: 44px; height: 44px;
	background: var(--brand); color: #fff;
	border: 0; border-radius: var(--radius);
	font-size: 1.25rem; cursor: pointer;
	box-shadow: var(--shadow); z-index: 90;
}
.to-top:hover { background: var(--brand-light); }
.to-top[hidden] { display: none; }

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

@media (max-width: 960px) {
	.layout--with-sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 782px) {
	.site-header__inner { justify-content: center; text-align: center; }
	.site-header__search { flex-basis: 100%; }

	.site-nav__toggle { display: flex; justify-content: center; }

	.site-nav__list {
		display: none;
		flex-direction: column;
		padding-bottom: .5rem;
	}
	.site-nav__list.is-open { display: flex; }
	.site-nav__list a { padding: .875rem 1rem; text-align: center; }

	.site-nav__list .sub-menu { position: static; display: block; background: var(--brand-dark); }

	.site-nav { position: static; }

	.social-bar { display: none; }
}

/* ---------- Препараты: сетка карточек ---------- */

.product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1.5rem;
	margin: 1.5rem 0;
}

.product-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	transition: box-shadow .15s, transform .15s, border-color .15s;
}
.product-card:hover {
	box-shadow: var(--shadow);
	transform: translateY(-2px);
	border-color: var(--brand-light);
}
.product-card__link {
	display: flex; flex-direction: column; height: 100%;
	text-decoration: none; color: var(--text);
}
.product-card__link:hover { text-decoration: none; }

.product-card__media img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.product-card__media--empty {
	display: grid; place-items: center;
	aspect-ratio: 16/10;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
	color: rgba(255,255,255,.9);
	font-weight: 800; font-size: 1.5rem; letter-spacing: .1em;
}

.product-card__body { padding: 1.125rem 1.25rem 1.375rem; display: flex; flex-direction: column; gap: .3rem; }
.product-card__title { font-weight: 700; font-size: 1.0625rem; color: var(--brand); }
.product-card__inn { font-size: .875rem; color: var(--text-muted); font-style: italic; }
.product-card__form { font-size: .8125rem; color: var(--text-muted); }

/* Бейдж статуса регистрации */
.product-badge {
	display: inline-block;
	align-self: flex-start;
	margin-top: .35rem;
	padding: .2rem .6rem;
	border-radius: 999px;
	font-size: .75rem; font-weight: 600; line-height: 1.4;
}
.product-badge--planned    { background: #eef0f6; color: #4a4f68; }
.product-badge--inspection { background: #fff3d6; color: #8a6300; }
.product-badge--in_process { background: #e0ecff; color: #12468f; }
.product-badge--registered { background: #dcf5e4; color: #1c6b38; }

/* ---------- Препарат: страница ---------- */

.product-hero { margin-bottom: 1.5rem; }
.product-hero__badge { margin: 0 0 .75rem; }
.product-hero__title { margin: 0 0 .25rem; }
.product-hero__latin { margin: 0 0 1rem; color: var(--text-muted); font-style: italic; font-size: 1.0625rem; }

.product-hero__chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.product-chip {
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: .3rem .8rem;
	font-size: .875rem; color: var(--text);
}
.product-chip__key { color: var(--text-muted); font-weight: 600; margin-right: .15rem; }

.product-media { margin: 0 0 1.75rem; }
.product-media img { width: 100%; border-radius: var(--radius); }

.product-description { margin-bottom: 2rem; font-size: 1.0625rem; }

/* Инструкция — аккордеон */
.product-leaflet { margin: 0 0 2rem; }
.product-leaflet__title { margin-bottom: 1rem; }

.product-acc {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-bottom: .625rem;
	overflow: hidden;
}
.product-acc__head {
	display: flex; align-items: center; gap: .625rem;
	padding: .9rem 1.125rem;
	font-weight: 700; color: var(--brand);
	cursor: pointer; list-style: none;
	user-select: none;
}
.product-acc__head::-webkit-details-marker { display: none; }
.product-acc__head::before {
	content: '+';
	flex: 0 0 auto;
	width: 20px; height: 20px;
	display: grid; place-items: center;
	color: var(--accent); font-weight: 700; font-size: 1.25rem; line-height: 1;
}
.product-acc[open] > .product-acc__head::before { content: '\2212'; } /* − */
.product-acc[open] > .product-acc__head { border-bottom: 1px solid var(--border); }
.product-acc__head:hover { background: var(--surface-alt); }
.product-acc__body { padding: 1rem 1.125rem 1.125rem; }
.product-acc__body > *:first-child { margin-top: 0; }
.product-acc__body > *:last-child { margin-bottom: 0; }

/* Документы */
.product-docs { margin: 0 0 2rem; }
.product-docs__title { margin-bottom: 1rem; }
.product-docs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .625rem; }
.product-doc {
	display: inline-flex; align-items: center; gap: .75rem;
	padding: .7rem 1rem;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	font-weight: 600; color: var(--brand);
}
.product-doc:hover { text-decoration: none; border-color: var(--brand-light); background: var(--surface-alt); }
.product-doc__ico {
	flex: 0 0 auto;
	background: var(--accent); color: #fff;
	font-size: .6875rem; font-weight: 700; letter-spacing: .03em;
	padding: .15rem .4rem; border-radius: 3px;
}

.product-footer { margin-top: 2rem; }
.entry__disclaimer {
	background: var(--surface-alt);
	border-left: 3px solid var(--brand-light);
	padding: 1rem 1.25rem;
	font-size: .875rem; color: var(--text-muted);
	margin: 0;
}

/* Колонка «Кратко» */
.fact-box {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	margin-bottom: 1.5rem;
	overflow: hidden;
}
.fact-box__title {
	margin: 0;
	background: var(--brand); color: #fff;
	font-size: 1rem; padding: .75rem 1rem;
}
.fact-box__list { margin: 0; padding: 1rem; }
.fact-box__list dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.fact-box__list dd { margin: .1rem 0 .75rem; font-weight: 600; }
.fact-box__list dd:last-of-type { margin-bottom: 0; }
.fact-box__status { padding: 0 1rem 1rem; margin: 0; font-size: .875rem; }

/* ---------- Аккордеон программы (страница «Производственная программа») ---------- */

.program-acc {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-bottom: .625rem;
}
.program-acc summary {
	padding: .9rem 1.125rem;
	font-weight: 700; color: var(--brand);
	cursor: pointer; list-style: none;
}
.program-acc summary::-webkit-details-marker { display: none; }
.program-acc summary::before { content: '+'; color: var(--accent); font-weight: 700; margin-right: .625rem; }
.program-acc[open] summary::before { content: '\2212'; }
.program-acc__body { padding: 0 1.125rem 1.125rem; }
.program-acc__body ul { margin: 0; padding-left: 1.25rem; columns: 2; column-gap: 2rem; }
.program-acc__body li { margin: .2rem 0; break-inside: avoid; }

@media (max-width: 600px) {
	.program-acc__body ul { columns: 1; }
}

/* ---------- Форма-заявка ---------- */

.fm-form-wrap { margin: 1.5rem 0; max-width: 640px; }

.fm-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }

.fm-form__row { margin: 0 0 1rem; }
.fm-form__row label { display: block; font-weight: 600; margin-bottom: .3rem; }
.fm-req { color: var(--accent); }

.fm-input {
	width: 100%;
	padding: .6rem .75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font: inherit; color: var(--text);
	background: var(--surface);
}
.fm-input:focus-visible { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(47,47,181,.15); }
.fm-input.is-error { border-color: var(--accent); background: #fff6f5; }
textarea.fm-input { resize: vertical; min-height: 96px; }

.fm-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.fm-form__consent { margin: .25rem 0 1.25rem; font-size: .9375rem; }
.fm-form__consent label { display: flex; gap: .5rem; align-items: flex-start; }
.fm-form__consent input { margin-top: .25rem; flex: 0 0 auto; }
.fm-form__consent.is-error { color: var(--accent); }

.fm-form__submit {
	background: var(--brand); color: #fff;
	border: 0; border-radius: 999px;
	padding: .7rem 1.75rem;
	font: inherit; font-weight: 600;
	cursor: pointer;
	transition: background .15s;
}
.fm-form__submit:hover { background: var(--brand-light); }

/* Honeypot — прячем от людей, оставляем для ботов */
.fm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Сообщения формы */
.fm-alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin: 0 0 1.25rem; font-size: .9375rem; }
.fm-alert--ok { background: #dcf5e4; border: 1px solid #b6e6c4; color: #1c6b38; }
.fm-alert--error { background: #fdecea; border: 1px solid #f5c6c2; color: #a12820; }
.fm-alert ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.fm-alert li { margin: .15rem 0; }

@media (max-width: 600px) {
	.fm-form__grid { grid-template-columns: 1fr; }
}
