/*!
 * Hramada 2026 v5 — base.css (U1).
 * Токены, reset, тыпаграфіка, макет, кнопкі, формы, шапка, меню, мабільная панэль, футэр.
 * Стужка галоўнай — home.css (U2), унутраныя шаблоны — content.css (U3).
 * Крыніца праўды: v5 handoff (DESIGN_SPEC, MOBILE_SPEC, design-tokens.css). Mobile-first;
 * брэйкпойнт скарачэння шапкі — 960px (мяняць разам у CSS і nav.js).
 */

/* =========================================================================
   1. ТОКЕНЫ (design-tokens.css 1:1 + дапаўненні ніжэй)
   ========================================================================= */
:root {
	--hg-bg: #FFFFFF;
	--hg-surface: #EEEEEE;
	--hg-menu-bg: var(--hg-surface);
	--hg-library-bg: var(--hg-surface);
	--hg-ink: #262626;
	--hg-muted: #686868;
	--hg-red: #C92B32;
	--hg-red-hover: #AB232A;
	--hg-divider: #CCCCCC;
	--hg-focus: #C92B32;
	--hg-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
	--hg-content-max: 1280px;
	--hg-prose-measure: 72ch;
	--hg-gutter: 32px;
	--hg-section-gap: 64px;
	--hg-grid-gap: 32px;
	--hg-radius: 4px;
	--hg-target-min: 44px;

	/* Дапаўненне да токенаў: мяжа поля формы. #CCCCCC (1.6:1) не праходзіць 3:1 для
	   межаў кантролаў (WCAG 1.4.11), #767676 дае 4.5:1 на белым. */
	--hg-field-border: #767676;
}

@media (max-width: 767px) {
	:root {
		--hg-gutter: 20px;
		--hg-section-gap: 40px;
		--hg-grid-gap: 28px;
	}
}

@media (max-width: 359px) {
	:root {
		--hg-gutter: 16px;
	}
}

/* =========================================================================
   2. RESET
   ========================================================================= */
*,
*::before,
*::after {
	box-sizing: border-box;
}

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

body {
	margin: 0;
	background: var(--hg-bg);
	color: var(--hg-ink);
	font-family: var(--hg-font);
	font-size: 16px;
	line-height: 1.6;
	font-weight: 400;
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
	body {
		font-size: 17px;
	}
}

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

svg {
	max-width: 100%;
}

iframe,
embed,
object {
	max-width: 100%;
}

main {
	display: block;
}

ul,
ol {
	padding-left: 1.25em;
}

/* =========================================================================
   3. ТЫПАГРАФІКА
   ========================================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 .5em;
	font-weight: 500;
	line-height: 1.25;
	text-wrap: balance;
}

h1 {
	font-size: 28px;
	line-height: 1.2;
}

h2 {
	font-size: 24px;
}

h3 {
	font-size: 22px;
	line-height: 1.3;
}

h4 {
	font-size: 18px;
}

h5,
h6 {
	font-size: 16px;
}

@media (min-width: 768px) {
	h1 {
		font-size: 36px;
	}

	h2 {
		font-size: 28px;
	}

	h3 {
		font-size: 24px;
	}

	h4 {
		font-size: 20px;
	}
}

p {
	margin: 0 0 1em;
}

strong,
b {
	font-weight: 600;
}

small {
	font-size: 14px;
}

a {
	color: var(--hg-ink);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: .18em;
}

a:hover {
	color: var(--hg-red-hover);
}

hr {
	height: 0;
	margin: 2em 0;
	border: 0;
	border-top: 1px solid var(--hg-divider);
}

/* =========================================================================
   4. ДАСТУПНАСЦЬ: focus, skip-link, screen-reader-text
   ========================================================================= */
:focus-visible {
	outline: 3px solid var(--hg-focus);
	outline-offset: 2px;
}

/* Цэль skip-link: фокус праграмна, кольцы не трэба. */
#main:focus {
	outline: none;
}

.hg-skip-link {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1000;
	padding: 12px 20px;
	background: var(--hg-bg);
	color: var(--hg-ink);
	font-weight: 500;
	text-decoration: none;
	border: 2px solid var(--hg-focus);
	border-radius: 0 0 var(--hg-radius) 0;
	transform: translateY(-150%);
}

