/*
 * NexGismo Tools — shared base styles for every tool, scoped under .ngt and theme-agnostic: inherits the theme's
 * fonts and text colour. Accent colour, in order: --ngt-accent-color (set it in
 * your theme to override), the block-theme primary preset, Blocksy's palette,
 * then a neutral blue.
 */
.ngt {
	--ngt-accent: var(--ngt-accent-color, var(--wp--preset--color--primary, var(--theme-palette-color-1, #2563eb)));
	--ngt-text: var(--theme-text-color, currentColor);
	--ngt-border: color-mix(in srgb, currentColor 18%, transparent);
	--ngt-surface: color-mix(in srgb, currentColor 4%, transparent);
	/* Darker shade of the theme accent: keeps white button text and links above 4.5:1 contrast. */
	--ngt-accent-strong: color-mix(in srgb, var(--ngt-accent) 82%, #000);
	--ngt-radius: 8px;
	--ngt-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--ngt-error: #c62828;
	--ngt-warning: #b26a00;
	--ngt-info: #1f6feb;
	--ngt-success: #1b7f3b;
	margin: 0 0 2em;
}

.ngt *, .ngt *::before, .ngt *::after { box-sizing: border-box; }
/* Component display rules (grid/flex) must never override the hidden attribute. */
.ngt [hidden] { display: none !important; }

.ngt-answer {
	font-size: 1.1em;
	line-height: 1.6;
	padding: 1em 1.25em;
	border-left: 4px solid var(--ngt-accent);
	background: var(--ngt-surface);
	border-radius: 0 var(--ngt-radius) var(--ngt-radius) 0;
}

.ngt-tool {
	border: 1px solid var(--ngt-border);
	border-radius: calc(var(--ngt-radius) * 1.5);
	padding: 1.25em;
	margin: 1.5em 0;
}

.ngt-tabs {
	display: flex;
	gap: .25em;
	overflow-x: auto;
	scrollbar-width: none;
	border-bottom: 1px solid var(--ngt-border);
	margin: -.25em 0 1.25em;
}
.ngt-tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 3px solid transparent;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: .6em .9em;
	white-space: nowrap;
	font-weight: 500;
}
.ngt-tab[aria-selected="true"] { border-bottom-color: var(--ngt-accent-strong); font-weight: 700; }
.ngt-tab:hover { border-bottom-color: var(--ngt-border); }

.ngt-label { display: block; font-weight: 600; font-size: .9em; margin: 0 0 .35em; }
.ngt-hint { font-size: .85em; margin: .35em 0 0; }

.ngt-row { display: flex; gap: .5em; flex-wrap: wrap; }
.ngt-row .ngt-input { flex: 1 1 260px; }

.ngt-input {
	width: 100%;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--ngt-border);
	border-radius: var(--ngt-radius);
	padding: .55em .75em;
	min-height: 2.6em;
}
.ngt-input:focus { outline: 2px solid var(--ngt-accent); outline-offset: 1px; border-color: transparent; }
textarea.ngt-input { height: auto; min-height: 4.5em; }
textarea.ngt-code { min-height: 16em; }
.ngt-form + .ngt-label, .ngt-form + .ngt-hint { margin-top: 1.25em; }
.ngt-code { font-family: var(--ngt-mono); font-size: .85em; line-height: 1.5; white-space: pre; overflow: auto; resize: vertical; }

.ngt-btn, .ngt-icon-btn, .ngt-link-btn { font: inherit; cursor: pointer; }
.ngt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	min-height: 2.6em;
	padding: .55em 1.1em;
	border-radius: var(--ngt-radius);
	border: 1px solid var(--ngt-border);
	background: transparent;
	color: inherit;
	font-weight: 600;
	white-space: nowrap;
}
.ngt-btn:hover { border-color: var(--ngt-accent); }
.ngt-btn-primary { background: var(--ngt-accent-strong); border-color: var(--ngt-accent-strong); color: #fff; }
.ngt-btn-primary:hover { filter: brightness(1.08); }
.ngt-btn:disabled, .ngt-icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.ngt-btn:focus-visible, .ngt-icon-btn:focus-visible, .ngt-link-btn:focus-visible, .ngt-tab:focus-visible {
	outline: 2px solid var(--ngt-accent);
	outline-offset: 2px;
}
.ngt-icon-btn {
	width: 2.2em;
	height: 2.2em;
	border-radius: var(--ngt-radius);
	border: 1px solid var(--ngt-border);
	background: transparent;
	color: inherit;
	line-height: 1;
}
.ngt-link-btn { background: none; border: 0; padding: .25em 0; color: var(--ngt-accent-strong); font-weight: 600; text-decoration: underline; }

.ngt-actions { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; margin-top: .75em; }

.ngt-status { min-height: 1.5em; margin: 1em 0 0; font-weight: 500; }
.ngt-status:empty { display: none; }
.ngt-status.is-error { color: var(--ngt-error); }
.ngt-status.is-success { color: var(--ngt-success); }
.ngt-status.is-busy::before {
	content: "";
	display: inline-block;
	width: .9em;
	height: .9em;
	margin-right: .5em;
	vertical-align: -.1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ngt-spin .8s linear infinite;
}
@keyframes ngt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ngt-status.is-busy::before { animation: none; } }

.ngt-report:empty { display: none; }
.ngt-report { margin-top: 1em; border: 1px solid var(--ngt-border); border-radius: var(--ngt-radius); padding: 1em; }
.ngt-report-head { display: flex; align-items: center; gap: .9em; }
.ngt-grade {
	display: inline-grid;
	place-items: center;
	width: 2.4em;
	height: 2.4em;
	border-radius: 50%;
	font-weight: 800;
	font-size: 1.2em;
	color: #fff;
	background: var(--ngt-error);
}
.ngt-grade.is-a { background: var(--ngt-success); }
.ngt-grade.is-b { background: #4c8c2b; }
.ngt-grade.is-c, .ngt-grade.is-d { background: var(--ngt-warning); }
.ngt-perfect { margin: .75em 0 0; color: var(--ngt-success); font-weight: 500; }
.ngt-issues { list-style: none; margin: .75em 0 0; padding: 0; display: grid; gap: .4em; }
.ngt-issue {
	display: grid;
	grid-template-columns: 5.5em 4.5em 1fr;
	gap: .5em;
	font-size: .9em;
	padding: .4em .6em;
	border-left: 3px solid var(--ngt-info);
	background: var(--ngt-surface);
	border-radius: 0 6px 6px 0;
}
.ngt-issue.is-error { border-color: var(--ngt-error); }
.ngt-issue.is-warning { border-color: var(--ngt-warning); }
.ngt-issue-level { font-weight: 700; }
.ngt-issue.is-error .ngt-issue-level { color: var(--ngt-error); }
.ngt-issue.is-warning .ngt-issue-level { color: var(--ngt-warning); }
.ngt-issue.is-info .ngt-issue-level { color: var(--ngt-info); }
.ngt-issue-line { font-family: var(--ngt-mono); font-size: .9em; }

.ngt-byline { font-size: .9em; margin: .75em 0 0; }
.ngt-answer a, .ngt-byline a, .ngt-verdict a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ngt-content a, .ngt-toc a { color: var(--ngt-accent-strong); text-underline-offset: 2px; }
.ngt-content h2 { margin-top: 1.75em; scroll-margin-top: 90px; }
.ngt-content h2:first-of-type { margin-top: 1.25em; }
.ngt-toc { border: 1px solid var(--ngt-border); border-radius: var(--ngt-radius); padding: 1em 1.25em; }
.ngt-toc ul { margin: 0; padding-left: 1.2em; columns: 2 220px; column-gap: 2em; }
.ngt-toc li { margin: .2em 0; break-inside: avoid; }
.ngt-verdict { padding: 1em 1.25em; border-radius: var(--ngt-radius); background: var(--ngt-surface); }
.ngt-steps li { margin-bottom: .5em; }
.ngt-pre { font-family: var(--ngt-mono); font-size: .85em; line-height: 1.55; overflow-x: auto; padding: 1em; border-radius: var(--ngt-radius); background: var(--ngt-surface); border: 1px solid var(--ngt-border); }
.ngt-table-wrap { overflow-x: auto; }
.ngt-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.ngt-table th, .ngt-table td { text-align: left; padding: .6em .75em; border-bottom: 1px solid var(--ngt-border); vertical-align: top; }
.ngt-table thead th { font-weight: 700; }
.ngt-faq h3 { font-size: 1.1em; margin: 1.25em 0 .35em; }
.ngt-reviewed { font-size: .85em; margin-top: 2em; }
.ngt-related { margin-top: 2em; padding: 1em 1.25em; border: 1px solid var(--ngt-border); border-radius: var(--ngt-radius); }
.ngt-content .ngt-related h2 { margin: 0 0 .5em; font-size: 1.15em; }
.ngt-related ul { margin: 0; padding-left: 1.2em; }
.ngt-related li { margin: .3em 0; }

.ngt-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

@media (max-width: 720px) {
	.ngt-tool { padding: 1em; }
	.ngt-tab { padding: .6em .55em; font-size: .9em; }
	.ngt-issue { grid-template-columns: auto 1fr; }
	.ngt-issue-msg { grid-column: 1 / -1; }
}
