/* ==========================================================================
   ImagesTo — converter
   ========================================================================== */

.ito-tool { padding: 12px 0 48px; scroll-margin-top: 72px; }

.ito-panel {
	max-width: 880px; margin: 0 auto;
	padding: 20px;
	background: var(--ito-surface);
	border: 1px solid var(--ito-line);
	border-radius: 16px;
	box-shadow: var(--ito-shadow);
}
@media (min-width: 640px) { .ito-panel { padding: 24px; } }

/* drop zone */
.ito-drop {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	min-height: 240px; padding: 28px 20px;
	text-align: center;
	border: 2px dashed var(--ito-line-2);
	border-radius: 14px;
	background: var(--ito-bg);
	cursor: pointer;
	transition: border-color .15s, background .15s;
}
.ito-drop:hover, .ito-drop.is-drag { border-color: var(--ito-accent); background: var(--ito-accent-soft); }
.ito-drop.is-busy { pointer-events: none; opacity: .6; }
.ito-drop__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px; border-radius: 50%; background: var(--ito-surface); border: 1px solid var(--ito-line); color: var(--ito-accent); }
.ito-drop__title { margin: 0 0 6px; font-size: 18px; }
.ito-drop__hint { margin: 0 0 6px; color: var(--ito-ink-3); font-size: 14px; letter-spacing: .02em; }
.ito-drop__paste { margin: 0; color: var(--ito-ink-3); font-size: 14px; }
@media (hover: none) { .ito-drop__paste { display: none; } .ito-drop { min-height: 180px; } }

.ito-input-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.ito-camera { cursor: pointer; }
@media (hover: none) and (pointer: coarse) {
	.ito-input-actions { flex-direction: column; }
	.ito-camera { order: -1; background: var(--ito-ink); color: #fff; border-color: var(--ito-ink); min-height: 50px; }
}

.ito-url { display: flex; gap: 8px; margin-top: 12px; }
.ito-url[hidden] { display: none; }

/* file list */
.ito-files { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.ito-file {
	display: grid; grid-template-columns: 44px 1fr auto auto auto; align-items: center; gap: 4px 12px;
	padding: 8px 8px 8px 8px;
	border: 1px solid var(--ito-line); border-radius: 10px; background: var(--ito-surface);
}
.ito-file__thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--ito-alt); transition: transform .2s; }
.ito-file__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14.5px; }
.ito-file__size { display: none; color: var(--ito-ink-3); font-size: 13px; }
.ito-file__status { grid-column: 2; grid-row: 2; color: var(--ito-ink-3); font-size: 13px; }
.ito-file .ito-icon-btn:first-of-type { grid-column: 4; grid-row: 1 / span 2; }
.ito-file .ito-icon-btn:last-of-type { grid-column: 5; grid-row: 1 / span 2; }
@media (min-width: 640px) {
	.ito-file { grid-template-columns: 44px 1fr auto auto auto auto; }
	.ito-file__size { display: block; grid-column: 3; grid-row: 1 / span 2; }
	.ito-file__status { grid-column: 4; grid-row: 1 / span 2; min-width: 90px; text-align: right; }
	.ito-file .ito-icon-btn:first-of-type { grid-column: 5; }
	.ito-file .ito-icon-btn:last-of-type { grid-column: 6; }
}
.ito-file--done .ito-file__status { color: var(--ito-ok); font-weight: 600; }
.ito-file--processing .ito-file__status { color: var(--ito-accent); font-weight: 600; }
.ito-file--error .ito-file__status { color: var(--ito-bad); white-space: normal; }

.ito-icon-btn {
	display: inline-grid; place-items: center; width: 36px; height: 36px;
	border: 1px solid transparent; border-radius: 8px; background: transparent;
	color: var(--ito-ink-3); cursor: pointer;
}
.ito-icon-btn:hover { background: var(--ito-alt); color: var(--ito-ink); }
.ito-icon-btn:disabled { opacity: .4; cursor: default; }

