/* Kasabian Archive Setlist Generator: interface.
   Colours follow the surrounding theme: text is inherited, lines and fills are
   neutral tints, and the script sets --ka-sg-surface to the page background
   and --ka-sg-ink to the text colour, so the search dropdown and the filled
   buttons work on light and dark themes. */

.ka-sg {
	--ka-sg-surface: #fff;
	--ka-sg-ink: #111;
	--ka-sg-line: rgba(128, 128, 128, 0.45);
	--ka-sg-fill: rgba(128, 128, 128, 0.12);
	--ka-sg-fill-strong: rgba(128, 128, 128, 0.24);
	--ka-sg-muted: 0.68;
	--ka-sg-radius: 6px;
	box-sizing: border-box;
	max-width: 1180px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.4;
	text-align: left;
}

.ka-sg *,
.ka-sg *::before,
.ka-sg *::after {
	box-sizing: border-box;
}

.ka-sg [hidden] {
	display: none !important;
}

.ka-sg .ka-sg__layout {
	/* Two columns when the theme's content area is wide enough, otherwise one.
	   This follows the width of the container, not of the browser window. */
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 28px;
}

.ka-sg .ka-sg__controls {
	flex: 11 1 380px;
}

.ka-sg .ka-sg__preview {
	position: sticky;
	top: 24px;
	flex: 9 1 320px;
}

