/* === Reset & Base === */
*,
*::before,
*::after {
	box-sizing: border-box;
}

:root {
	--navy: #1b3a5c;
	--navy-light: #2a5580;
	--green: #2e7d32;
	--green-light: #e8f5e9;
	--red: #c62828;
	--red-light: #ffebee;
	--gray-100: #f5f7fa;
	--gray-200: #e8ecf1;
	--gray-300: #cdd5de;
	--gray-500: #5a6a7b;
	--gray-700: #3d4f5f;
	--white: #ffffff;
	--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
	--shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
	--radius: 8px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
	margin: 0;
	font-family: var(--font);
	font-size: 1.125rem;
	color: var(--gray-700);
	background: var(--gray-100);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--navy);
}

a:hover {
	color: var(--navy-light);
}

h1,
h2,
h3 {
	color: var(--navy);
	line-height: 1.3;
}

.container {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 1rem;
}

/* === Skip Link === */
.skip-link {
	position: absolute;
	top: -100%;
	left: 1rem;
	background: var(--navy);
	color: var(--white);
	padding: 0.5rem 1rem;
	border-radius: var(--radius);
	z-index: 100;
	text-decoration: none;
}

.skip-link:focus {
	top: 0.5rem;
}

/* === Header === */
.site-header {
	background: var(--navy);
	color: var(--white);
	padding: 1.25rem 0;
}

.site-header .container {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.site-title {
	color: var(--white);
	text-decoration: none;
	font-size: 1.5rem;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.site-title:hover {
	color: var(--gray-200);
}

.site-header nav {
	display: flex;
	gap: 1rem;
}

.site-header nav a {
	color: var(--gray-200);
	text-decoration: none;
	font-size: 0.9rem;
}

.site-header nav a:hover {
	color: var(--white);
}

/* === Site Banner === */
.site-banner {
	background: #fde8e8;
	color: #7f1d1d;
	border-left: 5px solid #dc2626;
	padding: 1rem 0;
	font-size: 1.15rem;
	line-height: 1.5;
}

.site-banner .container {
	position: relative;
	padding-right: 2.5rem;
}

.banner-dismiss {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: #7f1d1d;
	font-size: 1.5rem;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	line-height: 1;
}

/* === Footer === */
.site-footer {
	background: var(--navy);
	color: var(--gray-300);
	padding: 2rem 0;
	margin-top: 3rem;
	font-size: 0.85rem;
	line-height: 1.7;
}

.site-footer a {
	color: var(--gray-200);
}

/* === SR Only === */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* === Home Page === */
.intro {
	font-size: 1.1rem;
	margin: 2rem 0 1.5rem;
	color: var(--gray-700);
}

/* === Controls === */
.controls {
	margin-bottom: 1.5rem;
}

.search-wrap {
	margin-bottom: 1rem;
}

#state-search {
	width: 100%;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	border: 2px solid var(--gray-300);
	border-radius: var(--radius);
	background: var(--white);
	color: var(--gray-700);
	transition: border-color 0.2s;
}

#state-search:focus {
	outline: none;
	border-color: var(--navy);
	box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.15);
}

.filter-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.filter-btn {
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	font-family: var(--font);
	border: 2px solid var(--gray-300);
	border-radius: 2rem;
	background: var(--white);
	color: var(--gray-700);
	cursor: pointer;
	transition: all 0.2s;
	min-height: 44px;
}

.filter-btn:hover {
	border-color: var(--navy);
	color: var(--navy);
}

.filter-btn:focus-visible {
	outline: 2px solid var(--navy);
	outline-offset: 2px;
}

.filter-btn[aria-pressed="true"] {
	background: var(--navy);
	border-color: var(--navy);
	color: var(--white);
}

.result-count {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--navy);
	margin-bottom: 1.25rem;
}

.result-count span {
	font-size: 1.6rem;
}

/* === Card Grid === */
.card-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

/* === State Card === */
.state-card {
	background: var(--white);
	border-radius: var(--radius);
	border: 2px solid var(--gray-300);
	border-left: 5px solid var(--navy);
	box-shadow: var(--shadow-md);
	padding: 1.5rem;
	font-size: 0.95rem;
	transition: box-shadow 0.2s;
}

