/* SageWits — 짙은 그린 + 골드, Playfair Display(제목) / Be Vietnam Pro(본문) / IBM Plex Mono(숫자)
   베트남어 성조 부호를 지원하는 글꼴로 바꿨다(기존 Song Myung·Noto Sans KR은 한국어 전용). */

:root {
  --bg: #F3F1EA;
  --surface: #FBFAF6;
  --surface-2: #EFECE3;
  --input: #FFFFFF;
  --ink: #17231D;
  --ink-2: #45524B;
  --ink-3: #647069;
  --line: #DEDAD0;
  --line-strong: #C4BFB1;
  --brand: #16402E;
  --brand-2: #1F5A40;
  --on-brand: #F4F1E8;
  --on-brand-2: #BFD0C5;
  --gold: #C9A227;
  --gold-ink: #85600C;
  --series-1: #1B7A4B;
  --series-2: #B7861A;
  --good-bg: #E4F1E8;
  --warn-bg: #FBEFD9;
  --warn-ink: #7A4A00;
  --info-bg: #E9EEE9;
  --accent: #1F6B4A;
  --shadow: 0 1px 2px rgb(23 35 29 / 0.05), 0 4px 16px rgb(23 35 29 / 0.05);

  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --radius: 12px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1310;
    --surface: #101915;
    --surface-2: #17231D;
    --input: #0D1512;
    --ink: #E7ECE8;
    --ink-2: #B3BFB8;
    --ink-3: #8C9891;
    --line: #22312A;
    --line-strong: #34463D;
    --brand: #0E271C;
    --brand-2: #173B2B;
    --on-brand: #EDEBE3;
    --on-brand-2: #9FB5A8;
    --gold: #D4AA3C;
    --gold-ink: #E2BC5E;
    --series-1: #279C66;
    --series-2: #C08A1C;
    --good-bg: #13291E;
    --warn-bg: #2E2410;
    --warn-ink: #F0C36A;
    --info-bg: #16221C;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0B1310;
  --surface: #101915;
  --surface-2: #17231D;
  --input: #0D1512;
  --ink: #E7ECE8;
  --ink-2: #B3BFB8;
  --ink-3: #8C9891;
  --line: #22312A;
  --line-strong: #34463D;
  --brand: #0E271C;
  --brand-2: #173B2B;
  --on-brand: #EDEBE3;
  --on-brand-2: #9FB5A8;
  --gold: #D4AA3C;
  --gold-ink: #E2BC5E;
  --series-1: #279C66;
  --series-2: #C08A1C;
  --good-bg: #13291E;
  --warn-bg: #2E2410;
  --warn-ink: #F0C36A;
  --info-bg: #16221C;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- 기본 ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  /* 베트남어는 단어 단위로 줄바꿈하는 것이 자연스럽다(한국어용 keep-all 제거) */
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.container--narrow { max-width: calc(680px + var(--gutter) * 2); }
@media (min-width: 720px) { :root { --gutter: 24px; } }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}

/* ---------- 헤더 ---------- */

.site-header { background: var(--brand); color: var(--on-brand); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--font-display); font-size: 24px; color: var(--on-brand); white-space: nowrap;
}
/* 부엉이 로고: 투명 PNG라 짙은 헤더에서도 원본처럼 보이도록 크림색 원 배지에 담는다.
   배지 지름 ≈ 글자 크기 × 1.9 로 "SageWits" 글자와 균형을 맞춘다. */
.logo__mark {
  flex: none; display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%;
  background: #FBF7EC; box-shadow: 0 0 0 2px rgb(201 162 39 / 0.35);
}
.logo__mark img { width: 90%; height: auto; margin-top: 6%; }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 4px; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; font-size: 15px;
  color: var(--on-brand-2); white-space: nowrap;
}
.site-nav a:hover { color: var(--on-brand); background: rgb(255 255 255 / 0.06); }
.site-nav a[aria-current="page"] { color: var(--on-brand); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 8px 8px 0 0; }
.site-header__actions { display: flex; gap: 4px; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--on-brand); cursor: pointer;
}
.icon-button:hover { background: rgb(255 255 255 / 0.08); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sun { display: none; }
[aria-pressed="true"] .icon--sun { display: block; }
[aria-pressed="true"] .icon--moon { display: none; }
.menu-button { display: none; }

@media (max-width: 899px) {
  .menu-button { display: inline-grid; }
  .site-header__actions { margin-left: auto; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--brand); border-top: 1px solid rgb(255 255 255 / 0.08); padding: 8px var(--gutter) 16px;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 12px; font-size: 16px; }
  .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); border-radius: 0 8px 8px 0; }
}

