/* firmware.css: owned by the firmware feature. Feature-specific styles go here, not in style.css. */
/* The card rules are shared with the homepage (docs/css/firmware.css, a copy kept by tools/fm1_site.py).
   They use only theme variables: --bg, --panel, --panel-2, --ink, --muted, --line, --accent, --ok, --warn, --bad, --mono, --radius. */

/* cards, the Also popular list, the validated rows */
.fw-title a.mini { color: var(--muted); display: inline-flex; padding: 2px; border-radius: 6px; }
.fw-title a.mini:hover { color: var(--ink); background: var(--panel-2); }
.fw-title .by + a.mini { margin-left: 4px; }
.fw-section { font-size: 15px; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.fw-section .info { color: var(--muted); cursor: help; font-weight: 400; }
/* Compact cards: screen, name + octopus, two-line tagline, the two actions; the rest under More. */
.fw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); column-gap: 10px; row-gap: 0; }
.fw-cards > .fw-card { margin-bottom: 10px; }
/* a card's four parts (header, actions, tags, More) on the row's shared tracks (subgrid): every part
   starts at the same height across a row, so More lines up even when tags wrap to two lines */
.fw-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: transform .15s, box-shadow .15s;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
.fw-card > * { align-self: start; }
.fw-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.fw-card.current { border-color: hsl(var(--h) 70% 55%); box-shadow: 0 0 0 2px hsl(var(--h) 70% 55%); }
/* Header: the square LCD capture beside name and tagline. */
.fw-head { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding: 10px 10px 0; align-items: start; }
.fw-art { width: 90px; height: 90px; border-radius: 8px; overflow: hidden; background: #000; box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(0,0,0,.3); }
.fw-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fw-headtext { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fw-headtext .fw-tag { font-size: 12.5px; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fw-more .by { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.fw-more .by a { font-size: 12px; }
/* under the actions: the tags */
.fw-card > .fw-chips { padding: 0 10px; margin-top: 7px; }
.fw-card > .fw-chips:empty { margin: 0; }
.fw-more .fw-icons { margin-top: 6px; }
.fw-more .fw-stats { margin-top: 6px; }
.fw-more-facts p { margin: 8px 0 0; }
/* More: every release on one line, tagged validated / failed / untested */
.rel-list { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.rel-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 12px; padding: 2px 0; }
.rel-line .mono { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-tag { font-size: 10.5px; padding: 0 7px; border-radius: 999px; color: #fff; background: #8A9099; text-decoration: none; }
a.rel-tag { cursor: copy; }
a.rel-tag:hover { filter: brightness(1.15); box-shadow: 0 0 0 1px currentColor inset; }
.rel-tag.validated { background: var(--ok); }
.rel-tag.failed { background: var(--bad); }
.fw-title .grow { flex: 1; min-width: 0; }
.fw-title .rank { font: 700 12px var(--mono); color: var(--muted); align-self: center; }
.flag { font: 700 10px var(--mono); letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; color: #fff; }
.flag.on { background: var(--ok); }
.flag.up { background: var(--warn); }
.flag.new { background: var(--accent); }
.fw-title { display: flex; align-items: baseline; gap: 6px; }
.fw-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fw-title .by { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-tag { font-size: 13.5px; }
.fw-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.fw-chips span { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: hsl(var(--h) 60% 50% / .14); color: hsl(var(--h) 55% 45%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fw-chips span { color: hsl(var(--h) 80% 72%); } }
:root[data-theme="dark"] .fw-chips span { color: hsl(var(--h) 80% 72%); }
.fw-stats { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.fw-stats b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.fw-actions { display: flex; align-items: center; gap: 5px; padding: 8px 10px 0; }
.fw-actions:empty { padding: 0; }
.fw-actions .octo-wrap { flex: none; }
.fw-actions .octo { width: 24px; height: 24px; }
.fw-actions .btn, .fw-actions button { font-size: 12px; padding: 3px 8px; gap: 5px; white-space: nowrap; }
button.fw-inst, a.btn.fw-inst { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
button.fw-inst:disabled { color: var(--muted); border-color: var(--line); }
button.fw-validate.failed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }   /* newest version failed: retest */
.fw-lib { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); }
.fw-more { padding: 6px 10px 8px; margin-top: 2px; }
.fw-more summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.fw-more[open] { font-size: 13px; }
.fw-more p { margin: 8px 0; }
.dir, .val { margin-top: 22px; }
/* homepage: Official and Community each in a card box (fwSections boxed) */
.fw-group { margin-top: 14px; }
.fw-group h3 .info { text-transform: none; cursor: help; font-weight: 400; }
.fw-group .fw-card { background: var(--panel-2); }
.dir-list { list-style: none; margin: 0; padding: 0; columns: 2 460px; column-gap: 36px; font-size: 13px; }
.dir-list li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.dir-rank { color: var(--muted); font: 12px var(--mono); }
.dir-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-stats { color: var(--muted); font: 11.5px var(--mono); white-space: nowrap; }
.dir-list li a { font-weight: 600; text-decoration: none; }
.dir-list li a:hover { text-decoration: underline; }
.dir-desc { color: var(--muted); }
.dir-star { color: var(--accent); margin-left: 4px; font-size: 11px; }
.dir-tag { font-size: 10.5px; margin-left: 6px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
/* validation (orange octopus) */
.octo-wrap { display: inline-flex; align-items: center; cursor: help; }
.octo { width: 20px; height: 20px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.fw-title .octo-wrap { align-self: center; }
.val h3 { display: flex; align-items: center; gap: 8px; }
/* Validated: one line per firmware, the same columns on every line (subgrid):
   octopus | name + version | date | tagline | actions (right) */
.val-list { display: grid; grid-template-columns: auto max-content max-content minmax(0, 1fr) max-content max-content max-content; column-gap: 14px; }
.val-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.val-row:last-child { border-bottom: 0; }
.val-name .mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.val-date { font-family: var(--mono); font-size: 12px; }
.val-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-new { font: 700 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); }
.val-new { justify-self: end; font-size: 12.5px; white-space: nowrap; }
.val-new .mono { font-family: var(--mono); }
.val-act { justify-self: end; }
.val-act .btn, .val-act button { font-size: 12.5px; padding: 3px 9px; white-space: nowrap; }
@media (max-width: 760px) {
  .val-list { grid-template-columns: auto minmax(0, 1fr) max-content max-content; }
  .val-row { grid-template-columns: subgrid; }
  .val-date, .val-desc, .val-new { display: none; }
}
.val-steps { color: var(--ok); font-size: 12px; }
.val details { margin-top: 10px; }
@media (max-width: 640px) { .dir-list li { white-space: normal; } .fw-cards { grid-template-columns: 1fr; } }

/* Neutral stand-in screen for cards built from GitHub metadata (never a fetched screenshot). */
.fw-art.ph { display: grid; place-items: center; background:
  repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 4px), #111; }
.fw-art.ph span { font: 700 11px var(--mono); letter-spacing: .08em; color: rgba(255,255,255,.38);
  text-align: center; padding: 0 6px; line-height: 1.3; word-break: break-word; }

/* "not curated yet" marker next to the author */
.fw-uncur { margin-left: 6px; font-size: 10.5px; padding: 0 6px; border-radius: 999px;
  border: 1px dashed var(--line); color: var(--muted); cursor: help; }

/* partial / cached data hints */
.fw-partial { font-size: 10.5px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--warn);
  color: var(--warn); cursor: help; }

/* greyed octopus: validated, but a newer stable release is out */
.octo-wrap.older { opacity: .5; filter: grayscale(1); }
/* outcome colours: orange = validated, purple = with issues, red = failed */
.octo-wrap.clean { --octo: #F07A2B; }
.octo-wrap.issues { --octo: #9B5DE5; }
.octo-wrap.failed { --octo: #E03C31; }
.val-newer { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.val-label { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid; }
.val-label.issues { color: #9B5DE5; }
.val-label.failed { color: #E03C31; }
.val-label.manual { color: var(--muted); }
.val-label.baseline { color: var(--muted); border-style: dashed; }
.val-steps.issues { color: #9B5DE5; }
.val-steps.failed { color: #E03C31; }
.val-note { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val-legend { display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; font-size: 12px; }
.val-legend .octo { width: 15px; height: 15px; }
.val-legend .octo-wrap + .octo-wrap, .val-legend .octo-wrap { margin-left: 8px; }
.val-legend .octo-wrap:first-child { margin-left: 0; }
.val-legend .trait.stock { margin-left: 8px; }
.val-legend .trait.stock svg { width: 16px; height: 16px; }
.dir-main .octo-wrap { margin-left: 5px; vertical-align: -3px; }
.dir-main .octo { width: 15px; height: 15px; }

/* card traits: egg open/closed source, green checksum, blue first-aid revert; grey = no or unknown */
.fw-headtext .by { display: flex; align-items: center; gap: 6px; }
.fw-headtext .by .by-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fw-tools { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.fw-tools a.mini { color: var(--muted); display: inline-flex; padding: 1px; border-radius: 6px; }
.fw-tools a.mini:hover { color: var(--ink); background: var(--panel-2); }
.fw-tools a.mini .ic { width: 16px; height: 16px; }
.fw-traits { display: inline-flex; gap: 3px; flex: none; }
/* top line: name left, octopus alone on the right */
.fw-title { min-height: 24px; }
.fw-title .octo { width: 24px; height: 24px; }
.trait { display: inline-flex; cursor: help; }
.trait svg { width: 17px; height: 17px; display: block; }
.trait .shell { fill: #F1E6CC; stroke: #A8916A; stroke-width: 1; stroke-linejoin: round; }
.trait .yolk { fill: #F2B705; }
.trait.sum .bg { fill: #2FB36A; }
.trait.sum .fg { stroke: #fff; }
/* stock seal (#19): a validation tested against a stock version other than the V15 baseline */
.trait.stock .bg { fill: #2F6FB0; }
.trait.stock .ring { fill: none; stroke: #CFE2F6; stroke-width: .8; opacity: .75; }
/* pink V15: tested on the old baseline, not rebased on V16 yet */
.trait.stock.legacy .bg { fill: #D6457F; }
.trait.stock.legacy .ring { stroke: #F9D2E2; }
.trait .fg-text { fill: #fff; font: 800 7.4px system-ui, sans-serif; letter-spacing: -.2px; }
.val-row .trait.stock svg { width: 16px; height: 16px; }
/* all card icons in one row under the buttons, groups split by a thin rule */
.fw-icons { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 6px 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.fw-icons > * + * { padding-left: 7px; border-left: 1px solid var(--line); }
/* the stock seal (V16 / V15) sits at the right edge */
.fw-icons > .trait.stock { margin-left: auto; padding-left: 0; border-left: 0; }
.trait.off .bg { fill: #8A9099; }
.trait.off { opacity: .4; }
.fw-legend-row { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 -6px; }
.legend-sep { width: 1px; height: 14px; background: var(--line); }
.trait-legend { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; }
.trait-legend .trait svg { width: 15px; height: 15px; }
.trait-legend .trait:not(:first-child), .trait-off-note { margin-left: 8px; }

/* Install button and dialog (fm1flash.js): Validated firmware list in the app and on the homepage */
.fw-install-btn { font-size: 12.5px; padding: 3px 10px; white-space: nowrap; }
a.btn.fw-install-btn { padding: 3px 10px; }
.fw-flash { width: min(520px, calc(100vw - 32px)); padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius, 10px);
  background: var(--panel); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.35); font-size: 14px; line-height: 1.45; }
.fw-flash::backdrop { background: rgba(0,0,0,.45); }
.fw-flash h3 { margin: 0 0 6px; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.fw-flash .muted { color: var(--muted); }
.fw-flash p { margin: 6px 0; }
.fw-i-notes { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.fw-i-notes li.warn { color: var(--warn); }
.fw-i-notes li.warn.strong { font-weight: 600; }
.fw-i-route ol { margin: 6px 0; padding-left: 22px; font-size: 13.5px; }
.fw-i-route li.active { font-weight: 600; }
.fw-i-route li.done { color: var(--ok); }
.fw-i-route li.done::after { content: " ✓"; }
.fw-i-route li.skipped { color: var(--muted); text-decoration: line-through; }
.fw-i-file { font-size: 13px; }
.fw-i-file.ok, .fw-i-msg.ok { color: var(--ok); }
.fw-i-file.bad, .fw-i-msg.bad { color: var(--bad); }
.fw-i-msg.warn, .fw-i-file.warn { color: var(--warn); }
.fw-i-pick { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; font-size: 13px; }
.fw-i-steps { margin: 10px 0 6px; padding-left: 22px; font-size: 13px; color: var(--muted); }
.fw-i-steps li.active { color: var(--ink); font-weight: 600; }
.fw-i-steps li.done { color: var(--ok); }
.fw-i-steps li.done::after { content: " ✓"; }
.fw-flash progress { width: 100%; height: 8px; accent-color: var(--accent); }
.fw-i-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.fw-flash button { font: inherit; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; }
.fw-flash button.ghost { background: none; }
.fw-flash button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.fw-flash button:disabled { opacity: .5; cursor: default; }
/* Validate (app only) */
.fw-val textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.fw-v-steps { margin: 10px 0; padding-left: 22px; font-size: 13.5px; }
.fw-v-steps li { margin: 6px 0; }
.fw-v-steps li > label { margin-right: 10px; }
.fw-v-steps li button { padding: 3px 10px; font-size: 12.5px; }
.fw-v-result { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0 4px; font-size: 13.5px; }
.fw-v-res { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fw-v-res .octo-wrap svg { width: 18px; height: 18px; }
.fw-i-actions .grow { flex: 1; }
