/**
 * Single: Animal
 *
 * 2-column detail page — sticky photo gallery left, info right.
 * Description full-width below. Related animals grid at bottom.
 */

.single-animal {
	overflow-x: clip;
	position: relative;
	z-index: 1;
}

/*** Back Link ***/

/*** 2-Column Layout ***/

.single-animal-layout {
	align-items: start;
	padding-bottom: var(--module-spacing-medium);
}

/*** Left Column — Photos ***/

.single-animal-media {
	grid-column: 1 / 7;
	position: sticky;
	top: calc(var(--header-height) + var(--text-spacing-small));
}

/*** Photo Wrapper ***/

.single-animal-photo-wrapper {
	position: relative;
}

.single-animal-photo-main {
	aspect-ratio: 3 / 2.5;
	border-radius: 16px;
}

.single-animal-photo-main img {
	object-fit: cover;
}

/** Photo Slide **/

.single-animal-photo-slide {
	background: none;
	border: none;
	cursor: pointer;
	display: block;
	height: 100%;
	left: 0;
	padding: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

.single-animal-photo-slide img {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/** Video Slide **/

.single-animal-video-slide {
	border: none;
	cursor: pointer;
	height: 100%;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

.single-animal-video-slide img {
	height: 100%;
	left: 0;
	object-fit: contain;
	position: absolute;
	top: 0;
	width: 100%;
}

/** Expand Button **/

.single-animal-photo-expand {
	align-items: center;
	background: #D7D9D9;
	border: none;
	border-radius: 6px;
	bottom: var(--text-spacing-xsmall);
	color: #99A1A5;
	cursor: pointer;
	display: flex;
	height: 40px;
	justify-content: center;
	position: absolute;
	right: var(--text-spacing-xsmall);
	transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
	width: 40px;
	z-index: 2;
}

.single-animal-photo-expand:hover {
	opacity: 0.8;
}

/** Carousel arrows — mobile only (thumbnail nav handles desktop) **/

.single-animal-photo-prev,
.single-animal-photo-next {
	display: none;
}

.single-animal-photo-expand svg {
	height: 16px;
	width: 16px;
}

/** Favorite Button **/

.single-animal-photo-wrapper .favorite-btn {
	font-size: calc(20rem / 16);
	height: 48px;
	left: var(--text-spacing-xsmall);
	position: absolute;
	top: var(--text-spacing-xsmall);
	width: 48px;
	z-index: 2;
}

.single-animal-photo-wrapper .favorite-btn.is-saved {
	background: var(--mustang-blue);
	color: var(--samoyed-white);
}

/** Foster Badge **/

.single-animal-foster-badge {
	align-items: center;
	background: var(--husky-blue);
	border-radius: 50%;
	bottom: var(--text-spacing-xsmall);
	color: var(--russian-blue);
	display: flex;
	font-size: calc(13rem / 16);
	font-weight: 700;
	height: 96px;
	justify-content: center;
	left: var(--text-spacing-xsmall);
	letter-spacing: 0.4px;
	line-height: 1.3;
	padding: 12px;
	position: absolute;
	text-align: center;
	text-transform: uppercase;
	width: 96px;
	z-index: 2;
}

/*** Lightbox ***/

.single-animal-lightbox {
	background: transparent;
	border: none;
	max-height: 90vh;
	max-width: 90vw;
	overflow: visible;
	padding: 0;
}

.single-animal-lightbox::backdrop {
	background: black;
	opacity: 0.8;
}

.single-animal-lightbox .modal-close,
.single-animal-lightbox .modal-close svg,
.single-animal-lightbox .modal-close svg path {
	color: var(--samoyed-white);
	fill: var(--samoyed-white);
	opacity: 1;
}

.single-animal-lightbox .modal-close {
	background: rgba(255, 255, 255, 0.25);
	border-radius: 6px;
	height: 40px;
	position: fixed;
	right: var(--text-spacing-medium);
	top: var(--text-spacing-medium);
	transition: background 0.2s ease;
	width: 40px;
}

.single-animal-lightbox .modal-close:hover {
	background: rgba(255, 255, 255, 0.4);
	color: var(--samoyed-white);
}

.single-animal-lightbox-prev,
.single-animal-lightbox-next {
	background: none;
	border: none;
	bottom: var(--text-spacing-medium);
	color: var(--samoyed-white);
	cursor: pointer;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
	padding: 0;
	position: fixed;
	transition: filter .2s ease, opacity .2s ease;
	z-index: 1;
}

.single-animal-lightbox-prev {
	left: calc(50% - 40px);
}

.single-animal-lightbox-next {
	left: calc(50% + 40px);
}

.single-animal-lightbox-prev:hover,
.single-animal-lightbox-next:hover {
	opacity: 0.6;
}

.single-animal-lightbox-prev svg,
.single-animal-lightbox-next svg {
	height: 32px;
	width: 32px;
}

.single-animal-lightbox-img {
	border-radius: 16px;
	display: block;
	height: 85vh;
	max-width: 100%;
	object-fit: contain;
	outline: none;
	user-select: none;
	width: auto;
}

.single-animal-lightbox-video {
	aspect-ratio: 16 / 9;
	border-radius: 16px;
	height: 85vh;
	max-width: 100%;
	overflow: hidden;
	width: auto;
}

.single-animal-lightbox-video iframe {
	border: 0;
	display: block;
	height: 100%;
	width: 100%;
}

/*** Thumbnails ***/

.single-animal-thumbs {
	display: flex;
	gap: var(--text-spacing-xsmall);
	list-style: none;
	margin: var(--text-spacing-xsmall) 0 0;
	padding: 0;
}

.single-animal-thumbs li {
	flex: 1;
}

.single-animal-thumb {
	aspect-ratio: 4 / 3;
	background: none;
	border: none;
	border-radius: 16px;
	cursor: pointer;
	flex: 1;
	height: 100%;
	min-width: 0;
	opacity: 0.5;
	overflow: hidden;
	padding: 0;
	position: relative;
	transition: border-color .2s ease, opacity .2s ease;
	width: 100%;
}

.single-animal-thumb.active {
	opacity: 1;
}

.single-animal-thumb:hover {
	opacity: 0.8;
}

.single-animal-thumb img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.thumb-play-icon {
	align-items: center;
	background: rgba(0, 0, 0, 0.4);
	border-radius: 50%;
	color: var(--samoyed-white);
	display: flex;
	font-size: calc(10rem / 16);
	height: 24px;
	justify-content: center;
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 24px;
}

/*** Right Column — Info ***/

.single-animal-info {
	grid-column: 7 / -1;
	padding-left: var(--text-spacing-small);
}

/*** Header ***/

.single-animal-header {
	margin-bottom: var(--text-spacing-medium);
}

.single-animal-header > p.semibold {
	margin: 0 0 4px;
}

.single-animal-location {
	align-items: center;
	display: flex;
	gap: var(--text-spacing-xsmall);
	margin-bottom: var(--text-spacing-small);
}

.single-animal-location .location-pin {
	align-items: center;
	background: var(--collie-blue);
	border-radius: 6px;
	color: var(--russian-blue);
	display: flex;
	font-size: calc(15rem / 16);
	justify-content: center;
	padding: 11px 0;
	width: 40px;
}

.single-animal-title-row {
	align-items: center;
	display: flex;
	gap: var(--text-spacing-xsmall);
	justify-content: space-between;
}

.single-animal-title-row .heading-2 {
	margin: 0;
}

/*** Traits ***/

.single-animal-traits {
	display: flex;
	flex-wrap: wrap;
	gap: var(--text-spacing-xxsmall);
	margin-bottom: var(--text-spacing-medium);
	margin-top: var(--text-spacing-small);
}

.single-animal-traits .pill.large {
	background: var(--wolfhound-gray);
}

/*** Badges ***/

.single-animal-badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--text-spacing-xxsmall);
	margin-top: var(--text-spacing-xsmall);
}

/*** Stats ***/

.single-animal-stats {
	column-gap: var(--text-spacing-medium);
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 0 0 var(--text-spacing-medium);
}

.single-animal-stat {
	border-bottom: 1px solid var(--wolfhound-gray);
	padding: var(--text-spacing-xsmall) 0;
}

.single-animal-stat dt {
	color: var(--grayhound);
	font-size: calc(12rem / 16);
	font-weight: 700;
	letter-spacing: 0.8px;
	margin-bottom: 2px;
	text-transform: uppercase;
}

.single-animal-stat dd {
	font-size: calc(16rem / 16);
	font-weight: 600;
	margin: 0;
}

/*** Compatibility Cards ***/

.single-animal-compatibility {
	display: grid;
	gap: var(--text-spacing-xxsmall);
	grid-template-columns: repeat(3, 1fr);
	margin-bottom: var(--text-spacing-medium);
}

.single-animal-compat-card {
	align-items: center;
	background: var(--husky-blue-25);
	border-radius: var(--border-radius-normal);
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px var(--text-spacing-xxsmall);
	text-align: center;
}

.single-animal-compat-icon {
	align-items: center;
	color: var(--russian-blue);
	display: flex;
	font-size: calc(22rem / 16);
	height: 36px;
	justify-content: center;
	position: relative;
	width: 36px;
}

.single-animal-compat-card p {
	color: var(--russian-blue);
	margin: 0;
}

.compat-check,
.compat-x {
	bottom: 5px;
	font-size: calc(12rem / 16);
	position: absolute;
	right: -4px;
}

.compat-check {
	color: var(--mustang-blue);
}

.compat-x {
	color: #99A1A5;
}

/** Compatibility — False State **/

.single-animal-compat-card.compat-false {
	background: #F2F3F5;
}

.single-animal-compat-card.compat-false .single-animal-compat-icon {
	color: #99A1A5;
}

/*** Action Buttons ***/

.single-animal-actions {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: var(--text-spacing-small);
	margin-bottom: var(--text-spacing-medium);
}

.single-animal-actions .btn.primary {
	text-align: center;
	width: 100%;
}

/*** Share ***/

.single-animal-share {
	display: flex;
	flex-direction: column;
	gap: var(--text-spacing-xsmall);
	margin-top: var(--text-spacing-xlarge);
}

.single-animal-share > p {
	margin: 0;
}

.single-animal-share-icons {
	display: flex;
	gap: var(--text-spacing-xxsmall);
	list-style: none;
	margin: 0;
	padding: 0;
}

.single-animal-share-icons .btn.icon {
	background: var(--goldie-yellow);
	border-radius: 6px;
	color: var(--russian-blue);
}

.single-animal-share-icons .btn.icon:hover {
	background: var(--goldie-yellow-hover);
}

/*** Description ***/

.single-animal-description-wrapper {
	background: var(--appaloosa-beige);
	margin-top: var(--module-spacing-xlarge);
	overflow: visible;
	position: relative;
}

.single-animal-description-wrapper > .background-shape.shape-top {
	color: var(--appaloosa-beige);
	left: 0;
	line-height: 0;
	position: absolute;
	top: 1px;
	transform: translateY(-100%);
	width: 100vw;
	z-index: 0;
}

.single-animal-description-wrapper > .background-shape.shape-top svg {
	display: block;
	height: auto;
	width: 100%;
}

.single-animal-description {
	margin-top: -240px;
	padding-bottom: var(--module-spacing-medium);
	padding-top: var(--module-spacing-small);
	position: relative;
	z-index: 1;
}

.single-animal-description .heading-3 {
	margin: 0;
}

.single-animal-description-inner {
	background: var(--samoyed-white);
	margin: 0 auto;
	max-width: 960px;
	overflow-x: clip;
	padding: var(--module-spacing-medium);
	position: relative;
}

.single-animal-description-inner .heading-3 {
	isolation: isolate;
	margin-bottom: var(--text-spacing-small);
	padding-bottom: var(--text-spacing-xsmall);
}

.single-animal-description-illustration {
	color: var(--appaloosa-beige);
	pointer-events: none;
	position: absolute;
	right: 0;
	top: 0;
	transform: translateY(-100%);
	width: 250px;
	z-index: -1;
}

.single-animal-description-illustration svg {
	display: block;
	height: auto;
	width: 100%;
}

.single-animal-description-illustration svg path {
	fill: currentColor;
}

/*** Related Animals ***/

.single-animal-related {
	background: var(--appaloosa-beige);
	padding: var(--text-spacing-xlarge) 0 var(--module-spacing-medium);
}

.single-animal-related header {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--text-spacing-small);
	justify-content: space-between;
	margin-bottom: var(--text-spacing-large);
}

