/**
 * Full-viewport-under-header overlay for Material schedule summary + contact form.
 */

/* Muted thin scrollbars inside column rails */
.gather-ms-scroll-rail {
	scrollbar-width: thin;
	scrollbar-color: rgb(58 53 53 / 0.22) transparent;
}

.gather-ms-scroll-rail::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

.gather-ms-scroll-rail::-webkit-scrollbar-thumb {
	background-color: rgb(58 53 53 / 0.22);
	border-radius: 999px;
}

.gather-ms-scroll-rail::-webkit-scrollbar-track {
	background: transparent;
}

.gather-material-schedule-overlay {
	box-sizing: border-box;
	position: fixed;
	top: var(--gather-material-schedule-panel-top, 5.75rem);
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 150;
	display: flex;
	justify-content: center;
	align-items: stretch;
	overflow: hidden;
	padding: clamp(0.75rem, 2vw, 1.35rem);
}

/**
 * Focus mode: hide site header, full viewport minus optional WP admin bar / safe areas.
 * Overlay stacks above sticky header (.gather-site-header is z-index 200).
 */
body.admin-bar.gather-material-schedule-open {
	/* Core sets --wp-admin--admin-bar--height on logged-in shells. */
	--gather-material-schedule-panel-top: var(--wp-admin--admin-bar--height, 32px);
}

body.gather-material-schedule-open:not(.admin-bar) {
	--gather-material-schedule-panel-top: 0px;
}

body.gather-material-schedule-open .gather-site-header {
	display: none;
}

body.gather-material-schedule-open .gather-material-schedule-overlay {
	top: var(--gather-material-schedule-panel-top, 0);
	z-index: 220;
	justify-content: stretch;
	align-items: stretch;
	padding:
		max(0.35rem, env(safe-area-inset-top, 0px))
		max(0.35rem, env(safe-area-inset-right, 0px))
		max(0.35rem, env(safe-area-inset-bottom, 0px))
		max(0.35rem, env(safe-area-inset-left, 0px));
}

body.gather-material-schedule-open .gather-material-schedule-dialog {
	width: 100%;
	max-width: none;
	flex: 1 1 auto;
	min-height: 0;
	max-height: none;
	align-self: stretch;
	border-radius: 0;
}

.gather-material-schedule-overlay[hidden] {
	display: none;
}

.gather-material-schedule-overlay__backdrop {
	position: absolute;
	inset: 0;
	z-index: 1;
	cursor: pointer;
	background: rgb(58 53 53 / 0.28);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.gather-material-schedule-dialog {
	--gather-ms-card-padding: clamp(0.85rem, 1.45vw, 1.05rem);
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	width: min(100%, 960px);
	max-height: calc(100dvh - var(--gather-material-schedule-panel-top, 5.75rem) - clamp(1.5rem, 4vw, 2rem));
	overflow: hidden;
	background: var(--gather-chalk);
	color: var(--gather-charcoal);
	border: 1px solid var(--gather-border-subtle);
	border-radius: 0.5rem;
	box-shadow:
		0 4px 6px rgb(58 53 53 / 0.04),
		0 20px 56px rgb(58 53 53 / 0.12);
	outline: none;
}

@media (prefers-reduced-motion: no-preference) {
	.gather-material-schedule-overlay:not([hidden]) .gather-material-schedule-dialog {
		animation: gather-ms-dialog-enter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
	}
}

@keyframes gather-ms-dialog-enter {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.988);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.gather-material-schedule-dialog:focus-visible {
	outline: 2px solid var(--gather-terra);
	outline-offset: 2px;
}

.gather-material-schedule-dialog__header {
	flex-shrink: 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 1rem clamp(1rem, 2.5vw, 1.5rem);
	border-bottom: 1px solid var(--gather-border-subtle);
}

.gather-material-schedule-dialog__title {
	margin: 0;
	font-family: var(--gather-font-headline);
	font-weight: 500;
	font-size: clamp(1.25rem, 2.8vw, 1.65rem);
}

.gather-ms-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--gather-border-subtle);
	background: rgb(242 237 230 / 0.65);
	cursor: pointer;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--gather-charcoal);
	transition:
		background-color 0.15s ease,
		border-color 0.15s ease;
}

.gather-ms-icon-button:hover {
	background: rgb(255 255 255 / 0.85);
}

.gather-ms-icon-button:focus-visible {
	outline: 2px solid var(--gather-terra);
	outline-offset: 2px;
}

