/*
 * VoltNiq — Components: the voltage motif, buttons, forms, nav, badges,
 * cards, icons, notices, pagination.
 */

/* =====================================================================
 * SIGNATURE MOTIF — "The Current Line"
 * A 2px trace carrying one square-wave notch, like a pulse crossing a
 * charging cable. Static by default; the animated variant runs the pulse
 * once across. Disabled under prefers-reduced-motion.
 * ================================================================== */
.current-line {
	width: 100%;
	height: 12px;
	overflow: hidden;
	line-height: 0;
}
.current-line__svg {
	width: 100%;
	height: 12px;
	display: block;
}
.current-line__path {
	fill: none;
	stroke: var(--c-volt);
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	filter: drop-shadow(0 0 4px rgba(54, 241, 179, 0.55));
}

/* Animated variant: draw the pulse across via dash offset. */
.current-line.is-animated .current-line__path {
	stroke-dasharray: 60 1200;
	stroke-dashoffset: 1260;
	animation: voltniq-pulse 2.4s var(--ease) 0.2s 1 forwards;
}
@keyframes voltniq-pulse {
	from { stroke-dashoffset: 1260; }
	to   { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.current-line.is-animated .current-line__path {
		stroke-dasharray: none;
		stroke-dashoffset: 0;
		animation: none;
	}
}

/* Header/footer use the line as a glowing divider border. */
.site-header .current-line,
.site-footer .current-line {
	border: 0;
}

/* =====================================================================
 * BUTTONS
 * ================================================================== */
.btn {
	--btn-bg: var(--c-surface-2);
	--btn-fg: var(--c-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	padding: var(--sp-3) var(--sp-5);
	background: var(--btn-bg);
	color: var(--btn-fg);
	border: 1px solid var(--c-line);
	border-radius: var(--r-md);
	font-weight: var(--fw-semibold);
	font-size: var(--fs-base);
	line-height: 1;
	cursor: pointer;
	position: relative;
	transition: background var(--dur-fast) var(--ease),
		border-color var(--dur-fast) var(--ease),
		transform var(--dur-fast) var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
	--btn-bg: var(--c-volt);
	--btn-fg: var(--c-on-volt);
	border-color: transparent;
}
.btn--primary:hover {
	--btn-bg: var(--c-volt-deep);
	color: var(--c-on-volt);
}

/* Primary button carries the current-line pulse on hover (motif point 4). */
.btn--primary::after {
	content: "";
	position: absolute;
	left: var(--sp-4);
	right: var(--sp-4);
	bottom: 6px;
	height: 2px;
	background: linear-gradient(90deg,
		transparent,
		var(--c-on-volt) 45%,
		var(--c-on-volt) 55%,
		transparent);
	background-size: 40% 100%;
	background-repeat: no-repeat;
	background-position: -40% 0;
	opacity: 0;
	transition: opacity var(--dur-fast) var(--ease);
}
.btn--primary:hover::after {
	opacity: 0.7;
	animation: voltniq-underline 0.8s var(--ease) 1;
}
@keyframes voltniq-underline {
	from { background-position: -40% 0; }
	to   { background-position: 140% 0; }
}
@media (prefers-reduced-motion: reduce) {
	.btn--primary:hover::after { animation: none; }
}

.btn--ghost {
	background: transparent;
	border-color: var(--c-line);
	color: var(--c-text);
}
.btn--ghost:hover {
	border-color: var(--c-volt);
	color: var(--c-volt);
}

.btn--block {
	width: 100%;
}

/* =====================================================================
 * FORMS
 * ================================================================== */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="url"],
textarea,
select {
	width: 100%;
	background: var(--c-surface);
	color: var(--c-text);
	border: 1px solid var(--c-line);
	border-radius: var(--r-md);
	padding: var(--sp-3) var(--sp-4);
	transition: border-color var(--dur-fast) var(--ease),
		box-shadow var(--dur-fast) var(--ease);
}
input::placeholder,
textarea::placeholder {
	color: var(--c-text-dim);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	border-color: var(--c-volt);
	box-shadow: var(--focus-ring);
}

label {
	display: inline-block;
	margin-bottom: var(--sp-2);
	color: var(--c-text-dim);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
}

.search-form {
	display: flex;
	gap: var(--sp-2);
	max-width: 560px;
}
.search-form__input {
	flex: 1 1 auto;
}
.search-form__submit {
	flex: 0 0 auto;
}

/* =====================================================================
 * NAVIGATION
 * ================================================================== */
.nav-primary__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}
.nav-primary__link {
	display: inline-block;
	padding: var(--sp-2) var(--sp-3);
	color: var(--c-text);
	font-weight: var(--fw-semibold);
	border-radius: var(--r-sm);
}
.nav-primary__link:hover,
.nav-primary__item.current-menu-item > .nav-primary__link {
	color: var(--c-volt);
}

