@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ---------------------------------------------------------------
   Palette note: cool "chassis" neutrals, deep PCB-green for the
   header band, and a single warm brass/gold accent standing in
   for the gold edge-connector fingers on a RAM stick or expansion
   card — the "contact-edge" tick pattern built from it is the one
   recurring motif on the page.
   --------------------------------------------------------------- */
:root {
  --bg: #eceee8;
  --surface: #ffffff;
  --surface-2: #e2e5dc;
  --dark: #16302a;
  --dark-2: #1e4437;
  --line: #d2d6c9;
  --line-strong: #a7ad9d;
  --ink: #12160f;
  --muted: #5d6357;
  --accent: #c1902e;
  --accent-dark: #93691c;
  --accent-soft: #f3e6c3;
  --on-dark: #f1efe4;
  --on-dark-muted: #9cae9f;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', var(--sans);
  --content-max: 1500px;
  --sidebar-w: 170px;
  --r: 8px;
  --r-sm: 4px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle, rgba(18,22,15,.055) 1px, transparent 1.3px) 0 0/22px 22px,
    var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Contact-edge: the recurring gold "connector finger" tick pattern. */
.contact-edge {
  height: 4px;
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 9px);
  opacity: .9;
}

.site-header { background: var(--dark); }
.header-inner { max-width: var(--content-max); margin: 0 auto; padding: 24px 28px 20px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
h1 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1; font-weight: 700; letter-spacing: -.02em; color: var(--on-dark); }
.header-inner p { margin: 9px 0 0; color: var(--on-dark-muted); font-size: 13px; }
.header-note { max-width: 340px; font-size: 11px; line-height: 1.55; color: var(--on-dark-muted); text-align: right; }

.site-footer { border-top: 1px solid var(--line-strong); }
.footer-inner { max-width: var(--content-max); margin: 0 auto; padding: 20px 28px 30px; display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-wrap: wrap; }
.footer-stat { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); white-space: nowrap; }
.footer-note { max-width: 560px; font-size: 11px; line-height: 1.6; color: var(--muted); }
.footer-note strong { color: var(--ink); font-weight: 600; }

.layout { max-width: var(--content-max); margin: 0 auto; padding: 0 28px 60px; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 30px; }
.sidebar { padding-top: 22px; min-height: calc(100vh - 100px); position: sticky; top: 0; align-self: start; }
.tab { position: relative; width: calc(100% - 6px); display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; background: transparent; border-radius: var(--r-sm); padding: 9px 12px 9px 16px; margin: 1px 0; color: var(--muted); text-align: left; transition: background .12s ease, color .12s ease; }
.tab::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: transparent; }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { color: var(--ink); font-weight: 600; background: var(--surface); }
.tab.active::before { background-image: repeating-linear-gradient(180deg, var(--accent) 0 3px, transparent 3px 6px); }
.tab-count { font-family: var(--mono); font-size: 10px; color: var(--accent-dark); }

.main { min-width: 0; padding-top: 24px; }
.category-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line-strong); }
.category-name { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.category-copy { color: var(--muted); margin-top: 7px; max-width: 62ch; }
.selection-limit { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }

/* ---------- compare slots ---------- */

.slots-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 20px 0; }

.slot { position: relative; border-radius: var(--r); min-height: 128px; }

/* filled slot: the picked component, with a quick-glance spec strip */
.slot-filled { background: #fbf6e9; border: 1px solid var(--accent); padding: 14px 16px; }
.slot-remove { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border: 0; background: none; color: var(--muted); font-size: 17px; line-height: 1; border-radius: var(--r-sm); }
.slot-remove:hover { color: var(--ink); background: var(--surface-2); }
.slot-brand { font-family: var(--mono); font-size: 10px; color: var(--muted); padding-right: 26px; }
.slot-name { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-top: 2px; padding-right: 26px; }
.slot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.slot-stat { min-width: 0; }

/* empty, active slot: a typeahead search box that reveals a dropdown */
.slot-search { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; }
.slot-search-wrap { flex: 1; position: relative; display: flex; align-items: center; }
.slot-search .search-icon { position: absolute; left: 0; color: var(--muted); pointer-events: none; }
.slot-search-input { width: 100%; border: 0; background: transparent; padding: 4px 4px 4px 22px; color: var(--ink); font-size: 14px; }
.slot-search-input:focus { outline: 0; }
.slot-search-input::placeholder { color: var(--muted); }

.slot-dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: 0 14px 30px rgba(12,15,11,.16); }
.slot-dropdown:empty { display: none; border: 0; box-shadow: none; }
.slot-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 8px 12px; text-align: left; }
.slot-option:last-of-type { border-bottom: 0; }
.slot-option:hover { background: var(--surface-2); }
.slot-option-brand { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.slot-option-name { font-size: 13px; color: var(--ink); }
.slot-dropdown-empty, .slot-dropdown-more { padding: 10px 12px; font-size: 11px; color: var(--muted); }

/* inactive slot: "+ Add another" placeholder */
.slot-add { border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; transition: border-color .12s ease, color .12s ease, background .12s ease; }
.slot-add:hover { border-color: var(--accent); color: var(--ink); background: var(--surface-2); }
.slot-add-icon { font-family: var(--display); font-size: 22px; line-height: 1; color: var(--accent-dark); }

.has-hint { cursor: help; border-bottom: 1px dotted var(--line-strong); }
.has-hint:hover { border-bottom-color: var(--accent); color: var(--ink); }
.spec-label { display: block; font-family: var(--mono); font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.spec-value { display: block; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- inline comparison ---------- */

.compare-section:empty { display: none; }
.compare-hint { margin-top: 6px; padding: 40px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.compare-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 10px; padding: 4px 2px; }
.compare-title { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.compare-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; }
.compare-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.diff-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.legend-best { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.btn-copy-link { border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: transparent; color: var(--ink); padding: 5px 10px; font-size: 11px; }
.btn-copy-link:hover { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.compare-body { overflow: auto; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); background: var(--surface); }
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.compare-table th:first-child, .compare-table td:first-child { width: 170px; }
.col-head { vertical-align: bottom; border-bottom: 2px solid var(--dark) !important; min-width: 190px; }
.col-brand { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.col-name { font-family: var(--display); font-size: 14px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.row-label { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.cell-value { font-variant-numeric: tabular-nums; }
.row-same .cell-value { color: var(--muted); }
.row-diff { background: #fbf8ef; }
.row-diff .cell-value { font-weight: 600; }
.row-diff .row-label { color: var(--ink); font-weight: 600; }
.cell-best { position: relative; color: var(--accent-dark) !important; }
.cell-best::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.diff-empty { text-align: center !important; color: var(--muted); padding: 30px !important; }

@media (max-width: 900px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .header-note { text-align: left; }
  .footer-inner { flex-direction: column; align-items: flex-start; padding: 18px 18px 24px; }
  .layout { display: block; padding: 0 18px 40px; }
  .sidebar { min-height: auto; position: static; display: flex; overflow-x: auto; padding: 10px 0; gap: 2px; }
  .tab { width: auto; flex: 0 0 auto; padding: 9px 14px; }
  .tab::before { top: auto; bottom: 0; left: 8px; right: 8px; width: auto; height: 3px; }
  .tab.active::before { background-image: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 6px); }
  .main { padding-top: 6px; }
  .slots-grid { grid-template-columns: 1fr; }
  .slot-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .header-inner { padding: 20px 18px; }
  h1 { font-size: 22px; }
  .category-head { align-items: flex-start; flex-direction: column; }
  .category-name { font-size: 27px; }
  .compare-table th, .compare-table td { padding: 10px; }
}
