/* 금고 읽기 화면. 노션의 읽는 감각(왼쪽 목차 + 좁은 본문)을 우리 결로 옮겼다. */

.reader-body { overflow-x: hidden; }
.hide { display: none !important; }

/* ── 코드 넣는 화면 ───────────────────────── */
.gate { max-width: 420px; margin: 11vh auto 0; padding: 0 20px 80px; position: relative; z-index: 1; }
.gate__h { font-family: var(--disp); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.04em; margin: 10px 0 12px; }
.gate__p { color: var(--mute); font-size: 14.5px; line-height: 1.8; margin: 0 0 26px; }
.gate__p b, .gate__hint b { color: var(--bone); }
.gate__hint { margin-top: 22px; font-size: 13px; color: var(--mute); line-height: 1.85; }
.code-in { font-family: var(--mono); font-size: 16px; letter-spacing: 0.1em; text-align: center; text-transform: uppercase; height: 54px; }
.msg { font-size: 13.5px; padding: 11px 13px; border-radius: 8px; margin-bottom: 16px; display: none; line-height: 1.7; }
.msg.on { display: block; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.35); color: #ffb4b4; }

/* ── 골격 ────────────────────────────────── */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.icobtn {
  background: none; border: 0; color: var(--mute); cursor: pointer; padding: 6px 8px;
  border-radius: 6px; font-size: 12.5px; line-height: 1;
}
.icobtn:hover { background: var(--ink-3); color: var(--bone); }
.icobtn svg { width: 18px; height: 18px; display: block; }

/* ── 왼쪽 목차 ───────────────────────────── */
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #0e0e10; border-right: 1px solid var(--line);
}
.side__top { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.side__close { display: none; margin-left: auto; }
.side__search { position: relative; padding: 0 12px 10px; }
.side__search svg { position: absolute; left: 22px; top: 9px; width: 15px; height: 15px; color: var(--mute-2); }
.side__search input {
  width: 100%; height: 33px; padding: 0 10px 0 32px; font-size: 13px;
  background: var(--ink-3); border: 1px solid transparent; border-radius: 6px; color: var(--bone);
}
.side__search input:focus { outline: none; border-color: var(--line-2); }
.side__search input::placeholder { color: var(--mute-2); }

.tree { flex: 1; overflow-y: auto; padding: 4px 8px 20px; scrollbar-width: thin; }
.tree::-webkit-scrollbar { width: 8px; }
.tree::-webkit-scrollbar-thumb { background: rgba(246, 246, 241, 0.12); border-radius: 4px; }

.sec { margin-bottom: 2px; }
.sec__h {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 6px 8px; border-radius: 6px; color: var(--mute);
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em;
}
.sec__h:hover { background: var(--ink-3); color: var(--bone); }
.sec__h .tw { width: 12px; flex: none; transition: transform 160ms var(--ease); color: var(--mute-2); }
.sec.open .sec__h .tw { transform: rotate(90deg); }
.sec__h .n { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--mute-2); }
.sec__list { display: none; }
.sec.open .sec__list { display: block; }

