/* ── Variables ── */
:root {
  --brand: #6c63ff;
  --brand-dim: rgba(108, 99, 255, 0.08);
  --brand-border: rgba(108, 99, 255, 0.2);

  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f5;
  --bg-4: #e4e4e7;

  --border: #e4e4e7;
  --border-light: #d1d1d6;

  --text-1: #09090b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  --green: #16a34a;
  --green-dim: #f0fdf4;
  --green-border: #bbf7d0;

  --red: #dc2626;
  --red-dim: #fef2f2;
  --red-border: #fecaca;

  --amber: #d97706;
  --amber-dim: #fffbeb;
  --amber-border: #fde68a;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-1); text-decoration: none; }
a:hover { color: var(--brand); }

code, pre {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.85em;
}

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Nav ── */
nav {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.nav-brand .logo-mark {
  width: 26px;
  height: 26px;
  background: var(--brand);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--text-2);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--bg-3);
}

.nav-cta {
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  background: var(--text-1);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  margin-left: 0.5rem;
  transition: opacity 0.15s;
}

.nav-cta:hover { opacity: 0.8; color: white; }

/* ── Hero ── */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-dim);
  border: 1px solid var(--brand-border);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 1.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0 0 1rem;
  color: var(--text-1);
}

.hero h1 span { color: var(--brand); }

.hero p {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 480px;
  margin: 0 0 2rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
}

.hero-stat strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.hero-stat span {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Filters ── */
.filters {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.filters label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.filters input[type="text"],
.filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  height: 36px;
}

.filters input[type="text"]:focus,
.filters select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

.filters input[type="text"] { min-width: 260px; }

.filters select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
}

.clear-btn {
  font-size: 0.8rem;
  color: var(--text-3);
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  height: 36px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.clear-btn:hover {
  color: var(--text-1);
  border-color: var(--border-light);
}

/* ── Service grid ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--border);
}

.service-card-wrap {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  flex: 1;
  transition: background 0.12s;
  color: var(--text-1);
}

.service-card:hover { background: var(--bg-2); }

.service-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.service-card h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

.service-card p {
  margin: 0;
  font-size: 0.825rem;
  color: var(--text-2);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.service-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.775rem;
  color: var(--text-3);
}

.price-badge {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--brand);
}

.compare-btn {
  width: 100%;
  padding: 0.4rem;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.compare-btn:hover { color: var(--text-1); background: var(--bg-2); }
.compare-btn.comparing {
  color: var(--brand);
  background: var(--brand-dim);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-protocol {
  background: var(--brand-dim);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.badge-featured {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.badge-verified {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.badge-active {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.badge-pending {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

/* ── Stars ── */
.stars { color: var(--amber); letter-spacing: -1px; font-size: 0.8rem; }
.rating-count { color: var(--text-3); font-size: 0.775rem; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

/* ── Compare bar ── */
.compare-bar {
  position: sticky;
  top: 52px;
  z-index: 40;
  background: var(--text-1);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

/* ── Service detail ── */
.service-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text-1); }

.service-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.service-hero p {
  font-size: 0.9rem;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 0 1rem;
}

.badge-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.service-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.service-link-btn {
  font-size: 0.8rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  transition: all 0.15s;
  background: var(--bg);
}

.service-link-btn:hover {
  color: var(--text-1);
  border-color: var(--border-light);
  background: var(--bg-2);
}

/* ── Section title ── */
.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ── Endpoint card ── */
.endpoint-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}

.endpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
}

.endpoint-path {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  color: var(--text-1);
  background: var(--bg-3);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.endpoint-price {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand);
}

.endpoint-price-unit {
  font-size: 0.7rem;
  color: var(--text-3);
  display: block;
  text-align: right;
  font-family: sans-serif;
}

.endpoint-meta {
  display: flex;
  gap: 1.5rem;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.775rem;
  color: var(--text-3);
  background: var(--bg-2);
}

.endpoint-meta span strong {
  color: var(--text-2);
  font-weight: 500;
}

.endpoint-chart {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  background: var(--bg-2);
}

/* ── Chart ── */
.chart-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.chart-stats span {
  font-size: 0.75rem;
  color: var(--text-3);
}

.chart-stats span strong {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--text-2);
  display: block;
}

.day-filters {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.day-btn {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.15s;
}

.day-btn:hover { color: var(--text-1); border-color: var(--border-light); }
.day-btn.active {
  background: var(--text-1);
  border-color: var(--text-1);
  color: white;
}

.chart-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

/* ── Review card ── */
.review-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-3);
}

.review-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text-1);
}

/* ── Forms ── */
.form-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="url"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 1rem;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea { resize: vertical; min-height: 90px; }

button[type="submit"],
.btn-primary {
  background: var(--text-1);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-block;
  text-decoration: none;
}

button[type="submit"]:hover,
.btn-primary:hover { opacity: 0.8; }

.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-block;
  text-decoration: none;
}

.btn-outline:hover {
  color: var(--text-1);
  border-color: var(--border-light);
  background: var(--bg-2);
}

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-top: 1rem;
}

.alert-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.alert-error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* ── Admin ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-2); }

.action-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s;
  font-weight: 500;
}

.action-btn:hover { opacity: 0.8; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-2);
  transition: all 0.15s;
  background: var(--bg);
  text-decoration: none;
  display: inline-block;
}

.page-btn:hover {
  color: var(--text-1);
  border-color: var(--border-light);
  background: var(--bg-2);
}

.page-btn.active {
  background: var(--text-1);
  border-color: var(--text-1);
  color: white;
}

/* ── Compare table ── */
.compare-grid {
  display: grid;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--border);
  margin-top: 1.5rem;
}

.compare-row {
  display: grid;
  gap: 1px;
  background: var(--border);
}

.compare-cell {
  background: var(--bg);
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
}

.compare-cell.label {
  background: var(--bg-2);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
}

.compare-cell.header {
  background: var(--bg-2);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Results meta ── */
.results-meta {
  font-size: 0.775rem;
  color: var(--text-3);
  margin-bottom: 1rem;
}

/* ── Grid util ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2rem 0;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-3);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--text-1); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.9rem; }
  .services-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
  .filters input[type="text"] { min-width: 100%; }
}

/* ── Card spacing override ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  border: none;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

.service-card-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.service-card-wrap:hover {
  border-color: var(--border-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ── Responsive overrides ── */
@media (max-width: 768px) {
  .nav-links .nav-link { display: none; }
  .hero { padding: 2.5rem 0 2rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 0.9rem; }
  .hero-stats { gap: 1.5rem; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input[type="text"],
  .filters select { width: 100%; min-width: unset; }
  .clear-btn { justify-content: center; }
  .services-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .endpoint-meta { flex-wrap: wrap; gap: 0.75rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .compare-bar { top: 52px; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .nav-inner { padding: 0 1rem; }
  .hero-stats { flex-direction: column; gap: 0.75rem; }
  .chart-stats { flex-wrap: wrap; gap: 0.75rem; }
}
