/* =========================================================================
   HNH — дизайн-система
   Палітра «редактора коду»: глибокий синьо-чорний фон, бурштиновий акцент.
   Шрифти: Unbounded (дисплей), Inter (текст), JetBrains Mono (службовий).
   ====================================================================== */

/* ---- Шрифти (self-hosted, variable) ---- */
@font-face {
	font-family: 'Unbounded';
	src: url('../fonts/unbounded-var.woff2') format('woff2');
	font-weight: 200 900;
	font-display: swap;
}
@font-face {
	font-family: 'Inter';
	src: url('../fonts/inter-var.woff2') format('woff2');
	font-weight: 100 900;
	font-display: swap;
}
@font-face {
	font-family: 'JetBrains Mono';
	src: url('../fonts/jbmono-var.woff2') format('woff2');
	font-weight: 100 800;
	font-display: swap;
}

/* ---- Токени ---- */
:root {
	--bg: #0C0F16;
	--bg-alt: #10141E;
	--surface: #141927;
	--ink: #E8ECF4;
	--muted: #8A93A6;
	--accent: #FFB454;
	--accent-ink: #1A1204;
	--cyan: #5CCFE6;
	--line: rgba(232, 236, 244, 0.09);

	--font-display: 'Unbounded', system-ui, sans-serif;
	--font-body: 'Inter', system-ui, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, monospace;

	--container: 1160px;
	--radius: 14px;
	--dur: 0.35s;
}

/* ---- База ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
.mono { font-family: var(--font-mono); }

.container {
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: 24px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	clip-path: inset(50%);
	overflow: hidden;
}
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--accent);
	color: var(--accent-ink);
	padding: 10px 18px;
	z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---- Кнопки ---- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 13px 26px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 15.5px;
	line-height: 1;
	border: 1px solid transparent;
	transition: transform var(--dur), background var(--dur), border-color var(--dur), color var(--dur);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
	background: var(--accent);
	color: var(--accent-ink);
}
.btn-primary:hover { background: #FFC575; color: var(--accent-ink); }
.btn-ghost {
	border-color: var(--line);
	color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline {
	border-color: var(--line);
	color: var(--ink);
	padding: 10px 20px;
	font-size: 14.5px;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Шапка ---- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid transparent;
	transition: border-color var(--dur);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
	display: flex;
	align-items: center;
	gap: 32px;
	min-height: 72px;
}
.brand { display: inline-flex; align-items: baseline; }
.brand-mark {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 22px;
	letter-spacing: 0.02em;
	color: var(--ink);
}
.brand-dot {
	font-family: var(--font-mono);
	font-size: 15px;
	color: var(--accent);
}

.site-nav { margin-left: auto; }
.nav-list {
	display: flex;
	gap: 28px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.nav-list a {
	font-size: 15px;
	color: var(--muted);
}
.nav-list a:hover { color: var(--ink); }

.nav-toggle { display: none; }

/* ---- Головний екран ---- */
.hero {
	padding: 96px 0 88px;
	position: relative;
	overflow: hidden;
}
/* 3D-площина сітки: перспектива, повільний «потік» клітинок, нахил за курсором */
.hero-grid3d {
	position: absolute;
	inset: 0;
	perspective: 900px;
	perspective-origin: 50% 20%;
	pointer-events: none;
	overflow: hidden;
	mask-image: radial-gradient(ellipse 95% 85% at 40% 10%, #000 0%, transparent 78%);
}
.grid-plane {
	position: absolute;
	left: -30%;
	right: -30%;
	top: -10%;
	bottom: -60%;
	background-image:
		linear-gradient(var(--line) 1px, transparent 1px),
		linear-gradient(90deg, var(--line) 1px, transparent 1px);
	background-size: 64px 64px;
	transform: rotateX(var(--tiltX, 56deg)) rotateY(var(--tiltY, 0deg));
	transform-origin: 50% 0%;
	animation: grid-flow 14s linear infinite;
	transition: transform 0.4s ease-out;
	will-change: background-position;
}
@keyframes grid-flow {
	from { background-position: 0 0; }
	to   { background-position: 0 64px; }
}
.hero > .container { position: relative; }

.hero-terminal {
	font-size: 14.5px;
	color: var(--muted);
	margin: 0 0 28px;
}
.term-prompt { color: var(--cyan); }
.term-line { color: var(--ink); }
.term-caret {
	display: inline-block;
	width: 9px;
	height: 1.1em;
	margin-left: 3px;
	background: var(--accent);
	vertical-align: text-bottom;
	animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-title {
	font-family: var(--font-display);
	font-weight: 550;
	font-size: clamp(34px, 5.4vw, 62px);
	line-height: 1.14;
	letter-spacing: -0.015em;
	margin: 0 0 24px;
	max-width: 17ch;
}
.hero-accent { color: var(--accent); }

.hero-lead {
	font-size: 18.5px;
	color: var(--muted);
	max-width: 56ch;
	margin: 0 0 36px;
}

.hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 48px;
}

.hero-stack {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 22px;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 13.5px;
	color: var(--muted);
}
.hero-stack li::before {
	content: '·';
	color: var(--accent);
	margin-right: 8px;
}

/* ---- Секції ---- */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }

