/* ============================================================
   hero.css — embeddable animated walkthrough demo.

   Scoping strategy:
   - `.hero-demo` is the scoping wrapper. All CSS custom properties
     live on it (not :root), so embedding inside another page
     (e.g. connectionary) doesn't leak --bg/--muted/--line into the
     host page or vice versa.
   - All descendant resets (box-sizing/margin/padding) are scoped
     under `.hero-demo *` so the host page is untouched.
   - Add `.hero-demo.dark` modifier to render as a dark card. See the
     dark-theme variant block at the bottom of this file.
   ============================================================ */

.hero-demo {
  /* --bg is the demo card *surface* color (white), not the page background.
     The page bg is set externally by the host (connectionary uses #ffffff).
     Making --bg pure white matches connectionary's --panel and gives a clean
     card contrast against the green-tinged page. */
  --bg: #ffffff;
  --bg-soft: #eff1ed;
  --fg: #111317;
  --fg-soft: #2A2C33;
  --muted: #626873;
  --mute-2: #8a909c;

  /* Brand mint — uses connectionary's --mint #6cd2ee (was muted sage #5FB8A4).
     This is the visual cue that ties the demo into the rest of the site. */
  --accent: #6cd2ee;
  --accent-hover: #3ab6d6;
  --accent-soft: rgba(108, 210, 238, 0.14);
  --accent-softer: rgba(108, 210, 238, 0.06);
  --accent-bd: rgba(108, 210, 238, 0.42);

  /* Domain/filter tag color in ACT 1 — distinct functional color, kept as-is. */
  --filter-blue: #1e40af;
  --filter-blue-soft: rgba(30, 64, 175, 0.10);
  --filter-blue-bd: rgba(30, 64, 175, 0.32);

  /* Semantic colors — fixed brand mapping:
       관계 = 보라 (relation), 수치 = 스카이 (figure), 발언 = 주황 (quote).
     Purple & sky preserved exactly; quote nudged from amber #D97706 toward
     a clearer "주황" #EA580C so it reads as orange rather than dark amber. */
  --c-figure: #0284C7;
  --c-quote: #EA580C;
  --c-relation: #6D28D9;
  --c-figure-soft: rgba(2, 132, 199, 0.10);
  --c-quote-soft: rgba(234, 88, 12, 0.12);
  --c-relation-soft: rgba(109, 40, 217, 0.10);
  --c-figure-bd: rgba(2, 132, 199, 0.32);
  --c-quote-bd: rgba(234, 88, 12, 0.34);
  --c-relation-bd: rgba(109, 40, 217, 0.32);

  /* Lines — same alphas, just rebased on the new fg #111317 (visually identical). */
  --line: rgba(17, 19, 23, 0.08);
  --line-strong: rgba(17, 19, 23, 0.14);
  --line-soft: rgba(17, 19, 23, 0.04);

  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Pretendard", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.hero-demo *,
.hero-demo *::before,
.hero-demo *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.demo-card {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
  box-shadow:
    0 1px 2px rgba(15, 17, 21, 0.04),
    0 12px 40px rgba(15, 17, 21, 0.06);
  position: relative;
  overflow: hidden;
}
.demo-progress {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: var(--line-soft);
  z-index: 5;
}
.demo-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
  opacity: 0.85;
}

.demo-preview {
  padding: 16px 28px 14px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, var(--accent-softer) 0%, transparent 100%);
}
.demo-preview-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
  white-space: nowrap;
}
.demo-preview-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.5;
  word-break: keep-all;
}
.demo-preview-text .ent { font-weight: 800; color: var(--fg); }
.demo-preview-text .result-num{ font-weight: 800; color: var(--c-figure); font-variant-numeric: tabular-nums; }
.demo-preview-text .move { font-weight: 700; color: var(--c-relation); }
.demo-preview-topic {
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.demo-preview-sep {
  color: var(--mute-2);
  margin: 0 2px;
  font-weight: 400;
}

.demo-body {
  display: flex;
  align-items: stretch;
}
.demo-sidebar {
  flex: 0 0 240px;
  border-right: 1px solid var(--line-soft);
  padding: 18px 14px 18px 20px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, transparent 80%);
}
.demo-sidebar-title {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--mute-2);
  margin-bottom: 14px;
  padding-left: 6px;
}
.demo-sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.demo-sidebar-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 8px 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.demo-sidebar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--fg);
  border-radius: 2px;
  transition: height 0.25s ease;
}
.demo-sidebar-item:hover {
  background: rgba(17, 19, 23, 0.03);
}
.demo-sidebar-item.active {
  background: rgba(17, 19, 23, 0.04);
}
.demo-sidebar-item.active::before {
  height: 60%;
}
.demo-sidebar-item.done::before {
  height: 60%;
  background: var(--line-strong);
}

.demo-sidebar-marker {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--mute-2);
  font-variant-numeric: tabular-nums;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  margin-top: 1px;
}
/* Active (current step) — solid black filled circle with white number.
   This is the strongest visual cue; matches connectionary's `.workflow-card .num`. */
