/* =========================================================
   Plus 2026 — Base: reset, типографика, контейнер, сетка.
   Mobile-first. Зависит от tokens.css.
   ========================================================= */

/* ---------- Reset / нормализация ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

* {
	margin: 0;
}

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

body {
	min-height: 100vh;
	font-family: var(--font-base);
	font-weight: var(--fw-regular);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	color: var(--color-text);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* медиа не вылезает за контейнер */
img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

/* длинные слова/ссылки не ломают сетку */
p,
h1,
h2,
h3,
h4,
li,
a {
	overflow-wrap: break-word;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
	background: none;
	border: none;
}

a {
	color: var(--color-accent);
	text-decoration: none;
}

ul,
ol {
	list-style: none;
	padding: 0;
}

/* ---------- Типографика ---------- */
h1,
h2,
h3,
h4 {
	color: var(--color-heading);
	font-weight: var(--fw-semibold);
	line-height: var(--lh-heading);
}

h1 {
	font-size: var(--fs-h1);
	line-height: var(--lh-tight);
}

h2 {
	font-size: var(--fs-h2);
}

h3 {
	font-size: var(--fs-h3);
}

small {
	font-size: var(--fs-small);
}

:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--c-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------- Контейнер ---------- */
/* Контейнер в стиле Bootstrap: центрирование + ступенчатые max-width. */
.container {
	width: 100%;
	margin-inline: auto;
	padding-inline: var(--container-pad);
}
@media (min-width: 576px)  { .container { max-width: 540px; } }
@media (min-width: 768px)  { .container { max-width: 720px; } }
@media (min-width: 992px)  { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }
@media (min-width: 1400px) { .container { max-width: var(--container-max); } }

/* ---------- Секция (вертикальный ритм) ---------- */
.section {
	padding-block: var(--section-y);
}

.section--soft {
	background: var(--color-bg-soft);
}

.section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-2);
	margin-bottom: var(--space-4);
}

/* ---------- Сетка карточек (сама перетекает 4→2→1) ---------- */
.grid {
	display: grid;
	gap: var(--space-3);
}

/* авто-колонки: минимум 280px, дальше делится поровну */
.grid--auto {
	grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.grid--auto-lg {
	grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}

/* фиксированные колонки с авто-сжатием на узких экранах */
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1279px) {
	.grid--4 { grid-template-columns: repeat(2, 1fr); }
	.grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
	.grid--2,
	.grid--3,
	.grid--4 { grid-template-columns: 1fr; }
}

/* ---------- Утилиты ---------- */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.stack > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}
