/* Public pages (home gallery + info placeholders). Chrome partial:
   app/views/shared/_site_header.html.erb. Tokens only — no literals. */

/* ── Page archetype ──────────────────────────────────────────────────────── */

.br-public {
  margin: 0;
  background: var(--nv-bg);
  color: var(--nv-text);
}

.br-public .br-sheet {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* ── Top bar: wordmark + account actions ─────────────────────────────────── */

.br-topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: 1rem;
}

.br-topbar-logo img {
  width: 108px;
  display: block;
}

.br-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── Main nav — its own row: always visible, always one line ─────────────── */

.br-mainnav {
  display: flex;
  gap: 1.75rem;
  padding: 0.2rem 0.1rem 0.85rem;
  overflow-x: auto;
}

.br-mainnav a,
.br-subnav a {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nv-muted);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.br-mainnav a:hover,
.br-subnav a:hover {
  color: var(--nv-text);
}

.br-mainnav a.active,
.br-subnav a.active {
  color: var(--nv-text);
  border-bottom-color: var(--br-turquoise);
}

/* Row 2 is the same on every page: the devices on the left, the pages about
   briora on the right. */
.br-mainnav-site {
  margin-left: auto;
  display: flex;
  gap: 1.75rem;
}

/* Row 3, where there is a context: a board with its sections, or the
   sections of the admin area. Under the ink rule, in the links' own style. */
.br-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.75rem;
  padding: 0.85rem 0.1rem 0.75rem;
  border-bottom: 1px solid var(--nv-border);
}

/* The board the row belongs to: ink, not a link (a button when there is
   another board to change to). */
.br-subnav-board,
.br-subnav-board > button {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nv-text);
  white-space: nowrap;
}

.br-subnav-board > button {
  padding: 0;
  border: 0;
  background: none;
}

.br-subnav .dropdown-item {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--nv-text);
  padding-bottom: 0.25rem;
  border-bottom: 0;
}

/* The account in row 1 (a label that leads to the profile). */
.br-topbar-actions .nv-account {
  text-decoration: none;
}

/* Pages with wide tables (the admin area): a wider column, header included. */
.br-public .br-sheet--wide {
  max-width: 1400px;
}

/* A page that brings a Bootstrap container (the admin pages) sits in the
   page column like every other: no second width, no second gutter. */
.br-sheet .container {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* The page column's content begins under the header, with air above it. */
.br-sheet > main {
  display: block;
  padding-top: 2rem;
}

/* A page that opens with a hero or a prose column brings its own air. */
.br-sheet > main > .br-hero:first-child,
.br-sheet > main > .br-page:first-child {
  padding-top: 1rem;
}

/* ── Hero — pitch on the left, the briora girl on the right ──────────────── */

.br-hero {
  display: flex;
  align-items: center;
  gap: 3rem;
  padding: 3rem 0 2.5rem;
}

.br-hero-copy {
  flex: 1;
  max-width: 620px;
}

.br-hero h1 {
  font-size: 40px;
  letter-spacing: -0.015em;
  margin: 0 0 0.9rem;
  line-height: 1.15;
}

.br-hero p {
  font-size: 16px;
  color: var(--nv-muted);
  margin: 0;
  line-height: 1.65;
}

/* Private-beta chip */
.br-beta {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--br-agent);
  border: 1px dashed var(--br-agent);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  margin-bottom: 1.25rem;
}

/* The girl: identical artwork in both themes — dark swaps to a variant with
   white-filled interiors and a white rim (no CSS filter). */
.br-girl {
  width: 528px;
  max-width: 55%;
  flex-shrink: 0;
}

.br-girl-dark { display: none; }
[data-bs-theme="dark"] .br-girl-light { display: none; }
[data-bs-theme="dark"] .br-girl-dark { display: block; }

@media (max-width: 780px) {
  .br-girl { display: none !important; }
}

/* Several paragraphs of pitch (the root page). */
.br-hero p + p {
  margin-top: 0.9rem;
}

