/* Agreement Gate – frontend modal (light theme).
   Colours are CSS variables; the plugin overrides them inline from the Appearance settings. */

.agreement-gate-overlay {
	--agreement-gate-accent: #aa3369;
	--agreement-gate-accent-rgb: 170, 51, 105;
	--agreement-gate-accent-dark: #8b2a56;
	--agreement-gate-title: #a12a3a;
	--agreement-gate-link: #aa3369;
	--agreement-gate-text: #1f2937;
	--agreement-gate-overlay-rgb: 46, 12, 28;
	--agreement-gate-overlay-alpha: 0.45;
	--agreement-gate-blur: 10px;
	--agreement-gate-muted: #6b7280;
	--agreement-gate-border: #e8e2e5;
	--agreement-gate-surface: #ffffff;
	--agreement-gate-surface-alt: #fcfafb;
}

html.agreement-gate-locked,
html.agreement-gate-locked body {
	overflow: hidden !important;
	height: 100%;
}

.agreement-gate-overlay[hidden] { display: none !important; }

.agreement-gate-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(var(--agreement-gate-overlay-rgb), var(--agreement-gate-overlay-alpha));
	-webkit-backdrop-filter: blur(var(--agreement-gate-blur)) saturate(110%);
	backdrop-filter: blur(var(--agreement-gate-blur)) saturate(110%);
	box-sizing: border-box;
	animation: agreement-gate-fade 0.25s ease-out;
}

.agreement-gate-modal {
	position: relative;
	width: 100%;
	max-width: 720px;
	max-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	background: var(--agreement-gate-surface);
	color: var(--agreement-gate-text);
	border-radius: 18px;
	box-shadow: 0 30px 80px rgba(var(--agreement-gate-overlay-rgb), 0.35), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
	padding: 32px 32px 26px;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	outline: none;
	overflow: hidden;
	animation: agreement-gate-rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* thin accent line across the top of the card */
.agreement-gate-modal::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	z-index: 3;
	background: linear-gradient(90deg, var(--agreement-gate-title), var(--agreement-gate-accent));
}

/* ---- header graphic ---- */
.agreement-gate-header { flex: 0 0 auto; }
.agreement-gate-header img { display: block; }

.agreement-gate-header-icon { margin: 0 0 14px; }
.agreement-gate-header-icon img {
	max-height: 64px;
	width: auto;
	max-width: 100%;
}

.agreement-gate-header-banner {
	margin: -32px -32px 22px;
}
.agreement-gate-header-banner img {
	width: 100%;
	height: 150px;
	object-fit: cover;
}

.agreement-gate-title {
	margin: 0 0 8px;
	font-size: 1.55rem;
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--agreement-gate-title);
}

.agreement-gate-hint {
	margin: 0 0 18px;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--agreement-gate-muted);
}

.agreement-gate-note {
	margin: -6px 0 18px;
	padding: 10px 14px;
	border-left: 3px solid var(--agreement-gate-accent);
	border-radius: 0 10px 10px 0;
	background: rgba(var(--agreement-gate-accent-rgb), 0.06);
	font-size: 0.92rem;
	line-height: 1.55;
	color: var(--agreement-gate-text);
}
.agreement-gate-note a {
	color: var(--agreement-gate-link);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.agreement-gate-align-center .agreement-gate-note {
	text-align: center;
	border-left: 0;
	border-radius: 10px;
	max-width: 560px;
	margin-left: auto;
	margin-right: auto;
}

/* ---- title alignment (setting) ---- */
.agreement-gate-align-center .agreement-gate-title,
.agreement-gate-align-center .agreement-gate-hint {
	text-align: center;
}
.agreement-gate-align-center .agreement-gate-header-icon img {
	margin-left: auto;
	margin-right: auto;
}
.agreement-gate-align-center .agreement-gate-hint {
	max-width: 560px;
	margin-left: auto;
	margin-right: auto;
}

/* ---- scrollable text area ---- */
.agreement-gate-content-wrap {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	border: 1px solid var(--agreement-gate-border);
	border-radius: 12px;
	background: var(--agreement-gate-surface-alt);
	overflow: hidden;
}

/* optional background image (url + opacity injected inline by PHP) */
.agreement-gate-content-wrap::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	opacity: 0;
	pointer-events: none;
}

.agreement-gate-content {
	position: relative;
	z-index: 1;
	flex: 1 1 auto;
	min-height: 180px;
	max-height: 46vh;
	overflow-y: auto;
	padding: 18px 22px;
	background: transparent;
	font-size: 0.95rem;
	line-height: 1.7;
	color: var(--agreement-gate-text);
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--agreement-gate-accent) transparent;
}

.agreement-gate-content::-webkit-scrollbar { width: 8px; }
.agreement-gate-content::-webkit-scrollbar-track { background: transparent; }
.agreement-gate-content::-webkit-scrollbar-thumb {
	background: var(--agreement-gate-accent);
	border-radius: 8px;
	border: 2px solid transparent;
	background-clip: padding-box;
}

.agreement-gate-content > *:first-child { margin-top: 0; }
.agreement-gate-content > *:last-child  { margin-bottom: 0; }