.nav-primary__item {
	position: relative;
}

.nav-primary__submenu {
	list-style: none;
	margin: 0;
	padding: var(--sp-2);
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	background: var(--c-surface-2);
	border: 1px solid var(--c-line);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-md);
	display: none;
	z-index: var(--z-header);
}
.nav-primary__item.has-submenu:hover > .nav-primary__submenu,
.nav-primary__item.has-submenu.is-open > .nav-primary__submenu {
	display: block;
}
.nav-primary__submenu .nav-primary__link {
	display: block;
}

/* Submenu toggle button (custom walker) — hidden on desktop hover UI. */
.nav-primary__toggle {
	display: none;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: var(--sp-2);
}
.nav-primary__toggle-icon {
	display: block;
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	color: var(--c-text-dim);
}

/* Hamburger / mobile nav toggle */
.nav-toggle {
	display: none;
	width: 44px;
	height: 44px;
	background: transparent;
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	cursor: pointer;
	position: relative;
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
	content: "";
	position: absolute;
	left: 50%;
	width: 20px;
	height: 2px;
	background: var(--c-text);
	transform: translateX(-50%);
	transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast);
}
.nav-toggle__bar { top: 50%; }
.nav-toggle__bar::before { top: -6px; }
.nav-toggle__bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before { transform: translateX(-50%) translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after { transform: translateX(-50%) translateY(-6px) rotate(-45deg); }

/* =====================================================================
 * HEADER ACTION ICONS (inline CSS glyphs as placeholders for SVG sprite)
 * ================================================================== */
.account-link,
.cart-link {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	color: var(--c-text);
	font-weight: var(--fw-semibold);
	font-size: var(--fs-sm);
}
.account-link:hover,
.cart-link:hover { color: var(--c-volt); }

.header-actions__search {
	background: transparent;
	border: 0;
	cursor: pointer;
	color: var(--c-text);
	padding: var(--sp-2);
}

.icon {
	display: inline-block;
	width: 22px;
	height: 22px;
	background: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}
/* Lightweight inline masks so the header renders before the SVG sprite ships. */
.icon--cart { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.6 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.6 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E"); }
.icon--account { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); }
.icon--search { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); }

.cart-link__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: var(--c-volt);
	color: var(--c-on-volt);
	border-radius: var(--r-pill);
	font-size: var(--fs-xs);
	font-weight: var(--fw-bold);
	line-height: 1;
}

/* =====================================================================
 * BADGES (CE / IP / connector / phase) — reusable trust signals
 * ================================================================== */
.badge {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-1);
	padding: var(--sp-1) var(--sp-3);
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	background: var(--c-surface-2);
	font-size: var(--fs-xs);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.02em;
	color: var(--c-text);
}
.badge--cert { color: var(--c-volt); border-color: color-mix(in srgb, var(--c-volt) 40%, var(--c-line)); }
.badge--caution { color: var(--c-amber); border-color: color-mix(in srgb, var(--c-amber) 40%, var(--c-line)); }

/* =====================================================================
 * CARDS
 * ================================================================== */
