/* =========================================================
   생활정보 사이트 - 공통 스타일시트
   컨셉: "장부(ledger)" 모티브 - 점선 리더, 표 형식 숫자,
   절제된 남색+금색 팔레트로 신뢰감 있는 생활정보 톤 구현
   ========================================================= */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1c2333;
  --ink-soft: #545b6b;
  --primary: #1f3a5f;
  --primary-dark: #142842;
  --accent: #c9a227;
  --accent-soft: #f4e9c7;
  --positive: #3e7c59;
  --line: #ded9cc;
  --line-strong: #c7c1b0;
  --radius: 6px;
  --max-width: 720px;
  --font-body: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  --font-num: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button { font-family: inherit; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand .mark {
  color: var(--accent);
}

/* ---------- Date ticker ---------- */
.ticker {
  background: var(--primary-dark);
  color: rgba(255,255,255,.75);
  font-size: 12px;
  font-family: var(--font-num);
}
.ticker .wrap {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ticker .today { color: var(--accent); font-weight: 600; }

/* ---------- Ad slot ---------- */
.ad-slot {
  max-width: var(--max-width);
  margin: 14px auto;
  padding: 0 16px;
}
.ad-slot .ad-box {
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius);
  letter-spacing: .04em;
}
.ad-slot.leaderboard .ad-box { min-height: 60px; display:flex; align-items:center; justify-content:center;}
.ad-slot.rectangle .ad-box { min-height: 100px; display:flex; align-items:center; justify-content:center;}

/* ---------- Main ---------- */
main { padding: 4px 0 40px; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 22px 0 10px;
}
.section-title .num {
  font-family: var(--font-num);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.section-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------- Ledger list (menu categories with dot-leader counts) ---------- */
.ledger {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.ledger-row {
  border-bottom: 1px solid var(--line);
}
.ledger-row:last-child { border-bottom: none; }

.ledger-head {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  padding: 14px 14px;
  cursor: pointer;
  text-align: left;
  gap: 10px;
}

.ledger-head .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.ledger-head .label {
  font-weight: 700;
  font-size: 15.5px;
  white-space: nowrap;
}

.ledger-head .dots {
  flex: 1;
  border-bottom: 1px dotted var(--line-strong);
  margin: 0 8px;
  height: 1px;
  transform: translateY(-4px);
}

.ledger-head .count {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--primary);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 13px;
  flex-shrink: 0;
}

.ledger-head .chevron {
  color: var(--ink-soft);
  font-size: 11px;
  transition: transform .15s ease;
  flex-shrink: 0;
}
.ledger-row.open .ledger-head .chevron { transform: rotate(90deg); }

.ledger-body {
  display: none;
  padding: 0 14px 12px 46px;
}
.ledger-row.open .ledger-body { display: block; }

.ledger-body a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 0;
  font-size: 14.5px;
  color: var(--ink);
  border-top: 1px dashed var(--line);
}
.ledger-body a:first-child { border-top: none; }
.ledger-body a:before {
  content: "›";
  color: var(--accent);
  font-weight: 700;
}
.ledger-body a:hover { color: var(--primary); }

/* ---------- badge: new ---------- */
.badge-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--positive);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.4;
  letter-spacing: .02em;
  flex-shrink: 0;
}

/* ---------- News list ---------- */
.news-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.news-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: none; }
.news-item .flag { padding-top: 2px; }
.news-item .body { flex: 1; min-width: 0; }
.news-item .title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-item .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-num);
}

.news-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
}
.news-detail h1 {
  font-size: 19px;
  margin: 4px 0 8px;
  letter-spacing: -0.01em;
}
.news-detail .meta {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-num);
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 12px;
}
.news-detail .summary { font-size: 15px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ---------- Calculator forms ---------- */
.calc-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 20px;
}
.calc-panel h1 {
  font-size: 18px;
  margin: 0 0 4px;
}
.calc-panel .desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field .input-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.field input, .field select {
  border: none;
  background: none;
  padding: 11px 12px;
  font-size: 15px;
  font-family: var(--font-num);
  width: 100%;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.field .unit {
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.calc-btn {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  margin-top: 4px;
}
.calc-btn:hover { background: var(--primary-dark); }
.calc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-box {
  margin-top: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
}
.result-row .rlabel { font-size: 13.5px; color: var(--ink-soft); }
.result-row .rvalue {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 15px;
}
.result-row.total {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 12px;
}
.result-row.total .rvalue {
  font-size: 20px;
  color: var(--primary);
}
.result-row.total .rlabel { font-weight: 700; color: var(--ink); }

/* ---------- Home hero ---------- */
.hero {
  padding: 26px 0 6px;
}
.hero h1 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding: 20px 0 34px;
  color: var(--ink-soft);
  font-size: 12px;
}
.site-footer .links {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.site-footer .links a { font-weight: 600; color: var(--ink-soft); }
.site-footer .links a:hover { color: var(--primary); }

/* ---------- utility ---------- */
.hidden { display: none !important; }

@media (min-width: 560px) {
  body { font-size: 16px; }
  .brand { font-size: 18px; }
}
