/* 앱(lib/theme.dart)과 같은 색을 쓴다. */
:root {
  color-scheme: light dark;
  --bg: #f6f5f2; --surface: #ffffff; --surface-high: #efede9; --outline: #e6e3de;
  --ink: #1f2029; --ink-soft: #77736d;
  --apricot: #ff8a65; --apricot-soft: #ffefe8; --on-apricot-soft: #a8431f;
  --radius: 22px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114; --surface: #1c1c20; --surface-high: #2a2a2f; --outline: #34343a;
    --ink: #f2f1ee; --ink-soft: #a6a39e;
    --apricot-soft: #3d2a22; --on-apricot-soft: #ffc4ae;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 56px; }

a { color: var(--on-apricot-soft); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }

/* 머리말 */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }

.hero {
  margin: 20px 0 16px; padding: 28px 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--apricot-soft), var(--surface));
  border: 1px solid var(--outline);
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 34px); line-height: 1.25; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--outline); color: var(--ink);
}

/* 목차 */
.toc { margin: 0 0 16px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--outline); }
.toc h2 { margin: 0 0 8px; font-size: 15px; color: var(--ink-soft); font-weight: 600; }
.toc ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: flex; gap: 10px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.toc a::before { content: counter(toc); color: var(--on-apricot-soft); font-weight: 700; min-width: 1.2em; }
.toc a:hover { color: var(--on-apricot-soft); }

/* 본문 카드 */
.card { margin: 0 0 12px; padding: 22px 22px 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--outline); }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 19px; line-height: 1.4; }
.num {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: var(--apricot); color: #1f2029; font-size: 14px; font-weight: 700;
}
.card p, .card ul, .card ol { margin: 0 0 14px; }
.card ul, .card ol { padding-left: 1.2em; }
.card li { margin: 4px 0; }
.card li::marker { color: var(--apricot); }

.note {
  margin: 0 0 14px; padding: 12px 16px; border-radius: 14px;
  background: var(--apricot-soft); color: var(--ink);
}

/* 표 */
.table { margin: 0 0 14px; border: 1px solid var(--outline); border-radius: 16px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { background: var(--surface-high); font-size: 13px; font-weight: 600; color: var(--ink-soft); text-align: left; padding: 10px 14px; }
td { padding: 12px 14px; border-top: 1px solid var(--outline); vertical-align: top; }
td:first-child { font-weight: 600; }

/* 좁은 화면에서는 표의 각 줄을 작은 카드로 쌓는다. */
@media (max-width: 600px) {
  .table { border: 0; border-radius: 0; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr:first-child { display: none; }
  tr { margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--outline); border-radius: 16px; background: var(--bg); }
  td { padding: 2px 0; border: 0; }
  td:first-child { font-size: 16px; margin-bottom: 4px; }
  td[data-label]:not(:first-child)::before {
    content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 6px;
  }
  .card { padding: 20px 18px 6px; }
  .hero { padding: 24px 20px; }
}

/* 버튼 모양 링크 */
.links { display: grid; gap: 10px; margin: 0 0 16px; }
.link-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--outline);
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.link-card::after { content: "›"; color: var(--apricot); font-size: 24px; line-height: 1; }
.link-card:hover { border-color: var(--apricot); }

/* 꼬리말 */
footer { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--outline); color: var(--ink-soft); font-size: 14px; }
footer p { margin: 4px 0; }
footer a { color: var(--ink-soft); }
