/* ==========================================================================
   Grave details slide-in panel.

   BASE styles below apply to the DEFAULT theme (original light look).
   The redesigned "rich" panel (used by MEMORIAL / GARDEN / HERITAGE) is
   layered at the bottom, scoped under `body.theme-rich`. It only adds/
   overrides and is purely token-driven (--gd-* from themes.css), so each
   theme is just a palette — DEFAULT renders exactly as it did before.
   ========================================================================== */

/* ---- Base image (shared / default) ------------------------------------- */

.grave-image-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	overflow: hidden;
}

.grave-image-wrap-thumb {
	height: 400px;
}

.grave-image-thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
}

.grave-gallery-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.grave-gallery-thumb {
	display: block;
	width: 72px;
	height: 72px;
	border-radius: 6px;
	overflow: hidden;
	border: 2px solid transparent;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.grave-gallery-thumb:hover {
	border-color: #4c6f92;
	transform: translateY(-1px);
}

.grave-gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.grave-image-wrap-detail {
	max-height: 450px;
	min-height: 200px;
}

.grave-image-detail {
	display: block;
	max-width: 100%;
	max-height: 450px;
	width: auto;
	height: auto;
}

.js-img-link:focus {
	outline: none !important;
	box-shadow: none !important;
}
.js-img-link:focus-visible {
	outline: none !important;
}

/* ---- Panel width (both themes) ----------------------------------------- */
/* Mobile: span the full viewport; desktop: fixed side panel. The selector
   beats Bootstrap's .modal-dialog max-width rules. */

#grave-info-modal .modal-dialog.grave-info-modal {
	width: 100vw;
	max-width: 100%;
}

@media (min-width: 768px) {
	#grave-info-modal .modal-dialog.grave-info-modal {
		width: 500px;
		max-width: 500px;
	}
}

/* Opened from the grave sheet on a phone, the panel rises out of the sheet's top edge and sinks back into
   it, instead of sliding in from the side (grave-details.js sets --grave-sheet-top). */
#grave-info-modal.modal-slide-right.is-from-sheet .modal-dialog {
	transform: translateY(var(--grave-sheet-top, 100%));
	transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

#grave-info-modal.modal-slide-right.is-from-sheet.show .modal-dialog {
	transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	#grave-info-modal.modal-slide-right.is-from-sheet .modal-dialog {
		transition: none;
	}
}

/* ==========================================================================
   MEMORIAL theme — dark gold redesign (colors from themes.css tokens)
   ========================================================================== */

/* ---- Panel shell -------------------------------------------------------- */

body.theme-rich #grave-info-modal .modal-content {
	height: 100%;
	border: 0;
	border-radius: 0;
	border-left: 1px solid var(--gd-border);
	background: linear-gradient(180deg, var(--gd-bg-2) 0%, var(--gd-bg) 38%);
	color: var(--gd-text) !important;
	box-shadow: var(--gd-panel-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

body.theme-rich #grave-info-modal .gd-body {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0 22px 22px;
	scrollbar-width: thin;
	scrollbar-color: var(--gd-gold-muted) transparent;
}

body.theme-rich #grave-info-modal .gd-body::-webkit-scrollbar {
	width: 8px;
}

body.theme-rich #grave-info-modal .gd-body::-webkit-scrollbar-thumb {
	background: var(--gd-scroll-thumb);
	border-radius: 8px;
}

/* ---- Section label (eyebrow) ------------------------------------------- */

body.theme-rich #grave-info-modal .gd-eyebrow {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 14px;
	font-family: 'Open Sans', sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--gd-gold);
}

body.theme-rich #grave-info-modal .gd-eyebrow > i {
	font-size: 12px;
	opacity: 0.85;
}

body.theme-rich #grave-info-modal .gd-eyebrow::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: linear-gradient(90deg, var(--gd-border) 0%, transparent 100%);
}

/* ---- Header ------------------------------------------------------------- */

body.theme-rich #grave-info-modal .gd-header {
	position: relative;
	padding: 26px 22px 18px;
	border-bottom: 1px solid var(--gd-border);
}