/* ── The switch of the root page: connect a device over USB ─────────────── */

.br-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2.5rem;
  border: 1px solid var(--nv-text);
  border-radius: var(--bs-border-radius);
}

.br-switch h2 {
  font-size: 20px;
  margin: 0 0 0.35rem;
}

.br-switch p {
  font-size: 14px;
  color: var(--nv-muted);
  margin: 0;
  max-width: 520px;
}

.br-switch-action {
  flex: none;
  text-align: right;
}

/* The firmware block of a board's page: the card of /hardware on the right. */
.br-firmware .br-hw-firmware {
  max-width: 340px;
  text-align: left;
  align-items: flex-start;
}

/* Everything in it starts at the left edge: the button, the notes, the
   Windows hint. */
.br-firmware .br-hw-dfu,
.br-firmware .br-hw-esp {
  align-items: flex-start;
}

@media (max-width: 780px) {
  .br-switch {
    flex-direction: column;
    align-items: flex-start;
  }

  .br-switch-action { text-align: left; }
}

/* ── The supported devices as small tiles, each leading to its landing page ─ */

.br-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.br-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.75rem;
  text-align: center;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
}

.br-tile:hover {
  border-color: var(--nv-text);
}

.br-tile h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0.6rem 0 0.25rem;
}

.br-tile p {
  font-size: 12px;
  line-height: 1.4;
  color: var(--nv-muted);
  margin: 0;
}

.br-counter {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0.25rem;
  border-top: 1px solid var(--nv-text);
}

/* ── Onboarding steps — vertical spec-sheet timeline. Active steps carry ink
     numerals and CTAs; future steps (.br-step-soon) are dashed and faint. ── */

.br-steps {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.br-steps li {
  display: flex;
  gap: 2rem;
  padding: 0 0.25rem;
}

.br-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.2rem;
  flex-shrink: 0;
}

.br-step-num {
  font-family: var(--nv-mono);
  font-size: 24px;
  line-height: 1;
  color: var(--nv-text);
  padding: 1.6rem 0 0.6rem;
}

.br-step-line {
  flex: 1;
  border-left: 1px dashed var(--br-faint);
}

.br-steps li:last-child .br-step-line { display: none; }

.br-step-entry {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 0 1.9rem;
  border-bottom: 1px solid var(--nv-border);
}

.br-steps li:last-child .br-step-entry { border-bottom: 0; }

.br-step-body {
  flex: 1;
  min-width: 0;
}

.br-step-body h2 {
  font-size: 18px;
  margin: 0 0 0.35rem;
}

.br-step-body p {
  font-size: 14px;
  color: var(--nv-muted);
  margin: 0;
  max-width: 560px;
  line-height: 1.6;
}

.br-step-entry .btn { flex-shrink: 0; }

.br-step-soon .br-step-num,
.br-step-soon .br-step-body h2,
.br-step-soon .br-step-body p {
  color: var(--br-faint);
}

.br-step-tag {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--br-faint);
  border: 1px dashed var(--br-faint);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
}

@media (max-width: 640px) {
  .br-step-entry {
    flex-wrap: wrap;
    gap: 0.9rem 1.5rem;
  }
}

/* ── Info-page placeholder body ──────────────────────────────────────────── */

.br-page {
  padding: 3rem 0;
  max-width: 640px;
}

