/*
 * BitRepo interior pages
 *
 * Extends the canonical Second Ascent system in home.css across the story,
 * borrower segments, lender page, and the internal route index.
 */

:root {
  --site-inline: max(
    var(--home-gutter),
    calc((100vw - var(--home-shell)) / 2 + var(--home-gutter))
  );
}

body.interior-page {
  overflow-x: clip;
}

.interior-page main {
  overflow: clip;
}

.redirect-page {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  padding: 32px;
  text-align: center;
}

.redirect-page img {
  width: 96px;
  height: 96px;
}

.redirect-page p {
  max-width: 36ch;
  color: var(--home-ink-body);
  font-size: 18px;
}

.redirect-page a {
  text-decoration-color: var(--home-carmine);
}

.interior-page h1,
.interior-page h2,
.interior-page h3 {
  text-wrap: balance;
}

.interior-page p,
.interior-page li,
.interior-page figcaption {
  text-wrap: pretty;
}

.num {
  font-family: var(--home-mono);
  font-variant-numeric: lining-nums tabular-nums;
}

/* Shared navigation */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-inline: var(--site-inline);
  border-bottom: 1px solid var(--home-rule);
  background: rgba(248, 246, 242, 0.97);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--home-ink);
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  aspect-ratio: 1;
  object-fit: contain;
}

.brand-name {
  font-size: 27px;
  font-weight: 640;
  letter-spacing: -0.025em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(24px, 2.5vw, 42px);
  font-size: 16px;
  font-weight: 480;
}

.nav-links > a:not(.btn-primary),
.nav-dd > summary {
  color: var(--home-ink);
  text-decoration: none;
  transition: color 160ms ease;
}

.nav-links > a:not(.btn-primary):hover,
.nav-links > a[aria-current="page"],
.nav-dd > summary:hover,
.nav-dd[open] > summary {
  color: var(--home-carmine);
}

.nav-links > a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--home-carmine);
  text-underline-offset: 0.35em;
}

.nav-dd {
  position: relative;
}

.nav-dd > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  padding-block: 12px;
  cursor: pointer;
}

.nav-dd > summary::-webkit-details-marker,
.nav-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-dd-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: -20px;
  z-index: 60;
  width: min(390px, calc(100vw - 40px));
  padding: 8px 20px;
  border-radius: 14px;
  background: var(--home-paper-raised);
  box-shadow: 0 18px 44px rgba(20, 14, 12, 0.14);
}

.nav-dd-row {
  display: block;
  padding: 15px 0;
  border-bottom: 1px solid var(--home-rule-soft);
  color: var(--home-ink);
  text-decoration: none;
}

.nav-dd-row:last-child {
  border-bottom: 0;
}

.dd-name,
.dd-desc {
  display: block;
}

.dd-name {
  font-size: 15px;
  font-weight: 650;
}

.dd-desc {
  margin-top: 2px;
  color: var(--home-ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.nav-dd-row:hover .dd-name,
.nav-dd-row[aria-current="page"] .dd-name {
  color: var(--home-carmine);
  text-decoration: underline;
}

.nav-menu {
  display: none;
}

/* Shared actions */

.btn-primary,
.btn-secondary {
  min-height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px 24px;
  border-radius: 0;
  font-family: var(--home-font);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition:
    background 180ms var(--home-ease),
    border-color 180ms var(--home-ease),
    color 180ms var(--home-ease),
    transform 180ms var(--home-ease),
    box-shadow 180ms var(--home-ease);
}

.btn-primary {
  border: 1px solid var(--home-carmine);
  background: var(--home-carmine);
  color: var(--home-white);
}

.btn-primary::after {
  content: "";
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("./assets/icons/arrow-right.svg") center / contain no-repeat;
  mask: url("./assets/icons/arrow-right.svg") center / contain no-repeat;
  transition: transform 180ms var(--home-ease);
}

.nav-links > .btn-primary {
  min-width: 206px;
  min-height: 50px;
  padding: 13px 20px;
  font-size: 15px;
}

.btn-secondary {
  border: 1px solid var(--home-ink);
  background: transparent;
  color: var(--home-ink);
}

.text-link {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px solid var(--home-carmine);
  color: var(--home-ink);
  font-size: 16px;
  font-weight: 520;
  text-decoration: none;
  transition: color 160ms ease;
}

.text-link:hover {
  color: var(--home-carmine);
}

.btn-primary:active,
.btn-secondary:active {
  transform: translateY(0) scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    border-color: var(--home-carmine-dark);
    background: var(--home-carmine-dark);
    color: var(--home-white);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(168, 13, 24, 0.23);
  }

  .btn-primary:hover::after {
    transform: translateX(3px);
  }

  .btn-secondary:hover {
    border-color: var(--home-carmine);
    color: var(--home-carmine);
  }
}

/* Segment-page hero */

.interior-page .hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  align-items: center;
  gap: clamp(64px, 8vw, 138px);
  padding: clamp(66px, 6.5vw, 100px) var(--site-inline) clamp(72px, 7vw, 108px);
  border-bottom: 1px solid var(--home-rule);
}

