/* OpenPress Image Format Converter interface (task 044 foundation; result, comparison and download styles added in 044B). Loaded on the Image Format Converter 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. Same visual language as the other tools; all selectors start with .op-ifc. Presentation only: the conversion is in
   image-format-converter-engine.js. Reduced motion: main.css zeroes transitions globally; the rule at the end repeats it for this tool. */

.op-ifc { --op-ifc-error: #B42318; --op-ifc-zone: #F1F3F5; --op-ifc-good: #067647; --op-ifc-warn: #B54708; display: grid; gap: 1.5rem; min-width: 0; }
@media (prefers-color-scheme: dark) {
	.op-ifc { --op-ifc-error: #F97066; --op-ifc-zone: #171D33; --op-ifc-good: #47CD89; --op-ifc-warn: #FDB022; }
	:root[data-theme="light"] .op-ifc { --op-ifc-error: #B42318; --op-ifc-zone: #F1F3F5; --op-ifc-good: #067647; --op-ifc-warn: #B54708; }
}
:root[data-theme="dark"] .op-ifc { --op-ifc-error: #F97066; --op-ifc-zone: #171D33; --op-ifc-good: #47CD89; --op-ifc-warn: #FDB022; }

/* Heading ----------------------------------------------------------------- */
.op-ifc__intro { display: grid; gap: 0.25rem; min-width: 0; }
.op-ifc__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-ifc__lede { margin: 0; color: var(--op-text-muted); font-size: 0.875rem; line-height: 1.4; }
.op-ifc__section-title { margin: 0; color: var(--op-text-muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* Upload zone -------------------------------------------------------------- */
.op-ifc__zone { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; min-width: 0; padding: 2.5rem 1.5rem; background: var(--op-ifc-zone); border: 1.5px dashed var(--op-border-strong); border-radius: 1.25rem; text-align: center; transition: border-color var(--op-transition), background-color var(--op-transition); }
.op-ifc__zone[hidden] { display: none; }
.op-ifc__zone:hover,
.op-ifc__zone:focus-within { border-color: var(--op-btn-bg); }
.op-ifc__zone[data-dragging="true"] { border-style: solid; border-color: var(--op-btn-bg); background: color-mix(in srgb, var(--op-btn-bg) 12%, var(--op-ifc-zone)); }
.op-ifc__zone:has(.op-ifc__input:focus-visible) { border-style: solid; border-color: var(--op-focus); }
.op-ifc__zone-icon { display: grid; place-items: center; color: var(--op-link); }
.op-ifc__zone-title { margin: 0; color: var(--op-text); font-size: 1.0625rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.op-ifc__input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; opacity: 0; clip-path: inset(50%); pointer-events: none; }
.op-ifc__choose { min-width: 12rem; max-width: 100%; min-height: 3rem; padding: 0 1.5rem; border-radius: 0.75rem; font-size: 0.9375rem; font-weight: 600; cursor: pointer; }
.op-ifc__input:focus-visible + .op-ifc__choose { outline: 3px solid var(--op-focus); outline-offset: 3px; }
.op-ifc__hint { display: grid; gap: 0.25rem; margin-top: 0.5rem; min-width: 0; }
.op-ifc__formats,
.op-ifc__limit { margin: 0; color: var(--op-text-muted); font-size: 0.8125rem; line-height: 1.4; }
.op-ifc__trust { display: flex; align-items: flex-start; justify-content: center; gap: 0.5rem; margin: 0.25rem 0 0; color: var(--op-text-muted); font-size: 0.8125rem; line-height: 1.4; text-align: left; }
.op-ifc__trust svg { flex: none; margin-top: 1px; color: var(--op-link); }
.op-ifc__trust span { min-width: 0; overflow-wrap: anywhere; }

/* Message box: error (default) and info ------------------------------------ */
.op-ifc__message { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; padding: 0.75rem 1rem; color: var(--op-ifc-error); background: color-mix(in srgb, var(--op-ifc-error) 8%, var(--op-bg-elevated)); border: 1px solid color-mix(in srgb, var(--op-ifc-error) 40%, var(--op-border)); border-radius: 0.75rem; }
.op-ifc__message[data-kind="info"] { color: var(--op-text); background: var(--op-bg-elevated); border-color: var(--op-border-strong); }
.op-ifc__message[hidden] { display: none; }
.op-ifc__message-icon { flex: none; margin-top: 1px; }
.op-ifc__message-body { display: grid; gap: 0.125rem; min-width: 0; }
.op-ifc__message-title { font-size: 0.9375rem; font-weight: 700; line-height: 1.3; }
.op-ifc__message-text { margin: 0; color: var(--op-text); font-size: 0.875rem; line-height: 1.4; overflow-wrap: anywhere; }

/* Selected image ----------------------------------------------------------- */
.op-ifc__file { display: grid; gap: 0.75rem; min-width: 0; padding: 1rem; background: var(--op-bg-elevated); border: 1px solid var(--op-border); border-radius: 0.75rem; box-shadow: var(--op-shadow-sm); }
.op-ifc__file[hidden] { display: none; }
.op-ifc__file-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-width: 0; }
.op-ifc__name { min-width: 0; color: var(--op-text); font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.op-ifc__remove { flex: none; min-height: 2.75rem; }
.op-ifc__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin: 0; min-width: 0; }
.op-ifc__fact { display: grid; gap: 0.125rem; min-width: 0; }
.op-ifc__fact dt { color: var(--op-text-muted); font-size: 0.8125rem; font-weight: 500; }
.op-ifc__fact dd { margin: 0; color: var(--op-text); font-size: 0.9375rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }

/* Controls ----------------------------------------------------------------- */
.op-ifc__controls { display: grid; gap: 0.75rem; min-width: 0; }
.op-ifc__field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.375rem; max-width: 20rem; min-width: 0; }
.op-ifc__label { color: var(--op-text); font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.op-ifc__select { display: block; width: 100%; min-width: 0; min-height: 2.75rem; margin: 0; 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: 1rem; cursor: pointer; transition: border-color var(--op-transition), background-color var(--op-transition); }
.op-ifc__select:hover { border-color: color-mix(in srgb, var(--op-btn-bg) 45%, var(--op-border-strong)); }
.op-ifc__select:focus { border-color: var(--op-focus); background: var(--op-bg-elevated); }
.op-ifc__select:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }

.op-ifc__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; min-width: 0; }
.op-ifc__convert,
.op-ifc__clear { min-height: 2.75rem; }
.op-ifc__convert { min-width: 10.5rem; justify-content: center; }
.op-ifc__convert:focus-visible,
.op-ifc__clear:focus-visible,
.op-ifc__remove:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-ifc__convert[aria-disabled="true"],
.op-ifc__clear[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: auto; }
.op-ifc__convert[aria-disabled="true"]:active,
.op-ifc__clear[aria-disabled="true"]:active { transform: none; box-shadow: none; }
.op-ifc__convert[aria-busy="true"] { cursor: progress; }
.op-ifc__status { margin: 0; color: var(--op-text-muted); font-size: 0.875rem; line-height: 1.4; }
.op-ifc__status[hidden] { display: none; }

/* Result panel (044B) ------------------------------------------------------ */
.op-ifc__output { display: grid; gap: 1rem; min-width: 0; padding: 1rem; background: var(--op-bg-elevated); border: 1px solid var(--op-border); border-radius: 0.75rem; box-shadow: var(--op-shadow-sm); }
.op-ifc__output[hidden] { display: none; }
.op-ifc__stale { margin: 0; padding: 0.75rem 1rem; color: var(--op-text); font-size: 0.9375rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; background: var(--op-ifc-zone); border: 1px solid var(--op-border-strong); border-left-width: 4px; border-radius: 0.5rem; }
.op-ifc__stale[hidden] { display: none; }
.op-ifc__result { display: grid; gap: 1rem; min-width: 0; }
.op-ifc__result[hidden] { display: none; }
.op-ifc__result-title { margin: 0; color: var(--op-text); font-size: 1.0625rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }

/* Preview: the frame hugs the image and carries a checkerboard, so transparent areas of PNG / WebP output are visible as transparent. */
.op-ifc__preview { display: grid; place-items: center; min-width: 0; padding: 0.75rem; background: var(--op-ifc-zone); border: 1px solid var(--op-border); border-radius: 0.75rem; overflow: hidden; }
.op-ifc__preview:empty { display: none; }
.op-ifc__preview-frame { display: block; max-width: 100%; line-height: 0; background-color: var(--op-bg-elevated); background-image: linear-gradient(45deg, color-mix(in srgb, var(--op-text) 14%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--op-text) 14%, transparent) 75%), linear-gradient(45deg, color-mix(in srgb, var(--op-text) 14%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--op-text) 14%, transparent) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; outline: 1px solid var(--op-border-strong); }
.op-ifc__preview-img { display: block; width: auto; height: auto; max-width: 100%; max-height: 24rem; object-fit: contain; }

/* Size comparison: the words carry the meaning; the coloured edge only repeats it. */
.op-ifc__comparison { margin: 0; padding: 0.75rem 1rem; color: var(--op-text); font-size: 0.9375rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; background: var(--op-ifc-zone); border: 1px solid var(--op-border); border-left: 4px solid var(--op-border-strong); border-radius: 0.5rem; }
.op-ifc__comparison:empty { display: none; }
.op-ifc__comparison[data-trend="smaller"] { border-left-color: var(--op-ifc-good); }
.op-ifc__comparison[data-trend="larger"] { border-left-color: var(--op-ifc-warn); }
.op-ifc__note { margin: 0; color: var(--op-text-muted); font-size: 0.8125rem; line-height: 1.4; overflow-wrap: anywhere; }
.op-ifc__note[hidden] { display: none; }

/* Original and converted facts, side by side when there is room, stacked on narrow screens. */
.op-ifc__compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.75rem; min-width: 0; }
.op-ifc__col { display: grid; gap: 0.5rem; align-content: start; min-width: 0; padding: 0.75rem 1rem; background: var(--op-bg); border: 1px solid var(--op-border); border-radius: 0.75rem; }
.op-ifc__col-title { margin: 0; color: var(--op-text-muted); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1.3; }
.op-ifc__facts--col { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }

.op-ifc__result-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; min-width: 0; }
.op-ifc__download { min-height: 3rem; min-width: 12rem; justify-content: center; }
.op-ifc__download:focus-visible { outline: 3px solid var(--op-focus); outline-offset: 2px; }
.op-ifc__download[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: auto; }
.op-ifc__download[aria-disabled="true"]:active { transform: none; box-shadow: none; }

@media (min-width: 768px) {
	.op-ifc__output { padding: 1.25rem; }
	.op-ifc__zone { padding: 3rem 1.5rem; }
}
@media (max-width: 480px) {
	.op-ifc__zone { padding: 2rem 1rem; }
	.op-ifc__actions > .op-btn,
	.op-ifc__result-actions > .op-btn { flex: 1 1 100%; }
	.op-ifc__choose { width: 100%; min-width: 0; }
	.op-ifc__field { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
	.op-ifc__zone,
	.op-ifc__select { transition: none; }
}