.single-animal-related header .heading-3 {
	margin: 0;
}

.single-animal-related-grid {
	display: grid;
	gap: var(--text-spacing-medium);
	grid-template-columns: repeat(4, 1fr);
	list-style: none;
	margin: 0;
	padding: 0;
}

/*
 * ====================================================================== *
 * 1200px — Laptop
 * ====================================================================== *
 */

@media only screen and (max-width: calc(1200rem / 16)) {

	.single-animal .back-link {
		margin-top: var(--text-spacing-xsmall);
	}

	.single-animal-related-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.single-animal-related-grid > li:nth-child(n+4) {
		display: none;
	}

}

/*
 * ====================================================================== *
 * 950px — Tablet
 * ====================================================================== *
 */

@media only screen and (max-width: calc(950rem / 16)) {

	.single-animal .back-link {
		margin-top: var(--text-spacing-xxsmall);
	}

	.single-animal-layout {
		padding-bottom: calc(var(--module-spacing-medium) + 32px);
	}

	.single-animal-photo-main {
		border-radius: 12px;
	}

	.single-animal-thumbs {
		gap: var(--text-spacing-xxsmall);
		margin: var(--text-spacing-xxsmall) 0 0;
	}

	.single-animal-thumb {
		border-radius: 8px;
	}

	.single-animal-info {
		padding-left: 0;
	}

	.single-animal-header {
		margin-bottom: var(--text-spacing-small);
	}

	.single-animal-traits {
		margin-bottom: 0;
	}

	.single-animal-traits .pill.large {
		font-size: calc(14rem / 16);
	}

	.single-animal-stats {
		column-gap: var(--text-spacing-xsmall);
	}

	.single-animal-share {
		margin-top: var(--text-spacing-small);
	}

	/* Bump share icons to 40px (footer size) for thumb-friendly tap targets. */

	.single-animal-share-icons .btn.icon {
		height: 40px;
		width: 40px;
	}

	.single-animal-share-icons .btn.icon svg {
		height: 16px;
		width: 16px;
	}

	.single-animal-related-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	/* Move location pill to bottom-left of image, hide icon for space —
	   matches the mobile browse-grid treatment. */

	.single-animal-related-grid .card.animal .media .pill.location i,
	.single-animal-related-grid .card.animal .media .pill.location svg {
		display: none;
	}

	.single-animal-related-grid .card.animal .media .pill {
		bottom: var(--text-spacing-xxsmall);
		top: auto;
	}

	.single-animal-description {
		padding-bottom: var(--text-spacing-medium);
	}

}

