/**
 * Photo credits: the camera button on cards, credit lines and the
 * Photo credits page. See inc/image-credits.php.
 */

/* Credit lines (hero, Explore features) keep their own position styles. */
.mm-credit-line a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Camera button on card photos */
.mm-credit {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	max-width: calc(100% - 1rem);
	min-height: 1.75rem;
	border-radius: 999px;
	color: #fff;
	background-color: rgb(10 20 40 / 0.55);
	font-size: 0.75rem;
	line-height: 1.3;
	cursor: default;
	transition: background-color 0.15s ease;
}

.mm-credit--br { right: 0.5rem; bottom: 0.5rem; flex-direction: row-reverse; }
.mm-credit--tr { right: 0.5rem; top: 0.5rem; flex-direction: row-reverse; }
.mm-credit--bl { left: 0.5rem; bottom: 0.5rem; }
.mm-credit--tl { left: 0.5rem; top: 0.5rem; }

.mm-credit__icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
}

.mm-credit__icon svg {
	width: 0.9rem;
	height: 0.9rem;
}

/* Hidden visually until hover or focus, but always read by screen readers. */
.mm-credit__text {
	overflow: hidden;
	max-width: 0;
	white-space: nowrap;
	text-overflow: ellipsis;
	transition: max-width 0.2s ease, padding 0.2s ease;
}

.mm-credit:hover,
.mm-credit:focus-visible {
	background-color: rgb(10 20 40 / 0.85);
}

.mm-credit:hover .mm-credit__text,
.mm-credit:focus-visible .mm-credit__text {
	max-width: 22rem;
	padding-inline: 0.6rem 0;
}

.mm-credit--bl:hover .mm-credit__text,
.mm-credit--tl:hover .mm-credit__text,
.mm-credit--bl:focus-visible .mm-credit__text,
.mm-credit--tl:focus-visible .mm-credit__text {
	padding-inline: 0 0.6rem;
}

.mm-credit:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.mm-credit,
	.mm-credit__text {
		transition: none;
	}
}

/* Photo credits page */
.mm-credits-city {
	margin-block-start: var(--mm-space-xl, 2rem);
}

.mm-credits-city__title {
	margin: 0 0 var(--mm-space-sm, 0.75rem);
	font-size: var(--mm-text-h4, 1.125rem);
}

.mm-credits-list {
	display: grid;
	gap: var(--mm-space-sm, 0.75rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mm-credits-item {
	display: flex;
	align-items: center;
	gap: var(--mm-space-md, 1rem);
	padding: var(--mm-space-xs, 0.5rem);
	border: 1px solid var(--mm-color-border-subtle, #e3e6ea);
	border-radius: var(--mm-radius-md, 0.75rem);
	background-color: var(--mm-color-surface, #fff);
}

.mm-credits-item__thumb {
	flex: none;
	width: 4.5rem;
	height: 3.5rem;
	overflow: hidden;
	border-radius: var(--mm-radius-sm, 0.5rem);
	background-color: var(--mm-color-surface-subtle, #f3f4f6);
}

.mm-credits-item__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mm-credits-item__credit {
	font-size: var(--mm-text-body-sm, 0.9375rem);
	overflow-wrap: anywhere;
}

.mm-credits-item__credit a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Homepage example trip: give its photo a corner for the button. */
.mm-hp-trip__media {
	position: relative;
}

/*
 * Credit lines on top of photos (guide and football heroes, Explore
 * features): a soft dark pill so the text reads on any photo, light or
 * dark. Overrides the plain white text in guide.css.
 */
.mm-gd-hero__credit,
.mm-gd-feature__credit {
	max-width: min(32rem, calc(100% - 2rem));
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	color: #fff !important;
	background-color: rgb(10 20 40 / 0.62);
	font-size: 0.75rem;
	line-height: 1.4;
	text-shadow: none !important;
	backdrop-filter: blur(4px);
}

.mm-gd-hero__credit a,
.mm-gd-feature__credit a {
	color: #fff;
}

/*
 * Open credit buttons: also open on tap (focus inside), wrap long credits
 * instead of cutting them off, and make their links clickable.
 */
.mm-credit:focus-within {
	background-color: rgb(10 20 40 / 0.85);
}

.mm-credit:hover .mm-credit__text,
.mm-credit:focus-visible .mm-credit__text,
.mm-credit:focus-within .mm-credit__text {
	max-width: min(22rem, 70vw);
	padding-block: 0.3rem;
	padding-inline: 0.6rem 0;
	white-space: normal;
	text-overflow: clip;
}

.mm-credit--bl:focus-within .mm-credit__text,
.mm-credit--tl:focus-within .mm-credit__text {
	padding-inline: 0 0.6rem;
}

.mm-credit:hover,
.mm-credit:focus-within {
	border-radius: 0.875rem;
}

.mm-credit__text a {
	color: #fff;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mm-credit__text a:hover {
	text-decoration-thickness: 2px;
}
