/**
 * G3 Modal System
 * =====================================================================
 * Shared, elegant, responsive base styling for all site modals.
 *
 * Per-modal customization:
 *   Every modal shell carries a `g3-modal--{slug}` modifier class, so a
 *   specific modal can be fully re-skinned without touching the base, e.g.
 *
 *     .g3-modal--pitch-your-problem .g3-modal__dialog { ... }
 *
 *   Per-instance overrides can be added via g3_render_modal($slug, [
 *     'extra_class' => 'g3-modal--dark g3-modal--wide'
 *   ]).
 * =====================================================================
 */

:root {
	--g3-modal-overlay-bg: rgba(10, 37, 68, 0.72);
	--g3-modal-dialog-bg: #ffffff;
	--g3-modal-dialog-color: #0a2544;
	--g3-modal-dialog-radius: 14px;
	--g3-modal-dialog-max-width: 560px;
	--g3-modal-field-padding-y: 8px;
	--g3-modal-field-padding-x: 12px;
	--g3-modal-accent: #f3762b;
	--g3-modal-border: #d7dde3;
	--g3-modal-muted: #5a6b7b;
	--g3-modal-shadow: 0 30px 80px rgba(10, 37, 68, 0.35);
	--g3-modal-z: 100000;
}

/* Native hide when closed (attribute set by PHP + toggled in JS). */
.g3-modal[hidden] {
	display: none;
}

.g3-modal {
	position: fixed;
	inset: 0;
	z-index: var(--g3-modal-z);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.g3-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--g3-modal-overlay-bg);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	cursor: pointer;
}

.g3-modal__dialog {
	position: relative;
	width: 100%;
	max-width: var(--g3-modal-dialog-max-width);
	max-height: 75vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--g3-modal-dialog-bg);
	color: var(--g3-modal-dialog-color);
	border-radius: var(--g3-modal-dialog-radius);
	box-shadow: var(--g3-modal-shadow);
	outline: none;
}

/* Nudge the dialog above dead-center (bottom margin offsets the centering).
   Skipped on mobile where the dialog is a bottom sheet. */
@media (min-width: 601px) {
	.g3-modal__dialog {
		margin-bottom: 100px;
	}
}

/* No-JS-GSAP fallback: simple fade/slide via class toggle. */
.g3-modal:not(.g3-modal--open) .g3-modal__overlay,
.g3-modal:not(.g3-modal--open) .g3-modal__dialog {
	opacity: 1;
}

.g3-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--g3-modal-dialog-color);
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		transform 0.2s ease;
}

.g3-modal__close svg {
	width: 20px;
	height: 20px;
}

.g3-modal__close:hover {
	background: rgba(10, 37, 68, 0.08);
}

.g3-modal__close:focus-visible {
	outline: 3px solid var(--g3-modal-accent);
	outline-offset: 2px;
}

.g3-modal__body {
	padding: 48px 40px 40px;
}

/* ---- Base content typography ---- */

.g3-modal__title {
	margin: 0 0 10px;
	font-size: 1.5rem;
	line-height: 1.25;
	font-weight: 800;
	color: var(--g3-modal-dialog-color);
}

.g3-modal__intro {
	margin: 0 0 24px;
	font-size: 15px !important;
	line-height: 1.5 !important;
	color: var(--g3-modal-muted);
}

/* ---- Base form controls ---- */

.g3-modal__form {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.g3-modal__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.g3-modal__label {
	font-size: 13px !important;
	line-height: 1.3 !important;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--g3-modal-dialog-color);
}

.g3-modal__input,
.g3-modal__textarea {
	width: 100%;
	padding: var(--g3-modal-field-padding-y) var(--g3-modal-field-padding-x);
	font-size: 16px !important;
	line-height: 1.35 !important;
	font-family: inherit;
	color: var(--g3-modal-dialog-color);
	background: #fff;
	border: 1px solid var(--g3-modal-border);
	border-radius: 8px;
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease;
	box-sizing: border-box;
}

.g3-modal__textarea {
	min-height: 96px;
	resize: vertical;
}

.g3-modal__input:focus,
.g3-modal__textarea:focus {
	outline: none;
	border-color: var(--g3-modal-accent);
	box-shadow: 0 0 0 3px rgba(243, 118, 43, 0.18);
}

.g3-modal__form button[type='submit'] {
	align-self: flex-start;
	margin-top: 18px;
	cursor: pointer;
	border: 0;
}

.g3-modal__form--loading button[type='submit'] {
	opacity: 0.7;
	cursor: progress;
}

/* Hide fields after a successful submission so only the message shows. */
.g3-modal__form--success .g3-modal__field,
.g3-modal__form--success button[type='submit'] {
	display: none;
}

/* Honeypot — visually hidden, not removed from DOM (bots still fill it). */
.g3-modal__honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

/* ---- Status / feedback region ---- */

.g3-modal__status {
	font-size: 13px !important;
	line-height: 1.5 !important;
	min-height: 1.2em;
}

.g3-modal__status--error {
	color: #c0392b;
	font-weight: 600;
}