.hg-skip-link:focus {
	transform: none;
}

.screen-reader-text,
.hg-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

[hidden] {
	display: none !important;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/* =========================================================================
   5. МАКЕТ
   ========================================================================= */
.hg-container {
	width: 100%;
	max-width: var(--hg-content-max);
	margin-inline: auto;
	padding-inline: var(--hg-gutter);
}

/* =========================================================================
   6. КНОПКІ
   ========================================================================= */
.hg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--hg-target-min);
	padding: 8px 20px;
	border: 1px solid transparent;
	border-radius: var(--hg-radius);
	font: inherit;
	font-weight: 500;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.hg-btn--primary {
	background: var(--hg-red);
	color: #FFFFFF;
}

.hg-btn--primary:hover,
.hg-btn--primary:focus-visible {
	background: var(--hg-red-hover);
	color: #FFFFFF;
}

.hg-btn--secondary {
	background: var(--hg-surface);
	color: var(--hg-ink);
}

.hg-btn--secondary:hover {
	border-color: var(--hg-ink);
	color: var(--hg-ink);
}

.hg-btn--block {
	display: flex;
	width: 100%;
}

/* =========================================================================
   7. ФОРМЫ І ПОШУК
   ========================================================================= */
button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
	width: 100%;
	min-height: var(--hg-target-min);
	padding: 8px 12px;
	background: var(--hg-bg);
	color: var(--hg-ink);
	border: 1px solid var(--hg-field-border);
	border-radius: var(--hg-radius);
	line-height: 1.4;
}

textarea {
	min-height: 8em;
}

input[type="search"] {
	-webkit-appearance: none;
	appearance: none;
}

::placeholder {
	color: var(--hg-muted);
	opacity: 1;
}

/* Форма пошуку (searchform.php): абгортка з мяжой — поле + кнопка. */
.hg-searchform {
	display: flex;
	align-items: stretch;
	width: 100%;
	max-width: 36rem;
	background: var(--hg-bg);
	border: 1px solid var(--hg-field-border);
	border-radius: var(--hg-radius);
}

.hg-searchform:focus-within {
	outline: 3px solid var(--hg-focus);
	outline-offset: 2px;
}

/* Спецыфічнасць вышэй за input[type="search"] з агульных правіл палёў. */
.hg-searchform .hg-searchform__input {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	border: 0;
	border-radius: calc(var(--hg-radius) - 1px) 0 0 calc(var(--hg-radius) - 1px);
	background: transparent;
}

/* Кольцы паказвае абгортка (:focus-within), не само поле. */
.hg-searchform .hg-searchform__input:focus-visible {
	outline: none;
}

.hg-searchform__submit {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: var(--hg-target-min);
	min-height: var(--hg-target-min);
	padding: 0 16px;
	border: 0;
	border-radius: 0 calc(var(--hg-radius) - 1px) calc(var(--hg-radius) - 1px) 0;
	background: var(--hg-red);
	color: #FFFFFF;
	font-weight: 500;
	cursor: pointer;
}

.hg-searchform__submit:hover {
	background: var(--hg-red-hover);
}

.hg-searchform__submit:focus-visible {
	outline-color: #FFFFFF;
	outline-offset: -5px;
}

/* =========================================================================
   8. ШАПКА (header.php)
   Вузкі экран (па змаўчанні): [эмблема+назва+апісанне | пошук | меню],
   панэль пошуку, чырвоная кнопка, шэры рад хуткіх спасылак, панэль меню.
   ========================================================================= */
.hg-header {
	margin-bottom: var(--hg-section-gap);
	background: var(--hg-bg);
}

.hg-header__bar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	grid-template-areas:
		"brand search menu"
		"psearch psearch psearch"
		"program program program";
	align-items: start;
	padding-block: 14px 0;
}

/* Эмблема + назва + апісанне — адна спасылка на галоўную; alt эмблемы пусты. */
.hg-brand {
	grid-area: brand;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"emblem name"
		"tagline tagline";
	column-gap: 12px;
	align-items: center;
	min-width: 0;
	color: var(--hg-ink);
	text-decoration: none;
}