.agreement-gate-content h1,
.agreement-gate-content h2,
.agreement-gate-content h3,
.agreement-gate-content h4 {
	color: var(--agreement-gate-title);
	line-height: 1.3;
	margin: 1.4em 0 0.5em;
	font-weight: 700;
}
.agreement-gate-content h1 { font-size: 1.25rem; }
.agreement-gate-content h2 { font-size: 1.15rem; }
.agreement-gate-content h3 { font-size: 1.05rem; }
.agreement-gate-content h4 { font-size: 1rem; }

.agreement-gate-content p,
.agreement-gate-content ul,
.agreement-gate-content ol { margin: 0 0 1em; }
.agreement-gate-content ul,
.agreement-gate-content ol { padding-left: 1.4em; }
.agreement-gate-content li { margin-bottom: 0.35em; }
.agreement-gate-content a {
	color: var(--agreement-gate-link);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.agreement-gate-end { height: 1px; }

/* soft fade at the bottom while there is more to read */
.agreement-gate-content-wrap::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 56px;
	z-index: 2;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
	pointer-events: none;
	transition: opacity 0.3s ease;
}
.agreement-gate-content-wrap.is-done::after { opacity: 0; }

/* ---- progress pill ---- */
.agreement-gate-scroll-indicator {
	display: flex;
	justify-content: center;
	margin-top: 12px;
	min-height: 1.6em;
	font-size: 0.85rem;
}
.agreement-gate-scroll-indicator span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 14px;
	border-radius: 999px;
	background: rgba(var(--agreement-gate-accent-rgb), 0.1);
	color: var(--agreement-gate-accent);
	font-weight: 500;
	transition: background 0.2s ease, color 0.2s ease;
}
.agreement-gate-scroll-indicator.is-done span {
	background: #e8f5ec;
	color: #1f7a3f;
}

/* ---- checkbox row ---- */
.agreement-gate-check {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 18px 0 0;
	padding: 14px 16px;
	border: 1px solid var(--agreement-gate-border);
	border-radius: 12px;
	background: var(--agreement-gate-surface);
	color: var(--agreement-gate-text);
	font-size: 0.95rem;
	line-height: 1.5;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.agreement-gate-check:hover:not(.is-disabled) {
	border-color: var(--agreement-gate-accent);
	background: rgba(var(--agreement-gate-accent-rgb), 0.06);
}
.agreement-gate-check.is-disabled {
	cursor: not-allowed;
	opacity: 0.55;
}
.agreement-gate-check input {
	margin: 3px 0 0;
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	cursor: pointer;
	accent-color: var(--agreement-gate-accent);
}
.agreement-gate-check input:disabled { cursor: not-allowed; }
.agreement-gate-check input:focus-visible {
	outline: 3px solid rgba(var(--agreement-gate-accent-rgb), 0.32);
	outline-offset: 2px;
	border-radius: 4px;
}
.agreement-gate-check a {
	color: var(--agreement-gate-link);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---- buttons ---- */
.agreement-gate-actions {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 12px;
	margin-top: 22px;
}

.agreement-gate-btn {
	appearance: none;
	border: 0;
	border-radius: 999px;
	padding: 12px 26px;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.agreement-gate-btn:focus-visible {
	outline: 3px solid rgba(var(--agreement-gate-accent-rgb), 0.32);
	outline-offset: 2px;
}
.agreement-gate-btn:active:not(:disabled) { transform: translateY(1px); }

.agreement-gate-btn-decline {
	background: transparent;
	color: var(--agreement-gate-muted);
	border: 1px solid var(--agreement-gate-border);
}
.agreement-gate-btn-decline:hover {
	color: var(--agreement-gate-text);
	background: #f6f4f5;
}

.agreement-gate-btn-accept {
	background: var(--agreement-gate-accent);
	color: #fff;
	box-shadow: 0 6px 18px rgba(var(--agreement-gate-accent-rgb), 0.3);
}
.agreement-gate-btn-accept:hover:not(:disabled) {
	background: var(--agreement-gate-accent-dark);
	box-shadow: 0 8px 22px rgba(var(--agreement-gate-accent-rgb), 0.38);
}
.agreement-gate-btn-accept:disabled {
	background: rgba(var(--agreement-gate-accent-rgb), 0.16);
	color: rgba(var(--agreement-gate-accent-rgb), 0.55);
	box-shadow: none;
	cursor: not-allowed;
}

@keyframes agreement-gate-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes agreement-gate-rise {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
	.agreement-gate-overlay { padding: 10px; }
	.agreement-gate-modal {
		padding: 24px 18px 18px;
		border-radius: 14px;
		max-height: calc(100vh - 20px);
	}
	.agreement-gate-header-banner { margin: -24px -18px 18px; }
	.agreement-gate-header-banner img { height: 110px; }
	.agreement-gate-header-icon img { max-height: 48px; }
	.agreement-gate-title { font-size: 1.3rem; }
	.agreement-gate-content { max-height: 40vh; padding: 14px 16px; }
	.agreement-gate-actions { flex-direction: column-reverse; }
	.agreement-gate-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.agreement-gate-overlay,
	.agreement-gate-modal { animation: none; }
	.agreement-gate-btn,
	.agreement-gate-check,
	.agreement-gate-content-wrap::after { transition: none; }
}