/*
 * ====================================================================== *
 * 650px — Mobile
 * ====================================================================== *
 */

@media only screen and (max-width: calc(650rem / 16)) {

	/* Stack the layout — sticky off, both columns full-width. Promote
	   media's children to grid items so we can drop the share block
	   below the info column via `order`. */

	.single-animal .single-animal-layout {
		row-gap: var(--text-spacing-small);
	}

	.single-animal-media {
		display: contents;
	}

	.single-animal-photo-wrapper,
	.single-animal-photo-main {
		grid-column: 1 / -1;
		order: 1;
	}

	.single-animal-info {
		grid-column: 1 / -1;
		order: 2;
	}

	.single-animal-share {
		grid-column: 1 / -1;
		order: 3;
	}

	.single-animal-photo-main {
		aspect-ratio: 1 / 1;
	}

	.single-animal-traits {
		flex-wrap: nowrap;
	}

	.single-animal-compatibility {
		grid-template-columns: 1fr;
	}

	.single-animal-description-illustration {
		width: 125px;
	}

	/* Photo carousel: hide the thumbnail nav and surface inline prev/next
	   on the main image (only the desktop nav was thumbnails). */

	.single-animal-thumbs {
		display: none;
	}

	.single-animal-photo-prev,
	.single-animal-photo-next {
		align-items: center;
		background: rgba(255, 255, 255, 0.85);
		border: none;
		border-radius: 50%;
		color: var(--russian-blue);
		cursor: pointer;
		display: flex;
		height: 40px;
		justify-content: center;
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
		z-index: 2;
	}

	.single-animal-photo-prev {
		left: var(--text-spacing-xsmall);
	}

	.single-animal-photo-next {
		right: var(--text-spacing-xsmall);
	}

	.single-animal-photo-prev svg,
	.single-animal-photo-next svg {
		height: 16px;
		width: 16px;
	}

	/* Description: white card breaks out to full viewport width, text
	   inside stays at the main container width via container padding. */

	.single-animal-description-inner {
		margin-left: calc(-1 * var(--container-outer-padding));
		margin-right: calc(-1 * var(--container-outer-padding));
		max-width: none;
		padding: var(--text-spacing-large) var(--container-outer-padding);
	}

	/* Related: 2 across, no second row, tighter card content gap. */

	.single-animal-related-grid {
		gap: var(--text-spacing-xsmall);
		grid-template-columns: repeat(2, 1fr);
	}

	.single-animal-related-grid > li:nth-child(n+3) {
		display: none;
	}

	.single-animal-related-grid .card.animal .card-link {
		gap: var(--text-spacing-xxsmall);
	}

	/* Restore the desktop arrow-block size for the back-link — the global
	   mobile shrink (28×28, 7×14 svg) reads as too small here. */

	.single-animal .back-link .arrow-block {
		height: 32px;
		width: 32px;
	}

	.single-animal .back-link .arrow-block svg {
		height: 12px;
		width: 12px;
	}

	.single-animal-location {
		margin-bottom: var(--text-spacing-xsmall);
	}

	.single-animal-actions {
		margin-bottom: var(--text-spacing-large);
	}

	.single-animal-description-inner .heading-3 {
		margin-bottom: var(--text-spacing-xxsmall);
		padding-bottom: var(--text-spacing-xxsmall);
	}

	.single-animal-related {
		padding-top: var(--text-spacing-medium);
	}

	/* Center the share block and pin it directly under the info column.
	   Negative margin-top trims 16px off the layout's row-gap above the
	   share text, padding-bottom adds 16px below the share buttons. */

	.single-animal-share {
		align-items: center;
		flex-wrap: wrap;
		margin-top: calc(-1 * var(--text-spacing-xsmall));
		padding-bottom: var(--text-spacing-xsmall);
		text-align: center;
	}

	.single-animal-share-icons {
		justify-content: center;
	}

}
