/* 디자인 기준: Home.dc.html, Guide.dc.html 시안 */

:root {
  --blue: #2a6df4;
  --blue-dark: #1b55cc;
  --blue-soft: #eaf1fe;
  --blue-disabled: #a9c3f9;
  --text: #191c22;
  --text-2: #2b303a;
  --muted: #4a515e;
  --muted-2: #6b7280;
  --line: #e7e9ee;
  --line-soft: #f0f1f4;
  --bg: #f5f6f8;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: #fff;
  word-break: keep-all;
}
body.page-home { background: var(--bg); }

/* 본문이 짧아도 푸터가 화면 맨 아래에 오도록 한다 */
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; width: 100%; }
.site-footer { flex: none; }

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ── 상단 바 ── */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px 0 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}
.site-nav { display: flex; gap: 2px; }
.site-nav a {
  padding: 0 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--blue); }
.site-nav a[aria-current="page"] {
  font-weight: 700;
  color: var(--blue);
  box-shadow: inset 0 -2px 0 var(--blue);
}

/* ── 레이아웃 ── */
.container { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
.container.narrow { max-width: 680px; padding: 16px 20px 56px; }

/* 광고 자리: 비어 있으면 접힌다. 광고 코드를 넣으면 "광고" 표시가 자동으로 붙는다. */
.ad-slot { margin: 0 0 24px; }
.ad-slot:empty { display: none; }
.ad-slot:not(:empty)::before {
  content: "광고";
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: #9aa1ad;
}
.ad-bottom { margin: 28px 0 0; }

/* ── 홈 ── */
.intro { margin-bottom: 20px; }
.intro h1 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.intro p { margin: 0; color: var(--muted); text-wrap: pretty; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.cond-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px 24px;
}
.cond-group legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.chip span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #d9dde4;
  background: #fff;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.chip input:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
}
.chip input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn-primary {
  margin-top: 24px;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-primary:disabled { background: var(--blue-disabled); cursor: not-allowed; }
.hint { margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--muted-2); }

.btn-outline {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #d9dde4;
  background: #fff;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
}
.btn-outline:hover { background: var(--bg); }