/* advanced */
.ito-advanced { margin-top: 16px; border: 1px solid var(--ito-line); border-radius: 10px; }
.ito-advanced summary { display: flex; align-items: center; gap: 6px; padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ito-ink-2); list-style: none; }
.ito-advanced summary::-webkit-details-marker { display: none; }
.ito-advanced summary .ito-icon { transition: transform .2s; }
.ito-advanced[open] summary .ito-icon { transform: rotate(180deg); }
.ito-advanced__body { padding: 0 14px 14px; display: grid; gap: 16px; }
.ito-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.ito-field legend { padding: 0; margin-bottom: 4px; font-weight: 650; font-size: 14.5px; }
.ito-field__help { margin: 0 0 10px; color: var(--ito-ink-3); font-size: 13.5px; }
.ito-langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; max-height: 210px; overflow: auto; padding: 2px; }
.ito-toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ito-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.ito-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--ito-accent); }
.ito-check--sm { font-size: 13.5px; color: var(--ito-ink-2); }

/* run */
.ito-run { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; }
.ito-run .ito-btn--primary { min-width: min(100%, 280px); }
.ito-alert { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: #fef2f2; color: var(--ito-bad); border: 1px solid #fecaca; font-size: 14.5px; }

/* progress */
.ito-progress { margin-top: 18px; }
.ito-stages { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 13.5px; color: var(--ito-ink-3); }
.ito-stages li { display: inline-flex; align-items: center; gap: 6px; }
.ito-stages li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ito-line-2); }
.ito-stages li.is-active { color: var(--ito-ink); font-weight: 650; }
.ito-stages li.is-active::before { background: var(--ito-accent); box-shadow: 0 0 0 4px var(--ito-accent-soft); animation: ito-pulse 1.2s ease-in-out infinite; }
.ito-stages li.is-done { color: var(--ito-ink-2); }
.ito-stages li.is-done::before { background: var(--ito-ok); }
@keyframes ito-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.ito-bar { height: 8px; border-radius: 99px; background: var(--ito-alt); overflow: hidden; }
.ito-bar span { display: block; height: 100%; width: 0; background: var(--ito-accent); border-radius: inherit; transition: width .3s ease; }
.ito-progress__label { margin: 8px 0 0; text-align: center; color: var(--ito-ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- results ---------- */

.ito-results { scroll-margin-top: 72px; }
.ito-summary { padding: 18px 20px; margin-bottom: 14px; background: var(--ito-surface); border: 1px solid var(--ito-line); border-radius: 14px; }
.ito-summary__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ito-summary__ok { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e8f6ee; color: var(--ito-ok); }
.ito-summary__title { margin: 0; font-size: 20px; }
.ito-summary p { margin: 10px 0 0; }
.ito-conf { padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: 13.5px; }
.ito-conf--high { background: #e8f6ee; color: var(--ito-ok); }
.ito-conf--mid { background: #fff6e5; color: var(--ito-warn); }
.ito-conf--low { background: #fef2f2; color: var(--ito-bad); }
.ito-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 14.5px; color: var(--ito-ink-2); }
.ito-stat strong { color: var(--ito-ink); font-variant-numeric: tabular-nums; }
.ito-stat--warn, .ito-stat--warn strong { color: var(--ito-warn); }

.ito-results__nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ito-docpick { flex: 1 1 260px; max-width: 420px; }
.ito-docpick[hidden] { display: none; }
.ito-pane-switch { display: inline-flex; padding: 3px; background: var(--ito-alt); border-radius: 10px; margin-left: auto; }
.ito-pane-switch button { padding: 8px 16px; border: 0; border-radius: 8px; background: transparent; font: 600 14px var(--ito-font); color: var(--ito-ink-2); cursor: pointer; }
.ito-pane-switch button[aria-selected="true"] { background: var(--ito-surface); color: var(--ito-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.ito-results__grid { display: grid; gap: 16px; }
@media (max-width: 959px) {
	.ito-results__grid[data-show="result"] .ito-source { display: none; }
	.ito-results__grid[data-show="image"] .ito-output { display: none; }
}
@media (min-width: 960px) {
	.ito-pane-switch { display: none; }
	.ito-results__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
	.ito-source { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; }
	.admin-bar .ito-source { top: 108px; max-height: calc(100vh - 124px); }
}

.ito-source, .ito-output { background: var(--ito-surface); border: 1px solid var(--ito-line); border-radius: 14px; min-width: 0; }
.ito-source__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--ito-surface); border-bottom: 1px solid var(--ito-line); border-radius: 14px 14px 0 0; }
.ito-source__title { font-weight: 650; font-size: 14.5px; }
.ito-source__frame { padding: 14px; display: grid; gap: 18px; }
.ito-src { margin: 0; }
.ito-src figcaption { margin-bottom: 6px; font-size: 13.5px; font-weight: 600; color: var(--ito-ink-2); }
.ito-src__wrap { position: relative; line-height: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--ito-line); background: var(--ito-alt); }
.ito-src__wrap img { display: block; width: 100%; height: auto; }
.ito-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.ito-box { fill: color-mix(in srgb, var(--ito-accent) 6%, transparent); stroke: var(--ito-accent); stroke-opacity: .55; stroke-width: var(--sw, 2px); vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .12s, stroke-opacity .12s; }
.ito-box--heading { stroke: #7c3aed; fill: rgba(124, 58, 237, .06); }
.ito-box--list { stroke: #0d9488; fill: rgba(13, 148, 136, .06); }
.ito-box--table { stroke: #c2410c; fill: rgba(194, 65, 12, .06); }
.ito-box:hover, .ito-box.is-active { fill: color-mix(in srgb, var(--ito-accent) 20%, transparent); stroke-opacity: 1; stroke-width: 2.5px; }
.ito-box--heading.is-active, .ito-box--heading:hover { fill: rgba(124, 58, 237, .18); }
.ito-box--list.is-active, .ito-box--list:hover { fill: rgba(13, 148, 136, .18); }
.ito-box--table.is-active, .ito-box--table:hover { fill: rgba(194, 65, 12, .16); }
.hide-boxes .ito-box { opacity: 0; }
.hide-boxes .ito-box.is-active { opacity: 1; }
.ito-focus { fill: rgba(245, 158, 11, .25); stroke: #f59e0b; stroke-width: 2.5px; vector-effect: non-scaling-stroke; opacity: 0; pointer-events: none; }
.ito-focus.is-on { animation: ito-focus 2.4s ease forwards; }
@keyframes ito-focus { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* output */
.ito-tabs { display: flex; gap: 2px; padding: 6px 6px 0; overflow-x: auto; border-bottom: 1px solid var(--ito-line); scrollbar-width: thin; }
.ito-tabs button { flex: none; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: 600 14.5px var(--ito-font); color: var(--ito-ink-3); cursor: pointer; margin-bottom: -1px; }
.ito-tabs button:hover { color: var(--ito-ink); }
.ito-tabs button[aria-selected="true"] { color: var(--ito-ink); border-bottom-color: var(--ito-accent); }
.ito-tabs button[hidden] { display: none; }

.ito-view { padding: 14px; min-height: 240px; }
.ito-view .ito-code { max-height: 70vh; border-radius: 10px; }
.ito-docsep { margin: 18px 0 8px; padding-top: 14px; border-top: 1px dashed var(--ito-line-2); font-weight: 650; font-size: 14px; color: var(--ito-ink-3); }
.ito-docsep:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.ito-blk { position: relative; padding: 10px 12px 12px; margin-bottom: 8px; border: 1px solid transparent; border-radius: 10px; transition: border-color .12s, background .12s; }
.ito-blk:hover, .ito-blk:focus-within { border-color: var(--ito-line); background: var(--ito-bg); }
.ito-blk.is-flash { animation: ito-flash 1.4s ease; }
@keyframes ito-flash { 0%, 40% { background: var(--ito-accent-soft); border-color: var(--ito-accent-line); } }
.ito-blk__bar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ito-blk__type {
	appearance: none; -webkit-appearance: none;
	padding: 2px 22px 2px 8px; min-height: 0;
	font: 700 11.5px/18px var(--ito-font); letter-spacing: .04em; text-transform: uppercase;
	color: var(--ito-accent); background: var(--ito-accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7180' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center;
	border: 0; border-radius: 6px; cursor: pointer;
}
.ito-blk--h1 .ito-blk__type, .ito-blk--h2 .ito-blk__type, .ito-blk--h3 .ito-blk__type, .ito-blk--h4 .ito-blk__type { color: #6d28d9; background-color: #f3effe; }
.ito-blk--ul .ito-blk__type, .ito-blk--ol .ito-blk__type { color: #0f766e; background-color: #e6f6f4; }
.ito-blk--p .ito-blk__type { color: var(--ito-ink-2); background-color: var(--ito-alt); }
.ito-blk__type--static { cursor: default; padding-right: 8px; color: #c2410c; background: #fdf0e8; }
.ito-blk__conf { font-size: 12px; color: var(--ito-ink-3); font-variant-numeric: tabular-nums; }
.ito-blk__conf.is-low { color: var(--ito-warn); font-weight: 650; }
.ito-blk__del { margin-left: auto; width: 30px; height: 30px; opacity: 0; }
.ito-blk:hover .ito-blk__del, .ito-blk:focus-within .ito-blk__del { opacity: 1; }
@media (hover: none) { .ito-blk__del { opacity: 1; } }

.ito-blk [contenteditable] { outline: none; border-radius: 4px; padding: 1px 2px; margin: 0; }
.ito-blk [contenteditable]:focus { box-shadow: 0 0 0 2px var(--ito-accent-line); background: var(--ito-surface); }
.ito-blk h1.ito-blk__text { font-size: 28px; }
.ito-blk h2.ito-blk__text { font-size: 23px; }
.ito-blk h3.ito-blk__text { font-size: 19px; }
.ito-blk h4.ito-blk__text, .ito-blk h5.ito-blk__text, .ito-blk h6.ito-blk__text { font-size: 17px; }
.ito-blk p.ito-blk__text { font-size: 16px; line-height: 1.65; }
.ito-blk__list { margin: 0; padding-left: 24px; }
.ito-blk__list li { margin: 3px 0; }
.ito-blk__table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ito-blk__table th, .ito-blk__table td { border: 1px solid var(--ito-line-2); padding: 6px 10px; text-align: left; vertical-align: top; }
.ito-blk__table th { background: var(--ito-alt); font-weight: 650; }
.ito-low { background: transparent; color: inherit; text-decoration: underline wavy #f59e0b; text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: pointer; }
.ito-low:hover { background: #fff6e5; }

.ito-tablebox { margin-bottom: 18px; }
.ito-tablebox__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; font-size: 14.5px; color: var(--ito-ink-2); }
.ito-tablebox__head .ito-btn { margin-left: auto; }
.ito-tablebox table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ito-tablebox th, .ito-tablebox td { border: 1px solid var(--ito-line-2); padding: 6px 10px; text-align: left; }
.ito-tablebox th { background: var(--ito-alt); }

.ito-output__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--ito-line); background: var(--ito-surface); border-radius: 0 0 14px 14px; position: sticky; bottom: 0; z-index: 3; }
.ito-output__actions [data-new] { margin-left: auto; }
.ito-btn.is-done { background: var(--ito-ok); border-color: var(--ito-ok); }
.ito-output__note { margin: 0; padding: 0 14px 14px; color: var(--ito-ink-3); font-size: 13px; }
@media (max-width: 520px) {
	.ito-output__actions .ito-btn { flex: 1 1 auto; }
	.ito-output__actions [data-new] { margin-left: 0; flex-basis: 100%; }
}

.ito-menu-btn { position: relative; }
.ito-menu-btn__list {
	position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 10;
	min-width: 210px; padding: 6px;
	background: var(--ito-surface); border: 1px solid var(--ito-line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
	display: grid;
}
.ito-menu-btn__list[hidden] { display: none; }
.ito-menu-btn__list button { padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; font: 550 14.5px var(--ito-font); color: var(--ito-ink); cursor: pointer; }
.ito-menu-btn__list button:hover, .ito-menu-btn__list button:focus-visible { background: var(--ito-alt); }
.ito-menu-btn__list button[hidden] { display: none; }

/* hidden attribute must win over display rules above */
.ito-tool [hidden] { display: none !important; }
