/**
 * Glossary: the A to Z, a term's page, and the definition tooltip in articles.
 * The tooltip can appear on any article, so this loads everywhere.
 */

/* The A to Z ---------------------------------------------------------------- */

.bud-glossary-tools {
	position: sticky;
	top: 77px;
	z-index: 20;
	display: grid;
	grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
	gap: 0.75rem 1.5rem;
	align-items: center;
	margin-bottom: 0.5rem;
	padding-block: 0.75rem;
	border-bottom: 1px solid var(--bud-line-strong);
	background: var(--charcoal);
}

.bud-glossary-input {
	width: 100%;
	padding: 0.7rem 1rem;
	border: 0;
	border-radius: 10px;
	background: var(--bud-surface);
	font-size: 1rem;
	color: #fff;
}

.bud-glossary-input:focus {
	outline: 2px solid var(--bud-lime);
}

.bud-letter-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 2px;
}

.bud-letter-nav > * {
	display: grid;
	place-items: center;
	min-width: 2rem;
	height: 2.25rem;
	border-radius: 6px;
	font-size: 0.95rem;
	font-weight: 700;
	text-decoration: none;
}

.bud-letter-nav a {
	color: #fff;
}

.bud-letter-nav a:hover,
.bud-letter-nav a:focus-visible {
	background: var(--bud-lime);
	color: #0b0d0b;
}

.bud-letter-nav span {
	color: #4d564f;
}

.bud-glossary-status {
	grid-column: 1 / -1;
	margin: 0;
	font-size: 0.88rem;
	color: #aeb7af;
}

.bud-glossary-status:empty {
	display: none;
}

.bud-glossary-group {
	padding-block: clamp(1.25rem, 2.5vw, 2rem);
	border-bottom: 1px solid var(--bud-line);
}

.bud-glossary-group[hidden] {
	display: none;
}

/* Clear of the sticky bar when a letter is jumped to. */
.bud-glossary-group h2 {
	margin: 0 0 0.75rem;
	padding: 0;
	border: 0;
	font-family: var(--bud-face);
	font-size: clamp(2.25rem, 3.5vw, 3rem);
	font-weight: 400;
	line-height: 1;
	color: var(--bud-lime);
	scroll-margin-top: 70px;
}

.bud-glossary {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 0.25rem clamp(1.5rem, 3vw, 2.5rem);
	margin: 0;
}

.bud-glossary > div {
	position: relative;
	padding-block: 0.6rem;
}

.bud-glossary > div[hidden] {
	display: none;
}

.bud-glossary dt {
	margin: 0 0 0.15rem;
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.3;
}

.bud-glossary dt a {
	color: #fff;
	text-decoration: none;
}

/* The whole entry is the link. */
.bud-glossary dt a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.bud-glossary > div:hover dt a {
	color: var(--bud-lime);
}

.bud-glossary dd {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	font-size: 0.92rem;
	line-height: 1.4;
	color: #aeb7af;
}

/* A term -------------------------------------------------------------------- */

.bud-term-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: clamp(2rem, 4vw, 3.5rem);
	align-items: start;
	padding-top: clamp(1rem, 2vw, 1.75rem);
}

.bud-term-main {
	min-width: 0;
}

.bud-term-head {
	margin-bottom: 1.75rem;
}

.bud-term-definition {
	max-width: 52rem;
	margin: 0.75rem 0 0;
	font-size: clamp(1.2rem, 2vw, 1.6rem);
	line-height: 1.4;
	color: #fff;
}

.bud-term-also {
	margin: 0.75rem 0 0;
	font-size: 0.95rem;
	color: #aeb7af;
}

.bud-term-main .bud-body {
	max-width: 46rem;
	font-size: 1.0625rem;
	line-height: 1.7;
}

.bud-term-related {
	margin-top: clamp(2rem, 4vw, 3rem);
	padding-top: clamp(1.5rem, 3vw, 2rem);
	border-top: 1px solid var(--bud-line-strong);
}

.bud-term-related h2 {
	margin: 0 0 1rem;
	padding: 0;
	border: 0;
	font-family: var(--bud-face);
	font-size: clamp(1.6rem, 2.4vw, 2rem);
	font-weight: 400;
	line-height: 1.05;
	text-transform: uppercase;
	color: #fff;
}

/* Glossary words in articles ------------------------------------------------ */

.bud-term-tip {
	position: fixed;
	z-index: 1000;
	width: min(320px, calc(100vw - 24px));
	padding: 0.85rem 1rem;
	border-radius: 12px;
	background: #f3f1e8;
	box-shadow: 0 10px 30px rgb(0 0 0 / 45%);
	color: #101510;
}

.bud-term-tip[hidden] {
	display: none;
}

.bud-term-tip strong {
	display: block;
	margin-bottom: 0.2rem;
	font-size: 1rem;
	color: #101510;
}

.bud-term-tip p {
	margin: 0 0 0.5rem;
	font-size: 0.92rem;
	line-height: 1.4;
	color: #2c332d;
}

.bud-term-tip a {
	font-size: 0.86rem;
	font-weight: 700;
	color: #1f6b33;
}

/* Phones -------------------------------------------------------------------- */

@media (max-width: 991px) {
	.bud-term-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 860px) {
	.bud-glossary-tools {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The letters stay one row you can swipe. */
	.bud-letter-nav {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.bud-letter-nav > * {
		flex: none;
		min-width: 2.4rem;
		height: 2.4rem;
	}

	.bud-glossary-group h2 {
		scroll-margin-top: 110px;
	}
}

@media (max-width: 640px) {
	.bud-glossary-tools {
		top: 115px;
	}
}
