/* image-size.css – "Compress image to N KB" and "Resize image" tool (loaded after /assets/css/site.css). */
.ist { --ist-line: #e2e8f0; --ist-ink: #1a202c; --ist-muted: #4a5568; --ist-soft: #5b6b80; --ist-bg: #eef2f7; --ist-acc: var(--accent, #3666d1); --ist-acc-soft: var(--accent-soft, #eef3fc);
       position: relative; max-width: 1240px; margin: 0 auto 2.5rem; padding: 0 12px; }
.ist [hidden] { display: none !important; }
.ist-start { max-width: 860px; margin: 0 auto; }
.ist.is-loaded .ist-start { display: none; }
.ist-start-points { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; margin: .9rem 0 0; padding: 0; list-style: none; color: var(--ist-muted); font-size: .9rem; }
.ist-start-points li::before { content: "✓ "; color: #38a169; font-weight: 700; }
.ist-error { max-width: 860px; margin: .8rem auto 0; padding: .75rem 1rem; border: 1px solid #feb2b2; border-radius: 10px; background: #fff5f5; color: #9b2c2c; }

.ist-work { display: none; border: 1px solid var(--ist-line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(15, 23, 42, .08); scroll-margin-top: calc(var(--header-h, 64px) + 12px); }
.ist.is-loaded .ist-work { display: flex; }
.ist-view { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--ist-bg); position: sticky; top: calc(var(--header-h, 64px) + 8px); align-self: flex-start; }
.ist-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--ist-line); flex-wrap: wrap; }
.ist-name { font-weight: 700; color: var(--ist-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.ist-orig { font-size: .82rem; color: var(--ist-soft); flex: 1; min-width: 0; }
.ist-btn { height: 34px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-size: .84rem; font-weight: 600; color: #2d3748; cursor: pointer; }
.ist-btn:hover { background: #f7fafc; }
.ist-views { display: flex; border: 1px solid #cbd5e0; border-radius: 8px; overflow: hidden; }
.ist-views button { height: 32px; padding: 0 10px; border: 0; border-right: 1px solid #e2e8f0; background: #fff; font: inherit; font-size: .8rem; font-weight: 600; color: var(--ist-muted); cursor: pointer; }
.ist-views button:last-child { border-right: 0; }
.ist-views button.is-on { background: var(--ist-acc-soft); color: var(--accent-dark, #2b4c94); }

.ist-stage { position: relative; flex: none; height: min(72vh, 660px); min-height: 380px; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden;
             background: repeating-conic-gradient(#e9eef5 0% 25%, #f4f7fb 0% 50%) 50% / 20px 20px; }
.ist-compare { --split: 50%; position: relative; width: 100%; height: 100%; }
.ist-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.ist-after { clip-path: inset(0 0 0 var(--split)); }
.ist-compare::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--split); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); pointer-events: none; }
.ist-slider { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.ist-tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(26, 32, 44, .78); color: #fff; font-size: .74rem; font-weight: 600; pointer-events: none; }
.ist-tag-l { left: 10px; } .ist-tag-r { right: 10px; }
.ist[data-view=result] .ist-before, .ist[data-view=result] .ist-compare::after, .ist[data-view=result] .ist-tag-l, .ist[data-view=result] .ist-slider,
.ist[data-view=actual] .ist-before, .ist[data-view=actual] .ist-compare::after, .ist[data-view=actual] .ist-tag, .ist[data-view=actual] .ist-slider { display: none; }
.ist[data-view=result] .ist-after { clip-path: none; }
.ist[data-view=actual] .ist-stage { display: block; overflow: auto; }
.ist[data-view=actual] .ist-compare { width: auto; height: auto; min-height: 0; }
.ist[data-view=actual] .ist-after { position: static; width: auto; height: auto; max-width: none; object-fit: none; clip-path: none; margin: 0 auto; image-rendering: auto; }
.ist-busy { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(0, 0, 0, .15); z-index: 4; }
.ist-busy-text { display: block; font-size: .82rem; font-weight: 600; color: var(--ist-ink); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ist-busy-bar { display: block; height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.ist-busy-bar i { display: block; height: 100%; width: 0; background: var(--ist-acc); transition: width .2s; }

.ist-panel { width: 340px; flex: none; border-left: 1px solid var(--ist-line); display: flex; flex-direction: column; background: #fff; }
.ist-sec { padding: 14px 16px; border-bottom: 1px solid var(--ist-line); display: flex; flex-direction: column; gap: 10px; }
.ist-h { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ist-soft); }
.ist-f { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--ist-muted); }
.ist-f input[type=number], .ist-f input[type=text], .ist-f select, .ist-row select { height: 38px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-weight: 500; color: var(--ist-ink); min-width: 0; }
.ist-row { display: flex; gap: 8px; align-items: flex-end; }
.ist-row > * { flex: 1; }
.ist-target-row input { font-size: 1.15rem; font-weight: 700; }
.ist-target-row select { flex: 0 0 82px; height: 44px; }
.ist-target-row input { height: 44px; width: 100%; min-width: 0; box-sizing: border-box; }
.ist-row input { width: 100%; min-width: 0; box-sizing: border-box; }
.ist-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ist-chip { height: 28px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 999px; background: #fff; font: inherit; font-size: .78rem; font-weight: 700; color: var(--ist-muted); cursor: pointer; }
.ist-chip.is-on, .ist-chip:hover { border-color: var(--ist-acc); color: var(--ist-acc); }
.ist-seg { display: flex; border: 1px solid #cbd5e0; border-radius: 9px; overflow: hidden; }
.ist-seg button { flex: 1; min-height: 36px; padding: 4px 8px; border: 0; border-right: 1px solid #e2e8f0; background: #fff; font: inherit; font-size: .82rem; font-weight: 600; color: #2d3748; cursor: pointer; line-height: 1.2; }
.ist-seg button:last-child { border-right: 0; }
.ist-seg button.is-on { background: var(--ist-acc-soft); color: var(--accent-dark, #2b4c94); }
.ist-seg button:disabled { opacity: .4; cursor: default; }
.ist-note { margin: 0; font-size: .76rem; line-height: 1.45; color: var(--ist-soft); }
.ist-check { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--ist-muted); cursor: pointer; }
.ist-check input { width: 17px; height: 17px; accent-color: var(--ist-acc); }
.ist-switch { font-weight: 700; color: var(--ist-ink); }
.ist-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ist-presets button { height: 28px; padding: 0 9px; border: 1px solid #cbd5e0; border-radius: 7px; background: #fff; font: inherit; font-size: .74rem; font-weight: 600; color: var(--ist-muted); cursor: pointer; }
.ist-presets button:hover { border-color: var(--ist-acc); color: var(--ist-acc); }
.ist[data-usesize="0"] .ist-only-size, .ist[data-usesize="1"] .ist-only-nosize, .ist[data-dims=keep] .ist-only-px, .ist[data-dims=keep] .ist-only-pct,
.ist[data-dims=pct] .ist-only-px, .ist[data-dims=px] .ist-only-pct, .ist[data-dims=px] .ist-only-keep, .ist[data-dims=pct] .ist-only-keep, .ist[data-format="image/png"] .ist-only-lossy { display: none !important; }
.ist-details > summary { cursor: pointer; font-size: .84rem; font-weight: 700; color: var(--ist-ink); list-style: none; display: flex; align-items: center; gap: 6px; }
.ist-details > summary::-webkit-details-marker { display: none; }
.ist-details > summary::before { content: "▸"; color: var(--ist-soft); transition: transform .15s; }
.ist-details[open] > summary::before { transform: rotate(90deg); }
.ist-details > div { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ist-f input[type=range] { width: 100%; accent-color: var(--ist-acc); }
.ist-f input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; }

.ist-out { padding: 14px 16px; margin-top: auto; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; border-top: 1px solid var(--ist-line); position: sticky; bottom: 0; }
.ist-status { margin: 0; padding: 8px 10px; border-radius: 8px; font-size: .86rem; font-weight: 700; line-height: 1.4; }
.ist-status.is-ok { background: #f0fff4; color: #276749; }
.ist-status.is-info { background: #eef3fc; color: #2b4c94; font-weight: 600; }
.ist-status.is-warn { background: #fffaf0; color: #9c4221; font-weight: 600; }
.ist-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: .8rem; }
.ist-stats dt { color: var(--ist-soft); }
.ist-stats dd { margin: 0; color: var(--ist-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ist-download { height: 48px; border: 0; border-radius: 10px; background: var(--brand, #3666d1); color: #fff; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ist-download svg { width: 19px; height: 19px; }
.ist-download:hover:not(:disabled) { background: var(--brand-dark, #2b4c94); }
.ist-download:disabled { opacity: .45; cursor: default; }
.ist-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3100; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: #1a202c; color: #fff; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.ist-toast.is-warn { background: #9b2c2c; }

@media (max-width: 900px) {
    .ist { padding: 0; }
    .ist-work { flex-direction: column; border-radius: 0; border-left: 0; border-right: 0; overflow: visible; }
    .ist-view { position: relative; top: auto; align-self: stretch; }
    .ist-stage { min-height: 280px; height: 52vh; }
    .ist-panel { width: auto; border-left: 0; border-top: 1px solid var(--ist-line); }
    .ist-out { z-index: 5; box-shadow: 0 -6px 16px rgba(15, 23, 42, .08); }
    .ist-name { max-width: 100%; }
    .ist-orig { flex-basis: 100%; order: 3; }
    .ist-bar .ist-btn { margin-left: auto; }
}

/* before the button is pressed (or after a setting changed) only the original is shown */
.ist[data-state=ready] .ist-after, .ist[data-state=stale] .ist-after,
.ist[data-state=ready] .ist-tag-r, .ist[data-state=stale] .ist-tag-r,
.ist[data-state=ready] .ist-slider, .ist[data-state=stale] .ist-slider,
.ist[data-state=ready] .ist-compare::after, .ist[data-state=stale] .ist-compare::after,
.ist[data-state=ready] .ist-views, .ist[data-state=stale] .ist-views { display: none !important; }
.ist[data-state=ready] .ist-before, .ist[data-state=stale] .ist-before { display: block !important; }
.ist-run { height: 50px; border: 0; border-radius: 10px; background: var(--accent, #3666d1); color: #fff; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 14px rgba(54, 102, 209, .3); }
.ist-run svg { width: 19px; height: 19px; }
.ist-run:hover:not(:disabled) { background: var(--accent-dark, #2b4c94); }
.ist-run:disabled { opacity: .6; cursor: progress; }
