/* Photo Resizer. Shared styles live in assets/css/tools-base.css. */
.ngt-img-tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1em; margin-bottom: 2em; }
.ngt-img .ngt-status { margin: 0; }
.ngt-img .ngt-content { max-width: 46em; }
.ngt-img .ngt-label { margin-bottom: .3em; }
.ngt-img .ngt-input { min-height: 2.75em; }
.ngt-img .ngt-hint { margin: .3em 0 0; }

/* Step 1: one action. */
.ngt-img-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .75em;
	min-height: 18em;
	padding: 2em 1em;
	text-align: center;
	cursor: pointer;
	border: 2px dashed var(--ngt-border);
	border-radius: 12px;
	background: var(--ngt-surface);
	transition: border-color .15s, background-color .15s;
}
.ngt-img-drop:hover,
.ngt-img-drop.is-over,
[data-file]:focus-visible + .ngt-img-drop { border-color: var(--ngt-accent-strong); }
.ngt-img-drop.is-over { background: color-mix(in srgb, var(--ngt-accent) 10%, transparent); }
.ngt-img-drop .ngt-hint { margin: 0; }
.ngt-img-pick { font-size: 1.15em; min-height: 3.2em; padding-inline: 2.25em; pointer-events: none; }
.ngt-img-drop-lead { font-size: 1.05em; }

/* Step 2: photo beside its settings. */
.ngt-img-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 24em); gap: 2em; align-items: start; }
.ngt-img-frame {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 16em;
	padding: 1em;
	border-radius: 12px;
	background: var(--ngt-surface);
}
.ngt-img-preview { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; border-radius: 4px; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
.ngt-img-toolbar { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .75em; }
.ngt-img-change { margin-left: auto; }
.ngt-img-toolbar [data-rotate] { min-width: 3em; padding-inline: .5em; font-size: 1.1em; }

.ngt-img-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1em; }
.ngt-img-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75em; }
.ngt-img-chips { display: flex; flex-wrap: wrap; gap: .35em; margin-top: -.5em; }
.ngt-img-chip {
	flex: 1 1 auto;
	min-height: 2.5em;
	padding: 0 .5em;
	font: inherit;
	font-size: .85em;
	font-weight: 600;
	color: inherit;
	cursor: pointer;
	background: transparent;
	border: 1px solid var(--ngt-border);
	border-radius: 6px;
}
.ngt-img-chip:hover { border-color: var(--ngt-accent-strong); }
.ngt-img-chip[aria-pressed="true"] { background: var(--ngt-accent-strong); border-color: var(--ngt-accent-strong); color: #fff; }
.ngt-img-chip:focus-visible { outline: 2px solid var(--ngt-accent); outline-offset: 2px; }

.ngt-img-result { display: grid; gap: .4em; padding-top: 1em; border-top: 1px solid var(--ngt-border); transition: opacity .15s; }
.ngt-img-result.is-busy { opacity: .55; }
.ngt-img-result p { margin: 0; }
.ngt-img-meta { font-size: .9em; }
.ngt-img-verdict { font-size: .9em; font-weight: 600; color: var(--ngt-success); }
.ngt-img-verdict::before { content: "✓ "; font-weight: 800; }
.ngt-img-note { font-size: .9em; padding: .6em .8em; border-radius: 8px; background: var(--ngt-surface); }
.ngt-img-note.is-bad { color: var(--ngt-error); background: color-mix(in srgb, var(--ngt-error) 10%, transparent); font-weight: 500; }
.ngt-img-bar { display: grid; gap: .5em; margin-top: .25em; }
.ngt-img-sizes-line { font-size: 1.2em; font-weight: 700; }
.ngt-img-badge { font-size: .7em; font-weight: 700; color: var(--ngt-success); white-space: nowrap; }
.ngt-img-download { width: 100%; font-size: 1.1em; min-height: 3.2em; }

/* Crop happens on the photo itself. */
.ngt-crop { display: grid; grid-template-columns: minmax(0, 1fr); gap: .25em; }
.ngt-crop-stage { position: relative; overflow: hidden; margin: 0 auto; border-radius: 4px; user-select: none; -webkit-user-select: none; background: #111; }
.ngt-crop-stage canvas { display: block; width: 100%; height: 100%; }
.ngt-crop-box {
	position: absolute;
	box-sizing: border-box;
	border: 2px solid #fff;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, .6);
	cursor: move;
	touch-action: none;
	background-image:
		linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35)), linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35)),
		linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35)), linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35));
	background-size: 1px 100%, 1px 100%, 100% 1px, 100% 1px;
	background-position: 33.33% 0, 66.66% 0, 0 33.33%, 0 66.66%;
	background-repeat: no-repeat;
}
.ngt-crop-box:focus-visible { outline: 3px solid var(--ngt-accent); outline-offset: 2px; }
/* A generous invisible touch area; the visible corner is drawn inside it. */
.ngt-crop-handle { position: absolute; width: 36px; height: 36px; touch-action: none; }
.ngt-crop-handle::after { content: ""; position: absolute; width: 16px; height: 16px; border: 4px solid #fff; }
.ngt-crop-handle.is-nw { top: 0; left: 0; cursor: nwse-resize; }
.ngt-crop-handle.is-nw::after { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.ngt-crop-handle.is-ne { top: 0; right: 0; cursor: nesw-resize; }
.ngt-crop-handle.is-ne::after { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.ngt-crop-handle.is-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.ngt-crop-handle.is-sw::after { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.ngt-crop-handle.is-se { bottom: 0; right: 0; cursor: nwse-resize; }
.ngt-crop-handle.is-se::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.ngt-img-links { display: flex; flex-wrap: wrap; gap: .4em 1.25em; padding-left: 1.2em; }

@media (max-width: 800px) {
	.ngt-img-work { grid-template-columns: minmax(0, 1fr); gap: 1.25em; }
	.ngt-img-drop { min-height: 15em; }
	.ngt-img-preview { max-height: 42vh; }
	.ngt-img-frame { min-height: 10em; }
	/*
	 * Size and Download stay in reach while the settings scroll. Sticky only works
	 * inside the parent box, so the wrappers step aside and the whole workspace is its range.
	 */
	.ngt-img-panel, .ngt-img-result { display: contents; }
	.ngt-img-bar {
		position: sticky;
		bottom: 0;
		z-index: 5;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		margin: 0 -16px;
		padding: .6em 16px;
		background: var(--theme-palette-color-7, #fff);
		box-shadow: 0 -2px 10px rgba(0, 0, 0, .1);
	}
	.ngt-img-toolbar .ngt-btn { padding-inline: .8em; }
	.ngt-img-toolbar [data-rotate] { min-width: 2.75em; padding-inline: .4em; }
	.ngt-img-sizes-line { font-size: 1em; }
	.ngt-img-download { width: auto; padding-inline: 1.5em; min-height: 2.9em; }
}
