/*!
 * @Rank – Redirect Rule Generator & Tester: 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-redir.
 *
 * Three rules here are function rather than decoration:
 *   · an issue's LEVEL is carried by its left border as well as its colour, so
 *     it survives a client theme that overrides background colours — several do;
 *   · the trace is a plain vertical list, one hop per line, because the thing
 *     somebody needs from a tester is the ORDER the hops happened in, not a
 *     diagram;
 *   · the generated output is monospace and pre-wrapped, never re-flowed, since
 *     it is meant to be copied character-for-character into a real config file.
 */

.atrank-redir .atrank-redir-panes {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	align-items: start;
}
@media (min-width: 900px) {
	.atrank-redir .atrank-redir-panes {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
}
.atrank-redir .atrank-redir-col {
	display: grid;
	gap: 10px;
	min-width: 0;
	align-content: start;
}

.atrank-redir .atrank-cardhead {
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
}

/* ── The input ────────────────────────────────────────────────────────── */
.atrank-redir .atrank-redir-input {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: min(200px, max(130px, 20vh));
	max-height: 40vh;
	resize: vertical;
	padding: 9px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12.5px;
	line-height: 1.6;
	white-space: pre;
	overflow-x: auto;
}
.atrank-redir .atrank-redir-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

.atrank-redir .atrank-redir-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 10px;
}
.atrank-redir .atrank-redir-preset {
	padding: 3px 9px;
	border: 1px solid var(--line2);
	border-radius: 20px;
	background: var(--panel);
	color: var(--muted);
	font: inherit;
	font-size: 11.5px;
	cursor: pointer;
	transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.atrank-redir .atrank-redir-preset:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.atrank-redir .atrank-redir-preset:focus-visible {
	outline: none;
	box-shadow: var(--ring);
}

/* ── The tester ───────────────────────────────────────────────────────── */
.atrank-redir .atrank-redir-testrow {
	display: flex;
	gap: 8px;
}
.atrank-redir .atrank-redir-testinput {
	flex: 1 1 auto;
	min-width: 0;
	padding: 7px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--panel);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 13px;
}
.atrank-redir .atrank-redir-testinput:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

.atrank-redir .atrank-redir-trace {
	display: grid;
	gap: 4px;
	margin-top: 10px;
}
.atrank-redir .atrank-redir-trace:empty {
	margin-top: 0;
}
.atrank-redir .atrank-redir-hop {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 5px 9px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
	font-size: 12px;
}
.atrank-redir .atrank-redir-hopnum {
	flex: 0 0 auto;
	font-family: var(--mono);
	font-size: 10.5px;
	color: var(--dim);
	font-variant-numeric: tabular-nums;
}
.atrank-redir .atrank-redir-hoppath {
	font-family: var(--mono);
	overflow-wrap: anywhere;
	min-width: 0;
}
.atrank-redir .atrank-redir-hop.is-end {
	border-style: dashed;
	color: var(--muted);
}
.atrank-redir .atrank-redir-hop.is-err {
	border-color: var(--err);
	background: var(--err-soft);
	color: var(--err);
	font-weight: 600;
}

/* ── Issues ───────────────────────────────────────────────────────────── */
.atrank-redir .atrank-redir-issues {
	display: grid;
	gap: 6px;
}
.atrank-redir .atrank-redir-issues:empty::before {
	content: "No issues found in the rules above.";
	font-size: 12.5px;
	color: var(--dim);
}
.atrank-redir .atrank-redir-issue {
	padding: 6px 9px 6px 10px;
	border: 1px solid var(--line);
	border-left: 3px solid var(--line2);
	border-radius: var(--r);
	background: var(--panel2);
	font-size: 12px;
	line-height: 1.5;
}
.atrank-redir .atrank-redir-issue.is-err {
	border-left-color: var(--err);
	background: var(--err-soft);
}
.atrank-redir .atrank-redir-issue.is-warn {
	border-left-color: var(--warn);
	background: var(--warn-soft);
}
.atrank-redir .atrank-redir-issue.is-note {
	border-left-color: var(--accent);
}
.atrank-redir .atrank-redir-issuekind {
	font-weight: 700;
	color: var(--txt);
}
.atrank-redir .atrank-redir-issue.is-err .atrank-redir-issuekind {
	color: var(--err);
}
.atrank-redir .atrank-redir-issue.is-warn .atrank-redir-issuekind {
	color: var(--warn);
}

/* ── Output format tabs ───────────────────────────────────────────────── */
.atrank-redir .atrank-redir-fmttabs {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.atrank-redir .atrank-redir-fmttab {
	appearance: none;
	border: 1px solid var(--line2);
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	padding: 5px 11px;
	border-radius: var(--r);
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.atrank-redir .atrank-redir-fmttab:hover {
	color: var(--accent);
	border-color: var(--accent);
}
.atrank-redir .atrank-redir-fmttab.is-on {
	color: var(--on-accent);
	background: var(--accent);
	border-color: var(--accent);
}
.atrank-redir .atrank-redir-fmttab:focus-visible {
	outline: none;
	box-shadow: var(--ring);
}

.atrank-redir .atrank-redir-out {
	margin: 0;
	padding: 9px 11px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.55;
	white-space: pre;
	overflow-x: auto;
	min-height: 2.4em;
	max-height: 46vh;
	overflow-y: auto;
}

/* ── Narrow ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.atrank-redir .atrank-redir-testrow {
		flex-direction: column;
	}
}
