/* ==========================================================================
   base.css — reset, типографика, утилиты, базовые элементы.
   Палитра/токены лежат в style.css (:root).
   ========================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
	font-size: 16px;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--lm-header-h) + 1rem);
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

body {
	font-family: var(--lm-font-body);
	font-size: var(--lm-fs-base);
	line-height: 1.65;
	color: var(--lm-text);
	background: var(--lm-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
img { border-style: none; }

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--lm-text-link); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--lm-text-link-h); }

ul, ol { list-style: none; }
table { width: 100%; border-collapse: collapse; }

::selection { background: var(--lm-accent-soft); color: var(--lm-text-link); }

/* ---- Типографика ---- */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--lm-font-display);
	font-weight: 800;
	line-height: 1.1;
	color: var(--lm-text);
	letter-spacing: -0.025em;
	text-wrap: balance;
}
h1 { font-size: var(--lm-fs-h1); letter-spacing: -0.03em; }
h2 { font-size: var(--lm-fs-h2); letter-spacing: -0.02em; }
h3 { font-size: var(--lm-fs-h3); font-weight: 700; }
h4 { font-size: clamp(1.05rem, 1rem + 0.2vw, 1.15rem); font-weight: 700; }
p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; }
small { font-size: var(--lm-fs-sm); }

/* ---- Утилиты каркаса ---- */
.lm-container {
	width: 100%;
	max-width: var(--lm-container);
	margin-inline: auto;
	padding-inline: var(--sp-5);
}

.lm-section {
	padding-top: clamp(2.75rem, 1.75rem + 4vw, 4.5rem);
	padding-bottom: clamp(2.75rem, 1.75rem + 4vw, 4.5rem);
}
/* Секция сразу после мини-hero — меньший отступ сверху (hero уже даёт разделение) */
.lm-hero-section + .lm-section,
.lm-hero + .lm-section {
	padding-top: clamp(1.75rem, 1rem + 2.5vw, 3rem);
}
.lm-section--tight { padding-block: var(--sp-6); }
.lm-section--soft  { background: var(--lm-bg-soft); }
.lm-section--dark  {
	background: var(--lm-surface-dark);
	color: var(--lm-text-on-dark);
}
.lm-section--dark h1,
.lm-section--dark h2,
.lm-section--dark h3 { color: #fff; }

.lm-section__head {
	max-width: 720px;
	margin-bottom: clamp(1.75rem, 1rem + 2vw, 2.5rem);
}
.lm-section__head--center { margin-inline: auto; text-align: center; }

.lm-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	font-family: var(--lm-font-body);
	font-size: var(--lm-fs-sm);
	font-weight: 600;
	color: var(--lm-text-link);
	margin-bottom: var(--sp-3);
}
.lm-eyebrow::before {
	content: "";
	width: 28px;
	height: 2px;
	background: var(--lm-grad-accent);
	border-radius: 2px;
	display: inline-block;
}
.lm-section__head--center .lm-eyebrow { justify-content: center; }

.lm-section__title { margin-bottom: var(--sp-3); }
.lm-section__subtitle {
	color: var(--lm-text-muted);
	font-size: var(--lm-fs-md);
	line-height: 1.65;
	max-width: 640px;
}
.lm-section__head--center .lm-section__subtitle { margin-inline: auto; }

/* ---- Надзаголовок-eyebrow без черты (компактный) ---- */
.lm-tag {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	padding: 0.3em 0.85em;
	font-size: var(--lm-fs-sm);
	font-weight: 600;
	border-radius: var(--r-pill);
	background: var(--lm-accent-soft);
	color: var(--lm-text-link);
	white-space: nowrap;
}
.lm-tag--eco { background: var(--lm-eco-soft); color: var(--lm-eco); }

/* ---- Скрытый текст для screen-reader ---- */
.lm-sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Skip-link ---- */
.lm-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 9999;
	padding: var(--sp-3) var(--sp-4);
	background: var(--lm-accent);
	color: #fff;
	border-radius: 0 0 var(--r-md) 0;
}
.lm-skip-link:focus { left: 0; }

