/**
 * Researcher access gate.
 *
 * html.pl-gate-on is set in <head> before the page paints (inc/gate.php), so
 * the blurred backdrop is there from the first frame; gate.js then adds the
 * dialog on top and removes both once the visitor confirms.
 *
 * @package Peplogy
 */

/* 1. Backdrop -------------------------------------------------------------- */
html.pl-gate-on,
html.pl-gate-on body {
	overflow: hidden;
}

html.pl-gate-on body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(11, 26, 51, 0.55);
	-webkit-backdrop-filter: blur(14px) saturate(1.1);
	backdrop-filter: blur(14px) saturate(1.1);
}

/* 2. Dialog ---------------------------------------------------------------- */
.pl-gate {
	--pl-gate-card: rgba(11, 26, 51, 0.66);
	--pl-gate-line: rgba(255, 255, 255, 0.18);
	--pl-gate-soft: #d8e2f0;
	--pl-gate-error: #ffb3b3;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	color: var(--pl-white);
	font-family: var(--pl-sans);
	animation: pl-gate-in 0.35s ease-out both;
}

@keyframes pl-gate-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.99);
	}
}

.pl-gate *,
.pl-gate *::before,
.pl-gate *::after {
	box-sizing: border-box;
}

.pl-gate__panel {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	width: min(720px, 100%);
	max-height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 20px;
	background: var(--pl-deep-navy);
	box-shadow: 0 30px 80px rgba(3, 10, 25, 0.55);
	outline: none;
	scrollbar-width: none; /* Sized to fit (section 7); a very short window can still scroll, without a bar. */
}

.pl-gate__panel::-webkit-scrollbar {
	display: none;
}

/* Photo with a light top (for the logo) fading into navy. */
.pl-gate__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	background-color: var(--pl-deep-navy);
	background-image:
		linear-gradient(180deg, rgba(238, 245, 252, 0.97) 0%, rgba(238, 245, 252, 0.9) 16%, rgba(227, 240, 253, 0.72) 27%, rgba(11, 42, 91, 0.45) 42%, rgba(11, 26, 51, 0.88) 70%, #0b1a33 100%),
		var(--pl-gate-img, radial-gradient(120% 70% at 80% 40%, #1668c7 0%, #0b2a5b 55%, #0b1a33 100%));
	background-position: center, 100% 38%;
	background-size: cover, cover;
	background-repeat: no-repeat;
}

.pl-gate__molecule {
	position: absolute;
	z-index: -1;
	width: 170px;
	color: var(--pl-sky);
	opacity: 0.45;
	pointer-events: none;
}

.pl-gate__molecule--l {
	top: 120px;
	left: -30px;
	opacity: 0.35;
}

.pl-gate__molecule--r {
	top: 150px;
	right: -30px;
	opacity: 0.3;
}

.pl-gate__corner {
	position: absolute;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--pl-navy);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0.24em;
	text-transform: uppercase;
}

.pl-gate__corner::after {
	content: "";
	display: block;
	width: 44px;
	height: 2px;
	margin-top: 8px;
	background: var(--pl-blue);
}

.pl-gate__corner--r {
	top: 30px;
	right: 30px;
}

.pl-gate__corner--l {
	top: 30px;
	left: 30px;
}

/* 3. Brand ----------------------------------------------------------------- */
.pl-gate__brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 24px 24px 16px;
	text-align: center;
}

.pl-gate__logo {
	display: block;
	width: auto;
	max-width: min(300px, 62%);
	height: 68px;
	object-fit: contain;
}

.pl-gate__wordmark {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--pl-navy);
	font-family: var(--pl-serif);
	font-size: 34px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.pl-gate__rule {
	position: relative;
	display: block;
	width: 120px;
	height: 8px;
	margin: 10px auto 8px;
}

.pl-gate__rule::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 1.5px;
	background: linear-gradient(90deg, var(--pl-blue) 0 42%, transparent 42% 58%, var(--pl-blue) 58%);
	transform: translateY(-50%);
}

.pl-gate__rule i {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pl-sky);
	transform: translate(-50%, -50%);
}

.pl-gate__rule--small {
	width: 72px;
	margin: 8px auto 12px;
}

.pl-gate__rule--small::before {
	background: linear-gradient(90deg, var(--pl-sky) 0 38%, transparent 38% 62%, var(--pl-sky) 62%);
}

