/* ==========================================================================
   Мастер реек — базовая раскладка: сброс, сетка, шапка, меню, подвал
   ========================================================================== */

/* ---------- переменные ---------- */
:root {
	--c-header: #032a73;
	--c-accent: #0038a1;
	--c-accent-2: #0aaadb;
	--c-accent-3: #3496ed;
	--c-accent-soft: #c9c579;
	--c-accent-active: #debc71;
	--c-dark: #101010;
	--c-dark-2: #1b1b1b;
	--c-card: #272727;
	--c-footer: #1f1f1f;
	--c-footer-text: #d1cdcd;
	--c-text: #fff;
	--c-text-dim: rgba(255, 255, 255, .25);
	--c-line: #ccc;
	--font-head: "Bai Jamjuree", -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-body: Georgia, "Times New Roman", serif;
	--radius: 10px;
	--radius-sm: 5px;
	--header-h: 80px;

	/* Шкала слоёв. Порядок важен: модалка заявки должна перекрывать шапку,
	   а выезжающее меню — быть выше модалки. */
	--z-scroll-top: 400;
	--z-header: 1000;
	--z-modal: 2000;
	--z-menu-overlay: 2900;
	--z-menu: 3000;
	--z-skip-link: 100000;
}

/* ---------- сброс ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* тёмная полоса прокрутки: на тёмном сайте стандартная белая выглядит
	   как светлая полоса сбоку. Поля формы при этом не меняются: у них
	   заданы свои цвета. */
	color-scheme: dark;
	scrollbar-color: #4a4a4a #141414;
	background-color: var(--c-dark);
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #141414; }
::-webkit-scrollbar-thumb { background: #4a4a4a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #5d5d5d; }

body {
	margin: 0;
	/* Место под зафиксированную шапку. Именно padding, а не margin-top
	   на main: отступ margin вышел бы из body наружу (коллапс) и поднял
	   бы весь документ вместе с якорем #top — ссылка «Главная» перестала бы
	   прокручивать страницу в самое начало. */
	padding-top: var(--header-h);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.56;
	color: var(--c-text);
	/* тёмный, а не белый: при любой перерисовке под шапкой не должно
	   проступать светлое пятно */
	background-color: var(--c-dark);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin-top: 0; font-weight: 500; line-height: 1.2; }
h1 { margin-bottom: .5rem; }
h2, h4, h5, h6 { margin-bottom: .5rem; }
h3 { margin-bottom: 1rem; }
p { margin-top: 0; margin-bottom: 1rem; }
ul, ol { margin-top: 0; margin-bottom: 1rem; padding-left: 2rem; }
img { display: block; max-width: 100%; height: auto; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { margin: 20px 0; border: 0; border-top: 1px solid #eee; }
a { color: #fff; text-decoration: none; transition: color .2s ease, background-color .2s ease; }
a:hover { color: #044cd0; }
:focus-visible { outline: 2px solid var(--c-accent-3); outline-offset: 2px; }

@media (min-width: 768px) and (max-width: 991px) { body { font-size: 14px; } }
@media (max-width: 767px) { body { font-size: 13px; } }

/* ---------- утилиты ---------- */
/* Отступ, с которым якорь подводится под липкую шапку: её высота + зазор */
:root { --anchor-offset: 90px; }

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: var(--z-skip-link);
	padding: 12px 20px;
	background: #fff;
	color: #000;
	border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.container {
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	padding-right: 15px;
	padding-left: 15px;
}
@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: 1380px) { .container { max-width: 1320px; } }

/* широкая раскладка от края до края (диагностика, контакты) */
.container--wide {
	max-width: 1600px;
	padding-right: 0;
	padding-left: 0;
}

.row { display: flex; flex-wrap: wrap; margin-right: -15px; margin-left: -15px; }
.col-12 { width: 100%; }
.col-md-4 { width: 33.333333%; }
.col-md-6 { width: 50%; }
.col-md-8 { width: 66.666667%; }
[class*="col-"] { position: relative; padding-right: 15px; padding-left: 15px; }
@media (max-width: 991px) {
	.col-md-4, .col-md-6, .col-md-8 { width: 100%; }
}

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- кнопки ---------- */
.btn {
	display: inline-block;
	padding: 15px 25px;
	border: 1px solid;
	border-radius: var(--radius);
	background: transparent;
	color: #fff;
	font-size: 16px;
	font-weight: 500;
	line-height: 24px;
	text-transform: capitalize;
	white-space: nowrap;
	transition: background-color .3s ease-in-out, color .3s ease-in-out, transform .3s ease-in-out;
}
.btn:hover, .btn:focus { background-color: #fff; color: #222; transform: scale(.95); }

/* ---------- шапка ---------- */
/* position/z-index объявлены в правиле ниже, после .site-header__inner */
.site-header__inner {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	min-height: var(--header-h);
}

.logo { display: inline-flex; align-items: center; }
.logo__img { height: 70px; width: auto; }

/* основное меню */
.main-menu { display: flex; align-items: center; margin-left: auto; }
.main-menu__list {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}
.main-menu__item { position: relative; }
.main-menu__link {
	display: block;
	padding: 0 15px;
	font-family: var(--font-head);
	font-size: 16px;
	font-weight: 500;
	line-height: var(--header-h);
	text-transform: uppercase;
	white-space: nowrap;
}
.main-menu__link:hover, .main-menu__link:focus { color: var(--c-accent-soft); }
.main-menu__link.is-active { font-weight: 600; color: var(--c-accent-active); }

/* бургер */
.burger {
	display: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: none;
}
.burger__box { display: block; width: 25px; }
.burger__box > span {
	display: block;
	height: 2px;
	margin: 5px 0;
	background-color: #fff;
	transition: background-color .3s ease-in, opacity .3s ease-in, transform .3s ease-in;
}
body.is-offcanvas .burger__box > span { background-color: #000; }
body.is-offcanvas .burger__box > span:nth-child(1) { transform: translate(0, 7px) rotate(-45deg); }
body.is-offcanvas .burger__box > span:nth-child(2) { opacity: 0; }
body.is-offcanvas .burger__box > span:nth-child(3) { transform: translate(0, -7px) rotate(45deg); }

/* Шапка всегда зафиксирована, место под неё резервирует body
   (padding-top). Раньше она переключалась между position:relative и
   position:fixed на пороге 100px, и в этот момент страница прыгала —
   между шапкой и содержимым проступал белый фон body. */
.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--z-header);
	width: 100%;
	background: var(--c-header);
	box-shadow: 0 0 4px 0 rgba(0, 0, 0, .1);
	animation: fade-in .5s;
	transition: box-shadow .25s ease;
}
.site-header.is-scrolled { box-shadow: 0 2px 12px rgba(0, 0, 0, .35); }

/* ---------- выезжающее меню ---------- */
.offcanvas-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--z-menu-overlay);
	background: rgba(0, 0, 0, .5);
	backdrop-filter: blur(10px);
	opacity: 0;
	transition: opacity .4s;
}
.offcanvas-overlay:not([hidden]) { opacity: 1; }

.offcanvas {
	position: fixed;
	top: 0; right: 0;
	z-index: var(--z-menu);
	width: 300px;
	max-width: 86vw;
	height: 100%;
	overflow-y: auto;
	background: var(--c-header);
	color: #fff;
	transform: translateX(100%);
	transition: transform .4s ease-in-out;
}
body.is-offcanvas .offcanvas { transform: none; }
body.is-offcanvas { overflow: hidden; }

.offcanvas__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	background: #000;
}
.offcanvas__body { padding: 25px; }
.offcanvas__list { margin: 0 0 15px; padding: 0; list-style: none; }
.offcanvas__list li a {
	display: block;
	padding: 12px 10px;
	border-bottom: 1px solid rgba(197, 153, 153, .21);
	color: #fff;
	font-size: 15px;
	font-weight: 500;
}
.offcanvas__list li a:hover { color: var(--c-accent-soft); }

.contact-list { margin: 20px 0 0; padding: 0; list-style: none; font-size: 14px; }
.contact-list li { margin-bottom: 10px; white-space: nowrap; }
.contact-list li span { margin-right: 5px; }
.contact-list a { color: #fff; opacity: .7; }
.contact-list a:hover { opacity: 1; }

/* ---------- кнопка "наверх" ---------- */
.scroll-top {
	position: fixed;
	right: 30px;
	bottom: 60px;
	z-index: var(--z-scroll-top);
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 100%;
	background: rgba(100, 100, 100, .4);
	color: #fff;
	font-size: 16px;
	line-height: 36px;
	text-align: center;
	transition: all .3s ease;
}
.scroll-top:hover { background: #000; color: #fff; }
.scroll-top[hidden] { display: none; }

/* ---------- подвал ---------- */
.site-footer {
	font-size: 15px;
	background: var(--c-footer);
	color: var(--c-footer-text);
	text-align: center;
}
.site-footer .container { padding-top: 30px; padding-bottom: 30px; }
.site-footer__copy { margin: 0; }
.site-footer a { color: var(--c-footer-text); }
.site-footer a:hover { color: #fff; }

/* ---------- адаптив ---------- */
@media (max-width: 991px) {
	.main-menu__list { display: none; }
	.burger { display: block; }
	.logo__img { height: 50px; }
	:root { --header-h: 70px; --anchor-offset: 80px; }
}
@media (min-width: 992px) {
	.offcanvas, .offcanvas-overlay { display: none; }
}

/* ---------- якоря и прокрутка ---------- */
/* Секции и блоки подводим под липкую шапку */
:target, section[id] { scroll-margin-top: var(--anchor-offset); }

/* «Главная»: элемент, привязанный к самому верху документа.
   Абсолютное позиционирование нужно из-за padding-top у body: в потоке
   якорь оказался бы на высоте шапки и прокручивал бы страницу не в ноль. */
.page-anchor {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	scroll-margin-top: 0;
}

/* Блок услуг: карточки вылезают на 50px вверх от своей секции, поэтому
   запас сверху нужен больше — иначе шапка накроет их верх. */
#services { scroll-margin-top: calc(var(--anchor-offset) + 50px); }