/* MisPers Database: front end. Inherits the theme's fonts and colours where it can. */
.mpdb-search, .mpdb-results, .mpdb-case, .mpdb-mapwrap, .mpdb-recent, .mispers-research {
	--mpdb-accent: #1f3a5f;
	--mpdb-line: color-mix(in srgb, currentColor 16%, transparent);
	--mpdb-soft: color-mix(in srgb, currentColor 5%, transparent);
	--mpdb-muted: color-mix(in srgb, currentColor 62%, transparent);
}

/*
 * Map. Hooks for your own styling:
 *   #mispers-map / .mispers-map      the wrapper (full width unless width="content")
 *   .mispers-map__canvas             the map itself; height from --mispers-map-height
 *   .mispers-map__status             the line under the map
 *   #mispers-case-map                the small map on a case's own page (--mispers-case-map-height)
 */
.mispers-map { margin: 0 0 1.5em; box-sizing: border-box; }
.mispers-map__canvas { box-sizing: border-box; width: 100%; height: var(--mispers-map-height, 560px); border-radius: 8px; border: 1px solid #d6d9de; z-index: 0; }
.mispers-map__status { font-size: .85em; color: var(--mpdb-muted); margin: .45em 0 0; min-height: 1.3em; }
/* Full width: stretched to the window edges (the theme's .alignfull, else 100vw, then corrected by the script) */
.mispers-map--full { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.mispers-map--full.alignfull { padding-left: 0; padding-right: 0; } /* some themes pad .alignfull */
.mispers-map--full:not(.mispers-map--in-column):not(.mispers-map--partial) .mispers-map__canvas { border-radius: 0; border-left: 0; border-right: 0; }
.mispers-map--full:not(.mispers-map--in-column):not(.mispers-map--partial) .mispers-map__status { padding: 0 var(--mispers-map-gutter, 16px); }
/* width="75%": that share of the window, centred (the script places it exactly) */
.mispers-map--partial { --mispers-map-w: calc(var(--mispers-map-share, 75) * 1vw); width: var(--mispers-map-w); max-width: var(--mispers-map-w); margin-left: calc(50% - var(--mispers-map-w) / 2); margin-right: calc(50% - var(--mispers-map-w) / 2); }
.mispers-case-map { box-sizing: border-box; width: 100%; height: var(--mispers-case-map-height, 320px); border-radius: 8px; border: 1px solid #d6d9de; z-index: 0; }
.mpdb-legend { background: #fff; color: #222; border-radius: 6px; box-shadow: 0 1px 5px rgba(0,0,0,.25); font: 13px/1.35 system-ui, sans-serif; max-width: 230px; }
.mpdb-legend summary { cursor: pointer; font-weight: 600; padding: 7px 10px; }
.mpdb-legend label { display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer; }
.mpdb-legend label:last-child { padding-bottom: 9px; }
.mpdb-legend small { color: #666; margin-left: auto; padding-left: 8px; }
.mpdb-cluster { background: rgba(31,58,95,.88); border: 3px solid rgba(255,255,255,.85); border-radius: 50%; color: #fff; display: flex !important; align-items: center; justify-content: center; font: 600 12px system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.mpdb-pop-cat { color: #666; font-size: .9em; }
.mpdb-swatch { display: inline-block; width: .8em; height: .8em; border-radius: 50%; flex: none; vertical-align: -.05em; margin-right: .35em; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }

/* Search */
.mpdb-search { border: 1px solid var(--mpdb-line); background: var(--mpdb-soft); border-radius: 8px; padding: 1em; margin: 0 0 1.5em; }
.mpdb-search__row { display: flex; flex-wrap: wrap; gap: .75em 1.1em; align-items: flex-end; }
.mpdb-search__row + .mpdb-search__row { margin-top: .9em; }
.mpdb-field { display: flex; flex-direction: column; gap: .3em; font-size: .9em; min-width: 10em; }
.mpdb-field--grow { flex: 1 1 18em; }
.mpdb-field span { font-weight: 600; }
.mpdb-field input, .mpdb-field select { width: 100%; padding: .5em .6em; font: inherit; border: 1px solid var(--mpdb-line); border-radius: 6px; background: Canvas; color: CanvasText; box-sizing: border-box; }
.mpdb-cats { border: 0; padding: 0; margin: .9em 0 0; }
.mpdb-cats legend { font-weight: 600; font-size: .9em; padding: 0; margin-bottom: .4em; }
.mpdb-check { display: inline-flex; gap: .35em; align-items: center; font-size: .9em; }
.mpdb-search__actions { margin-left: auto; display: inline-flex; gap: 1em; align-items: center; font-size: .9em; }
.mpdb-button { display: inline-block; background: var(--mpdb-accent); color: #fff !important; border: 0; border-radius: 6px; padding: .55em 1.2em; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.mpdb-button:hover, .mpdb-button:focus-visible { filter: brightness(1.2); }
.mpdb-button--small { padding: .35em .8em; font-size: .85em; }

/* Results */
.mpdb-results__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5em 1.5em; align-items: baseline; border-bottom: 1px solid var(--mpdb-line); padding-bottom: .5em; }
.mpdb-count { font-weight: 700; margin: 0; }
.mpdb-sort { margin: 0; font-size: .875em; display: flex; flex-wrap: wrap; gap: .3em .9em; }
.mpdb-list { list-style: none; margin: 0; padding: 0; }
.mpdb-item { display: grid; grid-template-columns: 72px 1fr; gap: 1em; padding: 1em 0; border-bottom: 1px solid var(--mpdb-line); margin: 0; }
.mpdb-item__photo img, .mpdb-item__nophoto { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.mpdb-item__nophoto { opacity: .18; }
.mpdb-item__title { font-weight: 700; font-size: 1.05em; text-decoration: none; }
.mpdb-item__title:hover { text-decoration: underline; }
.mpdb-item__meta { margin: .3em 0 0; font-size: .82em; color: var(--mpdb-muted); display: flex; flex-wrap: wrap; gap: .3em .9em; align-items: center; }
.mpdb-item__text { margin: .4em 0 0; font-size: .92em; }
.mpdb-cat { display: inline-flex; align-items: center; margin: 0; }
.mpdb-status { display: inline-block; white-space: nowrap; border-radius: 99px; padding: .05em .65em; font-size: .9em; font-weight: 600; border: 1px solid currentColor; }
.mpdb-status--missing { color: #b42318; }
.mpdb-status--found-alive { color: #1b7f3b; }
.mpdb-status--found-deceased { color: #5a6270; }
.mpdb-empty, .mpdb-note { padding: 1em; background: var(--mpdb-soft); border-radius: 6px; }
.mpdb-note { padding: .3em .6em; font-size: .85em; margin-left: .5em; }
.mpdb-pager { margin: 1.5em 0; display: flex; flex-wrap: wrap; gap: .4em; }
.mpdb-pager .page-numbers { padding: .3em .7em; border: 1px solid var(--mpdb-line); border-radius: 6px; text-decoration: none; }
.mpdb-pager .current { background: var(--mpdb-accent); border-color: var(--mpdb-accent); color: #fff; }

/* Case page: sized by its own column, not the window, so it suits any theme width */
.mpdb-case { container-type: inline-size; }
.mpdb-back { font-size: .9em; }
.mpdb-case__head { margin-bottom: 1.25em; }
.mpdb-case__head .mpdb-cat { font-size: .85em; color: var(--mpdb-muted); }
.mpdb-case__title { margin: .2em 0 .25em; }
.mpdb-case__where { margin: 0 0 .5em; color: var(--mpdb-muted); }
.mpdb-case__top { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 1.5em; align-items: start; margin-bottom: 1.5em; }
.mpdb-case__top--nophoto { grid-template-columns: 1fr; }
.mpdb-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mpdb-gallery__item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; aspect-ratio: 1; }
.mpdb-gallery__item--main { grid-column: 1 / -1; }
.mpdb-gallery__item--main img { aspect-ratio: auto; max-height: 460px; object-fit: contain; background: var(--mpdb-soft); }
.mpdb-dl { margin: 0; }
.mpdb-dl__row { display: grid; grid-template-columns: minmax(6.5em, 38%) 1fr; gap: .75em; padding: .5em 0; border-bottom: 1px solid var(--mpdb-line); }
.mpdb-dl dt { color: var(--mpdb-muted); margin: 0; }
.mpdb-dl dd { margin: 0; overflow-wrap: anywhere; }
.mpdb-case__text { margin: 0 0 1.25em; }
.mpdb-case__text img { max-width: 100%; height: auto; }
.mpdb-case__source { font-size: .9em; }
.mpdb-map--single { margin: 0 0 1.5em; }
.mpdb-case .mpdb-back { margin-top: 1.5em; }
@media (max-width: 600px) {
	/* phones: never taller than most of the screen */
	.mispers-map__canvas { height: min(var(--mispers-map-height, 560px), 70vh); }
	.mispers-map--partial:not(.mispers-map--in-column) { --mispers-map-w: 100vw; }
	.mispers-map--partial:not(.mispers-map--in-column) .mispers-map__canvas { border-radius: 0; border-left: 0; border-right: 0; }
}

/* [mispers_recent] */
.mpdb-recent { margin: 0 0 1.5em; }
.mpdb-recent__title { margin: 0 0 .6em; }
.mpdb-recent__items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 1em; }
.mpdb-recent__item { margin: 0; }
.mpdb-recent__link { display: flex; flex-direction: column; height: 100%; text-decoration: none !important; color: inherit; border: 1px solid var(--mpdb-line); border-radius: 8px; overflow: hidden; background: Canvas; transition: box-shadow .15s, transform .15s; }
.mpdb-recent__link:hover, .mpdb-recent__link:focus-visible { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); }
/* The frame sets the shape, so themes' own img rules (height:auto etc.) can't change it */
.mpdb-recent__photo { display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.mpdb-recent__photo img, .mpdb-recent__nophoto { display: block; width: 100% !important; height: 100% !important; max-width: none; object-fit: cover; object-position: center 20%; }
.mpdb-recent__nophoto { opacity: .2; }
.mpdb-recent__body { display: flex; flex-direction: column; align-items: flex-start; gap: .3em; padding: .7em .8em .85em; }
.mpdb-recent__name { font-weight: 700; line-height: 1.25; }
.mpdb-recent__link:hover .mpdb-recent__name { text-decoration: underline; }
.mpdb-recent__meta { font-size: .82em; color: var(--mpdb-muted); }
.mpdb-recent .mpdb-status { font-size: .75em; }
.mpdb-recent__all { margin: .9em 0 0; font-weight: 600; }
/* list layout: compact rows, suits a sidebar */
.mpdb-recent--list .mpdb-recent__items { grid-template-columns: 1fr; gap: 0; }
.mpdb-recent--list .mpdb-recent__link { flex-direction: row; align-items: center; gap: .75em; border: 0; border-bottom: 1px solid var(--mpdb-line); border-radius: 0; background: none; padding: .6em 0; }
.mpdb-recent--list .mpdb-recent__link:hover { box-shadow: none; transform: none; }
.mpdb-recent--list .mpdb-recent__photo { flex: none; width: 52px; aspect-ratio: 1; border-radius: 6px; }
.mpdb-recent--list .mpdb-recent__body { padding: 0; gap: .15em; }

@container (max-width: 640px) {
	.mpdb-case__top { grid-template-columns: 1fr; }
	.mpdb-gallery { max-width: 360px; }
}

@media (max-width: 680px) {
	.mpdb-field { width: 100%; min-width: 0; }
	.mpdb-search__actions { margin-left: 0; width: 100%; }
	.mpdb-case__top { grid-template-columns: 1fr; }
	.mpdb-item { grid-template-columns: 56px 1fr; }
	.mpdb-item__photo img, .mpdb-item__nophoto { width: 56px; height: 56px; }
}

/* Research notes: only rendered for signed-in users (see Settings & tools). */
.mispers-research { margin: 2em 0; padding: 1.25em 1.5em; border: 1px dashed var(--mpdb-line); border-left: 4px solid #8a2424; border-radius: 6px; background: rgba(138, 36, 36, .03); }
.mispers-research__title { margin: 0 0 .25em; font-size: 1.25em; }
.mispers-research__private { margin: 0 0 1em; font-size: .85em; color: var(--mpdb-muted); }
.mispers-research__group { margin: 1.25em 0 .25em; font-size: .95em; text-transform: uppercase; letter-spacing: .04em; color: var(--mpdb-muted); }
.mispers-research__sources { margin: 0; padding-left: 1.1em; }
.mispers-research__fit { display: inline-block; padding: .1em .6em; border-radius: 1em; font-size: .9em; font-weight: 600; }
.mispers-research__fit--good { background: #e6f4ea; color: #1e5631; }
.mispers-research__fit--partial { background: #fdf5d8; color: #6b4e00; }
.mispers-research__fit--poor { background: #fbe9ea; color: #8a2424; }
.mispers-research__updated { margin: 1em 0 0; font-size: .8em; color: var(--mpdb-muted); }