.hero-copy {
  max-width: 760px;
}

.hero-copy > .overline {
  display: none;
}

.hero-copy h1 {
  max-width: 780px;
  color: var(--home-ink);
  font-size: clamp(54px, 5.3vw, 78px);
  font-weight: 560;
  font-variation-settings: "wdth" 94, "opsz" 64;
  letter-spacing: -0.038em;
  line-height: 0.99;
}

.lede {
  max-width: 680px;
  margin-top: 30px;
  color: var(--home-ink-body);
  font-size: clamp(19px, 1.45vw, 22px);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-top: 36px;
}

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px 15px;
  margin-top: 42px;
  padding-block: 17px;
  border-top: 1px solid var(--home-rule);
  border-bottom: 1px solid var(--home-rule-soft);
  color: var(--home-ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.stat-strip b {
  color: var(--home-ink);
  font-weight: 600;
}

.strip-dot {
  width: 3px;
  height: 3px;
  background: var(--home-carmine);
}

/* Risk and evidence artifacts */

.risk-card,
.source-panel,
.ledger-panel {
  width: min(100%, 462px);
  justify-self: end;
  padding: 26px 30px 32px;
  border-radius: 16px;
  background: var(--home-card);
  color: var(--home-white);
  box-shadow: 0 18px 32px -16px rgba(0, 0, 0, 0.46);
}

.risk-card-head {
  display: grid;
  grid-template-columns: 1fr auto 28px;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--home-card-rule);
}

/* Lender trade card: the mark leads the title at every breakpoint. */
#trade-card .risk-card-head {
  grid-template-columns: 32px minmax(0, 1fr);
}

#trade-card .risk-card-head::after {
  content: none;
}

#trade-card-title {
  margin: 0;
  color: var(--home-white);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

#trade-card .risk-row-btc-yield {
  padding-block: 22px;
}

#trade-card .risk-row-btc-yield > span:first-child {
  color: var(--home-white);
  font-size: 17px;
}

#trade-card .risk-row-btc-yield > span:last-child {
  font-size: 30px;
  line-height: 1.2;
}

.risk-card-head::after {
  content: "";
  width: 28px;
  height: 28px;
  background: url("./assets/logo-mark-carmine.svg") center / contain no-repeat;
}

.overline,
.sample-tag,
.ledger-head,
.step-num {
  font-family: var(--home-mono);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.overline,
.sample-tag,
.ledger-head {
  font-size: 12px;
  text-transform: uppercase;
}

.risk-card-head .overline,
.risk-card-head .sample-tag {
  color: var(--home-card-muted);
}

.risk-row {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding-block: 13px;
  border-bottom: 1px solid var(--home-card-rule);
  font-size: 15px;
}

.risk-row > span:first-child {
  color: var(--home-card-muted);
}

.risk-row > span:last-child {
  max-width: 220px;
  color: var(--home-white);
  text-align: right;
}

.risk-row-em > span:first-child,
.risk-row-em > span:last-child {
  font-weight: 650;
}

.risk-note {
  max-width: 46ch;
  padding-top: 18px;
  color: var(--home-card-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Editorial sections and ruled schedules */

.interior-page .section {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: clamp(88px, 9vw, 138px) var(--site-inline);
  border-top: 1px solid var(--home-rule);
}

.interior-page .section:first-child {
  border-top: 0;
}

.section > .overline {
  color: var(--home-ink-muted);
}

.section > .overline.sq::before {
  content: "";
  width: 20px;
  height: 1px;
  display: inline-block;
  margin-right: 10px;
  vertical-align: 0.3em;
  background: var(--home-carmine);
}

.lede-wide {
  max-width: 880px;
  margin-top: 0;
  font-size: clamp(23px, 2.2vw, 34px);
  line-height: 1.42;
  letter-spacing: -0.018em;
}

.section-note,
.section-note-lg {
  max-width: 760px;
  color: var(--home-ink-muted);
  font-size: 14px;
  line-height: 1.55;
}

.lane-rows {
  display: flex;
  flex-direction: column;
}

.lane-row {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(260px, 1.55fr) minmax(170px, 0.7fr);
  align-items: center;
  gap: clamp(28px, 4vw, 68px);
  padding-block: 20px;
  border-top: 1px solid var(--home-rule);
}

.lane-row:last-child {
  border-bottom: 1px solid var(--home-rule);
}

.lane-name {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lane-desc {
  color: var(--home-ink-body);
  line-height: 1.6;
}

.lane-repay {
  color: var(--home-ink-muted);
  font-size: 12px;
  text-align: right;
}

.steps {
  display: flex;
  flex-direction: column;
}

.step {
  min-height: 142px;
  display: grid;
  grid-template-columns: 80px minmax(220px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(28px, 5vw, 82px);
  padding-block: 26px;
  border-top: 1px solid var(--home-rule);
}

.step:last-child {
  border-bottom: 1px solid var(--home-rule);
}

.step-num {
  color: var(--home-carmine);
  font-size: 13px;
}

.step h3 {
  font-size: clamp(23px, 2vw, 30px);
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.step p {
  max-width: 620px;
  color: var(--home-ink-body);
  line-height: 1.65;
}

/* Dark capital-source section */

.interior-page .section.source {
  border-top-color: var(--home-card-rule);
  background: var(--home-card);
  color: var(--home-white);
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(390px, 0.9fr);
  align-items: center;
  gap: clamp(64px, 9vw, 144px);
}

.source-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}

.interior-page .section.source .source-copy h2 {
  max-width: 720px;
  color: var(--home-white);
  font-size: clamp(48px, 5.3vw, 78px);
  font-weight: 560;
  font-variation-settings: "wdth" 94, "opsz" 64;
  letter-spacing: -0.038em;
  line-height: 0.99;
}

.interior-page .section.source .source-copy p {
  max-width: 650px;
  color: #d5d1ce;
  font-size: 17px;
  line-height: 1.65;
}

.interior-page .section.source .source-copy .text-link {
  color: var(--home-white);
}

.source-panel,
.ledger-panel {
  width: 100%;
  box-shadow: none;
  outline: 1px solid var(--home-card-rule);
}

.ledger-head {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--home-card-rule);
  color: var(--home-card-muted);
}

.ledger-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--home-card-rule);
}

.ledger-row .lk {
  color: var(--home-card-muted);
  line-height: 1.45;
}

.ledger-row .lv {
  color: var(--home-white);
  text-align: right;
  white-space: nowrap;
}

.ledger-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 18px;
  color: var(--home-white);
  font-weight: 600;
}

.ledger-src {
  color: var(--home-card-muted);
  font-size: 11px;
  font-weight: 400;
}

/* FAQ and close */

.faq-list {
  width: min(100%, 920px);
}

.faq-item {
  border-top: 1px solid var(--home-rule);
}

.faq-item:last-child {
  border-bottom: 1px solid var(--home-rule);
}

.faq-item summary {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 20px;
  list-style: none;
  cursor: pointer;
  font-size: clamp(19px, 1.7vw, 24px);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--home-carmine);
  font-family: var(--home-mono);
  font-size: 22px;
  font-weight: 400;
  transition: transform 180ms var(--home-ease);
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  max-width: 760px;
  padding: 0 48px 24px 0;
  color: var(--home-ink-body);
  line-height: 1.65;
}

