/* ===========================================================================
   Synameda need detail page (/poreikiai/<need>/).

   SPACING
   Vertical space is owned by exactly one thing at each level:
     .nd-sec        owns the gap between sections. Nothing else adds to it.
     .nd-wrap       owns the horizontal gutter. Nothing else adds to it.
     stack rules    own the gap between siblings, via `> * + *`, which keeps
                    every gap at the same specificity so a later single-class
                    rule can never be silently outranked and dropped.

   No element sets its own margin-top outside a stack rule. That is what
   produced the 0px gaps and the 330px void in the previous build: element
   margins fought a `.nd p { margin: 0 }` reset and lost, while panel padding
   and section padding stacked unnoticed.

   Consistency with the front page: same content width token, same gutter
   ramp, same neutral scale, same button size, same blue.
   Page background is never set here; it is owned globally.
   =========================================================================== */

/* The legacy whole-page shortcode still owns its own width and gutter. Split
   pages deliberately do not: Elementor owns their width and all outer space. */
body.snmd-needs-page .site-main,
body.snmd-needs-page .page-content {
	max-width: none !important;
	/* Hello Elementor also puts 10px of side padding on main, which would add
	   to our own gutter and make these pages inset 30px on a phone where the
	   front page is inset 20px. The gutter is owned by .nd-wrap alone. */
	padding-inline: 0 !important;
}

body.snmd-needs-page:not(.snmd-needs-split-page) .site-main .elementor .e-con-inner { max-width: none !important; }

body.snmd-needs-page:not(.snmd-needs-split-page) .site-main .elementor .e-con,
body.snmd-needs-page:not(.snmd-needs-split-page) .site-main .elementor .e-con-box {
	max-width: none !important;
	padding-inline: 0 !important;
}

body.snmd-needs-page .site-main .elementor-shortcode { width: 100%; }

body.snmd-needs-split-page .elementor-widget-shortcode,
body.snmd-needs-split-page .elementor-widget-shortcode > .elementor-widget-container,
body.snmd-needs-split-page .elementor-shortcode {
	width: 100%;
	margin: 0;
	padding: 0;
}

.nd {
	--n-ink: #1f1f1f;
	--n-700: #354760;
	--n-500: #66758a;
	--n-400: #7d8999;
	--n-200: #dfe3e8;
	--n-100: #e9ecf0;
	--n-50: #f4f5f7;
	--white: #fff;

	--blue: #3e6ae1;
	--blue-dark: #3053b0;
	--blue-bg: #ecf0fc;

	--nd-deep: #34457E;
	--nd-tint: #E7EBF6;

	--max: var(--snmd-content-width, 1400px);
	--gutter: var(--snmd-gutter, clamp(18px, 4vw, 48px));
	--sec: var(--snmd-section-y, clamp(56px, 5.2vw, 76px));

	--r-xl: var(--snmd-radius-image, 22px);
	--r-lg: var(--snmd-radius-card, 22px);
	--r: var(--snmd-radius-input, 12px);
	--r-sm: var(--snmd-radius-button, 4px);

	color: var(--n-ink);
	font-family: "Manrope", "Instrument Sans", system-ui, sans-serif;
	font-size: 18px;
	font-weight: 400;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

.nd *,
.nd *::before,
.nd *::after { box-sizing: border-box; }

/* Zero specificity, so the cover images below can set height:100% without
   being outranked by this reset. */
:where(.nd) :where(img) { max-width: 100%; height: auto; }

/* :where() contributes no specificity, so this reset scores 0,0,0 and any
   class rule below beats it automatically. Written as a plain `.nd p` it
   scores 0,1,1 and silently kills every single-class margin on a paragraph,
   which is what broke the spacing on the previous two builds. */
:where(.nd) :where(h1, h2, h3, p, ul, li, figure) { margin: 0; }

.nd h1,
.nd h2 {
	font-family: "Instrument Sans", "Manrope", system-ui, sans-serif;
	font-weight: 600;
	letter-spacing: -0.032em;
	line-height: 1.15;
}

.nd-wrap {
	width: 100%;
	max-width: var(--max);
	margin: 0 auto;
	padding-inline: var(--gutter);
}

.nd-sec { padding-block: var(--sec); }

/* Sections that follow one another on the same ground share one gap rather
   than each contributing their own, so nothing doubles up. */
.nd-sec + .nd-sec { padding-top: 0; }

/* Section shortcodes are flush to their Elementor container. Internal card,
   button and content spacing remains part of the design; only space around a
   section moves into Elementor. */
.nd--split .nd-wrap {
	max-width: none;
	padding-inline: 0;
}

.nd--split .nd-hero,
.nd--split .nd-sec { padding-block: 0; }

.nd--split .nd-products { padding-bottom: 0; }

.nd--split .nd-related {
	background: transparent;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

/* --------------------------------------------------------------- stacks --- */

.nd-stack > * + * { margin-top: var(--flow, 20px); }

/* ------------------------------------------------------------- buttons --- */

.nd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--snmd-button-height, 40px);
	padding-inline: var(--snmd-button-padding-x, 36px);
	border: 0;
	border-radius: var(--r-sm);
	font-family: inherit;
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color .2s ease, color .2s ease;
}