.demo-sidebar-item.active .demo-sidebar-marker {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
/* Done (past steps) — subtle gray fill with dark number. Recedes vs the active
   step but stays readable so the cycle-so-far is still visible. */
.demo-sidebar-item.done .demo-sidebar-marker {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  color: var(--fg-soft);
}
/* RESULT marker is intentionally mint — it's the brand "result-first" anchor.
   Stays mint in both default and active states (unlike numbered steps, which
   go black when active). */
.demo-sidebar-item.is-result .demo-sidebar-marker {
  background: var(--accent-soft);
  border-color: var(--accent-bd);
  color: var(--accent-hover);
  font-size: 11px;
}
.demo-sidebar-item.is-result.active .demo-sidebar-marker {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
/* Once RESULT has been visited, keep the mint marker for the rest of the
   cycle — the result-first anchor stays "lit" instead of fading to the
   neutral done-gray of numbered steps. */
.demo-sidebar-item.is-result.done .demo-sidebar-marker {
  background: var(--accent-soft);
  border-color: var(--accent-bd);
  color: var(--accent-hover);
}
/* When RESULT is active, the left rail + row tint match its mint theme
   (other active steps use the neutral black rail + tint). */
.demo-sidebar-item.is-result.active::before {
  background: var(--accent);
}
.demo-sidebar-item.is-result.active {
  background: var(--accent-softer);
}

.demo-sidebar-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.demo-sidebar-num {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--mute-2);
  transition: color 0.2s ease;
}
.demo-sidebar-item.is-result .demo-sidebar-num {
  color: var(--fg);
}
.demo-sidebar-item.active .demo-sidebar-num {
  color: var(--fg);
}
.demo-sidebar-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-soft);
  letter-spacing: -0.01em;
  line-height: 1.3;
  transition: color 0.2s ease;
}
.demo-sidebar-item.active .demo-sidebar-label {
  color: var(--fg);
  font-weight: 700;
}

.demo-sidebar-hint {
  margin-top: 14px;
  padding: 10px 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--mute-2);
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.demo-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 500px;
  overflow: hidden;
}

