/* flash.css: the Install a sensor screen (#/flash, views/flasher.js).
 *
 * A short step flow on the app's own ground: the step strip, big option
 * cards that are native radio buttons underneath, a progress bar with its
 * stages, and the cards for the states that replace the flow (no Web
 * Serial, no firmware yet). The bar's width is the one value the view sets
 * from script (node.style.width, which the CSP allows); everything else is
 * a class.
 *
 * What it refuses to do: draw a target under 44 px, signal a state by colour
 * alone (each stage and step also says it in text, for a screen reader too),
 * or animate for someone who asked for less motion.
 */

.flash-view .view-body { gap: 14px; }
.fl-slot { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ── The step strip ──────────────────────────────────────────────────── */
.fl-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px;
}
.fl-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  color: var(--ink-3); font: 600 calc(11.5 * var(--fs))/1.2 var(--head); letter-spacing: .02em; text-align: center;
}
.fl-step-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--glass); color: var(--ink-2);
  font: 700 13px/1 var(--head);
  transition: background 220ms var(--ease), border-color 220ms, color 220ms;
}
.fl-num .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.fl-step.now { color: var(--ink); }
.fl-step.now .fl-num { background: var(--fill-blue); border-color: rgba(41, 169, 242, .7); color: #fff; box-shadow: 0 6px 18px -8px rgba(1, 142, 220, .9); }
.fl-step.done { color: var(--ink-2); }
.fl-step.done .fl-num { background: rgba(52, 211, 153, .14); border-color: rgba(52, 211, 153, .45); color: #a7f3d0; }
.fl-step.skipped .fl-num { border-style: dashed; color: var(--ink-3); }
.fl-step.skipped .fl-step-name { text-decoration: line-through; }

/* ── A step's card ───────────────────────────────────────────────────── */
.fl-card { display: flex; flex-direction: column; gap: 14px; }
.fl-card > .card-sub { margin: 0; }
.fl-title { font-size: calc(18 * var(--fs)); outline: none; }
.fl-title:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 4px; border-radius: 6px; }
.fl-title-num {
  width: 26px; height: 26px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: rgba(1, 142, 220, .16); color: #cfe9fb; font: 700 13px/1 var(--head);
}
.fl-sub { margin: 4px 0 0; font: 700 calc(14.5 * var(--fs))/1.3 var(--head); }
.fl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* Side by side in a row; a column (.fl-actions-col) stretches them instead,
   where a flex-basis would become a height. */
.fl-actions:not(.fl-actions-col) .btn-lg { flex: 1 1 160px; }
.fl-actions-col { flex-direction: column; align-items: stretch; }
.fl-skel { height: 220px; border-radius: var(--radius); }

/* ── Option cards: a native radio inside each, so arrows and Space work ─ */
.fl-options { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .fl-options { grid-template-columns: 1fr 1fr; } }
.fl-option {
  position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: 76px; padding: 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: rgba(2, 6, 20, .35);
  cursor: pointer; text-align: left;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), transform 120ms var(--ease);
}
.fl-option:active { transform: scale(.985); }
.fl-option.on { border-color: rgba(41, 169, 242, .75); background: rgba(1, 142, 220, .14); box-shadow: inset 0 0 0 1px rgba(41, 169, 242, .35); }
.fl-option.off { cursor: not-allowed; opacity: .55; }
.fl-option.off:active { transform: none; }
.fl-option:focus-within { outline: 2px solid var(--blue-hi); outline-offset: 2px; }
/* The radio covers the card: the whole card is its target, and focus and
   screen readers land on a real control. */
