/* R53 shift light flasher. Dark only, the same three-step layout as the Touge
   flasher, in the product page's colours and type
   (ryansdesigns.geekopolis.com/shiftlight). */

:root {
  --bg: #0B1811;
  --bg-deep: #060d09;
  --panel: #132A1F;
  --ink: #08110C;
  --text: #EEF3EC;
  --text-muted: #8CA497;
  --surface: rgba(19, 42, 31, 0.72);
  --surface-solid: #10241a;
  --surface-raised: rgba(238, 243, 236, 0.06);
  --border: rgba(238, 243, 236, 0.1);
  --border-strong: rgba(238, 243, 236, 0.2);
  --accent: #FFB000;
  --accent-hover: #ffc233;
  --accent-soft: rgba(255, 176, 0, 0.14);
  --on-accent: #08110C;
  --green: #2BF06A;
  --danger: #ff5c5c;
  --danger-soft: rgba(255, 46, 46, 0.14);
  --ok: #2BF06A;
  --ok-soft: rgba(43, 240, 106, 0.12);
  --warn: #FFB000;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 45% at 15% -10%, rgba(43, 240, 106, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(255, 176, 0, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-deep) 75%);
  background-color: var(--bg-deep);
  background-attachment: fixed;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

code { font-family: var(--mono); font-size: 0.9em; }

.banner {
  padding: 10px 16px;
  text-align: center;
  font-size: 15px;
}
.banner[hidden] { display: none; }
.banner-warn { background: var(--warn); color: var(--ink); }
.banner-danger { background: #FF2E2E; color: #1a0000; }

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ---- header ---- */

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 28px;
}
.mark { width: 56px; height: 56px; flex: none; }
.header h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.header .subtitle { margin: 6px 0 0; color: var(--text-muted); }

/* ---- the three steps ---- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 820px) {
  .steps { grid-template-columns: 1fr; }
}

.step {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.step.ready {
  border-color: rgba(255, 176, 0, 0.4);
  box-shadow: 0 0 24px rgba(255, 176, 0, 0.06);
}
.step-head { display: flex; align-items: center; gap: 12px; }
.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text-muted);
}
.step.ready .step-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.step-body { flex: 1; color: var(--text-muted); font-size: 15px; }
.step-body p { margin: 0 0 10px; }
.step-body strong { color: var(--text); }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- buttons ---- */

button { font: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(238, 243, 236, 0.05);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) { background: rgba(238, 243, 236, 0.1); border-color: rgba(238, 243, 236, 0.3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn[hidden] { display: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: #FF2E2E; border-color: #FF2E2E; color: #1a0000; }
.btn-danger:hover:not(:disabled) { background: #ff5c5c; border-color: #ff5c5c; }
.btn-wide { flex: 1; }
.btn-big { min-height: 56px; font-size: 18px; width: 100%; }
.btn-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
}

/* ---- board summary in step 1 ---- */

.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.picked[hidden] { display: none; }
.picked svg { width: 56px; height: auto; flex: none; }
.picked .name { color: var(--text); font-weight: 600; }
.picked .how { font-size: 13px; }

.chip-line { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); word-break: break-word; }

.select {
  width: 100%;
  min-height: 44px;
  margin: 4px 0 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}

.note { font-size: 14px; color: var(--text-muted); }
.note-bad { color: var(--danger); }
.note[hidden] { display: none; }

/* ---- info cards below the steps ---- */

.info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}
@media (max-width: 820px) {
  .info { grid-template-columns: 1fr; }
}
.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.card h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.card p, .card li { color: var(--text-muted); font-size: 15px; }
.card p { margin: 0 0 10px; }
.card ul, .card ol { margin: 0; padding-left: 20px; }
.card li + li { margin-top: 6px; }
.card strong { color: var(--text); }

.footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.footer p { margin: 0 0 8px; }

/* ---- modals ---- */

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #16301f, #0d1c14);
  color: var(--text);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(238, 243, 236, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}
.modal-body { padding: 20px; overflow-y: auto; }

/* board picker */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.device-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(238, 243, 236, 0.03);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.device-card:hover {
  border-color: rgba(255, 176, 0, 0.55);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 176, 0, 0.08);
  transform: translateY(-2px);
}
.device-card svg { width: 110px; height: auto; }
.device-card .name { font-weight: 600; font-size: 17px; }
.device-card .module { font-size: 14px; color: var(--text); }
.device-card .spec { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.device-card .blurb { font-size: 13px; color: var(--text-muted); }

/* flash dialog */
.flash-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}
.flash-summary svg { width: 52px; height: auto; flex: none; }
.flash-summary strong { color: var(--text); }

.choices { display: grid; gap: 12px; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(238, 243, 236, 0.03);
  cursor: pointer;
}
.choice input { margin-top: 5px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.choice .title { display: block; font-weight: 600; }
.choice .desc { display: block; font-size: 14px; color: var(--text-muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-danger .title { color: var(--danger); }
.choice-danger:has(input:checked) { border-color: #FF2E2E; background: var(--danger-soft); }
.choice-off { opacity: 0.55; cursor: not-allowed; }

.flash-go { margin-top: 16px; }

.progress-wrap { margin-top: 18px; }
.progress-wrap[hidden] { display: none; }
.progress-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(238, 243, 236, 0.08);
  overflow: hidden;
}
/* Green to amber to red, like the strip. */
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--accent) 70%, #FF2E2E);
  transition: width 0.2s;
}
.progress.indeterminate .progress-bar {
  width: 30%;
  background: var(--accent);
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}

.result {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
}
.result[hidden] { display: none; }
.result-ok { background: var(--ok-soft); color: var(--ok); }
.result-bad { background: var(--danger-soft); color: var(--danger); }
.result code { color: var(--text); }

details.log { margin-top: 16px; }
details.log summary { cursor: pointer; color: var(--text-muted); font-size: 14px; }
.log pre {
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #040806;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  color: #c7d3cb;
}

@media (max-width: 520px) {
  .page { padding-top: 16px; }
  .mark { width: 44px; height: 44px; }
  .modal-body { padding: 16px; }
}
