[data-theme='light'],
:root:not([data-theme='dark']) {
	.capsule {
		color: var(--pico-color-zinc-50);
	}
}

/* Dark color scheme (Auto) */
/* Automatically enabled if user has Dark mode enabled */
@media only screen and (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		.capsule {
			color: var(--pico-color-zinc-700);
		}
	}
}

/* Dark color scheme (Forced) */
/* Enabled if forced with data-theme="dark" */
[data-theme='dark'] {
	.capsule {
		color: var(--pico-color-zinc-700);
	}
}

.capsule {
	border-radius: 200px;
	padding: 0.3em;
	font-size: 70%;
}

dt {
  /* see index.ts */
  margin-top: 0.3em;
}

.card {
	@media (min-width: 640px) {
		/* Center tree, limit width */
		margin: auto;
		max-width: 640px;
	}
}

/** rel=prev copied from pico.min.css to handle banner announcements */
article :is(a, button)[rel='prev'] {
	margin: 0;
	margin-left: var(--pico-spacing);
	padding: 0;
	float: right;
}
article :is(a, button)[rel='prev'] {
	display: block;
	width: 1rem;
	height: 1rem;
	margin-bottom: var(--pico-spacing);
	margin-left: auto;
	border: none;
	background-image: var(--pico-icon-close);
	background-position: center;
	background-size: auto 1rem;
	background-repeat: no-repeat;
	background-color: transparent;
	opacity: 0.5;
	transition: opacity var(--pico-transition);
}
article .close:is([aria-current]:not([aria-current='false']), :hover, :active, :focus),
article :is(a, button)[rel='prev']:is([aria-current]:not([aria-current='false']), :hover, :active, :focus) {
	opacity: 1;
}

