/* 컴퓨트 마켓 바이블 · K2 스타일. 규칙은 `_편집 스펙.md` §7 */

:root {
  --ink: #0A0A0A;
  --orange: #FF5B14;
  --paper: #FFFFFF;
  --gray: #8A8A8A;
  --line: #E4E4E4;
  --sans: "Pretendard Variable", Pretendard, -apple-system, system-ui, sans-serif;
  --display: "Black Han Sans", var(--sans);
  --num: "Anton", Impact, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --col: 760px;
  --bar-h: 64px;
  --prog-h: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* 장으로 이동하면 표지가 상단 바 바로 밑에 붙는다. 여백을 두면 앞 장의 흰 배경이 비친다 */
.chapter { scroll-margin-top: calc(var(--bar-h) + var(--prog-h) - 2px); }
.prose h2, .prose h3 { scroll-margin-top: calc(var(--bar-h) + var(--prog-h) + 24px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 18px; line-height: 1.85; letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; overflow-wrap: break-word;
}
a { color: inherit; }
img { max-width: 100%; }

.nowrap { white-space: nowrap; }
.dot { display: inline-block; width: .26em; height: .26em; border-radius: 50%; background: var(--orange); margin-left: .08em; vertical-align: baseline; }

/* ---------------------------------------------------------------- 버튼 */
.btn {
  display: inline-block; font-family: var(--display); font-size: 26px; line-height: 1; letter-spacing: 0;
  text-decoration: none; padding: 20px 34px; border: 0; cursor: pointer; white-space: nowrap; flex: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-white { background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--orange); }
.btn-black { background: var(--ink); color: var(--paper); box-shadow: 6px 6px 0 var(--orange); font-size: 20px; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 var(--orange); }
.btn:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--orange); }