/* Story */

.story-hero,
.story-chapter,
.story-timeline,
.team-section {
  padding-inline: var(--site-inline);
}

.story-hero {
  min-height: min(780px, calc(100svh - 90px));
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: center;
  gap: clamp(56px, 9vw, 150px);
  padding-block: clamp(78px, 8vw, 122px);
  border-bottom: 1px solid var(--home-rule);
}

.story-hero h1 {
  max-width: 900px;
  font-size: clamp(60px, 6vw, 92px);
  font-weight: 560;
  font-variation-settings: "wdth" 104, "opsz" 72;
  letter-spacing: -0.04em;
  line-height: 0.99;
}

.story-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  margin-top: 32px;
  font-size: 17px;
  font-weight: 620;
}

.story-byline span {
  color: var(--home-ink-muted);
  font-weight: 400;
}

.story-hero-mark {
  width: min(100%, 330px);
  aspect-ratio: 1;
  justify-self: center;
  object-fit: contain;
}

.story-chapter,
.story-timeline,
.team-section {
  padding-block: clamp(96px, 10vw, 152px);
  border-bottom: 1px solid var(--home-rule);
}

.story-chapter {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(56px, 10vw, 160px);
}

.story-chapter h2,
.story-timeline h2,
.team-section h2 {
  font-size: clamp(48px, 5.3vw, 78px);
  font-weight: 560;
  font-variation-settings: "wdth" 94, "opsz" 64;
  letter-spacing: -0.038em;
  line-height: 0.99;
}