.hg-brand:hover {
	color: var(--hg-ink);
}

.hg-brand:hover .hg-brand__name {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: .15em;
}

.hg-brand__emblem {
	grid-area: emblem;
	display: block;
	width: auto;
	max-width: none;
	height: 44px;
}

/* min-content: кожнае слова — на асобным радку («Народная / Грамада»). */
.hg-brand__name {
	grid-area: name;
	display: block;
	width: min-content;
	font-size: 23px;
	font-weight: 500;
	line-height: 1.1;
}

.hg-brand__tagline {
	grid-area: tagline;
	margin-top: 10px;
	color: var(--hg-muted);
	font-size: 14px;
	line-height: 1.45;
}

/* Кнопкі пошуку і меню: без JS схаваныя (панэлі тады проста бачныя). */
.hg-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: var(--hg-target-min);
	height: var(--hg-target-min);
	margin: 3px 0 0;
	padding: 0;
	border: 0;
	border-radius: var(--hg-radius);
	background: transparent;
	color: var(--hg-ink);
	cursor: pointer;
}

.hg-header__toggle:hover,
.hg-header__toggle[aria-expanded="true"] {
	background: var(--hg-surface);
}

.hg-search__toggle {
	grid-area: search;
}

.hg-menu-toggle {
	grid-area: menu;
	margin-left: 4px;
}

.hg-menu-toggle .hg-icon--close {
	display: none;
}

.hg-menu-toggle[aria-expanded="true"] .hg-icon--open {
	display: none;
}

.hg-menu-toggle[aria-expanded="true"] .hg-icon--close {
	display: block;
}

/* Пошук: на вузкім — wrapper не ўплывае на grid, форма займае свой радок. */
.hg-search {
	display: contents;
}

.hg-search__panel {
	grid-area: psearch;
	margin-top: 12px;
}

.hg-search .hg-searchform {
	max-width: none;
}

/* У шапцы кнопка пошуку — толькі іконка (тэкст «Знайсьці» застаецца для AT). */
.hg-header .hg-searchform__submit {
	padding: 0;
	background: transparent;
	color: var(--hg-ink);
}

.hg-header .hg-searchform__submit:hover {
	background: var(--hg-surface);
}

.hg-header .hg-searchform__submit:focus-visible {
	outline-color: var(--hg-focus);
}

.hg-header .hg-searchform__text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.hg-header__program {
	grid-area: program;
	width: 100%;
	margin-top: 16px;
}

/* Шэры рад хуткіх спасылак (location mobile-quick). */
.hg-quick {
	margin-top: 16px;
	background: var(--hg-surface);
}

.hg-quick__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hg-quick__list a {
	display: flex;
	align-items: center;
	min-height: 48px;
	color: var(--hg-ink);
	text-decoration: none;
}

.hg-quick__list a:hover {
	color: var(--hg-red-hover);
}