.nd-btn--solid { background-color: var(--blue); color: var(--white); }
.nd-btn--light { background-color: var(--white); color: var(--n-ink); }
.nd-btn--ghost {
	background-color: rgba(255, 255, 255, .14);
	color: var(--white);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38);
}

@media (hover: hover) and (pointer: fine) {
	.nd-btn--solid:hover { background-color: var(--blue-dark); }
	.nd-btn--light:hover { background-color: var(--n-50); }
	.nd-btn--ghost:hover { background-color: rgba(255, 255, 255, .22); }
}

/* ---------------------------------------------------------------- hero --- */

/* A contained panel, not a full bleed band: it sits inside the same width as
   every other section, with equal air on all four sides. */
.nd-hero { padding-block: clamp(24px, 2.6vw, 40px) 0; }

.nd-hero__panel {
	position: relative;
	display: flex;
	align-items: center;
	min-height: clamp(300px, 25vw, 400px);
	padding: clamp(36px, 3.8vw, 64px);
	border-radius: var(--r-xl);
	overflow: hidden;
	background: var(--n-ink);
	isolation: isolate;
}

/* Two classes deep on purpose: Elementor ships `.elementor img { height:auto }`
   at 0,1,1, which outranks a lone class and leaves the photo covering only the
   top of the panel. */
.nd .nd-hero__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 48% 62%;
}

/* Scrim: strong on the left where the words are, clearing to the right so
   the photograph is still visible. */
.nd-hero__panel::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(90deg, rgba(10, 30, 60, .94) 0%, rgba(10, 30, 60, .86) 42%, rgba(10, 30, 60, .38) 100%),
		linear-gradient(0deg, rgba(10, 30, 60, .35), rgba(10, 30, 60, .35));
}

/* px, not ch: a ch max-width here resolves against the wrapper's 18px body
   size, not the 54px heading, which squeezed the h1 onto three lines. */
.nd-hero__body { max-width: 720px; }

.nd-hero h1 {
	font-size: clamp(38px, 6vw, 68px) !important;
	color: var(--white);
}

.nd-hero__lead {
	margin-top: 18px;
	max-width: 56ch;
	font-size: 18px;
	line-height: 1.6;
	color: rgba(255, 255, 255, .82);
}

.nd-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 34px;
}

/* --------------------------------------------------- understand + signs --- */

.nd-understand__head { max-width: 64ch; }

.nd-understand h2 {
	font-size: clamp(30px, 4.2vw, 50px) !important;
	max-width: 20ch;
}

.nd-understand__head p {
	margin-top: 22px;
	font-size: 18px;
	line-height: 1.6;
	color: var(--n-500);
}

