/* ---------- Redirect checker [redirect_checker] ---------- */

.hat .hat-rc-opts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px 24px;
	max-width: 720px;
	margin: 16px auto 0;
}

.hat .hat-rc-agent {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.hat .hat-rc-agent > legend.hat-rc-legend {
	float: right;
	margin: 0 0 0 10px;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--hat-heading);
	line-height: 36px;
}

.hat .hat-rc-agent .hat-chip span {
	gap: 6px;
}

/* Toggle switch */
.hat .hat-rc-switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--hat-heading);
	cursor: pointer;
	position: relative;
}

.hat .hat-rc-switch input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.hat .hat-rc-switch-ui {
	flex: none;
	position: relative;
	width: 42px;
	height: 24px;
	border-radius: 999px;
	background: var(--hat-border);
	transition: background-color 0.15s;
}

.hat .hat-rc-switch-ui::after {
	content: "";
	position: absolute;
	top: 3px;
	right: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--hat-white);
	box-shadow: 0 1px 3px rgba(25, 42, 61, 0.3);
	transition: transform 0.15s var(--hat-ease);
}

.hat .hat-rc-switch input:checked + .hat-rc-switch-ui {
	background: var(--hat-primary);
}

.hat .hat-rc-switch input:checked + .hat-rc-switch-ui::after {
	transform: translateX(-18px);
}

.hat .hat-rc-switch input:focus-visible + .hat-rc-switch-ui {
	outline: 3px solid rgba(40, 114, 250, 0.45);
	outline-offset: 2px;
}

/* Wide tables must scroll inside their box, not stretch the result grid. */
.hat[data-hat-tool="redirect-checker"] .hat-output {
	grid-template-columns: minmax(0, 1fr);
}

/* Summary */
.hat .hat-rc-summary {
	display: grid;
	gap: 12px;
}

.hat .hat-rc-summary .hat-stats {
	grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.hat .hat-rc-summary .hat-stat-value {
	font-size: 1.2rem;
	white-space: nowrap;
}

.hat .hat-rc-final {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 1.5px dashed var(--hat-primary);
	border-radius: var(--hat-radius);
	background: var(--hat-primary-soft);
}

.hat .hat-rc-final-main {
	flex: 1;
	min-width: 0;
	display: grid;
}

.hat .hat-rc-final-label {
	font-size: 0.82rem;
}

.hat .hat-rc-final-url {
	font-weight: 700;
	color: var(--hat-heading);
	overflow-wrap: anywhere;
	text-align: left;
}

/* Timeline */
.hat .hat-rc-chain {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0;
}

.hat .hat-rc-hop {
	position: relative;
	display: flex;
	gap: 14px;
	margin: 0;
	padding: 0 0 22px;
}

.hat .hat-rc-hop.is-last {
	padding-bottom: 0;
}

/* Connector line + arrow head between steps */
.hat .hat-rc-hop:not(.is-last)::before {
	content: "";
	position: absolute;
	top: 46px;
	bottom: 4px;
	right: 26px;
	width: 2px;
	background: var(--hat-border);
}

.hat .hat-rc-hop:not(.is-last)::after {
	content: "";
	position: absolute;
	bottom: 2px;
	right: 22px;
	border: 5px solid transparent;
	border-top: 7px solid #c3cfda;
	border-bottom-width: 0;
}

.hat .hat-rc-code {
	flex: none;
	width: 54px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	font-weight: 800;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
	background: var(--hat-surface);
	color: var(--hat-heading);
	position: relative;
	z-index: 1;
}

.hat .hat-rc-code--success { background: var(--hat-success); color: var(--hat-white); }
.hat .hat-rc-code--primary { background: var(--hat-primary); color: var(--hat-white); }
.hat .hat-rc-code--warn { background: var(--hat-warn); color: var(--hat-white); }
.hat .hat-rc-code--danger { background: var(--hat-danger); color: var(--hat-white); }

.hat .hat-rc-hop-body {
	flex: 1;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--hat-border);
	border-radius: 12px;
	background: var(--hat-surface-2);
	display: grid;
	gap: 6px;
}

.hat .hat-rc-hop.is-danger .hat-rc-hop-body { border-color: rgba(224, 45, 60, 0.35); }
.hat .hat-rc-hop.is-last.is-success .hat-rc-hop-body { border-color: rgba(14, 159, 110, 0.35); background: var(--hat-success-soft); }

.hat .hat-rc-hop-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
}

.hat .hat-rc-step {
	font-size: 0.8rem;
	color: var(--hat-text);
	opacity: 0.85;
}

.hat .hat-rc-label {
	font-weight: 700;
	color: var(--hat-heading);
}

