/* Audiobook search block — minimal structural styles. Brand/visual styling
   lives in the theme; these only cover layout + the JS-driven affordances. */

.la-audiobook-search[aria-busy="true"] {
	opacity: 0.6;
}

.la-audiobook-search__form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: stretch;
}

.la-audiobook-search__field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

/* The query field grows to fill the row; the Search button sits beside it. */
.la-audiobook-search__field--query {
	flex: 1 1 20rem;
}

.la-audiobook-search__input {
	width: 100%;
	padding: 0.9rem 1.1rem;
	font-size: 1.0625rem;
	color: var(--wp--preset--color--text);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
}

.la-audiobook-search__input:focus-visible {
	outline: 2px solid var(--wp--preset--color--text);
	outline-offset: 1px;
}

.la-audiobook-search__submit {
	padding: 0.9rem 1.75rem;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent-contrast);
	font-size: 1.0625rem;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}

.la-audiobook-search__submit:hover,
.la-audiobook-search__submit:focus-visible {
	background: var(--wp--preset--color--secondary);
}

/* Quick-filter chips */
.la-audiobook-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 1.25rem;
}

.la-chip {
	padding: 0.5rem 1.1rem;
	color: var(--wp--preset--color--text);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
}

.la-chip:hover {
	border-color: var(--wp--preset--color--text-subtle);
}

.la-chip.is-active {
	color: var(--wp--preset--color--text-on-dark);
	background: var(--wp--preset--color--surface-dark);
	border-color: var(--wp--preset--color--surface-dark);
}

/* Featured top-covers row (placeholder art until the live catalog is wired). */
.la-audiobook-search__featured {
	list-style: none;
	margin: 2rem 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 1.25rem;
}