/* ---------------------------------------------------------------- 티커 */
.ticker { overflow: hidden; height: 48px; display: flex; align-items: center; white-space: nowrap; }
.ticker-track { display: flex; width: max-content; animation: ticker 36s linear infinite; }
.ticker-group { display: flex; align-items: center; gap: 40px; padding-right: 40px; }
.ticker span { font-family: var(--mono); font-weight: 800; font-size: 17px; letter-spacing: 0; }
.ticker .sep { display: inline-block; width: 10px; height: 10px; background: var(--orange); }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-reverse .ticker-track { animation-direction: reverse; }
.ticker-orange { background: var(--orange); color: var(--ink); }
.ticker-white { background: var(--paper); color: var(--ink); }
.ticker-black { background: var(--ink); color: var(--paper); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------------------------------------------------------------- 온보딩 */
.page-onboarding { background: var(--ink); min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.onboarding { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 48px; padding: 48px 64px; }
.ob-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(88px, 14vw, 200px); line-height: 1.05; letter-spacing: -0.02em; }
.ob-title span { display: block; }
.ob-title .o { color: var(--orange); }
.ob-title .w { color: var(--paper); }
.onboarding .btn { align-self: flex-start; }

/* ---------------------------------------------------------------- 목차 */
/* 검정 띠는 화면 폭 그대로, 안쪽은 아래 목록과 같은 폭. 큰 화면에서도 더 커지지 않는다 */
.masthead { background: var(--ink); color: var(--paper); }
.mh-inner { max-width: 1440px; margin: 0 auto; padding: 44px 64px 48px; display: flex; justify-content: space-between; align-items: flex-end; gap: 48px; }
.kicker { margin: 0; font-family: var(--mono); font-weight: 800; font-size: 15px; letter-spacing: .12em; color: var(--orange); }
.masthead h1 { margin: 14px 0 12px; font-family: var(--display); font-weight: 400; font-size: clamp(48px, 5.4vw, 76px); line-height: 1.05; letter-spacing: -0.02em; }
.one-liner { margin: 0; font-size: 18px; font-weight: 500; color: #BDBDBD; line-height: 1.5; }
.masthead .btn { font-size: 20px; padding: 16px 26px; box-shadow: 6px 6px 0 var(--orange); }
.contents { max-width: 1440px; margin: 0 auto; padding: 56px 64px 72px; display: flex; flex-direction: column; gap: 48px; }
.toc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.bar { margin: 0; background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.2; padding: 10px 16px; letter-spacing: 0; }
.toc-row { display: flex; align-items: center; gap: 20px; padding: 16px; border-bottom: 2px solid var(--ink); text-decoration: none; transition: background .12s; }
.toc-row:hover { background: #FFF1EA; }
.toc-row .n { font-family: var(--num); font-size: 36px; line-height: 1; color: var(--orange); width: 48px; flex: none; }
.toc-row .t { flex: 1; font-family: var(--display); font-size: 26px; line-height: 1.25; letter-spacing: 0; }
.toc-row .c { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--gray); }
.toc-row .a { font-family: var(--mono); font-size: 22px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border: 2px solid var(--ink); text-decoration: none; font-family: var(--display); font-size: 16px; }
.chip b { font-family: var(--num); font-weight: 400; font-size: 18px; color: var(--orange); }

/* ---------------------------------------------------------------- 상단 고정 바 */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--ink); color: var(--paper); }
.topbar-row { height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px; }
.logo { font-family: var(--display); font-size: 18px; text-decoration: none; color: var(--paper); letter-spacing: 0; white-space: nowrap; }
.current { display: none; }
.steps { display: flex; gap: 4px; }
.step { width: 30px; height: 26px; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 500; text-decoration: none; color: rgba(255,255,255,.4); border: 1px solid rgba(255,255,255,.15); letter-spacing: 0; }
.step.is-done { color: var(--paper); border-color: rgba(255,255,255,.5); }
.step.is-current { background: var(--orange); border-color: var(--orange); color: var(--ink); font-weight: 800; }
.btn-toc { font-family: var(--display); font-size: 16px; background: var(--paper); color: var(--ink); border: 0; padding: 8px 14px; cursor: pointer; text-decoration: none; letter-spacing: 0; }
.progress { height: var(--prog-h); background: #262626; }
.progress i { display: block; height: 100%; width: 0; background: var(--orange); }

/* ---------------------------------------------------------------- 장 표지 */
.opener { background: var(--ink); color: var(--paper); }
/* 검정 띠는 화면 폭 그대로, 안쪽 내용은 본문 칼럼 폭에 맞춘다. 큰 화면에서도 더 커지지 않는다 */
.opener-body { max-width: calc(var(--col) + 48px); margin: 0 auto; padding: 56px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.opener-title { display: flex; align-items: flex-end; gap: 28px; }
.big-num { font-family: var(--num); font-size: clamp(120px, 11vw, 168px); line-height: .85; color: var(--orange); font-variant-numeric: tabular-nums; flex: none; }
.opener-title h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: clamp(48px, 5.4vw, 84px); line-height: 1.08; letter-spacing: -0.02em; }
.deck { margin: 0; font-size: 19px; font-weight: 500; line-height: 1.6; color: #D6D6D6; }
.deck a { color: var(--paper); }
.questions { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.questions li { border-top: 1px solid rgba(255,255,255,.25); padding-top: 12px; display: flex; gap: 12px; font-size: 15px; font-weight: 700; line-height: 1.5; }
.questions b { font-family: var(--num); font-weight: 400; font-size: 20px; line-height: 1.1; color: var(--orange); width: 28px; flex: none; }

/* ---------------------------------------------------------------- 본문 */
.prose { max-width: calc(var(--col) + 48px); margin: 0 auto; padding: 72px 24px 96px; }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 28px; }
.prose strong { font-weight: 700; }
.prose a { text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose h2.sec { margin: 72px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 4px solid var(--ink); font-weight: 400; }
.prose > h2.sec:first-child { margin-top: 0; }
.sec-num { font-family: var(--num); font-size: 20px; line-height: 1; background: var(--orange); padding: 5px 10px; letter-spacing: 0; }
.sec-num-text { font-family: var(--display); font-size: 17px; padding: 6px 10px; }
.sec-title { font-family: var(--display); font-size: 44px; line-height: 1.2; letter-spacing: -0.01em; }
.prose h3 { margin: 48px 0 0; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.3; letter-spacing: 0; }
.prose h2.handoff { margin: 80px 0 0; font-weight: 400; }
.handoff span { display: inline-block; background: var(--ink); color: var(--paper); font-family: var(--display); font-size: 18px; padding: 6px 12px; letter-spacing: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; }
.prose li + li { margin-top: 8px; }
.prose ul li::marker { color: var(--orange); }
.prose ol li::marker { font-family: var(--mono); font-weight: 800; color: var(--orange); }
.prose blockquote { margin: 0; padding: 4px 0 4px 24px; border-left: 4px solid var(--orange); font-weight: 600; }
.prose code { font-family: var(--mono); font-size: .85em; background: #F2F2F2; padding: 2px 6px; letter-spacing: 0; }
.prose pre { margin: 0; background: var(--ink); color: var(--paper); padding: 20px 24px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: 15px; line-height: 1.6; }

/* 표는 가로 스크롤 없이 칼럼 폭 안에서 줄바꿈한다 */
.table-wrap { border: 3px solid var(--ink); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.prose th { background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 400; font-size: 15px; text-align: left; padding: 10px 14px; letter-spacing: 0; }
.prose td { padding: 11px 14px; border-top: 1px solid #D0D0D0; vertical-align: top; overflow-wrap: break-word; }
.prose td:first-child { font-weight: 700; }

.read-end { text-align: center; padding: 48px 24px 120px; }

/* ---------------------------------------------------------------- 그림 */
.fig { margin: 56px 0 0; position: relative; }
.fig-sticky { position: relative; display: flex; justify-content: center; }
.fig-scale { width: 820px; flex: none; zoom: var(--z, 1); padding: 0 10px 10px 0; }
.fig [data-step] { transition: opacity .4s ease; }
.fig [data-step].is-off { opacity: .12; }
.js-reveal .fig[data-steps]:not([data-steps="0"]) .fig-sticky { position: sticky; }

/* ---------------------------------------------------------------- 그림 크게 보기 (폰) */
.fig-zoom { display: none; }
.fig-viewer { position: fixed; inset: 0; z-index: 90; background: var(--ink); color: var(--paper); display: flex; flex-direction: column; }
.fig-viewer[hidden] { display: none; }
.fv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 3px solid var(--orange); }
.fv-label { font-family: var(--display); font-size: 16px; background: var(--orange); color: var(--ink); padding: 4px 10px; letter-spacing: 0; }
.fv-hint { font-family: var(--mono); font-size: 11px; font-weight: 700; color: rgba(255,255,255,.6); letter-spacing: 0; }
.fv-stage { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px; }
.fv-canvas { width: 820px; padding: 0 10px 10px 0; }
.fv-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.2); }
.fv-foot button { font-family: var(--display); font-size: 17px; letter-spacing: 0; padding: 12px 16px; cursor: pointer; border: 2px solid var(--paper); }
.fv-fit { background: var(--ink); color: var(--paper); }
.fv-close { background: var(--paper); color: var(--ink); box-shadow: 4px 4px 0 var(--orange); }
body.viewer-open { overflow: hidden; }
body.viewer-open .toc-fab { display: none; }

/* ---------------------------------------------------------------- 목차 패널 · 시트 */
.toc-scrim { position: fixed; inset: 0; background: rgba(10,10,10,.6); z-index: 60; }
.toc {
  position: fixed; z-index: 70; top: calc(var(--bar-h) + 12px); right: 32px; width: min(808px, calc(100vw - 64px));
  max-height: calc(100vh - var(--bar-h) - 40px); overflow: auto;
  background: var(--ink); color: var(--paper); border: 3px solid var(--orange); box-shadow: 10px 10px 0 var(--orange);
  padding: 20px 28px 24px;
}
.toc-grip { display: none; }
.toc-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.2); }
.toc-all { font-family: var(--mono); font-size: 12px; font-weight: 800; color: rgba(255,255,255,.7); letter-spacing: 0; }
.toc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; padding: 12px 0; }
.toc-item { display: flex; align-items: center; gap: 12px; padding: 7px 10px; text-decoration: none; font-family: var(--display); font-size: 17px; letter-spacing: 0; }
.toc-item b { font-family: var(--num); font-weight: 400; font-size: 20px; color: var(--orange); width: 28px; }
.toc-item span { flex: 1; }
.toc-item em { display: none; font-style: normal; font-family: var(--mono); font-size: 11px; font-weight: 800; }
.toc-item:hover { background: #1F1F1F; }
.toc-item.is-current { background: var(--orange); color: var(--ink); }
.toc-item.is-current b { color: var(--ink); }
.toc-item.is-current em { display: inline; }
.toc-secs { border-top: 1px solid rgba(255,255,255,.2); padding-top: 14px; }
.toc-secs-label { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--orange); letter-spacing: 0; }
.toc-secs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toc-secs-chips a { font-size: 13px; font-weight: 700; padding: 6px 10px; border: 1px solid var(--paper); text-decoration: none; line-height: 1.3; }
.toc-fab { display: none; }

