/* ChugCheck Notes — the directory.
 *
 * Colours come from the dark plugin when it is active (it sets --cc-* on the
 * body), so this page matches the search page it is drawn inside and the drink
 * pages the badges come from. The fallbacks are for a site without it.
 *
 * The badge itself is frontend.css's, shared with every drink page. What this
 * file does is give it a dark ground to stand on and lay the families out;
 * redrawing the badge here would be a second drawing of the same note. */

.ccn-index {
	--ccn-ink: var(--cc-ink, #F2EDE4);
	--ccn-dim: var(--cc-dim, #9A9183);
	--ccn-accent: var(--cc-accent, #C9A96A);
	--ccn-line: rgba(233, 231, 227, .12);

	/* The badge's own three, remapped. They are declared on
	   .chugcheck-notes-display, which is not an ancestor here, so without
	   this the circle's background resolves to nothing and every note that
	   has no picture becomes an invisible letter. */
	--chugcheck-notes-ink: var(--ccn-ink);
	--chugcheck-notes-ink-soft: var(--ccn-dim);
	--chugcheck-notes-bg: color-mix(in srgb, var(--ccn-ink) 8%, transparent);

	max-width: 1040px;
	margin: 0 auto;
	color: var(--ccn-ink);
	font-size: 16px;
	line-height: 1.5;
}

.ccn-index *,
.ccn-index *::before,
.ccn-index *::after { box-sizing: border-box; }

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

.ccn-index__count {
	margin: 0;
	font-size: clamp(26px, 4vw, 38px);
	font-weight: 800;
	letter-spacing: -.028em;
	line-height: 1.05;
}

.ccn-index__lede {
	margin: 10px 0 0;
	max-width: 56ch;
	font-size: 15px;
	color: var(--ccn-dim);
}

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

.ccn-index__find { margin: 22px 0 0; }

.ccn-index__input {
	width: 100%;
	max-width: 380px;
	padding: 11px 16px;
	border: 0;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ccn-ink) 6%, transparent);
	box-shadow: inset 0 0 0 1px var(--ccn-line);
	color: var(--ccn-ink);
	font: inherit;
	font-size: 15px;
}
.ccn-index__input::placeholder { color: var(--ccn-dim); }
.ccn-index__input:focus {
	outline: 0;
	box-shadow: inset 0 0 0 1px var(--ccn-accent);
}

.ccn-index__none { margin: 26px 0 0; color: var(--ccn-dim); }

/* ------------------------------------------------------------- a family -- */

.ccn-fam { margin: 38px 0 0; }

/* The name and the number are one statement, so they sit on one line and the
   number is quiet. It counts NOTES: a sum of the counts under it would
   double-count any drink carrying two notes from the same family. */
.ccn-fam__h {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0 10px;
	margin: 0 0 18px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--ccn-line);
	font-size: 19px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--ccn-ink);
}
.ccn-fam__n {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ccn-dim);
}

/* Columns rather than a flex run.
 *
 * frontend.css lays the drink page's badges out with flex and
 * justify-content: center, which is right for three or four of them under a
 * heading. Ninety of them that way comes out as ragged centred rows with a
 * different last line per family -- the wall the flat chip list already was.
 * A grid gives one set of columns down the whole page, so the eye can read
 * down a family as easily as across it. */
.ccn-fam__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 26px 12px;
	align-items: start;
}

/* The badge, on a dark ground.
 *
 * Only what has to change: the width, because a fixed 96px inside a grid cell
 * leaves every badge adrift at the left of its column, and the shadow, which
 * is a near-black on white in frontend.css and simply does not exist here. */
.ccn-index .chugcheck-note-badge {
	width: auto;
	gap: 9px;
	padding: 0 2px;
}
.ccn-index .chugcheck-note-badge__circle {
	width: 76px;
	height: 76px;
	box-shadow: inset 0 0 0 1px var(--ccn-line);
	transition: transform .18s cubic-bezier(.22, 1, .36, 1), box-shadow .18s ease;
}
.ccn-index .chugcheck-note-badge:hover .chugcheck-note-badge__circle {
	transform: translateY(-3px);
	box-shadow: inset 0 0 0 1px var(--ccn-accent);
}
.ccn-index .chugcheck-note-badge__initial {
	font-size: 25px;
	color: var(--ccn-dim);
}
.ccn-index .chugcheck-note-badge__name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	color: var(--ccn-ink);
}
.ccn-index .chugcheck-note-badge:hover .chugcheck-note-badge__name { color: var(--ccn-accent); }

/* How many drinks carry this note. Quiet on purpose: it is the answer to a
   question the reader has not asked yet, and the name is the one they came
   for. */
.ccn-index .chugcheck-note-badge__n {
	margin-top: -4px;
	font-size: 11px;
	color: var(--ccn-dim);
	font-variant-numeric: tabular-nums;
}

.ccn-index [hidden] { display: none !important; }

/* Four across on a phone, not three.
 *
 * 84px columns measured as three, which made a hundred and fifty notes a
 * nine-thousand-pixel page with a third of each row empty. 68px is the widest
 * minimum that still divides into four inside the search page's padding, and
 * the circle comes down with it so the badge stays a circle with a name under
 * it rather than a name with a dot over it. */
@media (max-width: 700px) {
	.ccn-fam { margin-top: 30px; }
	.ccn-fam__grid {
		grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
		gap: 20px 8px;
	}
	.ccn-index .chugcheck-note-badge { gap: 7px; padding: 0; }
	.ccn-index .chugcheck-note-badge__circle { width: 58px; height: 58px; }
	.ccn-index .chugcheck-note-badge__initial { font-size: 19px; }
	.ccn-index .chugcheck-note-badge__name { font-size: 11.5px; }
	.ccn-index .chugcheck-note-badge__n { font-size: 10.5px; }
}
