/* Home "Seamless integration": a token changed in Figma travels through tokens, GitHub and code,
   and the Storybook component updates. Authored on a 900 x 420 stage, scaled by js/integ-anim.js.
   Colors are fixed here (not part of the generated dark theme). */

@property --ix-accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #2563eb;
}
@property --ix-r {
  syntax: '<length>';
  inherits: true;
  initial-value: 8px;
}

.ix {
  position: relative;
  width: calc(100% + 61px);
  font-family: var(--font-family);
}
.ix__fit {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 420;
}
.ix__stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 900px;
  height: 420px;
  transform: scale(var(--ix-s, 0.9));
  transform-origin: 0 0;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

/* ---------- wire ---------- */
.ix-wire {
  position: absolute;
  inset: 0;
  width: 900px;
  height: 420px;
  overflow: visible;
}
.ix-wire path {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}
.ix-wire__base {
  stroke: #d5dcea;
  stroke-dasharray: 4 5;
}
.ix-wire__run {
  stroke: url(#ix-grad);
  stroke-dasharray: 0 1;
  stroke-linecap: round;
  opacity: 0;
}

/* ---------- windows ---------- */
.ix-win {
  position: absolute;
  top: 20px;
  display: flex;
  flex-direction: column;
  width: 372px;
  height: 380px;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e4e9f2;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 30px 60px -28px rgba(30, 50, 110, 0.28);
  transition:
    --ix-accent 0.9s cubic-bezier(0.65, 0, 0.35, 1),
    --ix-r 0.8s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.ix-fig {
  left: 0;
}
.ix-sb {
  left: 528px;
}
.ix-win[data-accent='blue'] {
  --ix-accent: #2563eb;
}
.ix-win[data-accent='violet'] {
  --ix-accent: #7c3aed;
}
.ix-win[data-radius='lg'] {
  --ix-r: 16px;
}
.ix-bar {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  flex: none;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid #eef1f6;
  font-size: 11px;
  color: #475467;
}
.ix-bar--dark {
  background: #1f2128;
  border-color: #1f2128;
  color: #c9ccd4;
}
.ix-dots {
  display: flex;
  gap: 5px;
}
.ix-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d0d5dd;
}
.ix-bar--dark .ix-dots i {
  background: #4a4e59;
}
.ix-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}
.ix-app {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}
.ix-app--fig {
  background: conic-gradient(#f24e1e 0 25%, #a259ff 0 50%, #1abcfe 0 75%, #0acf83 0);
  border-radius: 50%;
}
.ix-app--sb {
  background: #ff4785;
}
.ix-av {
  justify-self: end;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f472b6);
}

/* buttons shared by both windows */
.ix-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border-radius: var(--ix-r);
  background: var(--ix-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 14px -6px color-mix(in oklab, var(--ix-accent) 70%, transparent);
}
.ix-btn--ghost {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e4e7ec;
  box-shadow: none;
}

/* ---------- Figma ---------- */
.ix-fig__body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}
.ix-canvas {
  position: relative;
  flex: 1;
  background-color: #f4f5f7;
  background-image: radial-gradient(#d9dce3 1px, transparent 1px);
  background-size: 14px 14px;
}
.ix-frame-tag {
  position: absolute;
  left: 26px;
  top: 64px;
  font-size: 10.5px;
  font-weight: 500;
  color: #8a38f5;
}
.ix-frame {
  position: absolute;
  left: 26px;
  top: 82px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 196px;
  padding: 22px 20px;
  border-radius: 6px;
  background: #fff;
  border: 1px dashed #c4a5fb;
}
.ix-chipbar {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.ix-chipbar i {
  width: 34px;
  height: 8px;
  border-radius: 4px;
  background: #eef1f6;
}
.ix-chipbar i:first-child {
  width: 50px;
  background: color-mix(in oklab, var(--ix-accent) 20%, #fff);
}
.ix-sel {
  outline: 1.5px solid #0d99ff;
  outline-offset: 3px;
}
.ix-sel i {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fff;
  border: 1.5px solid #0d99ff;
}
.ix-sel .h1 {
  left: -7px;
  top: -7px;
}
.ix-sel .h2 {
  right: -7px;
  top: -7px;
}
.ix-sel .h3 {
  left: -7px;
  bottom: -7px;
}
.ix-sel .h4 {
  right: -7px;
  bottom: -7px;
}
.ix-size {
  position: absolute;
  left: 52px;
  top: 252px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #0d99ff;
  color: #fff;
  font-size: 10px;
}
.ix-props {
  flex: none;
  width: 124px;
  padding: 10px 10px;
  border-left: 1px solid #eceef2;
  background: #fff;
}
.ix .ix-props__tab {
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid #eceef2;
  font-size: 11px;
  font-weight: 600;
}
.ix .ix-props__h {
  margin: 12px 0 6px;
  font-size: 10px;
  font-weight: 600;
  color: #667085;
}
.ix-prop {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: #f4f5f7;
  font-size: 10.5px;
  color: #344054;
  transition:
    background-color 0.3s,
    box-shadow 0.3s;
}
.ix-prop b {
  font-size: 11px;
}
.ix-prop.is-on {
  background: #e5f3ff;
  box-shadow: inset 0 0 0 1px #0d99ff;
}
.ix-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--ix-accent);
}
.ix-corner {
  width: 11px;
  height: 11px;
  border-top: 2px solid #344054;
  border-left: 2px solid #344054;
  border-top-left-radius: calc(var(--ix-r) * 0.5);
}
.ix-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  transform: translate(var(--cx, 150px), var(--cy, 230px));
  transition: transform 0.75s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}
