@import "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Syne:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap";

/* ─── Design tokens ─────────────────────────────────────── */
:root {
  --background: hsl(220, 14%, 7%);
  --foreground: hsl(220, 10%, 92%);
  --card: hsl(220, 14%, 10%);
  --card-hover: hsl(220, 14%, 12%);
  --muted: hsl(220, 14%, 14%);
  --muted-foreground: hsl(220, 10%, 52%);
  --border: hsl(220, 14%, 16%);
  --primary: hsl(195, 100%, 60%);
  --secondary: hsl(260, 80%, 68%);
  --accent: hsl(155, 70%, 52%);
  --destructive: hsl(0, 72%, 58%);
  --radius: 6px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: Inter, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}
h1, h2, h3, h4, h5, h6 { font-family: Syne, sans-serif; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img, svg { display: block; }

/* ─── Layout ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 64rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
@media (min-width: 640px) { .container { padding-left: 2rem; padding-right: 2rem; } }
@media (min-width: 1024px) { .container { padding-left: 2.5rem; padding-right: 2.5rem; } }

.py-header { padding-top: 3.5rem; padding-bottom: 3.5rem; }
@media (min-width: 768px) { .py-header { padding-top: 5rem; padding-bottom: 5rem; } }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-16 { margin-top: 4rem; }
.block { display: block; }
.hidden { display: none !important; }
.inline-flex { display: inline-flex; align-items: center; gap: .375rem; }
.max-w-prose { max-width: 54ch; }

/* ─── Typography ─────────────────────────────────────────── */
.font-syne { font-family: Syne, sans-serif; }
.display-xl {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.section-title { font-size: 1.5rem; font-weight: 700; }
.quiz-banner-title { font-size: 1.25rem; font-weight: 700; }
.label-mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-accent { color: var(--accent); }
.badge-mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─── Borders & dividers ─────────────────────────────────── */
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.divider { border-top: 1px solid var(--border); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn-outline, .btn-outline-secondary, .btn-outline-accent, .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid;
  background: transparent;
  font-family: inherit;
}
.btn-outline {
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline:hover { background: var(--muted); }
.btn-outline:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-outline-secondary {
  border-color: hsl(260, 80%, 68%, 0.25);
  color: var(--secondary);
}
.btn-outline-secondary:hover { background: hsl(260, 80%, 68%, 0.08); }
.btn-outline-accent {
  border-color: hsl(155, 70%, 52%, 0.3);
  color: var(--accent);
}
.btn-outline-accent:hover { background: hsl(155, 70%, 52%, 0.08); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: hsl(220, 14%, 7%);
  font-weight: 600;
}
.btn-primary:hover { background: hsl(195, 100%, 50%); border-color: hsl(195, 100%, 50%); }

/* ─── Header links ───────────────────────────────────────── */
.header-links { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--muted-foreground);
  transition: color 0.15s;
}
.back-link:hover { color: var(--foreground); }
.hover-text { transition: color 0.15s; }
.hover-text:hover { color: var(--foreground); }

/* ─── Textarea ───────────────────────────────────────────── */
.textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-family: "IBM Plex Mono", monospace;
  font-size: .875rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea::placeholder { color: hsl(220, 10%, 35%); }
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px hsl(195, 100%, 60%, 0.2);
}

/* ─── Token stats ────────────────────────────────────────── */
.token-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}
@media (min-width: 640px) {
  .token-stats { flex-direction: row; align-items: center; justify-content: space-between; }
}
.stat-group { display: flex; align-items: center; gap: 2rem; }
.stat-item {}
.stat-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: .25rem;
}
.stat-value {
  font-family: Syne, sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.stat-divider { width: 1px; height: 2.5rem; background: var(--border); }

/* ─── Section header ─────────────────────────────────────── */
.section-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 768px) {
  .section-header { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}

/* ─── Model filter pills ─────────────────────────────────── */
.model-filter { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: .35rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { border-color: var(--primary); color: var(--primary); background: hsl(195, 100%, 60%, 0.08); }

/* ─── Pricing table ──────────────────────────────────────── */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pricing-table th {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: .75rem 1rem;
  text-align: left;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.pricing-table th:not(:first-child) { text-align: right; }
.pricing-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-table tr:hover td { background: var(--muted); }
.pricing-table td:not(:first-child) { text-align: right; font-family: "IBM Plex Mono", monospace; font-size: .8rem; }
.model-name { font-weight: 500; }
.provider-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: .65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: .15rem;
}
.cost-zero { color: var(--muted-foreground); }
.cost-low { color: var(--accent); }
.cost-mid { color: var(--foreground); }
.cost-high { color: var(--secondary); }
.cost-very-high { color: var(--destructive); }
.table-wrapper { overflow-x: auto; }
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
}

/* ─── Quiz banner ────────────────────────────────────────── */
.quiz-banner {
  border: 1px solid hsl(155, 70%, 52%, 0.25);
  border-radius: var(--radius);
  background: hsl(155, 70%, 52%, 0.05);
  padding: 1.5rem;
  margin: 2.5rem 0;
}
.quiz-banner-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}
@media (min-width: 640px) {
  .quiz-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.quiz-banner-text { flex: 1; }
.quiz-banner-cta { white-space: nowrap; flex-shrink: 0; }

/* ─── Examples grid ──────────────────────────────────────── */
.examples-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 640px) { .examples-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .examples-grid { grid-template-columns: repeat(3, 1fr); } }
.example-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.example-card:hover {
  border-color: hsl(195, 100%, 60%, 0.4);
  background: var(--card-hover);
}
.example-title { font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.example-desc { font-size: .8rem; color: var(--muted-foreground); line-height: 1.5; }

/* ─── API selector ───────────────────────────────────────── */
.api-selector { display: flex; flex-direction: column; gap: 1.5rem; }
.api-category-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: .65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: .5rem;
}
.api-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.api-chip {
  padding: .4rem .875rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  font-size: .8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.api-chip:hover { border-color: var(--secondary); color: var(--secondary); }
.api-chip.selected { border-color: var(--secondary); color: var(--secondary); background: hsl(260, 80%, 68%, 0.1); }

/* ─── Usage inputs ───────────────────────────────────────── */
.usage-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px) { .usage-grid { grid-template-columns: repeat(2, 1fr); } }
.usage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--card);
}
.usage-card-title { font-weight: 600; margin-bottom: .25rem; }
.usage-card-provider { font-size: .75rem; color: var(--muted-foreground); margin-bottom: .875rem; }
.input-row { margin-bottom: .75rem; }
.input-row:last-child { margin-bottom: 0; }
.input-label { font-size: .75rem; color: var(--muted-foreground); margin-bottom: .3rem; display: block; }
.number-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--foreground);
  font-size: .875rem;
  font-family: "IBM Plex Mono", monospace;
  transition: border-color 0.15s;
}
.number-input:focus { outline: none; border-color: var(--secondary); }