.state-card:hover {
	box-shadow: var(--shadow-md);
}

.state-card[hidden] {
	display: none;
}

.card-header {
	margin-bottom: 0.75rem;
}

.card-title {
	font-size: 1.35rem;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
}

.card-title a {
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
	text-underline-offset: 0.15em;
}

.card-title a:hover {
	text-decoration: underline;
}

.card-abbr {
	font-size: 0.85rem;
	color: var(--gray-500);
	font-weight: 400;
}

/* === State Flags === */
.state-flag {
	height: 24px;
	width: auto;
	vertical-align: middle;
	margin-right: 0.25rem;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.state-flag-lg {
	height: 40px;
	margin-right: 0.4rem;
}

/* === Badges === */
.card-badges,
.state-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-bottom: 0.75rem;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.25rem 0.65rem;
	border-radius: 2rem;
	font-size: 0.8rem;
	font-weight: 700;
	white-space: nowrap;
}

.badge-yes {
	background: var(--green-light);
	color: var(--green);
}

.badge-no {
	background: var(--gray-200);
	color: var(--gray-700);
}

.badge-caution {
	background: var(--red-light);
	color: var(--red);
}

/* === Card Content === */
.card-deadline {
	font-size: 0.95rem;
	margin: 0 0 0.75rem;
	color: var(--gray-700);
}

.card-details {
	border-top: 1px solid var(--gray-200);
	padding-top: 0.75rem;
}

.card-details dl {
	margin: 0;
}

.card-details dt {
	font-weight: 700;
	color: var(--navy);
	font-size: 0.9rem;
	margin-top: 0.5rem;
}

.card-details dt:first-child {
	margin-top: 0;
}

.card-details dd {
	margin: 0.15rem 0 0;
	font-size: 0.95rem;
	color: var(--gray-700);
}

.card-full-link {
	display: inline-block;
	margin-top: 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
}

/* === State Detail Page === */
.state-detail {
	padding: 2rem 0;
}

.state-detail-header {
	margin-bottom: 2rem;
}

.back-link {
	display: inline-block;
	font-size: 0.9rem;
	margin-bottom: 0.75rem;
	text-decoration: none;
}

.back-link:hover {
	text-decoration: underline;
}

.back-btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	background: var(--navy);
	color: var(--white);
	text-decoration: none;
	border-radius: var(--radius);
	font-size: 0.95rem;
	font-weight: 600;
	margin-bottom: 1rem;
	transition: background 0.2s;
}

.back-btn:hover {
	background: var(--navy-light);
	color: var(--white);
}

.state-detail-header h1 {
	font-size: 2rem;
	margin: 0;
}

.state-abbr {
	color: var(--gray-500);
	font-weight: 400;
}

.state-detail-grid {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

/* === Sidebar === */
.state-sidebar {
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 1.5rem;
	border-left: 4px solid var(--navy);
}

.state-sidebar h2 {
	font-size: 1.15rem;
	margin: 0 0 1rem;
}

.key-facts {
	margin: 0 0 1rem;
}

.key-facts dt {
	font-size: 0.8rem;
	color: var(--gray-500);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin-top: 0.75rem;
}

.key-facts dt:first-child {
	margin-top: 0;
}

.key-facts dd {
	margin: 0.15rem 0 0;
	font-weight: 600;
	color: var(--gray-700);
}

.state-badges {
	margin: 1rem 0;
}

.official-link {
	display: inline-block;
	padding: 0.6rem 1.2rem;
	background: var(--navy);
	color: var(--white);
	text-decoration: none;
	border-radius: var(--radius);
	font-size: 0.9rem;
	font-weight: 600;
	transition: background 0.2s;
	min-height: 44px;
}

.official-link:hover {
	background: var(--navy-light);
	color: var(--white);
}

/* === Main Content Sections === */
.state-main section {
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 1.5rem;
}

.state-main section + section {
	margin-top: 1rem;
}

.state-main h2 {
	font-size: 1.1rem;
	margin: 0 0 0.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--gray-200);
}

