/* LED display profiles — FR-BRD-04.
 *
 * Two stylesheets' worth of job in one file: the editor's chrome, and
 * the board itself. The board's rules are the ones that matter — they
 * are what `render.js` paints into, on this page and on a wall, so
 * every colour and size here comes from the profile rather than from a
 * declaration below.
 */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --bad: #b91c1c;
  --good: #0a7d32;
  --panel: #f8fafc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --panel: #111b2e;
  }
}

* { box-sizing: border-box; }

body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0 auto;
  max-width: 76rem;
  padding: 1.5rem 1rem 4rem;
}

h1 { font-size: 1.35rem; margin: 0 0 0.2rem; }
h2 { font-size: 1rem; margin: 0 0 0.6rem; }
h3 { font-size: 0.9rem; margin: 0 0 0.4rem; color: var(--muted); }
.lede, .note { color: var(--muted); font-size: 13px; }
.lede { margin-top: 0; max-width: 46rem; }
.note { margin: 0.4rem 0; }
code { font-size: 12px; }

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  align-items: start;
}

label { display: block; margin: 0.3rem 0; font-size: 12px; }
[hidden] { display: none !important; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.form {
  display: grid;
  gap: 0.3rem 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}
.form .wide { grid-column: 1 / -1; }

button {
  font: inherit;
  padding: 0.25rem 0.7rem;
  margin: 0.5rem 0.4rem 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }

.status { font-size: 13px; color: var(--muted); margin: 0.5rem 0 0; }
.status.bad { color: var(--bad); }

.problems { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.problems li {
  font-size: 12px;
  color: var(--bad);
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--line);
}
.problems li.ok { color: var(--good); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  font-size: 13px;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.list button { margin: 0 0 0 0.4rem; padding: 0.1rem 0.4rem; font-size: 12px; }

/* The stage keeps the board inside the column at any declared size; the
   board itself is scaled by the renderer so a 1920px wall previews at
   whatever fits. */
.stage {
  overflow: auto;
  padding: 4px;
  background: repeating-conic-gradient(var(--line) 0% 25%,
                                       transparent 0% 50%) 50% / 16px 16px;
  border-radius: 6px;
}

/* ---------- the board ---------- */

/* `render.js` sets width, height, background and colour from the
   profile. Nothing here may override them: a preview that imposed its
   own colours would be a preview of a different wall. */
.led-board {
  position: relative;
  overflow: hidden;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1;
}

.led-region {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.led-region[style*="text-align: left"] { align-items: flex-start; }
.led-region[style*="text-align: right"] { align-items: flex-end; }

.led-main { white-space: nowrap; }
/* Sized from the region's own font rather than fixed, so a caption
   stays in proportion on a wall of any pitch. */
.led-sub { font-size: 0.28em; font-weight: 600; letter-spacing: 0.08em; }

/* The staleness badge is drawn last and sits above everything, so a
   layout that fills the panel cannot hide it. A board that is wrong and
   silent is the failure this requirement is about. */
.led-stale {
  position: absolute;
  right: 1%;
  top: 1%;
  padding: 0.2em 0.5em;
  border-radius: 0.2em;
  background: #b91c1c;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.led-config-stale {
  position: absolute;
  left: 1%;
  top: 1%;
  padding: 0.2em 0.5em;
  border-radius: 0.2em;
  background: #92400e;
  color: #ffffff;
  letter-spacing: 0.06em;
}

/* The last resort: the fallback template failed too. One line, built by
   hand, with no profile involved — at that point the profile is the
   suspect. */
.led-dead {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #000000;
  color: #ffffff;
  font-size: 2rem;
  letter-spacing: 0.1em;
}

@media (prefers-reduced-motion: no-preference) {
  .led-board[data-transition="FADE"] .led-region { animation: fade .25s; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
