/* AI payment infrastructure page — credit-loop card, story panels, roles table,
   connect steps, pricing models grid, limits notes, cross-links */

/* More breathing room between sections on this page (dense midsection) */
:root {
  --pillar-section-y: 3rem;
  --pillar-section-y-end: 1.5rem;
}

/* —— Credit loop card (hero, right column) —— */
.credit-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(13, 18, 30, 0.055);
  display: flex;
  flex-direction: column;
  height: 100%;
}
html[data-theme='dark'] .credit-card {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}
.credit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.credit-card-head b {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.credit-card-tag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.credit-bal {
  padding: 0.95rem 0.95rem 0.2rem;
}
.credit-bal-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.credit-bal-num small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 0.4rem;
}
.credit-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 26, 40, 0.06);
  border: 1px solid var(--line);
  margin-top: 0.7rem;
  overflow: hidden;
}
html[data-theme='dark'] .credit-bar {
  background: rgba(231, 237, 255, 0.05);
}
.credit-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.25s ease, background 0.2s;
}
.credit-fill.zero {
  background: var(--rose);
}
.credit-stages {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.4rem 0.2rem;
}
.credit-stages li {
  display: grid;
  grid-template-columns: 20px 1fr 72px;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s, opacity 0.15s;
}
.credit-stages li:hover {
  background: rgba(20, 26, 40, 0.035);
}
html[data-theme='dark'] .credit-stages li:hover {
  background: rgba(231, 237, 255, 0.04);
}
.credit-stages li.cur {
  background: var(--callout-bg);
}
.credit-stages li.future {
  opacity: 0.38;
}
.credit-stages .n {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}
.credit-status {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  padding: 3px 0;
}
.credit-status.allow {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.credit-status.mid {
  background: var(--callout-bg);
  color: var(--blue);
}
.credit-status.block {
  background: color-mix(in srgb, var(--rose) 14%, transparent);
  color: var(--rose);
}
.credit-decision {
  margin: 0.4rem 0.95rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(20, 26, 40, 0.025);
  border: 1px solid var(--line);
  min-height: 112px;
}
html[data-theme='dark'] .credit-decision {
  background: rgba(231, 237, 255, 0.03);
}
.credit-decision.block {
  background: color-mix(in srgb, var(--rose) 9%, transparent);
  border-color: transparent;
}
.credit-decision b {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.credit-decision p {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.credit-decision .buy {
  border: 0;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 9px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.credit-scrub {
  padding: 0.8rem 0.95rem 0.3rem;
}
.credit-scrub label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.credit-scrub input[type='range'] {
  --range-pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.credit-scrub input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--blue) var(--range-pct),
    rgba(20, 26, 40, 0.1) var(--range-pct)
  );
}
html[data-theme='dark'] .credit-scrub input[type='range']::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--blue) var(--range-pct),
    rgba(231, 237, 255, 0.12) var(--range-pct)
  );
}
.credit-scrub input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}
.credit-scrub input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 26, 40, 0.1);
  border: 0;
}
html[data-theme='dark'] .credit-scrub input[type='range']::-moz-range-track {
  background: rgba(231, 237, 255, 0.12);
}
.credit-scrub input[type='range']::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--blue);
}
.credit-scrub input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}
.credit-scrub input[type='range']:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.credit-card-foot {
  padding: 0.55rem 0.95rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* —— Problem story: two-panel comparison —— */
.story-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
  border-top: 1px solid var(--line);
}
.story-section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.story-section .lede {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}
.story-section .lede + .lede {
  margin-top: 0.85rem;
}
.story-section .lede strong {
  color: var(--ink);
}
.story-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.story-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 1.1rem 1.1rem 1.2rem;
}
.story-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  letter-spacing: -0.015em;
}
.story-panel .cap {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.story-log {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.85;
  color: var(--muted);
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: rgba(20, 26, 40, 0.025);
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre;
}
html[data-theme='dark'] .story-log {
  background: rgba(231, 237, 255, 0.03);
}
.story-log em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

/* —— Who does what: roles table —— */
.roles-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.roles-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.roles-section .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 42em;
  font-size: 0.98rem;
  line-height: 1.6;
}
.roles-section .sub.note-line {
  margin: 1.35rem 0 0;
  font-size: 0.9rem;
}
.data-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  background: var(--card);
}
.data-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  padding: 1rem 1.35rem;
  background: rgba(20, 26, 40, 0.025);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