.g3-modal__status--success {
	color: #1e7a46;
	font-weight: 700;
	font-size: 1em !important;
}

.g3-modal__status--loading {
	color: var(--g3-modal-muted);
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
	.g3-modal {
		padding: 0;
		align-items: flex-end;
	}

	.g3-modal__dialog {
		max-width: 100%;
		max-height: 75vh;
		border-radius: 16px 16px 0 0;
	}

	.g3-modal__body {
		padding: 44px 24px 28px;
	}

	.g3-modal__title {
		font-size: 1.3rem;
	}
}

/* ---- Reduced motion: neutralize transitions ---- */

@media (prefers-reduced-motion: reduce) {
	.g3-modal__close,
	.g3-modal__input,
	.g3-modal__textarea {
		transition: none;
	}
}

/* =====================================================================
 * Per-modal overrides
 * ---------------------------------------------------------------------
 * Pitch Your Problem (Books LP) — generic elegant treatment until the
 * designer's comp is available.
 * ===================================================================== */

.g3-modal--pitch-your-problem {
	/* Postcard proportions: wider than it is tall. */
	--g3-modal-dialog-max-width: 840px;
}

.g3-modal--pitch-your-problem .g3-modal__body {
	padding: 52px 56px 48px;
}

.g3-modal--pitch-your-problem .g3-modal__textarea {
	min-height: 80px;
}

/* Two-column form: name + email side by side, everything else full width. */
@media (min-width: 620px) {
	.g3-modal--pitch-your-problem .g3-modal__form {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 22px;
		row-gap: 18px;
	}

	.g3-modal--pitch-your-problem .g3-modal__field--full,
	.g3-modal--pitch-your-problem .g3-modal__form button[type='submit'],
	.g3-modal--pitch-your-problem .g3-modal__status {
		grid-column: 1 / -1;
	}
}

/* =====================================================================
 * Contact page modals — shared layout (icon + title header, form panel)
 * ===================================================================== */

.g3-modal--contact {
	--contact-modal-circle-blue: #2d4460;
	--contact-modal-form-bg: #859cad;
	--contact-modal-frame-border: #d9d9d9;
	--g3-modal-dialog-max-width: 1090px;
	--g3-modal-field-padding-y: 0.5em;
	--g3-modal-field-padding-x: 0.8em;
	/* Bootstrap sets html { font-size: 10px }, so 3.2rem ≈ 32px design size. */
	--contact-modal-title-size: 3.2rem;
}

.g3-modal--contact .g3-modal__dialog {
	width: 90%;
	max-width: var(--g3-modal-dialog-max-width);
	border-radius: 0;
	border: 35px solid var(--contact-modal-frame-border);
	box-shadow: none;
	font-size: var(--base-font-size);
}

.g3-modal--contact .g3-modal__body {
	padding: 2.5em 2.75em 5em;
}

.g3-modal--contact .contact-modal__header {
	display: flex;
	align-items: center;
	gap: 1.25em;
	margin-bottom: 3rem;
}

.g3-modal--contact .contact-modal__copy {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5em;
	min-width: 0;
	padding-right: 1em;
}

.g3-modal--contact .contact-modal__icon {
	flex: 0 0 8.4em;
	font-size: 18px;
	width: 8.4em;
	height: 8.4em;
	min-width: 8.4em;
	min-height: 8.4em;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: var(--contact-modal-circle-blue);
}

.g3-modal--contact .contact-modal__icon-img {
	display: block;
	width: 75%;
	height: auto;
}

