/*
   * 팔레트는 pikaview.link 의 실제 랜딩(jp98 레트로 테마)에 맞춘다 —
   * 순백 배경, #242424 본문, **네이비 #000080 강조**(랜딩의 링크·CTA 색),
   * 밝은 상단 헤더(사이트 .landing-header 와 같은 결), #f7f7f7 패널.
   * 예전엔 #235a9f 파랑·#27302a 어두운 헤더였는데 그게 사이트와 갈려
   * "다른 데서 붙여논" 느낌을 냈다(2026-08-17 사용자 지적). 이제 맞췄다.
   * --titlebar 는 삽화 속 PC 목업의 창틀·작업표시줄에만 쓴다(페이지 헤더 아님).
   */
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f7f7f7;
    --surface-2: #f3f3f3;
    --text: #242424;
    --text-sub: #5d5d5d;
    --accent: #000080;
    --accent-strong: #001b62;
    --accent-soft: #eef2fb;
    --titlebar: #27302a;
    --titlebar-text: #ffffff;
    --border: #d0d0d0;
    --border-soft: #e7e7e7;
    --warn: #a05a00;
    --warn-soft: #fff6dc;
    --ok: #007a33;
    --code-bg: #f3f3f3;
    --chip-p-bg: #e6f3ec;
    --chip-p-tx: #007a33;
    --chip-t-bg: #fff6dc;
    --chip-t-tx: #a05a00;
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  /* 상단바가 sticky 라 앵커 이동 시 제목이 그 뒤로 숨는다 — 그 높이만큼 멈춤 위치를 내린다. */
  section[id] { scroll-margin-top: 72px; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
    font-size: 15.5px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
  }
  code, .chip, .kbd {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  }

  /* 페이지 헤더는 사이트의 밝은 랜딩 헤더(.landing-header)에 맞춘다 — 흰 바탕,
   * 아래 실선, 왼쪽 워드마크(홈 링크), 오른쪽 버전 + [홈으로]. 예전의 어두운
   * 제목줄은 사이트와 이질적이라 걷어냈다. */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 10px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-soft);
  }
  .topbar-left { display: inline-flex; align-items: baseline; gap: 10px; min-width: 0; }
  .brand {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.16em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
  }
  .brand:hover, .brand:focus-visible { color: var(--accent-strong); }
  .topbar .doc-kind { color: var(--text-sub); font-size: 13.5px; white-space: nowrap; }
  .topbar-actions { display: inline-flex; align-items: center; gap: 12px; }
  .topbar .ver {
    font-size: 12.5px;
    color: var(--text-sub);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 99px;
    padding: 3px 10px;
    white-space: nowrap;
  }
  /* [홈으로] — 랜딩의 보조 CTA(.landing-secondary-cta) 와 같은 결: 네이비 테두리·글자, 흰 바탕. */
  .home-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    background: var(--bg);
    font-weight: 800;
    font-size: 13.5px;
    text-decoration: none;
    white-space: nowrap;
  }
  .home-btn:hover, .home-btn:focus-visible { background: var(--accent-soft); }
  @media (max-width: 560px) {
    .topbar { padding: 10px 16px; }
    .topbar .doc-kind, .topbar .ver { display: none; }
  }

  .shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 40px;
    max-width: 1060px;
    margin: 0 auto;
    padding: 28px 24px 80px;
  }
  nav.toc {
    position: sticky;
    top: 76px;
    align-self: start;
    font-size: 13.5px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
  .toc .group {
    margin: 0 0 6px;
    padding-top: 14px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-sub);
  }
  .toc a {
    display: block;
    padding: 4px 10px;
    color: var(--text-sub);
    text-decoration: none;
    border-left: 2px solid var(--border-soft);
  }
  .toc a:hover { color: var(--accent-strong); border-left-color: var(--accent); }
  .toc a.active {
    color: var(--accent-strong);
    border-left-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
  }
  main { max-width: 46rem; min-width: 0; }

  h1 {
    margin: 6px 0 10px;
    font-size: 30px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-wrap: balance;
  }
  .lede { color: var(--text-sub); font-size: 16.5px; margin: 0 0 8px; }
  h2 {
    margin: 52px 0 12px;
    padding-top: 18px;
    font-size: 21px;
    border-top: 1px solid var(--border-soft);
    text-wrap: balance;
  }
  main > section:first-of-type h2 { border-top: 0; margin-top: 24px; }
  h3 { margin: 28px 0 8px; font-size: 16.5px; }
  p { margin: 10px 0; }
  ul, ol { margin: 10px 0; padding-left: 22px; }
  li { margin: 4px 0; }
  a { color: var(--accent-strong); }
  b, strong { font-weight: 700; }

  code {
    background: var(--code-bg);
    border-radius: 4px;
    padding: 1.5px 6px;
    font-size: 0.88em;
  }
  .kbd {
    display: inline-block;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface);
    font-size: 0.85em;
    line-height: 1.7;
  }
  .btn-label {
    display: inline-block;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.92em;
    white-space: nowrap;
  }

  .chip {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 7px;
    border-radius: 4px;
    font-size: 0.82em;
    font-weight: 700;
    text-align: center;
    line-height: 1.8;
  }
  .chip-p { background: var(--chip-p-bg); color: var(--chip-p-tx); }
  .chip-t { background: var(--chip-t-bg); color: var(--chip-t-tx); }

  .callout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    margin: 16px 0;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: var(--accent-soft);
    font-size: 14.5px;
  }
  .callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
  .callout .ico { font-weight: 800; color: var(--accent-strong); }
  .callout.warn .ico { color: var(--warn); }
  .callout p { margin: 0 0 6px; }
  .callout p:last-child { margin-bottom: 0; }

  .table-wrap { overflow-x: auto; margin: 14px 0; }
  table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }
  th, td {
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: top;
  }
  th { background: var(--surface); font-weight: 700; white-space: nowrap; }

  .steps { counter-reset: step; list-style: none; padding-left: 0; margin: 14px 0; }
  .steps > li {
    counter-increment: step;
    position: relative;
    padding: 2px 0 14px 40px;
  }
  .steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 11.5px;
    top: 31px;
    bottom: 2px;
    width: 1px;
    background: var(--border);
  }

  .flow {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 16px 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .flow .node {
    flex: 1 1 0;
    min-width: 110px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    text-align: center;
    font-size: 13.5px;
  }
  .flow .node b { display: block; font-size: 14px; }
  .flow .node small { color: var(--text-sub); }
  .flow .arrow {
    align-self: center;
    color: var(--text-sub);
    font-size: 16px;
    flex: none;
  }

  details.faq {
    margin: 8px 0;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--surface);
  }
  details.faq summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14.5px;
  }
  details.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  details.faq .a { padding: 0 14px 12px; font-size: 14.5px; color: var(--text); }

  footer.pagefoot {
    margin-top: 64px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-sub);
    font-size: 13px;
  }

  /* ── 첫 화면 개념도: 한 사람 → 세 곳의 PC (탑다운 장면) ──
   * 통짜 SVG 한 장이 아니라 카드별 소형 SVG 로 나눈 이유: 폰에서 세로로
   * 쌓일 때 각 그림이 제 크기를 지켜 글자가 안 뭉개진다. */
  .hero-scene { margin: 20px 0 6px; }
  .hero-scene svg text { font-family: inherit; }
  .hs-controllers {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
  }
  .hs-controllers figure { flex: 0 1 210px; min-width: 0; margin: 0; text-align: center; }
  .hs-controllers svg { display: block; width: 100%; height: auto; }
  .hs-fig-cap { margin-top: 2px; font-size: 13px; font-weight: 700; line-height: 1.45; }
  .hs-fig-cap small { display: block; font-weight: 400; color: var(--text-sub); font-size: 12px; }
  .hs-or {
    align-self: center;
    margin-bottom: 52px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-strong);
    white-space: nowrap;
  }
  .hs-beams { display: block; width: 100%; height: 54px; }
  .hs-beams path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 3 7;
    stroke-linecap: round;
    animation: hs-flow 1.4s linear infinite;
  }
  @keyframes hs-flow { to { stroke-dashoffset: -10; } }
  @media (prefers-reduced-motion: reduce) { .hs-beams path { animation: none; } }
  .hs-connector { display: none; }
  .hs-pcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .hs-pc {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
  }
  .hs-pc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 10px;
    background: var(--titlebar);
    color: var(--titlebar-text);
    font-size: 12.5px;
    font-weight: 600;
  }
  .hs-pc svg { display: block; width: 100%; height: auto; background: var(--surface); }
  .hs-pc-cap { padding: 7px 10px 9px; font-size: 12.5px; line-height: 1.5; color: var(--text-sub); }
  .hero-caption { margin: 10px 0 4px; font-size: 13px; color: var(--text-sub); }
  /*
   * 강점 카드. 개수가 바뀔 때마다 이 최소폭을 다시 재라 — main 칼럼은 742px
   * (1060 − 좌우 여백 48 − 목차 230 − 간격 40)이고, auto-fit 은 그 폭에
   * 몇 장이 들어가느냐로 열 수를 정한다.
   *   2장(~2026-08-17)  1fr 1fr
   *   3장(2026-08-17)   minmax(210px) → 3열
   *   4장(2026-08-27)   minmax(330px) → **2×2**
   * 210px 을 그대로 두면 4장이 3+1 로 갈려 넷째 카드만 혼자 남는다.
   */
  .hs-strengths {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 12px;
    margin: 18px 0 6px;
  }
  .hs-strength {
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: var(--accent-soft);
    font-size: 14px;
  }
  .hs-strength .t { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
  .hs-strength p { margin: 0; }
  @media (max-width: 640px) {
    .hs-beams { display: none; }
    .hs-connector {
      display: block;
      width: 0;
      height: 26px;
      margin: 4px auto;
      border-left: 2px dashed var(--accent);
    }
    .hs-pcs { grid-template-columns: minmax(0, 1fr); max-width: 300px; margin: 0 auto; }
    .hs-or { margin-bottom: 40px; }
    .hs-strengths { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
    nav.toc { position: static; max-height: none; margin-bottom: 20px; border: 1px solid var(--border-soft); border-radius: 8px; padding: 6px 14px 14px; background: var(--surface); }
    .topbar { padding: 12px 16px; }
    .shell { padding: 20px 16px 60px; }
  }

/* 장 사이 이동 (build-guide.py 가 더한다 — 정본에는 없는 자리다). */
.pagenav { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: 14px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 22px 0; }
.guide-card { display: block; padding: 14px 16px; border: 1px solid var(--border-soft); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); text-decoration: none; color: inherit; }
.guide-card:hover { background: var(--accent-soft); }
.guide-card b { display: block; font-size: 15.5px; color: var(--accent-strong); margin-bottom: 4px; }
.guide-card span { font-size: 13.5px; color: var(--text-sub); }
