/* chapter1.css — Chapter 1 (Live Universe / 기업 시그널) 데모 전용 스타일
   원본: chapter1.html 의 <style> 블록
   - 외부 페이지와 충돌하지 않도록 .chapter1-demo 컨테이너 아래로 모두 스코프
   - 변수, 본문 룰 전부 CSS nesting 으로 안쪽에 배치
*/

.chapter1-demo {
    --bg: var(--white);
    --bg-soft: #F5F5F2;
    --ink: #0F1115;
    --ink-soft: #2A2C33;
    --muted: #6B6E76;
    --muted-soft: #8E9098;
    --line: #E5E5E0;
    --line-soft: #EEEEE9;
    --accent: var(--mint);
    --accent-soft: rgba(var(--mint-rgb), 0.14);
    --accent-dim: rgba(var(--mint-rgb), 0.05);
    --hot: #DC2626;
    --hot-soft: rgba(220, 38, 38, 0.08);
    --live: var(--mint);
    --c-buy: #C9A56B;
    --c-sell: var(--mint);
    --c-rival: #D87A7A;
    --serif: var(--font-fraunces), 'Fraunces', 'Times New Roman', serif;
    --sans: 'Pretendard', -apple-system, sans-serif;
    --mono: var(--font-jetbrains-mono), 'JetBrains Mono', monospace;

  /* 원본 body 룰 → 컨테이너에 적용 */
  font-family: var(--sans);
  font-weight: 500;            /* 기본 400 → 500 으로 약간 두껍게 (homepage와 톤 통일) */
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* overlay/popout 를 demo 영역 내부로 한정시키는 anchor */
  position: relative;
}

/* 원본의 * 리셋을 .chapter1-demo 아래로 한정 */
.chapter1-demo,
.chapter1-demo *,
.chapter1-demo *::before,
.chapter1-demo *::after { box-sizing: border-box; }
.chapter1-demo :is(div, section, ul, ol, li, p, h1, h2, h3, h4, h5, h6,
                   figure, blockquote, button) { margin: 0; padding: 0; }
.chapter1-demo button { background: none; border: none; cursor: pointer; font: inherit; color: inherit; }

