/*
 * A trip section's forms (templates/admin/editor/section.html, dialog_body.html), and the long items stacked in them
 * (templates/admin/home/stack_item.html), on the panel styles in admin-forms.css.
 */
.eb-trip-editing-body {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* In a section, the panels sit flat, one after another. */
.eb-trip-editing-body .eb-panel {
	box-shadow: none;
	padding: 0;
}

.eb-trip-editing-body .eb-panel + .eb-panel {
	border-top: 1px solid var(--color-base-200);
	padding-top: 1.25rem;
}

/* A section's own fields: short ones two to a line, text boxes across. */
.eb-trip-editing-body .eb-fields {
	display: grid;
	gap: 0 1.25rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.eb-trip-editing-body .eb-fields > :has(textarea, trix-editor, [data-picture]) {
	grid-column: 1 / -1;
}

/* With a photo among them, the photo takes a column of its own on the left and the rest stack beside it, so no
   field stands alone on half an empty line (a trip's top: its cover photo, then its title, categories and badge). */
.eb-trip-editing-body .eb-fields:has([data-picture]) {
	grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
}

.eb-trip-editing-body .eb-fields:has([data-picture]) > * {
	grid-column: 2;
}

.eb-trip-editing-body .eb-fields:has([data-picture]) > :has([data-picture]) {
	grid-column: 1;
	grid-row: 1 / span 12;
}

/* A long item: its line with its name and buttons, then all its fields. */
.eb-stack {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.eb-stack-item {
	background: var(--color-base-50);
	border-radius: 0.625rem;
}

.eb-stack-head {
	align-items: center;
	border-bottom: 1px solid var(--color-base-200);
	display: flex;
	gap: 0.75rem;
	padding: 0.625rem 1rem;
}

.eb-stack-name {
	color: var(--color-base-900);
	flex: 1;
	font-weight: 600;
	min-width: 0;
}

.eb-stack-head .eb-actions {
	flex-direction: row;
}

.eb-stack-fields {
	display: grid;
	gap: 0 1rem;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	padding: 0.5rem 1rem 1rem;
}

.eb-stack-fields > :has(textarea, trix-editor, [data-picture]) {
	grid-column: 1 / -1;
}

/* A long item's name (a heading, a question, a title) gets room to be read whole. */
.eb-stack-fields > :has(input[name$="-heading"], input[name$="-question"], input[name$="-title"], input[name$="-name"]) {
	grid-column: span 2;
}

.eb-stack-fields input[type="text"] {
	max-width: none;
}

.dark .eb-stack-item {
	background: var(--color-base-900);
}

.dark .eb-stack-name {
	color: var(--color-base-100);
}

/* A picture while editing keeps a card's size rather than filling the width. */
.eb-trip-editing-body .eb-picture {
	max-width: 360px;
}

/* A section's own heading while it is edited: a large box in the heading's place, the standfirst under it. */
.eb-trip-section-head .eb-heading-edit {
	flex: 1;
	max-width: 760px;
}

.eb-trip-section-head:has(.eb-heading-edit:not([hidden])) {
	align-items: flex-start;
}

.eb-heading-edit [data-item] {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.eb-heading-input,
.eb-heading-lede {
	border: 1px dashed var(--color-base-300);
	border-radius: 0.5rem;
	padding: 0.375rem 0.625rem;
	width: 100%;
}

.eb-heading-input {
	color: var(--color-base-900);
	font-size: 1.375rem;
	font-weight: 700;
}

.eb-heading-lede {
	color: var(--color-base-600);
	font-size: 0.9375rem;
	resize: vertical;
}

.eb-heading-input:focus,
.eb-heading-lede:focus {
	border-color: var(--color-primary-600);
	border-style: solid;
	outline: none;
}

.eb-heading-input::placeholder,
.eb-heading-lede::placeholder {
	color: var(--color-base-400);
}

.dark .eb-heading-input {
	color: var(--color-base-100);
}

/* Unfold caps its boxes and its rich text editor at a set width; in the trip editor they use the room there is. */
.eb-trip [class*="max-w-"],
.eb-trip input[type="text"],
.eb-trip input[type="url"],
.eb-trip textarea,
.eb-trip trix-editor {
	max-width: none;
}
