/*
 * Pippin State Finder. Copy on the left (intro, the type / map switch, the field or the map guide), the picture or the
 * tile map on the right. Colours and type follow the Kit globals; the map shades are widget settings (Style tab).
 * data-mode on .pt-states says which way is showing: "type" (field + picture) or "map" (guide + map).
 */
.pt-states {
	--pt-s-text: var(--e-global-color-text, #22294e);
	--pt-s-muted: var(--e-global-color-e4427e8, #757575);
	--pt-s-border: var(--e-global-color-b0de001, #d9d9d9);
	--pt-s-accent: var(--e-global-color-accent, #d83040);
	--pt-s-dark: var(--e-global-color-3fbeb61, #0f1328);
	--pt-s-surface: var(--e-global-color-5f0ace0, #fff);
	--pt-s-panel: var(--e-global-color-5f0ace0, #fff);
	--pt-s-shade-1: #c2eafc;
	--pt-s-shade-2: #76d0f4;
	--pt-s-shade-3: #37aada;
	--pt-s-shade-4: #147298;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 580px);
	align-items: center;
	gap: var(--pt-section-sm, 64px);
	color: var(--pt-s-text);
}

/* Copy */
.pt-states__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 32px;
	min-width: 0;
}
.pt-states__intro {
	display: flex;
	flex-direction: column;
	gap: var(--pt-section-xs, 16px);
}
.pt-states .pt-states__eyebrow {
	margin: 0;
	color: var(--e-global-color-5ab0001, #d83040);
	font-family: var(--e-global-typography-5ab0d00-font-family), sans-serif;
	font-size: var(--e-global-typography-5ab0d00-font-size, 0.875rem);
	font-weight: var(--e-global-typography-5ab0d00-font-weight, 700);
	line-height: var(--e-global-typography-5ab0d00-line-height, 1.4);
	letter-spacing: var(--e-global-typography-5ab0d00-letter-spacing, 0.16em);
	text-transform: uppercase;
}
.pt-states .pt-states__title {
	margin: 0;
	color: var(--pt-s-text);
}
.pt-states .pt-states__lead {
	margin: 0;
	color: var(--pt-s-muted);
	font-size: var(--e-global-typography-3bc6d1e-font-size, 1.5rem);
	line-height: var(--e-global-typography-3bc6d1e-line-height, 1.4);
	letter-spacing: var(--e-global-typography-3bc6d1e-letter-spacing, -0.019em);
}

/* The type / map switch */
.pt-states__switch {
	display: inline-flex;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--pt-s-border);
	border-radius: 999px;
	background: var(--pt-s-surface);
}
.pt-states__switch[hidden] {
	display: none;
}
.pt-states .pt-states__way,
.pt-states .pt-states__way:is(:hover, :focus, :active) {
	min-height: 0;
	margin: 0;
	padding: 8px 18px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: var(--pt-s-text);
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}
.pt-states .pt-states__way:hover {
	background: var(--e-global-color-5ec0003, #f5fbfe);
}
.pt-states .pt-states__way[aria-pressed="true"] {
	background: var(--pt-s-dark);
	color: var(--e-global-color-836a0d3, #fff);
}
.pt-states .pt-states__way:focus-visible {
	outline: 2px solid var(--e-global-color-primary, #37aada);
	outline-offset: 2px;
}

/* Type a state */
.pt-states__finder {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px 16px;
	width: 100%;
	margin: 0;
}
.pt-states__field {
	display: flex;
	flex: 1 1 220px;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.pt-states .pt-states__label {
	margin: 0;
	color: var(--pt-s-text);
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.4;
}
.pt-states__combo {
	position: relative;
}
.pt-states .pt-states__input {
	width: 100%;
	height: auto;
	margin: 0;
	padding: 8px 12px;
	border: 2px solid var(--pt-s-border);
	border-radius: 8px;
	background: var(--pt-s-surface);
	box-shadow: none;
	color: var(--pt-s-text);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: -0.011em;
}
.pt-states .pt-states__input::placeholder {
	color: var(--pt-s-text);
	opacity: 1;
}
.pt-states .pt-states__input:focus {
	border-color: var(--e-global-color-primary, #37aada);
	outline: none;
}
.pt-states .pt-states__input:focus::placeholder {
	color: var(--pt-s-muted);
}
.pt-states__list {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	max-height: 288px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	border: 1px solid var(--pt-s-border);
	border-radius: 8px;
	background: var(--pt-s-surface);
	box-shadow: 0 12px 32px rgba(15, 19, 40, 0.12);
	list-style: none;
}
.pt-states__list[hidden] {
	display: none;
}
.pt-states__option {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	padding: 8px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}
.pt-states__option small {
	overflow: hidden;
	color: var(--pt-s-muted);
	font-size: 0.8125rem;
	font-weight: 400;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pt-states__option mark {
	background: none;
	color: var(--pt-s-accent);
}
.pt-states__option.is-active,
.pt-states__option:hover {
	background: var(--e-global-color-5ec0003, #f5fbfe);
}
.pt-states__empty {
	padding: 8px 10px;
	color: var(--pt-s-muted);
	font-size: 0.875rem;
}
.pt-states .pt-states__go,
.pt-states .pt-states__go:is(:hover, :focus, :active) {
	flex: none;
	min-height: 0;
	margin: 0;
	padding: 13px 40px;
	border: 0;
	border-radius: 999px;
	background: var(--pt-s-dark);
	box-shadow: none;
	color: var(--e-global-color-836a0d3, #fff);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: opacity 0.2s ease;
}
.pt-states .pt-states__go:hover {
	opacity: 0.88;
}
.pt-states .pt-states__go:focus-visible {
	outline: 2px solid var(--e-global-color-primary, #37aada);
	outline-offset: 2px;
}
.pt-states .pt-states__error {
	flex-basis: 100%;
	margin: 0;
	color: var(--pt-s-accent);
	font-size: 0.875rem;
	line-height: 1.4;
}
.pt-states .pt-states__error:empty {
	display: none;
}

/* Map guide: the hint and the legend */
.pt-states__guide {
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.pt-states .pt-states__hint {
	margin: 0;
	color: var(--pt-s-text);
	font-size: 1rem;
	line-height: 1.5;
}
.pt-states .pt-states__legend-title {
	margin: 0 0 8px;
	color: var(--pt-s-muted);
	font-size: 0.875rem;
	font-style: italic;
	line-height: 1.4;
}
.pt-states__legend ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.pt-states__legend li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
}
.pt-states__swatch {
	width: 18px;
	height: 18px;
	border-radius: 4px;
}
.pt-states__shade-1 {
	background: var(--pt-s-shade-1);
}
.pt-states__shade-2 {
	background: var(--pt-s-shade-2);
}
.pt-states__shade-3 {
	background: var(--pt-s-shade-3);
}
.pt-states__shade-4 {
	background: var(--pt-s-shade-4);
}

.pt-states .pt-states__browse {
	color: var(--e-global-color-11a0001, #d83040);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}
.pt-states .pt-states__browse:hover {
	color: var(--e-global-color-11a0002, #54bde9);
}
.pt-states__browse:hover .pt-arrow {
	transform: translateX(3px);
}

/* Arrow (same as the Insights widget's, so the link works on pages without it). */
.pt-states .pt-arrow {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	margin-left: 8px;
	vertical-align: -0.1em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8h11M9 3.5 13.5 8 9 12.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8h11M9 3.5 13.5 8 9 12.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.2s ease;
}

/* Panel: the picture or the map */
.pt-states__panel {
	position: relative;
	min-width: 0;
	height: 440px;
	overflow: hidden;
	border-radius: 30px;
	background: var(--e-global-color-5f0ace1, #fafafa);
}
.pt-states__media,
.pt-states__media img {
	display: block;
	width: 100%;
	height: 100%;
}
.pt-states__media img {
	object-fit: cover;
}
.pt-states__map {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 32px;
	background: var(--pt-s-panel);
}
.pt-states__grid {
	display: grid;
	grid-template-columns: repeat(11, minmax(0, 1fr));
	grid-template-rows: repeat(8, auto);
	gap: 6px;
	width: 100%;
	max-width: 520px;
}
.pt-states .pt-states__tile {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	grid-column: var(--col);
	grid-row: var(--row);
	aspect-ratio: 1;
	min-width: 0;
	border-radius: 6px;
	color: var(--pt-s-dark);
	line-height: 1.1;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pt-states .pt-states__tile:is(:hover, :focus, :active) {
	color: var(--pt-s-dark);
}
.pt-states .pt-states__tile.pt-states__shade-4,
.pt-states .pt-states__tile.pt-states__shade-4:is(:hover, :focus, :active) {
	color: var(--e-global-color-836a0d3, #fff);
}
.pt-states__abbr {
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: -0.006em;
}
.pt-states__years {
	font-size: 0.6875rem;
	font-weight: 400;
}
.pt-states .pt-states__tile:hover,
.pt-states .pt-states__tile.is-current {
	z-index: 2;
	box-shadow: 0 0 0 2px var(--pt-s-dark);
	transform: scale(1.08);
}
.pt-states .pt-states__tile:focus {
	outline: none;
}
.pt-states .pt-states__tile:focus-visible {
	z-index: 2;
	box-shadow: 0 0 0 2px var(--pt-s-surface), 0 0 0 4px var(--pt-s-dark);
	transform: scale(1.08);
}
.pt-states .pt-states__tile.is-selected {
	box-shadow: 0 0 0 2px var(--pt-s-surface), 0 0 0 4px var(--pt-s-accent);
}

/* The hover card */
.pt-states__card {
	position: absolute;
	z-index: 5;
	top: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 240px;
	padding: 14px 16px;
	border: 1px solid var(--pt-s-border);
	border-radius: 12px;
	background: var(--pt-s-surface);
	box-shadow: 0 12px 32px rgba(15, 19, 40, 0.14);
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.pt-states__card[hidden] {
	display: none;
}
.pt-states__card.is-shown {
	opacity: 1;
	transform: none;
}
.pt-states__card.is-pinned {
	pointer-events: auto;
}
.pt-states .pt-states__card p {
	margin: 0;
	line-height: 1.35;
}
.pt-states .pt-states__card-name {
	color: var(--pt-s-text);
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: -0.014em;
}
.pt-states .pt-states__card-nick {
	color: var(--pt-s-muted);
	font-size: 0.875rem;
}
.pt-states .pt-states__card-years {
	margin-top: 6px;
	color: var(--pt-s-text);
	font-size: 0.875rem;
	font-weight: 600;
}
.pt-states .pt-states__card-cta {
	margin-top: 8px;
	color: var(--e-global-color-11a0001, #d83040);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
}

/* Which way is showing (the switch appears once the script runs; without it, both the field and the picture show). */
.pt-states__guide,
.pt-states__map {
	display: none;
}
.pt-states[data-mode="map"].is-ready .pt-states__finder,
.pt-states[data-mode="map"].is-ready .pt-states__media {
	display: none;
}
.pt-states[data-mode="map"].is-ready .pt-states__guide {
	display: flex;
}
.pt-states[data-mode="map"].is-ready .pt-states__map {
	display: flex;
}
.pt-states.is-ready .pt-states__panel {
	animation: pt-states-fade 0.3s ease;
}
@keyframes pt-states-fade {
	from {
		opacity: 0.4;
	}
}

/* ---- Browse all states (the all-states page) ---- */
.pt-states .pt-states__tile {
	transition-property: background-color, color, opacity, transform, box-shadow;
}
.pt-states .pt-states__tile.is-dim {
	opacity: 0.22;
}
.pt-states__browse-all {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding-top: var(--pt-section-xs, 40px);
	border-top: 1px solid rgba(15, 19, 40, 0.1);
	scroll-margin-top: 120px;
}
.pt-states__browse-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 24px;
}
.pt-states .pt-states__browse-title {
	flex-basis: 100%;
	margin: 0;
	color: var(--pt-s-text);
}
.pt-states__regions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.pt-states .pt-states__region,
.pt-states .pt-states__region:hover,
.pt-states .pt-states__region:focus {
	margin: 0;
	padding: 8px 16px;
	border: 1.5px solid var(--pt-s-border);
	border-radius: 999px;
	background: var(--pt-s-surface);
	box-shadow: none;
	color: var(--pt-s-text);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pt-states .pt-states__region:hover {
	border-color: var(--pt-s-shade-2);
}
.pt-states .pt-states__region[aria-pressed="true"] {
	border-color: var(--pt-s-dark);
	background: var(--pt-s-dark);
	color: #fff;
}
.pt-states .pt-states__region:focus-visible {
	outline: 2px solid var(--pt-s-shade-3);
	outline-offset: 2px;
}
.pt-states .pt-states__count {
	margin: 0 0 0 auto;
	color: var(--pt-s-muted);
	font-size: 0.875rem;
}
.pt-states__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.pt-states__item {
	margin: 0;
}
.pt-states__item[hidden] {
	display: none;
}
.pt-states .pt-states__item-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border: 1px solid rgba(15, 19, 40, 0.08);
	border-radius: 16px;
	background: var(--pt-s-surface);
	color: var(--pt-s-text);
	text-decoration: none;
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.pt-states .pt-states__item-link:hover,
.pt-states .pt-states__item-link:focus-visible {
	border-color: var(--pt-s-shade-2);
	box-shadow: 0 16px 36px rgba(15, 19, 40, 0.12);
	color: var(--pt-s-text);
	transform: translateY(-2px);
}
.pt-states .pt-states__item-link:focus-visible {
	outline: 2px solid var(--pt-s-shade-3);
	outline-offset: 2px;
}
.pt-states__item-media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--pt-s-shade-1);
}
.pt-states__item-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.pt-states .pt-states__item-link:hover .pt-states__item-media img {
	transform: scale(1.04);
}
.pt-states__item-abbr {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 3px 8px;
	border-radius: 6px;
	background: var(--pt-s-dark);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}
.pt-states__item-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px 16px;
}
.pt-states__item-name {
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
}
.pt-states__item-nick {
	color: var(--pt-s-muted);
	font-size: 0.875rem;
	line-height: 1.4;
}
.pt-states__item-years {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	color: var(--pt-s-muted);
	font-size: 0.8125rem;
}
.pt-states__item-years .pt-states__swatch {
	flex: none;
}
.pt-states .pt-states__none {
	margin: 0;
	color: var(--pt-s-muted);
}

@media (prefers-reduced-motion: reduce) {
	.pt-states *,
	.pt-states.is-ready .pt-states__panel {
		transition: none !important;
		animation: none !important;
	}
}

/* Tablet: copy on top, the panel under it. */
@media (max-width: 1024px) {
	.pt-states {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--pt-section-xs, 40px);
	}
	.pt-states__panel {
		width: 100%;
		max-width: 640px;
		height: auto;
		aspect-ratio: 580 / 440;
	}
}

/* Phone */
@media (max-width: 767px) {
	.pt-states__copy {
		gap: 24px;
	}
	.pt-states .pt-states__lead {
		font-size: 1.125rem;
	}
	.pt-states .pt-states__go {
		width: 100%;
	}
	.pt-states__panel {
		border-radius: 20px;
	}
	.pt-states[data-mode="map"] .pt-states__panel {
		aspect-ratio: auto;
	}
	.pt-states__map {
		padding: 14px 12px;
	}
	.pt-states__grid {
		gap: 3px;
	}
	.pt-states .pt-states__tile {
		border-radius: 4px;
	}
	.pt-states__abbr {
		font-size: 0.625rem;
	}
	.pt-states__years {
		display: none;
	}
	/* The card sits under the map (a tapped state), not over it. */
	.pt-states__map {
		flex-direction: column;
		gap: 12px;
	}
	.pt-states__card {
		position: static;
		width: 100%;
		padding: 12px 14px;
		box-shadow: none;
		transform: none;
	}
	/* Browse: two cards a row, chips scroll sideways. */
	.pt-states__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
	.pt-states__item-body {
		padding: 10px 12px 12px;
	}
	.pt-states__item-name {
		font-size: 0.9375rem;
	}
	.pt-states__item-nick {
		font-size: 0.8125rem;
	}
	.pt-states__regions {
		flex-wrap: nowrap;
		max-width: 100%;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.pt-states .pt-states__region {
		flex: none;
	}
	.pt-states .pt-states__count {
		margin-left: 0;
	}
}