/* ===== 본문 규칙 (CSS nesting으로 .chapter1-demo 스코프 내부에 위치) ===== */
.chapter1-demo {
  /* 외곽 카드는 chapter3 의 .lens-card (lenses.css) 가 담당 — chapter1·2·3 공통 shell */

  /* ===== INTRO ===== */
  .intro {
    text-align: center;
    margin-bottom: 40px;
  }

  .intro-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted);
    margin-bottom: 16px;
  }

  .intro-title {
    font-family: var(--serif);
    font-size: 48px;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 14px;
  }

  .intro-title em {
    font-style: italic;
    font-weight: 300;
    color: var(--accent);
  }

  .intro-sub {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.55;
    max-width: 620px;
    margin: 0 auto;
  }

  /* ===== DEMO STATUS BAR ===== */
  /* 데모 상태 pill + replay 버튼을 한 줄에 가운데 정렬 */
  .demo-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 18px;
    flex-wrap: wrap;
  }
  .demo-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 20px;
    background: var(--ink);
    color: white;
    border-radius: 100px;
    font-size: 11.5px;
    letter-spacing: 0;
  }

  .demo-dot {
    width: 6px;
    height: 6px;
    background: var(--live);
    border-radius: 50%;
    animation: livePulse 1.4s ease-in-out infinite;
  }

  .demo-action {
    color: rgba(255,255,255,0.6);
  }

  .demo-action strong {
    color: var(--accent);
    font-weight: 600;
  }

  /* ===== LENS BAR ===== */
  /* chapter3 의 .pol-builder 와 동일한 톤 — 필터 칩들을 작은 카드로 감쌈 */
  .lens-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid rgba(15, 17, 21, 0.06);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.03);
  }

  .lens-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .lens-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--muted);
    margin-right: 8px;
    min-width: 60px;
  }

  .lens-chip {
    background: white;
    border: 1px solid var(--line);
    border-radius: 100px;
    padding: 7px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--sans);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .lens-chip:hover { border-color: var(--ink); }

  .lens-chip.active {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
  }

  /* + add chip — implies "more / customizable" */
  .lens-chip.add-chip {
    background: transparent;
    border: 1px dashed var(--line);
    color: var(--muted);
    padding: 7px 11px;
    font-size: 11px;
    letter-spacing: 0;
    font-weight: 500;
  }

  .lens-chip.add-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
  }

  .lens-chip.add-chip .add-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 13px;
    text-align: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    margin-right: 4px;
  }

  .lens-chip.auto-pulse {
    animation: chipPulse 0.6s ease;
  }


  .flag {
    font-size: 13px;
    line-height: 1;
  }

  /* universe stats — was tight mono uppercase ("UNIVERSE · 4 COMPANIES · ● LIVE")
     which read as AI-generated dashboard chrome. Now sentence case in the
     site sans family, slightly larger and more breathing room. */
  .universe-stats {
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
  }

  .universe-stats strong {
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
  }

  /* ===== UNIVERSE GRID ===== */
  /* lens-card-body 안에서 남는 세로 공간을 흡수 — chapter2·3 의 .universe / .pol-stage 와 동일한 flex 패턴.
     chapter1 은 status-row + lens-bar (3행) + universe-stats 가 위에 있어 pre-content 가 길기 때문에
     universe 자체 min-height 는 0 으로 두고 flex grow 로 남는 공간을 채움. overflow: hidden 으로
     혹시 grid 가 자랄 공간보다 크게 자라더라도 외곽 카드 (height: 820 고정) 를 밀어내지 않도록. */
  .universe {
    position: relative;
    padding: 0;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .universe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
  }

  .company {
    background: var(--bg-soft);
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .company-top {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .company-flag {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
  }

  .company-name {
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.2;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .company-tag {
    font-size: 10px;
    letter-spacing: 0;
    color: var(--muted-soft);
    margin-top: 6px;
  }

  .company.dimmed {
    opacity: 0.2;
  }

  .company.highlight {
    background: var(--accent-soft);
    border-color: var(--accent);
  }

  .company.highlight .company-name { color: var(--ink); }
  .company.highlight .company-tag { color: var(--accent); }

  .company.spotlight {
    background: var(--ink);
    border-color: var(--ink);
    z-index: 10;
    box-shadow: 0 14px 36px rgba(0,0,0,0.32), 0 0 0 3px rgba(17,19,23,0.08);
  }

  .company.spotlight .company-name { color: white; }
  .company.spotlight .company-tag { color: rgba(255,255,255,0.7); }

  .company.live::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    background: var(--hot);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5);
    animation: hotPulse 1.6s ease-in-out infinite;
  }



  /* ===== LIVE TICKER ===== */
  .live-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 12px 18px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .live-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .live-dot {
    width: 7px;
    height: 7px;
    background: var(--live);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(0, 200, 150, 0.6);
    animation: livePulse 1.4s ease-in-out infinite;
  }

  .live-text {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--ink);
  }

  .live-feed {
    font-size: 12px;
    color: var(--muted);
    flex: 1;
    text-align: right;
    margin-left: 24px;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.3s ease;
  }

  /* ===== OVERLAY — popout 뒷배경 blur. lens-card-header / lens-card-progress
     는 별도 z-index 로 overlay 위에 올라가므로 blur 영향 없음 (backdrop-filter
     는 element 의 paint order 상 "뒤" 만 흐림 처리). */
  .overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
  }

  .overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* ===== POPOUT — chapter1-demo 내부 top/bottom 양쪽 고정으로 영역 안에 정확히 들어가게 ===== */
  .popout {
    position: absolute;
    /* top: 96px = lens-card-header(약 76px) + breathing room. 헤더 바와
       시각적으로 겹치지 않도록 조정. */
    top: 96px;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) scale(0.97);
    width: min(620px, 92%);
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .popout.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
  }

  .popout-head {
    padding: 18px 26px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
    background: white;
    position: relative;
  }

  /* live indicator inside popout */
  .popout-live {
    position: absolute;
    top: 18px;
    right: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink);
  }

  .popout-live-dot {
    width: 6px;
    height: 6px;
    background: var(--live);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(0, 200, 150, 0.6);
    animation: livePulse 1.4s ease-in-out infinite;
  }

  .popout-live-time {
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0;
  }

  .popout-id { flex: 1; }

  .popout-eyebrow {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--accent);
    margin-bottom: 8px;
  }

  .popout-name {
    font-family: var(--sans);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .popout-name .flag,
  .popout-name .fi { font-size: 22px; }

  .popout-name-tag {
    font-size: 11px;
    letter-spacing: 0;
    color: var(--muted);
    background: var(--bg-soft);
    padding: 5px 10px;
    border-radius: 5px;
    margin-left: 4px;
  }

  .popout-close {
    background: var(--bg-soft);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-start;
  }

  .popout-close:hover { background: var(--line); }

  .popout-body {
    overflow-y: auto;
    padding: 22px 26px 26px;
  }

  /* breadcrumb */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 11.5px;
    letter-spacing: 0;
    color: var(--muted);
  }

  .breadcrumb-item {
    cursor: pointer;
    transition: color 0.2s;
  }

  .breadcrumb-item:hover { color: var(--ink); }

  .breadcrumb-item.active {
    color: var(--accent);
    font-weight: 600;
  }

  .breadcrumb-sep { opacity: 0.4; }

  /* SpaceX card content */
  .sx-summary {
    font-size: 14px;
    color: var(--ink-soft);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--bg-soft);
    border-radius: 8px;
    position: relative;
  }

  .sx-summary strong { color: var(--ink); font-weight: 600; }

  .sx-meta {
    display: flex;
    gap: 18px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--line);
    align-items: center;
    flex-wrap: wrap;
  }

  .sx-meta strong { color: var(--accent); font-weight: 600; }

  .sx-meta-live {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--live);
    font-weight: 600;
  }

  .sx-meta-live-dot {
    width: 5px;
    height: 5px;
    background: var(--live);
    border-radius: 50%;
    animation: livePulse 1.4s ease-in-out infinite;
  }

  .nv-row {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
    animation: rowIn 0.5s ease forwards;
    position: relative;
  }

  .nv-row:last-child { border-bottom: none; }
  .nv-row:nth-child(1) { animation-delay: 0.15s; }
  .nv-row:nth-child(2) { animation-delay: 0.30s; }
  .nv-row:nth-child(3) { animation-delay: 0.45s; }
  .nv-row:nth-child(4) { animation-delay: 0.60s; }


  /* NEW badge on live signal */
  .nv-row.is-new::before {
    content: 'NEW';
    position: absolute;
    top: 8px;
    left: -8px;
    background: var(--hot);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 3px;
    letter-spacing: 0;
    box-shadow: 0 2px 8px rgba(220,38,38,0.3);
    animation: livePulse 1.4s ease-in-out infinite;
  }

  .nv-row-cat {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .nv-row-tag {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .nv-row-tag .num {
    background: var(--accent);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
  }

  .nv-row-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
  }

  .nv-row-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .nv-row-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
  }

  .nv-row-item-name {
    font-weight: 600;
    color: var(--ink);
  }

  .nv-row-item-sub {
    font-size: 12px;
    color: var(--muted);
  }

  .nv-row-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .nv-row-evidence {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
  }

  .nv-row-time {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--muted-soft);
    letter-spacing: 0.04em;
  }

  .nv-row.is-new .nv-row-time {
    color: var(--hot);
    font-weight: 600;
  }

  /* .next-link (Micron 으로 가는 cross-chapter teaser) 와 Micron 가치사슬 팝업 (.vchain-*)
     은 chapter 2 로 이전 — chapter2.css 참고 */

  /* ===== RESPONSIVE ===== */
  @media (max-width: 1024px) {
    .section { padding: 0 0 24px; }
    .intro-title { font-size: 34px; }
    .universe-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .popout { width: 94%; top: 84px; bottom: 40px; }
    .nv-row { grid-template-columns: 1fr; gap: 6px; }
    .nv-row-meta { align-items: flex-start; }
  }

  @media (max-width: 640px) {
    .intro-title { font-size: 26px; }
    .universe-grid { grid-template-columns: repeat(2, 1fr); }
    /* Mobile 에선 데모 step 마다 실제 하이라이트되는 회사만 노출.
       단순히 첫 12 장 cap 했더니 Datacenter / Robotics+KR / Blue Origin 등이
       모두 hidden 되어 step 이 진행돼도 "바뀌는 게 안 보이는" 문제 발생.
       각 demo step 의 highlight 가 viewport 에 잡히도록 explicit whitelist:
         step 1 Listed → NVIDIA·Microsoft·Google·Intel·CoreWeave·Equinix·NTT·Rainbow
         step 2 Datacenter → CoreWeave·Equinix·Lambda·NTT
         step 3 Robotics+KR → 레인보우로보틱스 (유일한 KR robotics)
         step 4 Private+Space → SpaceX·Blue Origin
         step 5 SpaceX popup → SpaceX */
    .universe-grid .company { display: none; }
    .universe-grid .company[data-name="SpaceX"],
    .universe-grid .company[data-name="NVIDIA"],
    .universe-grid .company[data-name="Microsoft"],
    .universe-grid .company[data-name="Google"],
    .universe-grid .company[data-name="Intel"],
    .universe-grid .company[data-name="CoreWeave"],
    .universe-grid .company[data-name="Equinix"],
    .universe-grid .company[data-name="Lambda Labs"],
    .universe-grid .company[data-name="NTT Data"],
    .universe-grid .company[data-name="레인보우로보틱스"],
    .universe-grid .company[data-name="Blue Origin"],
    .universe-grid .company[data-name="Anthropic"] {
      display: flex;
    }
    /* 칩 wrap 미관 개선: label 을 자기 row 로 올려보내서 chips 가 다음 row 에서
       자유롭게 wrap. label + chips 모두 가운데 정렬해서 비좁은 폰 폭에서도
       균형있게 보이도록. */
    .lens-row { justify-content: center; }
    .lens-label {
      flex-basis: 100%;
      min-width: 0;
      margin: 0 0 2px;
      font-size: 10.5px;
      text-align: center;
    }
    /* SpaceX 같은 spotlight 카드가 desktop 에서는 scale(1.08) 로 살짝 커지지만,
       mobile 2-col grid 에선 cell 밖으로 8% 튀어나가 옆 카드/카드 우측 가장자리
       를 침범. 모바일에선 어두운 배경 + 그림자만으로 충분히 강조되므로 scale
       제거. (다른 highlight 카드들은 이미 transform 없음 — 동일한 영역 안에서
       처리.) */
    .company.spotlight {
      transform: none;
    }
    /* Demo 가 안 쓰는 필터 chip 은 mobile 에서 숨김 — 데이터의 다양성은 데스크탑
       에서, mobile 은 concept 전달에 집중. */
    .lens-chip.add-chip { display: none; }
    .lens-chip[data-type="gov"],
    .lens-chip[data-type="startup"] { display: none; }
    .lens-chip[data-sector="ai"],
    .lens-chip[data-sector="semi"] { display: none; }
    .lens-chip[data-country="US"],
    .lens-chip[data-country="CN"],
    .lens-chip[data-country="JP"],
    .lens-chip[data-country="TW"] { display: none; }
    .popout-head { padding: 14px 16px; }
    .popout-body { padding: 14px 16px; }
    .popout-live { right: 50px; top: 14px; padding: 4px 8px; font-size: 8px; }
  }
}

/* ==========================================================================
   @keyframes — CSS Nesting 안에 두면 일부 브라우저가 무시하므로 외부로 분리
   ========================================================================== */
@keyframes chipPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 4px 16px rgba(15,17,21,0.25); }
  100% { transform: scale(1); }
}


@keyframes hotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
}


@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 200, 150, 0.6); }
  50% { box-shadow: 0 0 0 4px rgba(0, 200, 150, 0); }
}


@keyframes rowIn {
  to { opacity: 1; transform: translateY(0); }
}


@keyframes linkFlash {
  0%, 100% { background: var(--accent-dim); }
  50% { background: var(--accent-soft); box-shadow: 0 4px 16px rgba(var(--mint-rgb),0.25); }
}


@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}


@keyframes nodeIn {
  to { opacity: 1; }
}


