/* image-tool.css: shared styling for every page that mounts the image tool widget.
   Colours come from tool.css tokens so light/dark both work. */
.it-drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px; text-align: center; cursor: pointer; background: var(--surface); color: var(--text); transition: border-color .15s, background .15s; display: block; }
.it-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.it-drop input[type=file] { display: none; }
.it-drop strong { display: block; margin-bottom: 4px; }

.it-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.it-presets button { padding: 7px 14px; font-size: .9rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; cursor: pointer; }
.it-presets button:hover, .it-presets button:focus-visible { border-color: var(--accent); color: var(--accent); }
.it-presets button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.it-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.it-fields label { display: block; margin-bottom: 4px; font-size: .92rem; color: var(--muted); }
.it-fields input, .it-fields select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.it-row { display: flex; gap: 8px; }
.it-fields .it-row input { flex: 1 1 auto; min-width: 0; width: auto; }
.it-fields .it-row select { flex: 0 0 auto; width: auto; }
@media (max-width: 560px) { .it-fields { grid-template-columns: 1fr; } }

.it-go { display: inline-block; background: var(--accent); color: var(--bg); border: 0; padding: 11px 20px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; margin-top: 14px; }
.it-go:hover { filter: brightness(1.08); }
.it-out { margin-top: 18px; }
.it-out img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.it-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }

/* before / after, so the cost of compression is visible rather than claimed */
.it-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.it-compare figure { margin: 0; }
.it-compare figcaption { margin-top: 6px; font-size: .84rem; }
.it-compare figure[hidden] { display: none; }
.it-compare figure[hidden] ~ figure { grid-column: 1 / -1; }
@media (max-width: 420px) { .it-compare { grid-template-columns: 1fr; } }

/* clipboard row */
.it-paste { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 10px 0 0; font-size: .9rem; }
.it-paste .it-link { margin-left: 0; }
.it-stat { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; font-size: .95rem; color: var(--muted); }
.it-stat b { font-size: 1.15rem; display: block; color: var(--text); }
.it-muted { color: var(--muted); font-size: .88rem; }
.it-err { background: var(--warn-bg); border: 1px solid var(--border); color: var(--warn-text); padding: 10px 12px; border-radius: 8px; }
.it-busy { opacity: .6; pointer-events: none; }

/* portal picker — the spec people know by name */
.it-portal { margin-bottom: 14px; }
.it-portal select { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }

/* target chips: what the tool is aiming at, always visible */
.it-spec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.it-spec-label { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.it-chip { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .86rem; font-weight: 600; }

/* advanced fields, folded away by default */
.it-adv { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.it-adv summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
.it-adv summary:hover { color: var(--accent); }
.it-adv .it-fields { margin-top: 10px; }

/* crop stage */
.it-crop { margin-top: 16px; }
/* overflow:hidden clips the box's huge spread shadow to the picture, so only the
   discarded part of the image is dimmed and not the rest of the page */
.it-crop-wrap { position: relative; display: inline-block; max-width: 100%; overflow: hidden; border-radius: 8px; touch-action: none; }
.it-crop-canvas { display: block; max-width: 100%; border-radius: 8px; border: 1px solid var(--border); cursor: crosshair; }
.it-crop-box { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); cursor: move; }
/* corner marks, so it reads as something you can pull on */
.it-crop-box::before, .it-crop-box::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 3px solid var(--accent);
}
.it-crop-box::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; }
.it-crop-box::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; }
.it-link { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; margin-left: 12px; }
.it-link:hover { color: var(--accent); }

/* page shell — the generated pages use bare <main>/<section>, so they are styled here */
main { max-width: 760px; margin: 0 auto; padding: 22px 16px 48px; }
main > section { margin-top: 34px; }
main h2 { font-size: 1.4rem; line-height: 1.3; margin: 0 0 8px; }
main h3 { font-size: 1.05rem; margin: 22px 0 4px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
@media (min-width: 600px) { .card { padding: 22px; } }

/* reference tables inside the copy */
main table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .94rem; display: block; overflow-x: auto; }
main table th, main table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
main table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
main table tr:last-child td { border-bottom: 0; }

/* shared page furniture */
.tool-nav { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 18px; font-size: .9rem; }
.tool-nav a { color: var(--muted); text-decoration: none; }
.tool-nav a:hover { color: var(--accent); }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.related a { display: block; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); background: var(--surface); }
.related a:hover { border-color: var(--accent); color: var(--accent); }
footer.site { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
footer.site a { color: var(--muted); }