.story-prose {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.story-prose p {
  color: var(--home-ink-body);
  font-size: 18px;
  line-height: 1.72;
}

.story-prose a {
  text-decoration-color: var(--home-carmine);
  text-decoration-thickness: 1px;
}

.story-prose a:hover {
  color: var(--home-carmine);
}

.story-opening {
  margin-bottom: 10px;
  color: var(--home-ink) !important;
  font-size: clamp(30px, 3vw, 46px) !important;
  font-weight: 560;
  letter-spacing: -0.025em;
  line-height: 1.1 !important;
}

.story-timeline {
  background: var(--home-paper-muted);
}

.story-timeline h2 {
  max-width: 680px;
  margin-bottom: clamp(58px, 7vw, 104px);
}

.story-years {
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-years li {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1.45fr);
  gap: clamp(32px, 7vw, 112px);
  padding-block: 26px;
  border-top: 1px solid var(--home-rule);
}

.story-years li:last-child {
  border-bottom: 1px solid var(--home-rule);
}

.story-years strong {
  color: var(--home-carmine);
  font-family: var(--home-mono);
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0.04em;
}

.story-years span {
  max-width: 800px;
  color: var(--home-ink-body);
  font-size: 17px;
  line-height: 1.65;
}

.story-belief {
  background: var(--home-card);
  color: var(--home-white);
}

.story-belief .story-prose p {
  color: #d5d1ce;
}

.story-belief .story-prose strong {
  color: var(--home-white);
}

.story-belief h2 {
  color: var(--home-white);
}

.team-section {
  background: var(--home-paper);
}

.team-intro {
  max-width: 700px;
  margin-top: 26px;
  color: var(--home-ink-body);
  font-size: clamp(19px, 1.55vw, 23px);
  line-height: 1.55;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: clamp(54px, 7vw, 96px);
  border-top: 1px solid var(--home-rule);
  border-bottom: 1px solid var(--home-rule);
}

.team-member {
  min-width: 0;
  padding: clamp(28px, 4vw, 58px);
}

.team-member + .team-member {
  border-left: 1px solid var(--home-rule);
}

.team-portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--home-paper-muted);
}