.state-main p {
	margin: 0.5rem 0;
}

.state-main ul {
	margin: 0.5rem 0;
	padding-left: 1.25rem;
}

.state-main li {
	margin-bottom: 0.3rem;
}

.method-list {
	list-style: none;
	padding: 0;
}

.method-list li {
	padding: 0.35rem 0;
}

.method-list .available::before {
	content: "\2713 ";
	color: var(--green);
	font-weight: 700;
}

.method-list .unavailable::before {
	content: "\2717 ";
	color: var(--red);
	font-weight: 700;
}

.last-verified {
	font-size: 0.8rem;
	color: var(--gray-500);
	margin-top: 2rem;
}

/* === Tablet: 640px+ === */
@media (min-width: 640px) {
	.card-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.controls {
		display: flex;
		flex-wrap: wrap;
		gap: 1rem;
		align-items: flex-start;
	}

	.search-wrap {
		flex: 1;
		min-width: 250px;
		margin-bottom: 0;
	}

	.filter-buttons {
		flex-shrink: 0;
	}
}

/* === Desktop: 1024px+ === */
@media (min-width: 1024px) {
	.site-header {
		position: sticky;
		top: 0;
		z-index: 100;
	}

	.card-grid {
		grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	}

	.state-detail-header h1 {
		font-size: 2.4rem;
	}

	.state-detail-grid {
		flex-direction: row;
		align-items: flex-start;
	}

	.state-sidebar {
		position: sticky;
		top: 4.5rem;
		flex: 0 0 300px;
		order: -1;
	}

	.state-main {
		flex: 1;
		min-width: 0;
	}
}

/* === About Page === */
.about-content {
	max-width: 860px;
	padding: 2rem 0;
}

.about-content h1 {
	font-size: 2rem;
	margin: 0 0 1.5rem;
}

.about-content section {
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 1.5rem 1.5rem 0.25rem;
	margin-bottom: 0;
}

.about-content section h2 {
	font-size: 1.35rem;
	margin: 0 0 0.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--gray-200);
}

.about-content p {
	margin: 0.5rem 0;
}

.about-content ul {
	margin: 0.5rem 0;
	padding-left: 1.25rem;
}

.about-content li {
	margin-bottom: 0.3rem;
}

.glossary {
	margin: 0;
}

.glossary dt {
	font-weight: 700;
	color: var(--navy);
	margin-top: 1rem;
}

.glossary dt:first-child {
	margin-top: 0;
}

.glossary dd {
	margin: 0.25rem 0 0 0;
	color: var(--gray-600);
	line-height: 1.5;
}

.sources-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 1.05rem;
}

.sources-table th,
.sources-table td {
	text-align: left;
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--gray-200);
}

.sources-table th {
	font-size: 0.9rem;
	color: var(--gray-500);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	background: var(--gray-100);
	position: sticky;
	top: 0;
}

.sources-table td:first-child {
	font-weight: 600;
	white-space: nowrap;
}

.sources-table a {
	font-size: 1rem;
}

.last-updated {
	font-size: 0.8rem;
	color: var(--gray-500);
}

.badge-confidence {
	display: inline-block;
	padding: 0.2rem 0.55rem;
	border-radius: 2rem;
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
}

.badge-high {
	background: var(--green-light);
	color: var(--green);
}

.badge-medium {
	background: #fff3e0;
	color: #e65100;
}

.badge-low {
	background: var(--red-light);
	color: var(--red);
}

.confidence-list {
	list-style: none;
	padding: 0;
}

.confidence-list li {
	padding: 0.4rem 0;
}

/* Responsive: scroll table on small screens */
.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* === Legislation === */
.legislation h2 {
	margin-bottom: 0.75rem;
}

.legislation-pending h2 {
	color: #e65100;
}

.legislation-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.legislation-list li {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--gray-200);
}

.legislation-list li:last-child {
	border-bottom: none;
}

.legislation-list strong {
	color: var(--navy);
	font-size: 0.95rem;
}

.legislation-list > li > span {
	font-size: 0.95rem;
}

