/**
 * Age confirmation gate -- purely CSS driven visibility.
 *
 * Hidden by default with display:none. `.kuki-gate-on` is added by the
 * synchronous script in <head> only when the visitor has not confirmed yet.
 * With JavaScript disabled it is absent, so nothing is displayed. Visibility
 * therefore never depends on when the script runs (no flash, fail-open).
 */

/*
 * The overlay does not use the opacity property.
 * opacity cascades onto children, which would make the card translucent too.
 * The transparency lives in the background rgba() instead, and the card stays
 * fully opaque (#fff).
 */
.kuki-age-gate {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 24px;
	background: rgba(var(--kagi-overlay-rgb, 26, 26, 36), var(--kagi-overlay-alpha, 0.65));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	font-family: var(--kagi-font, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif);
}

.kuki-gate-on .kuki-age-gate {
	display: flex;
	animation: kuki-age-gate-fade 0.18s ease-out;
}

/* The end state is opacity:1. The card stays opaque at every moment. */
@keyframes kuki-age-gate-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* White card. The text colour defaults to #1a1a1a. */
.kuki-age-gate__box {
	box-sizing: border-box;
	width: 100%;
	max-width: 640px;
	padding: 40px 36px;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
	text-align: center;
	line-height: 1.9;
	color: #1a1a1a;
}

/* Image above the card. The height is fixed and the width follows the ratio. */
.kuki-age-gate__image {
	margin: 0 0 24px;
}

/*
 * The height is fixed at 80px and width:auto lets the original ratio decide
 * the width. width:100% would stretch the image to the card width and break
 * the ratio. max-width:100% keeps a wide image from overflowing the card.
 * The image is display:block, so it is centred with margins.
 */
.kuki-age-gate__image img {
	display: block;
	height: 80px;
	width: auto;
	max-width: 100%;
	margin: 0 auto;
}

.kuki-age-gate__heading {
	margin: 0 0 20px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.04em;
	color: #1a1a1a;
}

.kuki-age-gate__body {
	margin: 0;
	font-size: 15px;
	color: #444;
}

.kuki-age-gate__body p {
	margin: 0 0 12px;
}

.kuki-age-gate__body p:last-child {
	margin-bottom: 0;
}

.kuki-age-gate__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin-top: 28px;
}

.kuki-age-gate__btn {
	flex: 1 1 240px;
	max-width: 300px;
	padding: 14px 20px;
	border: 1px solid transparent;
	border-radius: 3px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.kuki-age-gate__btn:focus-visible {
	outline: 2px solid #1a1a1a;
	outline-offset: 3px;
}

/*
 * The foreground colour is computed in PHP from the luminance of the accent
 * colour (--kagi-on-accent). White text on #8da8ff only reaches a contrast
 * ratio of 2.3:1, which fails WCAG AA (4.5:1), so it is computed on the PHP
 * side to stay legible for any colour chosen in the settings screen.
 */
.kuki-age-gate__btn--yes {
	background: var(--kagi-accent, #8da8ff);
	border-color: var(--kagi-accent, #8da8ff);
	color: var(--kagi-on-accent, #1a1a1a);
}

.kuki-age-gate__btn--yes:hover {
	opacity: 0.88;
}

.kuki-age-gate__btn--no {
	background: #fff;
	border-color: #d0d0d8;
	color: #55555f;
}

.kuki-age-gate__btn--no:hover {
	background: #f4f4f7;
	border-color: #b8b8c4;
	color: #1a1a1a;
}

/* Message shown after the visitor declines. */
.kuki-age-gate__deny {
	margin: 24px 0 0;
	padding: 16px;
	border-radius: 3px;
	background: #f4f4f7;
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
}

.kuki-age-gate__deny[hidden] {
	display: none;
}

@media (max-width: 600px) {
	.kuki-age-gate {
		padding: 16px;
	}

	.kuki-age-gate__box {
		padding: 28px 20px;
	}

	.kuki-age-gate__heading {
		font-size: 19px;
	}

	.kuki-age-gate__btn {
		flex-basis: 100%;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kuki-gate-on .kuki-age-gate {
		animation: none;
	}

	.kuki-age-gate__btn {
		transition: none;
	}
}
