/* Pay-Switch — the governed payment layer for agents.
   Signature element: the spend flow, where the line stays broken at the human gate. */

/* ── hero ──────────────────────────────────── */

/* the clam and its pearl sit to the right of the headline, not behind it */
.ps-hero__plate {
  inset: 0 -34% 0 auto;
  width: 134%;
  max-width: none;
  object-position: 50% 44%;
}

.ps-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 54% 86% at 14% 62%, color-mix(in oklab, var(--bg-deep) 80%, transparent), transparent 74%);
}

[data-theme="dark"] .ps-hero__plate {
  filter: brightness(0.46) saturate(0.82);
}

.ps-hero__title {
  max-width: 13ch;
}

.ps-hero__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.ps-hero__only {
  font-size: 0.875rem;
  font-weight: 520;
  color: var(--ink-2);
}

@media (max-width: 760px) {
  /* phones: the photograph becomes a header and fades out before the copy */
  .ps-hero {
    min-height: auto;
  }

  .ps-hero__plate {
    inset: 0;
    width: 100%;
    height: 62%;
    object-position: 46% 40%;
    -webkit-mask-image: linear-gradient(to bottom, #000 36%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 36%, transparent 100%);
  }

  .ps-hero::before,
  .ps-hero::after {
    display: none;
  }

  .ps-hero .page-hero__inner {
    padding-top: clamp(220px, 58vw, 300px);
  }
}

/* ── facts ─────────────────────────────────── */

.ps-facts__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px var(--gutter);
}

.ps-fact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ps-fact__value {
  order: 1;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 1.1em;
  font-size: clamp(2.4rem, 4.2vw, 3.75rem);
  line-height: 1;
  font-weight: 360;
  font-stretch: 86%;
  letter-spacing: -0.04em;
}

.ps-fact__label {
  order: 2;
  font-size: 0.9375rem;
  font-weight: 540;
  color: var(--ink-2);
  max-width: 26ch;
}

.ps-fact__code {
  padding: 0;
  background: none;
  font-size: 0.82em;
  letter-spacing: -0.02em;
  color: var(--current);
}

[data-theme="dark"] .ps-fact__code {
  color: var(--link);
}

