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

:root {
  --bg: #fafaf8;
  --bg-card: #fff;
  --bg-nav: #2c2c2c;
  --border: #d0d0c8;
  --border-dark: #aaa;
  --text: #222;
  --text-muted: #666;
  --accent: #b00;
  --accent-hover: #900;
  --link: #1a4d8f;
  --link-hover: #0f2e5a;
  --max-w: 960px;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html { font-size: 16px; overflow-y: scroll; }
body {
  font-family: Georgia, "Times New Roman", Times, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* === Accessibility === */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* === Nav === */
header > nav {
  background: var(--bg-nav);
  border-bottom: 3px solid #111;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 48px;
}
.nav-logo {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--sans); font-weight: 700; font-size: 1.1rem;
  color: #fff; text-decoration: none;
}
.nav-logo:hover { color: #fff; text-decoration: none; }
.nav-logo img { width: 24px; height: 24px; }
.nav-logo .logo-ai { color: #e55; }

.nav-links { display: flex; gap: 0; list-style: none; flex-wrap: wrap; }
.nav-links a {
  display: block; padding: 0.35rem 0.7rem;
  color: #ccc; font-family: var(--sans); font-size: 0.8rem;
  text-decoration: none; text-transform: uppercase; letter-spacing: 0.04em;
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a.active { color: #fff; border-bottom: 2px solid #e55; }

/* === Main === */
main {
  flex: 1; max-width: var(--max-w);
  margin: 0 auto; padding: 1.5rem 1rem; width: 100%;
}

/* === Hero (home) === */
.hero {
  text-align: center; padding: 1.5rem 0 1rem;
  border-bottom: 2px solid #222; margin-bottom: 1.5rem;
}
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.3rem; letter-spacing: -0.02em; }
.hero h1 .highlight { color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 1rem; }
.home-cta {
  text-align: center; padding: 2rem 0;
}
.cta-link {
  font-family: var(--sans); font-size: 1rem; font-weight: 700;
  color: var(--link); text-decoration: none;
}
.cta-link:hover { color: var(--accent); }

/* === Page header === */
.page-header {
  margin-bottom: 1rem; padding-bottom: 0.75rem;
  border-bottom: 2px solid #222;
}
.page-header h1 {
  font-size: 1.6rem; font-weight: 700;
  margin-bottom: 0.15rem; letter-spacing: -0.01em;
}
.page-header p { color: var(--text-muted); font-size: 0.95rem; }

/* === Model list (userbenchmark style) === */
.model-legend {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-family: var(--sans); font-size: 0.75rem; color: var(--text-muted);
  margin-bottom: 1rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.bar-quality-sample {
  display: inline-block; width: 14px; height: 10px;
  background: linear-gradient(90deg, #2d7d46, #4caf50); border-radius: 2px;
}
.bar-price-sample {
  display: inline-block; width: 14px; height: 10px;
  background: linear-gradient(90deg, #1565c0, #42a5f5); border-radius: 2px;
}

.model-list { }

.model-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.model-row:hover { background: #f0f0ea; }
.model-row:first-child { border-top: 1px solid var(--border); }

.model-rank {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 700;
  color: var(--text-muted); min-width: 2rem; text-align: right;
}

.model-info { flex: 1; min-width: 0; }

.model-name-line {
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
a.model-name, .model-name {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 700; color: var(--text);
  text-decoration: none;
}
a.model-name:hover { color: var(--link); }
.model-provider {
  font-family: var(--sans); font-size: 0.75rem; color: var(--text-muted);
}
.model-badge {
  font-family: var(--sans); font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 5px; border-radius: 3px;
}
.model-badge.open-weight { background: #e8f5e9; color: #2e7d32; }
.model-badge.reasoning { background: #fff3e0; color: #e65100; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.tag {
  font-family: var(--sans); font-size: 0.7rem;
  padding: 2px 8px; border-radius: 3px;
  background: #f0f0ec; color: var(--text-muted); border: 1px solid var(--border);
}

/* Sort toolbar & pagination */
.list-toolbar {
  font-family: var(--sans); font-size: 0.75rem;
  margin-bottom: 1rem; padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.sort-links { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); }
.sort-link {
  padding: 3px 8px; border-radius: 3px; text-decoration: none;
  color: var(--link); border: 1px solid transparent;
}
.sort-link:hover { border-color: var(--border); background: #f5f5f2; }
.sort-link.active { font-weight: 700; border-color: var(--border); background: #f0f0ec; color: var(--text); }

.pagination {
  font-family: var(--sans); font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.pagination-info { color: var(--text-muted); }

.model-bars { display: flex; flex-direction: column; gap: 3px; }

.bar-row {
  display: flex; align-items: center; gap: 0.5rem;
}
.bar-label {
  font-family: var(--sans); font-size: 0.65rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  min-width: 3.5rem; text-align: right;
}
.bar-track {
  flex: 1; height: 12px; background: #e8e8e4; border-radius: 2px;
  overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.3s ease;
}
.bar-quality { background: linear-gradient(90deg, #2d7d46, #4caf50); }
.bar-price { background: linear-gradient(90deg, #1565c0, #42a5f5); }
.bar-value {
  font-family: var(--sans); font-size: 0.7rem; color: var(--text-muted);
  min-width: 8rem; text-align: left; white-space: nowrap;
}

.model-stats {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; min-width: 5rem;
}
.model-value {
  display: flex; align-items: baseline; gap: 0.3rem;
}
.value-stars {
  font-size: 0.85rem; color: #f9a825; letter-spacing: -1px;
}
.value-num {
  font-family: var(--sans); font-size: 0.75rem; font-weight: 700; color: var(--text);
}
.model-ctx {
  font-family: var(--sans); font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase;
}
.model-price-change {
  font-family: var(--sans); font-size: 0.65rem; font-weight: 700;
  padding: 1px 4px; border-radius: 3px;
}
.price-down { background: #e8f5e9; color: #2e7d32; }
.price-up { background: #fce4ec; color: #c62828; }

/* === Pricing table === */
.pricing-table {
  width: 100%; border-collapse: collapse;
  margin-top: 1rem; font-size: 0.9rem;
}
.pricing-table th,
.pricing-table td {
  padding: 0.5rem 0.75rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.pricing-table thead th {
  font-family: var(--sans); color: var(--text-muted);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 700; border-bottom: 2px solid #222;
}
.pricing-table tbody th { font-weight: 700; color: var(--text); }
.pricing-table tbody tr:hover td,
.pricing-table tbody tr:hover th { background: #f0f0ea; }

/* === Cards === */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.card {
  display: block; padding: 1rem;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-card); text-decoration: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--border-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  color: var(--text); text-decoration: none;
}
.card-title {
  font-family: var(--sans); font-size: 1rem; font-weight: 700;
  margin-bottom: 0.3rem;
}
.card-desc {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem;
}
.card-stats {
  display: flex; gap: 1rem; font-family: var(--sans);
  font-size: 0.7rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em;
}

/* === SEO text === */
.seo-text {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.seo-text h2 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem;
}
.seo-text p {
  font-size: 0.9rem; color: var(--text-muted); line-height: 1.7;
}

/* === Detail sections === */
article section {
  margin-top: 1.5rem;
}
article section h2 {
  font-size: 1.15rem; font-weight: 700;
  margin-bottom: 0.5rem; padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

/* === Footer === */
footer {
  border-top: 3px solid #222; padding: 1rem;
  text-align: center; color: var(--text-muted);
  font-family: var(--sans); font-size: 0.75rem;
}
footer p { margin-bottom: 0.5rem; }
footer nav {
  display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap;
}
footer nav a {
  color: var(--text-muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.03em;
}
footer nav a:hover { color: var(--text); }
.footer-sections {
  margin-bottom: 0.5rem;
}
.footer-seo {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.footer-seo a {
  text-transform: none; letter-spacing: 0;
}
.footer-legal {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* === Legal pages === */
.legal-page section { margin-bottom: 1.5rem; }
.legal-page h2 {
  font-size: 1.15rem; font-weight: 700;
  margin-bottom: 0.4rem; border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
.legal-page h3 { font-size: 1rem; font-weight: 700; margin: 0.8rem 0 0.3rem; }
.legal-page p, .legal-page li { font-size: 0.9rem; line-height: 1.7; }
.legal-page ul { margin: 0.5rem 0 0.5rem 1.5rem; }
.legal-page address { font-style: normal; font-size: 0.9rem; line-height: 1.7; }

/* === Responsive === */
@media (max-width: 700px) {
  .nav-inner { gap: 0.5rem; flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; }
  .nav-links a { padding: 0.25rem 0.4rem; font-size: 0.7rem; }
  .hero h1 { font-size: 1.5rem; }
  .model-row { flex-wrap: wrap; }
  .model-stats { flex-direction: row; gap: 0.5rem; min-width: auto; }
  .bar-value { min-width: 6rem; }
}