body.theme-rich #grave-info-modal .gd-header .gd-eyebrow {
	margin-bottom: 8px;
}

body.theme-rich #grave-info-modal .gd-header .gd-eyebrow::after {
	display: none;
}

body.theme-rich #grave-info-modal .gd-title {
	margin: 0;
	font-family: var(--gd-serif);
	font-weight: 600;
	font-size: 24px;
	line-height: 1.15;
	letter-spacing: 0.01em;
	color: var(--gd-title-color);
}

body.theme-rich #grave-info-modal .gd-close {
	position: absolute;
	top: 22px;
	right: 22px;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid var(--gd-border);
	border-radius: 4px;
	background: transparent;
	color: var(--gd-text-muted);
	font-size: 20px;
	line-height: 1;
	opacity: 1;
	transition: all 0.18s ease;
}

body.theme-rich #grave-info-modal .gd-close:hover {
	border-color: var(--gd-border-strong);
	color: var(--gd-gold);
	background: var(--gd-surface-hover);
}

/* ---- Image -------------------------------------------------------------- */

body.theme-rich #grave-info-modal .gd-image-block {
	margin: 22px 0 8px;
}

body.theme-rich .grave-image-wrap {
	background: var(--gd-image-bg);
	border: 1px solid var(--gd-border);
	border-radius: 6px;
}

body.theme-rich .grave-image-wrap-thumb {
	height: 230px;
}

body.theme-rich #grave-info-modal .gd-image-caption {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin-top: 10px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--gd-gold-muted);
}

/* ---- Generic section spacing ------------------------------------------- */

body.theme-rich #grave-info-modal .gd-section {
	padding-top: 22px;
	margin-top: 22px;
	border-top: 1px solid var(--gd-border);
}

body.theme-rich #grave-info-modal .gd-section:first-of-type {
	border-top: 0;
}

/* ---- Free-for-sale notice ---------------------------------------------- */

body.theme-rich #grave-info-modal .gd-free {
	padding: 14px 16px;
	border: 1px solid var(--gd-border);
	border-left: 3px solid var(--gd-gold);
	border-radius: 6px;
	background: var(--gd-surface);
	color: var(--gd-text);
	font-size: 13.5px;
	line-height: 1.55;
}

/* ---- Person card -------------------------------------------------------- */

body.theme-rich #grave-info-modal .g-person {
	position: relative;
	display: flex;
	gap: 14px;
	padding: 16px 16px;
	margin-bottom: 12px;
	border: 1px solid var(--gd-border);
	border-radius: 7px;
	background: var(--gd-surface);
}

body.theme-rich #grave-info-modal .g-person:last-child {
	margin-bottom: 0;
}

body.theme-rich #grave-info-modal .g-person-icon {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--gd-border-strong);
	border-radius: 6px;
	color: var(--gd-gold);
	font-size: 14px;
}

body.theme-rich #grave-info-modal .g-person-body {
	flex: 1 1 auto;
	min-width: 0;
}

body.theme-rich #grave-info-modal .js-fullname {
	margin: 0 0 10px;
	font-family: var(--gd-serif);
	font-size: 19px;
	font-weight: 500;
	color: var(--gd-name-color);
}

body.theme-rich #grave-info-modal .g-person-dates {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 26px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body.theme-rich #grave-info-modal .g-person-dates li {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

body.theme-rich #grave-info-modal .g-date-label {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gd-gold-muted);
}

body.theme-rich #grave-info-modal .g-date-value {
	font-size: 14px;
	color: var(--gd-text);
}

body.theme-rich #grave-info-modal .g-person-age {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-top: 11px;
	font-size: 12.5px;
	font-style: italic;
	color: var(--gd-text-muted);
}

body.theme-rich #grave-info-modal .g-person-age > i {
	font-size: 9px;
	color: var(--gd-gold);
	font-style: normal;
}

/* ---- Owner card --------------------------------------------------------- */

