/* Row component */
.row {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--sp-5);
  gap: var(--sp-4);
  background: var(--bg);
  cursor: default;
  position: relative;
  transition: background 80ms;
}

.row:hover {
  background: var(--bg-hover);
}

.row:hover .row-actions {
  opacity: 1;
}

.row:active,
.row.row--active {
  background: var(--bg-active);
}

.row.row--focused {
  background: var(--bg-focus);
  box-shadow: inset 2px 0 0 var(--accent);
}

.row.row--dimmed {
  opacity: 0.3;
}

/* Favicon */
.fav {
  width: 16px;
  height: 16px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  background: var(--border);
  object-fit: contain;
}

/* Top line: favicon + title + tags */
.row-top {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex: 1;
  min-width: 0;
}

/* Title */
.rtitle {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-1);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tags */
.rtag {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Row actions (edit/delete) — dimmed at rest, full on row hover, always legible */
.row-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  opacity: 0.7;
  transition: opacity 80ms;
  flex-shrink: 0;
}

.row:hover .row-actions,
.row:focus-within .row-actions { opacity: 1; }

/* Theme-aware action buttons (override generic .chip / .chip.danger from glass.css) */
.row .row-actions .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-1);
  cursor: pointer;
  transition: background 80ms, border-color 80ms, color 80ms;
}

.row .row-actions .row-edit:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.row .row-actions .row-delete {
  padding: 0 9px;
  color: #b42318;
  background: var(--bg-raised);
  border-color: var(--border);
}
.row .row-actions .row-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.55);
  color: #b42318;
}
[data-theme="dark"] .row .row-actions .row-delete,
[data-theme="dark"] .row .row-actions .row-delete:hover { color: #ff7b72; }

/* Section header */
.sec-hd {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--sp-5);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  background: var(--bg-raised);
}

/* Board badge (shown in search results) */
.board-badge {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search highlight */
mark.search-hl {
  background: var(--search-hl);
  border-radius: 2px;
  padding: 0 1px;
  color: inherit;
}

/* Layout modes */
.layout-compact .row {
  height: 36px;
}
.layout-compact .rtag,
.layout-compact .board-badge {
  display: none;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1px;
}
.layout-grid .sec-hd {
  grid-column: 1 / -1;
}

.layout-masonry {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 1px;
}
.layout-masonry .sec-hd {
  grid-column: 1 / -1;
}

/* Mobile */
@media (max-width: 640px) {
  .row {
    height: auto;
    padding: 10px var(--sp-5);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .row-top {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    width: 100%;
    margin-bottom: 7px;
  }

  .row-pills {
    display: flex;
    gap: 6px;
    width: 100%;
    padding-left: 24px;
    overflow: hidden;
  }

  .row:hover { background: var(--bg); }
  .row:active { background: var(--bg-active); }
  /* Keep actions visible + reachable on mobile (own row, right-aligned) */
  .row-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
    padding-left: 24px;
  }

  .jumpbar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .quick-add-bar input { height: 48px; font-size: 16px; }
}

/* Staggered reveal on list change.
   Functional, not decorative: switching board swaps the whole list at once, and
   an instant repaint reads as a flicker with no signal that anything happened.
   A short cascade makes "this list is now different" legible.
   --row-i is set per row by the template and capped at 8, so the last visible
   row still starts within ~180ms and long lists are never gated behind an
   animation. */
.row {
  animation: rowReveal 240ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--row-i, 0) * 22ms);
}

@keyframes rowReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .row {
    animation: none;
  }
}
