/*!
 * @Rank – UTM Link Builder: the tool's own rules.
 *
 * The palette, header, cards, buttons, notices and toast all come from
 * assets/css/atrank-core.css. Only what is specific to this tool is here, and
 * every rule is anchored on .atrank-utm — a bare .atrank-something would reach
 * the host page, and the harness fails on it.
 *
 * One rule here is function rather than decoration: a built link is set in the
 * monospace face and allowed to break anywhere, because a tagged URL is one
 * long unbroken run and would otherwise push the column sideways.
 */

.atrank-utm .atrank-utm-panes {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	align-items: start;
}
@media (min-width: 940px) {
	.atrank-utm .atrank-utm-panes {
		grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
	}
}

.atrank-utm .atrank-utm-pane {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.atrank-utm .atrank-cardhead {
	justify-content: space-between;
	flex-wrap: wrap;
}
.atrank-utm .atrank-cardhead h2 {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	color: var(--accent);
	display: flex;
	align-items: baseline;
	gap: 8px;
}
.atrank-utm .atrank-utm-head-actions {
	display: inline-flex;
	gap: 6px;
}

/* ── The fields ───────────────────────────────────────────────────────── */
.atrank-utm .atrank-utm-field {
	display: block;
	margin-bottom: 9px;
	min-width: 0;
}

.atrank-utm .atrank-utm-label {
	display: block;
	margin-bottom: 3px;
	font-size: 11.5px;
	font-weight: 600;
	color: var(--dim);
}

.atrank-utm .atrank-utm-req {
	display: inline-block;
	margin-left: 4px;
	padding: 0 5px;
	border-radius: var(--r);
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.atrank-utm .atrank-utm-input,
.atrank-utm .atrank-utm-area {
	display: block;
	width: 100%;
	min-width: 0;
	padding: 6px 9px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--panel);
	color: var(--txt);
	font: inherit;
	font-size: 13px;
	line-height: 1.5;
}
.atrank-utm .atrank-utm-area {
	min-height: min(120px, max(84px, 14vh));
	max-height: 34vh;
	resize: vertical;
	font-family: var(--mono);
	font-size: 12.5px;
	background: var(--inset);
}
.atrank-utm .atrank-utm-input:focus,
.atrank-utm .atrank-utm-area:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

/* Three short optional fields sit in a row rather than a column: together they
   are shorter than one of the two required ones above them. */
.atrank-utm .atrank-utm-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0 9px;
}
@media (min-width: 480px) {
	.atrank-utm .atrank-utm-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.atrank-utm .atrank-utm-checks {
	margin-top: 4px;
	padding-top: 9px;
	border-top: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 16px;
}
.atrank-utm .atrank-utm-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	color: var(--muted);
	cursor: pointer;
}
.atrank-utm .atrank-utm-check input {
	width: 15px;
	height: 15px;
	accent-color: var(--accent);
}
.atrank-utm .atrank-utm-checks .atrank-hint {
	flex: 1 1 100%;
	margin: 0;
}

/* ── The links ────────────────────────────────────────────────────────── */
.atrank-utm .atrank-utm-rows {
	display: grid;
	gap: 7px;
}

.atrank-utm .atrank-utm-row {
	padding: 8px 10px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
	min-width: 0;
}

.atrank-utm .atrank-utm-rowhead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 4px;
}

.atrank-utm .atrank-utm-chip {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--accent);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.atrank-utm .atrank-utm-copy {
	flex: 0 0 auto;
	padding: 3px 9px;
	font-size: 11.5px;
}

/* A tagged URL is one long unbroken run: it has to be allowed to break. */
.atrank-utm .atrank-utm-link {
	display: block;
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.5;
	color: var(--txt);
	overflow-wrap: anywhere;
	word-break: break-all;
}

.atrank-utm .atrank-utm-notes {
	margin: 6px 0 0;
	padding: 0 0 0 15px;
	display: grid;
	gap: 3px;
}
.atrank-utm .atrank-utm-notes li {
	font-size: 11.5px;
	line-height: 1.45;
	color: var(--muted);
}
/* Colour means the same here as everywhere else in the line. */
.atrank-utm .atrank-utm-notes li.is-missing,
.atrank-utm .atrank-utm-notes li.is-duplicate {
	color: var(--err);
}
.atrank-utm .atrank-utm-notes li.is-case,
.atrank-utm .atrank-utm-notes li.is-replaced,
.atrank-utm .atrank-utm-notes li.is-length {
	color: var(--warn);
}

@media (max-width: 600px) {
	.atrank-utm .atrank-utm-chip {
		white-space: normal;
	}
}
