/* SkyyCast Image Format Converter (/tools/image-format-converter).
 *
 * Loaded by that page only, after assets/sc-public.css AND
 * assets/sc-image-checker.css: this file reuses the checker's shared `ic-*`
 * shell (drop zone, buttons, card list, detail panel, facts grid, badges)
 * and only adds the `fc-*` pieces specific to this tool -- the output-
 * format picker (the primary, always-visible control, designed around
 * Input format -> Output format rather than copying the compressor's mode
 * tabs), the quality control (hidden for PNG, which is lossless), the
 * transparency background-color warning, the progress bar and the
 * before/after compare slider. All scoped under `.pub-site` and built from
 * the `--pub-*` tokens: no new colours, no new fonts, nothing on
 * :root/html/body. Motion is limited to short state transitions and is
 * switched off under prefers-reduced-motion. */

/* ---- Output format picker: the primary control ---- */
.pub-site .fc-formats {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1rem;
}
.pub-site .fc-format-btn {
  appearance: none;
  border: 2px solid var(--pub-border-strong);
  border-radius: var(--pub-radius-md);
  background: var(--pub-surface);
  color: var(--pub-text);
  font: inherit;
  font-weight: 800;
  font-size: 1.0625rem;
  min-height: 44px;
  padding: .6rem 1.6rem;
  cursor: pointer;
  transition: background var(--pub-dur-fast) var(--pub-ease), border-color var(--pub-dur-fast) var(--pub-ease), color var(--pub-dur-fast) var(--pub-ease);
}
.pub-site .fc-format-btn:hover:not(:disabled) { border-color: var(--pub-accent); }
.pub-site .fc-format-btn:focus-visible { outline: none; box-shadow: var(--pub-ring); }
.pub-site .fc-format-btn.is-active {
  background: var(--pub-accent);
  border-color: var(--pub-accent);
  color: #fff;
}
.pub-site .fc-format-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ---- Quality row (hidden entirely for PNG output) ---- */
.pub-site .fc-quality-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.pub-site .fc-quality-row[hidden] { display: none; }
.pub-site .fc-label {
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--pub-text-muted);
}
.pub-site .fc-select {
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  min-height: 40px;
  padding: .4rem .7rem;
  border: 1px solid var(--pub-border-strong);
  border-radius: var(--pub-radius-md);
  background: var(--pub-surface);
  color: var(--pub-text);
}
.pub-site .fc-select:focus-visible { outline: none; box-shadow: var(--pub-ring); border-color: var(--pub-accent); }

/* ---- Transparency warning + background color picker ---- */
.pub-site .fc-bg-warning {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: 0 0 .85rem;
  padding: .7rem .9rem;
  border: 1px solid #F2D29C;
  border-left: 4px solid var(--pub-warning);
  border-radius: var(--pub-radius-md);
  background: #FFF7E8;
  color: var(--pub-text);
  font-size: .9375rem;
  line-height: 1.5;
}
.pub-site .fc-bg-warning[hidden] { display: none; }
.pub-site .fc-bg-warning svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--pub-warning); }
.pub-site .fc-bg-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .85rem;
}
.pub-site .fc-bg-row[hidden] { display: none; }
.pub-site .fc-bg-swatch {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--pub-border-strong);
  border-radius: var(--pub-radius-md);
  background: var(--pub-surface);
  cursor: pointer;
}
.pub-site .fc-bg-swatch:focus-visible { outline: none; box-shadow: var(--pub-ring); }

/* ---- Drop zone reused from ic-drop; just needs top margin here ---- */
.pub-site .fc-tool .ic-drop { margin-top: .25rem; }

/* ---- Progress ---- */
.pub-site .fc-progress { margin: .9rem 0 0; }
.pub-site .fc-progress[hidden] { display: none; }
.pub-site .fc-progress-label { margin: 0 0 .4rem; font-size: .875rem; font-weight: 700; color: var(--pub-text-secondary); }
.pub-site .fc-progress-track {
  height: 8px;
  border-radius: var(--pub-radius-pill);
  background: var(--pub-bg-soft);
  border: 1px solid var(--pub-border);
  overflow: hidden;
}
.pub-site .fc-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--pub-accent);
  transition: width .2s ease;
}

/* ---- Batch actions ---- */
.pub-site .fc-batch-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }
.pub-site .fc-batch-actions[hidden] { display: none; }

/* ---- Before / after compare ---- */
.pub-site .fc-compare {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 420px;
  margin: 0 0 1rem;
  border-radius: var(--pub-radius-md);
  overflow: hidden;
  border: 1px solid var(--pub-border);
  background: var(--pub-bg-soft);
  touch-action: none;
  user-select: none;
}
.pub-site .fc-compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.pub-site .fc-compare-after { clip-path: inset(0 0 0 50%); }
.pub-site .fc-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
}
.pub-site .fc-compare-handle::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -1px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--pub-border);
}
.pub-site .fc-compare-grip {
  position: relative;
  z-index: 1;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--pub-border);
  display: grid;
  place-items: center;
  color: var(--pub-text);
  box-shadow: var(--pub-shadow-sm);
}
.pub-site .fc-compare-handle:focus-visible .fc-compare-grip { outline: none; box-shadow: var(--pub-ring); }
.pub-site .fc-compare-tag {
  position: absolute;
  bottom: .6rem;
  padding: .2rem .55rem;
  border-radius: var(--pub-radius-pill);
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pub-site .fc-compare-tag-before { left: .6rem; }
.pub-site .fc-compare-tag-after { right: .6rem; }

/* ---- Decision note (e.g. transparency flattened) ---- */
.pub-site .fc-decision {
  margin: 0 0 1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--pub-border);
  border-left: 4px solid var(--pub-accent);
  border-radius: var(--pub-radius-md);
  background: var(--pub-accent-soft);
  color: var(--pub-text);
  font-size: .9375rem;
  line-height: 1.5;
}
.pub-site .fc-decision[data-tone="warn"] { border-left-color: var(--pub-warning); background: #FFF7E8; }

@media (max-width: 640px) {
  .pub-site .fc-format-btn { flex: 1 1 calc(33% - .4rem); text-align: center; padding: .6rem .5rem; }
  .pub-site .fc-quality-row { flex-direction: column; align-items: flex-start; }
  .pub-site .fc-select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pub-site .fc-format-btn,
  .pub-site .fc-progress-bar { transition: none; }
}
