/**
 * MAS Core - function search.
 *
 * Retuned 2026-09-08 for the Industry design on a light ground. Colours come
 * from mas-tokens.css; nothing here reads the Kadence palette, because the
 * palette still holds the old dark-theme values (see mas-tokens.css).
 *
 * The mockup's formula reference (screen 1e) is a table with a sticky detail
 * panel. This is still the card grid; what changed is the surface treatment —
 * square corners, hairline frames, one accent — so it reads as the same system.
 */

.mas-fn-search {
	color: var(--mas-ink);
}

.mas-fn-search *,
.mas-fn-search *::before,
.mas-fn-search *::after {
	box-sizing: border-box;
}

/* Filter row. */

.mas-fn-search__field {
	margin-bottom: var(--mas-gap-tight);
}

.mas-fn-search__label {
	display: block;
	margin-bottom: 0.4rem;
	color: var(--mas-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.mas-fn-search__input {
	width: 100%;
	max-width: 340px;
	min-height: 42px;
	padding: 8px 12px;
	border: 1px solid var(--mas-rule);
	border-radius: var(--mas-radius-input);
	background-color: var(--mas-surface);
	color: var(--mas-ink);
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	caret-color: var(--mas-accent);
}

.mas-fn-search__input::placeholder {
	color: var(--mas-faint);
}

.mas-fn-search__input:hover {
	border-color: rgba(15, 23, 42, 0.45);
}

.mas-fn-search__input:focus-visible {
	border-color: var(--mas-accent);
	outline: 2px solid var(--mas-accent);
	outline-offset: 2px;
}

/*
 * Category chips. The mockup uses a segmented control — one bar, hairline
 * dividers, the selected segment filled with the accent. These are separate
 * buttons, so they keep their own frames but take the same square, hairline,
 * single-accent treatment.
 */

.mas-fn-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	margin-bottom: var(--mas-gap-tight);
	border: 1px solid var(--mas-rule);
	border-radius: var(--mas-radius-input);
	overflow: hidden;
	width: fit-content;
	max-width: 100%;
}

.mas-fn-chip {
	padding: 7px 12px;
	border: 0;
	border-left: 1px solid var(--mas-rule);
	border-radius: 0;
	background-color: transparent;
	color: var(--mas-ink);
	font: inherit;
	font-size: 13px;
	line-height: 1.4;
	cursor: pointer;
}

.mas-fn-chip:first-child {
	border-left: 0;
}

.mas-fn-chip:hover {
	background-color: rgba(15, 23, 42, 0.07);
}

.mas-fn-chip:focus-visible {
	outline: 2px solid var(--mas-accent);
	outline-offset: -2px;
}

.mas-fn-chip.is-active {
	background-color: var(--mas-accent);
	color: var(--mas-paper);
}

/* Result count. Reads as meta, not as body copy. */

.mas-fn-search__count {
	margin: 0 0 var(--mas-gap-tight);
	color: var(--mas-muted);
	font-size: 13px;
}

/* Card grid. */

/* minmax(0, 1fr), not 1fr: a bare 1fr track grows to the longest unbroken
   syntax line (white-space: pre), which pushed phone cards to ~1,400px. */
.mas-fn-search__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--mas-gap);
}

@media (min-width: 600px) {
	.mas-fn-search__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.mas-fn-search__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/*
 * The card is a transparent line drawing: square, hairline, no fill, no shadow,
 * with "+" registration marks 6px outside each corner. The marks are drawn as
 * background layers on one overlay pseudo-element, so no extra markup is needed
 * — eight gradients, a 1px bar and an 11px bar for each of the four corners.
 */
.mas-fn-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: var(--mas-card-padding);
	border: 1px solid var(--mas-rule);
	border-radius: var(--mas-radius);
	background-color: transparent;
	color: var(--mas-ink);
	height: 100%;
}

.mas-fn-card::after,
.mas-model-card::after,
.mas-play-card::after {
	content: "";
	position: absolute;
	inset: -6px;
	pointer-events: none;
	background-repeat: no-repeat;
	background-image:
		linear-gradient(rgba(15, 23, 42, 0.55) 0 0), linear-gradient(rgba(15, 23, 42, 0.55) 0 0),
		linear-gradient(rgba(15, 23, 42, 0.55) 0 0), linear-gradient(rgba(15, 23, 42, 0.55) 0 0),
		linear-gradient(rgba(15, 23, 42, 0.55) 0 0), linear-gradient(rgba(15, 23, 42, 0.55) 0 0),
		linear-gradient(rgba(15, 23, 42, 0.55) 0 0), linear-gradient(rgba(15, 23, 42, 0.55) 0 0);
	background-size:
		1px 11px, 11px 1px,
		1px 11px, 11px 1px,
		1px 11px, 11px 1px,
		1px 11px, 11px 1px;
	background-position:
		left 5px top 0, left 0 top 5px,
		right 5px top 0, right 0 top 5px,
		left 5px bottom 0, left 0 bottom 5px,
		right 5px bottom 0, right 0 bottom 5px;
}

.mas-fn-card__title {
	margin: 0;
	color: var(--mas-ink);
	font-size: 19px;
	line-height: 1.2;
}

.mas-fn-card__link {
	color: inherit;
	text-decoration: none;
}

.mas-fn-card__link:hover,
.mas-fn-card__link:focus-visible {
	color: var(--mas-accent);
}

.mas-fn-card__link:focus-visible {
	outline: 2px solid var(--mas-accent);
	outline-offset: 2px;
}

/* The signature, set as a formula rather than as a code block. */
.mas-fn-card__syntax {
	display: block;
	overflow-x: auto;
	margin: 0;
	padding: 6px 8px;
	border-radius: 0;
	background-color: var(--mas-rule-soft);
	color: var(--mas-ink);
	font-family: var(--mas-mono);
	font-size: 13px;
	line-height: 1.5;
	white-space: pre;
}

.mas-fn-card__description {
	margin: 0;
	color: var(--mas-ink);
	font-size: 14px;
	line-height: 1.5;
}

/* Category tag: accent-100 fill, accent-800 text, square. */
.mas-fn-card__badge {
	align-self: flex-start;
	margin-top: auto;
	padding: 3px 10px;
	border: 0;
	border-radius: 0;
	background-color: var(--mas-accent-100);
	color: var(--mas-accent-800);
	font-size: 11px;
	letter-spacing: 0.02em;
}

/* States. */

.mas-fn-search__message {
	margin: 0;
	padding: var(--mas-card-padding);
	border: 1px dashed var(--mas-rule);
	border-radius: var(--mas-radius);
	color: var(--mas-muted);
}

.mas-fn-search__noscript {
	margin: 0;
	color: var(--mas-muted);
}
