/**
 * Nexlogicx Agency Theme — global tokens, base, adaptive grid, intro loader.
 *
 * Colors and fonts read from Elementor's Site Settings (global colors/typography), so changing
 * them in Elementor re-themes the whole site. The hex values are fallbacks for when no kit is set.
 * Tokens live on `body` because Elementor prints its global variables on the kit class of <body>.
 */

body {
	--nx-accent: var(--e-global-color-primary, #2251ff);
	--nx-accent-from: var(--e-global-color-accent, #4f7bff);
	--nx-accent-to: var(--e-global-color-nxaccentdk, #1636c7);
	--nx-ink: var(--e-global-color-secondary, #0a0a0a);
	--nx-fg: var(--e-global-color-text, #111111);
	--nx-bg: var(--e-global-color-nxbg, #ffffff);
	--nx-muted: var(--e-global-color-nxmuted, #8d8d8d);
	--nx-subtle: var(--e-global-color-nxsubtle, #b6b6b6);
	--nx-line: var(--e-global-color-nxline, #e6e5e2);
	--nx-surface: var(--e-global-color-nxsurface, #f1f0ee);
	--nx-surface-2: var(--e-global-color-nxsurface2, #e3e2df);
	--nx-hero-bg: var(--e-global-color-nxherobg, #c9c9c9);

	--nx-font-heading: var(--e-global-typography-primary-font-family, "Onest"), "Onest", sans-serif;
	--nx-font: var(--e-global-typography-text-font-family, "Onest"), "Onest", sans-serif;

	--nx-radius-pill: 9999px;
	--nx-radius-card: 2rem;
	--nx-radius-card-sm: 1.25rem;
	--nx-radius-control: 0.875rem;
	--nx-shell: 88rem;
	--nx-watermark: 13rem;

	--nx-ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
	--nx-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
	--nx-ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);

	position: relative;
	margin: 0;
	overflow-x: clip;
	background: var(--nx-bg);
	color: var(--nx-fg);
	font-family: var(--nx-font);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Adaptive rem grid (root font-size follows the viewport) ---------- */

@media (max-width: 1920px) { html.nx-fluid { font-size: 0.833333vw; } }
@media (max-width: 1440px) { html.nx-fluid { font-size: 1.111111vw; } }
@media (max-width: 1024px) { html.nx-fluid { font-size: 1.5625vw; } }
@media (max-width: 640px)  { html.nx-fluid { font-size: 4.444444vw; } }

/* ---------- Lenis (vendor) ---------- */

html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Site header / footer wrappers ---------- */

.nx-header-overlay .nx-site-header {
	position: absolute;
	inset-inline: 0;
	top: 0;
	z-index: 50;
}

/* Pages not built with Elementor (blog posts, archives) need room under the overlay header. */
.nx-header-overlay.nx-classic-content #content {
	padding-top: 8rem;
}

.nx-site-header .e-con,
.nx-site-footer .e-con {
	--padding-top: 0;
	--padding-bottom: 0;
	--padding-left: 0;
	--padding-right: 0;
}

/* ---------- Intro loader ---------- */

.nx-loader {
	position: fixed;
	inset: 0;
	z-index: 120;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2rem;
	background: var(--nx-ink);
	color: #fff;
	border-radius: 0 0 var(--nx-radius-card) var(--nx-radius-card);
	font-family: var(--nx-font);
	transform: translateY(0);
	transition: transform 0.75s var(--nx-ease-spring);
	/* Failsafe: if the script never runs, get out of the way. */
	animation: nx-loader-failsafe 0.01s linear 6s forwards;
}

html:not(.nx-js) .nx-loader,
html.nx-intro-skip .nx-loader {
	display: none;
}

.nx-loader.is-exit { transform: translateY(-100%); }

@keyframes nx-loader-failsafe {
	to { visibility: hidden; opacity: 0; pointer-events: none; }
}

.nx-loader__center {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.25rem;
	text-align: center;
	transition: opacity 0.6s var(--nx-ease-spring), transform 0.6s var(--nx-ease-spring);
}

.nx-loader.is-exit .nx-loader__center {
	opacity: 0;
	transform: translateY(-12px);
}

.nx-loader__brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-family: var(--nx-font-heading);
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.nx-loader__brand .nx-mark {
	font-size: 1.875rem;
	color: var(--nx-accent-from);
}

.nx-loader__tagline {
	max-width: 24ch;
	margin: 0;
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.55);
}

.nx-loader__progress {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: min(22rem, 72vw);
}

.nx-loader__track {
	height: 1px;
	background: rgba(255, 255, 255, 0.15);
}

.nx-loader__fill {
	width: 0;
	height: 100%;
	background: var(--nx-accent-from);
	transition: width 0.1s ease-out;
}

.nx-loader__meta {
	display: flex;
	justify-content: space-between;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.45);
}

.nx-loader__count {
	font-variant-numeric: tabular-nums;
	color: rgba(255, 255, 255, 0.8);
}

@media (min-width: 640px) {
	.nx-loader__brand { font-size: 1.875rem; }
}

/* ---------- Brand mark ---------- */

.nx-mark {
	display: inline-flex;
	flex-shrink: 0;
	width: 1em;
	height: 1em;
	line-height: 1;
}

.nx-mark svg,
.nx-mark img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

@media (prefers-reduced-motion: reduce) {
	.nx-loader, .nx-loader__center { transition: none; }
}

/* ======================================================================
   Classic templates (blog, posts, pages not built with Elementor)
   ====================================================================== */

.nx-container {
	width: 100%;
	max-width: 48rem;
	margin-inline: auto;
	padding-inline: 1.25rem;
}

.nx-container--wide {
	max-width: var(--nx-shell);
}

/* Reading column + sidebar needs more room than the plain reading width. */
.nx-container:has(> .nx-layout--sidebar) {
	max-width: 72rem;
}

.nx-classic-content .nx-main {
	padding-block: 4rem 6rem;
}

body.blog .nx-container,
body.archive .nx-container,
body.search .nx-container {
	max-width: var(--nx-shell);
}

@media (min-width: 640px) {
	.nx-container { padding-inline: 2rem; }
}

/* Built-in header / footer (until Elementor templates are assigned) */

.nx-default-header {
	border-bottom: 1px solid var(--nx-line);
}

.nx-default-header__inner,
.nx-default-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	padding-block: 1.25rem;
}

.nx-brand,
.nx-brand:hover {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--nx-fg);
	font-family: var(--nx-font-heading);
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.nx-brand__mark {
	font-size: 1.25rem;
	color: var(--nx-accent);
}

.custom-logo {
	display: block;
	width: auto;
	max-height: 2.5rem;
}

.nx-default-nav ul,
.nx-default-footer ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
	font-weight: 500;
}

.nx-default-nav a,
.nx-default-footer a {
	color: inherit;
}

.nx-default-nav a:hover,
.nx-default-footer a:hover {
	color: var(--nx-accent);
}

.nx-default-nav .sub-menu {
	display: none;
}

.nx-default-footer {
	margin-top: 4rem;
	background: var(--nx-ink);
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.875rem;
}

.nx-default-footer p {
	margin: 0;
}

/* Page header */

.nx-page-header {
	margin-bottom: 3rem;
}

.nx-page-title {
	margin: 0;
	font-size: 2.25rem;
	letter-spacing: -0.02em;
}

.nx-page-description {
	margin-top: 1rem;
	color: color-mix(in srgb, var(--nx-fg) 60%, transparent);
}

@media (min-width: 640px) {
	.nx-page-title { font-size: 3rem; }
}

/* Layout with optional sidebar */

.nx-layout--sidebar {
	display: grid;
	gap: 3rem;
}

@media (min-width: 1024px) {
	.nx-layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 18rem;
	}
}

.nx-widget {
	margin-bottom: 2.5rem;
	font-size: 0.9375rem;
}

.nx-widget__title,
.nx-layout__aside .wp-block-heading,
.nx-layout__aside .wp-block-search__label {
	margin-bottom: 1rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--nx-fg) 50%, transparent);
}

.nx-widget ul {
	padding: 0;
	list-style: none;
}

.nx-widget a {
	color: var(--nx-fg);
}

.nx-widget a:hover {
	color: var(--nx-accent);
}

.nx-widget li {
	padding-block: 0.4rem;
	border-bottom: 1px solid var(--nx-line);
}

/* Post grid */

.nx-post-grid {
	display: grid;
	gap: 1.5rem;
}

@media (min-width: 768px) {
	.nx-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
	.nx-layout:not(.nx-layout--sidebar) .nx-post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.nx-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--nx-radius-card-sm);
	background: var(--nx-surface);
	transition: transform 0.35s var(--nx-ease-snap);
}

.nx-card:hover {
	transform: translateY(-4px);
}

.nx-card__thumb img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.nx-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.5rem;
}

.nx-card__title {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.nx-card__title a {
	color: var(--nx-fg);
}

.nx-card__excerpt p {
	margin: 0;
	font-size: 0.9375rem;
	color: color-mix(in srgb, var(--nx-fg) 60%, transparent);
}

.nx-entry__meta {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--nx-fg) 45%, transparent);
}

.nx-entry__meta a {
	color: inherit;
}

/* Single entry */

.nx-entry__header {
	margin-bottom: 2.5rem;
}

.nx-entry__title {
	margin: 1rem 0 0;
	font-size: 2.25rem;
	letter-spacing: -0.02em;
}

@media (min-width: 640px) {
	.nx-entry__title { font-size: 3rem; }
}

.nx-entry__thumb {
	margin: 0 0 2.5rem;
}

.nx-entry__thumb img {
	display: block;
	width: 100%;
	border-radius: var(--nx-radius-card);
}

.nx-entry__content {
	font-size: 1.0625rem;
	line-height: 1.75;
}

.nx-entry__content > * + h2,
.nx-entry__content > * + h3 {
	margin-top: 2.5rem;
}

.nx-entry__content a {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.nx-entry__content .alignwide {
	width: min(64rem, 100vw - 2.5rem);
	max-width: none;
	margin-inline: 50%;
	transform: translateX(-50%);
}

.nx-entry__content .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline: 50%;
	transform: translateX(-50%);
}

.nx-entry__content .alignleft { float: left; margin: 0.25rem 1.5rem 1rem 0; }
.nx-entry__content .alignright { float: right; margin: 0.25rem 0 1rem 1.5rem; }
.nx-entry__content .aligncenter { margin-inline: auto; }

.wp-caption-text,
.wp-element-caption {
	margin-top: 0.5rem;
	font-size: 0.875rem;
	color: var(--nx-muted);
}

.nx-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 2.5rem;
}

