/* Post-quantum encryption: the hybrid key exchange figure ({{PQ_ART}}), the status list ({{PQ_STATUS}}), the home
   page's proof tile and the /security section. Colours come from the section's tokens, so everything follows light
   mode. The loops wait until the figure scrolls into view (site.js adds .in), and reduced motion stops them (site.css). */

/* ---------- the figure ---------- */
.pq-art {
	position: relative;
	margin: 0;
	width: 100%;
	aspect-ratio: 600 / 390;
	container-type: inline-size;
	--pq-cycle: 3.6s;
}
.pq-svg {
	width: 100%;
	height: 100%;
	overflow: visible;
}
.pq-panel {
	fill: color-mix(in srgb, var(--fg) 3%, transparent);
	stroke: var(--line);
	stroke-width: 1;
}
.pq-axis {
	fill: none;
	stroke: var(--line);
	stroke-width: 1;
}
.pq-curve {
	fill: none;
	stroke: var(--signal);
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.pq-chord,
.pq-drop {
	fill: none;
	stroke: var(--fg-dim);
	stroke-width: 1.3;
	stroke-dasharray: 3 5;
}
.pq-pt {
	fill: var(--fg);
}
.pq-pt.is-faint {
	fill: none;
	stroke: var(--fg-dim);
	stroke-width: 1.4;
}
.pq-pt.is-key {
	fill: var(--ok);
}
.pq-dot {
	fill: var(--fg);
}
.pq-basis {
	fill: none;
	stroke: var(--signal);
	stroke-width: 2.2;
	stroke-linecap: round;
}
.pq-noise {
	fill: color-mix(in srgb, var(--ok) 14%, transparent);
	stroke: var(--ok);
	stroke-width: 1.2;
	stroke-dasharray: 2 3;
}
.pq-wire {
	fill: none;
	stroke: var(--line);
	stroke-width: 2;
}
.pq-flow {
	fill: none;
	stroke: var(--signal);
	stroke-width: 2.8;
	stroke-linecap: round;
	/* pathLength 100: a short dash that starts just before the path and runs past its end */
	stroke-dasharray: 14 200;
	stroke-dashoffset: 14;
}
.pq-plus {
	fill: none;
	stroke: var(--fg-dim);
	stroke-width: 2;
	stroke-linecap: round;
}
.pq-seal {
	fill: var(--ink-2);
	stroke: var(--ok);
	stroke-width: 2;
}
.pq-hole {
	fill: var(--ok);
}
.pq-halo {
	fill: var(--ok);
	opacity: 0;
	transform-box: fill-box;
	transform-origin: center;
}

/* one cycle: both halves travel to the key together, then the key glows */
.pq-flow {
	animation: pq-flow var(--pq-cycle) cubic-bezier(0.55, 0, 0.45, 1) infinite
		var(--d, 0s) paused;
}
.pq-halo {
	animation: pq-halo var(--pq-cycle) var(--ease) infinite paused;
}
.pq-pt.is-key,
.pq-noise {
	transform-box: fill-box;
	transform-origin: center;
	animation: pq-beat var(--pq-cycle) var(--ease-loop) infinite paused;
}
.pq-dot.is-twinkle {
	animation: pq-twinkle 2.4s var(--ease-loop) infinite var(--d, 0s) paused;
}
.pq-art.in
	:is(.pq-flow, .pq-halo, .pq-pt.is-key, .pq-noise, .pq-dot.is-twinkle) {
	animation-play-state: running;
}
@keyframes pq-flow {
	0% {
		stroke-dashoffset: 14;
	}
	68%,
	100% {
		stroke-dashoffset: -100;
	}
}
@keyframes pq-halo {
	0%,
	60% {
		opacity: 0;
		transform: scale(0.7);
	}
	72% {
		opacity: 0.32;
		transform: scale(1);
	}
	100% {
		opacity: 0;
		transform: scale(1.3);
	}
}
@keyframes pq-beat {
	0%,
	100% {
		transform: scale(1);
	}
	12% {
		transform: scale(1.3);
	}
	30% {
		transform: scale(1);
	}
}
@keyframes pq-twinkle {
	0%,
	100% {
		opacity: var(--o, 0.6);
	}
	50% {
		opacity: 1;
		fill: var(--signal);
	}
}

/* labels: HTML over the drawing, so they stay legible at any width */
.pq-label {
	position: absolute;
	display: grid;
	gap: 2px;
	justify-items: center;
	text-align: center;
	line-height: 1.15;
	transform: translateX(-50%);
	pointer-events: none;
	white-space: nowrap;
}
.pq-label small {
	font-family: var(--mono);
	font-size: max(var(--type-floor), clamp(0.58rem, 1.7cqi, 0.72rem));
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--fg-dim);
}
.pq-label b {
	font-weight: 500;
	font-size: clamp(0.78rem, 2.9cqi, 1.05rem);
	letter-spacing: -0.01em;
	color: var(--fg);
}
.pq-l-classical {
	left: 23.3%;
	top: 0;
}
.pq-l-quantum {
	left: 74.7%;
	top: 0;
}
.pq-l-key {
	left: 49%;
	top: 89.5%;
}
.pq-l-key b {
	color: var(--ok);
}
html[data-theme='light'] .night .pq-l-key b,
html[data-theme='light'] .night .pq-label small {
	color: var(--fg-dim);
}
html[data-theme='light'] .night .pq-l-key b {
	color: var(--ok-ink);
}
@container (max-width: 420px) {
	.pq-label small {
		letter-spacing: 0.08em;
	}
	.pq-l-key small {
		display: none;
	}
	.pq-l-key {
		top: 91%;
	}
}

