:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e2e6ee;
  --text: #14181f;
  --text-dim: #5b6472;
  --brand: #0e6dfb;
  --brand-dark: #0850bd;
  --accent: #00b894;
  --chip-bg: #eef1f7;
  --chip-active-bg: #0e6dfb;
  --chip-active-text: #ffffff;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.04), 0 4px 16px rgba(20, 24, 31, 0.05);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --border: #262b34;
    --text: #eef1f6;
    --text-dim: #9aa4b2;
    --brand: #4c9bff;
    --brand-dark: #7fb8ff;
    --accent: #2fe0ac;
    --chip-bg: #1d222b;
    --chip-active-bg: #4c9bff;
    --chip-active-text: #0e1116;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  flex-shrink: 0;
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-dim);
}

.search-box {
  flex: 1 1 320px;
  position: relative;
  min-width: 220px;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-box input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.search-box svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-count {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Category chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 18px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--brand); }
.chip.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  border-color: transparent;
}
.chip .count { opacity: .7; font-size: 11px; margin-left: 4px; }

/* Grid */
main { padding: 24px 0 60px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.card:hover { border-color: var(--brand); transform: translateY(-2px); }
.card .cat-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
}
.card h3 {
  margin: 0;
  font-size: 16.5px;
  font-family: var(--mono);
  letter-spacing: -0.2px;
}
.card .tagline {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
}
.card ul.highlights {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card ul.highlights li {
  font-size: 12.5px;
  color: var(--text);
  padding-left: 14px;
  position: relative;
}
.card ul.highlights li::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.card .snippet {
  margin-top: 4px;
  font-size: 12px;
  background: var(--chip-bg);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--text-dim);
}
.card .snippet b { color: var(--text); font-weight: 600; }
.card .snippet mark, .snippet mark {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}
mark {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
  border-radius: 3px;
  padding: 0 1px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0 40px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: center;
}

/* Product detail page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  margin: 18px 0 6px;
  color: var(--text-dim);
}
.detail-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin: 10px 0 20px;
}
.detail-head .cat-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
}
.detail-head h1 {
  font-family: var(--mono);
  font-size: 26px;
  margin: 10px 0 4px;
  letter-spacing: -0.3px;
}
.detail-head .tagline {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 14px;
}
.detail-head ul.highlights {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 18px;
}
.detail-head ul.highlights li {
  font-size: 13.5px;
  padding-left: 18px;
  position: relative;
}
.detail-head ul.highlights li::before {
  content: "✓";
  position: absolute;
  left: 0; top: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.spec-search {
  margin: 0 0 16px;
}
.spec-search input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 13.5px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.section-card h2 {
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
table.spec-table {
  width: 100%;
  border-collapse: collapse;
}
table.spec-table tr {
  border-top: 1px solid var(--border);
}
table.spec-table tr:first-child { border-top: none; }
table.spec-table td {
  padding: 9px 18px;
  font-size: 13.5px;
  vertical-align: top;
}
table.spec-table td.k {
  color: var(--text-dim);
  width: 38%;
  min-width: 140px;
  font-weight: 500;
}
table.spec-table td.v {
  color: var(--text);
}
table.spec-table tr.hidden { display: none; }

details.raw-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 18px 14px;
  margin: 20px 0 40px;
}
details.raw-block summary {
  cursor: pointer;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
details.raw-block pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  max-height: 480px;
  overflow: auto;
  background: var(--chip-bg);
  padding: 12px 14px;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .detail-head h1 { font-size: 21px; }
  table.spec-table td.k { width: 46%; min-width: 0; }
}
