/*
 * CityScene layout — admin meta-box picker and shared front-end render.
 *
 * Two visual halves:
 *   .cityscene-layout-admin  → editor's two-pane picker + preview (admin only)
 *   .cityscene-layout-render → final published layout (admin preview + FE)
 */

/* ================================================================== */
/* Admin: two-pane editor                                             */
/* ================================================================== */

.cityscene-layout-admin {
	font-family: inherit;
	color: #222;
}

.cityscene-layout-admin__panes {
	display: grid;
	grid-template-columns: minmax(300px, 360px) 1fr;
	gap: 24px;
	align-items: start;
}

@media (max-width: 991.98px) {
	.cityscene-layout-admin__panes {
		grid-template-columns: 1fr;
	}
}

.cityscene-layout-admin__pane-title {
	margin: 0 0 12px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #6b7280;
}

.cityscene-layout-admin__add-event {
	display: block;
	width: 100%;
	margin: 0 0 16px;
	text-align: center;
	box-sizing: border-box;
}

.cityscene-layout-admin__empty {
	color: #6b7280;
	font-style: italic;
	padding: 16px 0;
}

/* ----- Left pane: event accordion ---------------------------------- */

.cityscene-layout-admin__picker {
	max-height: 1200px;
	overflow-y: auto;
	padding-right: 4px;
}

.cityscene-layout-admin__event {
	border: 1px solid #cfd4da;
	border-radius: 6px;
	margin-bottom: 8px;
	background: #fff;
}

.cityscene-layout-admin__event-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
}

.cityscene-layout-admin__event-drag {
	cursor: grab;
	color: #9ca3af;
	font-size: 16px;
	line-height: 1;
	user-select: none;
	padding: 0 4px;
}

.cityscene-layout-admin__event-drag:active {
	cursor: grabbing;
}

.cityscene-layout-admin__event-checkbox {
	flex-shrink: 0;
	margin: 0;
	cursor: pointer;
}

