/* =========================================================================
   База: сброс, типографика, кнопки, поля, утилиты.
   Сбросы завёрнуты в :where(), чтобы у них была нулевая специфичность и любое
   правило компонента их перебивало (иначе h1 в компоненте молча теряет шрифт).
   ========================================================================= */

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

:where(html) {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
	:where(html) { scroll-behavior: auto; }
}

body {
	margin: 0;
	background: var(--at-bg);
	color: var(--at-ink-body);
	font-family: var(--at-font);
	font-size: var(--at-size-base);
	font-weight: 400;
	line-height: var(--at-lh-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

:where(h1, h2, h3, h4, h5, h6) {
	margin: 0 0 var(--at-space-sm);
	font-family: var(--at-font);
	font-weight: 700;
	line-height: var(--at-lh-heading);
	color: var(--at-ink);
	text-wrap: balance;
}
h1 { font-size: var(--at-size-h1); line-height: var(--at-lh-display); }
h2 { font-size: var(--at-size-h2); color: var(--at-accent-dark); }
h3 { font-size: var(--at-size-h3); }
h4 { font-size: var(--at-size-h4); }
h5, h6 { font-size: var(--at-size-base); }

:where(p, ul, ol, dl, table, figure, blockquote, pre) { margin: 0 0 var(--at-space-sm); }
:where(p, li):last-child { margin-bottom: 0; }

a {
	color: var(--at-accent);
	text-decoration: none;
	transition: color var(--at-ease);
}
a:hover { color: var(--at-accent-dark); text-decoration: underline; }

:where(img, svg, video, iframe) { max-width: 100%; height: auto; }
img { display: block; }

:where(hr) { border: 0; border-top: 1px solid var(--at-border-soft); margin: var(--at-space-md) 0; }

:where(blockquote) {
	margin: 0 0 var(--at-space-sm);
	padding: var(--at-space-xs) var(--at-space-sm);
	border-left: 3px solid var(--at-accent);
	background: var(--at-surface-soft);
	border-radius: 0 var(--at-radius) var(--at-radius) 0;
}

:where(table) { width: 100%; border-collapse: collapse; }
:where(th, td) { padding: var(--at-space-xs) var(--at-space-3xs); text-align: left; border-bottom: 1px solid var(--at-border-soft); }

:focus-visible {
	outline: 2px solid var(--at-accent);
	outline-offset: 2px;
}

/* --- служебные утилиты --- */
.at-container {
	width: 100%;
	max-width: var(--at-container);
	margin-inline: auto;
	padding-inline: var(--at-gutter);
}
.at-prose { max-width: 68ch; }
.at-action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.at-muted { color: var(--at-ink-soft); font-size: var(--at-size-xs); font-weight: 400; }
.at-ta-r { text-align: right; }
.screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: var(--at-space-2xs) var(--at-space-sm);
	background: var(--at-accent);
	color: var(--at-ink-on-accent);
	font-weight: 700;
}
.skip-link:focus { left: var(--at-space-sm); top: var(--at-space-sm); }

/* --- иконки: единый штрих, цвет наследуется --- */
.at-ico {
	width: 18px; height: 18px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* =========================== кнопки ==================================== */
.at-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--at-space-2xs);
	border: 0;
	border-radius: var(--at-radius);
	padding: var(--at-space-xs) 18px;
	background: var(--at-accent);
	color: var(--at-ink-on-accent);
	font-family: inherit;
	font-size: var(--at-size-base);
	font-weight: 600;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--at-ease), color var(--at-ease), border-color var(--at-ease);
}
.at-btn:hover,
.at-btn:focus-visible { background: var(--at-accent-dark); color: var(--at-ink-on-accent); text-decoration: none; }
.at-btn:active { transform: translateY(1px); }
.at-btn[disabled], .at-btn.is-disabled { opacity: .55; pointer-events: none; }

.at-btn--outline {
	background: var(--at-surface);
	color: var(--at-accent-dark);
	border: 2px solid var(--at-accent);
	padding: 10px 16px;
}
.at-btn--outline:hover, .at-btn--outline:focus-visible { background: var(--at-accent-soft); color: var(--at-accent-dark); }

.at-btn--quiet {
	background: transparent;
	color: var(--at-accent-dark);
	padding-inline: 0;
}
.at-btn--quiet:hover { background: transparent; color: var(--at-accent); text-decoration: underline; }

.at-btn--sm { padding: 9px 14px; font-size: var(--at-size-sm); }
.at-btn--lg { padding: 16px 28px; font-size: 17px; font-weight: 700; }
.at-btn--wide { width: 100%; }

.at-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: var(--at-radius-pill);
	background: var(--at-accent);
	color: var(--at-ink-on-accent);
	font-size: var(--at-size-2xs);
	font-weight: 700;
	line-height: 1;
}

.at-linkbtn {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: var(--at-size-sm);
	color: var(--at-accent-dark);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}
.at-linkbtn:hover { color: var(--at-danger); }

/* =========================== поля ====================================== */
.at-field,
input[type=text], input[type=email], input[type=tel], input[type=url],
input[type=password], input[type=search], input[type=number], input[type=date],
select, textarea {
	width: 100%;
	padding: var(--at-space-xs) 14px;
	border: 1px solid var(--at-border);
	border-radius: var(--at-radius);
	background: var(--at-surface);
	color: var(--at-ink);
	font-family: inherit;
	font-size: var(--at-size-base);
	line-height: 1.4;
	transition: border-color var(--at-ease), box-shadow var(--at-ease);
}
input::placeholder, textarea::placeholder { color: #9aa5ab; }
.at-field:focus,
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--at-accent);
	box-shadow: 0 0 0 3px var(--at-accent-ring);
}
textarea { resize: vertical; min-height: 84px; }
input[type=checkbox], input[type=radio] { accent-color: var(--at-accent); width: 18px; height: 18px; }

label { display: block; font-weight: 700; font-size: var(--at-size-sm); margin-bottom: var(--at-space-3xs); }
.required, abbr.required { color: var(--at-danger); text-decoration: none; border: 0; }

/* =========================== карточка ================================== */
.at-card {
	background: var(--at-surface);
	border: 1px solid var(--at-border-soft);
	border-radius: var(--at-radius);
	padding: 20px 22px;
}
.at-card--flush { padding: 0; overflow: hidden; }
.at-card--float { box-shadow: var(--at-shadow); border-radius: var(--at-radius-lg); }

.at-note {
	margin: var(--at-space-sm) 0 0;
	padding: 10px 12px;
	background: var(--at-surface-soft);
	border-left: 3px solid var(--at-accent);
	border-radius: 0 var(--at-radius) var(--at-radius) 0;
	font-size: var(--at-size-xs);
	color: var(--at-ink-soft);
}
