/* Shared styles for the text-based tools in /crypto/. */

.crypto-tool header .eyebrow a {
	color: inherit;
	text-decoration: none;
}

.crypto-tool header h1 {
	margin-top: 0;
}

.crypto-intro {
	color: var(--muted);
}

.crypto-noscript {
	padding: 0.8rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--card);
}

.crypto-panel {
	margin: 1.5rem 0;
	padding: 1rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--card);
}

.crypto-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
	align-items: flex-start;
}

.crypto-mode {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0;
	border: 0;
}

.crypto-mode legend,
.crypto-field {
	display: block;
	margin: 0 0 0.35rem;
	padding: 0;
	font-size: 0.9rem;
	font-weight: 700;
}

.crypto-panel .crypto-field {
	margin-top: 1rem;
}

.crypto-mode label {
	display: flex;
	gap: 0.4rem;
	align-items: center;
	min-height: 40px;
}

.crypto-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.crypto-button {
	min-height: 40px;
	padding: 0.5rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: 7px;
	background: var(--bg);
	color: var(--fg);
	font: inherit;
	cursor: pointer;
}

.crypto-button:hover:not(:disabled) {
	border-color: var(--accent);
	color: var(--accent);
}

.crypto-button:disabled {
	opacity: 0.5;
	cursor: default;
}

.crypto-panel textarea,
.crypto-panel input[type="text"] {
	width: 100%;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg);
	color: var(--fg);
	font: inherit;
}

.crypto-panel textarea {
	min-height: 6rem;
	resize: vertical;
}

.crypto-output {
	display: block;
	min-height: 3.2em;
	padding: 0.6rem 0.7rem;
	border: 1px dashed var(--border);
	border-radius: 6px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.crypto-status {
	min-height: 1.6em;
	margin-bottom: 0;
	color: var(--muted);
	font-size: 0.9rem;
}

/* A list of choices, such as candidate keys, where one can be marked best. */

.crypto-candidates {
	list-style: none;
	margin: 1rem 0;
	padding: 0;
}

.crypto-candidates li + li {
	margin-top: 0.4rem;
}

.crypto-candidate {
	display: flex;
	gap: 0.75rem;
	align-items: baseline;
	width: 100%;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 7px;
	background: var(--bg);
	color: var(--fg);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.crypto-candidate:hover {
	border-color: var(--accent);
}

.crypto-candidate.is-best {
	border-color: var(--accent);
	background: var(--card);
}

.crypto-candidate__key {
	flex: 0 0 4.5rem;
	color: var(--muted);
	font-size: 0.85rem;
}

.crypto-candidate__text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.crypto-candidate__badge {
	flex: 0 0 auto;
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 700;
}

.crypto-candidates__empty {
	color: var(--muted);
}

.crypto-tool button:focus-visible,
.crypto-tool input:focus-visible,
.crypto-tool textarea:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

@media (max-width: 520px) {
	.crypto-candidate {
		flex-wrap: wrap;
		gap: 0.2rem 0.75rem;
	}

	.crypto-candidate__text {
		flex-basis: 100%;
		order: 3;
	}
}