.gather-ms-panel-layout {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: clamp(1.25rem, 3vw, 2rem);
	padding: clamp(1rem, 2.5vw, 1.5rem);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* Wrapper only affects layout on desktop; on narrow viewports height is intrinsic. */
.gather-ms-selections-scroll {
	min-width: 0;
}

@media (min-width: 900px) {
	.gather-ms-panel-layout {
		grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
		align-items: stretch;
		column-gap: clamp(1rem, 2vw, 1.75rem);
		/* Columns scroll independently — do not scroll the whole grid together. */
		overflow: hidden;
	}

	.gather-ms-panel-contact {
		padding-inline-start: clamp(1rem, 2vw, 1.5rem);
		border-inline-start: 1px solid var(--gather-border-subtle);
	}

	.gather-ms-panel-layout > .gather-ms-panel-selections,
	.gather-ms-panel-layout > .gather-ms-panel-contact {
		min-height: 0;
	}

	/* Extend .gather-ms-stack flex column so the middle pane can shrink and scroll */
	.gather-ms-panel-selections.gather-ms-stack {
		min-height: 0;
		max-height: 100%;
	}

	.gather-ms-panel-selections > .gather-ms-panel-selections--well {
		flex: 1;
		min-height: 0;
	}

	.gather-ms-selections-scroll {
		flex: 1;
		min-height: 0;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-gutter: stable;
	}

	.gather-ms-selections-footer {
		flex-shrink: 0;
	}

	.gather-ms-heading,
	#gather-ms-list-status.gather-ms-feedback {
		flex-shrink: 0;
	}

	.gather-ms-panel-contact.gather-ms-stack {
		min-height: 0;
		max-height: 100%;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-gutter: stable;
	}
}

.gather-ms-stack {
	--gather-ms-stack-gap: 0.75rem;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--gather-ms-stack-gap);
}

.gather-ms-heading {
	margin: 0;
	font-family: var(--gather-font-body);
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: rgb(122 125 127 / 0.95);
}

.gather-ms-panel-selections--well {
	padding: var(--gather-ms-card-padding, clamp(0.85rem, 1.45vw, 1.05rem));
	border-radius: 0.45rem;
	border: 1px solid var(--gather-border-subtle);
	background: var(--gather-surface-panel);
}

.gather-ms-feedback {
	margin: 0;
	min-height: 1.35em;
	font-size: 0.9rem;
	color: var(--gather-slate);
}

/* Live region stays in DOM; no reserved line or stack gap when idle. */
#gather-ms-list-status.gather-ms-feedback:empty {
	min-height: 0;
}

#gather-ms-list-status.gather-ms-feedback:empty + .gather-ms-selections-scroll {
	margin-top: calc(-1 * var(--gather-ms-stack-gap));
}

.gather-ms-feedback--form {
	padding-top: 0.65rem;
	color: var(--gather-terra);
	font-weight: 500;
	font-family: var(--gather-font-body);
}

.gather-ms-contact-card {
	padding: var(--gather-ms-card-padding, clamp(0.85rem, 1.45vw, 1.05rem));
	border-radius: 0.45rem;
	border: 1px solid var(--gather-border-subtle);
	background: rgb(255 255 255 / 0.52);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35);
}

.gather-ms-empty {
	margin: 0;
	padding: 1rem;
	border-radius: 0.5rem;
	background: rgb(242 237 230 / 0.55);
	border: 1px dashed var(--gather-border-subtle);
	color: var(--gather-slate);
	font-size: 0.95rem;
	line-height: 1.5;
}

.gather-ms-selection-list[hidden] {
	display: none;
}

.gather-ms-clear-overlay[hidden] {
	display: none;
}

.gather-ms-clear-overlay {
	position: absolute;
	inset: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1rem, 4vw, 2rem);
	box-sizing: border-box;
}

.gather-ms-clear-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(58 53 53 / 0.38);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	cursor: pointer;
}

.gather-ms-clear-overlay__dialog {
	position: relative;
	z-index: 2;
	width: min(100%, 22rem);
	max-width: 100%;
	padding: clamp(1.2rem, 3vw, 1.55rem);
	border-radius: 0.55rem;
	border: 1px solid var(--gather-border-subtle);
	background: var(--gather-chalk);
	color: var(--gather-charcoal);
	box-shadow:
		0 4px 6px rgb(58 53 53 / 0.06),
		0 18px 40px rgb(58 53 53 / 0.14);
	outline: none;
}

