/*
 * Explanatory diagrams (inc/diagrams.php) and the YouTube poster player.
 * Without CSS each diagram is a numbered list; with it, a track, a flow with
 * a validation loop, or a lifecycle ring. Motion only when allowed.
 */

.ig-dg {
	--dg-a: var(--wp--preset--color--red);
	--dg-b: var(--wp--preset--color--violet);
	--dg-c: var(--wp--preset--color--blue);
	margin: 0;
	padding: clamp(24px, 3.5vw, 44px);
	border: 1px solid rgba(157, 168, 255, .18);
	border-radius: 20px;
	background:
		radial-gradient(60% 80% at 100% 0%, rgba(118, 97, 255, .14), transparent 60%),
		linear-gradient(180deg, rgba(22, 36, 58, .75), rgba(11, 16, 32, .75));
}

.ig-dg__track {
	position: relative;
	display: grid;
	grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
	gap: 18px;
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: none;
}

/* The connecting line behind the nodes. */
.ig-dg__track::before {
	content: "";
	position: absolute;
	top: 21px;
	left: 22px;
	right: 22px;
	height: 2px;
	background: linear-gradient(90deg, var(--dg-a), var(--dg-b) 55%, var(--dg-c));
	opacity: .75;
}

.ig-dg__step { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.ig-dg__node {
	position: relative;
	z-index: 1;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: #0B1020;
	border: 1.5px solid rgba(157, 168, 255, .55);
	color: var(--wp--preset--color--text-1);
	font-family: var(--wp--preset--font-family--mono);
	font-size: .78rem;
	font-weight: 500;
	box-shadow: 0 0 0 6px rgba(11, 16, 32, .9);
}

.ig-dg__body { display: flex; flex-direction: column; gap: 6px; }
.ig-dg__title { font-family: var(--wp--preset--font-family--heading); font-weight: 600; font-size: 1.02rem; line-height: 1.3; color: var(--wp--preset--color--text-1); }
.ig-dg__text { font-size: .93rem; line-height: 1.55; color: var(--wp--preset--color--text-2); }
.ig-dg__tag {
	align-self: flex-start;
	margin-top: 4px;
	padding: 3px 9px;
	border-radius: 999px;
	border: 1px solid rgba(157, 168, 255, .3);
	font-family: var(--wp--preset--font-family--mono);
	font-size: .7rem;
	letter-spacing: .06em;
	color: var(--wp--preset--color--periwinkle);
}

.ig-dg__caption {
	margin-top: 26px;
	padding-top: 18px;
	border-top: 1px solid rgba(157, 168, 255, .14);
	font-size: .88rem;
	color: var(--wp--preset--color--text-3);
}

/* A. Attack path: phase brackets above the track. */
.ig-dg--attack { --cols: 6; }
.ig-dg__phases { display: grid; grid-template-columns: 1fr 3fr 2fr; gap: 18px; margin-bottom: 22px; }
.ig-dg__phase {
	padding: 8px 0 0;
	border-top: 2px solid;
	font-family: var(--wp--preset--font-family--mono);
	font-size: .72rem;
	letter-spacing: .12em;
	text-transform: uppercase;
}
.ig-dg__phase--discover { border-color: var(--wp--preset--color--red); color: var(--wp--preset--color--red); }
.ig-dg__phase--validate { border-color: var(--wp--preset--color--violet); color: var(--wp--preset--color--periwinkle); }
.ig-dg__phase--remediate { border-color: var(--wp--preset--color--blue); color: var(--wp--preset--color--blue); }
.ig-dg--attack .ig-dg__step:nth-child(1) .ig-dg__node { border-color: var(--wp--preset--color--red); }
.ig-dg--attack .ig-dg__step:nth-child(n+5) .ig-dg__node { border-color: var(--wp--preset--color--blue); }

/* B. Detection and response flow with a validation loop. */
.ig-dg--flow { --cols: 5; --dg-a: var(--wp--preset--color--cyan); --dg-b: var(--wp--preset--color--blue); --dg-c: var(--wp--preset--color--violet); }
.ig-dg__loop {
	position: relative;
	margin-top: 28px;
	padding: 18px 20px 18px 56px;
	border: 1px dashed rgba(111, 224, 246, .4);
	border-radius: 14px;
	background: rgba(111, 224, 246, .05);
}
.ig-dg__loop p { margin: 0; font-size: .94rem; color: var(--wp--preset--color--text-2); }
.ig-dg__loop strong { color: var(--wp--preset--color--text-1); }
.ig-dg__loop-line {
	position: absolute;
	left: 18px;
	top: 50%;
	width: 24px;
	height: 24px;
	margin-top: -12px;
	border: 2px solid var(--wp--preset--color--cyan);
	border-right-color: transparent;
	border-radius: 50%;
}
.ig-dg__loop-line::after {
	content: "";
	position: absolute;
	right: -3px;
	top: -2px;
	border: 5px solid transparent;
	border-left-color: var(--wp--preset--color--cyan);
	transform: rotate(-40deg);
}

/* C. Lifecycle ring: nodes around a core on wide screens. */
.ig-dg--cycle { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.ig-dg--cycle .ig-dg__caption { grid-column: 1 / -1; }
.ig-dg--cycle .ig-dg__track { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 26px; }
.ig-dg--cycle .ig-dg__track::before { display: none; }
.ig-dg--cycle .ig-dg__step { flex-direction: row; align-items: flex-start; }
.ig-dg--cycle .ig-dg__node { flex: none; }
.ig-dg__ring {
	position: relative;
	width: min(100%, 320px);
	aspect-ratio: 1;
	margin-inline: auto;
}
.ig-dg__ring::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(from -90deg, #7661FF, #6EB8F1, #6FE0F6, #7661FF);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.ig-dg__ring::after {
	content: "";
	position: absolute;
	inset: 18%;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(118, 97, 255, .38), transparent 70%);
}
.ig-dg__ring-core {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: grid;
	place-items: center;
	text-align: center;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	font-size: 1.2rem;
	line-height: 1.25;
	color: var(--wp--preset--color--text-1);
}

@media (prefers-reduced-motion: no-preference) {
	.ig-dg .ig-dg__step { opacity: .35; transform: translateY(8px); transition: opacity .6s ease, transform .6s ease; transition-delay: calc(var(--i) * 140ms); }
	.ig-dg.is-in .ig-dg__step { opacity: 1; transform: none; }
	.ig-dg__track::before { transform-origin: left; transform: scaleX(.05); transition: transform 1.4s cubic-bezier(.2, .7, .2, 1); }
	.ig-dg.is-in .ig-dg__track::before { transform: none; }
	.ig-dg.is-in .ig-dg__ring::before { animation: dg-spin 40s linear infinite; }
}
/* Without JavaScript nothing waits for a reveal. */
html:not(.n-js) .ig-dg .ig-dg__step { opacity: 1; transform: none; }
html:not(.n-js) .ig-dg__track::before { transform: none; }

@keyframes dg-spin { to { transform: rotate(360deg); } }

/* Vertical layouts on smaller screens. */
@media (max-width: 1023.98px) {
	.ig-dg--attack .ig-dg__phases { display: none; }
	.ig-dg__track,
	.ig-dg--cycle .ig-dg__track { grid-template-columns: minmax(0, 1fr); gap: 22px; }
	.ig-dg__track::before { top: 22px; bottom: 22px; left: 21px; right: auto; width: 2px; height: auto; background: linear-gradient(180deg, var(--dg-a), var(--dg-b) 55%, var(--dg-c)); }
	.ig-dg__step { flex-direction: row; align-items: flex-start; }
	.ig-dg__node { flex: none; }
	.ig-dg--cycle { grid-template-columns: minmax(0, 1fr); }
	.ig-dg__ring { width: min(60%, 220px); }
	@media (prefers-reduced-motion: no-preference) {
		.ig-dg__track::before { transform-origin: top; transform: scaleY(.05); }
		.ig-dg.is-in .ig-dg__track::before { transform: none; }
	}
}

/* ---------------------------------------------------------- Video poster */

.ig-video { margin: 0; }
.ig-video__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; border: 1px solid rgba(157, 168, 255, .22); background: #0B1020; }
.ig-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ig-video__play { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: #FFFFFF; }
.ig-video__play img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85) brightness(.7); transition: filter .3s ease, transform .5s ease; }
.ig-video__play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(6, 9, 16, .85)); }
.ig-video__icon {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 1;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	background: var(--wp--preset--color--violet-deep);
	box-shadow: 0 0 0 8px rgba(91, 69, 232, .25);
	transition: transform .25s ease, box-shadow .25s ease;
}
.ig-video__icon::after { content: ""; position: absolute; left: 29px; top: 24px; border-left: 18px solid #FFFFFF; border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.ig-video__title { position: absolute; left: 20px; right: 20px; bottom: 16px; z-index: 1; text-align: left; font-family: var(--wp--preset--font-family--heading); font-weight: 600; font-size: 1.05rem; line-height: 1.3; }
.ig-video__play:hover img,
.ig-video__play:focus-visible img { filter: saturate(1) brightness(.85); transform: scale(1.03); }
.ig-video__play:hover .ig-video__icon,
.ig-video__play:focus-visible .ig-video__icon { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(91, 69, 232, .3); }
.ig-video__play:focus-visible { outline: 3px solid var(--wp--preset--color--cyan); outline-offset: -3px; }
.ig-video figcaption { margin-top: 12px; font-size: .9rem; color: var(--wp--preset--color--text-3); }

/* Video section layout: text beside the player. */
.ig-video-section__grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
.ig-video-section__grid > * { margin: 0 !important; }
.ig-video-section__copy > * { margin-block: 0; }
.ig-video-section__copy > * + * { margin-top: 16px; }
@media (max-width: 900px) { .ig-video-section__grid { grid-template-columns: minmax(0, 1fr); } }

/* Homepage orbit: data flowing from each capability to the core. */
.n-flow { stroke: var(--wp--preset--color--cyan); stroke-width: .6; stroke-linecap: round; stroke-dasharray: 1.4 40; stroke-dashoffset: 0; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
	.n-orbit-wrap.is-in .n-flow { opacity: .9; animation: n-flow 3.2s linear infinite; }
	.n-orbit-wrap.is-in .n-flow:nth-child(2) { animation-delay: .6s; }
	.n-orbit-wrap.is-in .n-flow:nth-child(3) { animation-delay: 1.2s; }
	.n-orbit-wrap.is-in .n-flow:nth-child(4) { animation-delay: 1.8s; }
	.n-orbit-wrap.is-in .n-flow:nth-child(5) { animation-delay: 2.4s; }
}
@keyframes n-flow { from { stroke-dashoffset: 42; } to { stroke-dashoffset: 0; } }

.n-orbit-legend {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 18px;
	width: 100%;
	margin: 40px 0 0;
	padding: 0;
	list-style: none;
	counter-reset: n-leg;
}
.n-orbit-legend li { counter-increment: n-leg; padding-top: 14px; border-top: 2px solid rgba(111, 224, 246, .45); }
.n-orbit-legend li::before { content: "0" counter(n-leg); display: block; margin-bottom: 8px; font-family: var(--wp--preset--font-family--mono); font-size: .74rem; color: var(--wp--preset--color--cyan); }
.n-orbit-legend strong { display: block; color: var(--wp--preset--color--text-1); font-family: var(--wp--preset--font-family--heading); font-weight: 600; font-size: 1rem; line-height: 1.3; }
.n-orbit-legend span { display: block; margin-top: 6px; font-size: .93rem; line-height: 1.55; color: var(--wp--preset--color--text-2); }
@media (max-width: 1023.98px) { .n-orbit-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599.98px) { .n-orbit-legend { grid-template-columns: minmax(0, 1fr); } }
