/* OpenPress JSON Formatter & Validator interface (task 047 foundation). Loaded on the JSON Formatter Free Tool page only, after
   free-tool-single.css, inside the .op-free-tool-interface frame. Uses the theme's global tokens and the shared .op-btn, so light and
   dark follow the theme switch. The only colours this file adds are the scoped message accents below.
   Presentation only: no formatting happens here (see json-formatter.js). Reduced motion: main.css zeroes transitions globally. */

.op-jf { --op-jf-error: #B42318; --op-jf-success: #067647; }
@media (prefers-color-scheme: dark) {
	.op-jf { --op-jf-error: #F97066; --op-jf-success: #47CD89; }
	:root[data-theme="light"] .op-jf { --op-jf-error: #B42318; --op-jf-success: #067647; }
}
:root[data-theme="dark"] .op-jf { --op-jf-error: #F97066; --op-jf-success: #47CD89; }

.op-jf { display: grid; gap: 1.5rem; min-width: 0; }

/* Heading ----------------------------------------------------------------- */
.op-jf__intro { display: grid; gap: 0.25rem; min-width: 0; }
.op-jf__heading { margin: 0; color: var(--op-text); font-family: var(--op-font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.op-jf__lede { margin: 0; color: var(--op-text-muted); font-size: 0.875rem; line-height: 1.4; }

/* Text areas ---------------------------------------------------------------- */
.op-jf__field { display: grid; gap: 0.75rem; min-width: 0; }
.op-jf__field-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; min-width: 0; }
.op-jf__label { color: var(--op-text); font-size: 1rem; font-weight: 600; line-height: 1.3; }

.op-jf__textarea {
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	min-height: 12rem;
	height: 14rem;
	margin: 0;
	padding: 1rem;
	background: var(--op-bg);
	border: 1px solid var(--op-border-strong);
	border-radius: 0.75rem;
	color: var(--op-text);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 0.875rem;
	line-height: 1.6;
	tab-size: 2;
	resize: vertical; /* height only: the width is the layout's */
	transition: border-color var(--op-transition), background-color var(--op-transition);
}
.op-jf__textarea::placeholder { color: var(--op-text-muted); opacity: 1; }
.op-jf__textarea:hover { border-color: color-mix(in srgb, var(--op-btn-bg) 45%, var(--op-border-strong)); }
.op-jf__textarea:focus { border-color: var(--op-focus); background: var(--op-bg-elevated); }
.op-jf__textarea:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-jf__textarea--output { background: var(--op-bg-elevated); }

/* Result header: the label on the left, Copy and Download on the right. The two buttons reuse the "Clear" look below. */
.op-jf__field-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }

/* "Clear": secondary and quiet; also used by Copy and Download; dimmed while there is nothing to clear (aria-disabled keeps it reachable by keyboard). */
.op-jf__clear {
	min-height: 2.75rem;
	padding: 0 1rem;
	border-radius: 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--op-text-muted);
	transition: color var(--op-transition), background-color var(--op-transition), opacity var(--op-transition), transform var(--op-transition);
}
.op-jf__clear:hover { color: var(--op-text); }
.op-jf__clear:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-jf__clear[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: auto; }
.op-jf__clear[aria-disabled="true"]:hover { background: transparent; color: var(--op-text-muted); text-decoration: none; }
.op-jf__clear[aria-disabled="true"]:active { transform: none; }

.op-jf__trust { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0; color: var(--op-text-muted); font-size: 0.8125rem; line-height: 1.4; }
.op-jf__trust svg { flex: none; margin-top: 1px; color: var(--op-link); }
.op-jf__trust span { min-width: 0; overflow-wrap: anywhere; }

/* Controls: indentation and the two actions ------------------------------------- */
.op-jf__controls { display: grid; gap: 1rem; min-width: 0; }
.op-jf__option { display: grid; gap: 0.375rem; min-width: 0; }
.op-jf__option-label { color: var(--op-text); font-size: 0.875rem; font-weight: 600; line-height: 1.3; }
.op-jf__select {
	width: 100%;
	min-height: 2.75rem;
	padding: 0 0.75rem;
	background: var(--op-bg);
	border: 1px solid var(--op-border-strong);
	border-radius: 0.75rem;
	color: var(--op-text);
	font-family: inherit;
	font-size: 0.9375rem;
}
.op-jf__select:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-jf__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; min-width: 0; }
.op-jf__action { flex: 1 1 8rem; min-height: 2.75rem; border-radius: 0.75rem; font-weight: 600; }
.op-jf__action:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-jf__action[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Status message (the [hidden] attribute hides it otherwise). */
.op-jf__message { margin: 0; padding: 0.75rem 1rem; color: var(--op-text); background: var(--op-bg-elevated); border: 1px solid var(--op-border); border-radius: 0.75rem; font-size: 0.875rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.op-jf__message[hidden] { display: none; }
.op-jf__message[data-tone="error"] { color: var(--op-jf-error); background: color-mix(in srgb, var(--op-jf-error) 8%, var(--op-bg-elevated)); border-color: color-mix(in srgb, var(--op-jf-error) 40%, var(--op-border)); }
.op-jf__message[data-tone="success"] { color: var(--op-jf-success); background: color-mix(in srgb, var(--op-jf-success) 8%, var(--op-bg-elevated)); border-color: color-mix(in srgb, var(--op-jf-success) 40%, var(--op-border)); }

@media (min-width: 768px) {
	.op-jf__textarea { min-height: 14rem; height: 16rem; }
	.op-jf__controls { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); align-items: end; }
	.op-jf__actions { justify-content: flex-end; }
	.op-jf__action { flex: 0 1 auto; min-width: 8rem; }
}
@media (max-width: 480px) {
	.op-jf__field-head { gap: 0.25rem 0.5rem; }
	.op-jf__clear { padding: 0 0.5rem; }
	.op-jf__textarea { min-height: 11rem; height: 11rem; padding: 0.75rem; }
}

/* Task 051: 16px minimum on touch devices, so iOS Safari does not zoom the page when these fields are focused. */
@media (pointer: coarse) {
	.op-jf__textarea,
	.op-jf__select { font-size: 1rem; }
}
