/*! tool.css v2 — compressor card, state machine, credits UI, checkout sheet. */

/* Card overlaps the hero's lower edge. */
.compressor {
  position: relative;
  z-index: 2;
  margin-top: -56px;
  padding: 28px var(--space-xxl) 32px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.compressor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.compressor-head h2 { font-size: 22px; line-height: 1.15; letter-spacing: -0.01em; }
.compressor-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.compressor-body { margin-top: 20px; }

/* Stepper */
.steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.steps li + li::before {
  content: "";
  width: 16px;
  height: 1px;
  margin-inline: 2px 8px;
  background: var(--hairline);
}
.step-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.steps li.is-done .step-num { background: var(--primary-tint); border-color: var(--primary-subdued); color: var(--primary-deep); }
.steps li.is-active { color: var(--ink); }
.steps li.is-active .step-num { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 152px;
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.dropzone:hover { border-color: var(--hairline-input); background: var(--canvas); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-tint); }
.dropzone.has-file { border-color: var(--primary-subdued); background: var(--primary-tint); }
.dropzone-icon { color: var(--primary); }
.dropzone-title { font-size: 16px; font-weight: 400; color: var(--ink); }
.dropzone-sub { font-size: 13px; color: var(--muted); }
.file-name { max-width: 100%; font-size: 15px; font-weight: 400; color: var(--ink); word-break: break-all; }
.file-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; font-feature-settings: "ss01", "tnum"; }
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.trust-row span { display: inline-flex; align-items: center; gap: 6px; }
.trust-row svg { color: var(--primary); flex: none; }

/* Fields */
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.field-row:has(#custom-wrap:not([hidden])) { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.field { display: grid; gap: 6px; }
.field > label,
.field-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-2);
}
.select,
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hairline-input);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  font-weight: 300;
}
.select:focus,
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.select:disabled,
.input:disabled { background: var(--canvas-soft); color: var(--muted); }

.budget {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--canvas-soft);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "ss01", "tnum";
}
.budget:empty { display: none; }

/* Actions */
.compressor .actions-row { margin-top: 20px; }
.helper { font-size: 12px; color: var(--muted); }
.helper.is-error { color: #a3271c; }
.helper a { color: var(--primary); }

/* Desktop: dropzone left, controls right, so the CTA stays above the fold. */
@media (min-width: 900px) {
  .compressor-body {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    column-gap: 28px;
    align-content: start;
  }
  .compressor-body > #drop { grid-column: 1; grid-row: 1; align-self: start; }
  .compressor-body > #file-input { grid-column: 1; grid-row: 2; }
  .compressor-body > #file-error { grid-column: 1; grid-row: 2; }
  .compressor-body > .trust-row { grid-column: 1; grid-row: 3; }
  .compressor-body > .field-row { grid-column: 2; grid-row: 1; margin-top: 0; align-self: start; }
  .compressor-body > .budget { grid-column: 2; grid-row: 2; }
  .compressor-body > .actions-row { grid-column: 2; grid-row: 3; margin-top: 12px; align-self: start; }
  .compressor-body > .progress { grid-column: 1 / -1; grid-row: 4; }
  .compressor-body > .result { grid-column: 1 / -1; grid-row: 4; }
  .compressor-body > .exhausted { grid-column: 1 / -1; grid-row: 5; }
}

.file-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #fdf1ef;
  border: 1px solid #f3d3ce;
  color: #8c2418;
  font-size: 13px;
}
.file-error[hidden] { display: none; }

/* Progress */
.progress { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.stage { font-size: 13px; color: var(--ink-2); min-height: 1.4em; }
.progress-pct { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; font-feature-settings: "ss01", "tnum"; }
.bar-track { height: 6px; border-radius: var(--radius-pill); background: var(--hairline); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: var(--radius-pill); background: var(--primary); transition: width 180ms linear; }
.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "ss01", "tnum";
}

/* Result */
.result { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.result-video {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  background: #000;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.result-stats > div {
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--canvas-soft);
}
.result-stats dt { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.result-stats dd {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 300;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "ss01", "tnum";
}
.result-stats dd.is-good { color: var(--primary-deep); }
.result-note { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.result .actions-row { margin-top: 16px; }

/* Exhausted paywall (neutral, never red) */
.exhausted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding: 20px 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas-soft);
}
.exhausted h3 { font-size: 17px; letter-spacing: -0.01em; }
.exhausted p { margin-top: 4px; font-size: 13px; color: var(--muted); }

.debug-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--hairline);
  font-size: 12px;
  color: var(--muted);
}

/* Checkout placeholder sheet */
.checkout-dialog {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
.checkout-dialog::backdrop { background: rgba(13, 37, 61, 0.42); }
.checkout-dialog h2 { font-size: 22px; letter-spacing: -0.01em; }
.checkout-dialog p { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.checkout-dialog .fine { margin-top: 16px; }
.checkout-dialog .actions-row { margin-top: 24px; }
.checkout-dialog .actions-row .btn { flex: 1; }

@media (max-width: 767px) {
  .compressor { margin-top: -40px; padding: 18px 18px 22px; }
  .compressor-head { flex-wrap: wrap; }
  .steps { margin-top: 14px; font-size: 12px; overflow: hidden; }
  .steps li { padding: 4px 6px; gap: 6px; }
  .steps li + li::before { width: 8px; margin-inline: 0 4px; }
  .dropzone { min-height: 128px; padding: 16px; }
  .compressor .actions-row { margin-top: 14px; }
  .field-row { grid-template-columns: 1fr; margin-top: 14px; }
  .result-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .result-stats > div { padding: 10px; }
  .result-stats dd { font-size: 17px; }
  .exhausted { flex-direction: column; align-items: flex-start; }
  .exhausted .btn { width: 100%; }
  .checkout-dialog { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
  .dropzone { transition: none; }
}
