/* 레슨 본문. blocks.js 가 만드는 요소들이 여기에 대응한다. */

/* --- 절 --------------------------------------------------------------- */
/* 절마다 면을 준다. 배경 위에 글이 그냥 이어지면 어디서 어디까지가 한 덩어리인지
 * 안 보인다. 샌드박스 패널과 같은 그릇(.panel)을 쓴다. */

/* 레슨 안의 소제목(h2)은 제목 서체가 아니라 본문 서체를 가장 굵게 쓴다. 한 장에 절이 예닐곱
   개라, 절마다 Black Han Sans 가 서면 긴 글이 포스터처럼 무겁게 읽혔다. 화면 제목(h1)만
   제목 서체로 남긴다. */
.lesson-page h2 {
  font-family: var(--font);
  font-weight: var(--weight-display);
  letter-spacing: -0.02em;
}

.lesson-section {
  gap: var(--space-4);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-panel);
}

/* 문단은 면 폭이 아니라 읽기 폭으로 묶는다. */
.lesson-section > p,
.lesson-section > ul,
.lesson-section > ol { max-width: var(--measure); }

figure.block-cards { margin: 0; }
figure.block-cards figcaption { margin-top: calc(var(--space-1) * -1); max-width: var(--measure); }

/* --- 되는 예 / 안 되는 예 --------------------------------------------- */
/* 규칙 설명에서 가장 잘 먹히는 형태라 자주 쓴다. */

.examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}
/* 절과 같은 --surface 를 쓰면 면 위의 면이 같은 색이라 경계가 안 보인다.
   안쪽으로 한 단 내려앉는 --bg-sunken 을 쓴다. */
.example {
  border: var(--edge);
  border-inline-start-width: 3px;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-sunken);
}
.example.is-ok { border-inline-start-color: var(--ok); }
.example.is-bad { border-inline-start-color: var(--bad); }
.example__head { display: flex; gap: var(--space-2); align-items: baseline; }
.example__mark { font-weight: var(--weight-display); }
.example.is-ok .example__mark { color: var(--ok); }
.example.is-bad .example__mark { color: var(--bad); }
.example__label { font-weight: var(--weight-strong); font-size: var(--fs-small); }
.example .card-row { padding-block: var(--space-2); }

/* --- 본문에 끼워넣는 데모 ---------------------------------------------- */

.demo {
  border: var(--edge);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--bg-sunken);
}
.demo__title { margin-bottom: var(--space-3); }

/* --- 본문 표 ----------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: var(--fs-small); }
table.data th, table.data td { padding: var(--space-2) var(--space-3); text-align: left; border-bottom: var(--edge); }
table.data th { font-weight: var(--weight-strong); color: var(--text-muted); font-size: var(--fs-small); white-space: nowrap; }
table.data td.num,
table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 표는 내용만큼만 넓힌다. 940px 를 꽉 채우면 '카드'와 '합계'가 화면 양끝으로 갈라져
   한 줄을 눈으로 잇기가 어렵다. */
table.data { width: auto; min-width: min(100%, 460px); }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }

/* --- 앞뒤 챕터 이동 ---------------------------------------------------- */

.lesson-nav { border-top: var(--edge); padding-top: var(--space-4); }
