/* ============================================================
   FIRM-TILES.CSS - logo grid for the Firms page

   Replaces the stacked firm cards with a square-tile grid. The
   firm profile (#detailView) is untouched: it still carries the
   thesis, the holdings and the editable prices that used to live
   on the list card.
   ============================================================ */

.firm-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.firm-tile {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s ease, transform .15s ease;
}
.firm-tile:hover { border-color: var(--accent); transform: translateY(-2px); }

.firm-tile-link { display: block; text-decoration: none; color: inherit; }

/* Fixed square keeps the grid on a rhythm whatever shape the
   source artwork is. */
.firm-tile-art {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--hairline);
  padding: 18%;
}

/* contain, never cover. A logo cropped to fill is a broken logo. */
.firm-tile-art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 133 of 273 logos are dark artwork on transparency and are
   invisible against --surface-raised. Measured per logo, not
   guessed. They get a near-white chip so the mark reads. */
.firm-tile-art.is-dark-ink {
  background: #F4F6FA;
  border-bottom-color: #F4F6FA;
}

/* Wordmark tile for the 71 firms that publish no logo at all. */
.firm-tile-art-mark { padding: 12%; }
.firm-tile-mark {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.35;
  text-align: center;
  color: var(--ink);
  opacity: .92;
}

.firm-tile-rank {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-dim);
  background: rgba(7, 11, 20, .78);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}

.firm-tile-body { padding: 11px 13px 12px; }

.firm-tile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 3px;
}

.firm-tile-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-dim);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Save / Compare live outside the anchor so they stay clickable. */
.firm-tile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 13px 11px;
}

.firm-tile-actions .shortlist-btn {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.firm-tile-actions .shortlist-btn:hover { color: var(--accent); border-color: var(--accent); }
.firm-tile-actions .shortlist-btn.saved { color: var(--accent); border-color: var(--accent); }

.firm-tile-actions .compare-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-dim);
  cursor: pointer;
  user-select: none;
}

@media (max-width: 640px) {
  .firm-tile-grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 10px; }
  .firm-tile-name { font-size: 12.5px; }
  .firm-tile-meta { font-size: 9.5px; }
  .firm-tile-mark { font-size: 11px; }
}
