/*
 * Second-opinion request page (.sor-*), page-second-opinion.php only.
 *
 * A split screen: the doctor on navy, the form on white. Form controls inherit
 * the site's Gravity Forms styling (.gf-wrap in app.css); this file adds the
 * grid, the choice tiles, the two facts under the form and the popup.
 * .gf-wrap rules use !important against Gravity Forms' own, so the few rules
 * that change one of those have to as well.
 */

.sor { background: var(--color-bg); color: var(--color-text-body); }
.sor-shell { display: grid; grid-template-columns: minmax(0, 1fr); }

/* ------------------------------ the doctor ------------------------------ */
.sor-doc {
	position: relative; isolation: isolate; overflow: hidden;
	display: grid; grid-template-columns: minmax(0, 1fr) clamp(132px, 36vw, 220px);
	align-items: end; column-gap: var(--space-4);
	padding-inline: clamp(20px, 5vw, 64px);
	background:
		radial-gradient(ellipse 520px 420px at 82% 74%, rgba(53, 87, 255, 0.42) 0%, transparent 68%),
		linear-gradient(160deg, var(--color-navy-deep) 0%, var(--color-navy-darkest) 74%);
	color: var(--color-text-invert);
}
.sor-doc__text { align-self: center; padding-block: var(--space-8); }
.sor-doc__title {
	margin: 0; color: var(--color-text-invert);
	font-family: var(--font-heading); font-weight: var(--weight-extrabold);
	font-size: clamp(1.625rem, 6.2vw, 2.25rem); line-height: 1.1; letter-spacing: -0.02em;
	text-wrap: balance;
}
.sor-doc__loc {
	display: flex; align-items: center; gap: 7px;
	margin: var(--space-3) 0 0; font-size: var(--text-base); color: rgba(245, 247, 255, 0.82);
}
.sor-doc__loc svg { flex: none; width: 17px; height: 17px; color: #9DB3FF; }
.sor-doc__intro:empty { display: none; }
.sor-doc__intro p { margin: var(--space-4) 0 0; font-size: var(--text-lg); line-height: 1.55; color: rgba(245, 247, 255, 0.86); }
/* The cut-out's arms leave its frame at the sides lower down, so only the part above that is shown. */
.sor-doc__cutout { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 930; object-fit: cover; object-position: top; align-self: end; }
.sor-doc__photo { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-xl); margin-block: var(--space-8); }

/* Phones: the intro gets its own line under the name and the photo. */
@media (max-width: 599px) {
	.sor-doc { align-items: end; }
	.sor-doc__text { padding-block: var(--space-6) var(--space-6); }
	.sor-doc__intro p { font-size: var(--text-base); }
}

/* ------------------------------- the form ------------------------------- */
.sor-form { padding: var(--space-8) clamp(20px, 5vw, 64px) var(--space-16); }
.sor-form__inner { width: 100%; max-width: 640px; margin-inline: auto; }

/* The form is the page here, not a card on it. */
.sor .gf-wrap { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }

.sor .gf-wrap .gform_legacy_markup_wrapper ul.gform_fields {
	display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: var(--space-5) var(--space-4);
}
.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield { grid-column: 1 / -1; min-width: 0; }
.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gform_hidden { display: none; }
@media (min-width: 600px) {
	.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.sor-f-half { grid-column: span 3; }
	.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.sor-f-third { grid-column: span 2; }
}
/* A two-line label in one column must not push its input below its neighbours'. */
.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield { display: flex; flex-direction: column; }
.sor .gf-wrap .gform_legacy_markup_wrapper li.gfield > .ginput_container { margin: 0 !important; }

