/*
 * PlayForge Hreflang & Language Switch
 *
 * Lightbox look follows the sm33 Apple-Store lightbox (see style33.css):
 * blurred dimmed overlay, rounded white panel with scale-in animation.
 * All classes are pfhfl- prefixed.
 */

/* ---------- Globe trigger ---------- */

#lang-switch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	text-decoration: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

#lang-switch .bi-globe2 {
	font-size: 20px;
	line-height: 1;
}

/* ---------- Lightbox overlay ---------- */

.pfhfl-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 48px 24px;
	background: rgba(0, 0, 0, 0.55);
	-webkit-backdrop-filter: saturate(180%) blur(6px);
	backdrop-filter: saturate(180%) blur(6px);
	opacity: 0;
	transition: opacity 0.32s ease;
}

.pfhfl-overlay[hidden] {
	display: none;
}

.pfhfl-overlay.pfhfl-open {
	opacity: 1;
}

/* ---------- Panel ---------- */

.pfhfl-panel {
	position: relative;
	width: min(680px, 100%);
	/* Vertically centers the panel when it is shorter than the viewport */
	margin: auto 0;
	background: #ffffff;
	border-radius: 18px;
	padding: clamp(24px, 5vw, 44px);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	transform: scale(0.96) translateY(10px);
	transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pfhfl-overlay.pfhfl-open .pfhfl-panel {
	transform: scale(1) translateY(0);
}

.pfhfl-title {
	font-size: 22px;
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: #1d1d1f;
	margin: 0 48px 20px 0;
}

/* ---------- Close button ---------- */

.pfhfl-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #f5f5f7;
	color: #424245;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.pfhfl-close:hover {
	background: #e8e8ed;
	color: #1d1d1f;
}

.pfhfl-close svg {
	width: 18px;
	height: 18px;
}

/* ---------- Language grid: 4 columns on PC ---------- */

.pfhfl-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pfhfl-item-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 64px;
	padding: 10px 8px;
	border: 1px solid #e8e8ed;
	border-radius: 12px;
	background: #fff;
	color: #1d1d1f;
	text-align: center;
	text-decoration: none;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.pfhfl-item-link:hover,
.pfhfl-item-link:focus-visible {
	background: #f5f5f7;
	border-color: #d2d2d7;
}

.pfhfl-item-link .pfhfl-lang-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
}

.pfhfl-item-link .pfhfl-lang-native {
	font-size: 11px;
	line-height: 1.2;
	color: #6e6e73;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

/* The current language gets a subtle filled-in state */
.pfhfl-item-link.pfhfl-current {
	background: #cce7ff;
	border-color: #b3d8ff;
}

.pfhfl-item-link.pfhfl-current .pfhfl-lang-native {
	color: #1d4e7a;
}

/* ---------- Tablet: 3 columns ---------- */

@media (max-width: 1023.98px) {
	.pfhfl-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ---------- Mobile: 2 columns ---------- */

@media (max-width: 767.98px) {
	.pfhfl-overlay {
		padding: 12px;
	}

	.pfhfl-panel {
		padding: 22px 16px;
	}

	.pfhfl-title {
		font-size: 19px;
		margin-inline-end: 40px;
	}

	.pfhfl-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.pfhfl-overlay,
	.pfhfl-panel {
		transition: none;
	}

	.pfhfl-panel {
		transform: none;
	}
}