/* 빈 상태 */
.empty-card {
  margin-top: 20px;
  padding: 36px 20px;
  border-style: dashed;
  border-color: #cfd4dc;
  text-align: center;
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
}
.empty-card h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.empty-card p { margin: 0 auto; max-width: 400px; color: #5b6270; font-size: 15px; text-wrap: pretty; }
.empty-card p b { color: var(--text); }
.steps {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  text-align: left;
}
.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 15px;
}
.steps li span {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* 결과 요약 */
#result { margin-top: 20px; }
.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow { font-size: 13px; color: var(--muted-2); font-weight: 600; }
.summary-text { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.45; }
.progress-row { margin-top: 16px; display: flex; justify-content: space-between; align-items: baseline; }
.progress-label { font-size: 15px; color: var(--muted); }
.progress-label b { font-size: 22px; color: var(--blue); font-weight: 800; }
.progress-pct { font-size: 14px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.bar { margin-top: 6px; height: 8px; border-radius: 99px; background: #edf0f4; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--blue); border-radius: 99px; transition: width 0.25s; }

/* 카테고리 카드 */
.cat-card { margin-top: 12px; padding: 0; overflow: hidden; }
.cat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.cat-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.cat-count { font-size: 14px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.items { list-style: none; margin: 0; padding: 0; }
.items:empty { display: none; }
.item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 6px 0 8px;
  border-top: 1px solid var(--line-soft);
}
.item.done { opacity: 0.5; }
.item-check { position: absolute; left: 20px; width: 1px; height: 1px; margin: 0; opacity: 0; }
.item-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 0 12px;
  cursor: pointer;
}
.box {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 2px solid #c3c8d1;
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.item-check:checked + .item-label .box { background: var(--blue); border-color: var(--blue); color: #fff; }
.item-check:focus-visible + .item-label .box { outline: 2px solid var(--blue); outline-offset: 2px; }
.name { overflow-wrap: anywhere; }
.item.done .name { text-decoration: line-through; }
.del {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #a3a9b4;
  font-size: 22px;
  line-height: 1;
}
.del:hover { background: #f3f4f6; color: var(--muted); }

.add-form { display: flex; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid var(--line-soft); }
.add-form input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d9dde4;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline-color: var(--blue);
}
.add-form button {
  flex: none;
  height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--blue);
  background: #fff;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
}
.add-form button:hover { background: var(--blue-soft); }

.guide-teaser {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--blue-soft);
  color: var(--text);
  text-decoration: none;
}
.guide-teaser:hover { color: var(--text); }
.guide-teaser small { display: block; font-size: 13px; color: var(--blue); font-weight: 700; }
.guide-teaser strong { font-size: 16px; }
.guide-teaser .arrow { color: var(--blue); font-size: 20px; }

/* ── 글 페이지 (가이드, 소개, 문의, 개인정보처리방침) ── */
.prose { font-size: 17px; line-height: 1.8; }
.prose h1 {
  margin: 6px 0 12px;
  font-size: 28px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.prose h2 {
  margin: 44px 0 12px;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.prose h1 + .meta + h2,
.prose h1 + h2 { margin-top: 28px; }
.prose p { margin: 0 0 14px; text-wrap: pretty; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 6px; overflow-wrap: anywhere; }
.prose .meta { margin: 0; font-size: 14px; color: var(--muted-2); }
.prose .lead { margin: 24px 0 0; font-size: 18px; color: var(--text-2); }

.crumbs { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted-2); }
.crumbs a { color: var(--muted-2); text-decoration: none; }

.toc {
  margin: 28px 0 8px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--bg);
}
.toc .toc-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.toc ol { margin: 0; padding-left: 20px; font-size: 16px; line-height: 2; }
.toc li { margin: 0; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--blue); }

.cta-box {
  margin: 52px 0 0;
  padding: 28px 22px;
  border-radius: 18px;
  background: var(--blue-soft);
  text-align: center;
}
.prose .cta-box h2 { margin: 0 0 6px; font-size: 20px; }
.prose .cta-box p { margin: 0 0 18px; font-size: 15px; color: var(--muted); }
.cta-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}
.cta-link:hover { background: var(--blue-dark); color: #fff; }

/* 가이드 목록 */
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-card {
  display: block;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}
.guide-list li:last-child .guide-card { border-bottom: 1px solid var(--line); }
.guide-card:hover .guide-title { color: var(--blue); }
.guide-title { display: block; font-weight: 700; font-size: 17px; }
.guide-desc { display: block; margin-top: 2px; font-size: 15px; color: #5b6270; }

/* 글 아래 "다른 가이드" */
.related { margin-top: 40px; }
.prose .related h2 { margin: 0 0 8px; font-size: 17px; }
.prose .guide-list { margin: 0; padding: 0; }
.prose .guide-list li { margin: 0; }
.prose .guide-card { padding: 14px 0; }

/* ── 푸터 ── */
.site-footer { background: var(--bg); border-top: 1px solid var(--line); }
body.page-home .site-footer { background: #fff; }
.footer-inner { max-width: 720px; margin: 0 auto; padding: 24px 16px 32px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -8px; }
.footer-links a {
  padding: 0 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #5b6270;
  text-decoration: none;
}
.footer-links a.strong { font-weight: 700; color: var(--text-2); }
.footer-links a:hover { color: var(--blue); }
.footer-note { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted-2); }

/* ── 모션 ── */
html { scroll-behavior: smooth; }
h2[id], #condition-form { scroll-margin-top: 16px; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes item-out {
  to { opacity: 0; transform: translateX(24px); }
}
@keyframes float {
  50% { transform: translateY(-5px); }
}
@keyframes ready-pulse {
  from { box-shadow: 0 0 0 0 rgba(42, 109, 244, 0.45); }
  to { box-shadow: 0 0 0 12px rgba(42, 109, 244, 0); }
}

/* 페이지가 열릴 때 위에서부터 차례로 나타난다 */
.container > *:not(.ad-slot):not(#result) { animation: fade-up 0.5s ease backwards; }
.container > :nth-child(2) { animation-delay: 0.06s; }
.container > :nth-child(3) { animation-delay: 0.12s; }
.container > :nth-child(4) { animation-delay: 0.18s; }
.container > :nth-child(n + 5) { animation-delay: 0.24s; }

/* 목록을 만들 때 카테고리 카드가 차례로 나타난다 */
.animate-in .cat-card {
  animation: fade-up 0.4s ease backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.item.enter { animation: item-in 0.3s ease; }
.item.leaving { animation: item-out 0.2s ease forwards; }

.empty-icon { animation: float 3s ease-in-out infinite; }

.site-nav a, .footer-links a, .guide-card .guide-title { transition: color 0.15s; }
.brand-mark { transition: transform 0.2s; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }

.chip span { transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; }
.chip:hover input:not(:checked) + span { border-color: var(--blue); }
.chip:active span { transform: scale(0.95); }

.btn-primary, .btn-outline, .add-form button, .del, .cta-link {
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn-primary:not(:disabled) { animation: ready-pulse 0.6s ease-out; }
.btn-primary:active:not(:disabled), .btn-outline:active, .add-form button:active, .cta-link:active {
  transform: scale(0.98);
}

.item { transition: opacity 0.25s; }
.box { transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; }
.item-label:active .box { transform: scale(0.85); }
.name {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 1.5px;
  transition: background-size 0.25s ease;
}
.item.done .name { text-decoration: none; background-size: 100% 1.5px; }

.guide-teaser, .cta-link { transition: transform 0.2s, background-color 0.15s, box-shadow 0.2s; }
.guide-teaser:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(42, 109, 244, 0.15); }
.guide-teaser .arrow { transition: transform 0.2s; }
.guide-teaser:hover .arrow { transform: translateX(4px); }
.cta-link:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(42, 109, 244, 0.3); }

/* 움직임을 줄이는 설정을 쓰는 사용자에게는 효과를 끈다 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 인쇄: 짐 목록만 깔끔하게 ── */
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .item.done .name { text-decoration: line-through; background: none; }
  body, body.page-home { background: #fff; }
  .no-print, .topbar, .site-footer, .ad-slot, .guide-teaser, .empty-card { display: none !important; }
  .container { padding: 0; max-width: none; }
  .intro p { display: none; }
  #result { margin-top: 0; }
  .card { border: 0; padding: 0; border-radius: 0; }
  .cat-card { break-inside: avoid; margin-top: 8px; }
  .cat-head { padding: 8px 0; }
  .item { opacity: 1 !important; padding: 0; }
  .item-label { min-height: 36px; padding: 0; }
  .cat-custom.is-empty { display: none; }
}