body.theme-rich #grave-info-modal .g-owner {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	margin-bottom: 10px;
	border: 1px solid var(--gd-border);
	border-radius: 7px;
	background: var(--gd-surface);
}

body.theme-rich #grave-info-modal .g-owner:last-child {
	margin-bottom: 0;
}

body.theme-rich #grave-info-modal .g-owner-icon {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--gd-border-strong);
	border-radius: 6px;
	color: var(--gd-gold);
	font-size: 14px;
}

body.theme-rich #grave-info-modal .g-owner-body {
	min-width: 0;
}

body.theme-rich #grave-info-modal .g-owner-label {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gd-gold-muted);
	margin-bottom: 3px;
}

body.theme-rich #grave-info-modal .js-owner {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--gd-text);
}

/* ---- Buttons ------------------------------------------------------------ */

body.theme-rich #grave-info-modal .gd-share {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

body.theme-rich #grave-info-modal .gd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--gd-border);
	border-radius: 5px;
	background: transparent;
	color: var(--gd-text);
	font-family: 'Open Sans', sans-serif;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: all 0.18s ease;
}

body.theme-rich #grave-info-modal .gd-btn:hover,
body.theme-rich #grave-info-modal .gd-btn:focus {
	border-color: var(--gd-border-strong);
	color: var(--gd-gold-soft);
	background: var(--gd-surface-hover);
	outline: none;
}

body.theme-rich #grave-info-modal .gd-btn-primary {
	border-color: var(--gd-btn-primary-border);
	color: var(--gd-btn-primary-text);
	background: var(--gd-btn-primary-bg);
}

body.theme-rich #grave-info-modal .gd-btn-primary:hover,
body.theme-rich #grave-info-modal .gd-btn-primary:focus {
	border-color: var(--gd-btn-primary-border);
	color: var(--gd-btn-primary-hover-text);
	background: var(--gd-btn-primary-hover-bg);
}

body.theme-rich #grave-info-modal .gd-btn-ghost {
	border-color: transparent;
	color: var(--gd-text-muted);
}

body.theme-rich #grave-info-modal .gd-btn-ghost:hover,
body.theme-rich #grave-info-modal .gd-btn-ghost:focus {
	border-color: var(--gd-border);
	color: var(--gd-gold-soft);
	background: transparent;
}

body.theme-rich #grave-info-modal .gd-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ---- Footer ------------------------------------------------------------- */

body.theme-rich #grave-info-modal .gd-footer {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 22px;
	border-top: 1px solid var(--gd-border);
	background: var(--gd-footer-bg);
}

body.theme-rich #grave-info-modal .gd-footer-brand {
	font-family: var(--gd-serif);
	font-size: 16px;
	color: var(--gd-gold);
	letter-spacing: 0.02em;
}

body.theme-rich #grave-info-modal .gd-footer-nav {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--gd-text-muted);
}

body.theme-rich #grave-info-modal .gd-footer-arrow {
	width: 26px;
	height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--gd-border);
	border-radius: 4px;
	background: transparent;
	color: var(--gd-text-muted);
	transition: all 0.18s ease;
}

body.theme-rich #grave-info-modal .gd-footer-arrow:hover {
	border-color: var(--gd-border-strong);
	color: var(--gd-gold);
}

/* ==========================================================================
   Grave sheet — on a phone a picked grave first shows as a short sheet over
   the lower part of the map (who lies there, Detalji, Navigacija); the full
   panel above opens from it. Every theme, token-driven. Stacked over the map
   search (1020) and under the navbar (1030), so the hamburger menu still
   covers it, and under the modals.
   ========================================================================== */

.grave-sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1025;
	--grave-sheet-bg: var(--gd-bg-2, #ffffff);
	display: flex;
	flex-direction: column;
	max-height: 60dvh;
	padding-bottom: env(safe-area-inset-bottom);
	background: var(--grave-sheet-bg);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	color: var(--gd-text, #2D3436);
	border-top: 1px solid var(--gd-border, rgba(0, 0, 0, 0.08));
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.22);
	font-family: 'Open Sans', sans-serif;
	transform: translateY(100%);
	transition: transform 0.25s ease-out;
}

