/**
 * ACGI Member Access - members-only dialog.
 *
 * ---------------------------------------------------------------------------
 * BRANDING
 * ---------------------------------------------------------------------------
 * Every visual decision below is a custom property declared on .acgi-ma-modal.
 * To brand this for a client you should never need to touch this file - paste
 * overrides into Settings > Member Access > Custom CSS:
 *
 *     .acgi-ma-modal {
 *       --acgi-ma-accent: #7a2048;
 *       --acgi-ma-radius: 2px;
 *       --acgi-ma-font: "Public Sans", sans-serif;
 *     }
 *
 * That CSS is printed after this file, so plain specificity wins - no !important
 * required. The full token list is documented in the README.
 * ---------------------------------------------------------------------------
 */

.acgi-ma-modal {
	/* Surface */
	--acgi-ma-backdrop: rgba(30, 30, 30, 0.7);
	--acgi-ma-surface: #fff;
	--acgi-ma-width: 30rem;
	--acgi-ma-radius: 8px;
	--acgi-ma-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);

	/* Typography */
	--acgi-ma-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	--acgi-ma-title-size: 1.25rem;
	--acgi-ma-title-weight: 600;
	--acgi-ma-title-color: #1e1e1e;
	--acgi-ma-text-size: 0.9375rem;
	--acgi-ma-text-color: #50575e;
	--acgi-ma-text-leading: 1.6;

	/* Accent - the one value most client brands need to change */
	--acgi-ma-accent: #3858e9;
	--acgi-ma-accent-hover: #2340d4;
	--acgi-ma-accent-contrast: #fff;

	/* Controls */
	--acgi-ma-btn-radius: 4px;
	--acgi-ma-btn-padding: 0.625rem 1.125rem;
	--acgi-ma-btn-size: 0.875rem;
	--acgi-ma-btn-weight: 600;
	--acgi-ma-btn-border: #c3c4c7;
	--acgi-ma-btn-ghost-color: #1e1e1e;
	--acgi-ma-btn-ghost-hover-bg: #f6f7f7;

	/* Close control */
	--acgi-ma-close-color: #757575;
	--acgi-ma-close-hover-color: #1e1e1e;
	--acgi-ma-close-hover-bg: #f0f0f0;

	/* Spacing */
	--acgi-ma-pad: 1.75rem;
	--acgi-ma-gap: 0.75rem;

	/* Focus */
	--acgi-ma-focus: var(--acgi-ma-accent);

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	font-family: var(--acgi-ma-font);
	-webkit-font-smoothing: antialiased;
}

.acgi-ma-modal[hidden] {
	display: none;
}

/* ---------- backdrop ---------- */

.acgi-ma-modal__backdrop {
	position: absolute;
	inset: 0;
	background: var(--acgi-ma-backdrop);
	animation: acgi-ma-fade 160ms ease-out;
}

@supports (backdrop-filter: blur(2px)) {
	.acgi-ma-modal__backdrop {
		backdrop-filter: blur(2px);
	}
}

/* ---------- panel ---------- */

.acgi-ma-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var(--acgi-ma-width);
	max-height: calc(100vh - 2.5rem);
	overflow-y: auto;
	background: var(--acgi-ma-surface);
	border-radius: var(--acgi-ma-radius);
	box-shadow: var(--acgi-ma-shadow);
	padding: var(--acgi-ma-pad);
	animation: acgi-ma-rise 200ms cubic-bezier(0.2, 0, 0.13, 1);
}

/* ---------- header ---------- */

.acgi-ma-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--acgi-ma-gap);
	margin-bottom: 0.5rem;
}

.acgi-ma-modal__title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: var(--acgi-ma-title-size);
	font-weight: var(--acgi-ma-title-weight);
	line-height: 1.3;
	color: var(--acgi-ma-title-color);
	text-wrap: balance;
}

.acgi-ma-modal__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	margin: -0.25rem -0.4rem 0 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--acgi-ma-btn-radius);
	color: var(--acgi-ma-close-color);
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease;
}

.acgi-ma-modal__close:hover {
	background: var(--acgi-ma-close-hover-bg);
	color: var(--acgi-ma-close-hover-color);
}

.acgi-ma-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.acgi-ma-modal__close svg {
	display: block;
	width: 1.125rem;
	height: 1.125rem;
	fill: currentColor;
}