.act {
  position: absolute;
  inset: 0;
  padding: 24px 28px 18px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.act.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============ ACT 0 — 한눈에 보기 ============ */
.act-0 {
  justify-content: center;
  align-items: stretch;
  gap: 22px;
  padding: 16px 32px 36px;
}
.result-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.act-0.active .result-block { opacity: 1; transform: translateY(0); }
.act-0.active .result-block.result-input    { transition-delay: 0.05s; }
.act-0.active .result-funnel                { transition-delay: 0.85s; }
.act-0.active .result-block.result-insight  { transition-delay: 1.05s; }
.act-0.active .result-evidence              { transition-delay: 1.30s; }

.result-block-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--mute-2);
  margin-bottom: 8px;
}
.result-topic {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.result-entities {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.result-connector {
  display: inline-block;
  width: 18px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 1px;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  /* exit: snap back instantly so the next ACT 0 entry starts from a clean state */
  transition: transform 0.08s ease, opacity 0.06s ease;
  transition-delay: 0s;
}
.act-0.active .result-connector {
  opacity: 0.65;
  transform: scaleX(1);
  /* enter: snappy grow */
  transition: transform 0.10s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.08s ease;
}
.act-0.active .result-connector.c1 { transition-delay: 0.15s; }
.act-0.active .result-connector.c2 { transition-delay: 0.27s; }
.act-0.active .result-connector.c3 { transition-delay: 0.39s; }
.act-0.active .result-connector.c4 { transition-delay: 0.51s; }
.result-entity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  letter-spacing: -0.005em;
}
.result-entity > .fi {
  font-size: 13px;
  border-radius: 1.5px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

/* ===== flag-icons sizing per surface =====
   The flag-icons library renders each .fi as a 4:3 inline-block. We add
   subtle rounded corners and a hairline outline for crispness. Each
   surface sets its own width via font-size on the wrapper (since .fi
   uses 1em height). */
.flag-wrap {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.flag-wrap .fi {
  border-radius: 1.5px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}
/* size variants: control via font-size, since .fi height = 1em */
.entity-card-flag.flag-wrap   { font-size: 18px; margin-bottom: 7px; }
.evidence-flag.flag-wrap      { font-size: 18px; }
.mini-tl-name-flag.flag-wrap  { font-size: 13px; }

.result-funnel {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.4s ease;
  margin: -8px 0;
}
.act-0.active .result-funnel { opacity: 0.6; }
.result-funnel-arrow {
  font-size: 12px;
  color: var(--mute-2);
  line-height: 1;
  letter-spacing: 0;
}

.result-insight {
  background: var(--accent-softer);
  border: 1.5px solid var(--accent-bd);
  border-radius: 14px;
  padding: 18px 28px 14px;
  align-items: stretch;
  /* opt out of .act-0's `align-items: stretch` so the box doesn't span the
     full stage width; cap at ~720px and self-center for a tighter feel. */
  align-self: center;
  width: 100%;
  max-width: 660px;
}
.result-insight .result-block-label {
  color: var(--fg);
  margin-bottom: 12px;
  text-align: center;
}
.result-insight-text {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.result-line {
  font-size: clamp(16px, 1.7vw, 19px);
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.55;
  word-break: keep-all;
  text-wrap: pretty;
  text-align: center;
}
.result-line .ent  { font-weight: 800; color: var(--fg); }
.result-line .result-num { font-weight: 800; color: var(--c-figure); font-variant-numeric: tabular-nums; }
.result-line .rel  { font-weight: 700; color: var(--c-relation); }
.result-line .quo  { font-weight: 700; color: var(--c-quote); font-style: italic; }

.result-evidence {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--accent-bd);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.act-0.active .result-evidence { opacity: 1; transform: translateY(0); }
.result-evidence-check {
  color: var(--accent-hover);
  font-weight: 700;
  font-size: 12px;
}
.result-evidence-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  flex-wrap: wrap;
  justify-content: center;
}
.result-evidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.result-evidence-pill[data-type="relation"] {
  background: var(--c-relation-soft);
  color: var(--c-relation);
}
.result-evidence-pill[data-type="figure"] {
  background: var(--c-figure-soft);
  color: var(--c-figure);
}
.result-evidence-pill[data-type="quote"] {
  background: var(--c-quote-soft);
  color: var(--c-quote);
}
.result-evidence-pill strong {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.result-evidence-total {
  color: var(--muted);
  letter-spacing: -0.005em;
}

/* ============ ACT 1 ============ */
.act-1 {
  justify-content: center;
  align-items: center;
}
.extraction-prompt {
  font-size: 13px;
  color: var(--mute-2);
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: 24px;
}
.extraction-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 26px;
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  font-size: 26px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.015em;
  min-height: 56px;
  min-width: 340px;
  margin-bottom: 100px;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.extraction-input.processed {
  border-color: var(--accent);
  background: var(--accent-softer);
}
.extraction-input-icon {
  color: var(--accent-hover);
  font-size: 16px;
  flex-shrink: 0;
}
.extraction-input-text {
  font-variant-numeric: tabular-nums;
  position: relative;
  white-space: nowrap;
}
.src-word {
  display: inline-block;
  /* Pre-allocate the padding that glow will use, so other text doesn't shift */
  padding: 1px 5px;
  margin: 0 18px 0 0;
  border-radius: 3px;
  transition: background 0.3s ease, color 0.3s ease;
}
.src-word:first-child { margin-left: 0; }
.src-word.glow-blue {
  background: var(--filter-blue-soft);
  color: var(--filter-blue);
}
.src-word.glow-purple {
  background: var(--c-relation-soft);
  color: var(--c-relation);
}
/* the trailing word ("재편") — match src-word horizontal rhythm */
.extraction-input-text [data-tail] {
  display: inline-block;
}
.extraction-input-cursor {
  display: inline-block;
  width: 2px;
  height: 22px;
  background: var(--accent-hover);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.extraction-keywords {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 18px;
  height: 56px;
  pointer-events: none;
}
.extraction-kw {
  position: absolute;
  top: 0;
  /* `left` set via JS to align with source words above */
  transform: translate(-50%, -14px);
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.extraction-kw.in {
  opacity: 1;
  transform: translate(-50%, 0);
}
.extraction-kw::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 18px;
  background-image: linear-gradient(
    to bottom,
    currentColor 0%,
    currentColor 50%,
    transparent 50%,
    transparent 100%
  );
  background-size: 1px 4px;
  background-repeat: repeat-y;
  opacity: 0.55;
}
.extraction-kw-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 4px;
  opacity: 0.85;
}
.extraction-kw-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.extraction-kw[data-kind="domain"] {
  color: var(--filter-blue);
}
.extraction-kw[data-kind="domain"] .extraction-kw-pill {
  background: var(--filter-blue-soft);
  border-color: var(--filter-blue-bd);
}
.extraction-kw[data-kind="relation"] {
  color: var(--c-relation);
}
.extraction-kw[data-kind="relation"] .extraction-kw-pill {
  background: var(--c-relation-soft);
  border-color: var(--c-relation-bd);
}
.extraction-counter {
  margin-top: 32px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.extraction-counter.visible { opacity: 1; }
.extraction-counter-from {
  color: var(--mute-2);
  text-decoration: line-through;
}
.extraction-counter-arrow { color: var(--mute-2); }
.extraction-counter-to {
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.extraction-counter-suffix {
  color: var(--fg-soft);
  font-weight: 600;
}

/* ============ ACT 2 ============ */
.act-2 {
  justify-content: center;
  gap: 18px;
}
.entities-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.entity-card {
  padding: 16px 10px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  text-align: center;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
}
.entity-card.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.entity-card.dim {
  opacity: 0.32;
  transform: translateY(0) scale(0.96);
}
.entity-card.highlight {
  border-color: var(--accent);
  background: var(--accent-softer);
  box-shadow: 0 8px 24px rgba(17, 19, 23, 0.10);
  transform: translateY(-3px) scale(1.04);
}
.entity-card-flag { line-height: 1; }
.entity-card-name {
  font-size: 16px; font-weight: 700;
  color: var(--fg); letter-spacing: -0.01em;
  margin-bottom: 5px;
}
.entity-card-count {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.entity-card-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--bg-soft);
  border-radius: 4px;
  font-size: 10.5px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.02em;
}
.entities-caption {
  text-align: center;
  margin-top: 12px;
  font-size: 14.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: -0.005em;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.entities-caption.visible { opacity: 1; }
.entities-caption strong {
  color: var(--fg);
  font-weight: 700;
}

/* ============ ACT 3 (sub-acts 3a / 3b) ============ */
.act-3 {
  padding-top: 22px;
  padding-bottom: 14px;
  overflow: hidden;
}
.evidence-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.evidence-flag { line-height: 1; }
.evidence-name {
  font-size: 20px; font-weight: 700;
  color: var(--fg); letter-spacing: -0.015em;
}
.evidence-tag {
  margin-left: auto;
  font-size: 12px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.04em;
}

/* ===== sub-act 3a: SpaceX timeline + speech bubbles ===== */
.sub-3a {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: opacity 0.4s ease, transform 0.5s ease;
  transform-origin: 50% 50%;
}
.sub-3a.exiting {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}
/* Morph phase 1: fade out everything that ISN'T the line+dots — bubbles,
   connectors, header, mini labels, ticks, today indicator. No transform
   yet, so the line stays at full size while these disappear quickly. */
.sub-3a.fading-bubbles .tl-bubble,
.sub-3a.fading-bubbles .tl-connector,
.sub-3a.fading-bubbles .tl-obj-mini-label,
.sub-3a.fading-bubbles .evidence-header,
.sub-3a.fading-bubbles .timeline-tick,
.sub-3a.fading-bubbles .timeline-today {
  opacity: 0 !important;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

/* Morph phase 2: now that bubbles/labels are gone, the remaining content
   (just the axis line + dots) shrinks and slides toward the SpaceX row.
   The actual translate offsets are set by JS (--morph-tx, --morph-ty,
   --morph-scale-x, --morph-scale-y). */
.sub-3a.morphing {
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
  transform:
    translate(var(--morph-tx, 0px), var(--morph-ty, 0px))
    scale(var(--morph-scale-x, 0.5), var(--morph-scale-y, 0.25));
  transition:
    opacity 0.55s ease 0.15s,
    transform 0.6s cubic-bezier(0.5, 0, 0.2, 1);
}

.timeline-with-bubbles {
  position: relative;
  flex: 1;
  min-height: 320px;
  padding: 0 16px;
}
/* timeline horizontal centered vertically */
.timeline-axis-wrap {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1px;
}
.timeline-axis {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--line-strong);
}
.timeline-axis::before, .timeline-axis::after {
  content: '';
  position: absolute; top: 50%;
  width: 6px; height: 6px;
  background: var(--mute-2);
  border-radius: 50%;
  transform: translateY(-50%);
}
.timeline-axis::before { left: -3px; }
.timeline-axis::after  { right: -3px; }
.timeline-today {
  position: absolute;
  right: 0; top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(50%, -50%);
  z-index: 5;
}
.timeline-today::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: today-pulse 2s ease-out infinite;
}
.timeline-today::after {
  content: 'TODAY';
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 8.5px; font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
}
@keyframes today-pulse {
  0%   { transform: scale(1);   opacity: 0.4; }
  100% { transform: scale(2.6); opacity: 0; }
}
.timeline-tick {
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  font-size: 9.5px;
  color: var(--mute-2);
  font-weight: 500;
  letter-spacing: 0;
  pointer-events: none;
}
.timeline-tick::before {
  content: '';
  position: absolute;
  top: -10px; left: 50%;
  width: 1px; height: 4px;
  background: var(--line-strong);
}

/* timeline objects (small markers on the axis) */
.tl-obj {
  position: absolute;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tl-obj.in { opacity: 1; }
/* dot on axis */
.tl-obj-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px currentColor;
  transition: width 0.2s ease, height 0.2s ease;
}
.tl-obj.expanded .tl-obj-dot {
  width: 12px; height: 12px;
}
.tl-obj[data-side="up"] {
  bottom: 50%;
  transform: translate(-50%, calc(50% + 12px));
}
.tl-obj[data-side="up"].in {
  transform: translate(-50%, 50%);
}
.tl-obj[data-side="down"] {
  top: 50%;
  transform: translate(-50%, calc(-50% - 12px));
}
.tl-obj[data-side="down"].in {
  transform: translate(-50%, -50%);
}
.tl-obj[data-type="relation"] { color: var(--c-relation); }
.tl-obj[data-type="figure"]   { color: var(--c-figure); }
.tl-obj[data-type="quote"]    { color: var(--c-quote); }

/* small label (used when not expanded) */
.tl-obj-mini-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0;
  color: currentColor;
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}
.tl-obj[data-side="up"] .tl-obj-mini-label {
  bottom: 100%;
  margin-bottom: 6px;
}
.tl-obj[data-side="down"] .tl-obj-mini-label {
  top: 100%;
  margin-top: 6px;
}
.tl-obj.expanded .tl-obj-mini-label { opacity: 0; }

/* All bubbles extend leftward from the dot, anchored by their right edge.
   The diagonal connector then runs from the dot up-left (or down-left)
   at a consistent angle. */
.tl-bubble {
  position: absolute;
  /* horizontally centered on the dot — connector is vertical.
     --shift is set by JS when the bubble has to be clamped inside the stage,
     so the centering math (-50%) and the entrance motion stay identical
     for every bubble; only the horizontal offset changes. */
  --shift: 0px;
  left: 50%;
  transform: translate(calc(-50% + var(--shift)), 6px) scale(0.97);
  width: 280px;
  padding: 13px 15px 12px;
  background: var(--bg);
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.005em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 6;
  text-align: left;
  word-break: keep-all;
  box-shadow: 0 8px 24px rgba(15, 17, 21, 0.08);
}
.tl-obj[data-side="up"] .tl-bubble {
  bottom: calc(100% + 36px);
}
.tl-obj[data-side="down"] .tl-bubble {
  top: calc(100% + 36px);
}
.tl-obj.expanded .tl-bubble {
  opacity: 1;
  transform: translate(calc(-50% + var(--shift)), 0) scale(1);
}

/* diagonal dashed connector from dot to bubble corner */
.tl-connector {
  position: absolute;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
}
.tl-obj.expanded .tl-connector { opacity: 1; }
.tl-connector svg {
  overflow: visible;
  display: block;
}
.tl-connector-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.55;
}
.tl-connector-end {
  fill: currentColor;
  opacity: 0.7;
}

.tl-bubble-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0;
  color: currentColor;
  padding: 2px 7px;
  background: var(--bg);
  border: 1px solid currentColor;
  border-radius: 3px;
  margin-bottom: 8px;
}
.tl-obj[data-type="relation"] .tl-bubble-tag {
  background: var(--c-relation-soft);
}
.tl-obj[data-type="figure"] .tl-bubble-tag {
  background: var(--c-figure-soft);
}
.tl-obj[data-type="quote"] .tl-bubble-tag {
  background: var(--c-quote-soft);
}
.tl-bubble-text {
  color: var(--fg);
}
.tl-bubble-text .hl {
  font-weight: 700;
}
.tl-obj[data-type="relation"] .tl-bubble-text .hl { color: var(--c-relation); }
.tl-obj[data-type="figure"]   .tl-bubble-text .hl { color: var(--c-figure); }
.tl-obj[data-type="quote"]    .tl-bubble-text .hl { color: var(--c-quote); }

/* ===== sub-act 3b: 5 mini timelines ===== */
.sub-3b {
  position: absolute;
  inset: 0;
  padding: 24px 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.sub-3b.entering {
  opacity: 1;
  pointer-events: auto;
}
.sub-3b-prompt {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: -0.005em;
  text-align: center;
  margin-bottom: 6px;
}
.sub-3b-prompt strong {
  color: var(--fg);
  font-weight: 700;
}
.sub-3b-counts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.sub-3b-counts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sub-3b-counts span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sub-3b-counts [data-type="relation"] { color: var(--c-relation); }
.sub-3b-counts [data-type="figure"] { color: var(--c-figure); }
.sub-3b-counts [data-type="quote"] { color: var(--c-quote); }
.sub-3b-counts strong { color: currentColor; font-weight: 800; }
.mini-timelines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Shared time-axis reference sitting beneath the 5 mini-timeline rows.
   Same grid as .mini-tl-row so the scale aligns under the axis area only.
   Visual: muted "30일 전 - - - 오늘" reference. Reads as the unifying
   time scale every row above shares. */
.mini-tl-axis-header {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
  margin-top: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.mini-timelines .mini-tl-axis-header { opacity: 1; transform: translateY(0); }
.mini-tl-axis-scale {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}
.mini-tl-axis-label {
  white-space: nowrap;
  display: inline-block;
  transform: scale(0);
  opacity: 0;
  transform-origin: center;
}
/* STEP 4 time-flow finale: "30일 전" pops in as the line begins drawing,
   "오늘" pops in when the line reaches the right edge. Same two-stage pop
   used by the mini-tl dots so the labels read as part of the same beat. */
.mini-tl-axis-label.in {
  animation: mini-tl-label-pop 0.55s cubic-bezier(0.34, 1.4, 0.6, 1) both;
}
@keyframes mini-tl-label-pop {
  0%   { transform: scale(0);    opacity: 0; }
  25%  { transform: scale(0.3);  opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
/* The dashed segment filling the gap between the two labels. Flex grows it
   to whatever width the axis column gives us. Dashed reads as "this is a
   reference / scale" rather than a hard divider. Grows L→R together with
   the axis lines above for a unified "time arrives" feel. */
.mini-tl-axis-ticks {
  flex: 1;
  height: 1px;
  background-image: linear-gradient(to right,
    var(--line-strong) 50%, transparent 50%);
  background-size: 6px 1px;
  background-repeat: repeat-x;
  opacity: 0.55;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.mini-tl-axis-ticks.in { transform: scaleX(1); }

.mini-tl-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.mini-tl-row.in {
  opacity: 1;
  transform: translateX(0);
}
/* The SpaceX row receives the morph from STEP 3's full timeline. When it
   first appears it briefly glows + sits at full opacity (no fade-in needed)
   because conceptually it's the same timeline that just got reduced. */
.mini-tl-row.morph-target {
  transform: translateX(0);
}
.mini-tl-row.morph-target.morph-flash .mini-tl-axis-line {
  background: var(--accent);
}
.mini-tl-row.morph-target .mini-tl-axis-line {
  transition: background 0.6s ease, box-shadow 0.6s ease;
}
.mini-tl-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  overflow: hidden;
  white-space: nowrap;
}
.mini-tl-name-flag { line-height: 1; }
.mini-tl-axis {
  position: relative;
  height: 28px;
}
.mini-tl-axis-line {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-strong);
  transform: translateY(-0.5px) scaleX(0);
  transform-origin: left center;
  transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* STEP 4 ("time flow"): all rows draw their axis line L→R together once the
   company labels are in. SpaceX (.morph-target) lands at full width with no
   transform transition — its line "is" the line we just saw in STEP 3. */
.mini-tl-row.drawing .mini-tl-axis-line,
.mini-tl-row.morph-target .mini-tl-axis-line {
  transform: translateY(-0.5px) scaleX(1);
}
.mini-tl-dot {
  position: absolute;
  top: 50%;
  width: 8px; height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  border: 1.5px solid var(--bg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Two-stage pop: a tiny dot blinks in first, then grows out to full size.
   Final transform matches .in so any later transitions read from scale(1). */
.mini-tl-dot.in {
  transform: translate(-50%, -50%) scale(1);
  animation: mini-tl-dot-pop 0.55s cubic-bezier(0.34, 1.4, 0.6, 1) both;
}
@keyframes mini-tl-dot-pop {
  0%   { transform: translate(-50%, -50%) scale(0);    opacity: 0; }
  25%  { transform: translate(-50%, -50%) scale(0.3);  opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}
.mini-tl-dot[data-type="relation"] { background: var(--c-relation); }
.mini-tl-dot[data-type="figure"]   { background: var(--c-figure); }
.mini-tl-dot[data-type="quote"]    { background: var(--c-quote); }
.mini-tl-counts {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mini-tl-row.in .mini-tl-counts { opacity: 1; transition-delay: 0.2s; }
.mini-tl-counts-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.mini-tl-counts-item::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.mini-tl-counts-item[data-type="relation"] { color: var(--c-relation); }
.mini-tl-counts-item[data-type="figure"]   { color: var(--c-figure); }
.mini-tl-counts-item[data-type="quote"]    { color: var(--c-quote); }

/* ===== sub-act 3b: summary overlay (sits on top of mini-timelines) ===== */
.mini-timelines-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* shift up to compensate for the caption above, so the
     timelines+summary feel optically centered in the stage */
  transform: translateY(-18px);
}
.mini-timelines {
  position: relative;
  transition: filter 0.5s ease, opacity 0.5s ease;
}
.mini-timelines.dimmed {
  filter: blur(2px);
  opacity: 0.35;
}

/* ===== connection lines layer ===== */
/* SVG sits over the mini-timelines, drawing curves between related dots.
   Lines stroke-in during act3b's hold (after dots appear), then converge
   toward the summary card as act3c begins. */
.mini-tl-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mini-tl-connections.active {
  opacity: 1;
}
/* After dots have arrived at the card, hide the whole layer. */
.mini-tl-connections.absorbed {
  opacity: 0;
  transition: opacity 0.4s ease 0.1s;
}
.mini-tl-connection {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len, 200);
  stroke-dashoffset: var(--len, 200);
  opacity: 0;
  transition:
    stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s ease,
    stroke-width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
/* When .drawn lands, fire a brief brightness/width pulse, then settle.
   Sequence: stroke-in (0.7s, dashoffset) → at 0.5s flash brighter+thicker
   → settles by 1.0s into the .drawn state, before the 0.35s hold ends. */
.mini-tl-connection.drawn {
  stroke-dashoffset: 0;
  opacity: 0.95;
  stroke-width: 1.6;
  animation: mini-tl-flash 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s 1 forwards;
}
@keyframes mini-tl-flash {
  0%   { opacity: 0.95; stroke-width: 1.6; }
  40%  { opacity: 1;    stroke-width: 2.2; }
  100% { opacity: 0.85; stroke-width: 1.3; }
}
/* Synchronized glow pulse — after every chain has been drawn individually,
   STEP 4 fires one shared brightness flash so all lines peak together.
   The closing beat of STEP 4 ("everything connects"). The keyframe ends
   exactly at the .drawn settled state (opacity 0.85, stroke-width 1.3) so
   removing the class is a no-op visually — STEP 5's .fading can then
   override cleanly without a snap. Specificity (0,2,1) > .drawn (0,2,0). */
.mini-tl-connections.glow-pulse .mini-tl-connection {
  animation: mini-tl-glow-pulse 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes mini-tl-glow-pulse {
  0%   { opacity: 0.85; stroke-width: 1.3; }
  45%  { opacity: 1;    stroke-width: 2.6; }
  100% { opacity: 0.85; stroke-width: 1.3; }
}

/* During convergence: lines disappear FIRST (smooth fade), then dots converge.
   We use a dedicated keyframe animation rather than `animation: none +
   transition` — a fresh animation cleanly supersedes the .drawn flash
   animation's forwards-held state. The transition-on-cascade-swap path was
   unreliable and produced an abrupt snap instead of a fade. */
.mini-tl-connection.fading {
  animation: mini-tl-fade-out 0.4s ease forwards;
}
@keyframes mini-tl-fade-out {
  0%   { opacity: 0.85; }   /* matches .drawn flash's settled value */
  100% { opacity: 0; }
}
.mini-tl-connection.absorbed {
  opacity: 0;
}

/* Endpoint dots — these are what actually travel to the card.
   Travel is animated via JS by directly tweening cx/cy (transform on SVG
   elements has too many cross-browser quirks). CSS only handles fade.
   Glow filter inherited from the parent <svg> via the shared filter id. */
.mini-tl-connection-node {
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: url(#mini-tl-glow);
}
.mini-tl-connection-node.in {
  opacity: 1;
}
.mini-tl-connection-node[data-type="relation"] { fill: var(--c-relation); }
.mini-tl-connection-node[data-type="figure"]   { fill: var(--c-figure); }
.mini-tl-connection-node[data-type="quote"]    { fill: var(--c-quote); }

.summary-overlay {
  position: absolute;
  /* covers the full mini-timelines area, content centered */
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.summary-overlay.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.summary-overlay-card {
  /* Size to the natural width of the summary text (no extra side whitespace).
     Parent `.summary-overlay` already centers via `justify-content: center`,
     so the card auto-centers horizontally. max-width keeps it sane if the
     synthesized lines ever get unusually long. */
  width: fit-content;
  max-width: 720px;
  /* Match the "한눈에 보기" result-insight box — tinted sky-blue fill plus
     the same accent border. Visually ties the cycle's ending (summary) to
     its beginning (result preview). */
  background: var(--accent-softer);
  border: 1.5px solid var(--accent-bd);
  border-radius: 12px;
  padding: 22px 36px 18px;
  box-shadow: 0 18px 48px rgba(15, 17, 21, 0.18);
  transform: scale(0.94);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.35s ease,
    box-shadow 0.5s ease,
    border-color 0.5s ease;
}
.summary-overlay.visible .summary-overlay-card {
  transform: scale(1);
  opacity: 1;
}
/* Absorption pulse — fired when connection lines reach the card.
   Border briefly lights up; shadow deepens but stays neutral (no mint glow). */
.summary-overlay-card.absorbing {
  border-color: var(--accent);
  box-shadow: 0 22px 56px rgba(17, 19, 23, 0.22);
}
.summary-overlay-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--accent-bd);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.summary-overlay-title-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--fg);
  background: var(--bg-soft);
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.summary-overlay-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-overlay-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 17px;
  color: var(--fg);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.55;
  word-break: keep-all;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.summary-overlay-list-item.in {
  opacity: 1;
  transform: translateY(0);
}
.summary-overlay-bullet {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-hover);
  margin-top: 9px;
}
.summary-overlay-list-item .ent { font-weight: 700; color: var(--fg); }
.summary-overlay-list-item .result-num{ font-weight: 700; color: var(--c-figure); font-variant-numeric: tabular-nums; }
.summary-overlay-list-item .rel { font-weight: 700; color: var(--c-relation); }
.summary-overlay-list-item .quo { font-weight: 700; color: var(--c-quote); font-style: italic; }

.summary-overlay-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--accent-bd);
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.summary-overlay.visible .summary-overlay-footer {
  opacity: 1;
  transition-delay: 0.35s;
}
.summary-overlay-check { color: var(--accent-hover); font-weight: 700; }
.summary-overlay-footer strong {
  color: var(--fg); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.summary-overlay-footer .hl-rel { color: var(--c-relation); font-weight: 700; }
.summary-overlay-footer .hl-fig { color: var(--c-figure); font-weight: 700; }
.summary-overlay-footer .hl-quo { color: var(--c-quote); font-weight: 700; }

/* ============ FOOTER ============ */
.demo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 28px 16px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: -0.005em;
  border-top: 1px solid var(--line-soft);
}
.demo-meta--indicator-only {
  justify-content: center;
  padding-top: 14px;
  flex-direction: column;
  gap: 8px;
}
.demo-acts-hint {
  font-size: 12px;
  color: var(--mute-2);
  font-weight: 500;
  letter-spacing: 0;
}
.demo-acts-indicator {
  display: flex; gap: 8px; align-items: center;
}
.demo-acts-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.3s ease, width 0.3s ease, border-radius 0.3s ease;
  cursor: pointer;
}
.demo-acts-dot:hover {
  background: var(--mute-2);
}
.demo-acts-dot.done {
  background: var(--mute-2);
}
.demo-acts-dot.active {
  background: var(--fg);
  width: 20px;
  border-radius: 4px;
}

/* Desktop: sidebar takes over, dot indicator hidden */
.demo-meta--indicator-only {
  display: none;
}

@media (max-width: 880px) {
  .demo-card { border-radius: 12px; }
  .demo-preview { padding: 14px 18px 12px; }
  .demo-preview-text { font-size: 14px; }
  /* Mobile: sidebar collapses to horizontal dots */
  .demo-body { flex-direction: column; }
  .demo-sidebar { display: none; }
  .demo-meta--indicator-only { display: flex; }
  .demo-stage { height: 620px; }
  .act { padding: 22px 16px 14px; }
  .extraction-input { font-size: 20px; min-width: 0; margin-bottom: 90px; }
  .extraction-keywords { gap: 18px; }
  .entities-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .entity-card:nth-child(4),
  .entity-card:nth-child(5) { display: none; }
  .tl-bubble { width: 220px; font-size: 12.5px; }
  .mini-tl-row { grid-template-columns: 110px 1fr; gap: 10px; }
  .demo-meta { padding: 10px 18px 14px; font-size: 11.5px; }
  .result-connector { width: 12px; }
}

/* Phase 1: small phones (≤640) — further compaction so the analysis demo
   card fits comfortably without horizontal overflow or cramped text. */
@media (max-width: 640px) {
  .demo-preview { padding: 12px 14px 10px; gap: 8px; }
  .demo-preview-text { font-size: 13px; }
  .demo-preview-tag { font-size: 9px; padding: 3px 6px; }
  .demo-stage { height: 560px; }
  .act { padding: 18px 12px 12px; }
  .extraction-input { font-size: 17px; margin-bottom: 70px; }
  .extraction-keywords { gap: 12px; }
  .entities-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  /* 880px rule hides cards 4·5. In a 2-col grid that leaves a lonely 3rd card
     on its own row. Bring card 4 back so we get a balanced 2×2. Card 5 stays
     hidden — five cards would leave another orphan and a stretch of empty. */
  .entity-card:nth-child(4) { display: block; }
  .tl-bubble {
    /* 200 → 150 — 좁은 viewport 에서도 위·아래 bubble 둘 다 들어가도록 더 좁힘. */
    width: 150px;
    font-size: 11.5px;
    padding: 10px 12px 9px;
  }
  /* up bubble 이 idx 1·5 두 개라 narrow 폰에선 horizontal overlap 위험.
     idx 5 만 vertical 로 더 올려서 idx 1 위로 stacking — 가로로 겹쳐도
     세로로 분리되어 보임. connector 가 길어지지만 시각적으로 OK. */
  .tl-obj[data-idx="5"][data-side="up"] .tl-bubble {
    bottom: calc(100% + 100px);
  }
  /* idx 5 가 위로 한참 올라가니 stage 도 그만큼 키워서 bubble 이 잘리지 않게. */
  .timeline-with-bubbles { min-height: 400px; }
  .mini-tl-row { grid-template-columns: 88px 1fr; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-today::before { animation: none; opacity: 0.3; }
  .extraction-input-cursor { animation: none; }
  .result-connector { opacity: 0.65; transform: scaleX(1); transition: none; }
}

/* ============================================================
   DARK THEME VARIANT — add class="dark" on .hero-demo to render
   the widget as a dark card. Matches connectionary's existing
   dark surfaces (.hero-card, .compare-card.dark, .ss-card.aid,
   .cta-card) so the demo sits in the same visual family.

   Most styles auto-adapt because they reference CSS vars; we only
   override the var values + a handful of edge cases (surfaces that
   would otherwise blend, hardcoded shadows).
   ============================================================ */
.hero-demo.dark {
  /* Surfaces — dark card on the bright page. Matches connectionary's --dark. */
  --bg: #101214;
  --bg-soft: #1a1d21;

  /* Text — light on dark */
  --fg: #ffffff;
  --fg-soft: #e6e9ed;
  --muted: #bcc2cc;
  --mute-2: #8a909a;

  /* Mint — boost soft/softer/bd alphas so subtle tints are still visible on dark */
  --accent: #6cd2ee;
  --accent-hover: #94dff1;
  --accent-soft: rgba(108, 210, 238, 0.20);
  --accent-softer: rgba(108, 210, 238, 0.10);
  --accent-bd: rgba(108, 210, 238, 0.55);

  /* Filter blue — lifted for dark bg readability */
  --filter-blue: #60a5fa;
  --filter-blue-soft: rgba(96, 165, 250, 0.16);
  --filter-blue-bd: rgba(96, 165, 250, 0.45);

  /* Semantic colors — brightened so 보라/스카이/주황 pop on dark.
     Same mapping: 관계=보라, 수치=스카이, 발언=주황. */
  --c-figure: #38bdf8;
  --c-quote: #fb923c;
  --c-relation: #a78bfa;
  --c-figure-soft: rgba(56, 189, 248, 0.16);
  --c-quote-soft: rgba(251, 146, 60, 0.16);
  --c-relation-soft: rgba(167, 139, 250, 0.16);
  --c-figure-bd: rgba(56, 189, 248, 0.45);
  --c-quote-bd: rgba(251, 146, 60, 0.46);
  --c-relation-bd: rgba(167, 139, 250, 0.45);

  /* Lines — light on dark */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.04);
}

/* Demo card on dark theme — deeper shadow (since dark card sits on bright page),
   plus a subtle lime glow in the top-right corner matching connectionary's
   .hero-card::before signature. */
.hero-demo.dark .demo-card {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 24px 70px rgba(0, 0, 0, 0.35);
}
.hero-demo.dark .demo-card::after {
  content: "";
  position: absolute;
  inset: -110px -110px auto auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 210, 238, 0.22), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

/* Sidebar gradient — on dark, fade from a slightly darker shade (bg-soft is
   darker than bg here too, just both very dark) to transparent for subtle depth */
.hero-demo.dark .demo-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 80%);
}

/* Hover/active row tints — need to be light overlays on dark, not dark on dark */
.hero-demo.dark .demo-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.hero-demo.dark .demo-sidebar-item.active {
  background: rgba(255, 255, 255, 0.06);
}

/* RESULT done on dark — keep mint, overriding the neutral done style above.
   Needs the .hero-demo.dark prefix to beat .hero-demo.dark .done's specificity. */
.hero-demo.dark .demo-sidebar-item.is-result.done .demo-sidebar-marker {
  background: var(--accent-soft);
  border-color: var(--accent-bd);
  color: var(--accent-hover);
}

/* Done marker on dark — slightly lighter fill (bg-soft is too close to bg).
   Stay subtle but readable. */
.hero-demo.dark .demo-sidebar-item.done .demo-sidebar-marker {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--fg-soft);
}

/* Entity cards / workflow tags / pills — the bg-soft fills need a light overlay
   so they read as filled rather than blending into the card */
.hero-demo.dark .entity-card-tag,
.hero-demo.dark .result-entity,
.hero-demo.dark .summary-overlay-title-tag {
  background: rgba(255, 255, 255, 0.06);
}

/* Entity card default — slight lift off the dark card surface */
.hero-demo.dark .entity-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.10);
}

/* Extraction input on dark — same idea */
.hero-demo.dark .extraction-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Speech bubbles on dark — give them a light surface so the text reads cleanly */
.hero-demo.dark .tl-bubble {
  background: #1a1d21;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.hero-demo.dark .tl-bubble-tag {
  background: #1a1d21;
}

/* Summary overlay card — sits on top of mini-timelines. On dark, the card
   needs a slightly lifted surface so it visually separates from the timeline
   area underneath. */
.hero-demo.dark .summary-overlay-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5);
}