/* The map lets a little through, as it does under the search bar. */
@supports (background: color-mix(in srgb, red 50%, transparent)) {
	.grave-sheet {
		--grave-sheet-bg: color-mix(in srgb, var(--gd-bg-2, #ffffff) 84%, transparent);
	}
}

/* Runs on below the screen, so no rounding of the slide leaves a line of map under the sheet. */
.grave-sheet::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	height: 64px;
	background: var(--grave-sheet-bg);
}

.grave-sheet.is-open {
	transform: translateY(0);
}

.grave-sheet.is-dragging {
	transition: none;
}

@media (min-width: 768px) {
	.grave-sheet {
		display: none !important;
	}
}

.grave-sheet-grab {
	flex: 0 0 auto;
	padding: 8px 8px 0 16px;
	touch-action: none;
}

.grave-sheet-handle {
	width: 40px;
	height: 4px;
	margin: 0 auto 8px;
	border-radius: 2px;
	background: var(--gd-border-strong, #c3cbd1);
}

.grave-sheet-head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.grave-sheet-thumb {
	flex: 0 0 56px;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	object-fit: cover;
	object-position: top;
	background: var(--gd-image-bg, #eef1f3);
}

.grave-sheet-titles {
	flex: 1 1 auto;
	min-width: 0;
}

.grave-sheet-eyebrow {
	font-size: .7rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--gd-gold, #5f6f7a);
}

.grave-sheet-title {
	margin: 2px 0 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--gd-serif, 'Open Sans', sans-serif);
	font-size: 1.2rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gd-title-color, #2D3436);
}

.grave-sheet-close {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: 1.75rem;
	line-height: 1;
	color: var(--gd-text-muted, #6c757d);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.grave-sheet-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 16px 4px;
	font-size: .95rem;
}

.grave-sheet-free {
	margin-bottom: 6px;
	font-weight: 600;
	color: var(--gd-gold, #5f6f7a);
}

.grave-sheet-persons {
	margin: 0;
	padding: 0;
	list-style: none;
}

.grave-sheet-persons li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 3px 0;
}

.grave-sheet-person {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
	color: var(--gd-name-color, var(--gd-text, #2D3436));
}

.grave-sheet-years {
	flex: 0 0 auto;
	font-size: .85rem;
	color: var(--gd-text-muted, #6c757d);
}

.grave-sheet-persons li.grave-sheet-more {
	font-size: .85rem;
	color: var(--gd-text-muted, #6c757d);
}

.grave-sheet-owners {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px solid var(--gd-border, #e2e6ea);
	font-size: .85rem;
	color: var(--gd-text-muted, #6c757d);
}

.grave-sheet-owners i {
	flex: 0 0 auto;
	font-size: .75rem;
	opacity: .75;
}

/* The buttons are part of what the sheet is dragged by (grave-details.js); a tap still presses them. */
.grave-sheet-actions {
	flex: 0 0 auto;
	touch-action: none;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 10px 16px 12px;
}

.grave-sheet-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 12px;
	border: 1px solid var(--gd-border-strong, #c3cbd1);
	border-radius: 8px;
	background: var(--gd-surface, #ffffff);
	color: var(--gd-text, #2D3436);
	font-size: .95rem;
	font-weight: 600;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.grave-sheet-btn:active {
	background: var(--gd-surface-hover, #eef1f3);
}

.grave-sheet-btn-primary {
	background: var(--gd-btn-primary-bg, #6C7A89);
	color: var(--gd-btn-primary-text, #ffffff);
	border-color: var(--gd-btn-primary-border, #6C7A89);
}

.grave-sheet-btn-primary:active {
	background: var(--gd-btn-primary-hover-bg, #5a6671);
	color: var(--gd-btn-primary-hover-text, #ffffff);
}

body .grave-sheet button:focus:not(:focus-visible) {
	outline: none !important;
}

.grave-sheet-btn:disabled {
	opacity: .45;
	cursor: default;
}