/* ---------- body ---------- */

.acgi-ma-modal__body {
	font-size: var(--acgi-ma-text-size);
	line-height: var(--acgi-ma-text-leading);
	color: var(--acgi-ma-text-color);
}

.acgi-ma-modal__body > :first-child {
	margin-top: 0;
}

.acgi-ma-modal__body > :last-child {
	margin-bottom: 0;
}

.acgi-ma-modal__body p {
	margin: 0 0 0.75rem;
}

.acgi-ma-modal__body a {
	color: var(--acgi-ma-accent);
	text-underline-offset: 2px;
}

/* ---------- actions ---------- */

.acgi-ma-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--acgi-ma-gap);
	margin-top: 1.5rem;
}

.acgi-ma-modal__actions:empty {
	display: none;
}

.acgi-ma-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--acgi-ma-btn-padding);
	border-radius: var(--acgi-ma-btn-radius);
	font-family: inherit;
	font-size: var(--acgi-ma-btn-size);
	font-weight: var(--acgi-ma-btn-weight);
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.acgi-ma-btn--primary,
.acgi-ma-btn--primary:hover,
.acgi-ma-btn--primary:focus {
	color: var(--acgi-ma-accent-contrast);
	text-decoration: none;
}

.acgi-ma-btn--primary {
	background: var(--acgi-ma-accent);
	border: 1px solid var(--acgi-ma-accent);
}

.acgi-ma-btn--primary:hover {
	background: var(--acgi-ma-accent-hover);
	border-color: var(--acgi-ma-accent-hover);
}

.acgi-ma-btn--ghost,
.acgi-ma-btn--ghost:hover,
.acgi-ma-btn--ghost:focus {
	color: var(--acgi-ma-btn-ghost-color);
	text-decoration: none;
}

.acgi-ma-btn--ghost {
	background: transparent;
	border: 1px solid var(--acgi-ma-btn-border);
}

.acgi-ma-btn--ghost:hover {
	background: var(--acgi-ma-btn-ghost-hover-bg);
}

/* ---------- focus ---------- */

.acgi-ma-modal :focus-visible {
	outline: 2px solid var(--acgi-ma-focus);
	outline-offset: 2px;
}

/* The panel is focused programmatically on open so screen readers land inside
   the dialog. It is not a control, so it must not show a ring. Declared after
   the rule above so it wins without !important. */
.acgi-ma-modal__panel:focus,
.acgi-ma-modal__panel:focus-visible {
	outline: none;
}

/* ---------- page state ---------- */

body.acgi-ma-open {
	overflow: hidden;
}

/* ---------- inline notice (shown in place of restricted content) ---------- */

.acgi-ma-notice {
	--acgi-ma-accent: #3858e9;
	--acgi-ma-accent-hover: #2340d4;
	--acgi-ma-accent-contrast: #fff;
	--acgi-ma-btn-radius: 4px;
	--acgi-ma-btn-padding: 0.625rem 1.125rem;
	--acgi-ma-btn-size: 0.875rem;
	--acgi-ma-btn-weight: 600;
	--acgi-ma-btn-border: #c3c4c7;
	--acgi-ma-btn-ghost-color: #1e1e1e;
	--acgi-ma-btn-ghost-hover-bg: #f6f7f7;

	max-width: 34rem;
	margin: 3rem auto;
	padding: 2.5rem 2rem;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	text-align: center;
}

.acgi-ma-notice__title {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	font-weight: 600;
	color: #1e1e1e;
}

.acgi-ma-notice__body {
	color: #50575e;
	line-height: 1.6;
}

.acgi-ma-notice__actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 1.5rem;
}

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

@keyframes acgi-ma-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes acgi-ma-rise {
	from { opacity: 0; transform: translateY(8px) scale(0.99); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.acgi-ma-modal__panel,
	.acgi-ma-modal__backdrop {
		animation: none;
	}
	.acgi-ma-btn,
	.acgi-ma-modal__close {
		transition: none;
	}
}

/* ---------- small screens ---------- */

@media (max-width: 480px) {
	.acgi-ma-modal {
		--acgi-ma-pad: 1.5rem;
		padding: 1rem;
	}
	.acgi-ma-modal__actions {
		flex-direction: column;
		align-items: stretch;
	}
}
