* { box-sizing: border-box; }

html { min-width: 0; }

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--bc-bg);
  color: var(--bc-ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }

.pricing-main {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 54px 32px 110px;
}

.pricing-hero { max-width: 900px; }
.pricing-hero h1 {
  margin: 0;
  color: var(--bc-ink-hi);
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.05;
}
.pricing-hero p,
.shell-note,
.fine-print {
  color: var(--bc-mut);
}
.pricing-hero p {
  max-width: 78ch;
  margin: 18px 0 0;
  font-size: 0.95rem;
}

.pricing-section { margin-top: 64px; }
.pricing-section > h2,
.self-host h2 {
  margin: 0 0 18px;
  color: var(--bc-ink);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.scroll-shell {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

/* the sheet reads two ways at once: a plain name for the buyer, the exact
   route for the caller. it wraps instead of scrolling, so no scroll-shell. */
.price-menu {
  padding: 18px 24px;
  border: 1px solid var(--bc-border-2);
  border-radius: 14px;
  background: var(--bc-card);
}
.price-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 7px 0;
}
.price-what {
  min-width: 0;
  color: var(--bc-ink);
  font-size: 13.5px;
}
.price-name { font-weight: 600; }
.price-note { color: var(--bc-mut); }
.price-route {
  flex-shrink: 0;
  color: var(--bc-faint);
  font-family: inherit;
  font-size: 11.5px;
  white-space: nowrap;
}
.price-amount {
  flex-shrink: 0;
  color: var(--bc-ink-hi);
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
}
.price-leader {
  min-width: 30px;
  flex: 1;
  border-bottom: 1px dotted var(--bc-dim);
  transform: translateY(-0.25em);
}
.shell-note {
  margin: 12px 0 0;
  font-size: 0.78rem;
}

.notice {
  min-height: 1.55em;
  margin: -7px 0 14px;
  color: var(--bc-amber-soft);
  font-size: 0.82rem;
}
.wallet-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 14px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--bc-green) 32%, var(--bc-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bc-green) 5%, var(--bc-card));
}
.wallet-panel[hidden] { display: none; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--bc-green-text);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* the green eyebrow is a status colour; a plain section label wears muted ink. */
.eyebrow-mut { color: var(--bc-mut); }
.wallet-balance {
  margin: 0;
  color: var(--bc-ink-hi);
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  line-height: 1;
}
.wallet-refill {
  margin: 8px 0 0;
  color: var(--bc-mut);
  font-size: 0.76rem;
}
.wallet-portal { width: auto; min-width: 145px; margin: 0; }
/* the free tier is the lead offer now, not the leftmost card in the refill
   grid. it gets the accent border the "most curled" card used to own. */
.free-band {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr) auto;
  align-items: start;
  gap: 28px;
  padding: 24px 22px;
  border: 1px solid color-mix(in srgb, var(--bc-green) 42%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bc-green) 5%, var(--bc-card));
}
.free-band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.free-band-head .eyebrow {
  margin: 0;
  color: var(--bc-ink-hi);
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-transform: none;
}
.free-band-body { min-width: 0; }
.free-lede {
  margin: 0 0 12px;
  color: var(--bc-green-text);
  font-size: 0.79rem;
}
.free-facts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--bc-mut);
  font-size: 0.79rem;
  list-style: none;
}
/* NOT display:grid. These rows carry <strong>, and a grid container turns every
   inline child into its own grid item — one fragment per row. Hang the marker
   with absolute positioning so the row stays a normal line box. */
.free-facts li {
  position: relative;
  padding-left: 1.5em;
}
.free-facts li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--bc-green-text);
}
.free-facts strong { color: var(--bc-ink-hi); font-weight: 600; }
.free-band-cta { width: auto; min-width: 150px; margin: 0; }

/* the one line that explains the shape of the sheet: a read is a lookup, a
   refresh is live work. it sits closer to the sheet than the fine print. */
.why-priced {
  max-width: 78ch;
  margin: 14px 0 0;
  color: var(--bc-ink);
  font-size: 0.82rem;
}

