/* =============================================================================
 * marker-card.css — the card a map marker opens (marker-card.js, #34), and the
 * markers' hover state. Loads on /map/.
 *
 * Link rules use two classes on purpose: Leaflet's `.leaflet-container a`
 * (0,1,1) colors every link inside the map, and would beat a single class.
 * ============================================================================= */

/* A marker grows a little under the pointer, and stays grown while its card is
   open. The image grows, not the marker element: Leaflet places that with a
   transform, and scaling it would scale its position too (see features.js).
   Hover only where there's a pointer to hover with: on a touchscreen the state
   would stick after a tap. */
.atlas-marker img {
	block-size: 100%;
	display: block;
	inline-size: 100%;
	transition: scale var(--transition-duration) var(--transition-timing);
}

@media (hover: hover) {
	.atlas-marker:hover img {
		scale: 1.15;
	}
}

.atlas-marker--selected img {
	scale: 1.15;
}

/* Leaflet reserves 20px below a popup for its tip, which the map hides
   (map.css). marker-card.js sets the gap to the marker itself. */
.marker-card-popup {
	margin-block-end: 0;
}

.marker-card-popup .leaflet-popup-content-wrapper {
	background: var(--color-white);
	border-radius: 0;
	box-shadow: var(--box-shadow-default);
	overflow: hidden;
	padding: 0;
}

.marker-card-popup .leaflet-popup-content {
	line-height: 1.2;
	margin: 0;
}

/* The positioning context for the title link's ::after, which covers the
   card so a click anywhere on it follows the link. */
.marker-card {
	color: var(--color-brand-black);
	position: relative;
}

.marker-card__image,
.marker-card__placeholder {
	aspect-ratio: 4 / 3;
	display: block;
	inline-size: 100%;
}

.marker-card__image {
	object-fit: cover;
}

.marker-card__placeholder {
	align-items: center;
	background-color: var(--currentcolor-10);
	display: flex;
	justify-content: center;

	img {
		inline-size: 4em;
	}
}

.marker-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
	padding: 0.75em 1em 1em;
}

.marker-card__type,
.marker-card__native,
.marker-card__dates {
	color: var(--currentcolor-70);
	font-size: var(--text-sm);
}

/* The smallest text: the type label above the title, and the native
   territories footnote below the dates, which is often several lines long. */
.marker-card .marker-card__type,
.marker-card .marker-card__native {
	font-size: 0.75em;
}

.marker-card .marker-card__title {
	color: inherit;
	font-size: 1.1em;
	font-weight: 700;
	text-decoration: none;

	&::after {
		content: '';
		inset: 0;
		position: absolute;
	}
}

.marker-card:hover .marker-card__title {
	text-decoration: underline;
}

/* Descriptions run from a few words to a paragraph, so they're cut off at a
   few lines. Every browser still needs the prefixed version: line-clamp does
   nothing without `display: -webkit-box`. */
.marker-card__subtitle {
	-webkit-box-orient: vertical;
	display: -webkit-box;
	font-size: var(--text-sm);
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

/* The card's other controls sit above the title link's ::after, so they get
   their own clicks. */
.marker-card .marker-card__credit,
.marker-card__action {
	position: relative;
	z-index: 1;
}

.marker-card .marker-card__credit {
	color: inherit;
}

.marker-card__action {
	align-self: start;
	font-size: var(--text-sm);
	margin-block-start: 0.4em;
}