.cityscene-layout-admin__event-name {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cityscene-layout-admin__event-count {
	font-size: 12px;
	color: #6b7280;
	flex-shrink: 0;
}

.cityscene-layout-admin__event-expand {
	appearance: none;
	border: 0;
	background: transparent;
	color: #222;
	cursor: pointer;
	font-size: 42px;
	line-height: 0;
	border-radius: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}

.cityscene-layout-admin__event-expand:hover:not(:disabled) {
	background: #f3f4f6;
}

.cityscene-layout-admin__event-expand:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.cityscene-layout-admin__event-expand[aria-expanded="true"] {
	transform: rotate(180deg);
}

/* ----- Photo list inside an expanded event ------------------------- */

.cityscene-layout-admin__event-photos {
	border-top: 1px solid #e5e7eb;
	padding: 8px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cityscene-layout-admin__event-photos[hidden] {
	display: none;
}

/* When the parent event is unchecked, the panel can still be expanded so
 * editors reach Edit / Delete, but individual photo rows are visually
 * dimmed (via `.is-excluded` already) and made un-clickable. */
.cityscene-layout-admin__event-photos.is-event-disabled .cityscene-layout-admin__photo {
	pointer-events: none;
}

.cityscene-layout-admin__event-edit,
.cityscene-layout-admin__event-delete {
	appearance: none;
	background: #fff;
	font: inherit;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	display: block;
	width: 100%;
	text-align: center;
	box-sizing: border-box;
}

.cityscene-layout-admin__event-edit {
	border: 1px solid #cfd4da;
	color: #374151;
	margin-bottom: 6px;
}

.cityscene-layout-admin__event-edit:hover {
	border-color: #006837;
	color: #006837;
}

.cityscene-layout-admin__event-delete {
	border: 1px solid #b91c1c;
	color: #b91c1c;
	margin-top: 6px;
}

.cityscene-layout-admin__event-delete:hover:not(:disabled) {
	background: #b91c1c;
	color: #fff;
}

.cityscene-layout-admin__event-delete:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.cityscene-layout-admin__photo {
	display: grid;
	grid-template-columns: auto 56px 1fr;
	gap: 8px;
	align-items: center;
	padding: 6px;
	border-radius: 4px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.cityscene-layout-admin__photo:hover {
	background: #eef2f6;
}

.cityscene-layout-admin__photo.is-excluded {
	opacity: 0.5;
}

.cityscene-layout-admin__photo-handle {
	cursor: grab;
	color: #9ca3af;
	font-size: 16px;
	user-select: none;
	padding: 0 4px;
}

.cityscene-layout-admin__photo-handle:active {
	cursor: grabbing;
}

.cityscene-layout-admin__photo-thumb-wrap {
	position: relative;
	display: block;
	width: 56px;
	height: 56px;
}

.cityscene-layout-admin__photo-thumb {
	display: block;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 3px;
	background: #e5e7eb;
}

/* Hover hint on an included photo: red X overlay so editors know that
 * clicking will remove it from the layout. Excluded photos (already at
 * 50% opacity) get no overlay — clicking re-includes them. */
.cityscene-layout-admin__photo:not(.is-excluded):hover .cityscene-layout-admin__photo-thumb-wrap::after {
	content: "✕";
	position: absolute;
	inset: 0;
	background: rgba(220, 38, 38, 0.7);
	color: #fff;
	font-size: 28px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 3px;
	pointer-events: none;
}

.cityscene-layout-admin__photo-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.cityscene-layout-admin__photo-caption {
	font-size: 13px;
	color: #374151;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cityscene-layout-admin__photo-toggles {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.cityscene-layout-admin__photo-toggle {
	appearance: none;
	border: 1px solid #cfd4da;
	background: #fff;
	color: #374151;
	font: inherit;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 3px;
	cursor: pointer;
}

.cityscene-layout-admin__photo-toggle:hover {
	border-color: #006837;
	color: #006837;
}

.cityscene-layout-admin__photo-toggle.is-on {
	background: #006837;
	border-color: #006837;
	color: #fff;
}

/* ----- Right pane: read-only preview ------------------------------- */

.cityscene-layout-admin__preview {
	min-height: 200px;
}

.cityscene-layout-admin__preview-canvas {
	border: 1px dashed #cfd4da;
	border-radius: 6px;
	background: #fafbfc;
	padding: 0;
	min-height: 200px;
	box-sizing: border-box;
}

.cityscene-layout-admin__preview-empty {
	color: #6b7280;
	font-style: italic;
	padding: 24px;
	text-align: center;
}

/* ================================================================== */
/* Shared render: rows of absolute-positioned tiles + overlays        */
/* (admin live preview + front-end shortcode)                         */
/* ================================================================== */

.cityscene-layout-render {
	position: relative;
	width: 100%;
}

.cityscene-layout-render__item {
	position: relative;
	overflow: hidden;
	margin: 0;
	background: #e5e7eb;
}

.cityscene-layout-render__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cityscene-layout-render__overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	margin: 0;
	padding: 16px 14px 12px;
	color: #fff;
	line-height: 1.3;
}

/* Gradient sits behind the caption text and extends 50% above the overlay
 * itself so the fade reaches well into the image. Text children get
 * position:relative + z-index so they render above this pseudo-element. */
.cityscene-layout-render__overlay::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 150%;
	background: linear-gradient(to top, #000 33%, transparent 100%);
	pointer-events: none;
	z-index: 0;
}

.cityscene-layout-render__overlay > * {
	position: relative;
	z-index: 1;
}

.cityscene-layout-render__img-event {
	font-weight: 500;
	font-size: .8236rem;
	text-transform: uppercase;
	font-family: itc-avant-garde-gothic-pro, sans-serif;
	color: white;
	opacity: .82;
}

.cityscene-layout-render__img-people {
	font-weight: 700;
	font-size: 1rem;
	text-transform: capitalize;
	font-family: itc-avant-garde-gothic-pro, sans-serif;
	color: white;
}

.cityscene-layout-render__img-credit {
	font-family: din-1451-lt-pro-engschrift, sans-serif;
	font-style: normal;
	font-weight: 400;
	letter-spacing: 0.059em;
	line-height: 1.2;
	text-transform: uppercase;
	color: white;
	opacity: .82;
}

/* ================================================================== */
/* Admin: "Add an event" modal                                        */
/* ================================================================== */

.cityscene-modal {
	position: fixed;
	inset: 0;
	z-index: 100050;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 48px 16px;
	overflow-y: auto;
}

.cityscene-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	cursor: pointer;
}

.cityscene-modal__panel {
	position: relative;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
	width: min(720px, 100%);
	max-width: 100%;
}

.cityscene-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	border-bottom: 1px solid #e5e7eb;
}

.cityscene-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}

.cityscene-modal__close {
	font-size: 28px;
	line-height: 1;
	color: #6b7280;
	text-decoration: none;
	padding: 0 4px;
}

.cityscene-modal__close:hover,
.cityscene-modal__close:focus {
	color: #111827;
}

.cityscene-modal__body {
	padding: 20px 24px 24px;
}

.cityscene-modal__body .cityscene-form--upload {
	max-width: none;
}
