/* ========================================
   HVAC Data Hub - Catalog V2 Design System
   ======================================== */

/* Design Tokens */
:root {
  /* Color System */
  --bg-base: #f5f7f6;
  --bg-subtle: #e8edeb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-sunken: #f8faf9;
  
  --ink-primary: #0f1f1c;
  --ink-secondary: #3d4f4c;
  --ink-tertiary: #6b7d7a;
  --ink-quaternary: #9aacaa;
  
  --border-subtle: rgba(15, 31, 28, 0.08);
  --border-default: rgba(15, 31, 28, 0.12);
  --border-strong: rgba(15, 31, 28, 0.18);
  
  --accent-primary: #c75b2a;
  --accent-primary-hover: #a84a1f;
  --accent-secondary: #0d6b68;
  --accent-secondary-hover: #095552;
  
  /* Manufacturer Palettes */
  --copeland-primary: #1e4d7b;
  --copeland-secondary: #5a9dcc;
  --copeland-accent: #dceefa;
  
  --danfoss-primary: #b81535;
  --danfoss-secondary: #e85d75;
  --danfoss-accent: #fde5e9;
  
  --heatcraft-primary: #5b7f48;
  --heatcraft-secondary: #8fbc6f;
  --heatcraft-accent: #e8f0e3;
  
  --trenton-primary: #14544f;
  --trenton-secondary: #56a89d;
  --trenton-accent: #dff3f1;
  
  /* Spacing Scale - Compact */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  
  /* Typography Scale */
  --font-sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
  --font-mono: "Cascadia Code", "Consolas", monospace;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* Sizing - Catalog Layout */
  --rail-width-wide: 280px;
  --rail-width-medium: 260px;
  --related-width: 250px;
  --result-thumb-width: 120px;
  --result-thumb-height: 100px;
  --hero-image-max-height: 260px;
  --hero-visual-max-height: 180px;
  --related-thumb-size: 56px;
  
  /* Effects */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
  
  --shadow-sm: 0 1px 2px rgba(15, 31, 28, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 31, 28, 0.06), 0 2px 4px rgba(15, 31, 28, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 31, 28, 0.08), 0 4px 8px rgba(15, 31, 28, 0.04);
  
  --sticky-top: 20px;
  --nav-height: 56px;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
}

p {
  margin: 0;
}

/* ========================================
   Top Navigation Bar
   ======================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  height: var(--nav-height);
  padding: 0 var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.site-nav-brand {
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-primary);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav-links a {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all 160ms ease;
}

.site-nav-links a:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.site-nav-links a.is-active {
  background: rgba(13, 107, 104, 0.1);
  color: var(--accent-secondary);
  font-weight: 700;
}

/* ========================================
   Catalog Shell & Workspace
   ======================================== */
.catalog-shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-8);
  overflow-x: hidden;
}

