/* Sumongo motion — shared styles (sm-motion.css)
 * Everything is scoped under .sm. Tokens fall back to the page's own
 * custom properties (--ink, --muted, --line, --paper, --font) when present.
 * Stage content is sized in em; the stage font-size scales with the
 * component width (container query units), so there is no layout shift.
 */
.sm {
  --sm-font: var(--font, 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif);
  --sm-ink: var(--ink, #232323);
  --sm-ink-2: #4a4a52;
  --sm-muted: var(--muted, #797979);
  --sm-faint: #a8a8b0;
  --sm-line: var(--line, #e9e9e9);
  --sm-line-soft: #efeff2;
  --sm-paper: var(--paper, #ffffff);
  --sm-bg: #fafafa;
  --sm-accent: #716cc6;
  --sm-accent-ink: #5a55ad;
  --sm-accent-soft: #eeedf8;
  --sm-accent-tint: #f7f6fc;
  --sm-accent-line: #dcd9ed;
  --sm-dark: #272727;
  --sm-ok: #2f8a5a;
  --sm-ok-soft: #edf6ef;
  --sm-warm-soft: #fbf4e8;
  --sm-warm: #a9742a;
  --sm-radius: 11px;
  --sm-radius-sm: 7px;
  --sm-shadow: 0 7px 25px rgba(42, 35, 56, .06);
  --sm-shadow-lift: 0 14px 34px rgba(42, 35, 56, .14);
  container-type: inline-size;
  font-family: var(--sm-font);
  color: var(--sm-ink);
  background: var(--sm-paper);
  border: 1px solid var(--sm-line);
  border-radius: 14px;
  box-shadow: var(--sm-shadow);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.sm *, .sm *::before, .sm *::after { box-sizing: border-box; }
.sm button { font: inherit; color: inherit; }

/* ----- stage ------------------------------------------------------- */
.sm-stage {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fcfcfd 0%, #f6f6f8 100%);
  font-size: 13px;
  font-size: clamp(7.5px, 1.42cqw, 16px);
  line-height: 1.4;
  aspect-ratio: 2 / 1;
  user-select: none;
  -webkit-user-select: none;
}
@supports not (font-size: 1cqw) {
  .sm-stage { font-size: clamp(7.5px, 1.2vw, 16px); }
}
.sm-stage::before { /* soft dotted grid, like a desk */
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(35, 35, 35, .055) 1px, transparent 1.2px);
  background-size: 1.6em 1.6em;
  pointer-events: none;
}
.sm-flights { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.sm-ghost { position: absolute; transform-origin: 0 0; opacity: 0; will-change: transform, opacity; }
.sm-ghost-in { width: 100%; height: 100%; will-change: transform; }
.sm-ghost-in > * { width: 100%; height: 100%; margin: 0; }
.sm-paths { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 5; }
.sm-path { fill: none; stroke: var(--sm-accent); stroke-width: 1.5; stroke-linecap: round; opacity: .95; }
.sm-path.is-soft { stroke: #b9b4de; stroke-width: 1.3; }
.sm-dot { fill: var(--sm-accent); opacity: 0; filter: drop-shadow(0 0 4px rgba(113, 108, 198, .55)); }
.sm-ring { fill: none; stroke: var(--sm-accent); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }

/* cursor */
.sm-cursor { position: absolute; left: 0; top: 0; z-index: 8; opacity: 0; pointer-events: none; will-change: transform; }
.sm-cursor-ring { position: absolute; left: -.55em; top: -.55em; width: 1.9em; height: 1.9em; border-radius: 50%; border: 2px solid var(--sm-accent); opacity: 0; transform: scale(.2); }
.sm-cursor-tip { display: block; width: 1.5em; height: 1.5em; transform-origin: 15% 10%; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .28)); }
.sm-cursor-tip path { fill: #ffffff; stroke: #1c1c1f; stroke-width: 1.6; stroke-linejoin: round; }

/* ----- UI atoms (sample UI drawn inside stages) --------------------- */
.sm-win {
  position: relative;
  background: var(--sm-paper);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius);
  box-shadow: var(--sm-shadow);
  min-width: 0;
}
.sm-win-head {
  display: flex; align-items: center; justify-content: space-between; gap: .8em;
  padding: .85em 1.2em;
  border-bottom: 1px solid var(--sm-line-soft);
  font-size: .86em; color: var(--sm-muted);
}
.sm-win-head strong { color: var(--sm-ink); font-weight: 550; }
.sm-win-head > span { display: inline-flex; align-items: center; gap: .5em; min-width: 0; }
.sm-win-body { padding: 1.1em 1.2em; }
.sm-svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sm-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 1.75em; height: 1.75em; border-radius: 50%;
  background: var(--sm-accent-soft); color: var(--sm-accent-ink);
  font-size: .78em; font-weight: 600; letter-spacing: .02em;
}
.sm-avatar.is-dark { background: var(--sm-dark); color: #fff; }
.sm-chip {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .32em .65em; border-radius: 999px;
  background: #f3f3f5; color: var(--sm-ink-2);
  font-size: .8em; font-weight: 500; line-height: 1.2; white-space: nowrap;
  border: 1px solid transparent;
}
.sm-chip .sm-svg { width: 1.05em; height: 1.05em; stroke-width: 1.8; }
.sm-chip.is-accent { background: var(--sm-accent-soft); color: var(--sm-accent-ink); }
.sm-chip.is-outline { background: var(--sm-paper); border-color: var(--sm-line); }
.sm-chip.is-ok { background: var(--sm-ok-soft); color: var(--sm-ok); }
.sm-chip.is-warm { background: var(--sm-warm-soft); color: var(--sm-warm); }
.sm-badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .25em .55em; border-radius: 5px;
  background: var(--sm-accent-soft); color: var(--sm-accent-ink);
  font-size: .72em; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.sm-badge.is-ok { background: var(--sm-ok-soft); color: var(--sm-ok); }
.sm-badge.is-neutral { background: #f0f0f2; color: var(--sm-muted); }
.sm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .6em 1.05em; border-radius: 8px;
  background: var(--sm-dark); color: #fff; border: 1px solid var(--sm-dark);
  font-size: .86em; font-weight: 550; line-height: 1; white-space: nowrap;
  cursor: default;
}
.sm-btn.is-accent { background: var(--sm-accent); border-color: var(--sm-accent); }
.sm-btn.is-ghost { background: var(--sm-paper); color: var(--sm-ink); border-color: var(--sm-line); }
.sm-btn .sm-svg { width: 1.05em; height: 1.05em; }
.sm-brand { display: inline-flex; align-items: center; gap: .5em; font-weight: 600; letter-spacing: -.01em; color: var(--sm-ink); }
.sm-brand-mark {
  display: inline-block; width: 1.3em; height: 1.3em; border-radius: 50%;
  border: .11em solid currentColor;
  background: linear-gradient(90deg, transparent 50%, currentColor 50%);
  flex-shrink: 0;
}
.sm-check {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 1.15em; height: 1.15em; border-radius: 50%;
  border: 1.4px solid #c9c9cf; background: var(--sm-paper); color: #fff;
}
.sm-check .sm-svg { width: .75em; height: .75em; stroke-width: 2.4; opacity: 0; }
.sm-check.is-done { background: var(--sm-dark); border-color: var(--sm-dark); }
.sm-check.is-done .sm-svg { opacity: 1; }
.sm-count { position: relative; display: inline-grid; min-width: 1.5em; height: 1.5em; place-items: center; border-radius: 999px; background: #f0f0f2; color: var(--sm-muted); font-size: .72em; font-weight: 600; }
.sm-count i { grid-area: 1 / 1; font-style: normal; }
.sm-count i:not(:first-child) { opacity: 0; }
.sm-kbd { font-size: .72em; color: var(--sm-faint); border: 1px solid var(--sm-line); border-radius: 4px; padding: .1em .35em; }
.sm-field { display: grid; grid-template-columns: 4.2em 1fr; align-items: center; gap: .6em; font-size: .9em; padding: .45em 0; border-bottom: 1px solid var(--sm-line-soft); min-height: 2.4em; }
.sm-field > label { color: var(--sm-faint); font-size: .92em; }
.sm-field > div { display: flex; align-items: center; gap: .5em; min-width: 0; color: var(--sm-ink-2); }
.sm-type { display: inline-block; width: 0; white-space: nowrap; overflow: hidden; vertical-align: bottom; border-right: 1.5px solid transparent; padding-right: .08em; } /* typed in by the timeline */
.sm-row { display: flex; align-items: center; gap: .7em; padding: .72em .9em; border-radius: 8px; background: var(--sm-paper); border: 1px solid var(--sm-line-soft); font-size: .92em; }
.sm-row.is-faint { color: var(--sm-faint); border-color: transparent; background: transparent; }
.sm-row .sm-row-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-group { display: flex; align-items: center; justify-content: space-between; gap: .6em; font-size: .72em; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sm-faint); padding: .3em .2em; }
.sm-hint { display: inline-flex; align-items: center; gap: .4em; padding: .35em .6em; border-radius: 6px; background: var(--sm-dark); color: #fff; font-size: .74em; font-weight: 500; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.sm-hint { position: relative; }
.sm-hint::before { content: ''; position: absolute; left: -.5em; top: 50%; margin-top: -.4em; border: .4em solid transparent; border-left: 0; border-right-color: var(--sm-dark); }
.sm-later { opacity: 0; } /* revealed by the timeline */

/* ----- caption + controls ------------------------------------------ */
.sm-caption {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 3.4rem;
  padding: .7rem 1.4rem;
  border-top: 1px solid var(--sm-line);
  font-size: .95rem; color: var(--sm-ink);
}
.sm-caption [data-sm-caption] { opacity: 0; transform: translateY(.3em); transition: opacity .35s ease, transform .35s ease; font-weight: 500; letter-spacing: -.005em; }
.sm-caption [data-sm-caption].is-in { opacity: 1; transform: none; }
.sm-caption .sm-sample { font-size: .72rem; color: var(--sm-faint); white-space: nowrap; }
.sm-next { opacity: 0; transition: opacity .4s ease; font-size: .82rem; color: var(--sm-accent-ink); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .3em; }
.sm.is-ended .sm-next, .sm[data-sm-beat="3"] .sm-next { opacity: 1; }
.sm-next:focus-visible { outline: 2px solid var(--sm-accent-line); outline-offset: 2px; border-radius: 4px; }

.sm-controls {
  display: flex; align-items: stretch; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--sm-line);
  background: var(--sm-paper);
}
.sm-steps { display: flex; flex: 1 1 auto; min-width: 0; }
.sm-step {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: .5rem;
  padding: 1rem 1.2rem 1.1rem;
  background: none; border: 0; border-right: 1px solid var(--sm-line-soft);
  font-size: .86rem; color: var(--sm-muted); text-align: left; cursor: pointer;
}
.sm-step:last-child { border-right: 0; }
.sm-step > span:first-child { font-size: .7rem; color: var(--sm-faint); font-variant-numeric: tabular-nums; }
.sm-step.is-current { color: var(--sm-ink); font-weight: 550; }
.sm-step.is-done { color: var(--sm-ink-2); }
.sm-step .sm-step-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--sm-accent); transform: scaleX(0); transform-origin: left; opacity: .35; }
.sm-step.is-current .sm-step-bar { opacity: 1; }
.sm-step.is-done .sm-step-bar { opacity: .3; }
.sm-step:hover { color: var(--sm-ink); background: #fcfcfd; }
.sm-step:focus-visible { outline: 2px solid var(--sm-accent-line); outline-offset: -4px; border-radius: 6px; }
.sm-actions { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-left: 1px solid var(--sm-line-soft); }
.sm-ctl {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .8rem; border-radius: 8px; border: 1px solid var(--sm-line);
  background: var(--sm-paper); color: var(--sm-ink); font-size: .8rem; font-weight: 500; cursor: pointer;
  min-width: 6.2rem; justify-content: center;
}
.sm-ctl:hover { background: #f7f7f9; }
.sm-ctl:focus-visible { outline: 2px solid var(--sm-accent-line); outline-offset: 2px; }
.sm-ctl .sm-svg { width: .9rem; height: .9rem; }
.sm-ctl .sm-ico-pause { display: none; }
.sm.is-playing .sm-ctl .sm-ico-pause { display: block; }
.sm.is-playing .sm-ctl .sm-ico-play { display: none; }
.sm-ctl.is-replay { min-width: 0; }
.sm.is-reduced [data-sm-play] { display: none; }
.sm-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The page-level "Pause motion" toggle: freeze everything in place */
body.motion-paused .sm-caption [data-sm-caption] { transition: none; }

/* ----- narrow layouts ---------------------------------------------- */
@container (max-width: 640px) {
  .sm-caption { flex-direction: column; align-items: flex-start; gap: .35rem; min-height: 0; }
  .sm-controls { flex-direction: column; }
  .sm-actions { border-left: 0; border-top: 1px solid var(--sm-line-soft); justify-content: flex-end; }
  .sm-step { padding: .8rem .5rem .9rem; font-size: .74rem; flex-direction: column; align-items: flex-start; gap: .15rem; }
}

/* Readable fallback only when the browser cannot render the supplied scene. */
.sm .sm-static-summary{display:none;margin:1.25rem;box-shadow:none}
.sm.is-static .sm-stage{display:none}.sm.is-static .sm-static-summary{display:block}
.sm .sm-static-summary ol{padding-left:1.25rem;margin:0;font-size:14px;line-height:1.7}
.sm .sm-static-summary li+li{margin-top:.65rem}.sm [hidden]{display:none!important}
