/* ============================================================
   인플레하우스 · 학습하기 (Learn) — 아티클 공용 스타일
   정적 HTML 아티클 전용. SPA와 분리되어 CDN에서 직접 서빙된다.
   지향점: Toss Tech 블로그 같은 "책" 느낌의 긴 글 읽기 경험.
   디자인 토큰은 DESIGN.md(Coinbase-editorial)와 정렬한다.
   ============================================================ */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");

:root {
  --ink: #17181a;          /* 본문 잉크 */
  --ink-strong: #0a0b0d;   /* 제목 */
  --body: #40454c;         /* 러닝 텍스트(살짝 옅은) */
  --muted: #6b7280;        /* 캡션·메타 */
  --muted-soft: #9aa0a8;
  --line: #e7e9ec;
  --line-soft: #f0f1f3;
  --canvas: #ffffff;
  --surface-soft: #f8f9fa;
  --surface-tint: #f4f6fb; /* 브랜드 옅은 틴트 */
  --brand: #0052ff;
  --brand-strong: #003ecc;
  --brand-tint: #eaf0ff;
  --up: #05934f;
  --up-tint: #e8f6ee;
  --down: #cf202f;
  --down-tint: #fdecec;
  --amber: #b5730b;
  --amber-tint: #fdf3e2;

  --measure: 720px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
    "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--body);
  background: var(--canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* 한글은 음절 단위로 아무 데서나 줄바꿈되지 않도록 — 공백(어절) 기준으로만 끊는다.
     긴 단일 토큰(URL 등)은 넘치지 않게 break-word로 보완. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 읽기 진행 바 ---------- */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 100;
}
.reading-progress > span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), #4d86ff);
  transition: width 0.08s linear;
}

/* ---------- 상단 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header__inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand-mark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-strong); font-weight: 700; }
.brand-mark img { width: 26px; height: 26px; border-radius: 7px; }
.brand-mark span { font-size: 15px; letter-spacing: -0.01em; }
.header-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; transition: all 0.15s;
}
.header-back:hover { color: var(--ink-strong); border-color: var(--muted-soft); text-decoration: none; }

/* ---------- 아티클 컨테이너 ---------- */
.article { display: block; }
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 24px; }

/* ---------- 히어로 ---------- */
.article-hero {
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(1200px 380px at 50% -140px, rgba(0, 82, 255, 0.06), transparent 70%);
}
.article-hero .wrap { padding-top: 72px; padding-bottom: 48px; }
.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; color: var(--brand);
  letter-spacing: 0.01em; margin-bottom: 20px;
}
.eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-soft); }
.eyebrow .muted { color: var(--muted); font-weight: 600; }
.eyebrow .star { color: var(--amber); }
.article-hero h1 {
  margin: 0; color: var(--ink-strong);
  font-size: clamp(30px, 5.2vw, 46px); font-weight: 800;
  line-height: 1.18; letter-spacing: -0.028em;
}
.article-hero .lede {
  margin: 22px 0 0; color: var(--muted);
  font-size: clamp(17px, 2.2vw, 20px); font-weight: 500; line-height: 1.6;
  letter-spacing: -0.01em;
}
.hero-meta {
  margin-top: 28px; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--muted-soft);
}
.hero-meta .chip {
  padding: 5px 11px; border-radius: 999px; background: var(--surface-soft);
  color: var(--body); font-weight: 600; font-size: 12.5px; border: 1px solid var(--line-soft);
}

/* ---------- 본문 타이포 ---------- */
.article-body { padding-top: 8px; padding-bottom: 40px; }
.article-body .wrap { padding-top: 40px; }

.article-body p,
.article-body ul,
.article-body ol,
.article-body figure,
.article-body blockquote,
.article-body .callout,
.article-body .key-summary,
.article-body .table-wrap,
.article-body .steps,
.article-body .term-list,
.article-body .stat-row {
  margin: 0 0 26px;
}

.article-body p {
  font-size: 18px; line-height: 1.9; color: var(--ink);
  letter-spacing: -0.003em; word-break: keep-all;
}
.article-body p b, .article-body p strong { color: var(--ink-strong); font-weight: 700; }
.article-body .lead {
  font-size: 20px; line-height: 1.8; color: var(--body); font-weight: 500;
}

.article-body h2 {
  margin: 64px 0 20px; color: var(--ink-strong);
  font-size: 27px; font-weight: 800; line-height: 1.3; letter-spacing: -0.025em;
  scroll-margin-top: 84px;
}
.article-body h2::before {
  content: ""; display: block; width: 34px; height: 4px; border-radius: 4px;
  background: var(--brand); margin-bottom: 18px;
}
.article-body h3 {
  margin: 44px 0 14px; color: var(--ink-strong);
  font-size: 20px; font-weight: 700; line-height: 1.4; letter-spacing: -0.02em;
  scroll-margin-top: 84px;
}
.article-body h4 {
  margin: 30px 0 10px; color: var(--ink-strong);
  font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em;
}

