/* One shared cloud: integration events flow in, persistent teams work inside, and the local harness connects through MCP. */
.platform-section { position: relative; scroll-margin-top: 5rem; overflow-x: clip; }
.platform-inner { max-width: 1320px; margin: 0 auto; padding: 0 1.5rem; }
.platform-intro { text-align: center; margin: 0 auto 2rem; }
.platform-intro h2 {
  color: #f8fafc;
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.14;
  margin: 0 0 1.25rem;
}
.platform-intro > p {
  max-width: 740px;
  margin: 0 auto;
  color: #aab4c6;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.7;
  text-wrap: pretty;
}
.platform-intro > p > span { white-space: nowrap; color: #d8e1f2; }

/* Left to right on desktop: events, cloud, local harness. */
.platform-flow {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(96px, 145px) minmax(340px, 390px) minmax(96px, 145px) minmax(240px, 280px);
  justify-content: center;
  align-items: center;
  max-width: 1240px;
  margin: 3.5rem auto 0;
}
.platform-stage { position: relative; min-width: 0; }
.platform-caption { margin: 1rem 0 0; color: #9ca3af; font-size: .82rem; line-height: 1.6; text-align: center; text-wrap: pretty; }

.platform-events-caption { display: block; text-decoration: underline; text-decoration-color: rgba(156, 163, 175, .45); text-underline-offset: 3px; }
.platform-events-caption:hover { color: #c7dafc; }
.platform-events-caption:focus-visible { outline: 2px solid #599aff; outline-offset: 4px; border-radius: 4px; }

.platform-you { color: #599aff; font-weight: 700; }

/* Incoming events read as familiar notifications. */
.platform-events { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.platform-events li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .85rem;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  text-align: left;
}
.platform-event-logo {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  background: #192032;
  border: 1px solid #2f3a52;
  border-radius: 10px;
}
.platform-event-logo img { width: 20px; height: 20px; object-fit: contain; }
.platform-events li > span:last-child { display: grid; min-width: 0; }
.platform-events strong { color: #f1f5ff; font-size: .875rem; font-weight: 600; line-height: 1.35; }
.platform-events small { color: #9ca3af; font-size: .75rem; line-height: 1.35; }

/* Borderless cloud: depth comes from a static glow behind the content. */
.platform-stage-cloud { padding: 3.25rem 2.5rem 3rem; text-align: center; isolation: isolate; }
.platform-stage-cloud::before {
  content: "";
  position: absolute;
  inset: -12% -14%;
  z-index: -1;
  background:
    radial-gradient(ellipse closest-side at 50% 42%, rgba(51, 116, 255, .26), transparent 78%),
    radial-gradient(ellipse closest-side at 30% 70%, rgba(139, 92, 246, .16), transparent 80%),
    radial-gradient(ellipse closest-side at 72% 66%, rgba(6, 182, 212, .1), transparent 80%);
  pointer-events: none;
}
.platform-brand { display: flex; align-items: center; justify-content: center; gap: .55rem; margin: 0; color: white; font-size: 1.4rem; line-height: 1; }
.platform-brand img { flex: 0 0 30px; }
.platform-brand .platform-brand-cloud { position: relative; top: -.3em; font-size: .6em; vertical-align: middle; margin-left: .1em; }
.platform-team { margin: 2rem auto 1.75rem; }
.platform-team-avatars { display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.platform-team-avatars img {
  position: relative;
  border-radius: 50%;
  border: 2px solid #0a0a14;
  box-shadow: 0 0 0 1px rgba(89, 154, 255, .55), 0 10px 30px rgba(0, 0, 0, .45);
}
.platform-team-avatars img:first-child { margin-right: -10px; }
.platform-team-avatars img:last-child { margin-left: -10px; }
.platform-team-avatars img:nth-child(2) { z-index: 1; }
.platform-team h3 { margin: 0 0 .35rem; color: #f8fafc; font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.platform-team p { margin: 0; color: #aab4c6; font-size: .95rem; }
.platform-facilities {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.platform-facilities li {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: 0;
  color: #e2e8f5;
  background: rgba(10, 10, 20, .55);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  font-size: .82rem;
  line-height: 1.2;
  white-space: nowrap;
}
.platform-facilities .platform-tooltip-trigger { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border: 0; border-radius: inherit; background: transparent; color: inherit; }
.platform-facilities svg { flex: 0 0 14px; width: 14px; height: 14px; color: #8fb4ff; }

/* Both connectors carry events and actions in both directions. */
.platform-link { position: relative; display: flex; flex-direction: column; gap: 36px; align-items: center; justify-content: center; height: 100%; min-height: 1px; }
.platform-link-track {
  position: relative;
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(89, 154, 255, .2), rgba(89, 154, 255, .75), rgba(89, 154, 255, .2));
}
.platform-link-track::after {
  content: "";
  position: absolute;
  top: -3px;
  right: 0;
  width: 7px;
  height: 7px;
  border-top: 1px solid #8fb4ff;
  border-right: 1px solid #8fb4ff;
  transform: rotate(45deg);
}
.platform-direction-label { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); color: #c7dafc; font-size: .75rem; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.platform-link-track-return::after { left: 0; right: auto; transform: rotate(-135deg); }
.platform-link-pulse { position: absolute; inset: 0 10px; animation: platform-pulse-x 3.2s cubic-bezier(.45, 0, .55, 1) infinite; }
.platform-link-pulse::before {
  content: "";
  position: absolute;
  top: -2.5px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9cc0ff;
  box-shadow: 0 0 10px 2px rgba(51, 116, 255, .7);
}
.platform-link-pulse-return { animation-direction: reverse; animation-delay: -1.6s; }
.platform-link-label {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transform: translate(-50%, -50%);
  color: #c7dafc;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  white-space: nowrap;
}
.platform-link-label img { width: 20px; height: 20px; }
/* One two-way MCP connection, with its mark below the centered arrow. */
.platform-link-mcp { flex-direction: column; gap: 12px; }
.platform-link-mcp .platform-link-label { position: static; transform: none; }
.platform-link-mcp .platform-link-track::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  width: 7px;
  height: 7px;
  border-top: 1px solid #8fb4ff;
  border-right: 1px solid #8fb4ff;
  transform: rotate(-135deg);
}
.platform-link-mcp .platform-link-pulse {
  animation: platform-mcp-pulse-x 1.8s ease-in-out infinite alternate;
}
@keyframes platform-mcp-pulse-x {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}
@keyframes platform-mcp-pulse-y {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
@keyframes platform-pulse-x {
  0% { opacity: 0; transform: translateX(0); }
  15%, 85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}
@keyframes platform-pulse-y {
  0% { opacity: 0; transform: translateY(0); }
  15%, 85% { opacity: 1; }
  100% { opacity: 0; transform: translateY(100%); }
}

/* Local harness: a compact terminal the visitor can recognize. */
.platform-stage-local { text-align: left; }
.platform-harness-icons { display: flex; align-items: center; gap: .6rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.platform-harness-icons li { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid #2f3a52; border-radius: 50%; background: #192032; }
.platform-harness-icons .platform-harness-codex { background: #000; }
.platform-harness-icons img { display: block; width: 20px; height: 20px; object-fit: contain; }
.platform-terminal {
  overflow: hidden;
  background: #0d1324;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  font: .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.platform-terminal-bar { display: flex; align-items: center; gap: .35rem; padding: .55rem .75rem; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.platform-terminal-bar > span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.platform-terminal-bar em { margin-left: .4rem; color: #9ca3af; font-style: normal; font-size: .72rem; }
.platform-terminal p { margin: 0; padding: 0 .85rem; color: #e2e8f5; }
.platform-terminal p:first-of-type { padding-top: .75rem; }
.platform-terminal p:last-child { padding-bottom: .8rem; }
.platform-terminal b { color: #599aff; font-weight: 700; }
.platform-terminal-muted { color: #9ca3af !important; }
.platform-terminal-done { color: #4ade80 !important; }

/* Let the horizontal diagram set its height on tall desktop screens. */
@media (min-width: 1101px) {
  .home-section.platform-section { min-height: 0; }
  .platform-flow .platform-stage-cloud { padding-left: 0; padding-right: 0; }
  .platform-link-track { width: min(86px, calc(100% - 24px)); }
}

@media (max-width: 1240px) {
  .platform-stage-cloud { padding-left: 1.25rem; padding-right: 1.25rem; }
}
/* Narrow layouts read top to bottom: events, cloud, local harness. */
@media (max-width: 1100px) {
  .platform-flow { grid-template-columns: minmax(0, 1fr); max-width: 460px; margin-top: 2.5rem; }
  .platform-stage-events, .platform-stage-local { text-align: center; }
  .platform-stage-events { display: flex; flex-direction: column; }
  .platform-events-caption { order: -1; margin: 0 0 1rem; }
  .platform-link { flex-direction: row; height: 64px; margin: .25rem 0 1.25rem; }
  .platform-link-in { margin-top: 1rem; }
  .platform-link-mcp { flex-direction: column; height: 84px; }
  .platform-link-mcp .platform-link-track { height: 48px; flex-shrink: 0; }
  .platform-link-mcp .platform-link-track::before { top: 0; left: -3px; transform: rotate(-45deg); }
  .platform-link-mcp .platform-link-pulse { animation-name: platform-mcp-pulse-y; }

  .platform-direction-label { top: 50%; bottom: auto; left: auto; right: 12px; transform: translateY(-50%); }
  .platform-link-track-return .platform-direction-label { left: 12px; right: auto; }
  .platform-link-track { width: 1px; height: 100%; background: linear-gradient(180deg, rgba(89, 154, 255, .2), rgba(89, 154, 255, .75), rgba(89, 154, 255, .2)); }
  .platform-link-track::after { top: auto; bottom: 0; right: -3px; transform: rotate(135deg); }
  .platform-link-track-return::after { top: 0; bottom: auto; left: -3px; right: auto; transform: rotate(-45deg); }
  .platform-link-pulse { inset: 10px 0; animation-name: platform-pulse-y; }
  .platform-link-pulse::before { top: -3px; left: -2.5px; }
  .platform-stage-cloud { padding: 2.25rem 1.25rem 2.25rem; }
  .platform-stage-cloud::before { inset: -4% -10%; }
  .platform-terminal { text-align: left; }
  .platform-harness-icons { justify-content: center; }
}
@media (max-width: 540px) {
  .platform-inner { padding: 0 1rem; }
  .platform-intro h2 { font-size: clamp(1.8rem, 7.7vw, 2.55rem); }
  .platform-intro { margin-bottom: 1.75rem; }
  .platform-brand { font-size: 1.2rem; gap: .45rem; }
  .platform-brand img { width: 26px; height: 26px; flex-basis: 26px; }
  .platform-team { margin: 1.6rem auto 1.4rem; }
  .platform-team-avatars img:nth-child(odd) { width: 44px; height: 44px; }
  .platform-team-avatars img:nth-child(2) { width: 56px; height: 56px; }
  .platform-facilities li { font-size: .78rem; }
  .platform-facilities .platform-tooltip-trigger { padding: .4rem .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .platform-link-pulse { display: none; }
}

/* Opt in only after JS has prepared the complete reveal sequence. */
.platform-reveal-ready .platform-pop { opacity: 0; visibility: hidden; }
.platform-reveal-started .platform-pop {
  animation: platform-pop-in 420ms cubic-bezier(.2, .8, .25, 1) var(--platform-pop-delay) both;
}
@keyframes platform-pop-in {
  from { opacity: 0; visibility: hidden; transform: translateY(10px) scale(.88); }
  1% { visibility: visible; }
  75% { opacity: 1; transform: translateY(-1px) scale(1.025); }
  to { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .platform-reveal-ready .platform-pop { opacity: 1; visibility: visible; animation: none; transform: none; }
}

/* Use the existing public-site tooltip surface outside animated containers. */
.platform-tooltip-trigger { padding: 0; font: inherit; cursor: help; }
.platform-tooltip-trigger:focus-visible { outline: 2px solid #599aff; outline-offset: 3px; }
.platform-harness-icons .platform-tooltip-trigger { display: grid; place-items: center; width: 100%; height: 100%; border: 0; border-radius: inherit; background: transparent; }
.platform-harness-icons .platform-harness-cluster { margin-left: auto; }
.platform-harness-cluster a { cursor: pointer; }
.platform-link-label.platform-tooltip-trigger { padding: 0; border: 0; background: transparent; }
.sg-tooltip.platform-tooltip { width: max-content; max-width: min(280px, calc(100vw - 24px)); pointer-events: auto; z-index: 10000; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
