/* Projects index — datasheet sheet layout (hairline grid of project cells).
   Reuses the .br-public archetype + .br-counter chrome from home.css; this
   file owns the project grid. */

.br-proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--nv-border);
  border-left: 1px solid var(--nv-border);
}

@media (max-width: 860px) {
  .br-proj-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .br-proj-grid { grid-template-columns: 1fr; }
}

.br-proj-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 168px;
  text-decoration: none;
  color: var(--nv-text);
  border-right: 1px solid var(--nv-border);
  border-bottom: 1px solid var(--nv-border);
  transition: background 120ms;
}

/* The link carries the cell's layout so the whole card stays clickable;
   the action buttons sit on top of it (top-right corner). */
.br-proj-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.4rem 1.2rem;
  text-decoration: none;
  color: inherit;
}

.br-proj-actions {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: flex;
  gap: 0.35rem;
  opacity: 0;
  transition: opacity 120ms;
}

.br-proj-card:hover .br-proj-actions,
.br-proj-actions:focus-within {
  opacity: 1;
}

.br-proj-action {
  border: 1px solid var(--nv-border);
  background: var(--nv-bg);
  color: var(--nv-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  cursor: pointer;
}

.br-proj-action:hover {
  color: var(--nv-text);
  border-color: var(--nv-muted);
}

.br-proj-action-danger:hover {
  color: var(--bs-danger, #b02a37);
  border-color: var(--bs-danger, #b02a37);
}

.br-proj-card:hover {
  background: var(--br-tint);
  color: var(--nv-text);
}

.br-proj-card:hover .br-proj-name {
  color: var(--br-bluegray);
}

.br-proj-name {
  font-size: 17px;
  margin: 0.6rem 0 0.2rem;
}

.br-proj-board {
  align-self: flex-start;
  margin-top: 0.15rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nv-muted);
  border-bottom: 1px dashed var(--br-faint);
  padding-bottom: 2px;
}

.br-proj-updated {
  margin-top: auto;
  padding-top: 1.4rem;
  font-size: 12.5px;
  color: var(--br-faint);
}

/* Ghost cell that closes the grid. */
.br-proj-new {
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--nv-muted);
}

.br-proj-new .br-proj-plus {
  font-size: 26px;
  line-height: 1;
  color: var(--br-bluegray);
}

.br-proj-new:hover {
  color: var(--nv-text);
}

/* ── Device picture ──────────────────────────────────────────────────────── */
/* A board's SVG template and, laid exactly over its light display field, the
   frame sequence the simulator recorded for a program (a strip of --frames
   pictures side by side, played one after the other). The field is placed by
   the template's rectangle (--screen-*, BoardPreview), the size by --device-w
   where the picture is used (a list row, the hero of a landing page). */
.br-device {
  position: relative;
  flex: none;
  width: var(--device-w, 144px);
  aspect-ratio: 1;
}

.br-device-body {
  display: block;
  width: 100%;
  height: 100%;
}

/* One pixel larger than the field on every side: the template is anti-aliased,
   the screen snaps to whole pixels, and without the overlap a hairline of the
   field shows at small sizes. */
.br-device-screen {
  position: absolute;
  left: calc(var(--screen-x) - 1px);
  top: calc(var(--screen-y) - 1px);
  width: calc(var(--screen-w) + 2px);
  height: calc(var(--screen-h) + 2px);
  background-repeat: no-repeat;
  background-size: calc(var(--frames, 1) * 100%) 100%;
  image-rendering: pixelated;
}

.br-device-screen-play {
  animation: br-device-play calc(var(--frames) * 2s) steps(var(--frames), jump-none) infinite;
}

@keyframes br-device-play {
  to { background-position: 100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .br-device-screen-play { animation: none; }
}