.ka-sg .ka-sg__controls {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.ka-sg .ka-sg__field {
	position: relative;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.ka-sg .ka-sg__row {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.ka-sg .ka-sg__field--venue {
	flex: 1 1 240px;
}

.ka-sg .ka-sg__field--date {
	flex: 1 1 170px;
	max-width: 100%;
}

.ka-sg .ka-sg__label {
	display: block;
	float: none;
	width: auto;
	margin: 0 0 6px;
	padding: 0;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
	color: inherit;
}

.ka-sg .ka-sg__input {
	display: block;
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	background: var(--ka-sg-fill);
	color: inherit;
	font: inherit;
	font-size: 16px; /* Stops iOS zooming the page on focus. */
	line-height: 1.2;
	box-shadow: none;
}

.ka-sg .ka-sg__input::placeholder {
	color: inherit;
	opacity: 0.5;
}

.ka-sg .ka-sg__input:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.ka-sg.ka-sg--dark .ka-sg__input[type="date"] {
	color-scheme: dark;
}

.ka-sg .ka-sg__input:focus-visible,
.ka-sg .ka-sg__btn:focus-visible,
.ka-sg .ka-sg__icon:focus-visible,
.ka-sg .ka-sg__segment input:focus-visible + span {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Design selector */

.ka-sg .ka-sg__segments {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
	gap: 6px;
}

.ka-sg .ka-sg__segment {
	position: relative;
	display: block;
	margin: 0;
	cursor: pointer;
}

.ka-sg .ka-sg__segment input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ka-sg .ka-sg__segment span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 6px 8px;
	border: 1px solid var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	background: var(--ka-sg-fill);
	font-weight: 600;
	text-align: center;
}

.ka-sg .ka-sg__segment:hover span {
	background: var(--ka-sg-fill-strong);
}

/* The selected design is filled with the text colour; its label takes the page colour. */
.ka-sg .ka-sg__segment input:checked + span {
	border-color: var(--ka-sg-ink);
	background: var(--ka-sg-ink);
	color: var(--ka-sg-surface);
}

/* Buttons */

.ka-sg .ka-sg__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	margin: 0;
	padding: 8px 18px;
	border: 1px solid var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	background: var(--ka-sg-fill);
	color: inherit;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	box-shadow: none;
}

.ka-sg .ka-sg__btn:hover:not(:disabled) {
	background: var(--ka-sg-fill-strong);
}

.ka-sg .ka-sg__btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.ka-sg .ka-sg__btn--small {
	min-height: 36px;
	padding: 4px 12px;
	font-size: 14px;
}

.ka-sg .ka-sg__btn--primary {
	width: 100%;
	min-height: 54px;
	border-color: var(--ka-sg-ink);
	background: var(--ka-sg-ink);
	color: var(--ka-sg-surface);
	font-size: 17px;
	font-weight: 700;
}

.ka-sg .ka-sg__btn--primary:hover:not(:disabled) {
	background: var(--ka-sg-ink);
	opacity: 0.86;
}

/* Search results */

.ka-sg .ka-sg__results {
	position: absolute;
	z-index: 50;
	top: 100%;
	right: 0;
	left: 0;
	max-height: 320px;
	margin: 4px 0 0;
	padding: 4px;
	overflow-y: auto;
	border: 1px solid var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	background: var(--ka-sg-surface);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	list-style: none;
}

.ka-sg .ka-sg__result {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 12px;
	min-height: 44px;
	margin: 0;
	padding: 10px 10px;
	border-radius: 4px;
	list-style: none;
	cursor: pointer;
	overflow-wrap: anywhere;
}

.ka-sg .ka-sg__result::before {
	content: none;
}

.ka-sg .ka-sg__result:hover,
.ka-sg .ka-sg__result.is-active {
	background: var(--ka-sg-fill-strong);
}

.ka-sg .ka-sg__result--note {
	cursor: default;
	opacity: var(--ka-sg-muted);
}

.ka-sg .ka-sg__result--note:hover {
	background: none;
}

.ka-sg .ka-sg__result-title {
	font-weight: 600;
}

.ka-sg .ka-sg__result-album {
	font-size: 13px;
	opacity: var(--ka-sg-muted);
}

/* Selected songs */

.ka-sg .ka-sg__listhead {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.ka-sg .ka-sg__listhead .ka-sg__label {
	margin: 0;
}

.ka-sg .ka-sg__count {
	margin-right: auto;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	opacity: var(--ka-sg-muted);
}

.ka-sg .ka-sg__count.is-full {
	font-weight: 700;
	opacity: 1;
}

.ka-sg .ka-sg__list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ka-sg .ka-sg__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 2px;
	min-height: 48px;
	margin: 0;
	padding: 2px 4px;
	border: 1px solid var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	background: var(--ka-sg-fill);
	list-style: none;
}

.ka-sg .ka-sg__item::before {
	content: none;
}

.ka-sg .ka-sg__item--encore {
	border-style: dashed;
	background: none;
}

.ka-sg .ka-sg__item--encore .ka-sg__title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ka-sg .ka-sg__item.is-dragging {
	z-index: 5;
	background: var(--ka-sg-surface);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	opacity: 0.95;
}

.ka-sg .ka-sg__item.is-drop-before::after,
.ka-sg .ka-sg__item.is-drop-after::after {
	content: "";
	position: absolute;
	right: 0;
	left: 0;
	height: 3px;
	border-radius: 2px;
	background: currentColor;
}

.ka-sg .ka-sg__item.is-drop-before::after {
	top: -5px;
}

.ka-sg .ka-sg__item.is-drop-after::after {
	bottom: -5px;
}

.ka-sg.ka-sg--dragging {
	user-select: none;
	-webkit-user-select: none;
}

.ka-sg .ka-sg__num {
	flex: 0 0 26px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	text-align: right;
	opacity: var(--ka-sg-muted);
}

.ka-sg .ka-sg__title {
	flex: 1 1 auto;
	min-width: 0;
	padding: 6px 8px;
	overflow-wrap: anywhere;
}

.ka-sg .ka-sg__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	min-width: 40px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
}

.ka-sg .ka-sg__icon:hover:not(:disabled) {
	background: var(--ka-sg-fill-strong);
}

.ka-sg .ka-sg__icon:disabled {
	opacity: 0.25;
	cursor: default;
}

.ka-sg .ka-sg__icon--grab {
	cursor: grab;
	touch-action: none;
	opacity: var(--ka-sg-muted);
}

.ka-sg .ka-sg__item.is-dragging .ka-sg__icon--grab {
	cursor: grabbing;
}

.ka-sg .ka-sg__icon--remove {
	font-size: 24px;
}

.ka-sg .ka-sg__empty,
.ka-sg .ka-sg__hint {
	margin: 0;
	font-size: 14px;
	opacity: var(--ka-sg-muted);
}

.ka-sg .ka-sg__empty {
	padding: 16px;
	border: 1px dashed var(--ka-sg-line);
	border-radius: var(--ka-sg-radius);
	text-align: center;
}

.ka-sg .ka-sg__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ka-sg .ka-sg__hint:empty {
	display: none;
}

.ka-sg .ka-sg__notice {
	margin: 0 0 20px;
	padding: 12px 14px;
	border: 1px solid currentColor;
	border-radius: var(--ka-sg-radius);
}

.ka-sg .ka-sg__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Preview */

.ka-sg .ka-sg__preview {
	position: relative;
	min-width: 0;
}

.ka-sg .ka-sg__canvas {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 2480 / 3508;
	border-radius: 2px;
	background: #f1f2f4;
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}

.ka-sg .ka-sg__loading {
	position: absolute;
	top: 50%;
	right: 0;
	left: 0;
	margin: 0;
	color: #333;
	font-size: 14px;
	text-align: center;
	transform: translateY(-50%);
}

@media (prefers-reduced-motion: no-preference) {
	.ka-sg .ka-sg__btn,
	.ka-sg .ka-sg__icon,
	.ka-sg .ka-sg__segment span,
	.ka-sg .ka-sg__result {
		transition: background-color 0.12s ease, opacity 0.12s ease;
	}
}
