/* The species card (templates/species-card.html): on the landing page under the bird search, and in a
 * dialog on the share pages. Carries its own colours and buttons, so it looks the same on both. */

.species-card {
	--sc-card: #19191c;
	--sc-hairline: rgba(255, 255, 255, 0.14);
	--sc-faint: #75717f;
	--sc-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 28px;
	padding: 24px;
	border-radius: 20px;
	background: var(--sc-card);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 0 0 1px var(--sc-hairline);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	text-align: left;
	animation: species-card-in 360ms var(--sc-ease) both;
}

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

@keyframes species-card-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

.species-card p,
.species-card h3 {
	margin: 0;
}

.species-card-photo {
	overflow: hidden;
	aspect-ratio: 1;
	border-radius: 14px;
	background: linear-gradient(135deg, rgba(117, 185, 70, 0.18), rgba(26, 140, 192, 0.12));
}

.species-card-photo {
	position: relative;
}

.species-card-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	animation: species-card-photo-in 300ms var(--sc-ease) both;
}

.species-card-photo img[hidden] {
	display: none;
}

@keyframes species-card-photo-in {
	from {
		opacity: 0;
	}
}

/* While the picture loads, the frame shimmers like the text does. */
.species-card-photo.waiting {
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)) 0 0 / 200% 100%;
	animation: species-card-shimmer 1.2s linear infinite;
}

/* No picture: the 300sf mark, faint, instead of an empty box. */
.species-card-photo.empty::before {
	content: "";
	position: absolute;
	inset: 0;
	background-color: rgba(255, 255, 255, 0.16);
	-webkit-mask: url(/img/300sf.svg) center / 55% no-repeat;
	mask: url(/img/300sf.svg) center / 55% no-repeat;
}

.species-card-order {
	color: var(--accent);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.species-card-name {
	margin-top: 4px;
	font-size: 1.75rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.species-card-latin {
	color: var(--ink-soft);
	font-family: var(--font-latin);
	font-style: italic;
}

.species-card-summary {
	display: -webkit-box;
	margin-top: 12px !important;
	overflow: hidden;
	color: var(--ink-soft);
	line-height: 1.55;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
}

.species-card.loading .species-card-summary {
	min-height: 4.6em;
	border-radius: 8px;
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)) 0 0 / 200% 100%;
	animation: species-card-shimmer 1.2s linear infinite;
}

@keyframes species-card-shimmer {
	to {
		background-position: -200% 0;
	}
}

.species-card-failed {
	margin-top: 12px !important;
	color: var(--danger);
}

.species-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 20px;
}

.species-card-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 26px;
	border: 0;
	border-radius: 999px;
	background: var(--primary);
	color: var(--on-primary);
	font: inherit;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(180, 13, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
	transition: background-color 160ms, transform 160ms var(--sc-ease), box-shadow 160ms;
}

.species-card-button:hover {
	background: var(--primary-strong);
	transform: translateY(-1px);
}

.species-card-button svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.species-card-button.ghost {
	background: rgba(255, 255, 255, 0.06);
	color: var(--ink);
	box-shadow: inset 0 0 0 1px var(--sc-hairline);
}

.species-card-button.ghost:hover {
	background: rgba(255, 255, 255, 0.1);
}

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

.species-card-hint {
	margin-top: 12px !important;
	color: var(--sc-faint);
	font-size: 0.875rem;
}

.species-card-wiki {
	display: inline-block;
	margin-top: 8px;
	color: var(--ink-soft);
	font-size: 0.875rem;
}

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

/* As a dialog on the share pages. */

.species-dialog {
	width: min(760px, calc(100vw - 32px));
	max-width: none;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	overflow: visible;
}

.species-dialog::backdrop {
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(4px);
}

.species-dialog .species-card {
	position: relative;
}

.species-dialog-close {
	position: absolute;
	z-index: 1;
	top: -14px;
	right: -14px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--surface-raised);
	color: var(--ink);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

[data-species] {
	cursor: pointer;
}

@media (max-width: 640px) {
	.species-card {
		grid-template-columns: 1fr;
		gap: 18px;
		padding: 18px;
	}

	.species-card-photo {
		aspect-ratio: 16 / 10;
	}

	/* On a phone a missing picture would only push the text down. */
	.species-card-photo.empty {
		display: none;
	}

	.species-dialog-close {
		top: 8px;
		right: 8px;
	}
}