/* ─── Cost breakdown ─────────────────────────────────────── */
.cost-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) { .cost-summary { grid-template-columns: repeat(4, 1fr); } }
.cost-summary-item {
  background: var(--card);
  padding: 1.25rem;
}
.cost-summary-label { font-size: .7rem; font-family: "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); margin-bottom: .375rem; }
.cost-summary-value { font-family: Syne, sans-serif; font-size: 1.5rem; font-weight: 700; }
.cost-api-cards { display: flex; flex-direction: column; gap: .75rem; }
.cost-api-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--card);
}
.cost-api-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .875rem; }
.cost-api-name { font-weight: 600; }
.cost-api-provider { font-size: .75rem; color: var(--muted-foreground); margin-top: .15rem; }
.cost-api-monthly { font-family: Syne, sans-serif; font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.cost-api-annual { font-size: .75rem; color: var(--muted-foreground); text-align: right; margin-top: .15rem; }
.cost-tier-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  padding: .25rem 0;
  border-top: 1px solid var(--border);
}
.cost-tier-name { color: var(--muted-foreground); }
.cost-tier-amount { font-family: "IBM Plex Mono", monospace; }

/* ─── Scenario cards ─────────────────────────────────────── */
.scenario-cards { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 640px) { .scenario-cards { grid-template-columns: repeat(3, 1fr); } }
.scenario-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.scenario-card:hover { border-color: hsl(260, 80%, 68%, 0.4); background: var(--card-hover); }
.scenario-icon { font-size: 1.25rem; margin-bottom: .5rem; }
.scenario-name { font-weight: 600; font-size: .875rem; margin-bottom: .25rem; }
.scenario-desc { font-size: .8rem; color: var(--muted-foreground); line-height: 1.5; }

/* ─── Footer ─────────────────────────────────────────────── */
.footer-inner { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 640px) { .footer-inner { flex-direction: row; justify-content: space-between; align-items: flex-start; } }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease-out; }