.br-page h1 {
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

/* ── Background page diagrams ────────────────────────────────────────────── */
/* Rebuilt from the three briora_overview slides. Tokens only, so the fills
   and the text on them resolve in both themes (see --br-on-* in briora-theme). */

.br-dg {
  margin: 1.25rem 0 2rem;
  max-width: 640px;
}

.br-dg-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.br-dg-sub {
  font-family: var(--nv-mono);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 5px;
  opacity: 0.85;
}

.br-dg-cell {
  display: grid;
  place-items: center;
  border: 1px solid var(--br-hairline);
  background: var(--br-paper);
  color: var(--br-muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  padding: 9px 4px;
}

.br-dg-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.br-dg-group-head {
  border: 1px solid var(--br-hairline);
  background: var(--br-tint-plum);
  color: var(--br-ink);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  padding: 10px 6px;
}

/* 1 · Use cases */

.br-dg-uses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 14px;
}

.br-dg-use {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.br-dg-use-icon {
  width: 100%;
  max-width: 116px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--br-tint);
  border: 1px solid var(--br-hairline);
  border-radius: var(--bs-border-radius-lg);
  color: var(--br-agent);
  font-size: 42px;
}

.br-dg-use-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

/* 2 · Firmware stack */

.br-dg-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.br-dg-layer {
  padding: 16px 20px;
  text-align: center;
}

.br-dg-layer-cli  { background: var(--br-turquoise); color: var(--br-on-turquoise); }
.br-dg-layer-vm   { background: var(--br-bluegray);  color: var(--br-on-turquoise); }
.br-dg-layer-plum { background: var(--br-plum);      color: var(--br-on-plum); }

.br-dg-hw {
  display: grid;
  grid-template-columns: 4fr 2fr 4fr;
  gap: 3px;
  margin-top: 10px;
}

.br-dg-cells {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
}

/* 3 · IDE and agent */

.br-dg-ide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto 30px auto;
  grid-template-areas:
    "ed ch ch"
    "ed m1 m2"
    ".  l1 l2"
    "dv tc kb";
  gap: 6px;
}

.br-dg-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 14px;
  text-align: center;
}

.br-dg-ide-editor { grid-area: ed; background: var(--br-turquoise); color: var(--br-on-turquoise); }
.br-dg-ide-chat   { grid-area: ch; background: var(--br-bluegray);  color: var(--br-on-turquoise); }
.br-dg-ide-tools  { background: var(--br-plum); color: var(--br-on-plum); padding-block: 20px; }
.br-dg-ide-tools-toolchain { grid-area: m1; }
.br-dg-ide-tools-kb        { grid-area: m2; }

.br-dg-ide-device {
  grid-area: dv;
  justify-content: flex-start;
  padding: 14px 12px 12px;
  background: var(--br-plum);
  color: var(--br-on-plum);
}

.br-dg-ide-cli {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  align-self: flex-end;
  padding-top: 22px;
}

.br-dg-chip {
  background: var(--br-turquoise);
  color: var(--br-on-turquoise);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 8px;
}

.br-dg-arrow {
  font-size: 16px;
  line-height: 1;
  color: var(--br-turquoise);
}

.br-dg-link { position: relative; }
.br-dg-link-toolchain { grid-area: l1; }
.br-dg-link-kb        { grid-area: l2; }

.br-dg-link::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 7px;
  border-left: 2px solid var(--br-bluegray);
  transform: translateX(-1px);
}

.br-dg-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--br-bluegray);
}

.br-dg-ide-toolchain { grid-area: tc; }
.br-dg-ide-kb        { grid-area: kb; }

.br-dg-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.br-dg-tiles .br-dg-cell { min-height: 46px; }