.la-poster {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.la-poster__cover {
	display: block;
	aspect-ratio: 2 / 3;
	background: var(--wp--preset--color--box);
	border-radius: var(--wp--custom--radius--sm);
}

.la-poster__title {
	font-size: 0.9375rem;
	font-weight: 700;
}

@media (max-width: 781px) {
	.la-audiobook-search__featured { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
	.la-audiobook-search__featured { grid-template-columns: repeat(2, 1fr); }
	.la-audiobook-search__submit { flex: 1 1 100%; }
}

.la-audiobook-search__results {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 1.5rem;
}

.la-audiobook-card {
	display: flex;
	gap: 1rem;
}

.la-audiobook-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.la-audiobook-search__footer {
	margin-top: 1.5rem;
	text-align: center;
}

/* Combobox dropdown (BuildingsFinder). The parent gets .la-has-combobox so the
   absolutely-positioned listbox anchors to the input. */
.la-has-combobox {
	position: relative;
}

.la-audiobook-search__listbox {
	position: absolute;
	z-index: 30;
	left: 0;
	right: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 16rem;
	overflow-y: auto;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0 0 var(--wp--custom--radius--sm) var(--wp--custom--radius--sm);
}

.la-audiobook-search__listbox [role="option"] {
	padding: 0.5rem 0.75rem;
	cursor: pointer;
}

.la-audiobook-search__listbox [role="option"].is-active,
.la-audiobook-search__listbox [role="option"]:hover {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent-contrast);
}

/* =====================================================================
   Unified /search/ refinements (design-panel pass): make the audiobook
   group parallel to the site-results group, give books a book-shaped
   object, and compact the card.
   ===================================================================== */

/* Group heading — mirrors the "From our site" .la-sitesearch__title */
.la-audiobook-search__heading {
	font-family: var(--wp--preset--font-family--serif);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.15;
	color: var(--wp--preset--color--text);
	margin: 2rem 0 1rem;
}

/* Filter chips: content-width, left-aligned, subordinate to the search bar */
.la-audiobook-search__chips { justify-content: flex-start; margin-top: 0.75rem; }
.la-chip { flex: 0 0 auto; padding: 0.4rem 0.9rem; font-size: 0.875rem; }
.la-chip[aria-pressed="true"] {
	color: var(--wp--preset--color--text-on-dark);
	background: var(--wp--preset--color--surface-dark);
	border-color: var(--wp--preset--color--surface-dark);
}

.la-audiobook-search__count { margin: 0.75rem 0 0; font-size: 0.9375rem; color: var(--wp--preset--color--text-subtle); }
.la-audiobook-search__empty { margin: 0.75rem 0 0; font-size: 0.9375rem; color: var(--wp--preset--color--text-subtle); }

/* Results as divider rows (no nested cards), rhythm shared with site results */
.la-audiobook-search__results { gap: 0; margin-top: 0.5rem; }
.la-audiobook-card {
	gap: 1.25rem;
	padding: 1.1rem 0;
	border-top: 1px solid var(--wp--preset--color--border);
	align-items: flex-start;
}

/* Cover: real image or a branded book-shaped placeholder */
.la-audiobook-card__cover { width: 74px; height: 111px; object-fit: cover; border-radius: 6px; flex: none; }
.la-audiobook-card__cover--placeholder {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 74px;
	height: 111px;
	flex: none;
	padding: 8px;
	border-radius: 6px;
	background: var(--wp--preset--color--surface-dark) top right / 130% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 500' fill='none' stroke='%23ffffff' stroke-opacity='0.14' stroke-width='22' stroke-linecap='round'%3E%3Cpath d='M40 60 A 210 210 0 0 1 40 440'/%3E%3Cpath d='M40 120 A 160 160 0 0 1 40 380'/%3E%3C/svg%3E");
	color: var(--wp--preset--color--text-on-dark);
	overflow: hidden;
}
.la-audiobook-card__cover-kicker {
	font-family: var(--wp--preset--font-family--mono, monospace);
	font-size: 0.5rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.75;
}
.la-audiobook-card__cover-title {
	font-family: var(--wp--preset--font-family--serif);
	font-size: 0.625rem;
	font-weight: 700;
	line-height: 1.15;
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.la-audiobook-card__body { gap: 0.15rem; }
.la-audiobook-card__title { margin: 0; font-size: 1.1875rem; line-height: 1.25; }
.la-audiobook-card__title a { color: var(--wp--preset--color--text); text-decoration: none; }
.la-audiobook-card__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.la-audiobook-card__authors { margin: 0.15rem 0 0; color: var(--wp--preset--color--text-subtle); font-size: 0.9375rem; }
.la-audiobook-card__meta {
	margin: 0.3rem 0 0;
	font-family: var(--wp--preset--font-family--mono, monospace);
	font-size: 0.6875rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--teal, #0b5563);
}
.la-audiobook-card__cta {
	display: inline-block;
	margin-top: 0.6rem;
	padding: 0.35rem 0.9rem;
	border: 1.5px solid var(--wp--preset--color--text);
	border-radius: var(--wp--custom--radius--pill);
	color: var(--wp--preset--color--text);
	font-weight: 600;
	font-size: 0.875rem;
	text-decoration: none;
}
.la-audiobook-card__cta:hover,
.la-audiobook-card__cta:focus-visible {
	background: var(--wp--preset--color--text);
	color: var(--wp--preset--color--accent-contrast);
}

/* =====================================================================
   Search design pass (Justin, 7/17): the whole tool sat on the cream
   band with cream inputs/chips — no contrast layering, wireframe feel.
   1. The block becomes a white panel on the cream band.
   2. The form reads as ONE composed control row (input · sort · button).
   3. Landing state: hide the Audiobooks heading + filter chips until
      there are results to filter (cuts the chip-row soup).
   4. Result rows get real object hierarchy: shadowed cover, quieter
      compact CTA.
   ===================================================================== */

.la-audiobook-search {
	background: #fff;
	border: 1px solid var(--wp--preset--color--card-border, #ececec);
	border-radius: 20px;
	padding: clamp(1.25rem, 1rem + 2vw, 2.25rem);
	box-shadow: 0 14px 40px rgba(10, 37, 64, 0.07);
}

/* One control row: white fields with a visible (warm-gray) border on the
   white panel; the sort label is for screen readers only. */
.la-audiobook-search__input,
.la-audiobook-search__field select {
	background: #fff;
	border: 1px solid #d9d1c4;
	border-radius: 12px;
	font: inherit;
	color: var(--wp--preset--color--text);
}
.la-audiobook-search__input { font-size: 1.0625rem; }
.la-audiobook-search__field select { padding: 0.9rem 1rem; height: 100%; cursor: pointer; }
.la-audiobook-search__field label:not(.screen-reader-text) {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.la-audiobook-search__submit { border-radius: var(--wp--custom--radius--pill, 999px); }
.la-audiobook-search__input:focus-visible,
.la-audiobook-search__field select:focus-visible {
	outline: 3px solid var(--wp--preset--color--green, #0f8a47);
	outline-offset: 1px;
}

/* Landing state (no result rows yet): the "Audiobooks" heading has nothing to
   label yet, so hide it until results exist. The browse facets stay put — they
   are how you start browsing, so hiding them is exactly backwards. */
.la-audiobook-search:not(:has(.la-audiobook-card)) .la-audiobook-search__heading {
	display: none;
}

/* Results: stronger object hierarchy on the white panel. */
.la-audiobook-card__cover,
.la-audiobook-card__cover--placeholder {
	border-radius: 8px;
	box-shadow: 0 6px 16px rgba(10, 37, 64, 0.18);
}
.la-audiobook-card__title { font-size: 1.25rem; }
.la-audiobook-card__cta {
	padding: 0.3rem 0.85rem;
	font-size: 0.8125rem;
	border-width: 1px;
	border-color: var(--wp--preset--color--muted, #b9c6d8);
	color: var(--wp--preset--color--text);
}
.la-audiobook-card__cta:hover,
.la-audiobook-card__cta:focus-visible {
	border-color: var(--wp--preset--color--text);
}
.la-audiobook-search__count {
	font-family: var(--wp--preset--font-family--mono, monospace);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* The CTA is a flex child of the stretched card body — without this it
   grows to the widest sibling (long titles made comically wide pills). */
.la-audiobook-card__cta { align-self: flex-start; }

/* =====================================================================
   Tier 2 (7/17): bordered result cards, 2-up on wide screens, bigger
   cover presence.
   The chips used to be hidden here because they were presentational
   placeholders. They now drive the real `category` facet, so the
   display:none is gone.
   ===================================================================== */

.la-audiobook-search__results { gap: 1rem; margin-top: 1rem; }
.la-audiobook-card {
	border: 1px solid var(--wp--preset--color--card-border, #ececec);
	border-radius: 14px;
	padding: 1.1rem 1.25rem;
	background: #fff;
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.la-audiobook-card:hover { box-shadow: 0 10px 22px rgba(10, 37, 64, 0.10); transform: translateY(-2px); }
.la-audiobook-card__body { min-width: 0; }
.la-audiobook-card__cover,
.la-audiobook-card__cover--placeholder { width: 88px; height: 132px; }

@media (min-width: 1080px) {
	.la-audiobook-search__results { grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
}

/* "Popular titles" empty-state module (real curated covers). Hidden via
   data-la-featured once a search runs. */
.la-audiobook-search__poptitles { margin-top: 2.75rem; text-align: center; }
.la-audiobook-search__poptitles-eyebrow {
	margin: 0 auto;
	max-width: none; /* clear the global paragraph readability max-width so centering is true */
	font-family: var(--wp--preset--font-family--mono, monospace);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--teal, #0b5563);
}
.la-audiobook-search__poptitles-title {
	margin: 0.5rem auto 1.9rem;
	max-width: 24ch;
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 700;
	font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem);
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--navy, #08203f);
	text-wrap: balance;
}
.la-audiobook-search__poptitles .la-audiobook-search__featured { margin-top: 0; }
.la-poster__link {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	text-decoration: none;
	color: inherit;
}
.la-poster__img {
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--sm, 6px);
	box-shadow: 0 6px 16px rgba(10, 37, 64, 0.12);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.la-poster__link:hover .la-poster__img { box-shadow: 0 12px 24px rgba(10, 37, 64, 0.20); transform: translateY(-2px); }
.la-poster__link:hover .la-poster__title { text-decoration: underline; text-underline-offset: 3px; }
.la-poster__link:focus-visible { outline: 3px solid var(--wp--preset--color--green, #0f8a47); outline-offset: 3px; border-radius: 8px; }

/* "Load more" — branded outline pill (secondary action, matches the theme's
   is-style-outline buttons: navy border/text, fills navy on hover). */
.la-audiobook-search__load-more {
	padding: 0.8rem 2rem;
	background: transparent;
	border: 1.5px solid var(--wp--preset--color--accent, #08203f);
	border-radius: var(--wp--custom--radius--pill, 999px);
	color: var(--wp--preset--color--accent, #08203f);
	font-family: var(--wp--preset--font-family--sans);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.la-audiobook-search__load-more:hover,
.la-audiobook-search__load-more:focus-visible {
	background: var(--wp--preset--color--accent, #08203f);
	color: var(--wp--preset--color--accent-contrast, #faf4ec);
}
.la-audiobook-search__load-more:focus-visible {
	outline: 3px solid var(--wp--preset--color--green, #0f8a47);
	outline-offset: 3px;
}

/* ---------------------------------------------------------------------------
   Filter row — Grade | Category | Sort by, sitting under the search input.
   Per the 7/27 feedback these are three peer controls on the search bar rather
   than a separate browse panel.
   --------------------------------------------------------------------------- */

.la-audiobook-search__form {
	flex-wrap: wrap;
}

/* The three facets share a row beneath the query field. */
.la-audiobook-search__field:not(.la-audiobook-search__field--query) {
	flex: 1 1 12rem;
	min-width: 0;
}

.la-audiobook-search__field select {
	width: 100%;
}

@media (max-width: 40rem) {
	.la-audiobook-search__field:not(.la-audiobook-search__field--query) {
		flex-basis: 100%;
	}
}