.payload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.payload-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  background: var(--bc-card);
}
.payload-card h3 {
  margin: 0;
  color: var(--bc-ink-hi);
  font-size: 0.95rem;
  font-weight: 500;
}
.payload-route {
  display: block;
  margin: 5px 0 14px;
  color: var(--bc-faint);
  font-family: inherit;
  font-size: 11.5px;
  overflow-wrap: anywhere;
}
.payload-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  color: var(--bc-mut);
  font-size: 0.76rem;
  list-style: none;
}
/* same reason as .free-facts li: these rows carry <strong>, <em> and <code>. */
.payload-card li {
  position: relative;
  padding-left: 1.1em;
}
.payload-card li::before {
  content: '\00b7';
  position: absolute;
  left: 0;
  color: var(--bc-green-text);
}
.payload-card strong { color: var(--bc-ink); font-weight: 600; }
.payload-card em { color: var(--bc-ink); font-style: normal; text-decoration: underline dotted; }
.payload-card code {
  color: var(--bc-ink);
  font-family: inherit;
  font-size: 0.95em;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.plan-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  background: var(--bc-card);
}
.plan-card-build,
.plan-card.is-current {
  border-color: color-mix(in srgb, var(--bc-green) 42%, transparent);
}
.plan-card-head {
  min-height: 29px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.plan-card h3 {
  margin: 0;
  color: var(--bc-ink-hi);
  font-size: 1rem;
  font-weight: 500;
}
.plan-chip-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.plan-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--bc-green) 32%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bc-green) 8%, transparent);
  color: var(--bc-green-text);
  font-size: 0.64rem;
  line-height: 1;
  white-space: nowrap;
}
[data-current-chip][hidden] { display: none; }
.plan-price {
  margin: 14px 0 22px;
  color: var(--bc-ink-hi);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.plan-wallet,
.plan-translation,
.plan-detail { margin: 0; font-size: 0.79rem; }
.plan-wallet { color: var(--bc-ink); }
.plan-translation { margin-top: 3px; color: var(--bc-mut); }
.plan-detail {
  min-height: 3.5em;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--bc-hairline);
  color: var(--bc-ink);
}
.plan-features {
  display: grid;
  gap: 8px;
  margin: 18px 0 24px;
  padding: 0;
  color: var(--bc-mut);
  font-size: 0.75rem;
  list-style: none;
}
.plan-features li {
  display: grid;
  grid-template-columns: 1.1em minmax(0, 1fr);
  gap: 6px;
}
.plan-features li::before { content: '✓'; color: var(--bc-green-text); }

.plan-cta {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 9px 14px;
  border: 1px solid var(--bc-border-2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.plan-cta[hidden] { display: none; }
.plan-cta-outline { background: var(--bc-surface); color: var(--bc-ink-hi); }
.plan-cta-outline:hover {
  border-color: color-mix(in srgb, var(--bc-green) 36%, transparent);
  background: color-mix(in srgb, var(--bc-green) 8%, transparent);
}
.plan-cta-primary {
  border-color: var(--bc-green);
  background: var(--bc-green);
  color: var(--bc-bg);
}
:root[data-theme="light"] .plan-cta-primary { color: var(--bc-ink-hi); }
.plan-cta-primary:hover { background: var(--bc-green-hi); }
.plan-cta:hover { transform: translateY(-1px); }
.plan-cta:disabled {
  cursor: default;
  opacity: 0.58;
  transform: none;
}

.self-host {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 18px;
  padding: 22px 20px;
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  background: var(--bc-card);
}
.self-host h2 { margin-bottom: 6px; }
.self-host p { margin: 0; color: var(--bc-mut); font-size: 0.8rem; }
.self-host-cta { width: auto; min-width: 145px; margin: 0; flex-shrink: 0; }
.section-lede {
  max-width: 78ch;
  margin: -6px 0 18px;
  color: var(--bc-mut);
  font-size: 0.8rem;
}
.top-up-section { scroll-margin-top: 24px; }
/* the top-up section owns its own status line so errors land beside the
   controls instead of a full section up, next to the refill grid. it keeps
   .notice's reserved min-height on purpose: a live region that is display:none
   when its text arrives is not in the a11y tree to announce it. */
.top-up-notice { margin: -8px 0 12px; }
.top-up-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.top-up-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  background: var(--bc-card);
}
.top-up-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.top-up-preset {
  min-height: 42px;
  border: 1px solid var(--bc-border-2);
  border-radius: 999px;
  background: var(--bc-surface);
  color: var(--bc-ink-hi);
  cursor: pointer;
  font-size: 0.8rem;
}
.top-up-preset:hover {
  border-color: color-mix(in srgb, var(--bc-green) 36%, transparent);
  background: color-mix(in srgb, var(--bc-green) 8%, transparent);
}
.top-up-preset:disabled { cursor: default; opacity: 0.58; }
.custom-top-up label {
  display: block;
  color: var(--bc-ink-hi);
  font-size: 0.78rem;
}
.custom-top-up label span { color: var(--bc-mut); }
.custom-top-up-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.custom-top-up-row > span { color: var(--bc-mut); }
.custom-top-up input {
  min-width: 0;
  width: 100%;
  height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--bc-border-2);
  border-radius: 9px;
  background: var(--bc-surface);
  color: var(--bc-ink-hi);
  font: inherit;
  font-size: 0.8rem;
}
.custom-top-up input:focus-visible { outline: 2px solid var(--bc-green); outline-offset: 2px; }
.custom-top-up .plan-cta { width: auto; min-width: 126px; margin: 0; }
.custom-top-up .plan-cta:disabled { cursor: default; opacity: 0.58; }
.table-scroll {
  border: 1px solid var(--bc-border);
  border-radius: 12px;
}
table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  background: var(--bc-card);
  font-size: 0.78rem;
  text-align: left;
}
th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--bc-hairline);
  border-left: 1px solid var(--bc-hairline);
  font-weight: 400;
  vertical-align: top;
}
th:first-child,
td:first-child { border-left: 0; }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }
thead th { color: var(--bc-ink-hi); font-weight: 500; }
tbody th { width: 31%; color: var(--bc-mut); }
tbody td { width: 34.5%; color: var(--bc-ink); }

