/* ============================================================
   AI API Pricing — shared design system
   Concept: a live pricing ledger. Numbers are typeset like a
   meter readout; prose is calm and readable. Freshness is the
   product, so every price carries a visible verification age.
   ============================================================ */

:root {
  --ink: #0B0D0E;
  --surface: #15181A;
  --surface-raised: #1C2023;
  --paper: #F5F3EE;
  --paper-dim: #C9C5BB;
  --muted: #6B7480;
  --line: #2A2F33;
  --green: #3DDC84;
  --amber: #E8B339;
  --orange: #FF6B4A;
  --red: #FF4A4A;
  --focus: #6FE3FF;

  --mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 3px;
  --max-w: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- ticker header ---------- */
.ticker {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 7px 0;
  white-space: nowrap;
  overflow: hidden;
}
.ticker .wrap { display: flex; align-items: center; gap: 10px; }
.ticker .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(61,220,132,.5);
  animation: pulse 2.4s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61,220,132,.45); }
  70% { box-shadow: 0 0 0 6px rgba(61,220,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker .dot { animation: none; }
}

/* ---------- header / nav ---------- */
header.site {
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
}
header.site .wrap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
  color: var(--paper);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.logo span { color: var(--green); }
.logo:hover { text-decoration: none; }

nav.crumbs {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
nav.crumbs a { color: var(--paper-dim); }

/* hamburger for mobile */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
@media (max-width: 600px) {
  .nav-toggle { display: block; }
  nav.crumbs { width: 100%; flex-direction: column; align-items: flex-start; display: none; }
  nav.crumbs.open { display: flex; }
}

/* ---------- hero ---------- */
.hero {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  max-width: 760px;
}
.hero p.lede {
  font-size: 18px;
  color: var(--paper-dim);
  max-width: 600px;
  margin: 0 0 22px;
}
.hero .meta-row {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.hero .meta-row strong { color: var(--green); font-weight: 500; }

/* ---------- search bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 4px;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 12px;
  width: 100%;
  max-width: 400px;
  transition: border-color .15s ease;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { outline: none; border-color: var(--focus); }
.search-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.no-results {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

/* ---------- category grid (hub page) ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 36px 0;
}
.cat-card {
  background: var(--surface);
  padding: 22px;
  transition: background .15s ease;
}
.cat-card:hover { background: var(--surface-raised); }
.cat-card .num { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cat-card h3 { margin: 8px 0 6px; font-size: 18px; }
.cat-card p { margin: 0 0 12px; color: var(--paper-dim); font-size: 14px; }
.cat-card a.go { font-family: var(--mono); font-size: 13px; }

/* ---------- pricing table ---------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* No overflow:hidden — it breaks sticky thead */
  overflow-x: auto;
  margin: 12px 0 28px;
}
table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  /* Ensure rounded corners still clip the table inside the wrapper */
  border-radius: var(--radius);
}
table.ledger thead tr th:first-child { border-top-left-radius: var(--radius); }
table.ledger thead tr th:last-child  { border-top-right-radius: var(--radius); }

table.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  /* Sticky header disabled — overflow:auto on parent would clip it anyway.
     Use a plain non-sticky thead for reliable cross-browser alignment. */
}
table.ledger td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.ledger tr:last-child td { border-bottom: none; }
table.ledger tbody tr:hover td { background: var(--surface); }
table.ledger .tool-name {
  font-weight: 600;
  color: var(--paper);
}
table.ledger .vendor {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
table.ledger .price {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--green);
  white-space: nowrap;
}
table.ledger .price.na { color: var(--muted); }
table.ledger .sub {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* freshness pulse */
.fresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.fresh .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.fresh.fresh-green .dot { background: var(--green); }
.fresh.fresh-amber .dot { background: var(--amber); }
.fresh.fresh-orange .dot { background: var(--orange); }

/* ---------- tool detail page ---------- */
.tool-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
}
.tool-header .vendor-tag {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tool-header h1 { margin: 8px 0 14px; font-size: clamp(28px, 4vw, 40px); }
.price-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 18px 0;
  flex-wrap: wrap;
}
.price-block .big-price {
  font-family: var(--mono);
  font-size: 36px;
  color: var(--green);
  font-weight: 600;
}
.price-block .unit {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 32px 0;
}
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel h3 {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 14px;
}
.panel.pros h3 { color: var(--green); }
.panel.cons h3 { color: var(--orange); }
.panel ul { margin: 0; padding-left: 18px; }
.panel li { margin-bottom: 8px; color: var(--paper-dim); font-size: 14px; }

