/* Image-search page styles. Every selector is namespaced under
   #image-search-app so the MVP's bare element/class selectors (body, header,
   .grid, .card, .score …) cannot collide with CA's global brand.css. The
   topnav, page canvas, and #page-head h1/.page-sub type come from brand.css;
   this file styles the search form + results grid. Shared form primitives
   (input[type=…]) are NOT redefined here per brand.css's contract. */

/* Same page grid as the other app pages (Library/Meta run at 1200). */
#image-search-app {
  padding: 32px 20px 64px;
  max-width: 1200px;
  margin: 0 auto;
}

#image-search-app #page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

#image-search-app #search-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  max-width: 720px;
  margin-top: 12px;
}
#image-search-app .search-controls {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
#image-search-app .search-controls input[type="search"] {
  flex: 1;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border-strong, #d1d5db);
  border-radius: 4px;
  background: var(--rb-white, #fff);
  color: var(--fg, #1f2328);
}
#image-search-app .search-controls input[type="search"]:focus {
  outline: 2px solid color-mix(in srgb, var(--accent, #2563eb) 20%, transparent);
  border-color: var(--accent, #2563eb);
}
#image-search-app #search-form button {
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--accent, #2563eb);
  /* Black, as on .rb-btn-accent: white on brand orange is only ~3:1. */
  color: var(--rb-black, #000);
  border: 0;
  border-radius: var(--btn-radius, 12px);
  cursor: pointer;
}
#image-search-app #search-form button:hover { filter: brightness(0.95); }
#image-search-app #search-form button:disabled { opacity: 0.6; cursor: progress; }

#image-search-app .collection-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--fg, #374151);
  font-size: 0.85rem;
  cursor: pointer;
}
#image-search-app .collection-toggle input {
  margin-top: 0.15rem;
  accent-color: var(--accent, #2563eb);
}
#image-search-app .collection-toggle span { display: flex; flex-direction: column; gap: 0.1rem; }
#image-search-app .collection-toggle small { color: var(--fg-muted, #6b7280); font-size: 0.74rem; }

#image-search-app #examples {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--fg-muted, #6b7280);
}
#image-search-app .example {
  margin: 0 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  cursor: pointer;
  color: var(--fg, #374151);
}
#image-search-app .example:hover { background: var(--border, #e5e7eb); }

#image-search-app #status {
  margin-bottom: 1rem;
  color: var(--fg-muted, #6b7280);
  font-size: 0.9rem;
  min-height: 1.25rem;
}

#image-search-app .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
#image-search-app .card {
  background: var(--rb-white, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
#image-search-app .card .score {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  min-width: 2.25rem;
  text-align: center;
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  letter-spacing: 0.02em;
}
#image-search-app .card .score-perfect { background: rgba(22, 163, 74, 0.92); }
#image-search-app .card .score-strong  { background: rgba(37, 99, 235, 0.92); }
#image-search-app .card .score-partial { background: rgba(202, 138, 4, 0.92); }
#image-search-app .card .score-weak    { background: rgba(120, 113, 108, 0.92); }
#image-search-app .card .image-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  /* The image itself is the hit area, not a raised button. */
  border-radius: 0;
  box-shadow: none;
  translate: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#image-search-app .card .image-open:focus-visible {
  outline: 3px solid var(--accent, #2563eb);
  outline-offset: -3px;
}
#image-search-app .card .image-open:disabled { cursor: progress; }
#image-search-app .card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--surface-alt, #e5e7eb);
}
#image-search-app .card .body {
  padding: 0.6rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
#image-search-app .asset-badges,
#image-search-app .equipment-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
#image-search-app .asset-badge,
#image-search-app .equipment-labels span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.16rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.2;
}
#image-search-app .equipment-labels span {
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
}
#image-search-app .asset-badge.historic {
  color: #78350f;
  background: #fef3c7;
  border: 1px solid #fde68a;
}
#image-search-app .asset-badge.collateral {
  color: #6b21a8;
  background: #f3e8ff;
  border: 1px solid #e9d5ff;
}
#image-search-app .card .event {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
#image-search-app .card .reason {
  margin: 0;
  font-size: 0.78rem;
  color: var(--accent, #2563eb);
  font-weight: 500;
}
#image-search-app .card .description {
  margin: 0;
  font-size: 0.8rem;
  color: var(--fg, #374151);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: help;
}
#image-search-app .card .meta {
  margin: 0;
  font-size: 0.7rem;
  color: var(--fg-subtle, #9ca3af);
}
#image-search-app .empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--fg-subtle, #9ca3af);
}

@media (max-width: 560px) {
  #image-search-app .search-controls { flex-direction: column; }
  #image-search-app #search-form button { width: 100%; }
}