@media (max-width: 900px) {
  .ps-facts__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── what changes ──────────────────────────── */

.ps-changes__title {
  max-width: 20ch;
}

.ps-changes__lede {
  margin-top: 18px;
}

.ps-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(36px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

.ps-col {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 28px 28px 8px 0;
}

.ps-col + .ps-col {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.ps-col p {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.ps-col__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--held-soft);
  color: var(--held);
}

.ps-col:nth-child(2) .ps-col__icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.ps-col:nth-child(3) .ps-col__icon {
  background: color-mix(in oklab, var(--data-3) 18%, var(--surface));
  color: var(--data-3);
}

@media (max-width: 860px) {
  .ps-cols {
    grid-template-columns: 1fr;
  }

  .ps-col,
  .ps-col + .ps-col {
    padding: 22px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line-soft);
  }
}

/* ── spend flow: the broken line ───────────── */

.ps-flow {
  padding-bottom: var(--section-tight);
}

.ps-flow__lede {
  margin-top: 18px;
}

.ps-flow__stage {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(260px, 5fr);
  gap: 24px clamp(24px, 4vw, 64px);
  align-items: end;
  margin-top: clamp(36px, 4vw, 56px);
}

.ps-steps {
  --node: 46px;
  position: relative;
  display: grid;
  max-width: 760px;
}

/* the valve: where the line stops until you approve */
.ps-valve {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-width: 420px;
  width: 100%;
  justify-self: center;
}

.ps-valve__img {
  width: 92%;
  filter: drop-shadow(0 34px 50px rgb(11 34 48 / 0.18));
}

.ps-valve__body {
  position: relative;
  width: 82%;
  aspect-ratio: 1;
}

.ps-valve__body > span {
  position: absolute;
  border-radius: 50%;
}

/* a quiet instrument dial around the gate */
.ps-valve__dial {
  inset: 0;
  background: repeating-conic-gradient(from 0deg, var(--line-strong) 0 0.6deg, transparent 0.6deg 7.5deg);
  -webkit-mask: radial-gradient(closest-side, transparent 92%, #000 93%, #000 99%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 92%, #000 93%, #000 99%, transparent 100%);
  opacity: 0.8;
}

/* the wet-glass collar */
.ps-valve__glass {
  inset: 10%;
  background:
    radial-gradient(circle at 32% 26%, rgb(255 255 255 / 0.9), transparent 26%),
    conic-gradient(from 210deg, color-mix(in oklab, var(--held) 55%, #fff), color-mix(in oklab, var(--lilac) 70%, #fff), color-mix(in oklab, var(--accent) 40%, #fff), color-mix(in oklab, var(--held) 55%, #fff));
  -webkit-mask: radial-gradient(closest-side, transparent 62%, #000 63%);
  mask: radial-gradient(closest-side, transparent 62%, #000 63%);
  box-shadow: 0 30px 60px -24px rgb(11 34 48 / 0.35);
  opacity: 0.86;
  animation: ps-turn 48s linear infinite;
}

[data-theme="dark"] .ps-valve__glass {
  opacity: 0.6;
}

/* the lock: an accent arc with a gap where the agent's line arrives */
.ps-valve__lock {
  inset: 24%;
  background: conic-gradient(from 18deg, var(--accent) 0 324deg, transparent 324deg);
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 87%, #000 99%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 86%, #000 87%, #000 99%, transparent 100%);
  transition: transform 700ms var(--ease-spring);
}

/* the pearl: the money, held */
.ps-valve__pearl {
  inset: 33%;
  background:
    radial-gradient(circle at 34% 28%, #ffffff 0%, #fbf7ff 14%, transparent 34%),
    radial-gradient(circle at 60% 68%, color-mix(in oklab, var(--lilac) 70%, #fff) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, #f4effa 0%, #d9d0ef 56%, #a99bd4 86%, #8a7bbd 100%);
  box-shadow:
    inset -10px -14px 26px rgb(90 70 150 / 0.28),
    inset 8px 10px 18px rgb(255 255 255 / 0.6),
    0 22px 40px -14px rgb(60 40 120 / 0.45);
  transition: box-shadow 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.ps-valve__annot {
  position: absolute;
  left: 0;
  bottom: 8%;
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-float);
}

.ps-valve__annot::after {
  /* an accent leader from the label to the lock */
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  width: clamp(24px, 6vw, 64px);
  height: 1px;
  background: var(--accent);
  transform-origin: left center;
  transform: rotate(-24deg);
}

.ps-valve__annot-t {
  font-size: 0.875rem;
  font-weight: 640;
}

.ps-valve__annot-m {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* hovering the gate "opens" the valve: the arc closes and the pearl lifts */
.ps-flow__stage:has(.ps-step--gate:hover) .ps-valve__lock,
.ps-valve:hover .ps-valve__lock {
  transform: rotate(-18deg);
}

.ps-flow__stage:has(.ps-step--gate:hover) .ps-valve__pearl,
.ps-valve:hover .ps-valve__pearl {
  transform: translateY(-3px);
  box-shadow:
    inset -10px -14px 26px rgb(90 70 150 / 0.22),
    inset 8px 10px 18px rgb(255 255 255 / 0.7),
    0 0 0 6px color-mix(in oklab, var(--accent) 22%, transparent),
    0 26px 44px -14px rgb(60 40 120 / 0.5);
}

@keyframes ps-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .ps-flow__stage {
    grid-template-columns: 1fr;
  }

  .ps-valve {
    order: -1;
    max-width: 300px;
    justify-self: start;
  }
}

.ps-step {
  position: relative;
  display: grid;
  grid-template-columns: var(--node) minmax(0, 1fr) auto;
  gap: 4px 22px;
  align-items: start;
  padding-bottom: 34px;
}

.ps-step:last-child {
  padding-bottom: 0;
}

/* connector from this node to the next one */
.ps-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(var(--node) / 2 - 1px);
  top: calc(var(--node) + 6px);
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--held);
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 520ms var(--ease-out);
}

/* the last agent step does not reach the gate until you approve */
.ps-step:nth-last-child(2)::after {
  width: 0;
  background: none;
  border-left: 2px dashed color-mix(in oklab, var(--accent) 60%, var(--line-strong));
  transform: scaleY(1);
  transition: border-color var(--t-med) var(--ease-out);
}

.ps-steps.is-in .ps-step:not(:nth-last-child(2))::after {
  transform: scaleY(1);
}

.ps-steps.is-in .ps-step:nth-child(2)::after {
  transition-delay: 260ms;
}

.ps-steps:has(.ps-step--gate:hover) .ps-step:nth-last-child(2)::after {
  border-left-style: solid;
  border-left-color: var(--accent);
}

.ps-step__node {
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
  font-size: 0.8125rem;
  font-weight: 640;
  color: var(--ink-2);
  transition: background-color var(--t-med) var(--ease-out), color var(--t-med), box-shadow var(--t-med);
}

.ps-steps.is-in .ps-step:not(.ps-step--gate) .ps-step__node {
  background: var(--held);
  color: #fff;
  box-shadow: none;
}

.ps-steps.is-in .ps-step:nth-child(2) .ps-step__node {
  transition-delay: 200ms;
}

.ps-steps.is-in .ps-step:nth-child(3) .ps-step__node {
  transition-delay: 400ms;
}

[data-theme="dark"] .ps-steps.is-in .ps-step:not(.ps-step--gate) .ps-step__node {
  color: #041219;
}

.ps-step__node--gate {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1.5px var(--accent) inset;
}

.ps-step--gate:hover .ps-step__node--gate {
  background: var(--accent);
  color: #0b2230;
}

.ps-step__body {
  padding-top: 10px;
}

.ps-step__title {
  font-size: 1.1875rem;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.ps-step__body p {
  margin-top: 6px;
  color: var(--ink-2);
  max-width: 52ch;
}

.ps-step__who {
  margin-top: 12px;
  font-size: 0.8125rem;
  font-weight: 620;
  color: var(--held);
}

.ps-step--gate .status {
  margin-top: 10px;
}

.ps-flow__note {
  margin-top: 28px;
  padding-left: calc(46px + 22px);
  color: var(--ink-3);
  max-width: 60ch;
}

@media (max-width: 640px) {
  .ps-step {
    grid-template-columns: var(--node) minmax(0, 1fr);
  }

  .ps-step__who,
  .ps-step--gate .status {
    grid-column: 2;
    justify-self: start;
    margin-top: 6px;
  }

  .ps-flow__note {
    padding-left: 0;
  }
}

/* ── console ───────────────────────────────── */

.ps-console {
  padding-block: 0;
}

.ps-own {
  padding-top: var(--section-tight);
}

.ps-console__panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px 48px;
  align-items: end;
  padding: clamp(26px, 3.4vw, 48px);
  border-radius: var(--r-panel);
  background:
    radial-gradient(ellipse 60% 120% at 100% 0%, color-mix(in oklab, var(--held-soft) 80%, transparent), transparent 70%),
    var(--surface);
}

.ps-console__lede {
  margin: 12px 0 22px;
  color: var(--ink-2);
  max-width: 58ch;
}

.ps-states {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ps-state {
  --tone: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding-inline: 12px 14px;
  border-radius: var(--r-pill);
  box-shadow: 0 0 0 1px var(--line) inset;
  font-size: 0.875rem;
  font-weight: 560;
  color: var(--ink-3);
  transition: background-color var(--t-med), color var(--t-med), box-shadow var(--t-med);
}

.ps-state[data-state="authorized"] {
  --tone: var(--ok);
}

.ps-state[data-state="installed_unconfigured"] {
  --tone: var(--warn);
}

.ps-state[data-state="auth_pending"] {
  --tone: var(--held);
}

.ps-state__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tone) 45%, transparent);
}

.ps-state.is-current {
  background: color-mix(in oklab, var(--tone) 14%, var(--surface));
  box-shadow: 0 0 0 1.5px var(--tone) inset;
  color: var(--ink);
  font-weight: 640;
}

.ps-state.is-current .ps-state__dot {
  background: var(--tone);
}

.ps-console__status {
  margin-top: 14px;
  font-size: 0.9375rem;
  color: var(--ink-2);
  min-height: 1.5em;
}

.ps-console__endpoint {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.ps-console__actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

@media (max-width: 860px) {
  .ps-console__panel {
    grid-template-columns: 1fr;
  }

  .ps-console__actions {
    justify-items: start;
  }
}

/* ── your own agent ────────────────────────── */

.ps-own__lede {
  margin: 18px 0 28px;
}

.ps-own__url {
  max-width: 720px;
}

.ps-install {
  display: grid;
  gap: 2px;
  margin: 28px 0 0;
  max-width: 720px;
}

.ps-install li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}

.ps-install__n {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line-strong) inset;
  font-size: 0.8125rem;
  font-weight: 640;
}

.ps-install p {
  margin-top: 4px;
  color: var(--ink-2);
}

.ps-own__note {
  margin: 10px 0 26px;
  color: var(--ink-3);
  max-width: 60ch;
}
