/* ChugCheck Search 1.0.0
 *
 * Colours come from the dark plugin when it is active (it sets --cc-* on the
 * body), so the search matches the homepage and the drink pages. The fallbacks
 * are only for a site without it.
 */

.ccq,
.ccq-panel {
	--ccq-ground: var(--cc-ground, #12100D);
	--ccq-raised: var(--cc-raised, #1C1915);
	--ccq-ink: var(--cc-ink, #F2EDE4);
	--ccq-dim: var(--cc-dim, #9A9183);
	--ccq-accent: var(--cc-accent, #C9A96A);
	--ccq-line: rgba(233, 231, 227, .12);
}

/* The page around the results. The dark plugin paints the frame; this only
   takes away what the theme adds and the page does not need — its own title
   says "Search" directly above a search field that says so itself. */
body.chugcheck-search-page { background: var(--cc-ground, #12100D); }
body.chugcheck-search-page .entry-header,
body.chugcheck-search-page .ast-single-post-order,
body.chugcheck-search-page .page-header { display: none; }
body.chugcheck-search-page #primary,
body.chugcheck-search-page .ast-article-single { padding-top: 0; margin-top: 0; }

/* The search paints its own ground rather than borrowing the page's.
 *
 * The dark plugin is asked to take the page over, and normally does. But if it
 * is switched off, not installed, or simply has not been told about this page
 * yet, light ink on a white theme is unreadable — the words disappear rather
 * than merely looking wrong. Carrying its own background costs nothing where
 * the plugin is working (the colour is the same) and saves the page where it
 * is not.
 */
.ccq {
	max-width: 1040px;
	margin: 0 auto;
	padding: 28px 22px 56px;
	border-radius: 12px;
	background: var(--cc-ground, #12100D);
	color: var(--ccq-ink);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
}

.ccq *,
.ccq *::before,
.ccq *::after,
.ccq-panel *,
.ccq-panel *::before,
.ccq-panel *::after { box-sizing: border-box; }

.ccq a { color: inherit; text-decoration: none; }

.ccq-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------- field ---- */

.ccq-form {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 5px 5px 18px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ccq-ink) 8%, transparent);
	box-shadow: inset 0 0 0 1px var(--ccq-line);
}
.ccq-form:focus-within { box-shadow: inset 0 0 0 1px var(--ccq-accent); }

.ccq-form__icon { display: flex; color: var(--ccq-dim); flex: 0 0 auto; }

/* The theme styles every input; these have to say so three deep to survive. */
.ccq .ccq-form .ccq-form__input,
.ccq-form .ccq-form__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	outline: 0;
	padding: 15px 0;
	border-radius: 0;
	background: transparent;
	color: var(--ccq-ink);
	font: inherit;
	font-size: 17px;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}
.ccq-form__input::placeholder { color: var(--ccq-dim); opacity: 1; }
.ccq-form__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.ccq .ccq-form .ccq-form__go,
.ccq-form .ccq-form__go {
	flex: 0 0 auto;
	border: 0;
	border-radius: 999px;
	padding: 13px 24px;
	background: var(--ccq-accent);
	color: #17130C;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .04em;
	cursor: pointer;
	text-transform: none;
}
.ccq-form__go:hover { background: color-mix(in srgb, var(--ccq-accent) 80%, #fff); }

/* ---------------------------------------------------------- the list ---- */

/* The homepage's own search box predates this plugin and is not positioned;
   the panel is hung on it, so it has to be. */
.ccq-form--grafted { position: relative; z-index: 50; }

.ccq-panel {
	position: absolute;
	z-index: 40;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	max-height: min(60vh, 460px);
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: 14px;
	background: var(--ccq-raised, #1C1915);
	box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 48px -18px rgba(0, 0, 0, .85);
	color: var(--ccq-ink);
}
.ccq-panel[hidden] { display: none; }
/* Hung outside .ccq on the homepage, so it states its own size. */
.ccq-panel { font-size: 15px; }
@media (min-width: 761px) { .ccq-panel { font-size: 16px; } }

.ccq-list { margin: 0; padding: 6px; list-style: none; }
.ccq-list::before { content: none; }

.ccq-head {
	padding: 12px 12px 5px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ccq-dim);
}
.ccq-head:first-child { padding-top: 6px; }

.ccq-opt { --ccq-thumb: 44px; margin: 0; list-style: none; }
.ccq-opt__link {
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 8px 12px;
	border-radius: 9px;
}
.ccq-opt.is-on .ccq-opt__link { background: color-mix(in srgb, var(--ccq-ink) 10%, transparent); }

.ccq-opt__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccq-opt__name b { font-weight: 700; color: var(--ccq-accent); }
.ccq-opt__meta { flex: 0 0 auto; font-size: 12px; color: var(--ccq-dim); }

.ccq-opt--term .ccq-opt__name { color: var(--ccq-ink); }
.ccq-opt--all .ccq-opt__link { justify-content: center; }
.ccq-opt__all { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ccq-accent); }

.ccq-empty { padding: 16px 12px; color: var(--ccq-dim); font-size: 14px; }

/* --------------------------------------------------------- the page ---- */

.ccq-count {
	margin: 30px 0 6px;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -.01em;
}
.ccq-lede { margin: 22px 0 0; color: var(--ccq-dim); max-width: 60ch; }
.ccq-kick {
	margin: 26px 0 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ccq-dim);
}

.ccq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ccq-chips--filter { margin: 16px 0 22px; }
.ccq-chips--notes { margin-top: 22px; gap: 9px; }
.ccq-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 14px;
	border-radius: 999px;
	font-size: 13px;
	color: var(--ccq-ink);
	box-shadow: inset 0 0 0 1px var(--ccq-line);
	white-space: nowrap;
}
.ccq-chip:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ccq-ink) 35%, transparent); }
.ccq-chip.is-on { background: var(--ccq-accent); color: #17130C; box-shadow: none; }
.ccq-chip__n { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }

.ccq-jumps { display: grid; gap: 8px; margin: 16px 0 0; }
.ccq-jump {
	--ccq-thumb: 40px;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 15px 18px;
	border-radius: 12px;
	background: color-mix(in srgb, var(--ccq-ink) 5%, transparent);
	box-shadow: inset 0 0 0 1px var(--ccq-line);
}
.ccq-jump:hover { box-shadow: inset 0 0 0 1px var(--ccq-accent); }
.ccq-jump__kind {
	flex: 0 0 auto;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ccq-accent);
}
.ccq-jump__name { flex: 1 1 auto; min-width: 0; font-size: 18px; font-weight: 600; }
.ccq-jump__count { flex: 0 0 auto; font-size: 12px; color: var(--ccq-dim); }

.ccq-grid { display: grid; align-items: start; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ccq-grid::before { content: none; }
.ccq-hit { --ccq-thumb: 62px; margin: 0; list-style: none; }
.ccq-hit__link {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 14px;
	border-radius: 12px;
}
.ccq-hit__link:hover { background: color-mix(in srgb, var(--ccq-ink) 7%, transparent); }

/* ------------------------------------------------------- the picture ---- */

/* The same plate everywhere the search shows a drink, at whatever size the
   place around it sets. A cut-out bottle keeps the dark plate it stands on; a
   product photo shot on white keeps the white one, as on the drink pages. */
.ccq-thumb {
	flex: 0 0 auto;
	position: relative;
	display: grid;
	place-items: center;
	width: var(--ccq-thumb, 40px);
	height: var(--ccq-thumb, 40px);
	border-radius: 8px;
	overflow: hidden;
	background: color-mix(in srgb, var(--ccq-ink) 7%, transparent);
	color: var(--ccq-dim);
}
.ccq-thumb.is-round { border-radius: 50%; }
/* Laid over the plate rather than sized by it. A percentage height inside a
   centred grid item resolves to auto, so `height: 100%` left a tall photo
   standing 78px high in a 54px plate — and the plate, which hides what spills,
   cut the bottom off it. That was the cropping. */
.ccq-thumb img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.ccq-thumb.has-photo { background: var(--cc-plate, #fff); }
/* Little inset: a tall bottle in a square plate is small enough already, and
   nothing here is ever cropped to fill. */
.ccq-thumb.has-photo img { padding: 5%; }

/* Notes and producers. */
.ccq-thumb.is-note img { object-fit: cover; }
.ccq-thumb.is-mark img { padding: 12%; }

/* A cut-out has no background of its own, so the niche light is drawn behind
   it — the same warm glow the shelf gives it, at a twentieth of the size. */
.ccq-thumb.has-cutout {
	background:
		radial-gradient(70% 55% at 50% 100%, color-mix(in srgb, var(--ccq-c, #C9A96A) 42%, transparent), transparent 72%),
		#1A1611;
}
.ccq-thumb.has-cutout img { padding: 8% 16% 6%; }

.ccq-thumb.is-drawn {
	background:
		radial-gradient(70% 55% at 50% 100%, color-mix(in srgb, var(--ccq-c, #C9A96A) 34%, transparent), transparent 75%),
		color-mix(in srgb, var(--ccq-ink) 6%, transparent);
}
.ccq-shape {
	display: block;
	height: 66%;
	width: auto;
	fill: #0B0A09;
	stroke: color-mix(in srgb, var(--ccq-c, #C9A96A) 60%, #fff);
	stroke-width: 1.4;
}
.ccq-thumb.is-letter { font-size: 16px; font-weight: 700; }

.ccq-hit__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ccq-hit__name { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ccq-hit__meta { font-size: 13px; color: var(--ccq-dim); }
.ccq-hit__why { font-size: 13px; color: var(--ccq-accent); }

.ccq-pages { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 28px; font-size: 13px; }
.ccq-page { color: var(--ccq-accent); font-weight: 600; }
.ccq-page__of { color: var(--ccq-dim); }

@media (min-width: 761px) {
	.ccq { font-size: 17px; }
	.ccq-count { font-size: 30px; margin-top: 38px; }
	.ccq-hit { --ccq-thumb: 68px; }
	.ccq-hit__name { font-size: 18px; }
	.ccq-jump__name { font-size: 19px; }
	.ccq-form__input { padding: 17px 0; font-size: 18px; }
	.ccq-form__go { padding: 15px 28px; }
	.ccq-grid { grid-template-columns: 1fr 1fr; gap: 4px 20px; }
	.ccq-jumps { grid-template-columns: 1fr 1fr; }
}