html[data-theme='dark'] .data-table th {
  background: rgba(231, 237, 255, 0.03);
}
.data-table td {
  padding: 1.05rem 1.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--muted);
  line-height: 1.6;
}
.data-table td:first-child {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.data-table tr:last-child td {
  border-bottom: 0;
}

/* —— Connect Stripe in four steps —— */
.connect-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.connect-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.connect-section .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 42em;
  font-size: 0.98rem;
  line-height: 1.6;
}
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.step-list > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 1rem;
  padding: 0 0 1.75rem;
  position: relative;
}
.step-list > li::before {
  content: counter(step);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 1;
}
.step-list > li::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.step-list > li:last-child::after {
  display: none;
}
.step-list h3 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.step-list p {
  margin: 0;
  color: var(--muted);
  max-width: 36em;
  font-size: 0.92rem;
  line-height: 1.6;
}

.code-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 1rem 0 0;
  max-width: 460px;
}
.code-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(20, 26, 40, 0.025);
}
html[data-theme='dark'] .code-block-head {
  background: rgba(231, 237, 255, 0.03);
}
.code-copy {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.code-copy:hover {
  background: var(--card);
  color: var(--ink);
}
.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--ink);
}
.code-block pre .tok-cm {
  color: var(--muted);
}

/* —— Pricing models grid —— */
.models-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.models-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.models-section .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 42em;
  font-size: 0.98rem;
  line-height: 1.6;
}
.models-section .sub.note-line {
  margin: 1.35rem 0 0;
  font-size: 0.9rem;
}
.models-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}
.model {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.5rem;
}
.model b {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 0.4rem;
}
.model span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* —— What this doesn't do: limit notes —— */
.limits-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.limits-section h2 {
  margin: 0 0 1.35rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.limit-note {
  border: 1px solid color-mix(in srgb, var(--rose) 28%, var(--line));
  border-left: 3px solid var(--rose);
  background: color-mix(in srgb, var(--rose) 7%, var(--card));
  border-radius: 12px;
  padding: 1.1rem 1.35rem;
  margin: 0 0 1rem;
  max-width: 46em;
}
.limit-note:last-child {
  margin-bottom: 0;
}
.limit-note b {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 0.95rem;
}
.limit-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* —— Cross-sell links (3-up) —— */
.relate-section {
  padding: var(--pillar-section-y) 0 var(--pillar-section-y-end);
}
.relate-section h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.cross-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}
.cross-links a {
  display: block;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 1.35rem 1.35rem;
  color: var(--ink);
  text-decoration: none;
}
.cross-links a:hover {
  border-color: var(--blue);
}
.cross-links b {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}
.cross-links span {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .story-panels {
    grid-template-columns: 1fr;
  }
  .models-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .cross-links {
    grid-template-columns: 1fr;
  }
}

/* —— Dark closer CTA (page-specific: shared .cta-band is a light card elsewhere) —— */
.cta-band {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
}
.cta-band p {
  color: color-mix(in srgb, var(--btn-primary-ink) 70%, transparent);
}
.cta-band .btn-primary {
  background: var(--btn-primary-ink);
  color: var(--btn-primary-bg);
  border-color: var(--btn-primary-ink);
}
.cta-band .docs-link {
  color: color-mix(in srgb, var(--btn-primary-ink) 78%, transparent);
}
.cta-band .docs-link:hover {
  color: var(--btn-primary-ink);
  border-bottom-color: color-mix(in srgb, var(--btn-primary-ink) 40%, transparent);
}