.gather-ms-clear-overlay__title {
	margin: 0 0 0.55rem;
	font-family: var(--gather-font-headline);
	font-weight: 500;
	font-size: clamp(1.05rem, 2.2vw, 1.25rem);
	line-height: 1.25;
}

.gather-ms-clear-overlay__text {
	margin: 0 0 1.1rem;
	font-size: 0.92rem;
	line-height: 1.5;
	color: var(--gather-slate);
}

.gather-ms-clear-overlay__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.5rem 0.75rem;
}

@media (prefers-reduced-motion: no-preference) {
	.gather-ms-clear-overlay:not([hidden]) .gather-ms-clear-overlay__dialog {
		animation: gather-ms-clear-overlay-enter 0.22s cubic-bezier(0.22, 1, 0.36, 1);
	}
}

@keyframes gather-ms-clear-overlay-enter {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.99);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gather-ms-clear-overlay:not([hidden]) .gather-ms-clear-overlay__dialog {
		animation: none;
	}
}

.gather-ms-selections-footer {
	margin-top: auto;
	padding-top: 0.45rem;
	border-top: 1px solid rgb(58 53 53 / 0.06);
}

.gather-ms-selections-footer--split {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.65rem 1rem;
}

.gather-ms-selections-footer--split .gather-ms-btn--danger-outline {
	flex-shrink: 0;
}

.gather-ms-selection-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.gather-ms-selection-item {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	padding: 0.4rem 0.5rem;
	border-radius: 0.4rem;
	border: 1px solid rgb(58 53 53 / 0.09);
	background: rgb(255 255 255 / 0.45);
	min-width: 0;
	transition:
		border-color 0.15s ease,
		background-color 0.15s ease;
}

.gather-ms-selection-item:hover {
	border-color: rgb(58 53 53 / 0.14);
	background: rgb(255 255 255 / 0.72);
}

.gather-ms-selection-item--missing {
	opacity: 0.95;
	border-style: dashed;
}

.gather-ms-row-main {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	min-width: 0;
}