.tree a {
  display: block; padding: 5px 10px 5px 26px; border-radius: 6px;
  font-size: 13px; line-height: 1.5; color: #b9b9b4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree a:hover { background: var(--ink-3); color: var(--bone); }
.tree a.on { background: rgba(255, 87, 1, 0.13); color: var(--bone); box-shadow: inset 2px 0 0 var(--flame); }
.tree .empty { padding: 10px; font-size: 12.5px; color: var(--mute-2); }

.side__bot {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--mute);
}
.side__me { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 본문 ────────────────────────────────── */
.doc { min-width: 0; }
.doc__bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 86%, transparent); backdrop-filter: blur(12px);
}
.doc__menu { display: none; }
.crumb { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb b { color: var(--bone); font-weight: 500; }
.crumb i { font-style: normal; color: var(--mute-2); margin: 0 7px; }

.page { max-width: 820px; margin: 0 auto; padding: 46px 28px 140px; }
.page h1.t {
  font-family: var(--disp); font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 800;
  letter-spacing: -0.04em; line-height: 1.15; margin: 0 0 30px;
}

/* 문서 안 요소 — 노션 읽는 감각 */
.page h1 { font-size: 1.9em; font-weight: 800; letter-spacing: -0.03em; margin: 1.6em 0 0.5em; }
.page h2 { font-size: 1.45em; font-weight: 700; letter-spacing: -0.025em; margin: 1.7em 0 0.5em; }
.page h3 { font-size: 1.15em; font-weight: 700; letter-spacing: -0.02em; margin: 1.5em 0 0.4em; }
.page h4 { font-size: 1em; font-weight: 700; margin: 1.3em 0 0.3em; }
.page p { margin: 0.55em 0; line-height: 1.85; font-size: 15.5px; color: #d7d7d2; }
.page strong { color: var(--bone); font-weight: 700; }
.page em { color: #d7d7d2; }
.page hr { border: 0; height: 1px; background: var(--line); margin: 2.2em 0; }

.page ul, .page ol { margin: 0.6em 0; padding-left: 1.5em; display: flex; flex-direction: column; gap: 5px; }
.page li { line-height: 1.8; font-size: 15.5px; color: #d7d7d2; }
.page li.sub { margin-left: 1.1em; }
.page li.todo { list-style: none; display: flex; gap: 9px; align-items: flex-start; margin-left: -1.4em; }
.page li.todo .box {
  width: 16px; height: 16px; flex: none; margin-top: 4px; border-radius: 3px;
  border: 1.5px solid var(--line-2); display: grid; place-items: center;
  font-size: 11px; line-height: 1; color: transparent;
}
.page li.todo.on .box { background: var(--flame); border-color: var(--flame); color: #fff; }

.page code {
  font-family: var(--mono); font-size: 0.86em; padding: 2px 5px; border-radius: 4px;
  background: rgba(255, 87, 1, 0.1); color: #ff9a62; word-break: break-all;
}
.page pre.code {
  background: #0e0e10; border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; overflow-x: auto; margin: 1em 0; position: relative;
}
.page pre.code code {
  font-family: var(--mono); font-size: 12.8px; line-height: 1.75; background: none;
  color: #cfcfca; padding: 0; white-space: pre; word-break: normal;
}
.page pre.code[data-lang]::after {
  content: attr(data-lang); position: absolute; top: 8px; right: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute-2);
}

.page .callout {
  display: flex; gap: 12px; margin: 1.1em 0; padding: 14px 16px;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px;
}
.page .callout.warn { background: rgba(255, 87, 1, 0.07); border-color: rgba(255, 87, 1, 0.3); }
.page .callout__i { font-size: 16px; line-height: 1.6; flex: none; }
.page .callout p { margin: 0 0 0.35em; font-size: 14.5px; }
.page .callout p:last-child { margin-bottom: 0; }

.page .tbl { overflow-x: auto; margin: 1.1em 0; border: 1px solid var(--line); border-radius: 8px; }
.page table { border-collapse: collapse; width: 100%; font-size: 14px; }
.page th, .page td { text-align: left; padding: 9px 13px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.page th:last-child, .page td:last-child { border-right: 0; }
.page tr:last-child td { border-bottom: 0; }
.page th { background: var(--ink-2); font-weight: 600; color: var(--bone); white-space: nowrap; }
.page td { color: #d7d7d2; line-height: 1.7; }

.page a { color: #9db7ff; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(157, 183, 255, 0.4); }
.page a:hover { text-decoration-color: currentColor; }
.page a.inner { color: var(--flame); text-decoration-color: rgba(255, 87, 1, 0.45); }
.page a.dl {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--ink-2); color: var(--bone); font-size: 14px; font-weight: 600;
  transition: border-color 150ms var(--ease), background 150ms var(--ease);
}
.page a.dl:hover { border-color: var(--flame); background: var(--ink-3); }
.page a.dl svg { width: 16px; height: 16px; flex: none; color: var(--flame); }

/* 받는 파일 목록 화면 */
.files { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.frow { display: flex; align-items: center; gap: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--ink-2); }
.frow:last-child { border-bottom: 0; }
.frow:hover { background: var(--ink-3); }
.frow svg { width: 18px; flex: none; color: var(--mute-2); }
.frow .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .s { font-family: var(--mono); font-size: 11.5px; color: var(--mute); flex: none; }
.frow.done .t { color: var(--mute); }

/* ── 좁은 화면 ───────────────────────────── */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 282px; z-index: 60;
    transform: translateX(-100%); transition: transform 220ms var(--ease);
  }
  .app.nav .side { transform: none; }
  .side__close { display: block; }
  .doc__menu { display: block; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 50; opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease); }
  .app.nav .scrim { opacity: 1; pointer-events: auto; }
  .page { padding: 32px 20px 120px; }
  .gutters { display: none; }
}
@media (min-width: 881px) { .scrim { display: none; } }

/* ── 더한 것 ──────────────────────────────── */
.dim { color: var(--mute); }
.kbd {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 6px; color: var(--mute);
  background: var(--ink-3); white-space: nowrap;
}
.doc__bar .crumb { flex: 1; }
.doc__bar #qfbtn { flex: none; }
.doc__bar #qfbtn:hover { color: var(--bone); border-color: var(--bone); }

/* 읽은 표시 */
.tree a { display: flex; align-items: center; gap: 8px; padding-left: 14px; }
.tree a .dot {
  width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: transparent; border: 1px solid var(--mute-2);
}
.tree a.read .dot { background: var(--mute-2); border-color: var(--mute-2); }
.tree a.on .dot { background: var(--flame); border-color: var(--flame); }
.tree a > span:not(.dot) { overflow: hidden; text-overflow: ellipsis; }

/* 코드 복사 */
.page pre.code { padding-top: 34px; }
.page pre.code .copy {
  position: absolute; top: 7px; right: 8px; z-index: 2;
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 5px; cursor: pointer;
  background: var(--ink-3); border: 1px solid var(--line-2); color: var(--mute);
  opacity: 0; transition: opacity 140ms var(--ease), color 140ms var(--ease);
}
.page pre.code:hover .copy, .page pre.code .copy:focus-visible { opacity: 1; }
.page pre.code .copy:hover { color: var(--bone); border-color: var(--bone); }
.page pre.code .copy.ok { opacity: 1; color: var(--ok); border-color: var(--ok); }
.page pre.code[data-lang]::after { right: 62px; }

/* 이어 읽기 */
.pager { display: flex; gap: 12px; justify-content: space-between; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager__a {
  flex: 1; max-width: 48%; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--ink-2); transition: border-color 150ms var(--ease);
}
.pager__a:hover { border-color: var(--line-2); }
.pager__a.right { text-align: right; align-items: flex-end; }
.pager__a span { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--mute-2); }
.pager__a b { font-size: 14px; font-weight: 600; color: var(--bone); line-height: 1.5; }

/* 문서 안 목차 */
.toc { display: none; }
@media (min-width: 1280px) {
  .toc {
    display: block; position: fixed; top: 86px; right: 28px; width: 190px;
    max-height: calc(100vh - 140px); overflow-y: auto; padding-left: 12px;
    border-left: 1px solid var(--line);
  }
  .toc__h { font-size: 11px; font-weight: 700; letter-spacing: 0.01em; color: var(--mute-2); margin-bottom: 9px; }
  .toc a { display: block; font-size: 12.5px; line-height: 1.5; padding: 4px 0; color: var(--mute); }
  .toc a.lv3 { padding-left: 11px; font-size: 12px; }
  .toc a:hover { color: var(--bone); }
  .toc a.on { color: var(--flame); }
}

/* 빠른 찾기 */
.qf { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); }
.qf.on { display: block; }
.qf__box {
  max-width: 620px; margin: 11vh auto 0; background: #121214;
  border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}
.qf__top { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.qf__top svg { width: 17px; height: 17px; color: var(--mute-2); flex: none; }
.qf__top input { flex: 1; background: none; border: 0; outline: none; font-size: 15.5px; color: var(--bone); }
.qf__top input::placeholder { color: var(--mute-2); }
.qf__list { max-height: 54vh; overflow-y: auto; padding: 6px; }
.qf__r { display: block; padding: 9px 12px; border-radius: 7px; }
.qf__r b { display: block; font-size: 14px; font-weight: 600; color: var(--bone); }
.qf__m { display: block; font-size: 12px; color: var(--mute); margin-top: 2px; line-height: 1.5; }
.qf__r:hover, .qf__r.on { background: var(--ink-3); }
.qf__r.on { box-shadow: inset 2px 0 0 var(--flame); }
.qf__hint { padding: 18px 14px; font-size: 13px; color: var(--mute-2); }

/* 화면 구매자 표시 — 스크린샷으로 새 나가도 자리를 안다 */
.wm {
  position: fixed; inset: -20% -20%; z-index: 1; pointer-events: none; user-select: none;
  font-family: var(--mono); font-size: 11px; line-height: 5.2; white-space: pre;
  color: rgba(246, 246, 241, 0.012); transform: rotate(-24deg); overflow: hidden;
}
/* 워터마크(.wm)보다 위로. .qf 는 fixed 라 여기 넣으면 안 된다 — 자리가 무너진다. */
.app { position: relative; z-index: 2; }