/* ---------- 히어로 ---------- */

.home-hero, .page-hero {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%);
  color: var(--on-brand);
}
.home-hero { padding: 48px 0 56px; }
.home-hero h1 { font-size: clamp(34px, 7vw, 56px); margin: 8px 0 16px; }
.page-hero { padding: 20px 0 36px; }
.page-hero--compact { padding-bottom: 28px; }
.page-hero h1 { font-size: clamp(28px, 5vw, 40px); margin: 12px 0 8px; }
.eyebrow { font-size: 13px; letter-spacing: 0.12em; color: var(--gold); font-weight: 500; }
.lead { color: var(--on-brand-2); max-width: 640px; }
.home-hero .lead { font-size: 17px; }
.page-hero .question, .category-block .question { font-family: var(--font-display); color: var(--gold); margin-top: 12px; font-size: 18px; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.quick-links a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; text-decoration: none;
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.14); color: var(--on-brand); font-weight: 500;
}
.quick-links a::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.quick-links a:hover { background: rgb(255 255 255 / 0.14); }

.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--on-brand-2); }
.breadcrumb li:not(:last-child)::after { content: '›'; margin-left: 6px; opacity: 0.6; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--on-brand); }

/* ---------- 광고 자리 (크기를 미리 잡아 레이아웃 흔들림 방지) ---------- */

.ad { margin: 24px 0; min-height: 100px; }
.ad--middle, .ad--bottom { min-height: 250px; }
.ad--placeholder {
  display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  color: var(--ink-3); font-size: 13px; background: repeating-linear-gradient(135deg, transparent 0 10px, var(--surface-2) 10px 11px);
}

/* ---------- 카드 목록 ---------- */

.category-block { margin: 40px 0; }
.category-block__head { border-left: 4px solid var(--accent); padding-left: 16px; margin-bottom: 16px; }
.category-block h2 { font-size: 26px; }
.category-block h2 a { text-decoration: none; }
.category-block h2 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.category-block .question { color: var(--ink-2); font-size: 16px; margin-top: 4px; }