.fl-radio { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.fl-option-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--glass-2); color: var(--blue-hi); }
.fl-option-icon .ico { width: 21px; height: 21px; }
.fl-option-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fl-option-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 700 calc(15.5 * var(--fs))/1.25 var(--head); color: var(--ink); }
.fl-option-body { font-size: calc(13.5 * var(--fs)); line-height: 1.45; color: var(--ink-2); }
.fl-option-note { color: var(--ink-3); }
.fl-badge { font-size: calc(11 * var(--fs)); }
.fl-option-tick {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: transparent;
  transition: background 180ms var(--ease), color 180ms, border-color 180ms;
}
.fl-option-tick .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.fl-option.on .fl-option-tick { background: var(--fill-blue); border-color: transparent; color: #fff; }

/* ── Fields ──────────────────────────────────────────────────────────── */
.fl-ring { padding: 12px; border-radius: var(--radius-sm); background: rgba(2, 6, 20, .3); border: 1px solid var(--line); }
.flash-view input[aria-invalid="true"] { border-color: rgba(248, 113, 113, .7); }
.fl-card .field-hint.bad { color: #fca5a5; }
.fl-checkrow { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 8px 0; cursor: pointer; font-size: calc(14.5 * var(--fs)); }
.fl-check { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--blue); }
.fl-check:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 3px; }

/* ── Install: the tips, the bar and its stages ───────────────────────── */
.fl-tips { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: calc(14 * var(--fs)); line-height: 1.5; color: var(--ink-2); }
.fl-dl { margin: 0; }
.fl-progress { padding: 2px 0; }
.fl-bar {
  flex: 1; height: 12px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
}
.fl-bar-fill {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #0a78bd, var(--blue-hi));
  box-shadow: 0 0 12px rgba(41, 169, 242, .55);
  transition: width 260ms var(--ease);
}
.fl-pct { min-width: 44px; text-align: right; font: 700 calc(14 * var(--fs))/1 var(--head); color: var(--ink); }
.fl-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fl-stage { display: flex; align-items: center; gap: 10px; font-size: calc(14 * var(--fs)); color: var(--ink-3); }
.fl-stage-dot {
  width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-2); color: transparent;
}
.fl-stage-dot .ico { width: 13px; height: 13px; stroke-width: 2.8; }
.fl-stage.now { color: var(--ink); font-weight: 600; }
.fl-stage.now .fl-stage-dot { border-color: var(--blue-hi); border-top-color: transparent; animation: spin .9s linear infinite; }
.fl-stage.done { color: var(--ink-2); }
.fl-stage.stopped { color: #fecaca; }
.fl-stage.stopped .fl-stage-dot { border-color: rgba(248, 113, 113, .6); border-style: dashed; }
.fl-stage.done .fl-stage-dot { background: rgba(52, 211, 153, .18); border-color: rgba(52, 211, 153, .55); color: #a7f3d0; }

.fl-result:empty { display: none; }
.fl-status { margin: 0; min-height: 1.4em; }
.fl-status:empty { display: none; }

/* ── Technical details: the library's own words, for when it goes wrong ─ */
.fl-details summary {
  min-height: 44px; display: flex; align-items: center; cursor: pointer;
  color: var(--ink-3); font: 600 calc(13 * var(--fs))/1.2 var(--head);
}
.fl-details summary:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; border-radius: 6px; }
.fl-log {
  margin: 4px 0 0; max-height: 220px; overflow: auto; padding: 10px 12px; border-radius: var(--radius-xs);
  background: rgba(2, 6, 20, .6); border: 1px solid var(--line);
  font-size: calc(12 * var(--fs)); line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.fl-log:empty::before { content: 'Nothing yet.'; color: var(--ink-3); }

/* ── A command or a setup string to copy ─────────────────────────────── */
.fl-code {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-xs);
  background: rgba(2, 6, 20, .6); border: 1px solid var(--line-2);
}
.fl-code code {
  flex: 1; min-width: 0; padding-top: 6px; font-size: calc(12.5 * var(--fs)); line-height: 1.55; color: #cfe9fb;
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.fl-url { margin: 0; padding: 10px 12px; border-radius: var(--radius-xs); background: rgba(2, 6, 20, .6); border: 1px solid var(--line); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.fl-state .card-title .ico { color: var(--blue-hi); }
.fl-fallback { padding-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .fl-num, .fl-option, .fl-option-tick, .fl-bar-fill { transition: none; }
  .fl-option:active { transform: none; }
  .fl-stage.now .fl-stage-dot { animation: none; border-top-color: var(--blue-hi); }
}
