/* ============================================================
   tiles.css — tile cards, family headers, discovery panel
   ============================================================ */

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

.family-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px 6px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.family-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Tile card ---------- */

.tile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 0;
  margin: 0 8px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  position: relative;
  border: 1.5px solid transparent;
  background: transparent;
  text-align: left;
  width: calc(100% - 16px);
}

.tile-card:hover {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.tile-card.active {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border-color: var(--accent);
}

.tile-card.active .tile-name {
  color: var(--accent);
}

/* Family accent strip */
.tile-accent {
  width: 4px;
  border-radius: 2px;
  align-self: stretch;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Tile icon */
.tile-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--surface);
}

/* Tile card: active/hover icon bg */
.tile-card:hover  .tile-icon { background: var(--bg); }
.tile-card.active .tile-icon { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }

/* Tile text */
.tile-text {
  flex: 1;
  min-width: 0;
}

.tile-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-desc {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Arrow / external indicator */
.tile-arrow {
  font-size: .9rem;
  color: var(--border);
  flex-shrink: 0;
  transition: color .12s, transform .12s;
}

.tile-card:hover  .tile-arrow { color: var(--text-muted); transform: translateX(2px); }
.tile-card.active .tile-arrow { color: var(--accent); }

/* External link badge */
.tile-external {
  font-size: .65rem;
  background: var(--border);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Pinned indicator */
.tile-card.pinned .tile-name::after {
  content: ' 📌';
  font-size: .75rem;
}

/* ---------- Empty search state ---------- */

.tile-search-empty {
  padding: 40px 20px;
  text-align: center;
}

.tile-search-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  opacity: .5;
}

.tile-search-empty p {
  color: var(--text-muted);
  font-size: .875rem;
}

/* ---------- Family color map (CSS custom properties per family) ---------- */

.family-financial { --fc: #f59e0b; }
.family-life       { --fc: #22c55e; }
.family-maker      { --fc: #8b5cf6; }
.family-utilities  { --fc: #3b82f6; }
.family-math       { --fc: #ec4899; }
.family-programmer { --fc: #64748b; }
.family-games      { --fc: #f97316; }

/* Tile accent strip uses --fc */
.tile-card .tile-accent { background: var(--fc, var(--accent)); }

/* Active tile gets family-colored accent border */
.tile-card.active {
  border-color: var(--fc, var(--accent));
  background: color-mix(in srgb, var(--fc, var(--accent)) 8%, var(--card));
}
.tile-card.active .tile-name { color: var(--fc, var(--accent)); }
.tile-card.active .tile-arrow { color: var(--fc, var(--accent)); }

/* Family filter pills — colored when active */
.family-filter-btn[data-family="financial"].active { border-color: #f59e0b; color: #f59e0b; background: color-mix(in srgb, #f59e0b 10%, transparent); }
.family-filter-btn[data-family="life"].active       { border-color: #22c55e; color: #22c55e; background: color-mix(in srgb, #22c55e 10%, transparent); }
.family-filter-btn[data-family="maker"].active      { border-color: #8b5cf6; color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 10%, transparent); }
.family-filter-btn[data-family="utilities"].active  { border-color: #3b82f6; color: #3b82f6; background: color-mix(in srgb, #3b82f6 10%, transparent); }
.family-filter-btn[data-family="math"].active       { border-color: #ec4899; color: #ec4899; background: color-mix(in srgb, #ec4899 10%, transparent); }
.family-filter-btn[data-family="programmer"].active { border-color: #64748b; color: #64748b; background: color-mix(in srgb, #64748b 10%, transparent); }
.family-filter-btn[data-family="games"].active      { border-color: #f97316; color: #f97316; background: color-mix(in srgb, #f97316 10%, transparent); }
