/* =============================================================================
   Plantnimals — Frontend Styles
   Distribution map, classification tables, gallery lightbox, fun-facts rotator.
   ============================================================================= */

/* ── Distribution map ────────────────────────────────────────────────────── */

.pn-map-section {
	margin: 2rem 0;
}

.pn-distribution-map {
	height: 400px;
	width: 100%;
	border-radius: 4px;
	border: 1px solid #ddd;
	background: #f5f5f5;
}

/* ── Classification & stats tables ───────────────────────────────────────── */

.pn-classification-table,
.pn-stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .9em;
	margin-bottom: 1.5rem;
}

.pn-classification-table caption,
.pn-stats-table caption {
	font-weight: 700;
	text-align: left;
	padding: .5rem 0;
	font-size: 1em;
	caption-side: top;
}

.pn-classification-table th,
.pn-classification-table td,
.pn-stats-table th,
.pn-stats-table td {
	padding: .4rem .6rem;
	border: 1px solid #e0e0e0;
	text-align: left;
	vertical-align: top;
}

.pn-classification-table th,
.pn-stats-table th {
	background: #f9f9f9;
	width: 42%;
	font-weight: 600;
}

/* Conservation-status badge inside classification table */
.pn-badge.pn-conservation {
	display: inline-block;
	padding: .15em .5em;
	border-radius: 3px;
	font-size: .85em;
	font-weight: 600;
	background: #e8f5e9;
	color: #2e7d32;
}

/* ── Species-meta block wrapper ──────────────────────────────────────────── */

.pn-species-meta {
	margin-bottom: 2rem;
}

/* ── Species gallery grid ────────────────────────────────────────────────── */

.pn-gallery-section {
	margin: 2rem 0;
}

.pn-gallery-heading {
	margin-bottom: 1rem;
}

.pn-gallery {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 180px, 1fr ) );
	gap: .75rem;
}

.pn-gallery-item {
	margin: 0;
	overflow: hidden;
	border-radius: 4px;
	background: #f5f5f5;
	cursor: zoom-in;
}

.pn-gallery-item img {
	display: block;
	width: 100%;
	height: 160px;
	object-fit: cover;
	transition: transform .2s ease, opacity .2s ease;
}

.pn-gallery-item:hover img,
.pn-gallery-item:focus-within img {
	transform: scale( 1.04 );
	opacity: .92;
}

.pn-gallery-caption {
	font-size: .75em;
	color: #555;
	padding: .35rem .5rem;
	margin: 0;
	line-height: 1.4;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ── Gallery lightbox ─────────────────────────────────────────────────────── */

.pn-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, .88 );
	z-index: 99999;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.pn-lightbox--open {
	display: flex;
}

.pn-lightbox__img {
	max-width: 90vw;
	max-height: 90vh;
	object-fit: contain;
	border-radius: 2px;
	box-shadow: 0 4px 32px rgba( 0, 0, 0, .5 );
}

.pn-lightbox__close {
	position: absolute;
	top: 1rem;
	right: 1.5rem;
	background: none;
	border: none;
	color: #fff;
	font-size: 2.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	text-shadow: 0 1px 4px rgba( 0, 0, 0, .6 );
}

.pn-lightbox__close:hover,
.pn-lightbox__close:focus {
	opacity: .75;
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.pn-lightbox__caption {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba( 0, 0, 0, .65 );
	color: #e8e8e8;
	font-size: .8rem;
	line-height: 1.4;
	padding: .5rem 1rem;
	margin: 0;
	text-align: center;
}

/* ── Fun-facts rotator ────────────────────────────────────────────────────── */

[data-pn-fun-facts] li {
	transition: opacity .4s ease;
}

[data-pn-fun-facts] li[hidden] {
	display: none;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media ( max-width: 600px ) {
	.pn-distribution-map {
		height: 260px;
	}
}