/* ---------------------------------------------------------------- 부록 */
.appendix h1 { font-family: var(--display); font-weight: 400; font-size: 48px; line-height: 1.2; margin: 0; }

/* ---------------------------------------------------------------- 모바일 */
@media (max-width: 767px) {
  :root { --bar-h: 52px; --prog-h: 3px; }
  body { font-size: 16px; line-height: 1.8; }
  .btn { font-size: 22px; padding: 18px 24px; }
  .ticker { height: 36px; }
  .ticker span { font-size: 13px; }
  .ticker-group { gap: 22px; padding-right: 22px; }
  .ticker .sep { width: 8px; height: 8px; }

  .onboarding { padding: 32px 24px; gap: 36px; justify-content: center; }
  .ob-title { font-size: 25vw; }
  .ob-title .w { word-spacing: 100vw; }
  .onboarding .btn { align-self: stretch; text-align: center; }

  .mh-inner { flex-direction: column; align-items: stretch; padding: 32px 24px 36px; gap: 22px; }
  .masthead h1 { font-size: 48px; margin: 12px 0 10px; }
  .masthead .btn { text-align: center; font-size: 19px; }
  .one-liner { font-size: 16px; }
  .kicker { font-size: 12px; letter-spacing: .04em; }
  .contents { padding: 28px 16px 36px; gap: 28px; }
  .toc-cols { grid-template-columns: 1fr; gap: 28px; }
  .bar { font-size: 17px; padding: 8px 12px; }
  .toc-row { padding: 13px 12px; gap: 12px; }
  .toc-row .n { font-size: 26px; width: 34px; }
  .toc-row .t { font-size: 19px; }
  .toc-row .c { display: none; }

  .topbar-row { padding: 0 16px; }
  .topbar .logo, .steps, .topbar .btn-toc { display: none; }
  .current { display: flex; align-items: center; gap: 10px; }
  .cur-num { font-family: var(--num); font-weight: 400; font-size: 22px; color: var(--orange); }
  .cur-title { font-family: var(--display); font-size: 18px; letter-spacing: 0; }

  .opener-body { padding: 32px 20px 40px; gap: 16px; }
  .opener-title { flex-direction: column; align-items: flex-start; gap: 8px; }
  .big-num { font-size: 120px; }
  .opener-title h2 { font-size: clamp(40px, 13vw, 60px); }
  .deck { font-size: 16px; }
  .questions { grid-template-columns: 1fr; gap: 12px; }

  .prose { padding: 36px 20px 48px; }
  .prose > * + * { margin-top: 24px; }
  .prose h2.sec { margin-top: 56px; border-bottom-width: 3px; }
  .sec-num { font-size: 16px; padding: 3px 8px; }
  .sec-title { font-size: 30px; }
  .prose h3 { font-size: 21px; }
  .table-wrap { border-width: 2px; }
  .prose table { font-size: 13px; line-height: 1.5; }
  .prose th { font-size: 13px; padding: 8px 6px; }
  .prose td { padding: 9px 6px; }
  .prose th:first-child, .prose td:first-child { padding-left: 10px; }
  /* 열이 넷 이상인 표는 더 줄이고, 긴 영단어도 칸 안에서 끊는다. 가로 스크롤을 만들지 않는다 */
  .wide table { font-size: 12px; }
  .wide th { font-size: 12px; }
  .wide th, .wide td { padding: 7px 4px; overflow-wrap: anywhere; }
  .wide th:first-child, .wide td:first-child { padding-left: 8px; }
  .prose pre { padding: 14px 16px; }
  .prose pre code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
  .fig { margin-top: 40px; cursor: zoom-in; }
  .fig-zoom {
    display: block; margin: 14px auto 0; font-family: var(--display); font-size: 15px; letter-spacing: 0;
    background: var(--ink); color: var(--paper); border: 0; padding: 9px 14px; box-shadow: 4px 4px 0 var(--orange); cursor: pointer;
  }

  .toc {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: calc(100vh - 36px);
    border: 0; border-top: 3px solid var(--orange); box-shadow: none; padding: 0 16px 96px;
  }
  .toc-grip { display: block; width: 44px; height: 4px; background: rgba(255,255,255,.35); margin: 10px auto 6px; }
  .toc-list { grid-template-columns: 1fr; }
  .toc-item { padding: 5px 10px; font-size: 16px; }
  .toc-fab {
    display: block; position: fixed; right: 16px; bottom: 20px; z-index: 80; width: 132px; height: 52px;
    font-family: var(--display); font-size: 18px; letter-spacing: 0; cursor: pointer;
    background: var(--ink); color: var(--paper); border: 2px solid var(--paper); box-shadow: 5px 5px 0 var(--orange);
  }
  .toc-fab[aria-expanded="true"] { background: var(--paper); color: var(--ink); border-color: var(--ink); }
}

/* ---------------------------------------------------------------- 동작 줄이기 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; }
  .fig [data-step] { transition: none; }
  .btn { transition: none; }
}
