/* ===========================================================================
 * Narrative Comparator — comparator.css
 * Theme-isolated. Everything is scoped under .ncw / .ncw-shell and uses an
 * internal reset so the active theme can't bleed in. Palette matches the core
 * platform: #0a0a0f bg, #8b7ff0 accent, soft violet text.
 * ======================================================================== */

.ncw, .ncw-shell { all: initial; }
.ncw *, .ncw *::before, .ncw *::after,
.ncw-shell *, .ncw-shell *::before, .ncw-shell *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ncw, .ncw-shell {
  display: block; color: #e8e6ff; line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Tool hero + input card ---------- */
.ncw-shell { max-width: 1080px; margin: 0 auto; padding: 8px 4px 40px; }
.ncw-hero { background: #0a0a0f; border: 1px solid #20203a; border-radius: 16px; padding: 34px 22px 26px; text-align: center; }
.ncw-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: #8888aa; margin-bottom: 14px; }
.ncw-headline { font-size: 28px; font-weight: 700; color: #f0eeff; letter-spacing: -.02em; line-height: 1.18; margin-bottom: 8px; }
.ncw-headline span { color: #a89ff5; }
.ncw-subline { font-size: 14px; color: #9090b8; max-width: 460px; margin: 0 auto 22px; }

.ncw-card { width: 100%; max-width: 560px; margin: 0 auto; background: #0f0f18; border: 1px solid #3a3a55; border-radius: 12px; overflow: hidden; text-align: left; }
.ncw-tabs { display: flex; align-items: center; border-bottom: 1px solid #2a2a42; }
.ncw-tab { flex: 0 0 auto; padding: 11px 18px; font-size: 13px; font-weight: 600; color: #b8b8d8; background: transparent; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ncw-tab.is-active { color: #fff; border-bottom-color: #8b7ff0; }
.ncw-tab-div { width: 1px; height: 16px; background: #2a2a42; }
.ncw-body { padding: 14px; }
.ncw-input { width: 100%; background: transparent; border: none; outline: none; color: #e8e6ff; font-size: 14px; line-height: 1.6; resize: none; caret-color: #8b7ff0; min-height: 72px; }
.ncw-input::placeholder { color: #5a5a7a; }
.ncw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid #2a2a42; padding-top: 11px; margin-top: 6px; }
.ncw-hint { font-size: 11px; color: #7a7aa0; }
.ncw-go { background: #8b7ff0; color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.ncw-go:active { transform: scale(.97); }
.ncw-go[disabled] { opacity: .6; cursor: wait; }

.ncw-result[hidden], .ncw-example[hidden] { display: none; }
.ncw-result, .ncw-example { margin-top: 22px; }
.ncw-example-tag { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: #8888aa; background: #13131f; border: 1px solid #2a2a42; border-radius: 8px; padding: 7px 12px; margin-bottom: 14px; text-align: center; }

/* ---------- Card shell (shared by tool + share) ---------- */
.ncw { background: #0a0a0f; border: 1px solid #20203a; border-radius: 16px; padding: 22px; }

/* Stale banner */
.nc-stale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #1b1530; border: 1px solid #3a2f63; border-radius: 10px; padding: 10px 13px; font-size: 13px; color: #cbbff5; margin-bottom: 16px; }
.nc-stale-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8a64a; flex: 0 0 auto; }
.nc-rerun { background: none; border: none; color: #a89ff5; font-weight: 600; cursor: pointer; text-decoration: underline; font-size: 13px; padding: 0; }

/* A. Header */
.nc-head { border-bottom: 1px solid #20203a; padding-bottom: 16px; margin-bottom: 16px; }
.nc-asof { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: #8b7ff0; background: #15122a; border: 1px solid #2e2752; border-radius: 999px; padding: 5px 12px; margin-bottom: 12px; }
.nc-asof strong { color: #c7bdf7; }
.nc-title { font-size: 21px; font-weight: 700; color: #f0eeff; line-height: 1.3; letter-spacing: -.01em; margin-bottom: 8px; }
.nc-coverage-line { font-size: 13px; color: #9090b8; }
.nc-coverage-line strong { color: #e8e6ff; }

/* B. Divergence strip */
.nc-strip { background: #0f0d1c; border: 1px solid #2e2752; border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; overflow: hidden; }
.nc-strip-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8888aa; margin-bottom: 10px; }
.nc-strip-track { display: flex; align-items: stretch; gap: 10px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.nc-strip-track::-webkit-scrollbar { height: 6px; }
.nc-strip-track::-webkit-scrollbar-thumb { background: #2e2752; border-radius: 3px; }
.nc-strip-item { display: inline-flex; flex-direction: column; gap: 3px; flex: 0 0 auto; min-width: 0; max-width: 220px; padding: 8px 14px; background: #17142c; border: 1px solid #322a5c; border-radius: 10px; }
.nc-strip-term { font-size: 15px; font-weight: 700; color: #f0eeff; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.25; }
.nc-strip-region { font-size: 11px; color: #9b93c4; white-space: nowrap; }
.nc-strip-sep { display: none; }
.nc-strip-consistent .nc-strip-msg { font-size: 13px; color: #b8b0dd; }

/* C. Region grid */
.nc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.nc-card { background: #0f0f1a; border: 1px solid #262640; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.nc-card-empty { opacity: .62; }
.nc-card-head { display: flex; align-items: center; gap: 8px; }
.nc-card-flag { font-size: 18px; line-height: 1; }
.nc-card-name { font-size: 14px; font-weight: 700; color: #e8e6ff; flex: 1; }
.nc-nocov { font-size: 12px; color: #6f6f93; font-style: italic; }

.nc-tone { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; }
.nc-tone-measured     { color: #8aa0c8; }
.nc-tone-alarmed      { color: #d98a5a; }
.nc-tone-sympathetic  { color: #6db89a; }
.nc-tone-hostile      { color: #d96a7a; }
.nc-tone-celebratory  { color: #c8a44a; }
.nc-tone-dismissive   { color: #9b8ab0; }
.nc-tone-absent       { color: #5a5a7a; }

.nc-framing { font-size: 13px; color: #c2bce0; line-height: 1.55; }
.nc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nc-chip { font-size: 11px; font-weight: 600; color: #cdc5f0; background: #1a1730; border: 1px solid #2e2752; border-radius: 6px; padding: 3px 8px; }

.nc-src { border-top: 1px solid #20203a; padding-top: 10px; }
.nc-src-head { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #8b85b0; margin-bottom: 8px; }
.nc-wire-note { color: #6f6f93; font-weight: 500; text-transform: none; letter-spacing: 0; }
.nc-src-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.nc-src-extra { display: none; }
.nc-src-list.is-open .nc-src-extra { display: flex; }
.nc-src-item { display: flex; flex-direction: column; gap: 2px; }
.nc-src-item > a { display: flex; align-items: center; gap: 6px; text-decoration: none; font-size: 12px; color: #b8b0dd; }
.nc-src-item > a:hover .nc-src-outlet { text-decoration: underline; }
.nc-src-flag { flex: 0 0 auto; }
.nc-src-outlet { font-weight: 700; color: #cdc5f0; }
.nc-src-wire { font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8a8aae; background: #1a1a2e; border: 1px solid #2a2a42; border-radius: 4px; padding: 1px 5px; }
.nc-src-date { margin-left: auto; font-size: 11px; color: #6f6f93; flex: 0 0 auto; }
.nc-src-headline { display: block; font-size: 12.5px; color: #d7d2ee; line-height: 1.4; padding-left: 22px; text-decoration: none; }
.nc-src-headline:hover { color: #fff; text-decoration: underline; }
.nc-src-more { margin-top: 10px; width: 100%; background: #15122a; border: 1px solid #2e2752; color: #b8b0dd; font-size: 12px; font-weight: 600; border-radius: 8px; padding: 8px; cursor: pointer; }
.nc-src-more:hover { background: #1c1838; color: #fff; }

/* D. Gaps callout */
.nc-gaps { font-size: 12px; color: #9090b8; background: #0f0f1a; border: 1px dashed #2a2a42; border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; }
.nc-gaps-label { font-weight: 700; color: #b8b0dd; }
.nc-gaps strong { color: #cdc5f0; }
.nc-gaps-single, .nc-gaps-none { border-style: solid; }

/* E. Footer actions */
.nc-foot { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #20203a; padding-top: 16px; }
.nc-act { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #cdc5f0; background: #15122a; border: 1px solid #2e2752; border-radius: 8px; padding: 8px 13px; cursor: pointer; text-decoration: none; }
.nc-act:hover { background: #1c1838; }
.nc-act span { font-size: 13px; line-height: 1; }

.nc-disclaimer { font-size: 11px; color: #6f6f93; line-height: 1.5; margin-top: 14px; padding-top: 12px; border-top: 1px solid #161628; }
.nc-empty { padding: 40px 20px; text-align: center; color: #6f6f93; font-size: 14px; }

/* CTA overlay (free/guest) */
.ncw-cta { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; background: #15122a; border: 1px solid #2e2752; border-radius: 12px; padding: 16px; }
.ncw-cta[hidden] { display: none; }
.ncw-cta-msg { font-size: 13px; color: #cbbff5; font-weight: 600; }
.ncw-cta-btn { background: #8b7ff0; color: #fff; text-decoration: none; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 9px 18px; }

/* Loading overlay — staged steps */
.nc-loading { position: fixed; inset: 0; background: rgba(8,8,14,.86); z-index: 99998; display: none; align-items: center; justify-content: center; padding: 24px; }
.nc-loading.show { display: flex; }
.nc-loading-box { width: 100%; max-width: 340px; background: #0f0f1a; border: 1px solid #2e2752; border-radius: 16px; padding: 22px; }
.nc-loading-title { font-size: 14px; font-weight: 700; color: #f0eeff; margin-bottom: 16px; }
.nc-steps { display: flex; flex-direction: column; gap: 12px; }
.nc-step { display: flex; align-items: center; gap: 11px; font-size: 13px; color: #6f6f93; transition: color .3s ease; }
.nc-step-ico { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%; border: 2px solid #2e2752; position: relative; }
.nc-step.is-active { color: #e8e6ff; }
.nc-step.is-active .nc-step-ico { border-color: #8b7ff0; border-top-color: transparent; animation: nc-spin .8s linear infinite; }
.nc-step.is-done { color: #9b93c4; }
.nc-step.is-done .nc-step-ico { border-color: #6db89a; background: #6db89a; animation: none; }
.nc-step.is-done .nc-step-ico::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #0a0a0f; }
@keyframes nc-spin { to { transform: rotate(360deg); } }

/* Mobile: stack the grid, keep the strip swipeable */
@media (max-width: 640px) {
  /* Edge-to-edge: dark card runs to the screen edges (~2px), text keeps inner room */
  .ncw-shell {
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 6px 2px 30px;
    overflow-x: hidden;
  }
  .ncw { padding: 16px 12px; }
  .ncw-hero { padding: 28px 16px 22px; }
  .nc-grid { grid-template-columns: 1fr; }
  .nc-title { font-size: 18px; }
  .ncw-headline { font-size: 23px; }

  /* The "same story, different words" strip becomes a swipeable slider.
     (Region cards below are intentionally left stacked.) */
  .nc-strip { position: relative; }
  .nc-strip-track { scroll-snap-type: x mandatory; }
  .nc-strip:not(.nc-strip-consistent) .nc-strip-item {
    flex: 0 0 80%;
    max-width: 80%;
    scroll-snap-align: start;
  }
  /* right-edge fade = visual cue that there's more to swipe */
  .nc-strip:not(.nc-strip-consistent)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 40px;
    bottom: 6px;
    width: 30px;
    background: linear-gradient(to right, rgba(15,13,28,0), #0f0d1c);
    pointer-events: none;
  }
  .nc-strip:not(.nc-strip-consistent) .nc-strip-label::after {
    content: " · swipe →";
    color: #6f6f93;
    font-weight: 600;
  }
}