/* Choices as tiles. The radio stays visible, so the state is never colour alone. */
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio {
	display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: 100%;
}
@media (min-width: 600px) {
	.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sor .gf-wrap .gform_legacy_markup_wrapper .sor-f-yesno .gfield_radio { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio li,
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio .gchoice { position: relative; display: block; margin: 0 !important; padding: 0 !important; }
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio label {
	display: flex !important; align-items: center; width: 100%; max-width: none !important; box-sizing: border-box;
	min-height: 54px; margin: 0 !important; padding: 12px 14px 12px 44px !important;
	border: 1.5px solid var(--color-border); border-radius: var(--radius-xl);
	background: var(--color-bg); color: var(--color-text-strong);
	font-size: 16px; font-weight: var(--weight-semi); line-height: 1.25; cursor: pointer;
	transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio input[type="radio"] {
	position: absolute; left: 16px; top: 50%; width: 18px !important; height: 18px !important;
	margin: -9px 0 0 !important; cursor: pointer; z-index: 1;
}
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio label:hover { border-color: #8E9DF5; }
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio input:checked + label { border-color: var(--color-brand-blue); background: var(--color-bg-tinted); }
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_radio input:focus-visible + label { border-color: var(--color-brand-blue); box-shadow: 0 0 0 3px rgba(53, 87, 255, 0.22); }
.sor .gf-wrap .gform_legacy_markup_wrapper .gfield_error .gfield_radio label { border-color: #d92d20; }

/* Errors. Gravity Forms' own sheet bands the whole field and sets the message above the input, and 3.x adds a list of
   every message on top; each field already carries its message, so it shows once, under the input. */
body .sor .gf-wrap .gform_legacy_markup_wrapper ul.gform_fields li.gfield.gfield_error {
	min-width: 100%; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important;
}
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error .gfield_label { color: var(--color-navy-deep); }
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error .ginput_container { max-width: none; }
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error .validation_message { order: 3; margin: 0; padding: 6px 0 0 !important; }
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error input[type="text"],
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error input[type="email"],
body .sor .gf-wrap .gform_legacy_markup_wrapper li.gfield.gfield_error select { border-color: #d92d20 !important; }
body .sor .gf-wrap .gform_legacy_markup_wrapper .gform_validation_errors { margin: 0 0 var(--space-6) !important; text-align: left !important; }
body .sor .gf-wrap .gform_legacy_markup_wrapper .gform_validation_errors ol { display: none; }
body .sor .gf-wrap .gform_legacy_markup_wrapper .gform_submission_error { display: flex; align-items: center; gap: 4px; text-indent: 0; }

/* ------------------------ the two facts under it ------------------------ */
.sor-facts {
	display: grid; gap: var(--space-4); list-style: none;
	margin: var(--space-8) 0 0; padding: var(--space-6) 0 0;
	border-top: 1px solid var(--color-border);
}
.sor-facts__item { display: flex; align-items: flex-start; gap: var(--space-3); margin: 0; font-size: var(--text-base); line-height: 1.5; color: var(--color-text-body); }
.sor-facts__item svg { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--color-brand-blue); }
.sor-facts__item strong { color: var(--color-text-strong); }
@media (min-width: 600px) {
	.sor-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
}

/* ------------------------- sent: the text inline ------------------------ */
.sor .gform_confirmation_wrapper, .sor .gform_confirmation_message { margin: 0; padding: 0; border: 0; background: none; text-align: left; }
.sor .sor-done { padding: var(--space-6); text-align: left; border-left: 4px solid var(--color-brand-blue); background: var(--color-bg-tinted); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.sor-done:focus { outline: none; }
.sor .sor-done h2, .sor-dialog h2 { margin: 0; font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; color: var(--color-text-strong); }
.sor .sor-done p, .sor-dialog p { margin: var(--space-3) 0 0; font-weight: var(--weight-normal, 400); font-size: var(--text-lg); line-height: 1.5; color: var(--color-text-body); }
.sor-done a, .sor-dialog p a { color: var(--color-brand-blue); font-weight: var(--weight-semi); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }

/* ------------------------------ the popup ------------------------------- */
.sor-dialog {
	width: min(480px, calc(100vw - 40px)); max-height: calc(100dvh - 40px); box-sizing: border-box;
	margin: auto; padding: 0 var(--space-8) var(--space-8); border: 0; border-radius: var(--radius-2xl);
	background: var(--color-bg); color: var(--color-text-body); text-align: center; overflow: auto;
	box-shadow: 0 30px 90px rgba(0, 6, 37, 0.42);
}
.sor-dialog::backdrop { background: rgba(0, 6, 37, 0.62); }
.sor-dialog__mark {
	display: grid; place-items: center; width: 64px; height: 64px;
	margin: var(--space-10) auto var(--space-5); border-radius: 50%;
	background: var(--color-brand-blue); color: #fff;
}
.sor-dialog__mark svg { width: 27px; height: 27px; transform: translate(-2px, 2px); }
.sor-dialog__ok { margin-top: var(--space-6); min-width: 160px; justify-content: center; }
.sor-dialog__close {
	position: absolute; top: 12px; right: 12px; display: grid; place-items: center;
	width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-text-muted); cursor: pointer;
}
.sor-dialog__close svg { width: 20px; height: 20px; }
.sor-dialog__close:hover { background: var(--color-bg-tinted); color: var(--color-text-strong); }
.sor-dialog__close:focus-visible { outline: 2px solid var(--color-brand-blue); outline-offset: 1px; }
@media (max-width: 399px) { .sor-dialog { padding-inline: var(--space-5); } }

/* ---------------------------- split screen ------------------------------ */
@media (min-width: 1000px) {
	.sor-shell { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
	.sor-doc {
		display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
		padding: clamp(48px, 5vw, 80px) clamp(32px, 4vw, 64px) 0 max(32px, calc((100vw - var(--container-max)) / 2));
	}
	.sor-doc__text { align-self: auto; padding: 0; }
	.sor-doc__title { font-size: clamp(2.25rem, 3.4vw, 3.25rem); line-height: 1.06; }
	.sor-doc__loc { margin-top: var(--space-4); font-size: var(--text-lg); }
	.sor-doc__cutout { width: min(100%, 520px); margin: var(--space-8) auto 0; align-self: center; }
	.sor-form { padding: clamp(48px, 5vw, 80px) max(32px, calc((100vw - var(--container-max)) / 2)) clamp(64px, 6vw, 96px) clamp(40px, 5vw, 80px); }
	.sor-form__inner { max-width: 620px; margin: 0; }
}
