/* Photo to foam tracer. Linked only on /free-tools/photo-to-foam-tracer/. */

/* .field-row sets display:grid, which beats the hidden attribute. */
.ft-app [hidden] { display: none !important; }

.ft-nojs ol { color: var(--steel-300); padding-left: 1.2rem; display: grid; gap: 0.4rem; }

.ft-controls { display: grid; gap: 1rem; min-width: 0; }
.ft-stage-col { display: grid; gap: 1rem; min-width: 0; }

fieldset.ft-step { margin: 0; min-width: 0; }
fieldset.ft-step[disabled] { opacity: 0.5; }
.ft-step h2, .ft-step legend {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1.05rem; font-weight: 700; margin: 0 0 0.75rem; padding: 0; color: var(--paper);
}
.ft-step legend { float: left; width: 100%; }
.ft-step legend + * { clear: both; }
.ft-num {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--signal); color: var(--ink-950);
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
}
.ft-help { font-size: 0.88rem; color: var(--steel-400); margin: 0 0 0.75rem; }
.ft-first-actions { margin-top: 0; }
.ft-file { cursor: pointer; position: relative; }
.ft-file:focus-within { outline: 2px solid var(--signal); outline-offset: 2px; }

.ft-step input[type="range"] { width: 100%; accent-color: var(--signal); }
.ft-step output { font-family: var(--font-mono); color: var(--signal); font-weight: 600; margin-left: 0.35rem; }
.ft-check { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.88rem; color: var(--steel-300); margin: 0.25rem 0 0; }
.ft-check input { accent-color: var(--signal); margin-top: 0.2rem; }

.ft-list td { vertical-align: middle; }
.ft-list td.num, .ft-list th.num { white-space: nowrap; }
.ft-list input[type="checkbox"] { accent-color: var(--signal); width: 1.05rem; height: 1.05rem; }
.ft-list input.ft-name { padding: 0.35rem 0.5rem; font-size: 0.85rem; width: calc(100% - 2rem); min-width: 6rem; }
.ft-badge {
  display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; margin-right: 0.5rem;
  border-radius: 50%; background: var(--ink-700); color: var(--signal);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; vertical-align: middle;
}

/* The stage. Before a photo the box holds a 4:3 space, so nothing jumps when
   the page loads; after a photo it takes the photo's own shape. */
.ft-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.ft-tab {
  font: inherit; font-size: 0.85rem; padding: 0.45rem 0.8rem; cursor: pointer;
  background: var(--ink-850); color: var(--steel-300);
  border: 1px solid var(--ink-600); border-radius: var(--r-sm);
}
.ft-tab[aria-pressed="true"] { background: var(--ink-700); color: var(--paper); border-color: var(--signal-700); }
.ft-tab:disabled { opacity: 0.45; cursor: not-allowed; }
.ft-tab:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.ft-canvas-wrap {
  position: relative;
  aspect-ratio: var(--ft-ar, 1.3333);
  width: 100%;
  max-width: min(100%, calc(72vh * var(--ft-ar, 1.3333)));
  margin: 0 auto;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ft-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ft-canvas:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.ft-canvas-wrap.is-traced .ft-canvas { touch-action: auto; cursor: default; }
.ft-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 1rem; color: var(--steel-400); font-size: 0.92rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(147, 167, 187, 0.06) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(147, 167, 187, 0.06) 23px 24px);
}
.ft-empty[hidden] { display: none; }
.ft-empty strong { color: var(--paper); }
.ft-status { min-height: 2.6em; margin: 0.75rem 0 0; font-size: 0.86rem; color: var(--steel-300); }

.ft-foam h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.ft-svg-wrap { min-height: 6rem; }
.ft-svg-wrap svg { display: block; width: 100%; height: auto; }
.ft-kv { margin-top: 1rem; }
.ft-kv dd.is-bad, .ft-kv dd.is-ok { font-family: var(--font-sans); }

@media (max-width: 40rem) {
  .ft-list th:nth-child(4), .ft-list td:nth-child(4) { padding-left: 0.4rem; padding-right: 0.4rem; }
  .ft-list input.ft-name { min-width: 4.5rem; }
}