.blur {
	color: transparent;
	text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/** ---- */
/** DECISION STRUCTURE  */
/** ---- */

article.decision {
	@media (min-width: 640px) {
		/* Center tree, limit width */
		margin: auto;
		max-width: 640px;
	}

	& blockquote {
		padding-top: 0;
		padding-bottom: 0;
		border-inline-start: none;
		font-size: 0.75em;
	}

	& h2 {
		text-align: center;
	}

	& h1 {
		margin-left: 1em;
		margin-right: 1em;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		/* number of lines to show */
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	& section.footnotes > ol > li {
		font-size: 0.6em;
	}
}

/** ---- */
/** TREE STRUCTURE  */
/** ---- */

article.tree {
	@media (min-width: 640px) {
		/* Center tree, limit width */
		margin: auto;
		max-width: 640px;
	}

	& a.label {
		/* Remove underline from links in the tree */
		text-decoration: none;
	}

	& ul li p {
		/* Adjust paragraph margin top */
		margin-top: 1em;
	}

	& ul {
		padding-left: 0px;
		/* No top-level indention */

		@media (min-width: 640px) {
			& li {
				padding-left: 0.5rem;
				/* Indention if > small screens */
			}

			& li[data-par='true'] {
				padding-left: 0px;
				/* No indention for data-par even if > small screens */
			}
		}
	}

	& li {
		list-style-type: none;
		margin-top: 0.75em;
		margin-bottom: 0.25em;
		padding-left: 0px;
		padding-bottom: 0.25em;

		> p {
			display: inline;
			/* prevent separate line in a <li>...  because display:inline prevents this. */
		}
	}
}

/** ---- */
/** CODIFICATION EVENTS */
/** ---- */

/** Reverses breadcrumbs of tree branch to display single <h2> or <h3> header string */
span.crumbs {
	display: flex;
	flex-direction: row-reverse;
	flex-wrap: wrap-reverse;
	justify-content: center;

	& span:not(:last-child):before {
		content: ', ';
	}
}

[aria-label='Origin'] {
	background-color: var(--pico-color-slate-250);
}

li[data-last-history-action='Unconstitutional'][data-last-history-category='decision'],
li[data-last-history-action='Repealed'],
li[data-last-history-action='Vetoed'] {
	margin: 1em auto;
	border-left: 1rem solid;
	border-left-width: 0.15em;
	border-color: var(--pico-color-pink-500);
}

[aria-label='Unconstitutional'],
[aria-label='Repealed'],
[aria-label='Vetoed'] {
	background-color: var(--pico-color-pink-250);
}

li[data-last-history-action='Modified'],
li[data-last-history-action='Amended'] {
	margin: 1em auto;
	border-left: 1rem solid;
	border-left-width: 0.15em;
	border-color: var(--pico-color-indigo-500);
}
[aria-label='Amended'],
[aria-label='Modified'] {
	background-color: var(--pico-color-indigo-250);
}

li[data-last-history-action='Renumbered'],
li[data-last-history-action='Adopted'],
li[data-last-history-action='Interpreted'][data-last-history-category='statute'] {
	border-color: var(--pico-color-jade-400);
	margin: 1em auto;
	border-left: 1rem solid;
	border-left-width: 0.15em;
}

[aria-label='Renumbered'],
[aria-label='Adopted'] {
	background-color: var(--pico-color-jade-250);
}

li[data-last-history-action='Interpreted'][data-last-history-category='decision'] {
	margin: 1em auto;
	border-left: 1rem solid;
	border-left-width: 0.15em;
	border-color: var(--pico-color-jade-500);
}

li[data-last-history-action='Interpreted'][data-last-history-category='statute'] {
	margin: 1em auto;
	border-left: 1rem solid;
	border-left-width: 0.15em;
	border-color: var(--pico-color-jade-400);
}

[aria-label='Interpreted'] {
	background-color: var(--pico-color-jade-250);
}

section.history-events {
	/* make tree smaller in codification-based htmx requests */
	& article.tree {
		margin-top: 1em;
		background-color: unset;
		font-size: 75%;

		& ul {
			margin-bottom: 0;

			& li {
				margin-top: 0;
			}
		}
	}
}

/** ---- */
/** LINE CLAMPS */
/** See https://codepen.io/jaswrks/pen/mdxOad */

/* Begin required CSS. */
.line-clamp {
	display: block;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	position: relative;

	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	padding: 0 !important;
}
.line-clamp:after {
	content: '...';
	text-align: right;
	bottom: 0;
	right: 0;
	width: 25%;
	display: block;
	position: absolute;
	height: calc(1em * 1.2);
	background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 75%);
}
@supports (-webkit-line-clamp: 1) {
	.line-clamp:after {
		display: none !important;
	}
}
.line-clamp-1 {
	-webkit-line-clamp: 1;
	height: calc(1em * 1.2 * 1);
}
.line-clamp-2 {
	-webkit-line-clamp: 2;
	height: calc(1em * 1.2 * 2);
}
.line-clamp-3 {
	-webkit-line-clamp: 3;
	height: calc(1em * 1.2 * 3);
}
.line-clamp-4 {
	-webkit-line-clamp: 4;
	height: calc(1em * 1.2 * 4);
}
.line-clamp-5 {
	-webkit-line-clamp: 5;
	height: calc(1em * 1.2 * 5);
}
/* End required CSS. */

/** ---- */
/** TOAST */
/** https://web.dev/patterns/components/toast?hl=en#css */
/** ---- */

.gui-toast-group {
	position: fixed;
	z-index: 1;
	inset-block-end: 0;
	inset-inline: 0;
	padding-block-end: 5vh;

	display: grid;
	justify-items: center;
	justify-content: center;
	gap: 1vh;

	/* optimizations */
	pointer-events: none;
}

.gui-toast {
	--_duration: 3s;
	--_bg-lightness: 90%;
	--_travel-distance: 0;

	font-family: system-ui, sans-serif;
	color: black;
	background: hsl(0 0% var(--_bg-lightness) / 90%);

	max-inline-size: min(25ch, 90vw);
	padding-block: 0.5ch;
	padding-inline: 1ch;
	border-radius: 3px;
	font-size: 1rem;

	will-change: transform;
	animation:
		fade-in 0.3s ease,
		slide-in 0.3s ease,
		fade-out 0.3s ease var(--_duration);

	@media (--dark) {
		color: white;
		--_bg-lightness: 20%;
	}

	@media (--motionOK) {
		--_travel-distance: 5vh;
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

@keyframes fade-out {
	to {
		opacity: 0;
	}
}

@keyframes slide-in {
	from {
		transform: translateY(var(--_travel-distance, 10px));
	}
}