.legislation-status {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 2rem;
	font-size: 0.8rem;
	font-weight: 600;
	background: #fff3e0;
	color: #e65100;
	align-self: flex-start;
}

.legislation-pending .legislation-status {
	background: var(--red-light);
	color: var(--red);
}

/* === Recent News === */
.news-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.news-list li {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--gray-200);
}

.news-list li:last-child {
	border-bottom: none;
}

.news-list a {
	font-weight: 600;
	font-size: 0.95rem;
}

.news-meta {
	font-size: 0.8rem;
	color: var(--gray-500);
}

.news-list p {
	margin: 0.2rem 0 0;
	font-size: 0.9rem;
	color: var(--gray-700);
}

.all-news-link {
	display: inline-block;
	margin-top: 0.75rem;
	font-size: 0.9rem;
}

/* === Changes Page === */
#changes-by-state section {
	padding: 0.75rem;
	padding-bottom: 0;
	margin-bottom: 1.5rem;
}

#changes-by-state section h2 {
	margin: 0 0 0.5rem;
}

#changes-by-state .change-list,
#changes-by-date .change-list {
	margin: 0;
}

#changes-by-state .change-list li:last-child,
#changes-by-date .change-list li:last-child {
	padding-bottom: 0;
}

/* By-date accordion */
#changes-by-date .date-group {
	margin-bottom: 1rem;
}

#changes-by-date .date-group summary {
	list-style: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--navy);
	padding: 0.5rem 0;
	user-select: none;
}

#changes-by-date .date-group summary::-webkit-details-marker {
	display: none;
}

#changes-by-date .date-group summary::before {
	content: "+";
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	width: 1.25rem;
	text-align: center;
	flex-shrink: 0;
}

#changes-by-date .date-group[open] summary::before {
	content: "\2212";
}

/* === Changes Page Controls === */
.changes-controls {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.change-state-link {
	flex-shrink: 0;
	font-weight: 600;
	font-size: 0.9rem;
	min-width: 8em;
	text-decoration: none;
}

.change-state-link:hover {
	text-decoration: underline;
}

/* === Change Log: field label === */
.change-list code {
	font-size: 0.8rem;
	padding: 0.2rem 0.5rem;
	border-radius: 3px;
	background: var(--gray-200);
	color: var(--navy);
	font-family: var(--font);
	font-weight: 600;
	white-space: nowrap;
}

/* === Change Log === */
.state-detail > .change-log {
	background: var(--gray-200);
	border-radius: var(--radius);
	padding: 1.5rem;
	margin-top: 1rem;
}

.state-detail > .change-log h2 {
	font-size: 0.95rem;
}

.change-log h2 {
	margin-bottom: 0.75rem;
}

.change-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.change-list li {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.25rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 640px) {
	.change-list li {
		grid-template-columns: 6.5em 14em 1fr;
		gap: 0.75rem;
		align-items: baseline;
	}
}

.change-list li:last-child {
	border-bottom: none;
}

.change-list time,
.change-list .change-state-link {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--gray-500);
}

.change-list span {
	font-size: 0.95rem;
}

/* === Info Popovers === */
.info-btn {
	background: none;
	border: none;
	color: var(--navy);
	cursor: pointer;
	font-size: 0.85em;
	padding: 0 0.15em;
	vertical-align: super;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s;
}

.info-btn:hover {
	opacity: 1;
}

.key-facts dt,
.state-main h2 {
	position: relative;
}

.info-popover {
	display: none;
	position: absolute;
	left: 0;
	top: 100%;
	z-index: 10;
	background: var(--white);
	color: var(--gray-700);
	border: 1px solid var(--gray-300);
	border-radius: var(--radius);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	padding: 0.75rem 1rem;
	font-size: 0.85rem;
	font-weight: 400;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.5;
	width: max-content;
	max-width: min(360px, 90vw);
	margin-top: 0.25rem;
}

.info-popover.active {
	display: block;
}

/* === Focus Styles === */
a:focus-visible,
button:focus-visible,
input:focus-visible {
	outline: 2px solid var(--navy);
	outline-offset: 2px;
}
