/**
 * Preluence Genesis — Footer Engine.
 *
 * The futuristic footer templates. A preset is resolved by PHP into the
 * `pn-ftr--*` classes on the <footer> element plus a tiny token block; this
 * stylesheet paints the surface, the decorative fields and the signature
 * horizon. The widget columns, the bottom bar and the credit row keep the
 * markup and geometry the theme already ships.
 *
 * Rules that must hold for every template:
 * - Decoration is aria-hidden, pointer-events none and never the only carrier
 *   of meaning (accessibility.md › Vision).
 * - Motion is offered only under `prefers-reduced-motion: no-preference`
 *   (motion.md › Best practices).
 * - Glass gets an opaque fallback under `prefers-reduced-transparency`
 *   (liquid-glass.md › review checklist, item 5).
 * - Contrast holds in both appearances; the muted ink is mixed against the
 *   surface, never a fixed grey (dark-mode.md › Dark Mode colors).
 */

/* -------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

.pn-footer {
	--pn-f-accent: var(--pn-primary);
	--pn-f-radius: 0px;
	--pn-f-blur: 0px;
}

.pn-ftr {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	--pn-f-line: color-mix(in srgb, var(--pn-f-accent) 52%, transparent);
	--pn-f-glow: color-mix(in srgb, var(--pn-f-accent) 30%, transparent);
}

/* The template owns the top edge; the horizon replaces the heavy brand rule. */
.pn-footer.pn-ftr {
	border-block-start-width: 1px;
	border-block-start-color: var(--pn-f-border);
}

.pn-ftr--has-horizon.pn-footer {
	border-block-start-color: transparent;
}

/* -------------------------------------------------------------------------
 * Surface tones — one ink decision per surface, mixed against that surface
 * ---------------------------------------------------------------------- */

