/**
 * Sightings front-end styles.
 *
 * Design intent: a "field journal / travel scrapbook" feel — this is a record
 * of places a beloved object has been, kept by a community. Warm paper tone,
 * a friendly rounded display accent, postcard-style cards with a soft lift,
 * and pins/popups that feel like stamps in a passport. All theme-able via the
 * CSS custom properties below so a client's brand can override the palette
 * without touching markup.
 *
 * Everything is namespaced under .sightings-* so it never collides with theme
 * styles, and the variables are scoped to the components (not :root) so they
 * only affect this plugin's output.
 */

.sightings-grid,
.sightings-map,
.sightings-count {
	/* Theme tokens — override these in the theme to re-skin the plugin. */
	--sg-paper: #faf6ef;          /* warm off-white card/background          */
	--sg-ink: #2b2622;            /* near-black warm text                    */
	--sg-muted: #8a7f72;          /* sepia muted text                        */
	--sg-accent: #c4622d;         /* terracotta — stamps, links, pins        */
	--sg-accent-deep: #9c4a1f;    /* darker accent for hover                 */
	--sg-line: #e7ddcd;           /* hairline divider                        */
	--sg-shadow: 0 6px 22px rgba(43, 38, 34, 0.12);
	--sg-radius: 14px;
}

/* ------------------------------------------------------------------ Grid */

.sightings-grid {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: repeat(2, 1fr);
	margin: 1.5rem 0;
}

@media (min-width: 700px) {
	.sightings-grid.sightings-cols-3 { grid-template-columns: repeat(3, 1fr); }
	.sightings-grid.sightings-cols-4 { grid-template-columns: repeat(4, 1fr); }
	.sightings-grid.sightings-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
	.sightings-grid { grid-template-columns: 1fr; }
}

.sightings-card {
	background: var(--sg-paper);
	border-radius: var(--sg-radius);
	box-shadow: var(--sg-shadow);
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sightings-card:hover,
.sightings-card:focus-within {
	transform: translateY(-3px);
	box-shadow: 0 12px 30px rgba(43, 38, 34, 0.18);
}

.sightings-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.sightings-card__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--sg-line);
}

.sightings-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.sightings-card:hover .sightings-card__img {
	transform: scale(1.04);
}

.sightings-card__body {
	padding: 0.9rem 1rem 1.1rem;
}

.sightings-card__title {
	margin: 0 0 0.25rem;
	font-size: 1.05rem;
	line-height: 1.25;
	color: var(--sg-ink);
	font-weight: 700;
}

.sightings-card__place {
	margin: 0 0 0.2rem;
	font-size: 0.85rem;
	color: var(--sg-accent);
	font-weight: 600;
	letter-spacing: 0.01em;
}

/* Small "postmark" mark before the place name. */
.sightings-card__place::before {
	content: "\01F4CD"; /* round pushpin emoji as a lightweight location cue */
	margin-right: 0.3rem;
}

.sightings-card__by {
	margin: 0;
	font-size: 0.8rem;
	color: var(--sg-muted);
	font-style: italic;
}

.sightings-empty {
	padding: 2rem;
	text-align: center;
	color: var(--sg-muted);
	background: var(--sg-paper);
	border-radius: var(--sg-radius);
}

/* ------------------------------------------------------------ Pagination */

.sightings-pagination {
	margin: 1.75rem 0;
}

.sightings-pagination .page-numbers {
	display: inline-flex;
	min-width: 2.25rem;
	height: 2.25rem;
	align-items: center;
	justify-content: center;
	margin: 0 0.15rem;
	padding: 0 0.5rem;
	border-radius: 999px;
	color: var(--sg-ink);
	text-decoration: none;
	font-weight: 600;
}

.sightings-pagination ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.sightings-pagination .page-numbers.current {
	background: var(--sg-accent);
	color: #fff;
}

.sightings-pagination a.page-numbers:hover {
	background: var(--sg-line);
}

/* -------------------------------------------------------------- Counter */

.sightings-count {
	display: inline-block;
	font-weight: 700;
	color: var(--sg-accent-deep);
}