.nd-cue {
	margin-top: clamp(40px, 4vw, 56px);
	font-family: inherit;
	font-size: 18px;
	font-weight: 400;
	letter-spacing: normal;
	color: var(--n-ink);
}

.nd-signs {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}

.nd-sign {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 22px 26px;
	border: 1px solid var(--n-200);
	border-radius: var(--r-lg);
	background: var(--white);
}

.nd-sign__ico {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: var(--r);
	background: var(--nd-tint);
}

.nd-sign__ico img {
	width: 38px;
	height: 38px;
	object-fit: contain;
}

.nd-sign__txt {
	font-size: 18px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: -0.01em;
}

.nd-takeaway {
	margin-top: clamp(28px, 3vw, 40px);
	padding: 24px 28px;
	border-radius: var(--r-lg);
	background: var(--nd-tint);
	font-size: 18px;
	line-height: 1.6;
	color: var(--nd-deep);
	font-weight: 500;
}

/* ------------------------------------------------------------- headings --- */

.nd-head { max-width: 58ch; }

.nd-head h2 { font-size: clamp(30px, 4.2vw, 50px) !important; }

.nd-head p {
	margin-top: 20px;
	font-size: 18px;
	line-height: 1.6;
	color: var(--n-500);
}

/* ------------------------------------------------------------- products --- */

.nd-tabs {
	display: inline-flex;
	gap: 6px;
	margin-top: clamp(34px, 3.4vw, 48px);
	padding: 6px;
	border-radius: 14px;
	background: #e9ecf0;
}

.nd-tab {
	min-height: 52px;
	padding-inline: 34px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	color: #66758a;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.nd-tab.is-active {
	background: #fff;
	color: #24344a;
	box-shadow: 0 1px 3px rgba(31, 43, 71, .08);
}

.nd-tab:focus-visible {
	outline: 2px solid #a9b8d4;
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.nd-tab:not(.is-active):hover { color: #24344a; }
}

.nd-tabpanel { margin-top: clamp(28px, 3vw, 40px); }
.nd-tabpanel[hidden] { display: none; }

/* Four of the five pages run on the plain template, where the theme's
   `a { text-decoration: underline }` reaches the shop card and draws a rule
   under the audience badge. Miegas escapes it only because Elementor resets
   link decoration. Fixed here rather than in the shared card stylesheet, so
   the shop is untouched. */
.nd .pc a,
.nd .pc__media,
.nd .pc__name a { text-decoration: none !important; }

/* Cards at shop size, left aligned with every heading on the page. Flex, not
   a fixed grid, because koncentracija carries three products and the rest
   carry two; both need to sit at the same card width. */
.nd-prods {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}

.nd-prods > * {
	flex: 0 1 360px;
	max-width: 360px;
}

/* -------------------------------------------------------------- related --- */

/* This is where the page stops being about one need and points elsewhere, so
   it gets its own ground and drops the per-need accent: the arrows go blue,
   the site's own navigation colour, rather than this need's colour. */
/* Full padding above, half below: the CTA panel begins the moment the band
   ends, so a full measure underneath pushed it too far from the cards. */
.nd-related {
	background: var(--n-50);
	padding-top: var(--sec) !important;
	padding-bottom: calc(var(--sec) * 0.5) !important;
}

/* The band supplies its own top padding, so the white section above sheds
   most of its bottom padding. Otherwise the two stack and the gap doubles. */
.nd-products { padding-bottom: calc(var(--sec) * 0.42); }

/* The band's own bottom padding is the gap to the CTA. The generic
   `.nd-sec + .nd-sec { padding-top: 0 }` above handles the rest. */

.nd-related__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-top: clamp(30px, 3vw, 44px);
}

.nd-rel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 24px 26px;
	border: 1px solid var(--n-200);
	border-radius: var(--r-lg);
	background: var(--white);
	color: var(--n-ink);
	text-decoration: none !important;
	font-size: 18px;
	font-weight: 500;
	letter-spacing: -0.012em;
	transition: border-color .2s ease;
}