.pn-ftr--surface-dark {
	--pn-f-bg: #12151b;
	--pn-f-ink: #e8ecf3;
	--pn-f-text: #e8ecf3;
	--pn-f-strong: #ffffff;
	--pn-f-hover: #ffffff;
	--pn-f-muted: color-mix(in srgb, #e8ecf3 66%, var(--pn-f-bg));
	--pn-f-border: color-mix(in srgb, #e8ecf3 16%, transparent);
}

.pn-ftr--surface-light {
	--pn-f-bg: #eef1f5;
	--pn-f-ink: #0b0d10;
	--pn-f-text: #14171c;
	--pn-f-strong: #0b0d10;
	--pn-f-hover: var(--pn-f-accent);
	--pn-f-muted: color-mix(in srgb, #14171c 62%, var(--pn-f-bg));
	--pn-f-border: color-mix(in srgb, #14171c 14%, transparent);
}

.pn-ftr--surface-brand {
	--pn-f-bg: var(--pn-primary);
	--pn-f-ink: var(--pn-on-primary);
	--pn-f-text: var(--pn-on-primary);
	--pn-f-strong: var(--pn-on-primary);
	--pn-f-hover: var(--pn-on-primary);
	--pn-f-muted: color-mix(in srgb, var(--pn-on-primary) 74%, var(--pn-primary));
	--pn-f-border: color-mix(in srgb, var(--pn-on-primary) 22%, var(--pn-primary));
}

/*
 * Surfaces. Scoped to `.pn-footer.pn-ftr--preset-*` so a template beats the
 * legacy tone classes regardless of stylesheet order.
 */
.pn-footer.pn-ftr--preset-paper { --pn-f-bg: #fbfaf7; }
.pn-footer.pn-ftr--preset-slate { --pn-f-bg: #eef1f5; }
.pn-footer.pn-ftr--preset-cloud { --pn-f-bg: #f6f8fc; }
.pn-footer.pn-ftr--preset-graphite { --pn-f-bg: #12151b; }
.pn-footer.pn-ftr--preset-navy { --pn-f-bg: #0b1b3a; }
.pn-footer.pn-ftr--preset-cinema { --pn-f-bg: #06070b; }
.pn-footer.pn-ftr--preset-horizon { --pn-f-bg: #070d1c; }
.pn-footer.pn-ftr--preset-aurora { --pn-f-bg: #081326; }
.pn-footer.pn-ftr--preset-neon { --pn-f-bg: #05070d; }
.pn-footer.pn-ftr--preset-holo { --pn-f-bg: #070d1c; }
.pn-footer.pn-ftr--preset-glass { --pn-f-bg: #0a0f18; }
.pn-footer.pn-ftr--preset-constellation { --pn-f-bg: #04070f; }
.pn-footer.pn-ftr--preset-terminal { --pn-f-bg: #04070a; }
.pn-footer.pn-ftr--preset-sunrise { --pn-f-bg: #1c1030; }
.pn-footer.pn-ftr--preset-brand { --pn-f-bg: var(--pn-primary); }

/* -------------------------------------------------------------------------
 * Decorative field
 * ---------------------------------------------------------------------- */

.pn-ftr__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.pn-ftr__layer {
	position: absolute;
	inset: 0;
	display: block;
}

.pn-ftr > .pn-footer__widgets,
.pn-ftr > .pn-footer__bottom,
.pn-ftr > .pn-footer__credit-row {
	position: relative;
	z-index: 1;
}

/* Holographic grid — a receding floor under the columns. */
.pn-ftr__grid {
	background-image:
		linear-gradient(to right, var(--pn-f-line) 1px, transparent 1px),
		linear-gradient(to bottom, var(--pn-f-line) 1px, transparent 1px);
	background-size: 48px 48px;
	-webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / 30%), transparent 76%);
	mask-image: linear-gradient(to bottom, rgb(0 0 0 / 30%), transparent 76%);
	transform: perspective(340px) rotateX(56deg) scale(1.5);
	transform-origin: 50% 100%;
	opacity: 0.34;
}

/* Aurora drift. */
.pn-ftr__aurora {
	background:
		radial-gradient(46% 130% at 10% 0%, var(--pn-f-glow), transparent 70%),
		radial-gradient(42% 130% at 92% 8%, color-mix(in srgb, var(--pn-f-accent) 20%, transparent), transparent 72%);
	opacity: 0.85;
}

/* Constellation — a quiet starfield. */
.pn-ftr__stars {
	background-image:
		radial-gradient(1px 1px at 8% 26%, rgb(255 255 255 / 70%), transparent),
		radial-gradient(1px 1px at 21% 14%, rgb(255 255 255 / 55%), transparent),
		radial-gradient(1px 1px at 34% 32%, rgb(255 255 255 / 60%), transparent),
		radial-gradient(1px 1px at 47% 12%, rgb(255 255 255 / 45%), transparent),
		radial-gradient(1px 1px at 58% 30%, rgb(255 255 255 / 65%), transparent),
		radial-gradient(1px 1px at 69% 18%, rgb(255 255 255 / 50%), transparent),
		radial-gradient(1px 1px at 79% 34%, rgb(255 255 255 / 60%), transparent),
		radial-gradient(1px 1px at 90% 16%, rgb(255 255 255 / 55%), transparent),
		radial-gradient(1.4px 1.4px at 15% 44%, var(--pn-f-glow), transparent),
		radial-gradient(1.4px 1.4px at 63% 46%, var(--pn-f-glow), transparent);
	background-repeat: no-repeat;
	opacity: 0.7;
}

/* Spotlight — a soft ceiling glow for the cinematic sign-off. */
.pn-ftr__spot {
	background: radial-gradient(58% 92% at 50% -12%, var(--pn-f-glow), transparent 70%);
	opacity: 0.9;
}

/* Circuit trace. */
.pn-ftr__circuit {
	background-image:
		linear-gradient(90deg, transparent 0 46px, var(--pn-f-line) 46px 47px, transparent 47px 100%),
		linear-gradient(0deg, transparent 0 30px, var(--pn-f-line) 30px 31px, transparent 31px 100%);
	background-size: 96px 62px;
	-webkit-mask-image: radial-gradient(84% 110% at 50% 0%, #000 12%, transparent 86%);
	mask-image: radial-gradient(84% 110% at 50% 0%, #000 12%, transparent 86%);
	opacity: 0.3;
}

/* Holo scan lines. */
.pn-ftr__scan {
	background-image: repeating-linear-gradient(0deg, var(--pn-f-line) 0 1px, transparent 1px 4px);
	opacity: 0.22;
}

.pn-ftr--surface-dark .pn-ftr__scan {
	mix-blend-mode: screen;
}

/* Fine grain, so large flat surfaces do not read as plastic. */
.pn-ftr__grain {
	background-image: repeating-conic-gradient(rgb(255 255 255 / 4%) 0% 25%, transparent 0% 50%);
	background-size: 3px 3px;
	mix-blend-mode: overlay;
	opacity: 0.45;
}

.pn-ftr--surface-light .pn-ftr__grain {
	background-image: repeating-conic-gradient(rgb(0 0 0 / 4%) 0% 25%, transparent 0% 50%);
}

/* The signature horizon line. */
.pn-ftr__horizon {
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--pn-f-accent) 50%, transparent);
	box-shadow: 0 0 26px var(--pn-f-glow);
	opacity: 0.9;
}

.pn-ftr--fx-neon .pn-ftr__horizon {
	box-shadow: 0 0 16px var(--pn-f-accent), 0 0 48px var(--pn-f-glow);
}

/* -------------------------------------------------------------------------
 * The widget columns — the "footer widget" surface itself
 * ---------------------------------------------------------------------- */

.pn-ftr .pn-widget__title {
	position: relative;
	padding-block-end: 0.55rem;
	letter-spacing: 0.02em;
}

.pn-ftr .pn-widget__title::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	bottom: 0;
	width: 34px;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--pn-f-accent), transparent);
}

.pn-ftr .pn-widget a {
	transition: color 0.15s ease;
}

.pn-ftr .pn-widget a:hover,
.pn-ftr .pn-widget a:focus-visible {
	color: var(--pn-f-accent);
}

.pn-ftr .pn-footer__site {
	background-image: linear-gradient(90deg, var(--pn-f-strong), color-mix(in srgb, var(--pn-f-accent) 70%, var(--pn-f-strong)));
	-webkit-background-clip: text;
	background-clip: text;
}

.pn-ftr--surface-light .pn-footer__site,
.pn-ftr--surface-brand .pn-footer__site {
	-webkit-text-fill-color: currentColor;
	color: var(--pn-f-strong);
	background-image: none;
}

/* -------------------------------------------------------------------------
 * Alignment variants
 * ---------------------------------------------------------------------- */

.pn-ftr--align-center .pn-footer__grid,
.pn-ftr--align-center .pn-footer__bottom-inner {
	justify-items: center;
	text-align: center;
}

.pn-ftr--align-center .pn-footer__brand,
.pn-ftr--align-center .pn-footer__legal {
	justify-content: center;
}

.pn-ftr--align-center .pn-widget__title::after {
	inset-inline-start: 50%;
	transform: translateX(-50%);
}

.pn-ftr--align-wide .pn-footer__grid {
	gap: clamp(1.5rem, 4vw, 3rem);
}

/* -------------------------------------------------------------------------
 * Glass panel
 * ---------------------------------------------------------------------- */

.pn-ftr--frosted .pn-footer__widgets {
	max-width: calc(var(--pn-container) - 2rem);
	margin-inline: auto;
	padding-inline: clamp(1rem, 3vw, 2rem);
	border: 1px solid color-mix(in srgb, var(--pn-f-ink) 14%, transparent);
	border-radius: var(--pn-f-radius);
	background: color-mix(in srgb, var(--pn-f-bg) 62%, transparent);
	-webkit-backdrop-filter: blur(var(--pn-f-blur)) saturate(1.3);
	backdrop-filter: blur(var(--pn-f-blur)) saturate(1.3);
}

@media (prefers-reduced-transparency: reduce) {

	.pn-ftr--frosted .pn-footer__widgets {
		background: var(--pn-f-bg);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
}

/* -------------------------------------------------------------------------
 * Terminal — a data-desk texture on the meta text only
 * ---------------------------------------------------------------------- */

.pn-ftr--mono .pn-widget__title,
.pn-ftr--mono .pn-footer__legal,
.pn-ftr--mono .pn-footer__copyright {
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
	letter-spacing: 0.02em;
}

/* -------------------------------------------------------------------------
 * Motion — offered, never required
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {

	.pn-ftr--has-horizon .pn-ftr__horizon {
		animation: pn-ftr-horizon 7s ease-in-out infinite;
	}

	.pn-ftr__aurora {
		animation: pn-ftr-aurora 24s ease-in-out infinite alternate;
	}

	.pn-ftr__scan {
		animation: pn-ftr-scan 10s linear infinite;
	}

	.pn-ftr__grid {
		animation: pn-ftr-grid 30s linear infinite;
	}
}

@keyframes pn-ftr-horizon {

	0%,
	100% {
		opacity: 0.7;
	}

	50% {
		opacity: 1;
	}
}

@keyframes pn-ftr-aurora {

	from {
		transform: translate3d(-3%, 0, 0) scale(1.04);
	}

	to {
		transform: translate3d(3%, -2%, 0) scale(1.14);
	}
}

@keyframes pn-ftr-scan {

	from {
		background-position-y: 0;
	}

	to {
		background-position-y: 64px;
	}
}

@keyframes pn-ftr-grid {

	from {
		background-position-y: 0;
	}

	to {
		background-position-y: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.pn-ftr__layer,
	.pn-ftr__horizon {
		animation: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Contrast and forced colours
 * ---------------------------------------------------------------------- */

@media (prefers-contrast: more) {

	.pn-ftr {
		--pn-f-border: color-mix(in srgb, var(--pn-f-ink) 36%, transparent);
	}

	.pn-ftr .pn-widget a {
		text-decoration: underline;
	}

	.pn-ftr__layer {
		opacity: 0.2;
	}
}

@media (forced-colors: active) {

	.pn-ftr__bg {
		display: none;
	}

	.pn-footer.pn-ftr {
		border-block-start: 2px solid CanvasText;
	}

	.pn-ftr .pn-widget__title::after {
		background: CanvasText;
	}
}
