/**
 * Gulo Link-in-Bio — Frontend Stylesheet
 *
 * Layout and design for a link-in-bio page. All brand colors are applied
 * via CSS custom properties set inline by PHP, so this sheet stays
 * theme-agnostic.
 *
 * @package LinkInBio
 */

/* ── Page template reset ────────────────────────────────────────── */

body.lib-page {
	margin: 0;
	padding: 0;
	background: none;
}

/* ── Skip Link ──────────────────────────────────────────────────── */

.lib-skip-link {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
	z-index: 9999;
	text-decoration: none;
}

.lib-skip-link:focus {
	position: fixed;
	top: 0;
	left: 0;
	width: auto;
	height: auto;
	padding: 0.5rem 1.25rem;
	background: #000000;
	color: #ffffff;
	font-size: 0.9rem;
	font-weight: 600;
	border-bottom: 2px solid rgba(255 255 255 / 0.4);
	outline: 2px solid #ffffff;
	outline-offset: -4px;
	z-index: 9999;
}

/* ── Container ──────────────────────────────────────────────────── */

.lib-container {
	/* Defaults — overridden by inline CSS from PHP */
	--lib-bg: linear-gradient(160deg, #1a1a2e 0%, #16213e 100%);
	--lib-btn-bg: #ffffff;
	--lib-btn-color: #1a1a1a;
	--lib-text-color: #ffffff;

	/* Layout */
	position: relative;
	min-height: 100vh;
	padding: 3rem 1.25rem 4rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	background: var(--lib-bg);
	color: var(--lib-text-color);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
		Ubuntu, Cantarell, sans-serif;
	box-sizing: border-box;
	isolation: isolate;
}

.lib-container *,
.lib-container *::before,
.lib-container *::after {
	box-sizing: inherit;
}

/* ── Radial light bloom ─────────────────────────────────────────── */

.lib-container::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(
		ellipse 80% 50% at 30% 0%,
		rgba(255 255 255 / 0.07) 0%,
		transparent 70%
	);
	pointer-events: none;
	z-index: -1;
}

/* ── Entrance animations ────────────────────────────────────────── */

@keyframes lib-fade-up {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes lib-ring-pulse {
	0%,
	100% {
		box-shadow:
			0 0 0 3px rgba(255 255 255 / 0.25),
			0 0 0 6px rgba(255 255 255 / 0.08),
			0 8px 32px rgba(0 0 0 / 0.35);
	}

	50% {
		box-shadow:
			0 0 0 3px rgba(255 255 255 / 0.40),
			0 0 0 9px rgba(255 255 255 / 0.10),
			0 8px 32px rgba(0 0 0 / 0.35);
	}
}

/* ── Profile ────────────────────────────────────────────────────── */

.lib-profile {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	width: 100%;
	max-width: 480px;
	margin-bottom: 2rem;
	animation: lib-fade-up 0.55s ease both;
}

.lib-avatar {
	margin-bottom: 1rem;
}

.lib-avatar img {
	display: block;
	width: 96px;
	height: 96px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow:
		0 0 0 3px rgba(255 255 255 / 0.25),
		0 0 0 6px rgba(255 255 255 / 0.08),
		0 8px 32px rgba(0 0 0 / 0.35);
	animation: lib-ring-pulse 3s ease-in-out infinite;
}

.lib-name {
	margin: 0 0 0.5rem;
	font-size: clamp(1.25rem, 4vw, 1.75rem);
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--lib-text-color);
	line-height: 1.2;
	text-shadow: 0 2px 16px rgba(0 0 0 / 0.4);
}

.lib-bio {
	margin: 0;
	font-size: 0.95rem;
	color: var(--lib-text-color);
	opacity: 0.88;
	line-height: 1.6;
	max-width: 38ch;
}

/* ── Links Nav ──────────────────────────────────────────────────── */

.lib-links {
	width: 100%;
	max-width: 480px;
	outline: none; /* receives programmatic focus via tabindex=-1 */
}

.lib-links-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lib-link-item {
	width: 100%;
	animation: lib-fade-up 0.55s ease both;
	animation-delay: calc(0.1s + var(--lib-item-index, 0) * 0.07s);
}

/* ── Link Button ────────────────────────────────────────────────── */

.lib-link-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	width: 100%;
	padding: 1rem 1.25rem;
	background: var(--lib-btn-bg);
	color: var(--lib-btn-color);
	border-radius: 1rem;
	text-decoration: none;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	border: none;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0 0 0 / 0.15);
	transition:
		opacity 0.2s ease,
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.lib-link-btn:hover {
	opacity: 0.92;
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0 0 0 / 0.25);
}

/* WCAG 2.2 — 2.4.7 Focus Visible */
.lib-link-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 3px var(--lib-btn-bg),
		0 0 0 6px rgba(255 255 255 / 0.5),
		0 2px 12px rgba(0 0 0 / 0.15);
}

.lib-link-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 12px rgba(0 0 0 / 0.15);
}

.lib-link-title {
	flex: 1;
	text-align: center;
}

.lib-link-arrow {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	opacity: 0.45;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.lib-link-btn:hover .lib-link-arrow {
	opacity: 0.7;
	transform: translate(2px, -2px);
}

/* ── Glassmorphism button variant ───────────────────────────────── */

.lib-btn-glass .lib-link-btn {
	background: color-mix(in srgb, var(--lib-btn-bg) 18%, transparent);
	backdrop-filter: blur(12px);
	border: 1px solid color-mix(in srgb, var(--lib-btn-bg) 35%, transparent);
	color: var(--lib-text-color);
	box-shadow:
		0 2px 12px rgba(0 0 0 / 0.15),
		inset 0 1px 0 rgba(255 255 255 / 0.1);
}

.lib-btn-glass .lib-link-btn:hover {
	background: color-mix(in srgb, var(--lib-btn-bg) 28%, transparent);
	box-shadow:
		0 8px 24px rgba(0 0 0 / 0.25),
		inset 0 1px 0 rgba(255 255 255 / 0.15);
}

.lib-btn-glass .lib-link-btn:focus-visible {
	box-shadow:
		0 0 0 3px rgba(255 255 255 / 0.5),
		0 0 0 6px rgba(255 255 255 / 0.2),
		0 2px 12px rgba(0 0 0 / 0.15);
}

/* ── Footer ─────────────────────────────────────────────────────── */

.lib-footer {
	margin-top: auto;
	padding-top: 2.5rem;
	text-align: center;
}

.lib-footer-text {
	margin: 0;
	font-size: 0.75rem;
	color: var(--lib-text-color);
	opacity: 0.4;
}

.lib-footer-legal {
	margin-bottom: 0.35rem;
}

.lib-footer-link {
	color: inherit;
	text-decoration: none;
}

.lib-footer-link:hover,
.lib-footer-link:focus-visible {
	text-decoration: underline;
	opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (min-width: 640px) {
	.lib-container {
		padding-block: 4rem 5rem;
	}

	.lib-avatar img {
		width: 120px;
		height: 120px;
	}
}

/* ── Motion preference ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.lib-profile,
	.lib-link-item {
		animation: none;
	}

	.lib-avatar img {
		animation: none;
	}

	.lib-link-btn,
	.lib-link-arrow {
		transition: opacity 0.2s ease;
	}

	.lib-link-btn:hover {
		transform: none;
	}

	.lib-link-btn:hover .lib-link-arrow {
		transform: none;
	}
}
