/* ==========================================================================
   Legal by state: the map, the table, and a state's page
   Levels run from bright green (legal) to off-black (illegal).
   ========================================================================== */

.bud-legal {
	--legal-recreational: #3ef06e;
	--legal-medical: #1f9d4d;
	--legal-decriminalized: #1f9d4d;
	--legal-low-thc: #123b24;
	--legal-illegal: #070908;
	--legal-none: #2a2e2b;
}

.bud-legal-swatch {
	display: inline-block;
	flex: none;
	width: 14px;
	height: 14px;
	border-radius: 4px;
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%);
}

.bud-legal-swatch.is-recreational { background: var(--legal-recreational); }
.bud-legal-swatch.is-medical { background: var(--legal-medical); }
.bud-legal-swatch.is-decriminalized { background: repeating-linear-gradient(45deg, #1f9d4d 0 3px, #070908 3px 6px); }
.bud-legal-swatch.is-low-thc { background: var(--legal-low-thc); }
.bud-legal-swatch.is-illegal { background: var(--legal-illegal); }

/* Picker */
.bud-legal-find {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin-bottom: 1.25rem;
}

.bud-legal-find[hidden] {
	display: none;
}

.bud-legal-find label {
	margin: 0;
	font-weight: 700;
	color: #fff;
}

.bud-legal-find select {
	min-width: min(100%, 280px);
	padding: 0.65rem 0.9rem;
	border: 0;
	border-radius: 10px;
	background: var(--bud-surface-elevated);
	font-size: 1rem;
	color: #fff;
}

/* Map */
.bud-legal-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 260px;
	gap: clamp(1rem, 3vw, 2.5rem);
	align-items: center;
	margin-bottom: clamp(2rem, 4vw, 3rem);
	padding: clamp(1rem, 2.5vw, 2rem);
	border-radius: 18px;
	background: var(--bud-surface);
}

.bud-legal-map-wrap {
	position: relative;
	min-width: 0;
}

.bud-legal-map {
	display: block;
	width: 100%;
	max-height: min(66vh, 560px);
}

.bud-map-state path,
.bud-map-state circle {
	stroke: #4a524c;
	stroke-width: 0.75;
	stroke-linejoin: round;
	transition: opacity 0.15s ease;
}

.bud-map-state.is-recreational { fill: var(--legal-recreational); }
.bud-map-state.is-medical { fill: var(--legal-medical); }
.bud-map-state.is-low-thc { fill: var(--legal-low-thc); }
.bud-map-state.is-illegal { fill: var(--legal-illegal); }
.bud-map-state.is-none { fill: var(--legal-none); }

a.bud-map-state:hover path,
a.bud-map-state:hover circle,
a.bud-map-state:focus-visible path,
a.bud-map-state:focus-visible circle {
	stroke: #fff;
	stroke-width: 2;
}

a.bud-map-state {
	outline: 0;
}

.bud-map-state.is-dimmed path,
.bud-map-state.is-dimmed circle {
	opacity: 0.18;
}

.bud-legal-tip {
	position: absolute;
	z-index: 2;
	padding: 0.35rem 0.6rem;
	border-radius: 8px;
	background: #f3f1e8;
	font-size: 0.85rem;
	font-weight: 700;
	white-space: nowrap;
	color: #101510;
	pointer-events: none;
}

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

/* Key, which also filters */
.bud-legal-key {
	display: grid;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bud-legal-key button {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	padding: 0.55rem 0.65rem;
	border: 0;
	border-radius: 10px;
	background: none;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: left;
	color: #fff;
	cursor: pointer;
}

.bud-legal-key button:disabled {
	cursor: default;
}

.bud-legal-key button:not(:disabled):hover,
.bud-legal-key button[aria-pressed="true"] {
	background: var(--bud-surface-elevated);
}

.bud-legal-key span {
	flex: 1;
}

.bud-legal-key em {
	font-style: normal;
	font-weight: 700;
	color: #aeb7af;
}

/* Table */
.bud-legal-overview p {
	max-width: 52rem;
	margin: 0;
}

.bud-legal-overview strong {
	color: #fff;
}

.bud-legal-small {
	margin: 0.5rem 0 0;
	font-size: 0.88rem;
	color: #aeb7af;
}


.bud-legal-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.bud-legal-table th,
.bud-legal-table td {
	padding: 0.6rem 0.75rem;
	border: 0;
	border-bottom: 1px solid var(--bud-line);
	background: none;
	text-align: left;
	color: #dfe4df;
}

.bud-legal-table thead th {
	position: sticky;
	top: var(--bud-table-top, 77px);
	z-index: 5;
	border-bottom: 0;
	background: var(--charcoal);
	box-shadow: inset 0 -2px 0 var(--bud-line-strong);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none;
	color: #fff;
}

.bud-legal-table tbody tr {
	position: relative;
}

.bud-legal-table tbody tr[hidden] {
	display: none;
}

.bud-legal-table tbody tr:hover th,
.bud-legal-table tbody tr:hover td {
	background: var(--bud-surface);
}

.bud-legal-table tbody th {
	font-weight: 700;
}

.bud-legal-table tbody a {
	color: #fff;
	text-decoration: none;
}

/* The whole row is the link. */
.bud-legal-table tbody a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.bud-legal-table tbody tr:hover a {
	color: var(--bud-lime);
}

.bud-legal-status {
	white-space: nowrap;
}

.bud-legal-status .bud-legal-swatch {
	margin-right: 0.5rem;
	vertical-align: -2px;
}

.bud-legal-note {
	max-width: 50rem;
	margin: 1rem 0 0;
	font-size: 0.85rem;
	line-height: 1.5;
	color: #9aa49c;
}

/* A state: lead, infobox, contents, sections */
.bud-legal-state {
	padding-top: clamp(0.75rem, 2vw, 1.25rem);
}

.bud-legal-state-layout {
	display: grid;
	grid-template-columns: minmax(0, 46rem) 20rem;
	grid-template-areas:
		"lead box"
		"main box";
	grid-template-rows: auto 1fr;
	gap: 0 clamp(2rem, 3.5vw, 3rem);
	justify-content: space-between;
}

.bud-legal-state-layout.has-rail {
	grid-template-columns: 12rem minmax(0, 46rem) 20rem;
	grid-template-areas:
		"toc lead box"
		"toc main box";
}

.bud-legal-lead { grid-area: lead; }
.bud-legal-box { grid-area: box; }
.bud-legal-rail { grid-area: toc; }

.bud-legal-main {
	grid-area: main;
	min-width: 0;
}

/* The lead */
.bud-legal-lead {
	padding-bottom: 1.5rem;
}

.bud-legal-lead h1 {
	margin: 0 0 0.85rem;
	font-family: var(--bud-sans);
	font-size: clamp(1.9rem, 3.2vw, 2.6rem);
	font-weight: 800;
	line-height: 1.12;
	letter-spacing: -0.02em;
	text-transform: none;
	color: #fff;
}

.bud-legal-summary {
	margin: 0 0 0.6rem;
	font-size: clamp(1.125rem, 1.5vw, 1.25rem);
	line-height: 1.55;
	color: #f1f3ef;
}

.bud-legal-date {
	margin: 0.75rem 0 0;
	font-size: 0.85rem;
	color: #aeb7af;
}

/* The infobox */
.bud-legal-box {
	align-self: start;
	margin-bottom: 1.5rem;
	padding: 1.1rem 1.15rem 0.6rem;
	border: 1px solid var(--bud-line);
	border-radius: 10px;
	background: var(--bud-surface);
	font-size: 0.92rem;
	line-height: 1.35;
}

.bud-legal-box h2 {
	margin: 0;
	padding: 0;
	border: 0;
	font-family: var(--bud-sans);
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.2;
	text-transform: none;
	color: #fff;
}

.bud-legal-box-status {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0.3rem 0 0.8rem;
	font-weight: 600;
	color: #fff;
}

.bud-legal-box h3 {
	margin: 0.85rem 0 0.35rem;
	font-family: var(--bud-sans);
	font-size: 0.92rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	color: #fff;
}

.bud-legal-box dl {
	margin: 0;
}

.bud-legal-box dl div {
	display: grid;
	grid-template-columns: 7.25rem minmax(0, 1fr);
	gap: 0.75rem;
	padding-block: 0.5rem;
	border-top: 1px solid var(--bud-line);
}

.bud-legal-box dt {
	font-weight: 400;
	color: #aeb7af;
}

.bud-legal-box dd {
	margin: 0;
	font-weight: 600;
	color: #fff;
}

/* The contents */
.bud-legal-rail {
	position: sticky;
	top: 96px;
	align-self: start;
}

.bud-legal-rail h2 {
	margin: 0 0 0.6rem;
	padding: 0;
	border: 0;
	font-family: var(--bud-sans);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	color: #fff;
}

.bud-legal-rail ol,
.bud-legal-toc-phone ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bud-legal-rail a {
	display: block;
	padding: 0.32rem 0 0.32rem 0.7rem;
	border-left: 2px solid var(--bud-line);
	font-size: 0.94rem;
	line-height: 1.3;
	color: #c9d0ca;
	text-decoration: none;
}

.bud-legal-rail a:hover {
	color: #fff;
}

.bud-legal-rail a[aria-current] {
	border-left-color: var(--bud-lime);
	font-weight: 600;
	color: #fff;
}

.bud-legal-toc-phone {
	display: none;
}

/* The sections */
.bud-legal-section {
	margin: 0 0 2.25rem;
	font-size: 1.0625rem;
	line-height: 1.7;
	color: #e4e8e3;
}

.bud-legal-section > h2 {
	margin: 0 0 0.75rem;
	padding: 0 0 0.45rem;
	border: 0;
	border-bottom: 1px solid var(--bud-line-strong);
	font-family: var(--bud-sans);
	font-size: clamp(1.3rem, 2vw, 1.55rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.012em;
	text-transform: none;
	color: #fff;
}

.bud-legal-section h3 {
	margin: 1.15rem 0 0.35rem;
	font-family: var(--bud-sans);
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.3;
	text-transform: none;
	color: #fff;
}

.bud-legal-section p {
	margin: 0 0 0.85rem;
}

.bud-legal-section > p:last-child {
	margin-bottom: 0;
}

.bud-legal-section ul {
	margin: 0;
	padding-left: 1.25rem;
}

.bud-legal-section li {
	margin-bottom: 0.45rem;
}

.bud-legal-qa strong {
	font-weight: 600;
	color: #fff;
}

.bud-legal-qa a,
.bud-legal-law a,
.bud-legal-quoted a {
	color: var(--bud-lime);
}

.bud-legal-quoted {
	margin: 0.85rem 0 0;
	font-size: 0.88rem;
	line-height: 1.5;
	color: #aeb7af;
}

.bud-legal-law {
	font-size: 1rem;
}

.bud-legal-state .bud-body {
	max-width: none;
	font-size: inherit;
	line-height: inherit;
}

/* Sources, folded and small like an article's references */
.bud-legal-sources {
	margin: 0 0 1.25rem;
	border-top: 1px solid var(--bud-line-strong);
	border-bottom: 1px solid var(--bud-line);
	font-size: 0.82rem;
	line-height: 1.45;
	color: #aeb7af;
}

.bud-legal-sources summary {
	padding-block: 0.6rem;
	font-size: 0.92rem;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
}

.bud-legal-sources ol {
	margin: 0 0 0.85rem;
	padding-left: 1.6rem;
	overflow-wrap: anywhere;
}

.bud-legal-sources li {
	margin-bottom: 0.25rem;
}

.bud-legal-sources a {
	color: #dfe4df;
}

.bud-legal-sources a:hover {
	color: var(--bud-lime);
}

.bud-legal-sources span {
	margin-left: 0.3rem;
	color: #8f9a91;
}

.bud-legal-back {
	display: inline-block;
	margin-top: 1rem;
	font-weight: 700;
	color: #fff;
	text-decoration: none;
}

.bud-legal-back:hover {
	color: var(--bud-lime);
}

/* Tall enough to keep the facts in view while reading */
@media (min-width: 1200px) and (min-height: 760px) {
	.bud-legal-box {
		position: sticky;
		top: 96px;
	}
}

/* Too narrow for three columns: the infobox joins the article */
@media (max-width: 1199px) {
	.bud-legal-state-layout {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"lead"
			"box"
			"main";
		grid-template-rows: auto;
	}

	.bud-legal-state-layout.has-rail {
		grid-template-columns: 11rem minmax(0, 1fr);
		grid-template-areas:
			"toc lead"
			"toc box"
			"toc main";
		grid-template-rows: auto auto 1fr;
	}
}

/* Phones and tablets */
@media (max-width: 991px) {
	.bud-legal-panel {
		grid-template-columns: minmax(0, 1fr);
	}

	.bud-legal-state-layout,
	.bud-legal-state-layout.has-rail {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"lead"
			"box"
			"main";
		grid-template-rows: auto;
	}

	.bud-legal-rail {
		display: none;
	}

	.bud-legal-toc-phone {
		display: block;
		margin: 0 0 1.75rem;
		padding: 0.7rem 1.15rem;
		border: 1px solid var(--bud-line);
		border-radius: 10px;
		background: var(--bud-surface);
	}

	.bud-legal-toc-phone summary {
		font-weight: 700;
		color: #fff;
		cursor: pointer;
	}

	.bud-legal-toc-phone ol {
		margin-top: 0.5rem;
	}

	.bud-legal-toc-phone a {
		display: block;
		padding: 0.45rem 0;
		border-top: 1px solid var(--bud-line);
		font-size: 0.98rem;
		line-height: 1.3;
		color: #dfe4df;
		text-decoration: none;
	}

	.bud-legal-key {
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
	}
}

@media (max-width: 700px) {
	.bud-legal-table .is-wide {
		display: none;
	}

	.bud-legal-status {
		white-space: normal;
	}
}