.nd-rel svg {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	fill: none;
	stroke: var(--blue);
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform .2s ease;
}

@media (hover: hover) and (pointer: fine) {
	.nd-rel:hover { border-color: var(--blue); }
	.nd-rel:hover svg { transform: translateX(5px); }
}

/* ------------------------------------------------------------------ cta --- */

.nd-cta__panel {
	position: relative;
	display: flex;
	align-items: center;
	min-height: clamp(280px, 26vw, 360px);
	padding: clamp(36px, 4.4vw, 68px);
	border-radius: var(--r-xl);
	overflow: hidden;
	background: var(--n-ink);
	isolation: isolate;
}

.nd .nd-cta__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 68% 22%;
}

.nd-cta__panel::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(90deg, rgba(10, 30, 60, .95) 0%, rgba(10, 30, 60, .84) 46%, rgba(10, 30, 60, .46) 100%);
}

.nd-cta__body { max-width: 44ch; }

.nd-cta h2 {
	font-size: clamp(30px, 4.2vw, 50px) !important;
	color: var(--white);
}

.nd-cta__body p {
	margin-top: 18px;
	font-size: 18px;
	line-height: 1.6;
	color: rgba(255, 255, 255, .78);
}

.nd-cta__body .nd-btn { margin-top: 30px; }

/* ===================================================== responsive ======== */

@media (max-width: 1080px) {
	.nd-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.nd-hero__panel::after {
		background: linear-gradient(90deg, rgba(10, 30, 60, .94) 0%, rgba(10, 30, 60, .82) 60%, rgba(10, 30, 60, .6) 100%);
	}
}

@media (max-width: 760px) {
	.nd {
		--gutter: var(--snmd-gutter, 18px);
		--sec: var(--snmd-section-y, 56px);
	}

	.nd-hero { padding-block: 16px 0; }

	.nd-hero__panel {
		min-height: 0;
		padding: 30px 22px 32px;
	}

	/* Vertical scrim on small screens, since the copy now sits over the whole
	   frame. Kept light enough at the top that the photograph still reads. */
	.nd-hero__panel::after {
		background: linear-gradient(180deg, rgba(10, 30, 60, .62) 0%, rgba(10, 30, 60, .88) 46%, rgba(10, 30, 60, .95) 100%);
	}

	.nd-hero__lead { margin-top: 14px; }
	.nd-hero__actions { margin-top: 26px; gap: 10px; }
	.nd-hero__actions .nd-btn { flex: 1 1 100%; }

	.nd-understand__head p { margin-top: 16px; }
	.nd-cue { margin-top: 32px; }

	.nd-signs { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.nd-sign { gap: 16px; padding: 16px 18px; }
	.nd-sign__ico { width: 54px; height: 54px; }
	.nd-sign__ico img { width: 32px; height: 32px; }
	.nd-sign__txt { font-size: 18px; }

	.nd-takeaway { margin-top: 24px; padding: 20px 22px; font-size: 18px; }

	.nd-head p { margin-top: 14px; }

	.nd-tabs { display: flex; width: 100%; gap: 6px; margin-top: 28px; }
	.nd-tab { flex: 1 1 0; padding-inline: 12px; }

	.nd-tabpanel { margin-top: 24px; }
	.nd-prods { gap: 16px; }
	.nd-prods > * { flex: 1 1 100%; max-width: none; }

	.nd-related__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; }
	.nd-rel { padding: 18px 20px; font-size: 18px; }

	/* Tall enough that the panel reads as a deliberate block rather than a
	   box shrink-wrapped around three lines of text. */
	.nd-cta__panel { min-height: 400px; padding: 34px 24px 36px; }
	.nd-cta__panel::after { background: linear-gradient(180deg, rgba(10, 30, 60, .64) 0%, rgba(10, 30, 60, .9) 48%, rgba(10, 30, 60, .96) 100%); }
	.nd-cta__body p { margin-top: 14px; }
	.nd-cta__body .nd-btn { margin-top: 24px; width: 100%; }
}