.ix-cursor svg {
  width: 16px;
  height: 16px;
  fill: #0d99ff;
  stroke: #fff;
  stroke-width: 1.2;
  transition: transform 0.15s;
}
.ix-cursor.is-click svg {
  transform: scale(0.8);
}
.ix-cursor span {
  margin: 12px 0 0 -2px;
  padding: 2px 6px;
  border-radius: 4px 10px 10px 10px;
  background: #0d99ff;
  color: #fff;
  font-size: 10px;
  font-weight: 500;
}

/* ---------- pipeline ---------- */
.ix-node {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
  height: 50px;
  margin-top: -25px;
  padding: 0 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e4e9f2;
  box-shadow: 0 8px 20px -12px rgba(30, 50, 110, 0.3);
  transition:
    border-color 0.4s,
    box-shadow 0.4s,
    transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.ix-node__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f2f4f7;
  color: #344054;
  font:
    600 11px/1 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-style: normal;
  transition:
    background-color 0.4s,
    color 0.4s;
}
.ix-node__ic svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}
.ix-node span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ix-node b {
  font-size: 11.5px;
  font-weight: 600;
}
.ix-node small {
  font-size: 10px;
  color: #667085;
  white-space: nowrap;
}
.ix-node.is-on {
  border-color: #b9ccff;
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.08),
    0 10px 24px -12px rgba(37, 99, 235, 0.45);
  transform: scale(1.04);
}
.ix-node.is-on .ix-node__ic {
  background: #2563eb;
  color: #fff;
}

.ix-packet {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 5px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.45);
  transform: translate(-50%, -50%) translate(var(--px, 372px), var(--py, 120px));
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.ix-packet.is-on {
  opacity: 1;
}
.ix-packet i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pk, #7c3aed);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.ix-packet em {
  font:
    500 10.5px/1 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-style: normal;
}

/* ---------- Storybook ---------- */
.ix-sb__body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.ix-sb__side {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 108px;
  padding: 10px 8px;
  border-right: 1px solid #eef1f6;
  background: #f8fafc;
  font-size: 10.5px;
  color: #475467;
}
.ix-sb__search {
  height: 24px;
  margin-bottom: 6px;
  padding: 0 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e4e7ec;
  line-height: 22px;
  color: #98a2b3;
}
.ix .ix-sb__side p {
  margin: 8px 0 4px;
  padding: 0 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #98a2b3;
}
.ix-sb__side span:not(.ix-sb__search) {
  padding: 4px 6px;
  border-radius: 5px;
}
.ix-sb__side .is-on {
  background: #ffe4ee;
  color: #c0245e;
  font-weight: 500;
}
.ix-sb__main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.ix-tabs {
  display: flex;
  gap: 14px;
  height: 32px;
  padding: 0 14px;
  border-bottom: 1px solid #eef1f6;
  font-size: 10.5px;
  color: #667085;
}
.ix-tabs span {
  display: flex;
  align-items: center;
}
.ix-tabs .is-on {
  color: #0f172a;
  font-weight: 500;
  box-shadow: inset 0 -2px #ff4785;
}
.ix-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  background-image: linear-gradient(45deg, #f6f7f9 25%, transparent 25%),
    linear-gradient(-45deg, #f6f7f9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f6f7f9 75%),
    linear-gradient(-45deg, transparent 75%, #f6f7f9 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}
.ix-preview.is-flash .ix-btn:first-child {
  animation: ix-pop 0.7s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes ix-pop {
  40% {
    transform: scale(1.08);
  }
}
.ix-code {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  background: #0f172a;
  font:
    400 10.5px/18px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: #cbd5e1;
}
.ix-ln {
  padding: 0 12px;
  white-space: nowrap;
  transition: background-color 0.4s;
}
.ix-ln i {
  display: inline-block;
  width: 16px;
  font-style: normal;
  color: #475569;
}
.ix-ln em {
  font-style: normal;
  color: #7dd3fc;
}
.ix-ln.is-on {
  background: rgba(125, 211, 252, 0.12);
  box-shadow: inset 2px 0 #7dd3fc;
}
.ix-toast {
  position: absolute;
  top: 42px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e4e9f2;
  box-shadow: 0 8px 20px -8px rgba(15, 23, 42, 0.25);
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.35s,
    transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ix-toast i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #12b76a;
  color: #fff;
  font-size: 9px;
  font-style: normal;
}
.ix-toast.is-on {
  opacity: 1;
  transform: none;
}

/* ---------- story steps ---------- */
.integ-sec .ix-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.integ-sec .ix-steps li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-3, #667085);
  transition: color 0.4s;
}
.ix-steps li::before,
.ix-steps li::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 2px;
  border-radius: 2px;
}
.ix-steps li::before {
  right: 0;
  background: var(--dk-bd-e4e9f2, #e4e9f2);
}
.ix-steps li::after {
  width: 0;
  background: var(--brand, #2563eb);
}
.ix-steps b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 600;
}
.integ-sec .ix-steps li.is-on {
  color: var(--ink, #0f172a);
}
.ix-steps li.is-on::after {
  width: 100%;
  transition: width var(--ix-dur, 1.6s) linear;
}
.ix-steps li.is-done::after {
  width: 100%;
}

html[data-px-theme='dark'] .ix-wire__base {
  stroke: #344054;
}
html[data-px-theme='dark'] .ix-win,
html[data-px-theme='dark'] .ix-node {
  border-color: #2a3446;
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .ix *,
  .ix *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 1000px) {
  .ix {
    width: 100%;
  }
}
@media (max-width: 600px) {
  .integ-sec .ix-steps {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
