/*
 * Theme-level CSS overrides for the block editor and WP-specific elements
 * that aren't covered by base.css / pages.css / dark-theme.css.
 *
 * Kept small — the real design tokens live in base.css; this file just
 * bridges WP's default block classes to our variables.
 */

/* ----- FSE wrapper reset -----
 * WP wraps front-end output in .wp-site-blocks and adds global padding / max-width
 * that breaks our full-bleed hero & section layout. Strip those defaults.
 */
body { margin: 0 !important; }
.wp-site-blocks,
body > .wp-site-blocks,
.wp-site-blocks > .is-layout-constrained,
.wp-site-blocks > main,
.wp-site-blocks > .wp-block-group,
.wp-site-blocks > .wp-block-shortcode {
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}
/* Kill WP's 24px auto-gap between top-level blocks (header ↔ main ↔ footer). */
.wp-site-blocks > *,
:where(.wp-site-blocks) > *,
.wp-site-blocks > :first-child,
.wp-site-blocks > :last-child,
main > *,
main > :first-child,
main > :last-child,
main.wp-block-group > * {
	margin-block-start: 0 !important;
	margin-block-end: 0 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}
.has-global-padding { padding: 0 !important; }
.has-global-padding > .alignfull { margin-left: 0 !important; margin-right: 0 !important; }

main.wp-block-group,
.wp-site-blocks > main {
	display: block;
	width: 100%;
}

/* Strip WP's automatic wpautop <p> tags around section html that the shortcode outputs */
.wp-block-shortcode > p:empty { display: none; }

/* Hard-lock header layout: FSE/wpautop insert extra <p> wrappers that can
 * push .header-cta to a new row. Use flex with wrap:nowrap so all 3 children
 * share a single row, and push nav/cta to the right via margin-left:auto. */
.site-header .header-inner,
body .site-header .header-inner,
.wp-site-blocks .site-header .header-inner {
	display: grid !important;
	grid-template-columns: auto 1fr auto !important;
	align-items: center !important;
	gap: 32px !important;
	max-width: var(--maxw, 1280px) !important;
	margin: 0 auto !important;
	padding: 10px 24px !important;
}
.site-header .header-inner > .logo { margin-right: auto !important; flex: 0 0 auto !important; }
.site-header .header-inner > .nav  { display: flex !important; gap: 2px !important; flex: 0 1 auto !important; flex-wrap: nowrap !important; }
.site-header .header-inner > .nav > a { white-space: nowrap !important; flex: 0 0 auto !important; }
.site-header .header-inner > .header-cta { display: flex !important; align-items: center !important; gap: 10px !important; flex: 0 0 auto !important; }
.site-header .header-inner > p,
.site-header .header-inner > p:empty,
.site-header .header-inner > br { display: none !important; }

/* ----- Responsive header fix -----
 * Desktop: single row. Progressively shrink paddings, gaps, and font sizes
 * so everything fits at narrower widths. Collapse to 2 rows only under 720px.
 */
@media (max-width: 1280px) {
	.header-inner { gap: 14px !important; padding-left: 16px !important; padding-right: 16px !important; }
	.nav { gap: 0 !important; }
	.nav a { padding: 6px 7px !important; font-size: 13px !important; white-space: nowrap !important; }
	.header-cta { gap: 6px !important; }
	.header-cta .btn { padding: 7px 10px !important; font-size: 12px !important; }
	.logo-text .name { font-size: 13px !important; }
	.logo-text .sub { font-size: 10px !important; }
	.logo-mark { width: 26px !important; height: 26px !important; }
}
@media (max-width: 1100px) {
	.nav a { padding: 6px 6px !important; font-size: 12px !important; white-space: nowrap !important; }
	.logo-text .sub { display: none !important; }
}
@media (max-width: 880px) {
	/* Промежуточный (планшет/альбомный мобильный) — сразу бургер,
	 * двухстрочную раскладку не используем. */
}
@media (max-width: 640px) {
	.utilbar-inner { flex-wrap: wrap; gap: 10px !important; }
	.utilbar-inner > div { font-size: 11px; }
	.header-inner { padding: 10px 16px !important; }
	.header-inner .btn { padding: 10px 14px; font-size: 13px; }
}

/* =====================================================================
 * Mobile header (<=720px): burger + drawer.
 * Desktop/tablet (>720px) — .si-burger/.si-drawer hidden, layout unchanged.
 * ===================================================================== */
.si-burger { display: none; }
.si-drawer { display: none; }