.nx-tags a {
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--nx-line);
	border-radius: var(--nx-radius-pill);
	font-size: 0.8125rem;
	color: var(--nx-fg);
}

.post-navigation .nav-links {
	display: grid;
	gap: 1rem;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid var(--nx-line);
}

@media (min-width: 640px) {
	.post-navigation .nav-links { grid-template-columns: 1fr 1fr; }
	.post-navigation .nav-next { text-align: end; }
}

.post-navigation a {
	color: var(--nx-fg);
	font-weight: 500;
}

.nx-nav-label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.75rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--nx-muted);
}

/* Pagination */

.nx-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 3rem;
}

.nx-pagination .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 2.75rem;
	height: 2.75rem;
	padding-inline: 1rem;
	border-radius: var(--nx-radius-pill);
	background: var(--nx-surface);
	color: var(--nx-fg);
	font-size: 0.875rem;
	font-weight: 500;
}

.nx-pagination .page-numbers.current {
	background: var(--nx-ink);
	color: #fff;
}

/* Buttons & forms */

.nx-button,
.wp-block-button__link,
.wp-block-search__button,
.nx-main input[type="submit"],
.search-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.875rem 1.75rem;
	border: 0;
	border-radius: var(--nx-radius-pill);
	background: var(--nx-ink);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 500;
	transition: transform 0.35s var(--nx-ease-snap), background-color 0.2s;
}

