/* A customer's finance stack, before Light and with it (partials/stack-merge.njk, drawn by
   /assets/js/stack-merge.js): a hub, as the sales deck draws it. It sits on a light panel and
   builds on the redesign's tokens, so the dark theme comes with it: white cards (--surface) with
   the card shadow, soft rings, dashed spokes, and the Light tile in the inverse colours. */
.sx { --ease: cubic-bezier(.22, 1, .36, 1); color: var(--fg); font-family: var(--sans); }

/* the pill and the count */
.sx-bar { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.sx-toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--hair); border-radius: 999px; }
.sx-toggle::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--fg); transition: transform .45s var(--ease); }
.sx[data-mode="after"] .sx-toggle::before { transform: translateX(100%); }
.sx-toggle button { appearance: none; position: relative; z-index: 1; border: 0; background: none; padding: 11px 22px; font: 500 15px/1.2 var(--sans); color: var(--lgrey); cursor: pointer; border-radius: 999px; white-space: nowrap; transition: color .3s; }
.sx-toggle button[aria-selected="true"] { color: var(--bg); }
.sx-toggle button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.sx:not([data-ready]) .sx-toggle { visibility: hidden; } /* with no script the pill can't switch anything */
.sx-count { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.sx-count b { font: 400 56px/1 var(--serif); font-variant-numeric: tabular-nums; }
.sx-count .w { display: inline-grid; } .sx-count .w > span { grid-area: 1 / 1; font: 500 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--lgrey); }
.sx-count .one, .sx-count.is-one .many { visibility: hidden; } .sx-count.is-one .one { visibility: visible; } /* one cell for both words: the numeral stays put */

/* the field: with no script, the tools as a plain labelled list; with it, the hub over that list */
.sx-field { position: relative; }
.sx-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 32px; }
.sx-list li { display: flex; flex-direction: column; gap: 4px; padding: 14px 0 16px; border-top: 1px solid var(--hair); }
.sx-list .j { font: 500 11px/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--lgrey); }
.sx-list .n { font: 600 18px/1.2 var(--sans); }
.sx-list .sx-light-item { display: none; }
.sx[data-ready] .sx-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sx[data-ready] .sx-list .sx-light-item { display: list-item; }
.sx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sx-scene { position: absolute; inset: 0; }
.sx:not([data-ready]) .sx-scene { display: none; }
.sx-stage { position: relative; margin: 0 auto; }

/* the rings and spokes */
.sx-lines { position: absolute; left: 0; top: 0; overflow: hidden; pointer-events: none; } /* the rings stop at the stage's edge */
.sx-lines .ring { fill: color-mix(in srgb, var(--fg) 3.5%, transparent); stroke: none; }
.sx-lines .spokes line, .sx-lines .spokes path { fill: none; stroke: var(--hair-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.sx-lines .spokes .tangle { stroke: color-mix(in srgb, var(--fg) 30%, transparent); }
.sx-lines .spokes.after line { stroke: color-mix(in srgb, var(--fg) 45%, transparent); stroke-dasharray: none; } /* with Light, one clean line each */
.sx-lines .spokes { transition: opacity .35s ease; }
.sx-lines .spokes.after { opacity: 0; }

/* a card per tool: what it did, and its name */
.sx-card { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 12px; padding: 0 16px; box-sizing: border-box; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow-sm), inset 0 0 0 1px var(--line-06); transform-origin: 50% 50%; transition: transform .9s var(--ease), opacity .45s ease, scale .5s var(--ease); }
.sx-card .w { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* the logo: the vendor's own artwork, or its initials until there is some; a group shows up to four */
.sx-card .ic { flex: 0 0 32px; display: grid; place-items: center; width: 32px; height: 32px; }
.sx-card .ic img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.sx-card .ic i { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 8px; background: color-mix(in srgb, var(--fg) 8%, transparent); font: 600 12px/1 var(--sans); font-style: normal; letter-spacing: .02em; color: var(--lgrey); }
.sx-card .ic.is-group { grid-template-columns: 1fr 1fr; gap: 2px; }
.sx-card .ic.is-group img, .sx-card .ic.is-group i { width: 15px; height: 15px; border-radius: 4px; font-size: 6.5px; }
.sx-card .j { font: 500 11px/14px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--lgrey); white-space: nowrap; }
.sx-card .n { font: 600 18px/22px var(--sans); letter-spacing: -.005em; color: var(--fg); }
/* the middle before Light: the ledger, a little larger */
.sx-card.is-core { z-index: 2; box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line-08); }
/* the middle with Light: the lockup on the inverse surface */
.sx-light { position: absolute; left: 0; top: 0; z-index: 4; display: grid; place-items: center; border-radius: 18px; background: var(--inv-bg); color: var(--inv-fg); box-shadow: var(--card-shadow); opacity: 0; transform-origin: 50% 50%; transition: transform .7s var(--ease), opacity .45s ease; }
.sx-light svg { display: block; width: auto; height: 30px; }
.sx-stage.is-instant, .sx-stage.is-instant * { transition: none !important; }

/* a phone: smaller cards, to SIZE.narrow in stack-merge.js */
.sx-stage[data-size="narrow"] .sx-card { padding: 0 10px; gap: 8px; border-radius: 12px; }
.sx-stage[data-size="narrow"] .sx-card .w { gap: 3px; }
.sx-stage[data-size="narrow"] .sx-card .j { white-space: normal; }
.sx-stage[data-size="narrow"] .sx-card .ic { flex-basis: 24px; width: 24px; height: 24px; }
.sx-stage[data-size="narrow"] .sx-card .ic i { font-size: 9px; border-radius: 6px; }
.sx-stage[data-size="narrow"] .sx-card .ic.is-group img, .sx-stage[data-size="narrow"] .sx-card .ic.is-group i { width: 11px; height: 11px; }
.sx-stage[data-size="narrow"] .sx-card .j { font-size: 10px; line-height: 13px; }
.sx-stage[data-size="narrow"] .sx-card .n { font-size: 15px; line-height: 18px; }

.sx-stage[data-size="narrow"] .sx-light svg { height: 24px; }

/* the caption: the story's own words, following the state; both share one cell, so nothing under it moves */
.sx-cap { display: grid; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--hair); }
.sx-cap p { font-size: 15px; line-height: 1.6; color: var(--lgrey); max-width: 46rem; margin: 0; }
.sx-cap b { font-weight: 500; color: var(--fg); }
.sx[data-ready] .sx-cap p { grid-area: 1 / 1; }
.sx[data-ready][data-mode="before"] .sx-cap .af, .sx[data-ready][data-mode="after"] .sx-cap .b4 { visibility: hidden; }

@media (max-width: 700px) {
  .sx-bar { flex-direction: column; align-items: flex-start; gap: 24px; margin-bottom: 20px; }
  .sx-toggle button { padding: 10px 16px; font-size: 14px; }
  .sx-cap { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .sx-toggle::before, .sx-toggle button, .sx-card, .sx-light, .sx-lines .spokes { transition: none !important; }
}