/* ------------------------------------------------------------------ Map */

.sightings-map {
	width: 100%;
	border-radius: var(--sg-radius);
	overflow: hidden;
	box-shadow: var(--sg-shadow);
	border: 1px solid var(--sg-line);
	z-index: 0; /* keep Leaflet panes below sticky theme headers */
}

/* Popups styled as little passport stamps. */
.sightings-popup .leaflet-popup-content-wrapper {
	border-radius: 12px;
	padding: 0;
	overflow: hidden;
	background: var(--sg-paper);
}

.sightings-popup .leaflet-popup-content {
	margin: 0;
	width: 220px !important;
}

.sightings-popup__media img {
	display: block;
	width: 100%;
	height: 130px;
	object-fit: cover;
}

.sightings-popup__body {
	padding: 0.65rem 0.8rem 0.8rem;
}

.sightings-popup__title {
	margin: 0 0 0.2rem;
	font-size: 0.98rem;
	color: var(--sg-ink);
}

.sightings-popup__place {
	margin: 0 0 0.15rem;
	font-size: 0.8rem;
	color: var(--sg-accent);
	font-weight: 600;
}

.sightings-popup__by {
	margin: 0 0 0.4rem;
	font-size: 0.75rem;
	color: var(--sg-muted);
	font-style: italic;
}

.sightings-popup__link {
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--sg-accent);
	text-decoration: none;
}

.sightings-popup__link:hover {
	color: var(--sg-accent-deep);
}

/* ------------------------------------------------- Accessibility / motion */

@media (prefers-reduced-motion: reduce) {
	.sightings-card,
	.sightings-card__img {
		transition: none;
	}
}