@media (max-width: 520px) {
  .br-dg-uses { grid-template-columns: repeat(2, 1fr); }
  .br-dg-hw { grid-template-columns: 1fr; }

  .br-dg-ide {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 30px auto auto;
    grid-template-areas:
      "ed ed"
      "ch ch"
      "m1 m2"
      "l1 l2"
      "tc kb"
      "dv dv";
  }

  .br-dg-ide-editor { padding-block: 22px; }

  .br-dg-ide-device {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .br-dg-ide-cli { margin-top: 0; padding-top: 0; }
}

/* ── Hardware page (board list + browser flasher) ────────────────────────── */

.br-hw-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.br-hw-board {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px dashed var(--br-faint);
}

.br-hw-name {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}

.br-hw-info .br-label {
  margin-right: 0.75rem;
}

.br-hw-purchase {
  color: var(--br-bluegray);
}

.br-hw-firmware {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  text-align: right;
  flex-shrink: 0;
}

.br-hw-badge {
  font-size: 13px;
  color: var(--br-muted);
  border: 1px dashed var(--br-faint);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  white-space: nowrap;
}

.br-hw-download {
  font-size: 14px;
  color: var(--br-bluegray);
}

/* STM32 WebUSB DFU flasher (dfu-flash controller) */
.br-hw-dfu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.br-hw-dfu-progress {
  width: 10rem;
  height: 0.5rem;
}

.br-hw-dfu-status {
  font-size: 13px;
  max-width: 22rem;
}

.br-hw-dfu-note {
  font-size: 13px;
  max-width: 22rem;
  text-align: left;
}

.br-hw-win-hint {
  font-size: 13px;
  max-width: 22rem;
  color: var(--br-bluegray);
}

.br-hw-win-hint summary {
  cursor: pointer;
}

.br-hw-win-hint[open] {
  text-align: left;
}

@media (max-width: 576px) {
  .br-hw-board {
    flex-direction: column;
  }
  .br-hw-firmware {
    align-items: flex-start;
    text-align: left;
  }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.br-public-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--br-faint);
}

.br-public-footer a {
  color: inherit;
}

/* The round Swiss-cross badge next to the copyright line. */
.br-swiss-badge {
  height: 0.875rem;
  width: auto;
  vertical-align: -0.1875rem;
  margin-left: 0.25rem;
}

/* ── Info of a board: two columns, two rows — the board and the ways on,
   under them its firmware and the console ─────────────────────────────── */

.br-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem 2.5rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.br-info {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.br-info-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  font-size: 14px;
  margin: 1rem 0 0;
}

.br-info-facts dt {
  font-weight: 400;
  color: var(--nv-muted);
}

.br-info-facts dd {
  margin: 0;
}

/* The ways on from here: a link, and what waits behind it. */
.br-info-entry h2,
.br-console h2 {
  font-size: 20px;
  margin: 0 0 0.6rem;
}

.br-info-entry dl {
  margin: 0;
}

.br-info-entry dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.9rem;
}

.br-info-entry dd {
  margin: 0.1rem 0 0;
  font-size: 14px;
  color: var(--nv-muted);
}

/* In half the width the firmware block stands upright. */
.br-info-firmware .br-switch {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  height: 100%;
  margin-bottom: 0;
}

/* The firmware box and the console box stand side by side: same top, same
   height. */
.br-info-firmware,
.br-info-grid > .br-console {
  align-self: stretch;
}

.br-info-firmware .br-switch-action,
.br-info-firmware .br-hw-firmware {
  text-align: left;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .br-info-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The console: a window with what the board answered and, at its bottom,
   the line a command is entered in. */
.br-console-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem 0.6rem;
}

.br-console-head h2 { margin: 0; }

.br-console {
  display: flex;
  margin-bottom: 0;
}

.br-console-window {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 22rem;
  border: 1px solid var(--nv-text);
  border-radius: var(--bs-border-radius);
}

.br-console-output {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.3rem 1.75rem 0.6rem;
  font-family: var(--bs-font-monospace);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.br-console-hint {
  margin: 0;
  padding: 0 1.75rem 0.5rem;
  font-size: 13px;
  color: var(--nv-muted);
}

.br-console-bar {
  flex: none;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  border-top: 1px solid var(--nv-text);
}

.br-console-command { color: var(--nv-muted); }
.br-console-error { color: var(--bs-danger); }

/* No board connected: the console is there to be seen, not to be used. */
.br-console.is-off .br-console-bar,
.br-console.is-off .br-console-output {
  opacity: 0.45;
}

/* The connected board runs an older firmware than this page installs. */
.br-console-update {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  flex: none;
  padding: 0.75rem 1.75rem;
  background: var(--bs-danger);
  color: #fff;
  font-size: 14px;
}

.br-console-update[hidden] { display: none; }
.br-console-update .btn { margin-left: auto; }