.post-list,
.search-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--sp-5);
}
.post-card {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: var(--r-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.post-card__image {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}
.post-card__body {
	padding: var(--sp-5);
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}
.post-card__excerpt {
	color: var(--c-text-dim);
	font-size: var(--fs-sm);
}

/* =====================================================================
 * NOTICES / PAGINATION / EMPTY
 * ================================================================== */
.content-empty {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: var(--r-lg);
	padding: var(--sp-7);
	text-align: center;
	color: var(--c-text-dim);
}

.page-header {
	margin-bottom: var(--sp-6);
}
.page-header__search {
	margin-top: var(--sp-4);
}

.pagination,
.nav-links {
	display: flex;
	gap: var(--sp-2);
	margin-top: var(--sp-7);
	flex-wrap: wrap;
}
.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 var(--sp-3);
	border: 1px solid var(--c-line);
	border-radius: var(--r-md);
	color: var(--c-text);
}
.page-numbers.current {
	background: var(--c-volt);
	color: var(--c-on-volt);
	border-color: transparent;
}

/* =====================================================================
 * 404
 * ================================================================== */
.error-404 {
	text-align: center;
	max-width: 640px;
	margin-inline: auto;
	padding-block: var(--sp-8);
}
.error-404__code {
	font-family: var(--font-display);
	font-size: clamp(4rem, 14vw, 9rem);
	font-weight: var(--fw-bold);
	color: var(--c-surface-2);
	line-height: 1;
	letter-spacing: -0.04em;
}
.error-404__title { margin-top: var(--sp-3); }
.error-404__text { color: var(--c-text-dim); margin-top: var(--sp-3); }
.error-404__search { margin-block: var(--sp-6); display: flex; justify-content: center; }
.error-404__actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* =====================================================================
 * MOBILE NAV (≤ 720px)
 * ================================================================== */
@media (max-width: 720px) {
	.nav-toggle { display: inline-flex; }

	.nav-primary__list {
		display: none;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		width: 100%;
		background: var(--c-surface-2);
		border: 1px solid var(--c-line);
		border-radius: var(--r-md);
		padding: var(--sp-2);
		margin-top: var(--sp-3);
	}
	.nav-primary.is-open .nav-primary__list {
		display: flex;
	}
	.nav-primary__item {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
	}
	.nav-primary__link { flex: 1 1 auto; }
	.nav-primary__toggle { display: inline-flex; }
	.nav-primary__submenu {
		position: static;
		display: none;
		box-shadow: none;
		border: 0;
		width: 100%;
		padding-left: var(--sp-4);
		background: transparent;
	}
	.nav-primary__item.is-open > .nav-primary__submenu { display: block; }
	.nav-primary__item.has-submenu:hover > .nav-primary__submenu { display: none; }
	.nav-primary__item.has-submenu.is-open > .nav-primary__submenu { display: block; }
}

/* =====================================================================
 * FORM NOTICES (contact + generic)
 * ================================================================== */
.form-notice {
	border: 1px solid var(--c-line);
	border-left: 3px solid var(--c-volt);
	border-radius: var(--r-md);
	background: var(--c-surface);
	padding: var(--sp-4);
	margin-bottom: var(--sp-5);
}
.form-notice--ok { border-left-color: var(--c-volt); color: var(--c-volt); }
.form-notice--error { border-left-color: var(--c-danger); color: var(--c-danger); }

/* =====================================================================
 * CONTACT PAGE
 * ================================================================== */
.contact-layout {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	gap: var(--sp-7);
	align-items: start;
}
.contact-info {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: var(--r-lg);
	padding: var(--sp-6);
}
.contact-info__title { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
.contact-info__lead { color: var(--c-text-dim); margin-bottom: var(--sp-4); }
.contact-info__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--sp-4);
}
.contact-info__list li { display: flex; flex-direction: column; gap: 2px; }
.contact-info__label {
	font-size: var(--fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--c-text-dim);
}
.contact-info__note {
	margin-top: var(--sp-5);
	font-size: var(--fs-sm);
	color: var(--c-text-dim);
}
.contact-form-wrap {
	background: var(--c-surface);
	border: 1px solid var(--c-line);
	border-radius: var(--r-lg);
	padding: var(--sp-6);
}
.contact-form__title { font-size: var(--fs-lg); margin-bottom: var(--sp-4); }
.contact-form__row {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	margin-bottom: var(--sp-4);
}
.contact-form__row .req { color: var(--c-volt); }
.contact-form__actions { margin: 0; }
/* Honeypot — removed from layout and from assistive tech, but present in DOM. */
.contact-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

@media (max-width: 860px) {
	.contact-layout {
		grid-template-columns: 1fr;
	}
}
