/*
 * The designed dropdown (assets/src/select.js).
 *
 * The button takes the place, and the look, of the field it replaces: the
 * same border, radius and 16px text as every other input on these forms, with
 * a chevron that turns when the menu is open. The menu is a card in the site's
 * own shadow and radius; on a phone it is a sheet from the bottom.
 */

.ecc-select {
	position: relative;
	display: block;
	width: 100%;
	min-width: 0;
}

/* The native control stays in the form for submission, out of sight. */
.ecc-select > .ecc-select__native {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	white-space: nowrap !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.ecc-select__button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 10px 14px;
	box-sizing: border-box;
	border: 1px solid var(--color-pill-border, #D9D6CC);
	border-radius: 10px;
	background: var(--ecc-surface, #fff);
	color: var(--ecc-ink, #0A1312);
	font: inherit;
	font-size: 16px;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.ecc-select__button:hover {
	border-color: #BDB9AC;
}

.ecc-select__button:focus-visible,
.ecc-select.is-open .ecc-select__button {
	outline: none;
	border-color: var(--ecc-fill, #7CB342);
	box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.25);
}

.ecc-select__button:disabled {
	cursor: default;
	opacity: 0.5;
}

.ecc-select__value {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ecc-select__chevron {
	flex: 0 0 auto;
	color: var(--ecc-muted, #5A5A54);
	transition: transform 0.2s ease;
}

.ecc-select.is-open .ecc-select__chevron {
	transform: rotate(180deg);
	color: var(--ecc-accent, #4A7326);
}

/* In the events filter bar the fields are 42px, a notch shorter than a form
   field, so the button matches them. */
.ecc-filters .ecc-select__button {
	min-height: 44px;
	padding: 9px 12px;
}

/* In the editor toolbar: sized to its label, like the buttons beside it. */
.ecc-select--toolbar {
	width: auto;
}

.ecc-select--toolbar .ecc-select__button,
.ecc-select--compact .ecc-select__button {
	width: auto;
	/* Fits "Subheading", the longest style, so the toolbar does not reflow
	   as the caret moves between a paragraph and a heading. */
	min-width: 132px;
	min-height: 36px;
	padding: 6px 10px;
	border-radius: 8px;
}

.ecc-select--compact {
	width: auto;
}

.ecc-select--compact .ecc-select__button {
	min-width: 140px;
}

@media (pointer: coarse) {
	.ecc-select--toolbar .ecc-select__button,
	.ecc-select--compact .ecc-select__button {
		min-height: 44px;
	}
}

/* --- the menu -------------------------------------------------------------- */

.ecc-select-layer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	pointer-events: none;
}

.ecc-select-layer[hidden] {
	display: none;
}

.ecc-select-layer__backdrop {
	position: absolute;
	inset: 0;
	pointer-events: auto;
	background: transparent;
}

.ecc-select-menu {
	position: fixed;
	display: flex;
	flex-direction: column;
	max-width: min(420px, calc(100vw - 16px));
	padding: 6px;
	box-sizing: border-box;
	border: 1px solid var(--color-pill-border, #D9D6CC);
	border-radius: 14px;
	background: var(--ecc-surface, #fff);
	box-shadow: 0 14px 40px rgba(10, 19, 18, 0.16), 0 2px 6px rgba(10, 19, 18, 0.06);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(-4px) scale(0.98);
	transform-origin: top left;
	transition: opacity 0.14s ease, transform 0.14s ease;
	font-family: inherit;
}

.ecc-select-menu.is-above {
	transform-origin: bottom left;
	transform: translateY(4px) scale(0.98);
}

.ecc-select-layer.is-in .ecc-select-menu {
	opacity: 1;
	transform: none;
}

/* The sheet's header is for phones only. */
.ecc-select-menu__head {
	display: none;
}

.ecc-select-menu__search {
	flex: 0 0 auto;
	margin: 2px 2px 6px;
	padding: 10px 12px;
	border: 1px solid var(--color-pill-border, #D9D6CC);
	border-radius: 10px;
	font: inherit;
	font-size: 16px;
	color: var(--ecc-ink, #0A1312);
	background: var(--color-pill-bg, #EFEBE0);
}

.ecc-select-menu__search:focus {
	outline: none;
	border-color: var(--ecc-fill, #7CB342);
	background: var(--ecc-surface, #fff);
	box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.25);
}

.ecc-select-menu__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	outline: none;
}

.ecc-select-menu__option {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 40px;
	padding: 8px 12px;
	border-radius: 9px;
	color: var(--ecc-ink, #0A1312);
	font-size: 15px;
	line-height: 1.3;
	cursor: pointer;
	user-select: none;
}

.ecc-select-menu__option[hidden] {
	display: none;
}

.ecc-select-menu__text {
	flex: 1 1 auto;
	min-width: 0;
}

.ecc-select-menu__option.is-active {
	background: var(--color-pill-bg, #EFEBE0);
}

.ecc-select-menu__option[aria-selected="true"] {
	color: var(--ecc-accent, #4A7326);
	font-weight: 600;
}

.ecc-select__check {
	flex: 0 0 auto;
	visibility: hidden;
	color: var(--ecc-accent, #4A7326);
}

.ecc-select-menu__option[aria-selected="true"] .ecc-select__check {
	visibility: visible;
}

.ecc-select-menu__option[aria-disabled="true"] {
	opacity: 0.45;
	cursor: default;
}

/* Keyboard focus is on the list, which says which option is active through
   aria-activedescendant; the ring goes on that option so it can be seen. */
.ecc-select-menu__list:focus-visible .ecc-select-menu__option.is-active,
.ecc-select-menu__search:focus ~ .ecc-select-menu__list .ecc-select-menu__option.is-active {
	box-shadow: inset 0 0 0 2px var(--ecc-fill, #7CB342);
}

.ecc-select-menu__grouplabel {
	padding: 12px 12px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ecc-muted, #5A5A54);
}

.ecc-select-menu__group[hidden] {
	display: none;
}

.ecc-select-menu__empty {
	margin: 0;
	padding: 14px 12px;
	font-size: 14px;
	color: var(--ecc-muted, #5A5A54);
}

.ecc-select-menu__empty[hidden] {
	display: none;
}

/* The editor's text-style menu previews each style. */
.ecc-select-style--h2 {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.ecc-select-style--h3 {
	font-size: 17px;
	font-weight: 700;
}

/* On the closed button the preview would change the toolbar's height, so the
   label stays text-sized there and only its weight carries over. */
.ecc-select__value.ecc-select-style--h2,
.ecc-select__value.ecc-select-style--h3 {
	font-size: inherit;
	letter-spacing: normal;
}

/* --- a sheet on a phone ----------------------------------------------------- */

html.ecc-select-lock,
html.ecc-select-lock body {
	overflow: hidden;
}

.ecc-select-layer.is-sheet .ecc-select-layer__backdrop {
	background: rgba(10, 19, 18, 0.45);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ecc-select-layer.is-sheet.is-in .ecc-select-layer__backdrop {
	opacity: 1;
}

.ecc-select-layer.is-sheet .ecc-select-menu {
	left: 0;
	right: 0;
	bottom: 0;
	top: auto;
	max-width: none;
	max-height: min(75vh, 560px);
	padding: 0 10px calc(12px + env(safe-area-inset-bottom, 0px));
	border: 0;
	border-radius: 20px 20px 0 0;
	box-shadow: 0 -10px 40px rgba(10, 19, 18, 0.2);
	transform: translateY(100%);
	transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
	opacity: 1;
}

.ecc-select-layer.is-sheet.is-in .ecc-select-menu {
	transform: none;
}

.ecc-select-layer.is-sheet .ecc-select-menu__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 10px 6px 8px;
}

.ecc-select-menu__grip {
	width: 40px;
	height: 4px;
	border-radius: 2px;
	background: var(--color-pill-border, #D9D6CC);
}

/* The header is the sheet's drag handle (sheet.js): pull down to dismiss. */
.ecc-select-layer.is-sheet .ecc-select-menu__head {
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.ecc-select-layer.is-dragging .ecc-select-menu__head {
	cursor: grabbing;
}

/* While a finger holds it the sheet follows exactly, with no easing lag. */
.ecc-select-layer.is-dragging .ecc-select-menu,
.ecc-select-layer.is-dragging .ecc-select-layer__backdrop {
	transition: none;
}

/* On its way out the card takes no taps; they go to the page. */
.ecc-select-layer.is-closing .ecc-select-layer__backdrop,
.ecc-select-layer.is-closing .ecc-select-menu {
	pointer-events: none;
}

.ecc-select-menu__title {
	align-self: flex-start;
	padding: 0 6px;
	font-size: 17px;
	font-weight: 700;
	color: var(--ecc-ink, #0A1312);
}

.ecc-select-layer.is-sheet .ecc-select-menu__option {
	min-height: 52px;
	padding: 10px 14px;
	font-size: 17px;
}

@media (prefers-reduced-motion: reduce) {
	.ecc-select-menu,
	.ecc-select__chevron,
	.ecc-select-layer.is-sheet .ecc-select-menu,
	.ecc-select-layer.is-sheet .ecc-select-layer__backdrop {
		transition: none;
	}
}