.section-head { margin-bottom: 48px; }
.eyebrow {
	display: block;
	font-size: 14px;
	color: var(--accent);
	margin-bottom: 14px;
	letter-spacing: 0.02em;
}
.section-desc {
	color: var(--muted);
	font-size: 16.5px;
	max-width: 62ch;
	margin: 16px 0 0;
}
.section-title {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: clamp(26px, 3.4vw, 40px);
	line-height: 1.2;
	margin: 0;
	letter-spacing: -0.01em;
}



/* ---- Гравітаційна сітка секції послуг ---- */
.has-gravity,
.has-pulse {
	position: relative;
	overflow: hidden;
}
.has-gravity > .container,
.has-pulse > .container {
	position: relative;
	z-index: 1;
}
.gravity-grid,
.pulse-grid {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}
/* Фолбек: статична сітка без JS, на тачскрінах і при reduced-motion */
.has-gravity.gravity-static .gravity-grid,
.has-pulse.gravity-static .pulse-grid { display: none; }
.has-gravity.gravity-static::before,
.has-pulse.gravity-static::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(var(--line) 1px, transparent 1px),
		linear-gradient(90deg, var(--line) 1px, transparent 1px);
	background-size: 64px 64px;
	mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 92%, transparent 100%);
	pointer-events: none;
}

/* ---- Картки послуг ---- */
.cards-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 22px;
}
.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 30px 28px;
	transition: border-color var(--dur), transform var(--dur);
}
.card:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	transform: translateY(-4px);
}
.card-index {
	display: inline-block;
	font-size: 13px;
	color: var(--accent);
	border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
	border-radius: 6px;
	padding: 3px 9px;
	margin-bottom: 20px;
}
.card-title {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 20px;
	margin: 0 0 12px;
	line-height: 1.3;
}
.card-text {
	color: var(--muted);
	font-size: 15.5px;
	margin: 0 0 18px;
}
.card-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 14.5px;
	color: var(--muted);
}
.card-list li {
	padding-left: 20px;
	position: relative;
	margin-bottom: 7px;
}
.card-list li::before {
	content: '→';
	position: absolute;
	left: 0;
	color: var(--accent);
}

/* ---- Проєкти ---- */
.projects-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 22px;
}
.project {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: border-color var(--dur), transform var(--dur);
}
.project:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	transform: translateY(-4px);
}
.project-thumb img {
	width: 100%;
	aspect-ratio: 800 / 520;
	object-fit: cover;
}
.project-body { padding: 24px; }
.project-tag {
	display: inline-block;
	font-size: 12.5px;
	color: var(--cyan);
	margin-bottom: 12px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}
.project-title {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 19px;
	margin: 0 0 10px;
	line-height: 1.3;
}
.project-title a:hover { color: var(--accent); }
.project-desc {
	color: var(--muted);
	font-size: 14.5px;
	margin: 0;
}