.team-member h3 {
  margin-top: 28px;
  font-size: clamp(28px, 2.7vw, 40px);
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.team-role {
  margin-top: 8px;
  color: var(--home-carmine);
  font-family: var(--home-mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-bio {
  max-width: 58ch;
  margin-top: 20px;
  color: var(--home-ink-body);
  line-height: 1.65;
}

.team-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

.team-links li {
  display: flex;
}

/* Footer */

.site-footer {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-inline: var(--site-inline);
  background: var(--home-ink);
  color: var(--home-white);
}

.site-footer .brand {
  color: var(--home-white);
}

.site-footer .brand-mark-sm {
  width: 24px;
  height: 24px;
}

.site-footer .brand-name-sm {
  font-size: 17px;
  font-weight: 620;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 24px;
}

.site-footer a,
.footer-links a {
  color: #d5d1ce;
  font-size: 14px;
  text-decoration: underline;
}

.site-footer a:hover,
.footer-links a:hover {
  color: var(--home-white);
}

/* One quiet arrival, consistent with the homepage. */

@starting-style {
  .hero-copy > *,
  .risk-card,
  .story-hero-copy > *,
  .story-hero-mark {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(5px);
  }
}

.hero-copy > *,
.risk-card,
.story-hero-copy > *,
.story-hero-mark {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition:
    opacity 680ms var(--home-ease),
    transform 680ms var(--home-ease),
    filter 680ms var(--home-ease);
}

.hero-copy > :nth-child(2),
.story-hero-copy > :nth-child(2) {
  transition-delay: 90ms;
}

.hero-actions,
.story-hero-copy > :nth-child(3) {
  transition-delay: 170ms;
}

.risk-card,
.story-hero-mark {
  transition-delay: 130ms;
}

@media (max-width: 1120px) {
  .interior-page .hero {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.82fr);
    gap: 56px;
  }

  .source-grid {
    gap: 64px;
  }
}

@media (max-width: 980px) {
  .site-header {
    min-height: 76px;
  }

  .nav-links > a,
  .nav-links > .nav-dd {
    display: none;
  }

  .nav-menu {
    display: block;
    position: static;
  }

  .nav-menu > summary {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    text-align: right;
  }

  .nav-menu > summary .burger {
    display: block;
  }

  .nav-menu[open] > summary .burger line { transform-origin: center; }
  .nav-menu[open] > summary .burger line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-menu[open] > summary .burger line:nth-child(2) { opacity: 0; }
  .nav-menu[open] > summary .burger line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .nav-menu-panel {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    z-index: 60;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    padding: 20px var(--home-gutter) 28px;
    border-bottom: 1px solid var(--home-rule);
    background: var(--home-paper);
  }

  .nav-menu-group {
    display: block;
    margin-bottom: 8px;
    color: var(--home-ink-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .nav-menu-panel .nav-dd-row {
    min-height: 48px;
    padding: 12px 0;
  }

  .nav-menu-panel .dd-name {
    font-size: 17px;
    font-weight: 480;
  }

  .nav-menu-panel .dd-desc {
    display: none;
  }

  .nav-menu-rule {
    display: block;
    height: 18px;
  }

  .nav-menu-panel .nav-menu-cta {
    width: 100%;
    margin-top: 22px;
  }

  .interior-page .hero,
  .source-grid,
  .story-hero,
  .story-chapter {
    grid-template-columns: 1fr;
  }

  .interior-page .hero {
    gap: 54px;
  }

  .risk-card,
  .source-panel,
  .ledger-panel {
    width: min(100%, 560px);
    justify-self: start;
  }

  .step {
    grid-template-columns: 58px minmax(220px, 0.75fr) minmax(0, 1.25fr);
    gap: 34px;
  }

  .story-hero-mark {
    width: 220px;
    justify-self: start;
  }

  .story-chapter {
    gap: 50px;
  }
}

@media (max-width: 740px) {
  .lane-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-block: 24px;
  }

  .lane-repay {
    margin-top: 6px;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-name {
    font-size: 23px;
  }

  .interior-page .hero {
    padding-top: 54px;
  }

  .hero-copy h1,
  .story-hero h1 {
    font-size: clamp(46px, 12.5vw, 60px);
    font-variation-settings: "wdth" 96, "opsz" 60;
    letter-spacing: -0.038em;
    line-height: 1;
  }

  .lede {
    margin-top: 26px;
    font-size: 18px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .hero-actions .btn-primary {
    width: 100%;
  }

  .hero-actions .text-link {
    align-self: flex-start;
  }

  .stat-strip {
    align-items: flex-start;
  }

  .risk-card {
    padding: 22px 20px 24px;
  }

  .risk-card-head {
    grid-template-columns: 1fr 24px;
  }

  .risk-card-head .sample-tag {
    display: none;
  }

  .risk-card-head::after {
    width: 24px;
    height: 24px;
  }

  .risk-row {
    min-height: 58px;
    gap: 12px;
    font-size: 14px;
  }

  .risk-row > span:last-child {
    max-width: 170px;
  }

  .step,
  .story-years li {
    grid-template-columns: 1fr;
  }

  .step {
    gap: 8px;
    padding-block: 24px;
  }

  .step-num {
    margin-bottom: 5px;
  }

  .interior-page .section.source .source-copy h2,
  .story-chapter h2,
  .story-timeline h2,
  .team-section h2 {
    font-size: clamp(43px, 12vw, 58px);
  }

  .ledger-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-block: 15px;
  }

  .ledger-row .lv {
    text-align: left;
    white-space: normal;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .team-member + .team-member {
    border-top: 1px solid var(--home-rule);
    border-left: 0;
  }

  .story-years li {
    gap: 10px;
  }

  .story-years strong {
    font-size: 12px;
  }

  .site-footer {
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    padding-block: 32px;
  }

  .footer-links {
    flex-direction: column;
    justify-content: flex-start;
    gap: 14px;
  }
}

@media (max-width: 350px) {
  .hero-copy h1,
  .story-hero h1 {
    font-size: 44px;
    font-variation-settings: "wdth" 88, "opsz" 52;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy > *,
  .risk-card,
  .story-hero-copy > *,
  .story-hero-mark {
    transition-delay: 0ms;
  }
}

/* ------------------------------------------------------------------
   E-commerce borrower page: one type scale, one section skeleton.
   Scoped to body:is(.page-ecom, .page-agents) so other pages keep their current styles.
   ------------------------------------------------------------------ */

:is(.page-ecom, .page-agents) {
  --t-display: 72px;
  --t-h2: 44px;
  --t-h3: 24px;
  --t-lede: 20px;
  --t-body: 17px;
  --t-small: 14px;
  --t-mono: 14px;
  --t-eyebrow: 12px;
  --prose-max: 560px;
}

@media (max-width: 767px) {
  :is(.page-ecom, .page-agents) {
    --t-display: 44px;
    --t-h2: 32px;
    --t-h3: 20px;
    --t-lede: 18px;
    --t-body: 16px;
  }
}

:is(.page-ecom, .page-agents) .hero-copy h1 {
  font-size: var(--t-display);
  line-height: 1;
  letter-spacing: -0.03em;
}

:is(.page-ecom, .page-agents) .hero-copy .lede {
  max-width: var(--prose-max);
  margin-top: 26px;
  font-size: var(--t-lede);
  line-height: 1.5;
}

:is(.page-ecom, .page-agents) .eyebrow {
  margin: 0;
  color: var(--home-carmine);
  font-family: var(--home-mono);
  font-size: var(--t-eyebrow);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:is(.page-ecom, .page-agents) .h2,
:is(.page-ecom, .page-agents) .section.source .source-copy h2 {
  max-width: 720px;
  margin: 0;
  font-size: var(--t-h2);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

:is(.page-ecom, .page-agents) .section {
  gap: 24px;
  padding-block: 128px;
}

:is(.page-ecom, .page-agents) .section .lede {
  max-width: var(--prose-max);
  margin: 0;
  font-size: var(--t-lede);
  line-height: 1.5;
  letter-spacing: 0;
}

:is(.page-ecom, .page-agents) .section .body,
:is(.page-ecom, .page-agents) .section.source .source-copy p,
:is(.page-ecom, .page-agents) .step p,
:is(.page-ecom, .page-agents) .lane-desc,
:is(.page-ecom, .page-agents) .faq-item p,
:is(.page-ecom, .page-agents) .founder-name {
  max-width: var(--prose-max);
  font-size: var(--t-body);
  line-height: 1.6;
}

:is(.page-ecom, .page-agents) .section.source .source-copy {
  gap: 24px;
}

:is(.page-ecom, .page-agents) .section.source .source-copy p {
  margin: 0;
}

:is(.page-ecom, .page-agents) .section.source .source-copy .eyebrow {
  max-width: none;
  color: var(--home-carmine);
  font-size: var(--t-eyebrow);
  line-height: 1.4;
}

:is(.page-ecom, .page-agents) .step h3,
:is(.page-ecom, .page-agents) .lane-name {
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

:is(.page-ecom, .page-agents) .step {
  min-height: 0;
  padding-block: 28px;
}

:is(.page-ecom, .page-agents) .step-time,
:is(.page-ecom, .page-agents) .lane-repay,
:is(.page-ecom, .page-agents) .risk-row .num,
:is(.page-ecom, .page-agents) .ledger-row .lv,
:is(.page-ecom, .page-agents) .fact-strip .num {
  font-family: var(--home-mono);
  font-size: var(--t-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

:is(.page-ecom, .page-agents) .step-time {
  display: block;
  margin-top: 6px;
  color: var(--home-ink-muted);
  font-weight: 400;
}

:is(.page-ecom, .page-agents) .risk-row,
:is(.page-ecom, .page-agents) .ledger-row {
  min-height: 48px;
  padding-block: 12px;
  font-size: var(--t-body);
}

:is(.page-ecom, .page-agents) .risk-row > span:first-child,
:is(.page-ecom, .page-agents) .ledger-row .lk {
  opacity: 0.7;
  color: var(--home-white);
}

:is(.page-ecom, .page-agents) .risk-row-em > span:first-child {
  opacity: 1;
}

:is(.page-ecom, .page-agents) .risk-note,
:is(.page-ecom, .page-agents) .ledger-foot {
  font-size: var(--t-small);
  line-height: 1.5;
}

:is(.page-ecom, .page-agents) .faq-item summary {
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* fact strip: four items, no wrapping, 2x2 on mobile */

:is(.page-ecom, .page-agents) .fact-strip {
  display: flex;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 8px 0;
  margin: 40px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--home-rule);
  border-bottom: 1px solid var(--home-rule);
  list-style: none;
  color: var(--home-ink-muted);
  font-size: var(--t-small);
  white-space: nowrap;
}

:is(.page-ecom, .page-agents) .fact-strip li {
  display: flex;
  align-items: center;
  gap: 0.3em;
  white-space: nowrap;
}

:is(.page-ecom, .page-agents) .fact-strip li:not(:last-child)::after {
  content: "";
  width: 3px;
  height: 3px;
  margin: 0 14px;
  border-radius: 50%;
  background: var(--home-carmine);
}

:is(.page-ecom, .page-agents) .fact-strip b {
  color: var(--home-ink);
  font-weight: 600;
}

@media (max-width: 767px) {
  :is(.page-ecom, .page-agents) .fact-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }

  :is(.page-ecom, .page-agents) .fact-strip li:not(:last-child)::after {
    display: none;
  }
}

/* two cards, side by side, aligned tops */

:is(.page-ecom, .page-agents) .two-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 8px 0;
}

:is(.page-ecom, .page-agents) .two-cards .ledger-panel {
  width: 100%;
  justify-self: stretch;
}

:is(.page-ecom, .page-agents) .ledger-panel-alt {
  background: var(--home-paper-muted);
  color: var(--home-ink);
  box-shadow: none;
  outline: 1px solid var(--home-rule-soft, rgba(9, 9, 10, 0.16));
}

:is(.page-ecom, .page-agents) .ledger-panel-alt .ledger-head {
  color: var(--home-ink-muted);
  border-bottom-color: var(--home-rule-soft, rgba(9, 9, 10, 0.16));
}

:is(.page-ecom, .page-agents) .ledger-panel-alt .ledger-row {
  border-bottom-color: var(--home-rule-soft, rgba(9, 9, 10, 0.16));
}

:is(.page-ecom, .page-agents) .ledger-panel-alt .ledger-row .lk,
:is(.page-ecom, .page-agents) .ledger-panel-alt .ledger-row .lv {
  color: var(--home-ink);
}

/* two-column text sections */

:is(.page-ecom, .page-agents) .two-col {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 24px clamp(48px, 8vw, 128px);
  align-items: start;
}

:is(.page-ecom, .page-agents) .two-col > div {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

:is(.page-ecom, .page-agents) .founder-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

:is(.page-ecom, .page-agents) .founder-rows li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 0;
  border-top: 1px solid var(--home-rule);
}

:is(.page-ecom, .page-agents) .founder-rows li:last-child {
  border-bottom: 1px solid var(--home-rule);
}

:is(.page-ecom, .page-agents) .founder-name {
  font-weight: 600;
}

:is(.page-ecom, .page-agents) .founder-line {
  color: var(--home-ink-muted);
  font-size: var(--t-small);
  line-height: 1.5;
}

:is(.page-ecom, .page-agents) .founder-rows .text-link {
  align-self: flex-start;
  margin-top: 6px;
  font-size: var(--t-small);
}

@media (max-width: 767px) {
  :is(.page-ecom, .page-agents) .section {
    padding-block: 72px;
  }

  :is(.page-ecom, .page-agents) .two-cards,
  :is(.page-ecom, .page-agents) .two-col {
    grid-template-columns: 1fr;
  }
}

/* AI agents page: code in links, wrapping values in the paired cards */

.page-agents code {
  font-family: var(--home-mono);
  font-size: 0.92em;
  letter-spacing: 0;
}

.page-agents .two-cards .ledger-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.page-agents .two-cards .ledger-row .lv {
  white-space: normal;
}

/* Agent credit page: the 402/200 switch, the exchange card, the stat strip, the design-partner block */

.page-x402 .x-hero {
  align-items: center;
  padding-top: 56px;
}

.page-x402 .hero-copy {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.page-x402 .hero-copy > div > h1 {
  margin-top: 8px;
}

.page-x402 .x-switch {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  padding: 4px;
  border: 1px solid var(--home-ink);
  border-radius: 999px;
  background: var(--home-paper-raised);
  font-family: var(--home-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.page-x402 .x-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--home-ink);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), width 320ms cubic-bezier(0.2, 0.8, 0.2, 1), background 320ms ease;
}

.page-x402[data-mode="credit"] .x-thumb {
  background: var(--home-carmine);
}

.page-x402 .x-switch button {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--home-ink-muted);
  padding: 10px 18px;
  border-radius: 999px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: color 240ms ease;
}

.page-x402 .x-switch button:hover {
  color: var(--home-ink);
}

.page-x402 .x-switch button[aria-pressed="true"] {
  color: var(--home-paper);
}

.page-x402 .x-switch button:focus-visible {
  outline: 2px solid var(--home-carmine);
  outline-offset: 3px;
}

.page-x402 .x-switch.is-nudging .x-thumb {
  animation: x-nudge 700ms ease-in-out 2;
}

@keyframes x-nudge {
  0%, 100% { translate: 0 0; }
  50% { translate: 8px 0; }
}

.page-x402 .x-code.is-flipping {
  animation: x-flip 440ms ease-in-out;
}

@keyframes x-flip {
  0% { opacity: 1; transform: translateY(0); filter: blur(0); }
  50% { opacity: 0; transform: translateY(0.08em); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.page-x402 .hero-copy h1[data-show],
.page-x402 .hero-copy .lede[data-show] {
  animation: x-rise 420ms ease-out both;
}

@keyframes x-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-x402 .x-code {
  pointer-events: none;
  font-size: clamp(120px, 20vw, 330px);
  line-height: 0.85;
  letter-spacing: -0.06em;
  font-weight: 600;
  color: var(--home-carmine);
  margin-left: -0.04em;
  transition: color 400ms ease;
}

.page-x402[data-mode="credit"] .x-code {
  color: var(--home-ink);
}

.page-x402 .hero-copy .lede {
  margin-top: 0;
}

.page-x402 .x-note {
  color: var(--home-ink-muted);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.04em;
}

/* mode switching */

.page-x402 [data-show] {
  display: none;
}

.page-x402[data-mode="today"] [data-show="today"],
.page-x402[data-mode="credit"] [data-show="credit"] {
  display: block;
}

.page-x402[data-mode="today"] .x-exchange-body[data-show="today"],
.page-x402[data-mode="credit"] .x-exchange-body[data-show="credit"] {
  display: flex;
}

.page-x402[data-mode="today"] .x-exchange-head [data-show="today"],
.page-x402[data-mode="credit"] .x-exchange-head [data-show="credit"] {
  display: inline;
}

/* exchange card */

.page-x402 .x-exchange {
  width: 100%;
  max-width: 680px;
  min-height: 372px;
  display: flex;
  flex-direction: column;
  font-family: var(--home-mono);
}

.page-x402 .x-exchange-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--home-card-rule);
  color: var(--home-card-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-x402 .x-exchange-body {
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
  font-size: clamp(13px, 0.95vw, 15px);
  line-height: 1.55;
}

.page-x402 .x-dim { color: var(--home-card-muted); }
.page-x402 .x-fg { color: var(--home-white); }
.page-x402 .x-red { color: #ff5a4e; }
.page-x402 .x-carmine { color: var(--home-carmine); }
.page-x402 .x-indent { padding-left: 22px; }
.page-x402 .x-rule { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--home-card-rule); }

.page-x402 .x-line {
  animation: x-line-in 420ms ease-out both;
}

.page-x402 .x-line:nth-child(1) { animation-delay: 60ms; }
.page-x402 .x-line:nth-child(2) { animation-delay: 260ms; }
.page-x402 .x-line:nth-child(3) { animation-delay: 460ms; }
.page-x402 .x-line:nth-child(4) { animation-delay: 660ms; }
.page-x402 .x-line:nth-child(5) { animation-delay: 860ms; }
.page-x402 .x-line:nth-child(6) { animation-delay: 1060ms; }
.page-x402 .x-line:nth-child(7) { animation-delay: 1260ms; }

@keyframes x-line-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.page-x402 .x-blink {
  animation: x-blink 1.1s steps(2, start) infinite;
}

@keyframes x-blink {
  to { visibility: hidden; }
}

/* stat strip */

.page-x402 .x-strip-section {
  padding-block: 0;
  border-top: 0;
}

.page-x402 .x-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 22px 0;
  border-bottom: 1px solid var(--home-rule);
}

.page-x402 .x-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-x402 .x-stats dt {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.page-x402 .x-stats dd {
  margin: 0;
  color: var(--home-ink-muted);
  font-size: var(--t-small);
}

/* design partners (dark) */

.page-x402 .section.source .h2 {
  color: var(--home-white);
}

.page-x402 .section.source .body,
.page-x402 .section.source p {
  color: #d5d1ce;
}

.page-x402 .section.source .two-col > div {
  gap: 24px;
}

.page-x402 .x-partner-story {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-x402 .x-request {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--home-card-rule);
  color: var(--home-card-muted);
  font-size: 13px;
  line-height: 1.5;
}

.page-x402 .x-request .x-indent {
  white-space: pre;
}

.page-x402 .x-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.page-x402 .x-two > div {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--home-card-rule);
}

.page-x402 .x-two .eyebrow {
  color: var(--home-card-muted);
}

.page-x402 .section.source .text-link {
  color: var(--home-white);
}

@media (prefers-reduced-motion: reduce) {
  .page-x402 .x-line,
  .page-x402 .x-blink {
    animation: none;
  }

  .page-x402 .x-code {
    transition: none;
  }

  .page-x402 .x-thumb,
  .page-x402 .x-code.is-flipping,
  .page-x402 .hero-copy h1[data-show],
  .page-x402 .hero-copy .lede[data-show],
  .page-x402 .x-switch.is-nudging .x-thumb {
    animation: none;
    transition: none;
  }
}

@media (max-width: 767px) {
  .page-x402 .x-hero {
    padding-top: 54px;
  }

  .page-x402 .x-stats,
  .page-x402 .x-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-x402 .x-request .x-indent {
    white-space: pre-wrap;
  }
}

/* Desktop composition; preserve the existing stacked layout through 980px. */
@media (min-width: 981px) {
  .page-x402 {
    --site-inline: max(var(--home-gutter), calc((100vw - 1248px) / 2));
    --x-column-gap: clamp(48px, 5vw, 72px);
  }

  .page-x402 .x-hero,
  .page-x402 .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--x-column-gap);
  }

  .page-x402 .x-hero {
    align-items: start;
    padding-block: 48px 64px;
  }

  .page-x402 .hero-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .page-x402 .x-switch {
    grid-area: 1 / 1;
    justify-self: start;
    line-height: 18px;
  }

  .page-x402 .x-heading {
    grid-area: 2 / 1;
    display: grid;
  }

  .page-x402 .x-code {
    grid-area: 1 / 1;
    font-size: clamp(200px, 15vw, 220px);
  }

  /* Overlap both states in their own rows so switching cannot move the CTA. */
  .page-x402 .hero-copy h1[data-show] {
    grid-area: 2 / 1;
    display: block;
    visibility: hidden;
    font-size: clamp(56px, 4.5vw, 64px);
  }

  .page-x402 .hero-copy .lede[data-show] {
    grid-area: 3 / 1;
    display: block;
    visibility: hidden;
  }

  .page-x402 .hero-copy .hero-actions {
    grid-area: 4 / 1;
    margin-top: 4px;
  }

  .page-x402 .x-exchange {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-self: start;
    margin-top: 72px; /* 48px switch + 24px copy gap; aligns with the numeral. */
  }

  .page-x402 .x-exchange-head {
    grid-area: 1 / 1;
  }

  .page-x402 .x-exchange-body[data-show] {
    grid-area: 2 / 1;
    display: flex;
    visibility: hidden;
    font-size: 15px;
  }

  .page-x402[data-mode="today"] .hero-copy [data-show="today"],
  .page-x402[data-mode="credit"] .hero-copy [data-show="credit"],
  .page-x402[data-mode="today"] .x-exchange-body[data-show="today"],
  .page-x402[data-mode="credit"] .x-exchange-body[data-show="credit"] {
    visibility: visible;
  }

  .page-x402 .section:not(.x-strip-section) {
    padding-block: 88px;
  }

  .page-x402 #talk .two-col {
    grid-template-rows: auto 1fr;
  }

  .page-x402 .x-partner-invitation {
    grid-area: 1 / 1;
  }

  /* Keep one CTA in its mobile DOM position; place it beside the invitation. */
  .page-x402 .two-col > .x-partner-copy {
    display: contents;
  }

  .page-x402 .x-partner-story {
    grid-area: 1 / 2 / 3;
  }

  .page-x402 .x-partner-copy .hero-actions {
    grid-area: 2 / 1;
    align-self: start;
    margin-top: 0;
  }

  .page-x402 .x-request .x-indent {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}
