/* 직구노트 — 산뜻한 카드형 디자인
 * 흰 카드 + 넉넉한 여백 + 파란 포인트, 회색 채움 입력칸, 크고 굵은 결과 숫자 */
:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --fill: #f2f4f6;          /* 입력칸·보조 배경 */
  --fill-strong: #e5e8eb;
  --text: #191f28;
  --text-2: #4e5968;
  --muted: #8b95a1;
  --line: #e5e8eb;
  --accent: #3182f6;
  --accent-strong: #1b64da;
  --accent-soft: #e8f3ff;
  --hl: #e8f3ff;            /* 표 강조 행 */
  --warn-bg: #fff4e6;
  --warn-text: #c2410c;
  --success: #03b26c;
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(0, 23, 51, 0.04), 0 1px 2px rgba(0, 23, 51, 0.04);
  --shadow-hover: 0 8px 24px rgba(0, 23, 51, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101115;
    --surface: #1b1d23;
    --fill: #262a31;
    --fill-strong: #30353d;
    --text: #eceef1;
    --text-2: #c1c7cf;
    --muted: #8f98a3;
    --line: #2c3038;
    --accent: #4c95ff;
    --accent-strong: #7aafff;
    --accent-soft: #1b2a42;
    --hl: #1f3150;
    --warn-bg: #3a2a18;
    --warn-text: #ffb27a;
    --success: #2fd28c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 700; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; background: var(--fill); padding: 1px 6px; border-radius: 6px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: -0.03em; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 17px; }
.main-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { color: var(--text-2); padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.main-nav a:hover { background: var(--fill); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- 본문 ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin: 24px 0 0; }
.crumbs a { color: var(--muted); }
.content { padding: 4px 0 24px; }
.content h1 { font-size: 32px; line-height: 1.3; font-weight: 800; letter-spacing: -0.035em; margin: 16px 0 12px; }
.content h2 { font-size: 23px; line-height: 1.4; font-weight: 700; letter-spacing: -0.025em; margin: 48px 0 12px; }
.content h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 32px 0 8px; }
.content p, .content li, .content dd { color: var(--text-2); }
.content strong { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.content li { margin: 6px 0; }
.content li::marker { color: var(--muted); }
.lead { font-size: 19px; line-height: 1.65; color: var(--text-2); margin: 0 0 8px; }
.updated { font-size: 14px; color: var(--muted) !important; margin-top: 48px; }
.small { font-size: 14px; color: var(--muted) !important; }
.content h2[id] { scroll-margin-top: 84px; }

/* ---------- 카드 목록 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.card {
  position: relative; display: block; background: var(--surface); border-radius: var(--radius);
  padding: 18px 44px 18px 20px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card::after { content: "›"; position: absolute; right: 18px; top: 50%; transform: translateY(-52%); font-size: 26px; color: var(--muted); line-height: 1; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); text-decoration: none; }
.card:active { transform: scale(0.98); }
.card strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; }
.card span { font-size: 14px; color: var(--muted); }

/* ---------- 계산기 ---------- */
.tool { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; margin: 24px 0; box-shadow: var(--shadow); }
.content .tool h2 { margin: 0 0 18px; font-size: 20px; }
.tool-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.tool label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); flex: 1 1 150px; }
.tool > label { margin-bottom: 12px; }
.tool select, .tool input, .tool textarea {
  font: inherit; font-size: 17px; font-weight: 600; color: var(--text);
  background: var(--fill); border: 2px solid transparent; border-radius: var(--radius-sm);
  padding: 12px 14px; width: 100%; min-height: 52px; transition: border-color .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.tool textarea { resize: vertical; }
.tool select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
.tool select:hover, .tool input:hover { background-color: var(--fill-strong); }
.tool select:focus, .tool input:focus, .tool textarea:focus { outline: none; border-color: var(--accent); background-color: var(--surface); }
.tool input::placeholder { color: var(--muted); font-weight: 500; }

.result { margin-top: 8px; padding: 20px; border-radius: var(--radius); background: var(--fill); }
.result .big { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; color: var(--accent); line-height: 1.25; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.result .sub { color: var(--text-2); font-size: 15px; margin-top: 6px; }
.result .sub strong { color: var(--text); }
.sub.warn { color: var(--warn-text) !important; background: var(--warn-bg); padding: 10px 12px; border-radius: 10px; }
.sub.warn strong { color: inherit !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 14px; font-weight: 600; color: var(--text-2); }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 14px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--text-2); }
th { background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tr.hit td { background: var(--hl); color: var(--accent-strong); font-weight: 700; }

/* 결과 표(복사 버튼) */
.result .table-wrap { box-shadow: none; margin: 12px 0 4px; }
.out-table th { text-align: left; position: static; font-size: 14px; color: var(--text-2); white-space: normal; min-width: 120px; }
.out-table td { text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--text); }
.out-table td:nth-child(3) { width: 1%; text-align: right; }
.out-table code { background: none; padding: 0; font-size: 15px; font-weight: 600; }
.out-table .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.copy { font: inherit; font-size: 14px; font-weight: 700; padding: 7px 12px; border-radius: 8px; border: none; background: var(--accent-soft); color: var(--accent); cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
.copy:hover { background: var(--accent); color: #fff; }
.copy:active { transform: scale(0.95); }
@media (max-width: 600px) {
  .out-table tr { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--line); }
  .out-table tr:last-child { border-bottom: none; }
  .out-table th { grid-column: 1 / -1; padding-bottom: 0; border-bottom: none; }
  .out-table td { border-bottom: none; }
  .out-table td:nth-child(3) { width: auto; }
}

/* ---------- 안내·FAQ·관련 글 ---------- */
.note { background: var(--accent-soft); color: var(--text-2); padding: 16px 18px; border-radius: var(--radius); margin: 18px 0; line-height: 1.75; }
.note strong { color: var(--text); }
.faq { margin: 0; }
.faq dt { font-weight: 700; color: var(--text); margin-top: 10px; background: var(--surface); padding: 16px 18px 4px; border-radius: var(--radius) var(--radius) 0 0; }
.faq dd { margin: 0 0 10px; background: var(--surface); padding: 0 18px 16px; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
.related { background: var(--surface); border-radius: var(--radius-lg); padding: 8px 24px 16px; margin: 8px 0 32px; box-shadow: var(--shadow); }
.related h2 { font-size: 18px; margin: 16px 0 4px; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { border-bottom: 1px solid var(--line); }
.related li:last-child { border-bottom: none; }
.related a { display: block; padding: 12px 0; color: var(--text); font-weight: 600; }
.related a::after { content: " ›"; color: var(--muted); }

.form-mock { background: var(--surface); border-radius: var(--radius); padding: 8px 20px; margin: 16px 0; font-size: 15px; box-shadow: var(--shadow); }
.form-mock div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.form-mock div:last-child { border-bottom: none; }
.form-mock span:first-child { color: var(--muted); }
.form-mock span:last-child { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; color: var(--text); }

/* 체크리스트 */
.content li > label { cursor: pointer; }
.content input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: -3px; margin-right: 4px; }

/* ---------- 판단 순서도 ---------- */
.flow { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; margin: 18px 0; box-shadow: var(--shadow); }
.flow-q { background: var(--fill); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 16px; line-height: 1.5; color: var(--text); }
.flow-num { display: inline-block; background: var(--text); color: var(--surface); border-radius: 6px; font-size: 12px; font-weight: 800; padding: 1px 7px; margin-right: 8px; vertical-align: 1px; }
.flow-row { display: grid; grid-template-columns: 3fr 2fr; gap: 0 40px; align-items: center; }
.flow-row > .flow-end { grid-column: 1; }
.flow-yes { position: relative; }
.flow-yes::before { content: ""; position: absolute; left: -36px; top: 50%; width: 28px; border-top: 2px solid var(--fill-strong); }
.flow-yes::after { content: ""; position: absolute; left: -10px; top: calc(50% - 5px); border: 5px solid transparent; border-left-color: var(--fill-strong); }
.flow-yes .flow-tag { position: absolute; left: -34px; top: calc(50% - 22px); }
.flow-down { position: relative; height: 40px; margin-left: 28px; border-left: 2px solid var(--fill-strong); }
.flow-down::after { content: ""; position: absolute; left: -6px; bottom: -1px; border: 5px solid transparent; border-top-color: var(--fill-strong); }
.flow-down .flow-tag { position: absolute; left: 10px; top: 11px; }
.flow-tag { font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.flow-tag.yes { color: var(--accent); }
.flow-tag.no { color: var(--muted); }
.flow-end { display: block; border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text); border: 2px solid transparent; line-height: 1.45; transition: border-color .15s; }
.flow-end:hover { text-decoration: none; }
.flow-end strong { display: block; font-size: 16px; }
.flow-end span { display: block; font-size: 14px; color: var(--text-2); }
.flow-end em { display: block; font-style: normal; font-size: 13px; font-weight: 700; margin-top: 4px; color: var(--accent); }
a.flow-end:hover { border-color: var(--accent); }
.flow-end.esta, .flow-end.eta { background: var(--accent-soft); }
.flow-end.eta { background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.flow-end.eta em { color: var(--success); }
.flow-end.ok { background: var(--surface); border: 2px dashed var(--fill-strong); }
.flow-end.visa { background: var(--warn-bg); margin-top: 16px; }
.flow-end.visa em { color: var(--warn-text); }

/* ---------- 푸터 ---------- */
.site-footer { padding: 32px 0 40px; margin-top: 24px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.site-footer p { margin: 6px 0; }
.site-footer a { color: var(--text-2); font-weight: 600; }
.site-footer .small { font-size: 13px; }

/* ---------- 모바일 ---------- */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { flex-direction: column; align-items: stretch; gap: 0; min-height: 0; padding-top: 10px; }
  .logo { font-size: 18px; }
  .logo-mark { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .main-nav { margin: 6px -16px 0; padding: 0 12px 8px; }
  .main-nav a { font-size: 14px; padding: 7px 11px; }
  .content h1 { font-size: 26px; }
  .content h2 { font-size: 21px; margin-top: 40px; }
  .lead { font-size: 17px; }
  .tool { padding: 20px 16px; border-radius: var(--radius); margin-left: -4px; margin-right: -4px; }
  .result { padding: 16px; }
  .result .big { font-size: 28px; }
  .cards { grid-template-columns: 1fr; gap: 8px; }
  .content h2[id] { scroll-margin-top: 110px; }
  .flow { padding: 14px; }
  .flow-row { grid-template-columns: 1fr; }
  .flow-yes { margin: 8px 0 0 44px; }
  .flow-yes::before { left: -30px; top: -8px; width: 0; height: calc(50% + 8px); border-top: none; border-left: 2px solid var(--fill-strong); }
  .flow-yes::after { left: -12px; }
  .flow-yes .flow-tag { left: -30px; top: auto; bottom: calc(50% + 4px); transform: translateX(6px); }
  .flow-yes .flow-end { position: relative; }
  .flow-yes .flow-end::before { content: ""; position: absolute; left: -30px; top: 50%; width: 20px; border-top: 2px solid var(--fill-strong); }
}