.g3-modal--contact .contact-modal__title {
	margin: 0;
	font-family: 'Montserrat', sans-serif;
	font-size: var(--contact-modal-title-size);
	font-weight: 800;
	line-height: 1.15;
	color: var(--primary-color-dark, #0b2544);
	text-transform: uppercase;
}

.g3-modal--contact .contact-modal__intro {
	margin: 0;
	font-size: 1.05em;
	line-height: 1.45 !important;
	font-weight: 400;
	color: var(--primary-color-dark, #0b2544);
}

.g3-modal--contact .contact-modal--no-icon .contact-modal__title {
	margin-top: 0;
}

/* Labeled booking form (Book Mike request) */
.g3-modal--contact .contact-modal__form--labeled {
	grid-template-columns: 1fr 1fr;
}

.g3-modal--contact .contact-modal__form--labeled .contact-modal__field-label {
	display: block;
	margin: 0 0 0.12em;
	font-size: 0.84em;
	font-weight: 700;
	line-height: 1.15;
	color: var(--primary-color-dark, #0b2544);
}

.g3-modal--contact .contact-modal__form--labeled .contact-modal__field-group > .contact-modal__field-label {
	margin-bottom: 0.12em;
}

.g3-modal--contact .contact-modal__required {
	color: #c0392b;
}

.g3-modal--contact .contact-modal__form--labeled .contact-modal__field-hint {
	margin: 0.12em 0 0;
	font-size: 0.75em;
	line-height: 1.25;
}

.g3-modal--contact .contact-modal__field-hint {
	margin: 0.2em 0 0;
	font-size: 0.78em;
	font-style: italic;
	line-height: 1.3;
	color: rgba(11, 37, 68, 0.72);
}

.g3-modal--contact .contact-modal__form--labeled .contact-modal__field-row {
	gap: 0.75em;
}

.g3-modal--contact .contact-modal__field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.65em;
}

.g3-modal--contact .contact-modal__field-row-item {
	min-width: 0;
}

/* Book Mike request — spacing tweaks only (width matches .g3-modal--contact) */
.g3-modal--book-mike-request .g3-modal__body {
	padding: 2em 2.25em 2.5em;
}

.g3-modal--book-mike-request .contact-modal__header {
	margin-bottom: 1.5rem;
}

.g3-modal--contact .contact-modal__form-panel {
	padding: 1.15em 1.25em 2.5em;
	background-color: var(--contact-modal-form-bg);
}

.g3-modal--contact .contact-modal__form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.65em 0.9em;
	margin: 0;
}

.g3-modal--contact .contact-modal__form.contact-modal__form--labeled {
	gap: 1.5em 0.9em;
}

.g3-modal--book-mike-request .contact-modal__form.contact-modal__form--labeled {
	gap: 1.25em 1em;
}

.g3-modal--contact .contact-modal__form .g3-modal__field {
	margin: 0;
}

.g3-modal--contact .contact-modal__input,
.g3-modal--contact .contact-modal__textarea {
	padding: var(--g3-modal-field-padding-y) var(--g3-modal-field-padding-x);
	border: 0;
	border-radius: 0;
	font-size: 1em !important;
	color: var(--primary-color-dark, #0b2544);
}

.g3-modal--contact .contact-modal__input::placeholder {
	color: #8a96a3;
	opacity: 1;
}

.g3-modal--contact .contact-modal__input:focus {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.g3-modal--contact .contact-modal__field--full {
	grid-column: 1 / -1;
}

.g3-modal--contact .contact-modal__textarea {
	width: 100%;
	min-height: 5em;
	padding: var(--g3-modal-field-padding-y) var(--g3-modal-field-padding-x);
	border: 0;
	border-radius: 0;
	font-size: 1em !important;
	font-family: inherit;
	line-height: 1.35;
	color: var(--primary-color-dark, #0b2544);
	resize: vertical;
}

.g3-modal--contact .contact-modal__radio-group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1.5em;
}

.g3-modal--contact .contact-modal__radio {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	font-size: 0.95em;
	color: var(--primary-color-dark, #0b2544);
	cursor: pointer;
}

.g3-modal--contact .contact-modal__radio-input {
	margin: 0;
	accent-color: var(--primary-color-dark, #0b2544);
}

.g3-modal--contact .contact-modal__checkbox {
	display: flex;
	align-items: flex-start;
	gap: 0.45em;
	font-size: 0.95em;
	color: var(--primary-color-dark, #0b2544);
	cursor: pointer;
}

.g3-modal--contact .contact-modal__checkbox-input {
	margin: 0.15em 0 0;
	accent-color: var(--primary-color-dark, #0b2544);
}

.g3-modal--contact .contact-modal__textarea::placeholder {
	color: #8a96a3;
	opacity: 1;
}

.g3-modal--contact .contact-modal__textarea:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.g3-modal--contact .contact-modal__form-footer {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75em;
	margin-top: 0.6em;
	width: 100%;
}

.g3-modal--contact .contact-modal__form-footer .g3-modal__status:empty {
	display: none;
}

.g3-modal--contact .contact-modal__form button[type='submit'].br-cta--orange {
	align-self: center;
	margin-top: 0;
	border: solid 1px var(--white);
}

.g3-modal--contact .g3-modal__status {
	color: #2d4460;
	text-align: center;
	min-height: 0;
}

.g3-modal--contact .g3-modal__status--error {
	color: #c0392b;
	font-weight: 600;
	font-size: 1.1em !important;
}

.g3-modal--contact .g3-modal__status--success {
	color: #2d4460;
}

.g3-modal--contact .g3-modal__form--success .contact-modal__form-footer {
	margin-top: 0;
}

@media (max-width: 1000px) {
	.g3-modal--contact .contact-modal__icon {
		/* 5em at the icon's own 18px font-size = 90px (kept under 100px). */
		flex-basis: 5em;
		width: 5em;
		height: 5em;
		min-width: 5em;
		min-height: 5em;
	}

	.g3-modal--contact .contact-modal__title {
		font-size: 2.75rem;
	}
}

@media (max-width: 900px) {
	.g3-modal--contact .g3-modal__body {
		padding: 2.75em 1.35em 1.75em;
	}

	.g3-modal--contact .g3-modal__dialog {
		border-radius: 0;
	}

	.g3-modal--contact .contact-modal__header {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.g3-modal--contact .contact-modal__copy {
		align-items: center;
	}

	.g3-modal--contact .contact-modal__title {
		margin-top: 0;
		font-size: 2.35rem;
	}

	.g3-modal--contact .contact-modal__form {
		grid-template-columns: 1fr;
	}

	.g3-modal--contact .contact-modal__field-row {
		grid-template-columns: 1fr;
	}
}