/* ---- Продукт (IDAP) ---- */
.product {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 48px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 44px;
	align-items: center;
}
.product-kicker {
	display: block;
	font-size: 13.5px;
	color: var(--cyan);
	margin-bottom: 14px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.product-title {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: clamp(30px, 4vw, 44px);
	margin: 0 0 16px;
	color: var(--accent);
}
.product-desc {
	color: var(--muted);
	margin: 0 0 22px;
}
.product-feats {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
	font-size: 13.5px;
	color: var(--ink);
}

.product-stats {
	display: grid;
	gap: 26px;
	border-left: 1px solid var(--line);
	padding-left: 44px;
}
.stat-num {
	display: block;
	font-size: clamp(34px, 4vw, 48px);
	font-weight: 700;
	color: var(--ink);
	line-height: 1;
	margin-bottom: 6px;
}
.stat-label {
	color: var(--muted);
	font-size: 14.5px;
}


/* ---- Партнери: нескінченна карусель ---- */
.marquee {
	overflow: hidden;
	padding: 6px 0 10px;
	mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}
.marquee-track {
	display: flex;
	width: max-content;
	animation: marquee 32s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}
.marquee-list {
	display: flex;
	align-items: stretch;
	gap: 18px;
	list-style: none;
	margin: 0;
	padding: 0 9px;
}
.partner-item { flex: 0 0 auto; display: flex; }
.partner-chip {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	min-width: 220px;
	min-height: 96px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px 28px;
	transition: border-color var(--dur);
}
a.partner-chip:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	color: inherit;
}
.partner-chip img.partner-logo {
	max-height: 52px;
	width: auto;
	max-width: 200px;
	object-fit: contain;
	filter: grayscale(1) brightness(1.7) opacity(0.75);
	transition: filter var(--dur);
}
a.partner-chip:hover img.partner-logo { filter: none; }
.partner-name {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 16.5px;
	color: var(--ink);
	line-height: 1.3;
	white-space: nowrap;
}
a.partner-chip:hover .partner-name { color: var(--accent); }
.partner-note {
	font-size: 12px;
	color: var(--muted);
	letter-spacing: 0.03em;
	white-space: nowrap;
}

/* ---- CTA ---- */
.cta { text-align: center; padding-bottom: 110px; }
.cta-title {
	font-family: var(--font-display);
	font-weight: 550;
	font-size: clamp(30px, 4.6vw, 52px);
	margin: 0 0 16px;
	letter-spacing: -0.01em;
}
.cta-text {
	color: var(--muted);
	font-size: 18px;
	margin: 0 0 34px;
}
.cta-actions {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 14px;
}