.hat .hat-rc-url {
	display: block;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.88rem;
	color: var(--hat-heading);
	text-align: left;
	overflow-wrap: anywhere;
}

.hat .hat-rc-loc {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	font-size: 0.85rem;
}

.hat .hat-rc-loc .hat-code {
	overflow-wrap: anywhere;
	min-width: 0;
}

.hat .hat-rc-hop-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.hat .hat-rc-hop-meta .hat-pill {
	background: var(--hat-white);
	border: 1px solid var(--hat-border);
	font-weight: 600;
}

.hat .hat-rc-hop-meta .hat-pill--success { background: var(--hat-success-soft); border-color: transparent; }
.hat .hat-rc-hop-meta .hat-pill--warn { background: var(--hat-warn-soft); border-color: transparent; }
.hat .hat-rc-hop-meta .hat-pill--danger { background: var(--hat-danger-soft); border-color: transparent; }

.hat .hat-rc-note {
	margin: 0;
	font-size: 0.88rem;
	font-weight: 600;
}

.hat .hat-rc-note.is-bad { color: var(--hat-danger); }
.hat .hat-rc-note.is-warn { color: var(--hat-warn); }

.hat .hat-rc-issues .is-info > .hat-icon { color: var(--hat-primary); }

.hat .hat-rc-help {
	margin-top: 4px;
	font-size: 0.9rem;
}

/* Variants table */
.hat .hat-rc-vtable td {
	vertical-align: top;
	white-space: normal;
	padding: 10px 12px;
}

.hat .hat-rc-vtable td:nth-child(2) {
	white-space: nowrap;
}

.hat .hat-rc-vurl {
	overflow-wrap: anywhere;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.86rem;
}

.hat .hat-rc-vnote {
	display: block;
	margin-top: 4px;
	font-size: 0.8rem;
	white-space: normal;
	min-width: 110px;
}

.hat .hat-rc-vwrap {
	margin-top: 14px;
}

.hat .hat-rc-vtext {
	margin-top: 2px !important;
	font-size: 0.92rem;
}

.hat .hat-rc-vwrap + .hat-hint {
	text-align: right;
}

@media (max-width: 640px) {
	.hat .hat-rc-opts {
		flex-direction: column;
		align-items: stretch;
	}

	.hat .hat-rc-agent {
		flex-wrap: wrap;
	}

	.hat .hat-rc-final {
		flex-wrap: wrap;
	}

	.hat .hat-rc-summary .hat-stats {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	.hat .hat-rc-summary .hat-stat {
		padding: 12px 8px;
	}

	.hat .hat-rc-summary .hat-stat-value {
		font-size: 1.1rem;
	}

	.hat .hat-rc-final .hat-btn {
		width: 100%;
	}

	.hat .hat-rc-hop {
		gap: 10px;
	}

	.hat .hat-rc-code {
		width: 46px;
		height: 36px;
		font-size: 0.85rem;
	}

	.hat .hat-rc-hop:not(.is-last)::before {
		top: 42px;
		right: 22px;
	}

	.hat .hat-rc-hop:not(.is-last)::after {
		right: 18px;
	}

	.hat .hat-rc-hop-body {
		padding: 10px 12px;
	}

	/* Variants table becomes stacked cards */
	.hat .hat-rc-vwrap {
		border: 0;
		overflow: visible;
	}

	.hat .hat-rc-vtable thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.hat .hat-rc-vtable,
	.hat .hat-rc-vtable tbody,
	.hat .hat-rc-vtable tr,
	.hat .hat-rc-vtable td {
		display: block;
		width: 100%;
	}

	.hat .hat-rc-vtable tr {
		margin-bottom: 10px;
		border: 1.5px solid var(--hat-border);
		border-radius: var(--hat-radius);
		overflow: hidden;
	}

	.hat .hat-rc-vtable td {
		display: flex;
		flex-wrap: wrap;
		gap: 2px 10px;
		align-items: baseline;
		padding: 8px 12px;
		white-space: normal;
		border-bottom: 1px solid var(--hat-border);
	}

	.hat .hat-rc-vtable tr td:last-child {
		border-bottom: 0;
		flex-wrap: wrap;
	}

	.hat .hat-rc-vtable td::before {
		content: attr(data-label);
		flex: 0 0 100%;
		font-size: 0.78rem;
		font-weight: 700;
		color: var(--hat-text);
	}

	.hat .hat-rc-vtable td > bdi {
		min-width: 0;
		overflow-wrap: anywhere;
	}

	.hat .hat-rc-vnote {
		min-width: 0;
		width: 100%;
		margin-top: 0;
	}
}