.hg-quick__list a[aria-current] {
	color: var(--hg-red);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

/* Згортванне панэляў толькі калі JS жывы (.hg-js ставіць inline-сігнал у <head>);
   без JS панэль меню — звычайны спіс, форма пошуку — заўсёды бачная. */
@media (max-width: 959.98px) {
	.hg-js .hg-header__toggle {
		display: inline-flex;
	}

	.hg-js .hg-menu-panel:not(.is-open),
	.hg-js .hg-search__panel:not(.is-open) {
		display: none;
	}
}

/* Планшэт: кнопка не расцягваецца на ўсю шырыню. */
@media (min-width: 600px) and (max-width: 959.98px) {
	.hg-header__program {
		justify-self: start;
		width: auto;
		min-width: 280px;
	}
}

/* =========================================================================
   9. НАВІГАЦЫЯ: стужка-плашка (desktop) і inline-панэль (вузкі экран)
   ========================================================================= */
.hg-menu-panel {
	background: var(--hg-bg);
	border-bottom: 1px solid var(--hg-divider);
}

.hg-nav__list,
.hg-nav-service__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.hg-nav__list {
	padding-block: 4px;
}

.hg-nav__list li + li,
.hg-nav-service__list li + li {
	border-top: 1px solid var(--hg-divider);
}

.hg-nav__list a,
.hg-nav-service__list a {
	display: flex;
	align-items: center;
	min-height: 48px;
	padding-block: 8px;
	color: var(--hg-ink);
	text-decoration: none;
}

.hg-nav__list a:hover,
.hg-nav-service__list a:hover {
	color: var(--hg-red-hover);
}

.hg-nav__list a[aria-current] {
	color: var(--hg-red);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

/* Службовыя спасылкі ў панэлі (location footer) — другасная група. */
.hg-nav-service {
	margin-bottom: 8px;
	border-top: 1px solid var(--hg-divider);
	color: var(--hg-muted);
	font-size: 16px;
}

.hg-nav-service__list a {
	color: var(--hg-muted);
}

.hg-nav-service__list a:hover {
	color: var(--hg-red-hover);
}

@media (min-width: 960px) {
	.hg-header__bar {
		grid-template-columns: minmax(0, 1fr) auto auto;
		grid-template-areas: "brand search program";
		align-items: center;
		padding-block: 20px 20px;
	}

	.hg-brand {
		grid-template-areas:
			"emblem name"
			"emblem tagline";
		column-gap: 16px;
	}

	.hg-brand__emblem {
		height: 64px;
	}

	.hg-brand__name {
		align-self: end;
		width: auto;
		font-size: 34px;
	}

	.hg-brand__tagline {
		align-self: start;
		margin-top: 4px;
		font-size: 17px;
	}

	/* Шырокі экран: кнопкі і toggle-панэлі не патрэбныя, форма заўсёды бачная. */
	.hg-header__toggle {
		display: none !important;
	}

	.hg-search {
		display: block;
		grid-area: search;
	}

	.hg-search__panel {
		margin-top: 0;
	}

	.hg-search .hg-searchform {
		width: 260px;
	}

	.hg-header__program {
		width: auto;
		margin: 0 0 0 20px;
	}

	.hg-quick {
		display: none;
	}

	/* Радок 2: плашка #EEEEEE, radius 4px, без ценю. */
	.hg-menu-panel {
		border-bottom: 0;
	}

	.hg-nav {
		background: var(--hg-menu-bg);
		border-radius: var(--hg-radius);
	}

	.hg-nav__list {
		display: flex;
		justify-content: space-between;
		padding: 0 12px;
	}

	.hg-nav__list li + li {
		border-top: 0;
	}

	.hg-nav__list a {
		min-height: 56px;
		padding: 8px 16px;
	}

	.hg-nav-service {
		display: none;
	}
}

/* =========================================================================
   10. ФУТЭР (footer.php): белы, тонкі падзельнік, без цёмнага блока
   ========================================================================= */
.hg-footer {
	margin-top: var(--hg-section-gap);
	padding-block: 28px 40px;
	border-top: 1px solid var(--hg-divider);
	background: var(--hg-bg);
}

.hg-footer__top {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.hg-footer__brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--hg-ink);
	text-decoration: none;
}

.hg-footer__brand:hover {
	color: var(--hg-ink);
}

.hg-footer__emblem {
	display: block;
	width: auto;
	max-width: none;
	height: 40px;
}

.hg-footer__name {
	display: block;
	width: min-content;
	font-size: 20px;
	font-weight: 500;
	line-height: 1.15;
}

.hg-footer__social-list,
.hg-footer__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hg-footer__social-list a,
.hg-footer__list a,
.hg-footer__site {
	display: inline-flex;
	align-items: center;
	min-height: var(--hg-target-min);
	color: var(--hg-ink);
	text-decoration: none;
}

.hg-footer__social-list a:hover,
.hg-footer__list a:hover,
.hg-footer__site:hover {
	color: var(--hg-red-hover);
	text-decoration: underline;
}

.hg-footer__bottom {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--hg-divider);
}

@media (min-width: 768px) {
	.hg-footer__top {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.hg-footer__bottom {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 0 32px;
	}
}
