/*
 * JSON formatter styles.
 * Shared variables, reset, body (grid background), .brand, .nav, .eyebrow,
 * .seo-content and footer come from /style.css (loaded first).
 * This file only holds what is specific to this page.
 */

body {
	padding: 40px 20px;
}

.wrap {
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
}

/* ---------- top nav (overrides shared .nav sizing) ---------- */
.topnav {
	max-width: none;
	margin: 0 0 36px;
	padding: 0;
}

/* ---------- headings ---------- */
.eyebrow {
	margin-bottom: 10px;
}
h1 {
	font-size: 30px;
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0 0 4px;
}
.sub {
	color: var(--muted);
	font-size: 14.5px;
	margin: 0 0 28px;
}

/* ---------- card ---------- */
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow:
		0 1px 2px rgba(20, 20, 20, 0.03),
		0 12px 32px -18px rgba(20, 20, 20, 0.18);
	overflow: hidden;
}

.toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 14px;
	border-bottom: 1px solid var(--line);
}

/* segmented mode toggle */
.mode-row {
	display: flex;
	gap: 6px;
	min-width: 220px;
}
.mode-btn {
	flex: 1;
	font-family: "JetBrains Mono", monospace;
	font-size: 13px;
	font-weight: 500;
	padding: 10px 18px;
	border-radius: 7px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	transition: all 0.15s ease;
	letter-spacing: 0.02em;
}
.mode-btn:hover {
	color: var(--ink);
}
.mode-btn.active {
	background: var(--ink);
	color: #fff;
}

.options {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}
.opt {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: "JetBrains Mono", monospace;
	font-size: 12px;
	color: var(--muted);
}
.opt select {
	font-family: "JetBrains Mono", monospace;
	font-size: 12.5px;
	padding: 7px 10px;
	border-radius: 7px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink);
	cursor: pointer;
}
.opt.check {
	cursor: pointer;
}
.opt.check input {
	accent-color: var(--accent);
	width: 15px;
	height: 15px;
	margin: 0;
}

/* ---------- input / output panes ---------- */
.panes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 8px;
	padding: 0 18px;
}
.panes > * {
	min-width: 0;
}
.field {
	padding: 18px 0 6px;
}
.field-label {
	display: flex;
	justify-content: space-between;
	font-family: "JetBrains Mono", monospace;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 8px;
}

textarea,
.output {
	width: 100%;
	height: 380px;
	background: #fbfbfa;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 12px 13px;
	font-family: "JetBrains Mono", monospace;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ink);
	outline: none;
	transition: border-color 0.15s ease;
	tab-size: 2;
}
textarea {
	resize: vertical;
	white-space: pre;
	overflow: auto;
}
textarea:focus,
.output:focus {
	border-color: var(--accent);
}
textarea::placeholder {
	color: #b7b9bd;
}
.output {
	white-space: pre;
	overflow: auto;
	cursor: text;
}
.output.empty {
	color: #b7b9bd;
}
.output.error {
	color: var(--error);
}

/* ---------- status line ---------- */
.status {
	margin: 10px 18px 0;
	padding: 10px 13px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #fbfbfa;
	font-family: "JetBrains Mono", monospace;
	font-size: 12.5px;
	color: var(--muted);
	word-break: break-word;
}
.status.ok {
	color: var(--good);
	border-color: var(--good);
}
.status.bad {
	color: var(--error);
	border-color: var(--error);
	background: #fdf3f1;
}

/* ---------- actions ---------- */
.actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	padding: 14px 18px 18px;
}
.btn-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.act {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-family: "Space Grotesk", sans-serif;
	font-weight: 600;
	font-size: 13.5px;
	padding: 9px 16px;
	border-radius: 7px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink);
	cursor: pointer;
	transition: all 0.15s ease;
}
.act:hover {
	border-color: #c9c7be;
	background: #fafaf8;
}
.act.copy.copied {
	background: var(--good);
	border-color: var(--good);
	color: #fff;
}
.ico {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.file {
	position: relative;
}
.file input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
}
.file:focus-within {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.meta {
	font-family: "JetBrains Mono", monospace;
	font-size: 11.5px;
	color: var(--muted);
	display: flex;
	gap: 14px;
}
.meta.centered {
	justify-content: center;
	margin-top: 14px;
}
.footer-note {
	text-align: center;
	font-size: 12px;
	color: var(--muted);
	margin-top: 18px;
	font-family: "JetBrains Mono", monospace;
}

/* ---------- explainer below the tool ---------- */
.seo-content {
	max-width: 680px;
	margin: 50px auto 0;
}
.seo-content h2 {
	font-size: 20px;
	font-weight: 700;
	margin: 32px 0 10px;
}
.seo-content p,
.seo-content li {
	color: var(--muted);
	line-height: 1.7;
}
.seo-content ol,
.seo-content ul {
	padding-left: 22px;
}
.seo-content strong {
	color: var(--ink);
}
.seo-content code {
	font-family: "JetBrains Mono", monospace;
	font-size: 12.5px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 4px;
	padding: 1px 5px;
}

/* ---------- footer (stacked, left-aligned like the base64 page) ---------- */
footer {
	max-width: none;
	margin: 60px 0 0;
	padding: 24px 0 0;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	text-align: left;
}

/* ---------- tablet & below ---------- */
@media (max-width: 900px) {
	body {
		padding: 28px 16px;
	}
	.panes {
		grid-template-columns: 1fr;
	}
	textarea,
	.output {
		height: 260px;
	}
	.seo-content {
		margin-top: 40px;
	}
}

/* ---------- phones ---------- */
@media (max-width: 480px) {
	body {
		padding: 20px 14px;
	}
	.topnav {
		margin-bottom: 24px;
	}
	h1 {
		font-size: 24px;
	}
	.sub {
		margin-bottom: 20px;
	}
	.toolbar {
		padding: 10px;
	}
	.mode-row {
		width: 100%;
	}
	.panes {
		padding: 0 14px;
	}
	/* 16px stops iOS Safari from zooming the page when the box is focused */
	textarea {
		font-size: 16px;
	}
	.status {
		margin: 10px 14px 0;
	}
	.actions {
		flex-direction: column;
		align-items: stretch;
		padding: 12px 14px 14px;
	}
	.btn-group {
		width: 100%;
	}
	.btn-group .act {
		flex: 1;
		justify-content: center;
	}
	.seo-content h2 {
		font-size: 18px;
	}
	footer {
		margin-top: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mode-btn,
	.act {
		transition: none;
	}
}
