/*
 * YourBigFamilyTree — genealogy plugin
 * geneo_media.css — self-contained lightbox/modal for gallery thumbnails and documents
 * on the Individual page. No Bootstrap / jQuery dependency (the front-end theme may not
 * load Bootstrap's JS). Mirrors the look/feel of the File Manager preview modal.
 */

/* ---- Individual profile header (framework-independent, responsive) -------------------
 * Self-contained flexbox so the header never depends on the theme's grid. The theme's
 * Bootstrap `.row`/`.col-md-*` left photo + text side-by-side and colliding below the md
 * breakpoint (flex columns that don't stack); this wraps cleanly on small screens instead.
 */
.geneo-profile-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 18px;
	margin: 0 0 1.25rem;
}
.geneo-profile-header .geneo-photo {
	flex: 0 0 auto;
	width: 300px;
	max-width: 100%; /* up to 300px, but never overflow a narrow column */
}
.geneo-profile-header .geneo-photo:empty { display: none; } /* redacted subjects have no photo */
.geneo-profile-header .geneo-photo img { display: block; width: 100%; height: auto; border-radius: 3px; }
.geneo-profile-header .geneo-headtext {
	flex: 1 1 260px;
	min-width: 0; /* allow long names to wrap instead of forcing overflow */
}
.geneo-profile-header .geneo-name { margin-top: 0; }
.geneo-profile-header .geneo-actions { margin-top: 0.6rem; }
.geneo-profile-header .geneo-actions .btn { margin: 0 4px 4px 0; }

/* Small screens: stack the photo above the text so nothing can collide. The photo keeps its
 * 300px cap but max-width:100% keeps it inside the viewport on narrow phones. */
@media (max-width: 600px) {
	.geneo-profile-header { flex-direction: column; gap: 12px; }
	.geneo-profile-header .geneo-name { font-size: 1.6rem; line-height: 1.2; }
}

/* clickable thumbnails / doc links */
.geneo-media-open { cursor: zoom-in; display: inline-block; }
.geneo-gallery .geneo-media-open img { display: block; }
.geneo-documents .geneo-media-open { cursor: pointer; }

/* overlay */
.geneo-lightbox {
	position: fixed;
	inset: 0;
	z-index: 20000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.82);
	padding: 24px;
	box-sizing: border-box;
}
.geneo-lightbox.is-open { display: flex; }
.geneo-lightbox * { box-sizing: border-box; }

/* dialog */
.geneo-lightbox__dialog {
	position: relative;
	background: #fff;
	color: #222;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	max-width: 96vw;
	max-height: 94vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* header */
.geneo-lightbox__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	border-bottom: 1px solid #e2e2e2;
	background: #f6f6f6;
}
.geneo-lightbox__title {
	font-size: 15px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin: 0;
	flex: 1 1 auto;
}
.geneo-lightbox__head-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

/* body */
.geneo-lightbox__body {
	position: relative;
	padding: 0;
	overflow: auto;
	background: #111;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	min-width: 260px;
}
.geneo-lightbox__body img {
	display: block;
	max-width: 92vw;
	max-height: 78vh;
	width: auto;
	height: auto;
	margin: 0 auto;
}
.geneo-lightbox__body iframe {
	width: 88vw;
	height: 80vh;
	border: 0;
	background: #fff;
}
.geneo-lightbox__none {
	background: #fff;
	color: #555;
	text-align: center;
	padding: 40px 32px;
	width: 420px;
	max-width: 88vw;
}
.geneo-lightbox__none .fa { color: #999; }
.geneo-lightbox__none p { margin: 14px 0 0; }

/* close button */
.geneo-lightbox__close {
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	color: #666;
	cursor: pointer;
	padding: 0 4px;
}
.geneo-lightbox__close:hover { color: #000; }

/* prev / next arrows (image gallery navigation) */
.geneo-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	border: 0;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	font-size: 30px;
	line-height: 1;
	width: 48px;
	height: 64px;
	cursor: pointer;
	z-index: 2;
}
.geneo-lightbox__nav:hover { background: rgba(0, 0, 0, 0.65); }
.geneo-lightbox__nav--prev { left: 0; border-radius: 0 4px 4px 0; }
.geneo-lightbox__nav--next { right: 0; border-radius: 4px 0 0 4px; }
.geneo-lightbox__nav[hidden] { display: none; }

@media (max-width: 640px) {
	.geneo-lightbox { padding: 0; }
	.geneo-lightbox__dialog { max-width: 100vw; max-height: 100vh; border-radius: 0; width: 100vw; height: 100vh; }
	.geneo-lightbox__body img { max-width: 100vw; max-height: 80vh; }
	.geneo-lightbox__body iframe { width: 100vw; height: 82vh; }
}

/* A–Z surname index (individuals.php) — a flex-wrap row of pills, so it wraps onto
 * multiple lines on a phone instead of pushing the page wider than the viewport. */
/* record-id annotation appended after a name, e.g. "John Smith (137)" */
.geneo-idtag { font-size: 0.8em; font-weight: normal; color: #888; }

.geneo-az-index { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 1rem; }
.geneo-az-index .btn { flex: 0 0 auto; min-width: 2.1em; text-align: center; }
@media (max-width: 600px) {
	.geneo-az-index .btn { min-width: 2.4em; padding: 6px 9px; font-size: 15px; }
}

/* Pagination — finger-friendly tap targets (≥44px) that also wrap on small screens. */
.geneo-pager { margin-top: 1rem; }
.geneo-pager .pagination { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 0; align-items: center; }
.geneo-pager .pagination > li { list-style: none; }
.geneo-pager .pagination > li > a,
.geneo-pager .pagination > li > span {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; min-width: 44px; padding: 10px 18px;
	font-size: 16px; border: 1px solid #ccc; border-radius: 4px; text-decoration: none;
}
.geneo-pager .pagination > li.disabled > span { border-color: #e2e2e2; color: #777; background: #f7f7f7; }

/* Structured date-entry widget (individual_edit / family_edit): a row of small inputs that
 * wraps on phones, with the advanced range/free-text box on its own line beneath. */
.geneo-datefield { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.geneo-datefield .geneo-date-part { margin: 0; }
.geneo-datefield .geneo-date-adv { flex: 1 1 100%; margin-top: 4px; }
.geneo-datefield .geneo-date-adv small { display: inline-block; margin-right: 4px; }

/* "view on map" link appended to place facts on the individual profile */
.geneo-maplink { font-size: .8em; white-space: nowrap; text-decoration: none; opacity: .8; }
.geneo-maplink:hover { opacity: 1; }
.geneo-breadcrumb { margin-bottom: .75rem; }

/* Biography sits in the header, right of the photo (below the action buttons). */
.geneo-headtext .geneo-biography { margin-top: 1.1rem; }
.geneo-headtext .geneo-biography h3 { margin-top: 0; }

/* Lower area: Family (left) and Notes (right) side by side, stacking on narrow screens. */
.geneo-lower { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; margin-top: 1rem; }
.geneo-lower .geneo-family { flex: 1 1 300px; min-width: 0; margin-top: 0; }
.geneo-lower .geneo-notes  { flex: 1 1 320px; min-width: 0; }
.geneo-lower .geneo-notes:empty { display: none; }
.geneo-notes-block h3 { margin-top: 0; }
/* Preserve the original line breaks of imported NOTE text (e.g. the Horn book pages). */
.geneo-notes-text {
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	max-height: 32rem;
	overflow-y: auto;
	padding: .6rem .8rem;
	background: #fafafa;
	border: 1px solid #ececec;
	border-radius: 4px;
	font-size: .95em;
	line-height: 1.4;
}