/* light mode: the green reads darker on white */
html[data-theme='light'] .night :is(.pq-pt.is-key, .pq-hole, .pq-halo) {
	fill: var(--ok-ink);
}
html[data-theme='light'] .night :is(.pq-seal, .pq-noise) {
	stroke: var(--ok-ink);
}
html[data-theme='light'] .night .pq-seal {
	fill: #fff;
}

/* ---------- status list ---------- */
.pq-status {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	border-top: 1px solid var(--line);
}
.pq-row {
	display: grid;
	grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto;
	gap: 6px 24px;
	align-items: baseline;
	padding: 18px 0;
	border-bottom: 1px solid var(--line);
}
.pq-row b {
	font-weight: 500;
	letter-spacing: -0.01em;
}
.pq-what {
	color: var(--fg-dim);
}
.pq-state {
	--c: var(--fg-dim);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	justify-self: end;
	font-family: var(--mono);
	font-size: max(var(--type-floor), 0.72rem);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--c);
	white-space: nowrap;
}
.pq-state::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--c);
}
.is-live .pq-state {
	--c: var(--ok);
}
.is-live .pq-state::before {
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent);
	animation: pq-live 2.4s var(--ease-loop) infinite;
}
.is-next .pq-state {
	--c: var(--signal);
}
.is-resistant .pq-state {
	--c: var(--ice);
}
html[data-theme='light'] .night .is-live .pq-state {
	--c: var(--ok-ink);
}
html[data-theme='light'] .night .is-resistant .pq-state {
	--c: var(--navy);
}
@keyframes pq-live {
	50% {
		box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 0%, transparent);
	}
}
@media (max-width: 720px) {
	.pq-row {
		grid-template-columns: minmax(0, 1fr) auto;
	}
	.pq-what {
		grid-column: 1 / -1;
		grid-row: 2;
	}
}

/* ---------- home: the proof tile ---------- */
.pq-tile {
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
	align-items: center;
	gap: clamp(24px, 4vw, 56px);
}
.pq-tile > .stack {
	gap: 14px;
}
.pq-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
}
.pq-chips li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--mono);
	font-size: max(var(--type-floor), 0.74rem);
	padding: 7px 12px;
	border-radius: 999px;
	box-shadow: 0 0 0 1px var(--line) inset;
	color: var(--fg);
}
.pq-chips li::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ok);
}
.pq-chips li.is-next::before {
	background: var(--signal);
}
.pq-chips li span {
	color: var(--fg-dim);
}
html[data-theme='light'] .night .pq-chips li::before {
	background: var(--ok-ink);
}
html[data-theme='light'] .night .pq-chips li.is-next::before {
	background: var(--signal);
}
@media (max-width: 900px) {
	.pq-tile {
		grid-template-columns: 1fr;
	}
}

/* ---------- /security: the section ---------- */
.pq-section .split {
	align-items: center;
}
.pq-steps {
	display: grid;
	gap: 26px;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: pq;
}
.pq-steps li {
	display: grid;
	gap: 6px;
	counter-increment: pq;
}
.pq-steps li::before {
	content: counter(pq, decimal-leading-zero);
	font-family: var(--mono);
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	color: var(--signal);
}
.pq-steps h3 {
	font-size: clamp(1.2rem, 1.9vw, 1.5rem);
	letter-spacing: -0.02em;
}
.pq-steps p {
	color: var(--fg-dim);
	max-width: 46ch;
}
.pq-where {
	display: grid;
	gap: 18px;
	margin-top: clamp(56px, 7vw, 96px);
}
.pq-note {
	color: var(--fg-dim);
	font-size: 0.92rem;
	max-width: 70ch;
}