.gather-ms-row-main-link {
	display: inline-block;
	align-self: flex-start;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

.gather-ms-row-content {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.45rem;
	min-width: 0;
}

.gather-ms-row-sample {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.8rem;
	color: var(--gather-slate);
	cursor: pointer;
}

.gather-ms-row-sample input[type='checkbox'] {
	margin: 0;
	accent-color: var(--gather-terra);
}

.gather-ms-row-main-link:hover .gather-ms-row-title {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.gather-ms-row-main--missing {
	cursor: default;
	text-decoration: none;
}

.gather-ms-row-thumb {
	flex-shrink: 0;
	width: 2.5rem;
	height: 2.5rem;
	margin-top: 0.12rem;
	object-fit: cover;
	border-radius: 0.28rem;
	background: rgb(58 53 53 / 0.08);
}

.gather-ms-row-thumb--placeholder {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 0.28rem;
	background: rgb(58 53 53 / 0.1);
	flex-shrink: 0;
	margin-top: 0.12rem;
}

.gather-ms-row-text {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
	flex: 1;
}

.gather-ms-row-meta--compact {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 0.35rem;
	row-gap: 0.1rem;
	font-size: 0.75rem;
	line-height: 1.38;
	color: var(--gather-slate);
}

.gather-ms-meta-sep {
	flex-shrink: 0;
	opacity: 0.45;
	font-weight: 300;
	user-select: none;
}

.gather-ms-meta-bit {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.28em;
}

.gather-ms-meta-abbr {
	font-size: 0.62rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: rgb(122 125 127 / 0.95);
	flex-shrink: 0;
}

.gather-ms-meta-mono {
	font-family: var(--gather-font-accent);
	font-size: 0.73rem;
	font-weight: 400;
	color: var(--gather-charcoal);
	letter-spacing: 0.03em;
}

.gather-ms-meta-color-val {
	font-size: 0.76rem;
	font-weight: 500;
	color: var(--gather-charcoal);
	word-break: break-word;
}

.gather-ms-row-title {
	min-width: 0;
	font-family: var(--gather-font-headline);
	font-size: 0.9rem;
	font-weight: 500;
	line-height: 1.28;
	word-break: break-word;
	color: var(--gather-charcoal);
}

.gather-ms-contact-intro {
	margin: -0.1rem 0 0;
	font-size: 0.86rem;
	line-height: 1.45;
	color: var(--gather-slate);
}

.gather-ms-draft-help {
	margin: 0.45rem 0 0;
	font-size: 0.8rem;
	line-height: 1.45;
	color: rgb(122 125 127 / 0.95);
}

.gather-ms-draft-status {
	margin: 0.35rem 0 0;
	min-height: 1.25em;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--gather-slate);
}

.gather-ms-form {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.gather-ms-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.gather-ms-field label {
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--gather-charcoal);
}

.gather-ms-field abbr {
	text-decoration: none;
	color: var(--gather-terra);
}

.gather-ms-optional {
	font-weight: 400;
	font-size: 0.82rem;
	color: var(--gather-slate);
	text-transform: none;
}

.gather-ms-field input,
.gather-ms-field textarea {
	font-family: var(--gather-font-body);
	font-size: 0.92rem;
	padding: 0.55rem 0.65rem;
	border-radius: 0.375rem;
	border: 1px solid var(--gather-border-subtle);
	background: #fffefd;
	color: var(--gather-charcoal);
}

.gather-ms-field input:focus-visible,
.gather-ms-field textarea:focus-visible {
	outline: 2px solid var(--gather-terra);
	outline-offset: 1px;
}

.gather-ms-field--checkbox {
	flex-direction: row;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.gather-ms-field--checkbox input {
	width: auto;
	flex-shrink: 0;
	margin: 0.2rem 0 0;
	accent-color: var(--gather-terra);
}

.gather-ms-field--checkbox label {
	font-weight: 500;
}

.gather-ms-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: center;
}

.gather-ms-btn {
	font-family: var(--gather-font-body);
	font-size: 0.875rem;
	font-weight: 600;
	padding: 0.52rem 1rem;
	border-radius: 0.375rem;
	border: 1px solid transparent;
	cursor: pointer;
	transition:
		background-color 0.15s ease,
		color 0.15s ease,
		border-color 0.15s ease;
	line-height: 1.35;
}

.gather-ms-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.gather-ms-btn:focus-visible {
	outline: 2px solid var(--gather-terra);
	outline-offset: 2px;
}

.gather-ms-btn--primary {
	background: var(--gather-terra);
	color: #fff;
	border-color: rgb(58 53 53 / 0.12);
}

.gather-ms-btn--primary:hover:not(:disabled) {
	filter: brightness(1.04);
}

.gather-ms-btn--ghost {
	background: transparent;
	color: var(--gather-charcoal);
	border-color: var(--gather-border-subtle);
}

.gather-ms-btn--ghost:hover:not(:disabled) {
	background: rgb(242 237 230 / 0.55);
}

.gather-ms-btn--text {
	background: transparent;
	border-color: transparent;
	color: var(--gather-slate);
	font-weight: 500;
	padding: 0.35rem 0.15rem;
	font-size: 0.82rem;
	text-decoration: underline;
	text-underline-offset: 0.2em;
	text-decoration-color: rgb(122 125 127 / 0.35);
}

.gather-ms-btn--text:hover:not(:disabled) {
	color: var(--gather-terra);
	text-decoration-color: rgb(196 122 90 / 0.55);
	background: transparent;
}

.gather-ms-btn--text:disabled {
	text-decoration: none;
	opacity: 0.42;
}

.gather-ms-btn--danger-outline {
	background: rgb(242 237 230 / 0.45);
	border-color: rgb(196 122 90 / 0.55);
	color: var(--gather-charcoal);
}

.gather-ms-btn--danger-outline:hover:not(:disabled) {
	background: rgb(242 237 230 / 0.88);
	border-color: var(--gather-terra);
}

.gather-ms-selection-item > .gather-ms-btn--icon {
	margin-top: 0.06rem;
}

.gather-ms-btn--icon {
	width: 1.875rem;
	height: 1.875rem;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
	border-color: rgb(58 53 53 / 0.1);
	background: rgb(255 255 255 / 0.65);
	border-radius: 50%;
	font-size: 1rem;
	color: rgb(122 125 127);
}

.gather-ms-btn--icon:hover:not(:disabled) {
	background: rgb(242 237 230 / 0.95);
	border-color: rgb(58 53 53 / 0.16);
	color: var(--gather-charcoal);
}

@media (prefers-reduced-motion: reduce) {
	.gather-material-schedule-overlay:not([hidden]) .gather-material-schedule-dialog {
		animation: none;
	}

	.gather-ms-selection-item {
		transition: none;
	}
}