/* Stage content sits above the lime glow */
.hero-demo.dark .demo-preview,
.hero-demo.dark .demo-body,
.hero-demo.dark .demo-meta {
  position: relative;
  z-index: 1;
}

/* ============================================================
   LIGHT THEME — STEP 4 connection lines
   The doubled-blur SVG filter (#mini-tl-glow) stacks blurred copies
   that read as a bright halo on dark, but as a dark fringe on white.
   On light, swap the per-type gradient stroke for a uniform mint
   line + a softer mint drop-shadow glow. Endpoint dots stay colored
   by their type (relation/figure/quote) so the chain still encodes
   evidence type at the nodes.
   ============================================================ */
/* Skip the parent opacity fade-in for light: the 0.25s fade overlaps with the
   line stroke-in (0.7s), so by the time the parent is visible the line is
   already ~20% drawn. Removing the fade-in makes the parent visible instantly
   while the path still sits at dashoffset = len (fully hidden), so the line
   clearly emerges from the start dot. .absorbed keeps its own transition. */
.hero-demo:not(.dark) .mini-tl-connections {
  transition: none;
}
.hero-demo:not(.dark) .mini-tl-connections.absorbed {
  transition: opacity 0.4s ease 0.1s;
}
.hero-demo:not(.dark) .mini-tl-connection {
  stroke-width: 1;
  opacity: 0.5;
  filter: none;
  transition:
    stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.5s ease;
}
.hero-demo:not(.dark) .mini-tl-connection.drawn {
  stroke-width: 1;
  opacity: 0.5;
  animation: none;
}
/* Synchronized glow flash on light — mirror the dark theme: re-enable the
   SVG #mini-tl-glow filter (doubled blur + source) at the peak so the
   line's own gradient colors bloom as a halo, and pulse stroke-width +
   opacity the same way. The filter is normally off in light theme (it
   can read as a dark fringe at rest), but for one frame at peak the
   bloom reads as a halo, matching the dark-theme moment.
   Specificity (0,5,0) beats .drawn's (0,4,0) so the animation fires. */
.hero-demo:not(.dark) .mini-tl-connections.glow-pulse .mini-tl-connection {
  animation: mini-tl-glow-pulse-light 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes mini-tl-glow-pulse-light {
  0%   { opacity: 0.5;  stroke-width: 1; filter: none; }
  45%  { opacity: 0.25; stroke-width: 1; filter: blur(1.6px) brightness(1.8); }
  100% { opacity: 0.5;  stroke-width: 1; filter: none; }
}
/* Convergence fade-out on light — animate cleanly to 0 so the lines
   actually clear before the dots travel (matches dark behavior). The
   prior `opacity: 0.15` left a faint scribble that competed with the
   converging dots. Same specificity logic as the glow-pulse rule above. */
.hero-demo:not(.dark) .mini-tl-connection.fading {
  animation: mini-tl-fade-out-light 0.4s ease forwards;
}
@keyframes mini-tl-fade-out-light {
  0%   { opacity: 0.5; }
  100% { opacity: 0; }
}
.hero-demo:not(.dark) .mini-tl-connection.absorbed {
  opacity: 0;
}
.hero-demo:not(.dark) .mini-tl-connection-node {
  filter: none;
}
.hero-demo:not(.dark) .mini-tl-connection-node.in {
  opacity: 0.85;
}