.faq details { border-top: 1px solid var(--bc-hairline); }
.faq details:last-of-type { border-bottom: 1px solid var(--bc-hairline); }
.faq summary {
  padding: 16px 4px;
  color: var(--bc-ink-hi);
  cursor: pointer;
  font-size: 0.86rem;
}
.faq details p {
  max-width: 78ch;
  margin: -4px 4px 18px;
  color: var(--bc-mut);
  font-size: 0.8rem;
}
.fine-print {
  margin: 54px 0 0;
  font-size: 0.72rem;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--bc-green);
  outline-offset: 3px;
}

@media (max-width: 980px) {
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payload-grid { grid-template-columns: minmax(0, 1fr); }
  /* the band's three tracks stop fitting well before the cards do */
  .free-band { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .free-band-cta { width: 100%; }
}

/* the one-line row needs room for the longest name, its route, a leader, and a
   price that is sometimes a sentence. below that, the route drops to a second
   line rather than the sheet growing a horizontal scrollbar. */
@media (max-width: 940px) {
  /* the price stays on the name's line; the 40% basis is what keeps it there —
     at basis:auto a long name claims the whole flex line and orphans the price
     below it. a price that is a phrase rather than a number ("$0.30 hosted ·
     $0.10 caller key") still cannot fit beside the name, so it takes the next
     line, right-aligned, on purpose. */
  .price-row { flex-wrap: wrap; gap: 2px 12px; padding: 9px 0; }
  .price-what { flex: 1 1 40%; }
  /* narrow enough and both halves wrap rather than run off the card: there is
     no leader here to absorb the slack. */
  .price-amount { order: 2; flex-shrink: 1; margin-left: auto; }
  .price-route {
    order: 3;
    flex-basis: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .price-leader { display: none; }
}

@media (max-width: 620px) {
  .pricing-main { padding: 38px 18px 80px; }
  .pricing-section { margin-top: 52px; }
  .plans-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-card { padding: 20px 18px 18px; }
  .self-host { align-items: flex-start; flex-direction: column; }
  .self-host-cta { width: 100%; }
  .price-menu { padding: 14px 18px; }
  .free-band { padding: 20px 18px; }
  .payload-card { padding: 18px; }
  .wallet-panel { align-items: flex-start; flex-direction: column; }
  .wallet-portal { width: 100%; }
  .top-up-grid { grid-template-columns: minmax(0, 1fr); }
  .top-up-presets { gap: 6px; }
  /* keep the amount field readable instead of squeezing it under the button */
  .custom-top-up-row { flex-wrap: wrap; }
  .custom-top-up-row input { flex: 1 1 8ch; }
  .custom-top-up .plan-cta { width: 100%; }
  table { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .plan-cta { transition: none; }
  .plan-cta:hover { transform: none; }
}