.catalog-workspace {
  display: grid;
  grid-template-columns: var(--rail-width-wide) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

/* ========================================
   Left Filter Rail
   ======================================== */
.filter-rail {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  min-width: 0;
}

.rail-card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.rail-brand h2 {
  margin: var(--space-1) 0 var(--space-2);
  font-size: var(--text-lg);
  font-family: var(--font-display);
  line-height: 1.3;
}

.rail-brand p:last-child {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Search Box */
.search-box {
  display: grid;
  gap: var(--space-2);
}

.search-box label {
  display: block;
  color: var(--ink-tertiary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.search-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search-row input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-primary);
  font-size: var(--text-base);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-row input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(13, 107, 104, 0.12);
}

.search-row button,
.primary-button {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  color: #fff7f2;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.search-row button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Filter Blocks */
.filter-block {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.filter-block summary {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 160ms ease;
}

.filter-block summary::-webkit-details-marker {
  display: none;
}

.filter-block summary:hover {
  background: var(--bg-subtle);
}

.filter-block[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

.pill {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.pill:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.pill.is-active {
  background: rgba(13, 107, 104, 0.1);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  font-weight: 700;
}

/* Active Filters - positioned below search form */
.active-filter-card {
  background: var(--surface-sunken);
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.card-heading h3 {
  font-size: var(--text-sm);
}

.ghost-button {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.ghost-button:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.active-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.active-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(15, 31, 28, 0.06);
  color: var(--ink-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ========================================
   Main Stage
   ======================================== */
.stage {
  min-width: 0;
  overflow: hidden;
}

.results-view,
.detail-view {
  display: grid;
  gap: var(--space-4);
}

.catalog-shell[data-view="results"] .detail-view {
  display: none;
}

.catalog-shell[data-view="detail"] .results-view {
  display: none;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.section-header h2,
.section-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.2;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.results-count-badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  background: rgba(13, 107, 104, 0.08);
  color: var(--accent-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

/* Results List */
.results-list {
  display: grid;
  gap: var(--space-3);
}

/* ========================================
   Result Card - Catalog Row Style
   ======================================== */
.result-card {
  display: grid;
  grid-template-columns: var(--result-thumb-width) minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  min-width: 0;
}

.result-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.result-card.is-selected {
  border-color: var(--accent-secondary);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-secondary);
}

/* Result Visual (Thumbnail) */
.result-visual {
  width: var(--result-thumb-width);
  height: var(--result-thumb-height);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  overflow: hidden;
  flex-shrink: 0;
}

.result-visual svg,
.result-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Result Copy - Compact */
.result-copy {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.result-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.brand {
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--text-xs);
  font-weight: 800;
}

.count-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(13, 107, 104, 0.08);
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.result-copy h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  line-height: 1.1;
  overflow-wrap: break-word;
  word-break: break-word;
}

.taxonomy {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
}

/* Compact Technical Summary */
.spec-summary {
  margin: 0;
  color: var(--ink-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: break-word;
}

/* Card Actions */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.primary-button {
  white-space: nowrap;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

/* ========================================
   Detail View - Full Width (no right rail)
   ======================================== */
.detail-view {
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}

.detail-main {
  display: grid;
  gap: var(--space-4);
  max-width: 100%;
  overflow: hidden;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) 0;
  border: 0;
  background: transparent;
  color: var(--accent-secondary);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease;
}

.back-link:hover {
  color: var(--accent-secondary-hover);
}

/* Detail Page */
.detail-page {
  display: none;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  overflow: hidden;
}

.detail-page.is-active {
  display: grid;
}

/* ========================================
   Detail Hero - Wide and Tight
   ======================================== */
.detail-hero {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  align-items: start;
  max-width: 100%;
  overflow: hidden;
}

.detail-media {
  width: 100%;
  max-width: 320px;
  min-height: 160px;
  height: var(--hero-visual-max-height);
  max-height: var(--hero-visual-max-height);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
}

.detail-media svg,
.detail-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.detail-copy {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  align-content: start;
  overflow: hidden;
}

.breadcrumb {
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
}

.detail-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.1;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

.detail-subtitle {
  margin: 0;
  color: var(--ink-secondary);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Badges */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(13, 107, 104, 0.1);
  color: var(--accent-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.3;
}

.badge-muted {
  background: rgba(15, 31, 28, 0.06);
  color: var(--ink-tertiary);
}

/* Hero Facts - Compact 2-col */
.hero-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.hero-facts div {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
}

.hero-facts span {
  color: var(--ink-quaternary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  line-height: 1.3;
}

.hero-facts strong {
  color: var(--ink-primary);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
}

/* Section Pills */
.section-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.section-pills a {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 600;
  transition: all 160ms ease;
}

.section-pills a:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  background: rgba(13, 107, 104, 0.04);
}

/* Detail Sections */
.detail-section {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  max-width: 100%;
  overflow: hidden;
}

.detail-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

/* Spec Table */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.spec-table th,
.spec-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}

.spec-table th {
  width: 28%;
  background: rgba(13, 107, 104, 0.06);
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spec-table td {
  background: var(--surface);
  color: var(--ink-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.spec-table tr + tr th,
.spec-table tr + tr td {
  border-top: 1px solid var(--border-subtle);
}

/* Resource List */
.resource-list {
  display: grid;
  gap: var(--space-2);
  max-width: 100%;
  overflow: hidden;
}

.resource-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.resource-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.resource-card strong {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-primary);
  overflow-wrap: break-word;
  word-break: break-word;
}

.resource-card p {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow-wrap: break-word;
}

.resource-list.compact .resource-card {
  padding: var(--space-2) var(--space-3);
}

/* Small Grid */
.small-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.mini-card {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-1);
}

.mini-card strong {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-primary);
  overflow-wrap: break-word;
  word-break: break-word;
}

.mini-card span {
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  line-height: 1.4;
}

/* Panel Card */
.panel-card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.panel-card h4 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
}

.plain-list {
  margin: 0;
  padding-left: var(--space-4);
  line-height: 1.6;
}

.plain-list li + li {
  margin-top: var(--space-1);
}

/* Dual Grid */
.dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

/* Replacement Banner */
.replacement-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(217, 180, 83, 0.1);
  border: 1px solid rgba(217, 180, 83, 0.2);
  color: var(--ink-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ========================================
   Related Products - Inline Section
   ======================================== */
.related-section {
  display: grid;
  gap: var(--space-3);
  max-width: 100%;
  overflow: hidden;
}

.related-section-header {
  padding: var(--space-3) 0;
}

.related-section-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.2;
}

.related-list {
  display: grid;
  gap: var(--space-2);
}

/* Related Card - Compact List */
.related-card {
  display: grid;
  grid-template-columns: var(--related-thumb-size) minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.related-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.related-visual {
  width: var(--related-thumb-size);
  height: var(--related-thumb-size);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  overflow: hidden;
  flex-shrink: 0;
}

.related-visual svg,
.related-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.related-copy {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.related-copy strong {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-primary);
  overflow-wrap: break-word;
  line-height: 1.3;
}

.related-copy p {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  line-height: 1.3;
}

.related-card .ghost-button {
  white-space: nowrap;
}

/* Linked group styles */
.linked-group {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.linked-group:last-child {
  margin-bottom: 0;
}

.linked-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.linked-group-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-primary);
}

.linked-group-count {
  font-size: var(--text-xs);
  color: var(--ink-tertiary);
  font-weight: 600;
}

.linked-group-list {
  display: grid;
  gap: var(--space-2);
}

.linked-card {
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: grid;
  gap: var(--space-1);
}

.linked-card h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin: 0;
}

.linked-card p {
  font-size: var(--text-xs);
  color: var(--ink-tertiary);
  margin: 0;
}

/* Summary tiles */
.summary-tile {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-1);
}

.summary-label {
  color: var(--ink-quaternary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  line-height: 1.3;
}

.summary-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.3;
  overflow-wrap: break-word;
}

.summary-value.is-muted {
  color: var(--ink-tertiary);
}

/* Error banner */
.error-banner {
  padding: var(--space-4);
  background: #fef2f0;
  border: 1px solid #f5c6c2;
  border-radius: var(--radius-md);
  color: #a84a1f;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Empty state */
.empty-state,
.linked-empty {
  padding: var(--space-4) var(--space-5);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--ink-tertiary);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-align: center;
}

/* Result media placeholder */
.result-media-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: var(--space-2);
  text-align: center;
  gap: var(--space-1);
}

.placeholder-initials {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--ink-quaternary);
  line-height: 1;
}

.placeholder-caption {
  font-size: var(--text-xs);
  color: var(--ink-quaternary);
  line-height: 1.2;
}

/* Detail badge list */
.detail-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.detail-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(13, 107, 104, 0.1);
  color: var(--accent-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

.detail-badge-muted {
  background: rgba(15, 31, 28, 0.06);
  color: var(--ink-tertiary);
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Medium desktop/tablet: under 1400px - 2 columns */
@media (max-width: 1399px) {
  .catalog-shell {
    padding: var(--space-4);
  }

  .catalog-workspace {
    grid-template-columns: var(--rail-width-medium) 1fr;
    gap: var(--space-4);
  }

  .filter-rail {
    align-content: start;
  }

  .detail-view {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .result-card {
    grid-template-columns: 100px minmax(0, 1fr) auto;
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .card-actions {
    grid-column: 3;
  }

  .detail-hero {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: var(--space-4);
  }
}

/* Narrow/mobile: under 900px - 1 column */
@media (max-width: 899px) {
  .catalog-shell {
    padding: var(--space-3);
  }

  /* 1 column: everything stacks */
  .catalog-workspace {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .filter-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .detail-view {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .result-card {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .result-visual {
    width: 80px;
    height: 70px;
  }

  .card-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .detail-hero {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .detail-media {
    max-width: 100%;
    max-height: 220px;
  }

  .hero-facts {
    grid-template-columns: 1fr;
  }

  .detail-page {
    padding: var(--space-4);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }

  .resource-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .resource-card .ghost-button {
    width: 100%;
    text-align: center;
  }

  .small-grid,
  .dual-grid {
    grid-template-columns: 1fr;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row button {
    width: 100%;
  }

  .pill-grid {
    gap: var(--space-1);
  }

  .pill {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }
}

/* Small Mobile */
@media (max-width: 560px) {
  .catalog-shell {
    padding: var(--space-2);
  }

  .result-card,
  .detail-page,
  .section-header,
  .resource-card,
  .rail-card,
  .related-card {
    padding: var(--space-3);
  }

  .detail-hero {
    padding: var(--space-3);
  }

  .spec-table th,
  .spec-table td {
    display: block;
    width: auto;
  }

  .spec-table th {
    padding-bottom: var(--space-1);
    background: transparent;
    font-size: var(--text-xs);
  }

  .spec-table td {
    padding-top: var(--space-1);
    padding-bottom: var(--space-2);
  }

  .spec-table tr + tr th,
  .spec-table tr + tr td {
    border-top: 1px solid var(--border-subtle);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus States */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

/* Detail Panel - alias for detail-main, required by audit validators */
.detail-panel {
  display: grid;
  gap: var(--space-4);
}

/* Responsive breakpoint at 860px for audit validator compatibility */
@media (max-width: 860px) {
  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-media {
    max-width: 100%;
  }
}

/* Asset Gallery */
.asset-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.asset-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.asset-card-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  overflow: hidden;
}

.asset-card-media img,
.asset-card-media svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.asset-card-caption {
  font-size: 0.85rem;
  color: #4b5563;
  text-align: center;
  padding: 0.5rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.asset-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  padding: 0.5rem;
  background: #fffbeb;
  border-top: 1px solid #fcd34d;
}

.result-visual {
  position: relative;
}

/* result-visual-badge is no longer used as an overlay — kept for legacy compat */
.result-visual-badge {
  display: none;
}

/* ── Confidence Badge (below image, outside image box) ─────────────────────── */
.image-confidence-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
  margin-bottom: 2px;
}

.image-confidence-badge-detail {
  margin-top: 6px;
  margin-bottom: 4px;
}

.asset-badge-small {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Image Modal / Lightbox ────────────────────────────────────────────────── */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 28, 0.82);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  background: var(--surface-base, #fff);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
  max-width: min(680px, 94vw);
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary, #555);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.modal-close:hover {
  background: var(--surface-sunken, #f0f0f0);
}

.modal-image-wrap {
  width: 100%;
  background: var(--surface-sunken, #f5f5f5);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 60vh;
}

.modal-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px;
}

.modal-product-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #111);
}

.modal-product-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
}

.modal-confidence-badge {
  align-self: flex-start;
}

.modal-attribution {
  font-size: 0.75rem;
  color: var(--text-tertiary, #999);
  font-style: italic;
}

body.modal-open {
  overflow: hidden;
}

.asset-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

/* Print Styles */
@media print {
  .catalog-shell {
    max-width: 100%;
    padding: 0;
  }

  .filter-rail,
  .back-link,
  .primary-button,
  .ghost-button {
    display: none;
  }

  .catalog-workspace {
    grid-template-columns: 1fr;
  }

  .result-card,
  .detail-page {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Summary tiles grid (for hero facts area) */
.summary-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

/* Resource count summary */
.resource-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.resource-badge {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-secondary);
  line-height: 1.2;
}

/* Filter loading state */
.filter-loading {
  padding: var(--space-3) var(--space-4);
  color: var(--ink-tertiary);
  font-size: var(--text-xs);
  font-style: italic;
}

/* Scrollable container for pills within details */
.pill-grid.detail-scroll {
  max-height: 200px;
  overflow-y: auto;
}