/**
 * Stratford BID site search.
 * Everything is scoped under .sua-search so nothing collides with Breakdance's
 * generated .bde-* rules or the theme.
 */

.sua-search {
	--sua-cream: #f6e4b2;
	--sua-cream-deep: #efd794;
	--sua-gold: #e3ae48;
	--sua-gold-hot: #eda919;
	--sua-plum: #4f0a2f;
	--sua-ink: #0a193e;
	--sua-ink-soft: #33406b;
	--sua-paper: #fffdf8;
	--sua-parchment: #fbf6ea;
	--sua-rule: #e7d9b6;
	--sua-muted: #6e6579;

	position: fixed;
	inset: 0;
	z-index: 99999;
}

.sua-search[hidden] {
	display: none;
}

.sua-search__scrim {
	position: absolute;
	inset: 0;
	background: rgba(10, 25, 62, 0.55);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

/**
 * The notched "ticket" silhouette, drawn with radial gradients rather than an
 * image mask.
 *
 * The site's .mask-cross points at Subtract-2.svg, which is 14MB — a Figma
 * export with a full-resolution JPEG baked in as a pattern fill. A mask only
 * reads alpha, so that bitmap is downloaded and discarded. Gradients also keep
 * the notches perfectly circular at any box height, which an image mask with
 * mask-size: cover cannot do on a panel that grows as results come in.
 */
.sua-search__frame {
	position: relative;
	max-width: 660px;
	margin: 70px auto 20px;
	/* Drop-shadow follows the masked silhouette; box-shadow would be clipped
	   away by the mask, since masking happens after the shadow is painted. */
	filter: drop-shadow(0 20px 40px rgba(10, 25, 62, 0.45));
}

.sua-search__box {
	--sua-notch: 20px;
	position: relative;
	background: var(--sua-paper);
	border-top: 3px solid var(--sua-gold);
	font-family: inherit;

	-webkit-mask:
		radial-gradient(circle var(--sua-notch) at 0 0, rgba(0, 0, 0, 0) 98%, #000 100%) top left / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 100% 0, rgba(0, 0, 0, 0) 98%, #000 100%) top right / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 0 100%, rgba(0, 0, 0, 0) 98%, #000 100%) bottom left / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 100% 100%, rgba(0, 0, 0, 0) 98%, #000 100%) bottom right / 51% 51% no-repeat;
	mask:
		radial-gradient(circle var(--sua-notch) at 0 0, rgba(0, 0, 0, 0) 98%, #000 100%) top left / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 100% 0, rgba(0, 0, 0, 0) 98%, #000 100%) top right / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 0 100%, rgba(0, 0, 0, 0) 98%, #000 100%) bottom left / 51% 51% no-repeat,
		radial-gradient(circle var(--sua-notch) at 100% 100%, rgba(0, 0, 0, 0) 98%, #000 100%) bottom right / 51% 51% no-repeat;
}

@media (max-width: 720px) {
	.sua-search__frame {
		margin: 0;
		max-width: none;
		min-height: 100%;
		filter: none;
	}

	/* A full-bleed sheet has no corners to notch. */
	.sua-search__box {
		min-height: 100vh;
		-webkit-mask: none;
		mask: none;
	}
}

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

.sua-search__top {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid var(--sua-rule);
}

.sua-search__icon {
	flex: none;
	color: var(--sua-gold-hot);
}

.sua-search .sua-search__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: none;
	font-size: 22px;
	line-height: 1.3;
	color: var(--sua-ink);
	padding: 2px 0;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.sua-search .sua-search__input:focus {
	outline: none;
	box-shadow: none;
}

.sua-search .sua-search__input::placeholder {
	color: #b9afc0;
}

.sua-search .sua-search__input::-webkit-search-cancel-button {
	display: none;
}

.sua-search__esc {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: var(--sua-muted);
	background: none;
	border: 1px solid var(--sua-rule);
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sua-search__esc:hover,
.sua-search__esc:focus-visible {
	color: var(--sua-plum);
	border-color: var(--sua-plum);
	background: var(--sua-cream);
}

/* Group heading that carries an action on the right. */
.sua-search__group--action {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.sua-search__clear {
	font: inherit;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--sua-muted);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	border-bottom: 1px solid transparent;
}

.sua-search__clear:hover,
.sua-search__clear:focus-visible {
	color: var(--sua-plum);
	border-bottom-color: var(--sua-plum);
	outline: none;
}

/* ----------------------------------------------------------------- results */

.sua-search__body {
	padding: 6px 0 12px;
	max-height: 58vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
	.sua-search__body {
		max-height: calc(100vh - 190px);
	}
}

.sua-search__group {
	margin: 0;
	padding: 14px 20px 6px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--sua-gold);
}

.sua-search .sua-search__hit {
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 9px 20px;
	text-decoration: none;
	color: inherit;
	transition: background 0.12s ease;
}

.sua-search .sua-search__hit:hover,
.sua-search .sua-search__hit.is-active,
.sua-search .sua-search__hit:focus-visible {
	background: var(--sua-cream);
	outline: none;
}

.sua-search__thumb {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 2px;
	overflow: hidden;
	background: var(--sua-parchment);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--sua-plum);
	font-size: 15px;
}

.sua-search__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.sua-search__text {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sua-search__name {
	font-size: 15px;
	color: var(--sua-ink);
	line-height: 1.3;
}

.sua-search__meta {
	font-size: 11.5px;
	color: var(--sua-muted);
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sua-search__go {
	margin-left: auto;
	flex: none;
	font-size: 12px;
	color: var(--sua-plum);
	opacity: 0;
}

.sua-search__hit.is-active .sua-search__go {
	opacity: 1;
}

.sua-search mark {
	background: rgba(237, 169, 25, 0.32);
	color: inherit;
	padding: 0 1px;
}

/* ------------------------------------------------------------------- chips */

.sua-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 4px 20px 16px;
}

.sua-search__chip {
	font: inherit;
	font-size: 13px;
	color: var(--sua-ink-soft);
	background: none;
	border: 1px solid var(--sua-rule);
	padding: 7px 14px;
	border-radius: 100px;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

/* Suggestions backed by a post render as links, so they need the anchor reset. */
.sua-search a.sua-search__chip--link {
	display: inline-block;
	text-decoration: none;
	color: var(--sua-ink-soft);
}

.sua-search__chip:hover,
.sua-search__chip:focus-visible,
.sua-search a.sua-search__chip--link:hover,
.sua-search a.sua-search__chip--link:focus-visible {
	color: var(--sua-plum);
	border-color: var(--sua-plum);
	background: var(--sua-cream);
	outline: none;
}

/* ------------------------------------------------------------ empty, extras */

.sua-search__empty {
	padding: 26px 20px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--sua-muted);
}

.sua-search__empty b {
	color: var(--sua-ink);
	font-weight: 500;
}

/**
 * Footer action.
 *
 * A quiet text link rather than a solid button: this is an aside, not the
 * primary path through the panel. The padding is what keeps it clear of the
 * corner notches — the old full-bleed bar sat flush to the edge and the mask
 * clipped it. Bottom padding must stay above --sua-notch.
 */
.sua-search__foot {
	display: flex;
	padding: 14px 20px 22px;
	border-top: 1px solid var(--sua-rule);
	background: var(--sua-parchment);
}

.sua-search .sua-search__surprise {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: auto;
	flex: 0 0 auto;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	color: var(--sua-plum);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	transition: color 0.15s ease;
}

.sua-search__surprise-text {
	border-bottom: 1px solid transparent;
	transition: border-color 0.15s ease;
}

.sua-search .sua-search__surprise:hover,
.sua-search .sua-search__surprise:focus-visible {
	color: var(--sua-gold-hot);
	outline: none;
}

.sua-search .sua-search__surprise:hover .sua-search__surprise-text,
.sua-search .sua-search__surprise:focus-visible .sua-search__surprise-text {
	border-bottom-color: currentColor;
}

.sua-search__die {
	font-size: 18px;
	line-height: 1;
	color: var(--sua-gold-hot);
	transition: transform 0.25s ease;
}

.sua-search .sua-search__surprise:hover .sua-search__die {
	transform: rotate(-18deg);
}

@media (prefers-reduced-motion: reduce) {
	.sua-search .sua-search__surprise:hover .sua-search__die {
		transform: none;
	}
}

.sua-search__live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Lock the page behind the overlay without losing scroll position. */
html.sua-search-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.sua-search * {
		transition-duration: 0.01ms !important;
	}
}