/* ---- Контентная типографика (the_content на страницах) ---- */
.lm-prose {
	font-size: 1.0625rem;
	line-height: 1.8;
	color: var(--lm-text);
	
}
.lm-prose h2 {
	margin-top: 2.4em;
	margin-bottom: 0.6em;
	font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
	font-weight: 800;
	line-height: 1.2;
	padding-top: 0.5em;
}
.lm-prose h2:first-child { margin-top: 0; }
.lm-prose h3 {
	margin-top: 1.8em;
	margin-bottom: 0.5em;
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--lm-text);
}
.lm-prose h4 {
	margin-top: 1.4em;
	margin-bottom: 0.4em;
	color: var(--lm-text-link);
	font-size: 1rem;
	font-weight: 700;
}
.lm-prose p { margin-bottom: 1.2em; }
.lm-prose ul, .lm-prose ol { margin: 0 0 1.3em 1.4em; }
.lm-prose ul { list-style: disc; }
.lm-prose ol { list-style: decimal; }
.lm-prose li { margin-bottom: 0.5em; }
.lm-prose img {
	border-radius: var(--r-lg);
	margin: 1.6em auto;
	box-shadow: var(--sh-2);
	display: block;
}
/* Несколько картинок в одном абзаце → сетка 2 колонки */
.lm-prose p > img + img,
.lm-prose p:has(> img + img) {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--sp-3);
}
.lm-prose p:has(> img + img) img {
	margin: 0;
	width: 100%;
	height: auto;
}
@media (max-width: 576px) {
	.lm-prose p:has(> img + img) {
		grid-template-columns: 1fr;
	}
}
/* Адаптивные видео (YouTube/Vimeo) — 16:9, не вылезают за контент */
.lm-prose iframe,
.lm-prose .wp-block-embed iframe,
.lm-prose embed {
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	border: none;
	border-radius: var(--r-lg);
	margin: 1.6em auto;
	box-shadow: var(--sh-2);
	display: block;
}
.lm-prose .wp-block-embed__wrapper,
.lm-prose .wp-has-aspect-ratio .wp-block-embed__wrapper {
	position: relative;
	width: 100%;
}
.lm-prose a {
	color: var(--lm-text-link);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}
.lm-prose a:hover { color: var(--lm-text-link-h); }
.lm-prose blockquote {
	margin: 1.8em 0;
	padding: var(--sp-5) var(--sp-6);
	background: var(--lm-bg-soft);
	border-left: 3px solid var(--lm-accent);
	border-radius: 0 var(--r-lg) var(--r-lg) 0;
	font-style: italic;
	color: var(--lm-text-muted);
	font-size: 1.1rem;
}
.lm-prose strong { font-weight: 700; color: var(--lm-text); }
.lm-prose table {
	margin: 2em 0;
	font-size: 0.95rem;
	border-collapse: collapse;
	width: 100%;
	border-radius: var(--r-md);
	overflow: hidden;
	box-shadow: var(--sh-card);
}
.lm-prose th, .lm-prose td {
	padding: var(--sp-3) var(--sp-4);
	border-bottom: 1px solid var(--lm-border);
	text-align: left;
}
.lm-prose th {
	background: var(--lm-surface-dark);
	color: #fff;
	font-weight: 600;
	font-size: 0.85rem;
	letter-spacing: 0.02em;
}
.lm-prose tr:nth-child(even) td { background: var(--lm-bg-soft); }
.lm-prose tr:last-child td { border-bottom: none; }
.lm-prose hr {
	border: none;
	height: 1px;
	background: var(--lm-border);
	margin: 2.5em 0;
}

/* ---- Анимации появления (data-reveal) ---- */
[data-reveal] {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
[data-reveal].is-revealed {
	opacity: 1;
	transform: none;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
	[data-reveal] { opacity: 1; transform: none; }
}

/* ---- Кастомный скроллбар (десктоп) ---- */
@media (pointer: fine) {
	::-webkit-scrollbar { width: 12px; height: 12px; }
	::-webkit-scrollbar-track { background: var(--lm-bg-soft); }
	::-webkit-scrollbar-thumb { background: var(--lm-border-strong); border-radius: var(--r-pill); border: 3px solid var(--lm-bg-soft); }
	::-webkit-scrollbar-thumb:hover { background: var(--lm-text-faint); }
}

/* ---- Фокус-кольцо ---- */
:focus-visible {
	outline: 2px solid var(--lm-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ---- Grain overlay — тонкая SVG-текстура против плоского digital-вида ---- */
.lm-grain {
	position: fixed;
	inset: 0;
	z-index: 9998;
	pointer-events: none;
	opacity: 0.028;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) {
	.lm-grain { display: none; }
}