.pl-gate__motto {
	margin: 0;
	color: var(--pl-navy);
	font-size: 11px;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0.24em;
	text-transform: uppercase;
}

/* 4. Card ------------------------------------------------------------------ */
.pl-gate__card {
	width: min(500px, calc(100% - 32px));
	margin: 0 auto;
	padding: 20px 22px 16px;
	border: 1px solid var(--pl-gate-line);
	border-radius: 14px;
	background: var(--pl-gate-card);
	-webkit-backdrop-filter: blur(12px) saturate(1.2);
	backdrop-filter: blur(12px) saturate(1.2);
	box-shadow: 0 18px 50px rgba(3, 10, 25, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pl-gate__title {
	margin: 0;
	color: var(--pl-white);
	font-family: var(--pl-serif);
	font-size: 31px;
	font-weight: 600;
	line-height: 1.15;
	text-align: center;
}

.pl-gate__text {
	margin: 0 0 14px;
	color: var(--pl-gate-soft);
	font-size: 14px;
	line-height: 1.55;
	text-align: center;
}

.pl-gate__text strong {
	color: var(--pl-white);
	font-weight: 700;
}

.pl-gate__text a {
	color: var(--pl-white);
}

/* Offer */
.pl-gate__offer {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 14px;
	padding: 10px 16px;
	border: 1.5px solid var(--pl-sky);
	border-radius: 10px;
	background: linear-gradient(90deg, rgba(22, 104, 199, 0.42), rgba(11, 42, 91, 0.3));
	box-shadow: 0 0 0 4px rgba(77, 163, 245, 0.12), 0 10px 26px rgba(22, 104, 199, 0.25);
}

.pl-gate__offer > .icon {
	flex: none;
	color: var(--pl-sky);
}

.pl-gate__offer-title {
	margin: 0;
	color: var(--pl-white);
	font-size: 17px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.pl-gate__offer-title em {
	color: var(--pl-sky);
	font-style: normal;
}

.pl-gate__offer-text {
	margin: 4px 0 0;
	color: var(--pl-on-dark);
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/* 5. Form ------------------------------------------------------------------ */
.pl-gate__form {
	margin: 0;
}

.pl-gate__field {
	margin: 0 0 12px;
}

.pl-gate__field > label {
	display: block;
	margin: 0 0 6px;
	color: var(--pl-white);
	font-size: 13px;
	font-weight: 700;
}

.pl-gate__control {
	position: relative;
	display: block;
}

.pl-gate__control > .icon {
	position: absolute;
	top: 50%;
	left: 13px;
	color: var(--pl-on-dark);
	transform: translateY(-50%);
	pointer-events: none;
}

.pl-gate__control > .icon--chevron {
	right: 13px;
	left: auto;
	color: var(--pl-white);
}

.pl-gate .pl-gate__input {
	display: block;
	width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 14px 0 42px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.07);
	box-shadow: none;
	color: var(--pl-white);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.pl-gate select.pl-gate__input {
	padding-right: 40px;
	cursor: pointer;
}

.pl-gate select.pl-gate__input option {
	background: var(--pl-white);
	color: var(--pl-ink);
}

.pl-gate .pl-gate__input::placeholder {
	color: rgba(216, 226, 240, 0.6);
	opacity: 1;
}

.pl-gate .pl-gate__input:hover {
	border-color: rgba(255, 255, 255, 0.6);
}

.pl-gate .pl-gate__input:focus {
	border-color: var(--pl-sky);
	background: rgba(255, 255, 255, 0.1);
	box-shadow: 0 0 0 3px rgba(77, 163, 245, 0.35);
	outline: none;
}

.pl-gate .pl-gate__input[aria-invalid="true"] {
	border-color: var(--pl-gate-error);
}

.pl-gate__check {
	position: relative;
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 10px 0 0;
	color: var(--pl-gate-soft);
	font-size: 13px;
	line-height: 1.45;
	cursor: pointer;
}

.pl-gate__check input {
	position: absolute;
	width: 18px;
	height: 18px;
	margin: 0;
	opacity: 0;
}

.pl-gate__box {
	display: grid;
	flex: none;
	place-items: center;
	width: 19px;
	height: 19px;
	margin-top: 1px;
	border: 1.5px solid rgba(255, 255, 255, 0.75);
	border-radius: 4px;
	color: transparent;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pl-gate__check input:checked + .pl-gate__box {
	border-color: var(--pl-sky);
	background: var(--pl-blue);
	color: var(--pl-white);
}

.pl-gate__check input:focus-visible + .pl-gate__box {
	box-shadow: 0 0 0 3px rgba(77, 163, 245, 0.45);
}

.pl-gate__check input[aria-invalid="true"] + .pl-gate__box {
	border-color: var(--pl-gate-error);
}

.pl-gate__check a {
	color: var(--pl-white);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.pl-gate__error {
	margin: 5px 0 0;
	color: var(--pl-gate-error);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.4;
}

.pl-gate__check + .pl-gate__error {
	margin-left: 29px;
}

.pl-gate__error--form {
	margin: 14px 0 0;
	padding: 8px 12px;
	border: 1px solid rgba(255, 179, 179, 0.45);
	border-radius: 8px;
	background: rgba(255, 120, 120, 0.1);
}

.pl-gate__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.pl-gate__submit {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	margin: 16px 0 0;
	padding: 12px 18px;
	border: 1px solid rgba(77, 163, 245, 0.85);
	border-radius: 8px;
	background: linear-gradient(180deg, #2b8af0 0%, var(--pl-blue) 52%, #0f4f9c 100%);
	box-shadow: 0 10px 24px rgba(22, 104, 199, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
	color: var(--pl-white);
	font-family: inherit;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pl-gate__submit:hover {
	filter: brightness(1.08);
	box-shadow: 0 14px 30px rgba(22, 104, 199, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.pl-gate__submit:active {
	transform: translateY(1px);
}

.pl-gate__submit:focus-visible {
	outline: 3px solid var(--pl-sky);
	outline-offset: 3px;
}

.pl-gate__submit[disabled] {
	cursor: progress;
	filter: saturate(0.6) brightness(0.9);
}

.pl-gate__submit .icon {
	transition: transform 0.15s ease;
}

.pl-gate__submit:hover .icon {
	transform: translateX(3px);
}

.pl-gate__links {
	margin: 12px 0 0;
	color: var(--pl-gate-soft);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
}

.pl-gate__links a {
	color: var(--pl-white);
	font-weight: 700;
	text-decoration: none;
}

.pl-gate__links a:hover,
.pl-gate__links a:focus-visible {
	text-decoration: underline;
}

/* Done */
.pl-gate__done {
	text-align: center;
}

.pl-gate__done-icon {
	display: inline-grid;
	place-items: center;
	width: 56px;
	height: 56px;
	margin: 2px 0 12px;
	border: 1.5px solid var(--pl-sky);
	border-radius: 50%;
	background: rgba(22, 104, 199, 0.35);
	color: var(--pl-white);
}

.pl-gate__done-title {
	margin: 0 0 8px;
	color: var(--pl-white);
	font-size: 17px;
	font-weight: 800;
}

.pl-gate__done .pl-gate__text {
	margin: 0;
}

/* 6. Badges ---------------------------------------------------------------- */
.pl-gate__features {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
	grid-auto-flow: column;
	margin: 18px 0 0;
	padding: 0 12px 18px;
	list-style: none;
}

.pl-gate__features li {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	padding: 4px 8px;
	color: var(--pl-white);
	font-size: 10.5px;
	font-weight: 800;
	line-height: 1.35;
	letter-spacing: 0.16em;
	text-align: center;
	text-transform: uppercase;
}

.pl-gate__features li + li {
	border-left: 1px solid rgba(77, 163, 245, 0.55);
}

.pl-gate__features .icon {
	color: var(--pl-white);
}

/* 7. Small screens --------------------------------------------------------- */
@media (max-width: 640px) {
	.pl-gate {
		padding: 0;
	}

	.pl-gate__panel {
		width: 100%;
		height: 100%;
		border: 0;
		border-radius: 0;
	}

	.pl-gate__corner,
	.pl-gate__molecule--r {
		display: none;
	}

	.pl-gate__molecule--l {
		width: 120px;
		opacity: 0.3;
	}

	.pl-gate__brand {
		padding: 22px 16px 16px;
	}

	.pl-gate__logo {
		height: 58px;
	}

	.pl-gate__motto {
		font-size: 10px;
		letter-spacing: 0.18em;
	}

	.pl-gate__card {
		width: calc(100% - 24px);
		padding: 20px 16px 16px;
	}

	.pl-gate__title {
		font-size: 27px;
	}

	.pl-gate__text {
		font-size: 13.5px;
	}

	.pl-gate__offer {
		gap: 12px;
		padding: 11px 12px;
	}

	.pl-gate__offer-title {
		font-size: 15px;
	}

	.pl-gate__offer-text {
		font-size: 9.5px;
		letter-spacing: 0.08em;
	}

	.pl-gate__submit {
		font-size: 13px;
		letter-spacing: 0.18em;
	}

	.pl-gate__features {
		margin-top: 18px;
		padding: 0 4px 18px;
	}

	.pl-gate__features li {
		gap: 6px;
		padding: 2px 4px;
		font-size: 9px;
		letter-spacing: 0.1em;
	}

	.pl-gate__features .icon {
		width: 22px;
		height: 22px;
	}
}

@media (min-width: 641px) and (max-height: 920px) {
	.pl-gate__brand {
		padding-top: 16px;
		padding-bottom: 10px;
	}

	.pl-gate__logo {
		height: 56px;
	}

	.pl-gate__card {
		padding-top: 16px;
	}

	.pl-gate__title {
		font-size: 28px;
	}

	.pl-gate__text {
		font-size: 13.5px;
	}

	.pl-gate__features {
		margin-top: 14px;
		padding-bottom: 14px;
	}
}

/* Laptop-height windows: tighter spacing so the whole gate fits without scrolling. */
@media (min-width: 641px) and (max-height: 800px) {
	.pl-gate {
		padding: 12px;
	}

	.pl-gate__brand {
		padding: 12px 24px 8px;
	}

	.pl-gate__logo {
		height: 46px;
	}

	.pl-gate__rule {
		margin: 6px auto 6px;
	}

	.pl-gate__motto {
		font-size: 10px;
	}

	.pl-gate__corner {
		top: 18px;
		font-size: 9px;
	}

	.pl-gate__card {
		padding: 14px 20px 12px;
	}

	.pl-gate__title {
		font-size: 25px;
	}

	.pl-gate__rule--small {
		margin: 6px auto 8px;
	}

	.pl-gate__text {
		margin-bottom: 10px;
		font-size: 13px;
		line-height: 1.45;
	}

	.pl-gate__offer {
		margin-bottom: 10px;
		padding: 8px 14px;
	}

	.pl-gate__offer > .icon {
		width: 26px;
		height: 26px;
	}

	.pl-gate__offer-title {
		font-size: 15px;
	}

	.pl-gate__offer-text {
		margin-top: 2px;
		font-size: 9.5px;
	}

	.pl-gate__field {
		margin-bottom: 8px;
	}

	.pl-gate__field > label {
		margin-bottom: 4px;
		font-size: 12.5px;
	}

	.pl-gate .pl-gate__input {
		height: 40px;
		font-size: 14px;
	}

	.pl-gate__check {
		margin-top: 8px;
		font-size: 12.5px;
		line-height: 1.4;
	}

	.pl-gate__submit {
		min-height: 42px;
		margin-top: 12px;
		padding: 9px 18px;
		font-size: 13px;
	}

	.pl-gate__links {
		margin-top: 8px;
		font-size: 12.5px;
	}

	.pl-gate__features {
		margin-top: 10px;
		padding-bottom: 10px;
	}

	.pl-gate__features li {
		gap: 5px;
		font-size: 9.5px;
	}

	.pl-gate__features .icon {
		width: 20px;
		height: 20px;
	}
}

@media (min-width: 641px) and (max-height: 720px) {
	.pl-gate {
		padding: 8px;
	}

	.pl-gate__logo {
		height: 40px;
	}

	.pl-gate__card {
		padding-top: 12px;
	}
}

/* Very short windows: drop the extras first. */
@media (min-width: 641px) and (max-height: 680px) {
	.pl-gate__motto,
	.pl-gate__brand .pl-gate__rule,
	.pl-gate__features {
		display: none;
	}

	.pl-gate__card {
		margin-bottom: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pl-gate,
	.pl-gate * {
		animation: none !important;
		transition: none !important;
	}
}
