/* Search results (#382). The product grid, cards, chips, buttons and the empty panel are the shell's (shell.css);
   the filter panel is the subject page's (category.css, loaded first). This file lays out the page around them: the
   heading, the empty-state form, the curriculum matches, the filters beside the results (#77/#78), the toolbar, the
   filter chips and "Show more". Tokens only (tokens.css). */

.se-h h1 { overflow-wrap: anywhere; }
.se-h p[hidden] { display: none; }

/* ---- the empty state: a search form and ways to browse ---- */
.se-start { display: grid; gap: 28px; max-width: 760px; }
.se-form label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.se-fi { display: flex; gap: 10px; }
.se-fi input {
	flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 1.5px solid var(--field); border-radius: 4px;
	background: var(--white); color: var(--ink); font: inherit; font-size: 1rem;
}
.se-fi input:focus { border-color: var(--roof); outline: 3px solid var(--focus); outline-offset: 2px; }
.se-fi .btn { flex: none; }
.se-start h2 { font-size: 1.4rem; }
.se-browse { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.se-nojs .se-browse { justify-content: center; margin-top: 6px; }

/* ---- curriculum the search names, first ---- */
.se-cur { margin-bottom: 40px; }
.se-cur > h2, .se-tb h2 { font-size: 1.55rem; }
/* One row at every width (#523, family testing: three boxes came before the first product); more scroll sideways. */
.se-cl {
	display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 16px; list-style: none;
	margin: 14px 0 0; padding: 0 0 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
}
.se-c {
	scroll-snap-align: start; position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 16px;
	border: 1.5px solid var(--line); border-radius: 8px; background: var(--white);
}
.se-c:hover, .se-c:focus-within { border-color: var(--roof); }
.se-c .kick { margin: 0; }
.se-c h3 { font: 600 1.15rem/1.3 var(--sans); color: var(--navy); }
.se-c h3 a { color: var(--navy); }
.se-c h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; } /* the whole card opens the curriculum */
.se-cm { font-size: .9rem; color: var(--muted); font-weight: 600; }
.se-cx { font-size: .92rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.se-go { margin-top: auto; padding-top: 8px; color: var(--roof); font-weight: 600; font-size: .92rem; }
.se-go::after { content: " \2192"; }
.se-call { margin-top: 12px; font-weight: 600; }
.se-cn { margin-top: 6px; color: var(--muted); }
.se-cn:empty { display: none; }

/* ---- filters beside the results (#77/#78): shown once a search has products (search.js drops .se-nf) ---- */
.se-b { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
.se-res.se-nf .se-b { grid-template-columns: minmax(0, 1fr); }
.se-res.se-nf .se-fr, .se-res.se-nf .filt-b { display: none; }
/* The panel is a popover for the phone's Filters button; on a wide screen it is a plain sidebar. */
.se-fr[popover] {
	position: static; inset: auto; width: auto; height: auto; margin: 0; padding: 0; border: 0; overflow: visible;
	background: none; color: inherit; display: block;
}
.se-tb .filt-b { margin-left: auto; align-self: center; }
.se-b .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.se-res.se-nf .se-b .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- products ---- */
.se-tb { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.se-tb h2:focus { outline: none; }
.se-tb h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.se-count { color: var(--muted); }
.se-count b { color: var(--navy); font-variant-numeric: tabular-nums; }
.se-act { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.se-act:empty { display: none; }
.se-act button {
	display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px 0 14px; border-radius: 999px;
	border: 0; background: var(--mist-2); color: var(--navy); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
}
.se-act button .ic { width: 15px; height: 15px; }
.se-act button:hover { background: var(--line); }
.se-msg { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 18px; padding: 14px 18px; border-left: 4px solid var(--brick); background: var(--brick-t); border-radius: 4px; }
.se-msg[hidden] { display: none; }
.se-msg p { color: var(--ink); }
.grid[aria-busy="true"]:empty { min-height: 240px; }
.se-ea { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.se-ea [hidden] { display: none; }
.se-more { display: flex; justify-content: center; margin-top: 36px; }
.se-more [hidden] { display: none; }
.se-more .btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
.se-prod .grid[hidden] { display: none; }

@media (max-width: 1100px) {
	.se-b { grid-template-columns: 220px minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 960px) {
	.se-b, .se-res.se-nf .se-b { grid-template-columns: minmax(0, 1fr); }
	.se-b .grid, .se-res.se-nf .se-b .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	/* Closed until the Filters button opens it. A browser without popovers drops both rules below and shows the panel
	   above the results instead (its button hidden: @supports at the end). */
	.se-fr[popover]:not(:popover-open) { display: none; }
	.se-fr:popover-open {
		position: fixed; inset: 12px 12px auto; max-height: calc(100dvh - 24px); overflow: auto; z-index: 60;
		background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 0 20px 20px;
		box-shadow: 0 30px 60px -20px rgba(20, 30, 50, .5);
	}
	.se-fr::backdrop { background: rgba(20, 30, 50, .35); }
}
@supports not selector(:popover-open) {
	.se-tb .filt-b { display: none; }
}

@media (max-width: 560px) {
	.se-cl { grid-auto-columns: 86%; }
	.se-cur > h2, .se-tb h2 { font-size: 1.35rem; }
	.se-fi { flex-direction: column; }
	.se-fi .btn { width: 100%; }
	.se-ea .btn { width: 100%; }
}