.calc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.calc-grid--wide { margin: 8px 0 32px; }
.calc-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 18px 18px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s;
}
.calc-card::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
a.calc-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.calc-card__name { font-weight: 700; font-size: 17px; }
.calc-card__summary { color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.calc-card__go { margin-top: auto; padding-top: 8px; color: var(--gold-ink); font-weight: 700; }
.calc-card.is-planned { box-shadow: none; background: transparent; border-style: dashed; }
.calc-card.is-planned .calc-card__name { color: var(--ink-2); }
.calc-card.is-planned .badge { align-self: flex-start; margin-top: 8px; }

.other-categories { margin: 40px 0; }
.other-categories h2 { font-size: 24px; margin-bottom: 12px; }
.other-categories ul { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.other-categories a {
  display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--line); border-top: 3px solid var(--accent); background: var(--surface); font-weight: 700;
}
.other-categories .muted { font-weight: 400; font-size: 14px; }

/* ---------- 계산기 ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__title { font-size: 15px; font-family: var(--font-sans); font-weight: 700; color: var(--ink-2); margin-bottom: 16px; }

.calculator { display: grid; gap: 16px; margin: 24px 0; }
@media (min-width: 900px) {
  .calculator { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; gap: 24px; }
  .calc-summary { position: sticky; top: 76px; }
}

.calc-form { padding: 20px; border-top: 3px solid var(--accent); }
.field { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 500; font-size: 15px; margin-bottom: 6px; padding: 0; }
.input-wrap {
  display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--input);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.input-wrap input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 0 12px 14px; outline: none;
  font-family: var(--font-mono); font-size: 18px; text-align: right; font-variant-numeric: tabular-nums;
}
.suffix { padding: 0 14px 0 8px; color: var(--ink-3); font-size: 15px; white-space: nowrap; }
input[aria-invalid] { color: var(--warn-ink); }
.input-wrap:has(input[aria-invalid]) { border-color: var(--warn-ink); }
.field__amount { font-size: 13px; color: var(--ink-3); text-align: right; margin-top: 4px; min-height: 1.5em; }
.field__hint { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.field__error { font-size: 13px; color: var(--warn-ink); margin-top: 4px; font-weight: 500; }
.field__error::before { content: '! '; font-weight: 700; }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }

.segments { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.segment { flex: 1 1 auto; position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment span {
  display: block; text-align: center; padding: 8px 10px; border-radius: 7px; font-size: 14px; color: var(--ink-2);
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.segment input:checked + span { background: var(--input); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.segment input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }

.form-actions { display: flex; justify-content: flex-end; }
.button {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 10px;
  border: 1px solid transparent; background: var(--brand-2); color: var(--on-brand); text-decoration: none; font-weight: 500; cursor: pointer;
}
.button--ghost { background: transparent; color: var(--ink-2); border-color: var(--line); font-size: 14px; padding: 8px 14px; }
.button--ghost:hover { color: var(--ink); border-color: var(--line-strong); }

.calc-summary { padding: 24px 20px; transition: opacity 0.15s; }
.is-stale { opacity: 0.45; }
.headline { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.headline__label { font-weight: 500; color: var(--ink-2); }
.headline__value { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.headline__value .num { font-size: clamp(34px, 8vw, 48px); font-weight: 600; line-height: 1.15; }
.headline__value .unit { font-size: 20px; color: var(--ink-2); }
.headline__readable { color: var(--gold-ink); font-weight: 500; }

.notice { margin-top: 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.notice::before { font-weight: 700; margin-right: 6px; }
.notice--info { background: var(--info-bg); color: var(--ink); }
.notice--info::before { content: 'ⓘ'; }
.notice--good { background: var(--good-bg); color: var(--ink); }
.notice--good::before { content: '✓'; }
.notice--warning { background: var(--warn-bg); color: var(--warn-ink); }
.notice--warning::before { content: '!'; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 20px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.metric { background: var(--surface); padding: 12px 14px; }
.metric dt { font-size: 13px; color: var(--ink-3); }
.metric dd { margin: 2px 0 0; font-size: 17px; font-weight: 500; }
.metric--strong dd { color: var(--gold-ink); font-weight: 600; }
@media (max-width: 380px) { .metrics { grid-template-columns: 1fr; } }

.basis { margin-top: 20px; font-size: 13px; color: var(--ink-2); }
.basis__title { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.basis__title::before { content: 'ⓘ '; }
.assumptions li { margin: 2px 0; }
.assumptions .badge { font-size: 11px; background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.calc-notes summary { cursor: pointer; color: var(--ink-3); margin-top: 4px; }
.calc-notes ul { list-style: disc; padding-left: 20px; margin-top: 4px; }

/* 모바일 하단 결과 바: 입력하는 동안 핵심 금액을 계속 보여준다 */
.calc-summary { scroll-margin-top: 76px; }
.result-dock { display: none; }
@media (max-width: 899px) {
  .result-dock {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px 10px 16px; border-radius: 14px; text-decoration: none;
    background: var(--brand); color: var(--on-brand); border: 1px solid rgb(255 255 255 / 0.1);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
    transform: translateY(calc(100% + 24px)); visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s, opacity 0.15s;
  }
  .result-dock.is-visible { transform: none; visibility: visible; transition: transform 0.2s ease, visibility 0s, opacity 0.15s; }
  .result-dock.is-stale { opacity: 0.6; }
  /* 포커스된 입력칸이 결과 바 뒤로 숨지 않도록 */
  html.has-dock { scroll-padding-bottom: 96px; }
}
.result-dock__text { display: flex; flex-direction: column; min-width: 0; }
.result-dock__label { font-size: 12px; color: var(--on-brand-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-dock__value { font-size: 15px; white-space: nowrap; }
.result-dock__value .num { font-size: 21px; font-weight: 600; margin-right: 2px; color: var(--on-brand); }
.result-dock__go {
  display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 6px 10px; border-radius: 999px;
  background: var(--gold); color: #1A1406; font-size: 13px; font-weight: 700;
}
.result-dock__go .icon { width: 16px; height: 16px; stroke-width: 2.4; }

/* 상세 결과: 차트 + 표 */
/* minmax(0, 1fr): 넓은 표가 칸 전체를 늘리지 않고 표 안에서만 가로 스크롤되도록 */
.calc-details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; transition: opacity 0.15s; }
.calc-details > * { min-width: 0; }
.chart-card { margin: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chart-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.chart-card h3, .table-block h3 { font-size: 17px; font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 14px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.chart-box { position: relative; }
.chart-svg { overflow: visible; }
.chart-svg .s1 { fill: var(--series-1); }
.chart-svg .s2 { fill: var(--series-2); }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart-svg .axis { fill: var(--ink-3); font-size: 12px; font-family: var(--font-mono); }
.chart-svg .value-label, .chart-svg .ref-label { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font-mono); }
.chart-svg .ref { stroke: var(--ink-2); stroke-width: 1.5; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-svg .hit.is-active { fill: var(--ink); fill-opacity: 0.05; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 180px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgb(0 0 0 / 0.16); font-size: 13px;
}
.tooltip strong { display: block; margin-bottom: 4px; }
.tooltip__row { display: flex; align-items: center; gap: 6px; margin: 2px 0; color: var(--ink-2); }
.tooltip__row .num { margin-left: auto; padding-left: 12px; color: var(--ink); }
.tooltip__total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; font-weight: 500; color: var(--ink); }

.table-block { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-block > h3 { margin-bottom: 12px; }
details.table-block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.table-block > summary::-webkit-details-marker { display: none; }
details.table-block > summary::after { content: 'Mở ▾'; font-size: 13px; color: var(--ink-3); }
details.table-block[open] > summary { margin-bottom: 12px; }
details.table-block[open] > summary::after { content: 'Thu gọn ▴'; }
.table-wrap { overflow-x: auto; max-height: 520px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 500; color: var(--ink-2); z-index: 1; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num, td.num { text-align: right; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
tr.is-current > * { background: color-mix(in srgb, var(--gold) 12%, transparent); font-weight: 600; }
tr.is-current th::after { content: ' · hiện tại'; font-size: 12px; color: var(--gold-ink); font-weight: 500; }

/* ---------- 가이드·FAQ·관련 ---------- */

.guide, .faq, .related { margin: 48px 0; }
.guide { max-width: 760px; }
.prose { font-size: 17px; line-height: 1.85; }
.prose h2 { font-size: 26px; margin: 40px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 19px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 16px; }
.prose ul { list-style: disc; padding-left: 22px; }
.prose ol { list-style: decimal; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose a { color: var(--gold-ink); text-underline-offset: 3px; }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 14px 16px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 15px; line-height: 1.7; }
.prose blockquote { border-left: 3px solid var(--gold); padding: 4px 0 4px 16px; color: var(--ink-2); }
.prose table { display: block; overflow-x: auto; font-size: 15px; line-height: 1.6; }
/* 본문 표는 문장이 들어가므로 줄바꿈 허용 (계산 결과 표는 숫자라 줄바꿈 금지 유지) */
.prose th, .prose td { white-space: normal; min-width: 7em; vertical-align: top; }
.prose thead th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.faq h2, .related h2 { font-size: 26px; margin-bottom: 16px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 32px 16px 0; font-weight: 500; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 12px; font-size: 22px; color: var(--ink-3); }
.faq details[open] summary::after { content: '−'; }
.faq details p { padding: 0 0 16px; color: var(--ink-2); max-width: 760px; }

/* ---------- 블로그 (카드뉴스) ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { padding: 48px 0; color: var(--ink-2); text-align: center; }
.home-blog { margin: 48px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 26px; }
.section-head a { color: var(--gold-ink); font-size: 14px; text-decoration: none; }

/* 표지 색 테마 — 카드뉴스는 사진처럼 쓰이는 그림이라 라이트·다크 모드에서 같은 색을 유지한다 */
.cover--green { --c-bg: linear-gradient(160deg, #16402E 0%, #1F5A40 100%); --c-ink: #F4F1E8; --c-sub: #BFD0C5; --c-accent: #D9B44A; }
.cover--gold  { --c-bg: linear-gradient(160deg, #F6EBCB 0%, #E8CF8E 100%); --c-ink: #231B06; --c-sub: #5C4A1C; --c-accent: #8A6410; }
.cover--ink   { --c-bg: linear-gradient(160deg, #1B2A23 0%, #0C1411 100%); --c-ink: #F1EEE4; --c-sub: #A9B7AF; --c-accent: #D9B44A; }

/* 목록: 표지 카드 격자 */
.post-grid { display: grid; gap: 20px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); margin: 8px 0 24px; }
.post-card[hidden] { display: none; }
.post-card__link { display: flex; flex-direction: column; gap: 10px; text-decoration: none; height: 100%; }
.cover {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 4 / 5; padding: 20px;
  border-radius: 16px; background: var(--c-bg); color: var(--c-ink); overflow: hidden;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 10px 24px rgb(0 0 0 / 0.08); transition: transform 0.2s;
}
.cover::after { /* 오른쪽 아래 금빛 원 장식 */
  content: ''; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%;
  border: 18px solid var(--c-accent); opacity: 0.18;
}
.post-card__link:hover .cover { transform: translateY(-3px); }
.cover__tag {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--c-accent); border: 1px solid currentColor;
}
.cover__title {
  margin-top: auto; font-family: var(--font-display); font-size: clamp(22px, 2.4vw + 12px, 30px); line-height: 1.3;
   display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.cover__foot { display: flex; justify-content: space-between; margin-top: 16px; font-size: 12px; color: var(--c-sub); }
.cover__brand { font-family: var(--font-display); font-size: 14px; color: var(--c-ink); }
.cover__brand::before { content: '●'; color: var(--c-accent); font-size: 9px; margin-right: 5px; vertical-align: 2px; }
.post-card__body { display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
.post-card__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 표지에 이미 보임 */
.post-card__excerpt { color: var(--ink-2); font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__meta { font-size: 12px; color: var(--ink-3); }

.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 20px; }
.tag-filter[hidden] { display: none; }
.chip.is-active { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand); }
.chip.is-active .muted { color: var(--on-brand-2); }

/* 글 페이지 */
.post__head { padding-top: 24px; padding-bottom: 4px; max-width: calc(760px + var(--gutter) * 2); }
.post__head .breadcrumb ol { color: var(--ink-3); }
.post__head .breadcrumb [aria-current] { color: var(--ink-2); }
.post__head h1 { font-size: clamp(28px, 5vw, 40px); margin: 10px 0 8px; }
.post__head .meta { font-size: 13px; color: var(--ink-3); }
.post__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag-chip {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-decoration: none;
  color: var(--gold-ink); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent);
}

.cardnews { margin: 8px 0 32px; }
.cardnews__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cardnews__count { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); }
.cardnews__stage { position: relative; }
.cardnews__track {
  display: flex; align-items: flex-start; gap: 16px; margin: 0; padding: 4px 0 12px; list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.cardnews__track::-webkit-scrollbar { display: none; }
.cardnews__track:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 20px; }
@media (min-width: 640px) {
  /* 가운데 카드 하나 + 양옆 카드가 살짝 보이도록 */
  .cardnews__track { padding-inline: calc(50% - 260px); }
}

.slide {
  position: relative; flex: 0 0 min(100%, 520px); scroll-snap-align: center; aspect-ratio: 4 / 5;
  display: flex; flex-direction: column; padding: 28px 26px 18px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 6px rgb(0 0 0 / 0.05), 0 12px 28px rgb(0 0 0 / 0.07);
  /* overflow 를 두지 않는다: 4:5 비율은 최소 높이로만 쓰고, 글이 길면 카드가 늘어나야 잘리지 않는다 */
}
/* 오른쪽 아래 금빛 고리 장식은 배경으로 그려서 카드 밖으로 넘치지 않게 */
.slide--cover, .slide--end {
  color: var(--c-ink); border-color: transparent;
  background:
    radial-gradient(circle at 100% 100%, transparent 84px, color-mix(in srgb, var(--c-accent) 18%, transparent) 85px 110px, transparent 111px),
    var(--c-bg);
}
@media (max-width: 480px) {
  .slide { padding: 22px 20px 16px; }
  .slide__body.prose { font-size: 15px; }
}
/* 카드 속 표: 좁은 카드에서는 행마다 작은 블록으로 쌓는다 (머리글은 data-label 로 각 칸에 표시) */
@media (max-width: 560px) {
  .card-table, .card-table tbody, .card-table tr, .card-table th, .card-table td { display: block; }
  .slide__body.prose .card-table { overflow: visible; }
  .card-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .card-table tr { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
  .card-table tr + tr { margin-top: 8px; }
  .slide__body.prose .card-table th, .slide__body.prose .card-table td { min-width: 0; padding: 2px 0; border: 0; }
  .card-table tbody th { font-weight: 700; font-size: 15px; color: var(--ink); }
  .card-table td::before { content: attr(data-label) ' · '; font-weight: 700; color: var(--gold-ink); }
}
.slide__title { margin-top: auto; font-family: var(--font-display); font-size: clamp(28px, 4vw + 14px, 40px); line-height: 1.28;  }
.slide__excerpt { margin-top: 14px; color: var(--c-sub); font-size: 15px; line-height: 1.7; }
.slide__hint { margin-top: 20px; font-size: 13px; font-weight: 700; color: var(--c-accent); }
.slide__num { font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--gold-ink); }
.slide--end .slide__num { color: var(--c-accent); }
.slide__heading { font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 2vw + 14px, 28px); line-height: 1.35; margin: 6px 0 14px;  }
.slide__body.prose { font-size: 16px; line-height: 1.75; }
.slide__body.prose ul, .slide__body.prose ol { padding-left: 18px; }
.slide__body.prose li { margin: 8px 0; }
.slide__body.prose li strong:first-child { color: var(--ink); }
.slide__body.prose table { font-size: 14px; }
.slide__body.prose blockquote { font-size: 15px; }
.slide__foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 16px; font-size: 12px; color: var(--ink-3); }
.slide--cover .slide__foot, .slide--end .slide__foot { color: var(--c-sub); }
.slide:not(.slide--cover):not(.slide--end) .cover__brand { color: var(--ink); }
.slide:not(.slide--cover):not(.slide--end) .cover__brand::before { color: var(--gold); }
.slide--cover .cover__tag { position: relative; z-index: 1; }

.slide__links { position: relative; z-index: 1; display: grid; gap: 8px; margin: auto 0 0; }
.slide__links a {
  display: flex; justify-content: space-between; padding: 14px 16px; border-radius: 12px; text-decoration: none; font-weight: 700;
  background: rgb(255 255 255 / 0.1); border: 1px solid color-mix(in srgb, var(--c-accent) 55%, transparent); color: var(--c-ink);
}
.slide__links a:hover { background: rgb(255 255 255 / 0.18); }
.cover--gold .slide__links a { background: rgb(255 255 255 / 0.45); }
.slide__author { position: relative; z-index: 1; margin-top: 16px; font-size: 13px; color: var(--c-sub); }

.cardnews__arrow {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); display: none;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.cardnews__arrow:disabled { opacity: 0.35; cursor: default; }
.cardnews__arrow--prev { left: 0; }
.cardnews__arrow--next { right: 0; }
@media (min-width: 640px) { .cardnews__arrow:not([hidden]) { display: grid; place-items: center; } }

.cardnews__dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cardnews__dots[hidden] { display: none; }
.cardnews__dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: width 0.2s, background 0.2s; }
.cardnews__dot[aria-current="true"] { width: 22px; background: var(--gold); }

/* 한 번에 펼쳐 보기 */
.cardnews.is-stacked .cardnews__track { flex-direction: column; align-items: center; overflow: visible; padding-inline: 0; scroll-snap-type: none; }
.cardnews.is-stacked .slide { flex: none; width: min(100%, 560px); }
.cardnews.is-stacked .cardnews__arrow, .cardnews.is-stacked .cardnews__dots { display: none; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 32px 0; }
.post-nav a {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700;
}
.post-nav .muted { font-size: 13px; font-weight: 400; }
.post-nav__next { text-align: right; }
@media (max-width: 480px) { .post-nav { grid-template-columns: 1fr; } .post-nav__next { text-align: left; } }

/* ---------- 푸터 ---------- */

.site-footer { margin-top: 64px; padding: 40px 0 32px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 14px; }
.site-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.logo--footer { color: var(--ink); font-size: 21px; }
.logo--footer .logo__mark { box-shadow: 0 0 0 1px var(--line-strong); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-nav a { color: var(--ink-2); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); text-decoration: underline; }
.disclaimer { margin: 24px 0 12px; padding: 14px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media (forced-colors: active) {
  .chart-svg .s1, .swatch.s1 { fill: CanvasText; background: CanvasText; }
  .chart-svg .s2, .swatch.s2 { fill: Highlight; background: Highlight; }
}