.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 24px 0;
}
.fact {
  background: var(--surface);
  padding: 16px 18px;
}
.fact .k { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-family: var(--mono); font-size: 15px; color: var(--paper); margin-top: 4px; }
@media (max-width: 700px) { .fact-grid { grid-template-columns: 1fr; } }

.source-note {
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 14px;
  margin: 28px 0;
}
.source-link {
  font-family: var(--mono);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

/* ---------- category pillar page ---------- */
.cat-intro {
  font-size: 17px;
  color: var(--paper-dim);
  max-width: 720px;
  margin: 18px 0 28px;
}
.takeaways {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 28px 0 36px;
}
.takeaways .section-label { margin-bottom: 14px; }
.takeaways ul { margin: 0; padding-left: 0; list-style: none; }
.takeaways li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--paper-dim);
  line-height: 1.5;
}
.takeaways li:last-child { margin-bottom: 0; }
.takeaways li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--green);
  font-family: var(--mono);
}

/* ---------- cost calculator ---------- */
.calculator {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 32px 0;
}
.calc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.calc-label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--paper-dim);
  white-space: nowrap;
}
.calc-input {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--green);
  font-family: var(--mono);
  font-size: 18px;
  padding: 6px 12px;
  width: 110px;
  transition: border-color .15s;
}
.calc-input:focus { outline: none; border-color: var(--focus); }
.calc-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.calc-results { overflow-x: auto; }
table.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}
table.calc-table th {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
table.calc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.calc-table tr:last-child td { border-bottom: none; }
table.calc-table .tool-name-plain { font-weight: 600; display: block; }
table.calc-table .vendor {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}
.calc-cost {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--green);
  white-space: nowrap;
}
.calc-disclaimer {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 0;
  font-style: italic;
}

/* ---------- guide page (prose-heavy) ---------- */
.guide-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 0 40px;
}
.guide-body h2 {
  font-size: 22px;
  margin: 40px 0 14px;
  padding-top: 4px;
}
.guide-body h2:first-child { margin-top: 0; }
.guide-body p { font-size: 16px; color: var(--paper-dim); margin: 0 0 16px; }
.guide-body code {
  font-family: var(--mono);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 0.9em;
  color: var(--green);
}
.guide-body .callout {
  background: var(--surface);
  border-left: 2px solid var(--green);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 15px;
  color: var(--paper-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---------- error state ---------- */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--paper-dim);
  font-size: 14px;
}
.error-icon {
  font-size: 28px;
  color: var(--orange);
}
.retry-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paper-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 16px;
  transition: border-color .15s, color .15s;
}
.retry-btn:hover { border-color: var(--focus); color: var(--focus); }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  margin-top: 56px;
}
footer.site .wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
footer.site p {
  font-size: 13px;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}
footer.site a { color: var(--paper-dim); }
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--paper-dim); }

/* ---------- misc ---------- */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--paper-dim);
}
.section-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ---------- responsive helpers ---------- */
@media (max-width: 760px) {
  .cat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .cat-grid { grid-template-columns: 1fr; }
  table.ledger th:nth-child(3),
  table.ledger td:nth-child(3) { display: none; } /* hide free tier col on smallest screens */
}
