/* Zenesis v2 — "Four Core Services" section.
   Layout, content, colours and typography are set in Elementor / Site Settings.
   This file adds the sticky panel stack (numbered headers stay visible as tabs), tab states,
   card hover, photo crop and the scroll reveal. States are set by services.js. */

.zn-services {
	--zn-ease-out: cubic-bezier(.16, 1, .3, 1);
	--zn-top: 24px;  /* first panel's sticky offset */
	--zn-tab: 64px;  /* tab height = offset step between stacked panels (matches the tab's min height in Elementor) */
}
.zn-services p:last-child { margin-bottom: 0; }
.zn-services .zn-services__dot { color: var(--e-global-color-primary); }

/* ── Sticky stack: each panel sticks one tab-height below the previous one ── */
body:not(.elementor-editor-active) .zn-services .zn-services__panel {
	position: sticky;
	top: calc(var(--zn-top) + var(--zn-i, 0) * var(--zn-tab));
}
.zn-services .zn-services__panel:nth-child(2) { --zn-i: 1; }
.zn-services .zn-services__panel:nth-child(3) { --zn-i: 2; }
.zn-services .zn-services__panel:nth-child(4) { --zn-i: 3; }

/* panel being covered by the next one recedes slightly (--zn-c: 0 → 1, set on scroll) */
.zn-services .zn-services__body {
	transform-origin: 50% 0;
	opacity: calc(1 - var(--zn-c, 0) * .55);
	scale: calc(1 - var(--zn-c, 0) * .035);
}

/* ── Tabs ── */
.zn-services .zn-services__tab { position: relative; cursor: pointer; }
.zn-services .zn-services__tab:focus-visible { outline: 1px solid var(--e-global-color-primary); outline-offset: -4px; }
.zn-services .zn-services__name { min-width: 0; }
.zn-services .zn-services__name .elementor-heading-title {
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	transition: color .4s ease, opacity .4s ease;
}
.zn-services .zn-services__num .elementor-heading-title { font-variant-numeric: tabular-nums; }
/* gold underline marks the active tab */
.zn-services .zn-services__tab::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
	background: var(--e-global-color-primary);
	scale: 0 1; transform-origin: 0 50%;
	transition: scale .9s var(--zn-ease-out);
}
.zn-services .zn-services__panel.is-active .zn-services__tab::after { scale: 1 1; }
.zn-services .zn-services__panel.is-past .zn-services__name .elementor-heading-title { opacity: .6; }

/* circled arrow: points up on tabs above the active one, down below it, filled when active */
.zn-services .zn-services__arrow .elementor-icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border-radius: 50%;
	border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
	transition: border-color .4s ease, background-color .4s ease, color .4s ease, rotate .6s var(--zn-ease-out);
}
.zn-services .zn-services__arrow .elementor-icon svg { width: 12px; height: 12px; fill: currentColor; }
.zn-services .zn-services__panel.is-past .zn-services__arrow .elementor-icon { rotate: 180deg; }
.zn-services .zn-services__panel.is-active .zn-services__arrow .elementor-icon {
	border-color: var(--e-global-color-primary); background-color: var(--e-global-color-primary); color: var(--e-global-color-zn_white);
}
.zn-services .zn-services__panel:not(.is-active) .zn-services__tab:hover .zn-services__name .elementor-heading-title { color: var(--e-global-color-primary); opacity: 1; }
.zn-services .zn-services__panel:not(.is-active) .zn-services__tab:hover .zn-services__arrow .elementor-icon { border-color: var(--e-global-color-primary); color: var(--e-global-color-primary); }

/* ── Service cards ── */
.zn-services .zn-services__item {
	position: relative;
	transition: box-shadow .5s ease, transform .5s var(--zn-ease-out);
}
.zn-services .zn-services__item::before {
	content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
	background: var(--e-global-color-primary);
	scale: 0 1; transform-origin: 0 50%;
	transition: scale .6s var(--zn-ease-out);
}
.zn-services .zn-services__item:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -24px rgba(15, 19, 43, .35); }
.zn-services .zn-services__item:hover::before { scale: 1 1; }
.zn-services .zn-services__icon img { display: block; transition: scale .5s var(--zn-ease-out); }
.zn-services .zn-services__item:hover .zn-services__icon img { scale: 1.08; }

/* ── Photo: fills the column height, cropped ── */
.zn-services .zn-services__photo { position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; }
.zn-services .zn-services__photo img {
	position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}

/* Practice area title: links to its service page (link set in Elementor), turns gold on hover */
.zn-services .zn-services__title .elementor-heading-title a { color: inherit; transition: color .4s ease; }
.zn-services .zn-services__title .elementor-heading-title a:is(:hover, :focus-visible) { color: var(--e-global-color-primary); }
.zn-services .zn-services__title .elementor-heading-title a:focus-visible { outline: 1px solid var(--e-global-color-primary); outline-offset: 4px; }

/* "Explore …" links: .zn-link component in global.css (circle fills gold, arrow nudges; label keeps its colour) */

/* ── Scroll reveal (armed by services.js; without JS everything is visible) ── */
.zn-services.is-armed .zn-services-rv { opacity: 0; translate: 0 28px; }
.zn-services.is-armed .zn-services-rv.is-in {
	opacity: 1; translate: 0 0;
	transition: opacity 1s ease, translate 1.2s var(--zn-ease-out);
	transition-delay: var(--zn-d, 0s);
}
.zn-services.is-armed .zn-services__accent { scale: 1 0; transform-origin: 50% 0; }
.zn-services.is-armed .zn-services__accent.is-in { scale: 1 1; transition: scale 1.2s var(--zn-ease-out) .1s; }
.zn-services.is-armed .zn-services__photo { clip-path: inset(100% 0 0 0); }
.zn-services.is-armed .zn-services__photo img { scale: 1.15; }
/* driven by the column (a fully clipped element never reports as intersecting) */
.zn-services.is-armed .zn-services__media.is-in .zn-services__photo { clip-path: inset(0 0 0 0); transition: clip-path 1.4s var(--zn-ease-out) .15s; }
.zn-services.is-armed .zn-services__media.is-in .zn-services__photo img { scale: 1; transition: scale 2s var(--zn-ease-out) .15s; }

@media (max-width: 1024px) {
	.zn-services { --zn-top: 20px; --zn-tab: 60px; }
	.zn-services .zn-services__photo { min-height: 0; }
}
@media (max-width: 767px) {
	.zn-services { --zn-top: 12px; --zn-tab: 52px; }
	.zn-services .zn-services__item:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.zn-services .zn-services__body { opacity: 1; scale: none; }
	.zn-services .zn-services__item,
	.zn-services .zn-services__item:hover { transform: none; transition: none; }
	.zn-services .zn-services__icon img { transition: none; }
}