.article-body ul, .article-body ol { padding-left: 4px; }
.article-body li {
  font-size: 18px; line-height: 1.85; color: var(--ink);
  margin: 0 0 10px; padding-left: 26px; position: relative; list-style: none;
  word-break: keep-all;
}
.article-body ul > li::before {
  content: ""; position: absolute; left: 6px; top: 14px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
}
.article-body ol { counter-reset: li; }
.article-body ol > li { counter-increment: li; }
.article-body ol > li::before {
  content: counter(li); position: absolute; left: 0; top: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.article-body li b, .article-body li strong { color: var(--ink-strong); font-weight: 700; }

.article-body a { font-weight: 600; border-bottom: 1px solid rgba(0, 82, 255, 0.25); }
.article-body a:hover { border-bottom-color: var(--brand); text-decoration: none; }

/* ---------- 인용 ---------- */
.article-body blockquote {
  border-left: 3px solid var(--brand); padding: 4px 0 4px 22px;
  color: var(--body); font-size: 19px; line-height: 1.75; font-style: normal;
}
.article-body blockquote p { font-size: inherit; color: inherit; margin: 0; }
.article-body blockquote cite {
  display: block; margin-top: 10px; font-size: 14px; color: var(--muted-soft); font-style: normal;
}

/* ---------- 콜아웃 ---------- */
.callout {
  border-radius: 16px; padding: 20px 22px 20px 54px; position: relative;
  background: var(--surface-tint); border: 1px solid var(--line-soft);
  font-size: 16.5px; line-height: 1.72; color: var(--ink);
}
.callout::before {
  position: absolute; left: 20px; top: 19px; font-size: 20px; line-height: 1;
}
.callout .callout-title { display: block; font-weight: 800; color: var(--ink-strong); margin-bottom: 6px; font-size: 15.5px; }
.callout p { font-size: inherit; line-height: inherit; margin: 0 0 8px; color: inherit; }
.callout p:last-child, .callout ul:last-child, .callout li:last-child { margin-bottom: 0; }
.callout ul li { font-size: 16px; }
.callout-info  { background: var(--brand-tint);  border-color: #d5e2ff; }
.callout-info::before  { content: "💡"; }
.callout-tip   { background: var(--up-tint);     border-color: #cdeedd; }
.callout-tip::before   { content: "✅"; }
.callout-warn  { background: var(--down-tint);   border-color: #f7d4d4; }
.callout-warn::before  { content: "⚠️"; }
.callout-note  { background: var(--amber-tint);  border-color: #f2e0c0; }
.callout-note::before  { content: "📌"; }
.callout-quote { background: var(--surface-soft); border-color: var(--line); }
.callout-quote::before { content: "🗣️"; }

/* ---------- 핵심 요약 박스 ---------- */
.key-summary {
  border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfe, #f6f8fc);
  padding: 26px 28px;
}
.key-summary .ks-head {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--brand); text-transform: uppercase; margin-bottom: 16px;
}
.key-summary .ks-head::before { content: "🧭"; font-size: 16px; }
.key-summary ul { margin: 0; }
.key-summary li { font-size: 16.5px; line-height: 1.7; color: var(--ink); margin-bottom: 12px; }
.key-summary li:last-child { margin-bottom: 0; }
.key-summary ul > li::before { top: 12px; }

/* ---------- 통계/수치 강조 행 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px;
  background: var(--canvas);
}
.stat .stat-num { font-size: 26px; font-weight: 800; color: var(--ink-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .stat-label { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* ---------- 용어 카드 리스트 ---------- */
.term-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line-soft); }
.term {
  padding: 22px 4px; border-bottom: 1px solid var(--line-soft);
}
.term dt {
  font-size: 18px; font-weight: 800; color: var(--ink-strong); letter-spacing: -0.015em;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
}
.term dt .en { font-size: 13px; font-weight: 600; color: var(--muted-soft); letter-spacing: 0; }
.term dd { margin: 10px 0 0; font-size: 16.5px; line-height: 1.75; color: var(--body); }
.term dd .ex {
  display: block; margin-top: 10px; padding: 12px 15px; border-radius: 11px;
  background: var(--surface-soft); border: 1px solid var(--line-soft);
  font-size: 15px; color: var(--ink); line-height: 1.65;
}
.term dd .ex b { color: var(--brand-strong); }

/* ---------- 단계(steps) ---------- */
.steps { display: flex; flex-direction: column; gap: 0; }
.steps .step {
  position: relative; padding: 0 0 26px 46px; border-left: 2px solid var(--line);
  margin-left: 14px;
}
.steps .step:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps .step .num {
  position: absolute; left: -15px; top: -2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 4px #fff;
}
.steps .step .step-title { font-size: 17px; font-weight: 700; color: var(--ink-strong); margin-bottom: 5px; }
.steps .step .step-desc { font-size: 15.5px; line-height: 1.7; color: var(--body); }
.steps .step .step-meta { font-size: 13px; color: var(--muted-soft); margin-top: 4px; }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.article-body table { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 460px; }
.article-body thead th {
  background: var(--surface-soft); color: var(--ink-strong); font-weight: 700;
  text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.article-body tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink); line-height: 1.6; }
.article-body tbody tr:last-child td { border-bottom: none; }
.article-body tbody tr:nth-child(even) { background: #fcfcfd; }
.article-body td b, .article-body th b { color: var(--ink-strong); }

/* ---------- 그림/캡션 ---------- */
.article-body figure { text-align: center; }
.article-body figure img { border-radius: 16px; border: 1px solid var(--line-soft); margin: 0 auto; }
.article-body figcaption { margin-top: 12px; font-size: 13.5px; color: var(--muted-soft); line-height: 1.55; }

/* ---------- 코드 ---------- */
.article-body :not(pre) > code {
  font-family: var(--mono); font-size: 0.86em; padding: 2px 6px; border-radius: 6px;
  background: var(--surface-soft); border: 1px solid var(--line-soft); color: var(--down);
}
.article-body pre {
  overflow-x: auto; background: #0f1115; color: #e6e9ef; border-radius: 14px;
  padding: 18px 20px; font-size: 14px; line-height: 1.65; margin: 0 0 26px;
}
.article-body pre code { font-family: var(--mono); }

/* ---------- 구분선 ---------- */
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 48px 0; }

/* ---------- 하단 글 내비게이션 ---------- */
.article-footer-nav { border-top: 1px solid var(--line-soft); margin-top: 24px; }
.article-footer-nav .wrap { padding-top: 40px; padding-bottom: 8px; }
.afn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.afn-card {
  display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--canvas); transition: all 0.15s;
}
.afn-card:hover { border-color: var(--brand); background: var(--surface-tint); text-decoration: none; }
.afn-card .afn-dir { font-size: 12.5px; font-weight: 700; color: var(--muted-soft); margin-bottom: 6px; }
.afn-card .afn-title { font-size: 16px; font-weight: 700; color: var(--ink-strong); letter-spacing: -0.015em; line-height: 1.4; }
.afn-card.next { text-align: right; }
.afn-card.disabled { opacity: 0.4; pointer-events: none; }
.afn-list-link {
  display: flex; justify-content: center; margin: 26px 0 0;
}
.afn-list-link a {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700;
  color: var(--brand); padding: 11px 22px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff;
}
.afn-list-link a:hover { background: var(--brand-tint); text-decoration: none; border-color: #d5e2ff; }

/* ---------- 사이트 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft); background: var(--surface-soft);
  margin-top: 56px;
}
.site-footer .wrap { max-width: 1080px; padding-top: 36px; padding-bottom: 44px; }
.site-footer .foot-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-strong); font-weight: 700; font-size: 14px; }
.site-footer .foot-brand img { width: 22px; height: 22px; border-radius: 6px; }
.site-footer p { font-size: 12.5px; color: var(--muted-soft); line-height: 1.7; margin: 14px 0 0; max-width: 640px; }
.site-footer .foot-links { margin-top: 16px; display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer .foot-links a { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- 반응형 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .site-header__inner { padding: 0 18px; }
  .article-hero .wrap { padding-top: 44px; padding-bottom: 34px; }
  .article-body .wrap { padding-top: 30px; }
  .article-body p, .article-body li { font-size: 17px; line-height: 1.82; }
  .article-body h2 { font-size: 23px; margin-top: 48px; }
  .article-body h3 { font-size: 18.5px; margin-top: 34px; }
  .afn-grid { grid-template-columns: 1fr; }
  .callout { padding: 18px 18px 18px 48px; }
  .brand-mark span { display: none; }
}

/* ---------- SPA 임베드 모드(?embed=1) — 앱 콘텐츠 영역 안에 표시될 때 ---------- */
.embed .site-header,
.embed .site-footer,
.embed .reading-progress {
  display: none;
}
.embed .article-hero {
  border-radius: 0;
}
.embed .article-hero .wrap {
  padding-top: 44px;
}
/* 임베드에서는 부모(앱)가 스크롤을 담당하므로 문서 자체 스크롤은 없앤다. */
.embed body {
  overflow: hidden;
}

@media print {
  .site-header, .reading-progress, .article-footer-nav, .site-footer { display: none; }
  body { color: #000; }
}