.sightings-card__link:focus-visible {
	outline: 3px solid var(--sg-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------ Map pins & clusters */

/* SVG pin (divIcon). Leaflet's default divIcon has a white box background; we
   reset it so only our SVG shows. */
.sightings-pin {
	background: transparent;
	border: 0;
}

.sightings-pin svg {
	display: block;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

/* Cluster bubble. Color is set inline per-instance via the widget control. */
.sightings-cluster-wrap {
	background: transparent;
}

.sightings-cluster {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: 700;
	font-size: 0.9rem;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	border: 2px solid rgba(255, 255, 255, 0.85);
}

/* "Use Ctrl + scroll to zoom" hint overlay (cooperative scroll mode). */
.sightings-map {
	position: relative;
}

.sightings-map__hint {
	position: absolute;
	inset: 0;
	z-index: 500;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(43, 38, 34, 0.55);
	color: #fff;
	font-size: 1.05rem;
	font-weight: 600;
	text-align: center;
	padding: 1rem;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.sightings-map--hint-on .sightings-map__hint {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.sightings-map__hint {
		transition: none;
	}
}

/* --------------------------------------------------- Sighting gallery + lightbox */

.sightings-gallery {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(3, 1fr);
	margin: 1.25rem 0;
}

.sightings-gallery.sightings-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sightings-gallery.sightings-cols-4 { grid-template-columns: repeat(4, 1fr); }
.sightings-gallery.sightings-cols-5 { grid-template-columns: repeat(5, 1fr); }
.sightings-gallery.sightings-cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 600px) {
	.sightings-gallery,
	.sightings-gallery.sightings-cols-2,
	.sightings-gallery.sightings-cols-4,
	.sightings-gallery.sightings-cols-5,
	.sightings-gallery.sightings-cols-6 {
		grid-template-columns: repeat(2, 1fr);
	}
}

.sightings-gallery__item {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 10px;
	background: var(--sg-line, #e7ddcd);
	cursor: zoom-in;
}

.sightings-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.sightings-gallery__item:hover .sightings-gallery__img {
	transform: scale(1.05);
}

/* Lightbox overlay */
.sightings-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(20, 17, 15, 0.92);
	padding: 3vw;
}

.sightings-lightbox.is-open {
	display: flex;
}

.sightings-lightbox__figure {
	margin: 0;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sightings-lightbox__img {
	max-width: 90vw;
	max-height: 82vh;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.sightings-lightbox__caption {
	color: #fff;
	margin-top: 0.75rem;
	font-size: 0.95rem;
	text-align: center;
	max-width: 80vw;
}

.sightings-lightbox__close,
.sightings-lightbox__nav {
	position: absolute;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	border: 0;
	cursor: pointer;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 1.8rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

.sightings-lightbox__close:hover,
.sightings-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.25);
}

.sightings-lightbox__close {
	top: 4vw;
	right: 4vw;
	font-size: 2.2rem;
}

.sightings-lightbox__prev { left: 3vw; }
.sightings-lightbox__next { right: 3vw; }

.sightings-lightbox__nav {
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.sightings-lightbox__prev { left: 2vw; }
	.sightings-lightbox__next { right: 2vw; }
	.sightings-lightbox__close { top: 2vw; right: 2vw; }
}

@media (prefers-reduced-motion: reduce) {
	.sightings-gallery__img,
	.sightings-lightbox__close,
	.sightings-lightbox__nav {
		transition: none;
	}
}

/* --------------------------------------------------------- Single field block */

.sightings-field {
	margin: 0 0 0.6rem;
}

.sightings-field--inline {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4rem;
}

.sightings-field--stacked {
	display: block;
}

.sightings-field__label {
	font-weight: 700;
	color: var(--sg-muted, #8a7f72);
	font-size: 0.9rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.sightings-field--stacked .sightings-field__label {
	display: block;
	margin-bottom: 0.15rem;
}

.sightings-field__value {
	color: var(--sg-ink, #2b2622);
}

/* Story renders as HTML paragraphs; keep them tidy inside the value. */
.sightings-field--story .sightings-field__value p {
	margin: 0 0 0.75rem;
}
.sightings-field--story .sightings-field__value p:last-child {
	margin-bottom: 0;
}

/* When it's the story, inline layout doesn't make sense — force block flow. */
.sightings-field--story.sightings-field--inline {
	display: block;
}

/* Lightbox story panel (shown when opened from a pin/card in lightbox mode). */
.sightings-lightbox__story {
	color: #f3ede4;
	margin-top: 0.6rem;
	font-size: 0.95rem;
	line-height: 1.5;
	text-align: center;
	max-width: 70ch;
	max-height: 22vh;
	overflow-y: auto;
}

/* ------------------------------------------------------------- Photo wall */

.sightings-wall {
	margin: 1.5rem 0;
}

/* Grid: uniform square tiles. */
.sightings-wall--grid {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(var(--sg-wall-cols, 4), 1fr);
}
.sightings-wall--grid .sightings-wall__item {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	cursor: zoom-in;
	display: block;
}
.sightings-wall--grid .sightings-wall__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

/* Masonry: natural aspect ratios, packed via CSS columns. */
.sightings-wall--masonry {
	column-count: var(--sg-wall-cols, 4);
	column-gap: 0.5rem;
}
.sightings-wall--masonry .sightings-wall__item {
	display: block;
	margin: 0 0 0.5rem;
	break-inside: avoid;
	border-radius: 8px;
	overflow: hidden;
	cursor: zoom-in;
}
.sightings-wall--masonry .sightings-wall__img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.35s ease;
}

/* Slider: horizontal scroll-snap strip. */
.sightings-wall--slider {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 0.5rem;
}
.sightings-wall--slider .sightings-wall__item {
	flex: 0 0 auto;
	width: clamp(180px, 30%, 320px);
	aspect-ratio: 1 / 1;
	scroll-snap-align: start;
	overflow: hidden;
	border-radius: 8px;
	cursor: zoom-in;
}
.sightings-wall--slider .sightings-wall__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.sightings-wall__item:hover .sightings-wall__img {
	transform: scale(1.05);
}

@media (max-width: 700px) {
	.sightings-wall--grid { grid-template-columns: repeat(2, 1fr); }
	.sightings-wall--masonry { column-count: 2; }
}

@media (prefers-reduced-motion: reduce) {
	.sightings-wall__img { transition: none; }
}
