/* About "Our story": one idea -> first components -> a complete system.
   Authored on a 720 x 400 stage, scaled by js/story-anim.js. Plays once when it scrolls into view.
   Not part of the generated dark theme; dark styles are at the end. */

.story__img.sx {
  aspect-ratio: 720 / 400;
  background: radial-gradient(60% 70% at 50% 42%, rgba(96, 140, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #f7f9ff, #ffffff);
  border: 1px solid #e6ecf7;
  font-family: var(--font-family);
}
.sx__stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 720px;
  height: 400px;
  transform: scale(var(--sx-s, 0.8));
  transform-origin: 0 0;
  color: #0f172a;
  background-image: radial-gradient(rgba(37, 99, 235, 0.09) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the spark ---------- */
.sx-spark {
  position: absolute;
  left: 360px;
  top: 170px;
  width: 0;
  height: 0;
  transition:
    opacity 0.5s,
    transform 0.6s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.sx-spark::before {
  content: '';
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #93b4fb, #2563eb);
  box-shadow:
    0 0 0 6px rgba(37, 99, 235, 0.12),
    0 0 30px 6px rgba(37, 99, 235, 0.35);
}
.sx-spark i {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(37, 99, 235, 0.5);
  animation: sx-ring 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
}
.sx-spark i + i {
  animation-delay: 0.9s;
}
@keyframes sx-ring {
  to {
    transform: scale(5);
    opacity: 0;
  }
}
.sx__stage:not([data-ch='0']) .sx-spark {
  opacity: 0;
  transform: scale(0.2);
}

/* ---------- column headings ---------- */
.sx-head {
  position: absolute;
  top: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #667085;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.5s 0.5s,
    transform 0.5s 0.5s;
}
.sx__stage[data-ch='2'] .sx-head {
  opacity: 1;
  transform: none;
}

/* ---------- cards: positions are set per chapter by the script ---------- */
.sx-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: var(--w);
  height: var(--h);
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e6ebf4;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 12px 28px -16px rgba(30, 50, 110, 0.3);
  opacity: var(--o, 1);
  transform: rotate(var(--rot, 0deg)) scale(var(--sc, 1));
  transition:
    left 0.9s var(--d, 0s) cubic-bezier(0.65, 0, 0.35, 1),
    top 0.9s var(--d, 0s) cubic-bezier(0.65, 0, 0.35, 1),
    width 0.9s var(--d, 0s) cubic-bezier(0.65, 0, 0.35, 1),
    height 0.9s var(--d, 0s) cubic-bezier(0.65, 0, 0.35, 1),
    transform 0.9s var(--d, 0s) cubic-bezier(0.34, 1.3, 0.64, 1),
    opacity 0.6s var(--d, 0s);
}
.sx-card small {
  font-size: 10px;
  color: #667085;
}

/* card contents */
.sx-sw {
  display: flex;
}
.sx-sw i {
  width: 22px;
  height: 22px;
  margin-right: -5px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #2563eb;
}
.sx-sw i:nth-child(2) {
  background: #93b4fb;
}
.sx-sw i:nth-child(3) {
  background: #12b76a;
}
.sx-sw i:nth-child(4) {
  background: #f79009;
}
.sx-sw i:nth-child(5) {
  background: #f04438;
}
.sx-aa {
  font-size: 26px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #2563eb;
}
.sx-sp {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 26px;
}
.sx-sp i {
  width: 8px;
  border-radius: 2px;
  background: #c7d7fe;
}
.sx-sp i:nth-child(1) {
  height: 8px;
}
.sx-sp i:nth-child(2) {
  height: 13px;
}
.sx-sp i:nth-child(3) {
  height: 19px;
}
.sx-sp i:nth-child(4) {
  height: 26px;
  background: #2563eb;
}
.sx-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.7);
}
.sx-input,
.sx-select {
  display: flex;
  align-items: center;
  width: 120px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  font-size: 10.5px;
  color: #667085;
  white-space: nowrap;
  overflow: hidden;
}
.sx-input {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  color: #0f172a;
}
.sx-select {
  justify-content: space-between;
}
.sx-select::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid #667085;
  border-bottom: 1.5px solid #667085;
  transform: rotate(45deg);
}
.sx-card[data-id='toggle'],
.sx-card[data-id='badge'] {
  flex-direction: row;
  gap: 10px;
}
.sx-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #2563eb;
}
.sx-toggle i {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
}
.sx-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
}
.sx-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 500;
}
.sx-badge--g {
  background: #ecfdf3;
  color: #067647;
}
.sx-avs {
  display: flex;
}
.sx-avs i {
  width: 26px;
  height: 26px;
  margin-right: -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(135deg, #93c5fd, #6366f1);
}
.sx-avs i:nth-child(2) {
  background: linear-gradient(135deg, #fda4af, #f97316);
}
.sx-avs i:nth-child(3) {
  background: linear-gradient(135deg, #86efac, #14b8a6);
}
.sx-avs i:nth-child(4) {
  background: #eef4ff;
}

/* mini layouts for patterns and templates */
.sx-mini {
  display: flex;
  width: 112px;
  height: 58px;
  padding: 6px;
  border-radius: 6px;
  background: #f5f7fb;
  border: 1px solid #edf0f5;
}
.sx-form {
  flex-direction: column;
  gap: 5px;
}
.sx-form i {
  height: 8px;
  border-radius: 3px;
  background: #fff;
  border: 1px solid #e4e7ec;
}
.sx-form b {
  width: 40px;
  height: 9px;
  border-radius: 3px;
  background: #2563eb;
}
.sx-dash {
  gap: 6px;
}
.sx-dash em {
  width: 18px;
  border-radius: 3px;
  background: #e4ebfb;
}
.sx-dash > span {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
  padding: 4px;
  border-radius: 3px;
  background: #fff;
}
.sx-dash i {
  flex: 1;
  border-radius: 2px;
  background: #c7d7fe;
}
.sx-dash i:nth-child(1) {
  height: 40%;
}
.sx-dash i:nth-child(2) {
  height: 65%;
}
.sx-dash i:nth-child(3) {
  height: 50%;
}
.sx-dash i:nth-child(4) {
  height: 90%;
  background: #2563eb;
}
.sx-dash i:nth-child(5) {
  height: 70%;
}
.sx-land {
  flex-direction: column;
  gap: 5px;
}
.sx-land b {
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2563eb, #93b4fb);
}
.sx-land span {
  display: flex;
  gap: 4px;
  flex: 1;
}
.sx-land i {
  flex: 1;
  border-radius: 3px;
  background: #fff;
  border: 1px solid #e4e7ec;
}

/* ---------- chapter line ---------- */
.sx-line {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
}
.sx-line::before,
.sx-line::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  height: 2px;
  border-radius: 2px;
}
.sx-line::before {
  right: 5px;
  background: #e4e9f2;
}
.sx-line::after {
  width: 0;
  background: #2563eb;
  transition: width 1.6s cubic-bezier(0.65, 0, 0.35, 1);
}
.sx__stage[data-ch='1'] .sx-line::after {
  width: 50%;
}
.sx__stage[data-ch='2'] .sx-line::after {
  width: calc(100% - 10px);
}
.sx-line span {
  position: relative;
  font-size: 12px;
  font-weight: 500;
  color: #98a2b3;
  transition: color 0.4s;
}
.sx-line span:nth-child(2) {
  transform: translateX(-50%);
  position: absolute;
  left: 50%;
}
.sx-line i {
  position: absolute;
  top: -14px;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #d0d5dd;
  transition:
    border-color 0.4s,
    background-color 0.4s;
}
.sx-line span:nth-child(2) i {
  left: 50%;
  margin-left: -5px;
}
.sx-line span:nth-child(3) i {
  left: auto;
  right: 0;
}
.sx-line span.is-on {
  color: #0f172a;
}
.sx-line span.is-on i {
  border-color: #2563eb;
  background: #2563eb;
}

/* ---------- dark ---------- */
html[data-px-theme='dark'] .story__img.sx {
  background: radial-gradient(60% 70% at 50% 42%, rgba(96, 140, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #121a2b, #0f1522);
  border-color: #243049;
}
html[data-px-theme='dark'] .sx__stage {
  color: #e9eef8;
  background-image: radial-gradient(rgba(147, 180, 251, 0.1) 1px, transparent 1px);
}
html[data-px-theme='dark'] .sx-head,
html[data-px-theme='dark'] .sx-line span {
  color: #8c98ae;
}
html[data-px-theme='dark'] .sx-line span.is-on {
  color: #fff;
}
html[data-px-theme='dark'] .sx-line::before {
  background: #2a3446;
}
html[data-px-theme='dark'] .sx-line i {
  background: #0f1522;
  border-color: #3a465c;
}

@media (prefers-reduced-motion: reduce) {
  .sx *,
  .sx *::before,
  .sx *::after {
    animation: none !important;
    transition: none !important;
  }
}
.sx-noanim *,
.sx-noanim *::after {
  transition: none !important;
}
html[data-px-theme='dark'] .sx-line span.is-on i {
  border-color: #608cff;
  background: #608cff;
}