/* ---- Контактна форма ---- */
.contact-form {
	max-width: 640px;
	margin: 0 auto;
	text-align: left;
	display: grid;
	gap: 18px;
}
.form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}
.form-row-bottom { align-items: end; }
.form-field { display: grid; gap: 8px; }
.form-label {
	font-size: 13px;
	color: var(--muted);
	letter-spacing: 0.03em;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
	width: 100%;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 10px;
	color: var(--ink);
	font: inherit;
	padding: 13px 16px;
	transition: border-color var(--dur);
}
.contact-form input:focus,
.contact-form textarea:focus {
	outline: none;
	border-color: var(--accent);
}
.contact-form textarea { resize: vertical; min-height: 130px; }
.form-captcha input { font-family: var(--font-mono); }
.form-submit { justify-self: end; width: 100%; justify-content: center; }
.hp-field { position: absolute !important; left: -9999px; }
.form-notice {
	max-width: 640px;
	margin: 0 auto 22px;
	padding: 13px 18px;
	border-radius: 10px;
	font-size: 14.5px;
	text-align: left;
}
.form-ok  { background: rgba(0, 200, 120, 0.1);  border: 1px solid rgba(0, 200, 120, 0.35);  color: #7CE0B3; }
.form-err { background: rgba(255, 100, 100, 0.08); border: 1px solid rgba(255, 100, 100, 0.3); color: #FF9C9C; }
.cta-alt { margin-top: 26px; font-size: 14px; color: var(--muted); }
.cta-alt a { color: var(--accent); }

/* ---- Футер ---- */
.site-footer {
	border-top: 1px solid var(--line);
	background: var(--bg-alt);
	padding: 64px 0 32px;
}
.footer-grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr;
	gap: 40px;
	margin-bottom: 48px;
}
.footer-brand { font-size: 20px; }
.footer-note {
	color: var(--muted);
	font-size: 14.5px;
	max-width: 34ch;
	margin: 14px 0 0;
}
.footer-label {
	display: block;
	font-family: var(--font-mono);
	font-size: 13px;
	color: var(--accent);
	margin-bottom: 16px;
}
.footer-links {
	list-style: none;
	margin: 0;
	padding: 0;
}
.footer-links li { margin-bottom: 10px; }
.footer-links a {
	color: var(--muted);
	font-size: 15px;
}
.footer-links a:hover { color: var(--ink); }
.footer-bottom {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	border-top: 1px solid var(--line);
	padding-top: 24px;
	color: var(--muted);
	font-size: 13.5px;
}

/* ---- Внутрішні сторінки ---- */
.page-main { padding: 72px 0 96px; }
.entry-title {
	font-family: var(--font-display);
	font-weight: 550;
	font-size: clamp(28px, 4vw, 46px);
	line-height: 1.2;
	margin: 0 0 28px;
}
.entry-content { max-width: 760px; }
.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.entry-content h2, .entry-content h3 {
	font-family: var(--font-display);
	font-weight: 500;
	line-height: 1.3;
	margin: 42px 0 16px;
}
.entry-content pre {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 18px 22px;
	overflow-x: auto;
	font-family: var(--font-mono);
	font-size: 14px;
}
.entry-content code { font-family: var(--font-mono); font-size: 0.92em; color: var(--cyan); }
.entry-content blockquote {
	border-left: 3px solid var(--accent);
	margin: 24px 0;
	padding: 4px 0 4px 22px;
	color: var(--muted);
}
.entry-meta {
	font-family: var(--font-mono);
	font-size: 13.5px;
	color: var(--muted);
	margin-bottom: 20px;
}

.posts-list { display: grid; gap: 22px; max-width: 760px; }
.posts-list .card-title a:hover { color: var(--accent); }

.error-404 { text-align: center; padding: 120px 0; }
.error-code {
	font-family: var(--font-mono);
	font-size: clamp(64px, 12vw, 140px);
	font-weight: 700;
	color: var(--accent);
	line-height: 1;
	display: block;
	margin-bottom: 20px;
}

/* ---- Анімація появи ---- */
.reveal {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
	opacity: 1;
	transform: none;
}
/* Без JS або зі скороченим рухом — усе видно одразу */
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.reveal { opacity: 1; transform: none; transition: none; }
	.term-caret { animation: none; }
	.grid-plane { animation: none; transition: none; }
	.marquee-track { animation: none; flex-wrap: wrap; width: auto; }
	.marquee-list[aria-hidden] { display: none; }
	.btn:hover, .card:hover, .project:hover { transform: none; }
}

/* ---- Адаптив ---- */
@media (max-width: 980px) {
	.projects-grid { grid-template-columns: repeat(2, 1fr); }
	.product { grid-template-columns: 1fr; gap: 32px; }
	.product-stats {
		border-left: 0;
		border-top: 1px solid var(--line);
		padding-left: 0;
		padding-top: 32px;
		grid-template-columns: repeat(3, 1fr);
	}
	.footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
	body { font-size: 16px; }
	.section { padding: 64px 0; }
	.hero { padding: 64px 0; }
	.cards-grid, .projects-grid { grid-template-columns: 1fr; }
	.product { padding: 28px 22px; }
	.product-stats { grid-template-columns: 1fr; }
	.footer-grid { grid-template-columns: 1fr; }

	.form-row { grid-template-columns: 1fr; }

	.header-cta { display: none; }
	.nav-toggle {
		display: inline-flex;
		margin-left: auto;
		background: none;
		border: 1px solid var(--line);
		border-radius: 8px;
		padding: 10px;
		cursor: pointer;
	}
	.nav-toggle-box {
		display: flex;
		flex-direction: column;
		gap: 5px;
		width: 20px;
	}
	.nav-toggle-box span {
		height: 2px;
		background: var(--ink);
		border-radius: 2px;
		transition: transform var(--dur), opacity var(--dur);
	}
	.nav-toggle[aria-expanded="true"] .nav-toggle-box span:first-child { transform: translateY(3.5px) rotate(45deg); }
	.nav-toggle[aria-expanded="true"] .nav-toggle-box span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

	.site-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--bg-alt);
		border-bottom: 1px solid var(--line);
		padding: 20px 24px 28px;
	}
	.site-nav.is-open { display: block; }
	.nav-list { flex-direction: column; gap: 16px; }
	.nav-list a { font-size: 17px; color: var(--ink); }
}
