/* ── Tool Comparison page styles ──────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg, #0f1117);
  color: var(--text, #e2e8f0);
  min-height: 100vh;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

a { color: var(--accent, #5ba300); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; width: 100%; }

/* ── Header ──────────────────────────────────────────────────────────────── */

/* Bare element selectors scoped with :not(.site-chrome) / :not(.site-footer)
 * so per-page hero rules don't accidentally style the shared chrome (which
 * uses <header class="site-chrome"> and <footer class="site-footer">). */
header:not(.site-chrome) { text-align: center; margin-bottom: 2rem; }
header:not(.site-chrome) h1 { font-size: 1.8rem; margin-bottom: 0.3rem; }
header:not(.site-chrome) p { color: var(--muted, #8892a4); font-size: 0.9rem; }
.back-link { display: inline-block; margin-bottom: 1rem; font-size: 0.85rem; }

/* ── Item selector ───────────────────────────────────────────────────────── */

.selector {
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.selector-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #8892a4);
  margin-bottom: 0.75rem;
}

.selector-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg, #0f1117);
  color: var(--text, #e2e8f0);
  border: 1px solid var(--border, #2d3148);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent, #5ba300);
}

.search-input::placeholder { color: var(--muted, #8892a4); }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.search-results.open { display: block; }

.search-result {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border, #2d3148);
  transition: background 0.1s;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--highlight); }
.search-result .result-radar { color: var(--muted, #8892a4); font-size: 0.75rem; }

/* ── Selected chips ──────────────────────────────────────────────────────── */

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--highlight);
  border: 1px solid var(--border, #2d3148);
  border-radius: 100px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.chip .chip-ring {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  padding: 0.08rem 0.4rem;
  border-radius: 100px;
}

.chip .chip-remove {
  cursor: pointer;
  color: var(--muted, #8892a4);
  font-size: 1rem;
  line-height: 1;
  margin-left: 0.2rem;
  transition: color 0.15s;
}

.chip .chip-remove:hover { color: var(--accent-5, #c73e3e); }

/* ── Share link ──────────────────────────────────────────────────────────── */

.share-bar {
  display: none;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.share-bar.visible { display: flex; }

.share-btn {
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  color: var(--muted, #8892a4);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.share-btn:hover { border-color: var(--accent, #5ba300); color: var(--accent, #5ba300); }

/* ── Comparison output ───────────────────────────────────────────────────── */

.comparison-output {
  display: none;
}

.comparison-output.visible { display: block; }

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted, #8892a4);
}

.empty-state h2 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--text, #e2e8f0); }
.empty-state p { font-size: 0.9rem; max-width: 440px; margin: 0 auto; }

/* ── Summary cards ───────────────────────────────────────────────────────── */

.summary-cards {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-cards.cols-2 { grid-template-columns: 1fr 1fr; }
.summary-cards.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.summary-card {
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 12px;
  padding: 1.25rem;
}

.summary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.summary-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.summary-card .ring {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.55rem;
  border-radius: 100px;
  text-transform: capitalize;
}

.summary-card .card-radar {
  font-size: 0.78rem;
  color: var(--muted, #8892a4);
  margin-bottom: 0.5rem;
}

.summary-card .card-summary {
  font-size: 0.84rem;
  color: var(--muted, #8892a4);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.summary-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: var(--bg, #0f1117);
  border: 1px solid var(--border, #2d3148);
  color: var(--muted, #8892a4);
}

.tag-pill.shared {
  border-color: var(--accent, #5ba300);
  color: var(--accent, #5ba300);
}

.card-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

/* ── Ring colours ────────────────────────────────────────────────────────── */

.ring--adopt  { color: var(--accent, #5ba300); background: rgba(91,163,0,0.13); }
.ring--trial  { color: var(--accent-4, #c97a2e); background: rgba(201,122,46,0.13); }
.ring--assess { color: var(--accent-2, #009eb0); background: rgba(0,158,176,0.13); }
.ring--hold   { color: var(--muted, #8892a4); background: rgba(104,129,144,0.15); }

/* ── Comparison table ────────────────────────────────────────────────────── */

.comparison-section { margin-bottom: 2rem; }

.comparison-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.comparison-section h2 .count {
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 100px;
  padding: 0.15rem 0.6rem;
  color: var(--muted, #8892a4);
  vertical-align: middle;
}

.comparison-section > p {
  color: var(--muted, #8892a4);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
}

th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #8892a4);
}

th, td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border, #2d3148);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(91,163,0,0.04); }

td.cell-empty {
  color: var(--muted, #8892a4);
  font-style: italic;
  opacity: 0.6;
}

td.cell-diff {
  /* Subtle highlight when values differ */
}

th.dim-header {
  min-width: 120px;
  width: 160px;
}

/* ── Tag overlap section ─────────────────────────────────────────────────── */

.tag-overlap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.tag-group h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #8892a4);
  margin-bottom: 0.4rem;
}

.tag-group .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ── Popular comparisons ─────────────────────────────────────────────────── */

.popular-section {
  display: none;
  margin-bottom: 2rem;
}

.popular-section.visible { display: block; }

.popular-section h2 {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.popular-subtitle {
  color: var(--muted, #8892a4);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.popular-card {
  display: block;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.popular-card:hover {
  border-color: var(--accent, #5ba300);
  box-shadow: 0 2px 12px rgba(91, 163, 0, 0.08);
  text-decoration: none;
}

.popular-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.popular-card p {
  font-size: 0.8rem;
  color: var(--muted, #8892a4);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.popular-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.popular-items {
  color: var(--muted, #8892a4);
}

.popular-rings {
  display: flex;
  gap: 0.3rem;
}

.popular-rings .ring {
  font-size: 0.65rem;
  padding: 0.06rem 0.4rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer:not(.site-footer) {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #2d3148);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted, #8892a4);
}

/* ── Theme toggle (matches site pattern) ─────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--surface, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text, #e2e8f0);
  transition: border-color 0.2s;
}

.theme-toggle:hover { border-color: var(--accent, #5ba300); }
.theme-toggle svg { width: 18px; height: 18px; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .summary-cards.cols-2,
  .summary-cards.cols-3 {
    grid-template-columns: 1fr;
  }

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

  body { padding: 2rem 1rem; }
}