.nx-button:hover,
.wp-block-button__link:hover,
.wp-block-search__button:hover,
.nx-main input[type="submit"]:hover,
.search-submit:hover {
	color: #fff;
	background: var(--nx-accent);
	transform: scale(1.03);
}

.search-form {
	display: flex;
	gap: 0.5rem;
	margin-block: 1.5rem;
}

/* Comments */

.nx-comments {
	margin-top: 4rem;
	padding-top: 2.5rem;
	border-top: 1px solid var(--nx-line);
}

.nx-comments__list {
	padding: 0;
	list-style: none;
}

.nx-comments__list .comment-body {
	margin-bottom: 1.5rem;
	padding: 1.25rem;
	border-radius: var(--nx-radius-card-sm);
	background: var(--nx-surface);
}

.nx-comments__list .children {
	padding-inline-start: 1.5rem;
	list-style: none;
}

.nx-comments .comment-author {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.nx-comments .avatar {
	border-radius: 50%;
}

.nx-comments .comment-content {
	margin-top: 0.75rem;
}

.nx-comments .comment-metadata {
	font-size: 0.8125rem;
}

.nx-comments .comment-metadata a {
	color: var(--nx-muted);
}

.comment-form label {
	display: block;
	margin-bottom: 0.375rem;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--nx-fg) 55%, transparent);
}

.comment-form .comment-form-cookies-consent label {
	display: inline;
	text-transform: none;
}

/* 404 / empty */

.nx-404 {
	padding-block: 10rem 8rem;
	text-align: center;
}

.nx-404__code {
	margin: 0 0 1rem;
	font-size: 6rem;
	font-weight: 700;
	line-height: 1;
	color: var(--nx-accent);
}

.nx-404 .search-form {
	max-width: 28rem;
	margin-inline: auto;
}