@media (max-width: 960px) {
	/* Hide utility bar on mobile — its content moves into the drawer */
	.utilbar { display: none !important; }

	/* Hide inline nav in header — replaced by burger */
	.site-header .header-inner .nav { display: none !important; }

	/* Collapse header to a single row: logo | cta (Вход + бургер) */
	.site-header .header-inner,
	body .site-header .header-inner,
	.wp-site-blocks .site-header .header-inner {
		grid-template-columns: auto auto !important;
		grid-template-areas: "logo cta" !important;
		row-gap: 0 !important;
		gap: 12px !important;
		padding: 10px 16px !important;
	}
	.site-header .header-inner .logo { grid-area: logo; }
	.site-header .header-inner .header-cta {
		grid-area: cta;
		justify-self: end;
		gap: 8px !important;
	}
	/* Tight CTA: keep primary button, hide "Вход" to save room */
	.site-header .header-cta .btn-ghost { display: none !important; }
	/* На мобиле кнопка «Подключиться» превращается в иконку — текста нет,
	 * видна только стрелка ↗. Иначе на узких экранах (iPhone 13, ~375px)
	 * она заезжает на логотип. */
	.site-header .header-cta .btn-primary {
		padding: 0 !important;
		width: 40px;
		height: 40px;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		font-size: 0 !important;
		gap: 0 !important;
	}
	.site-header .header-cta .btn-primary .btn-arrow {
		font-size: 18px;
		line-height: 1;
	}

	/* Logo: drop subtitle, shrink name */
	.logo-text .sub { display: none !important; }
	.logo-text .name { font-size: 13px !important; }
	.logo-mark { width: 26px !important; height: 26px !important; }

	/* ---- Footer на мобиле ---- */
	/* Одна колонка + перенос длинных слов (email, номера с тире). */
	.site-footer .footer-grid {
		grid-template-columns: 1fr !important;
		gap: 32px !important;
		padding: 0 16px 40px !important;
	}
	.site-footer .footer-grid li,
	.site-footer .footer-grid a,
	.site-footer .footer-grid p {
		overflow-wrap: anywhere;
		word-break: break-word;
	}
	.site-footer .footer-bottom {
		flex-direction: column;
		gap: 6px;
		align-items: flex-start;
		padding: 20px 16px 0 !important;
	}

	/* ---- Burger button ---- */
	.si-burger {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 40px; height: 40px;
		padding: 0;
		background: transparent !important;
		border: 1px solid var(--line, #d8dde4);
		border-radius: 8px;
		cursor: pointer;
		color: #0a111f;
	}
	body.page-f .si-burger,
	body.page-e .si-burger {
		border-color: #2a3a55;
		color: #e6eef8;
	}
	.si-burger__icon {
		display: block;
		width: 22px; height: 22px;
		color: inherit;
		pointer-events: none;
	}
	.si-burger__l {
		transform-origin: 12px 12px;
		transition: transform .22s ease, opacity .22s ease;
	}
	.si-burger.is-open .si-burger__l1 { transform: translateY(5px) rotate(45deg); }
	.si-burger.is-open .si-burger__l2 { opacity: 0; }
	.si-burger.is-open .si-burger__l3 { transform: translateY(-5px) rotate(-45deg); }

	/* ---- Drawer ---- */
	.si-drawer {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 200;
		pointer-events: none;
	}
	.si-drawer__backdrop {
		position: absolute; inset: 0;
		background: rgba(4, 8, 16, 0.55);
		opacity: 0; transition: opacity .24s ease;
		z-index: 1;
	}
	.si-drawer__inner {
		position: absolute;
		top: 0; right: 0; bottom: 0;
		/* Fallback для старых Firefox Android: dvw поддержан только с 117.
		 * Без фолбэка весь width: min() игнорируется и drawer растягивается. */
		width: 86vw;
		max-width: 360px;
		width: min(86dvw, 360px);
		max-width: 100%;
		background: #0a111f;
		color: #e6eef8;
		/* Верх оставляем под системной плашкой Android/iOS Safari. */
		padding: 64px 24px 32px 24px;
		padding-top: calc(env(safe-area-inset-top, 0px) + 64px);
		padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
		box-shadow: -12px 0 48px rgba(0,0,0,.4);
		transform: translateX(100%);
		transition: transform .28s cubic-bezier(.2,.7,.2,1);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		display: flex; flex-direction: column; gap: 24px;
		z-index: 2;
		box-sizing: border-box;
	}
	.si-drawer.is-open { pointer-events: auto; }
	.si-drawer.is-open .si-drawer__backdrop { opacity: 1; }
	.si-drawer.is-open .si-drawer__inner { transform: translateX(0); }

	/* Кнопка закрытия — абсолютно в правом верхнем углу drawer'а,
	 * с учётом системной плашки. Никаких отрицательных margin, чтобы
	 * ничего не толкало содержимое вбок. */
	.si-drawer__close {
		position: absolute;
		top: calc(env(safe-area-inset-top, 0px) + 14px);
		right: 14px;
		width: 40px; height: 40px;
		background: #0a111f;
		border: 1px solid #2a3a55;
		border-radius: 8px;
		color: #e6eef8;
		font-size: 24px; line-height: 1;
		cursor: pointer;
		z-index: 3;
	}

	.si-drawer__nav { margin-top: 0; }
	.si-drawer__nav .nav {
		display: flex !important;
		flex-direction: column !important;
		gap: 2px !important;
		overflow: visible !important;
	}
	.si-drawer__nav .nav a {
		display: block;
		padding: 14px 6px 14px 14px !important;
		font-size: 17px !important;
		font-weight: 400;
		color: #e6eef8 !important;
		border-bottom: 1px solid #1a2438;
		border-left: 2px solid transparent;
		background: transparent !important;
		text-decoration: none;
		transition: color .15s ease, border-color .15s ease;
	}
	.si-drawer__nav .nav a.active,
	.si-drawer__nav .nav a.current-menu-item,
	.si-drawer__nav .nav .current-menu-item > a {
		color: #3a9ae8 !important;
		border-left-color: #3a9ae8 !important;
		background: transparent !important;
	}

	.si-drawer__util {
		display: flex; flex-direction: column; gap: 14px;
		padding-top: 16px;
		border-top: 1px solid #1a2438;
	}
	.si-drawer__phone {
		display: flex; flex-direction: column; gap: 4px;
		padding: 12px 14px;
		border: 1px solid #1d2a42;
		border-radius: 10px;
		background: rgba(121,179,237,0.04);
		color: #e6eef8 !important;
		text-decoration: none;
	}
	.si-drawer__phone-num {
		font-family: var(--f-sans, "IBM Plex Sans", sans-serif);
		font-size: 20px;
		font-weight: 500;
		letter-spacing: -0.01em;
	}
	.si-drawer__phone-sub {
		font-family: var(--f-mono, "JetBrains Mono", monospace);
		font-size: 11px;
		letter-spacing: 0.04em;
		color: #8ea3c4;
		text-transform: uppercase;
	}
	.si-drawer__action {
		display: block;
		padding: 12px 14px;
		border: 1px solid #1d2a42;
		border-radius: 10px;
		color: #e6eef8 !important;
		text-decoration: none;
		font-family: var(--f-sans, "IBM Plex Sans", sans-serif);
		font-size: 15px;
		letter-spacing: 0.01em;
	}
	.si-drawer__action:hover,
	.si-drawer__action:active { border-color: #3a9ae8; color: #3a9ae8 !important; }

	body.si-drawer-open { overflow: hidden; }

	/* ---------------------------------------------------------------
	 * Сжатие вертикального ритма на мобиле.
	 * Десктопные 96px/80px paddings между секциями визуально рвут
	 * скролл на телефоне. Ужимаем до 40-44px.
	 * --------------------------------------------------------------- */
	.section,
	.principles,
	.team,
	.timeline,
	.process,
	.e-cta,
	.e-cta-final,
	.e-how,
	.e-testi,
	.e-industries,
	.e-cases,
	.e-hero,
	.numbers,
	.industries,
	.cases,
	.how,
	.testi,
	.svc {
		padding-top: 44px !important;
		padding-bottom: 44px !important;
	}

	/* e-hero-main имеет свой padding: 56px 0 48px — тоже жмём */
	.e-hero-main {
		padding: 24px 0 28px !important;
		gap: 20px !important;
	}

	/* Ключевые секции главной задают вертикальный padding не на
	 * себе, а на внутреннем .container (96px 24px). Ужимаем его. */
	.e-how .container,
	.e-industries .container,
	.e-cases .container,
	.e-testi .container,
	.e-cta .container {
		padding-top: 44px !important;
		padding-bottom: 44px !important;
	}

	/* Внутренние .head у секций имеют margin-bottom: 64px — тоже много */
	.e-how .head,
	.e-industries .head,
	.e-cases .head,
	.e-testi .head {
		margin-bottom: 28px !important;
		gap: 16px !important;
	}

	/* Footer: тоже ужимаем верхний отступ */
	.site-footer {
		padding: 40px 0 24px !important;
		margin-top: 0 !important;
	}

	/* Секционные margin'ы между заголовком и контентом */
	.section-head { margin-bottom: 24px !important; }

	/* Hero: заливает полэкрана — тоже сожмём */
	.hero,
	.page-head { padding: 40px 0 32px !important; }
}

/* ----- Block editor defaults → site tokens ----- */
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	font-family: var(--f-sans, "IBM Plex Sans", sans-serif);
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.02em;
	border: 1px solid var(--line, #d8dde4);
	border-radius: 0;
	background: transparent;
	color: inherit;
	text-decoration: none;
	transition: background .2s, color .2s, border-color .2s;
}
.wp-block-button.is-style-fill .wp-block-button__link,
.wp-block-button.btn-primary .wp-block-button__link {
	background: var(--ink, #0a0d12);
	color: #fff;
	border-color: var(--ink, #0a0d12);
}
.wp-block-button.is-style-fill .wp-block-button__link:hover,
.wp-block-button.btn-primary .wp-block-button__link:hover {
	background: var(--brand, #1767b3);
	border-color: var(--brand, #1767b3);
}

/* Pagination (archives / search) */
.wp-block-query-pagination {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 32px;
	font-family: var(--f-mono, "JetBrains Mono", monospace);
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers {
	padding: 8px 12px;
	border: 1px solid currentColor;
	color: inherit;
	text-decoration: none;
}
.wp-block-query-pagination .current {
	background: var(--ink, #0a0d12);
	color: #fff;
	border-color: var(--ink, #0a0d12);
}

/* Search form */
.wp-block-search {
	margin: 24px 0;
}
.wp-block-search__input {
	border: 1px solid var(--line, #d8dde4);
	padding: 12px 14px;
	font-family: var(--f-sans, inherit);
	font-size: 15px;
	background: transparent;
	color: inherit;
}
.wp-block-search__button {
	margin-left: -1px;
	padding: 12px 18px;
	background: var(--ink, #0a0d12);
	color: #fff;
	border: 1px solid var(--ink, #0a0d12);
	font-family: var(--f-sans, inherit);
	font-size: 14px;
	cursor: pointer;
}

/* Post date / meta */
.news-card .wp-block-post-date,
.news-card time {
	display: block;
	font-family: var(--f-mono, monospace);
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted, #6a717b);
	margin-bottom: 10px;
}
.news-card h2 {
	font-size: 22px;
	line-height: 1.25;
	margin: 0 0 10px;
}
.news-card h2 a {
	color: inherit;
	text-decoration: none;
}
.news-card h2 a:hover { text-decoration: underline; }

/* Footer widgets */
.site-footer .footer-widget {
	margin-bottom: 24px;
}
.site-footer .footer-widget ul { list-style: none; padding: 0; margin: 0; }
.site-footer .footer-widget li { margin: 0 0 8px; }

/* Alignment helpers WP expects */
.alignfull { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); max-width: 100vw; }
.alignwide { max-width: min(1200px, 92vw); margin-left: auto; margin-right: auto; }

/* WP core caption / gallery tweaks to match dark theme on page-f */
body.page-f .wp-caption-text,
body.page-f .wp-block-image figcaption {
	color: var(--muted-dark, #6b7a94);
	font-family: var(--f-mono, monospace);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Dark forms (contact page) */
body.page-f input[type="text"],
body.page-f input[type="email"],
body.page-f input[type="tel"],
body.page-f input[type="search"],
body.page-f input[type="url"],
body.page-f textarea,
body.page-f select {
	background: #070c18;
	border: 1px solid #2a3a55;
	color: #e6eef8;
	padding: 12px 14px;
	font-family: var(--f-sans, inherit);
	font-size: 15px;
	width: 100%;
}
body.page-f input:focus,
body.page-f textarea:focus,
body.page-f select:focus {
	outline: none;
	background: #070c18 !important;
	color: #e6eef8 !important;
	border-color: var(--brand, #3a9ae8);
	box-shadow: 0 0 0 3px rgba(90,140,220,.15);
}

/* WPCF7 / WPForms container */
.si-form p { margin: 0 0 16px; }
.si-form .wpcf7-submit,
.si-form button[type="submit"] {
	background: var(--brand, #1767b3);
	color: #fff;
	border: 0;
	padding: 14px 28px;
	font-family: var(--f-sans, inherit);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.02em;
	cursor: pointer;
}
.si-form .wpcf7-submit:hover,
.si-form button[type="submit"]:hover {
	background: #0f4e8c;
}
