/* 일상관리 공통 스타일. 모바일(폭 360px)을 기준으로 먼저 만들고, 넓은 화면은 아래에서 보강한다.
   분위기: 넉넉한 여백 + 깊은 파랑 배너 + 가는 선과 작은 분류 글자. 색은 아래 :root 에서만 바꾼다. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f1b2d;
  --muted: #55627a;
  --line: #e3e9f2;
  --accent: #185fa5;
  --accent-dark: #0c447c;
  --accent-soft: #e6f1fb;
  --accent-mid: #b5d4f4;
  --navy: #0b2545;
  --navy-2: #124a86;
  --error: #c62828;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, 0.05), 0 4px 14px rgba(11, 37, 69, 0.05);
  --shadow-md: 0 2px 4px rgba(11, 37, 69, 0.06), 0 12px 28px rgba(11, 37, 69, 0.10);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 18px; }

.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 8px 12px; z-index: 20; }
.skip-link:focus { left: 0; }

/* 상단 */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 9px; color: #fff; font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, var(--navy-2), var(--accent));
}
.main-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0 -10px; }
.main-nav a { padding: 6px 12px; color: var(--muted); text-decoration: none; border-radius: 999px; font-size: 15px; font-weight: 600; transition: background-color 0.15s, color 0.15s; }
.main-nav a:hover { color: var(--accent-dark); background: var(--accent-soft); }
.main-nav a[aria-current="page"] { color: var(--accent-dark); background: var(--accent-soft); }

main.wrap { padding-top: 24px; padding-bottom: 44px; }

h1 { font-size: 28px; line-height: 1.3; letter-spacing: -0.02em; margin: 8px 0 10px; }
h2 { font-size: 21px; line-height: 1.4; letter-spacing: -0.015em; margin: 32px 0 12px; }
h3 { font-size: 17px; margin: 18px 0 6px; }
.lead { color: var(--muted); margin: 0 0 6px; }

/* 작은 분류 글자: 제목 위에 얹는 짧은 이름표 */
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

/* 첫 화면 큰 배너: 이미지 없이 색과 모양만으로 만든다 (저작권 걱정 없음) */
.hero {
  position: relative; overflow: hidden; margin: 0 0 8px; padding: 34px 22px 32px; border-radius: var(--radius-lg); color: #fff;
  /* 배경 그림은 AI로 만든 이미지(docs/IMAGES.md). 글자가 잘 읽히도록 왼쪽에 어두운 막을 덧씌운다. */
  background:
    linear-gradient(90deg, rgba(11, 37, 69, 0.82) 0%, rgba(11, 37, 69, 0.48) 55%, rgba(11, 37, 69, 0.05) 100%),
    var(--navy) url("/assets/img/hero.webp") center / cover no-repeat;
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: #cfe3fa; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.28; margin: 4px 0 12px; max-width: 14em; }
.hero-text { margin: 0 0 22px; color: #d7e6f8; max-width: 34em; }
.hero-actions { margin: 0; }

/* 페이지 위쪽 머리말(도구 목록·도구 페이지) */
.page-head { margin: 0 0 18px; padding: 22px 20px; border: 1px solid #d8e5f6; border-radius: var(--radius-lg); background: #f4f8fd url("/assets/img/pagehead.webp") right bottom / cover no-repeat; }
.page-head h1 { margin: 2px 0 8px; }
.page-head .lead { margin: 0; }

/* 구역 제목: 작은 분류 글자 + 제목 + 가는 선 */
.section { margin-top: 36px; }
.section-head { display: flex; flex-direction: column; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; }

.card-grid { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: 1fr; }
.section .card-grid { margin-top: 0; }
.card {
  position: relative; display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  height: 100%; padding: 18px 44px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.card::after { content: "→"; position: absolute; right: 18px; top: 50%; transform: translate(-6px, -50%); color: var(--accent); font-weight: 700; opacity: 0; transition: opacity 0.18s, transform 0.18s; }
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--accent-mid); box-shadow: var(--shadow-md); color: var(--text); }
.card:hover::after, .card:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.card-icon {
  grid-row: 1 / 3; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; color: var(--accent-dark); font-weight: 800; font-size: 20px;
  background: linear-gradient(135deg, var(--accent-soft), #cfe2f7);
}
.card strong { font-size: 17px; letter-spacing: -0.01em; }
.card span:last-child { color: var(--muted); font-size: 14px; line-height: 1.55; }

.latest-posts { margin-top: 36px; }

/* 도구 상자 */
.tool-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 18px; margin: 0 0 18px; box-shadow: var(--shadow-sm); }
.tool-box h2 { margin: 0 0 14px; font-size: 18px; }
.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 8px 14px; }

input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 16px; /* 16px: 폰에서 입력할 때 화면이 확대되지 않게 */
  color: var(--text); background: #fff; border: 1px solid #b8c4d6; border-radius: 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: #8fa3bf; }
textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.22); outline: none; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #9ec1ff; outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); font-size: 14px; margin: 4px 0 0; min-height: 0; }
.error:empty { display: none; }

.result {
  margin: 14px 0 0; padding: 14px 16px; background: var(--accent-soft); color: var(--accent-dark); border-left: 4px solid var(--accent);
  border-radius: 4px 12px 12px 4px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
}
.result:empty { display: none; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 20px; font: inherit; font-weight: 700; color: #fff; background: var(--accent);
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none; transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover { background: var(--accent-dark); color: #fff; }
button:active, .btn:active { transform: translateY(1px); }
button.secondary { color: var(--accent-dark); background: var(--accent-soft); }
button.secondary:hover { background: #d3e5f8; color: var(--accent-dark); }
.btn-light { color: var(--navy); background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.btn-light:hover { color: var(--navy); background: #eaf2fc; }

.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* 표 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 15px; }
caption { text-align: left; font-weight: 700; padding: 12px 14px 8px; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--accent-soft); color: var(--accent-dark); }
tbody tr:nth-child(even) td { background: #fafcfe; }
tbody tr:last-child td { border-bottom: 0; }

/* 설명 글 */
.prose p, .prose li { max-width: 68ch; }
.prose ul, .prose ol { padding-left: 22px; }
.prose > h1 { font-size: 30px; margin-bottom: 14px; }
.prose code { background: #eaf0f8; padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }
.formula { display: block; margin: 10px 0; padding: 12px 14px; background: #eaf0f8; border-radius: 10px; overflow-x: auto; }

.faq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.faq[open] { border-color: var(--accent-mid); box-shadow: var(--shadow-sm); }
.faq summary { position: relative; cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; font-weight: 400; color: var(--accent); }
.faq[open] summary::after { content: "−"; }
.faq p { margin: 0; padding: 0 16px 16px; color: var(--muted); }

.sources li { margin-bottom: 4px; }
.related { margin-top: 36px; }

/* 광고 자리: 광고 코드 없이 자리만. 비어 있으면 눈에 띄지 않게 둔다. */
.ad-slot { display: block; min-height: 0; margin: 22px 0; text-align: center; }

/* 하단 */
.site-footer { background: var(--navy); border-top: 0; padding: 30px 0 34px; color: #c3d3ea; font-size: 14px; }
.site-footer p { margin: 6px 0; }
.site-footer a { color: #ffffff; text-decoration-color: rgba(255, 255, 255, 0.4); }
.site-footer a:hover { color: #cfe3fa; }
.footer-brand { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.footer-links { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-note { color: #9db3d1; }

@media (min-width: 600px) {
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
  .main-nav { margin: 0 -10px 0 0; }
  h1 { font-size: 32px; }
  .hero { padding: 54px 40px 50px; }
  .hero h1 { font-size: 40px; }
  .page-head { padding: 28px 28px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .tool-box { padding: 24px 24px; }
}

/* 날짜 입력 */
fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.date-row { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 8px; align-items: center; }
.date-part { display: flex; align-items: center; gap: 4px; min-width: 0; }
.date-part input { width: 100%; min-width: 0; text-align: center; padding-left: 4px; padding-right: 4px; }
.unit { color: var(--muted); font-size: 15px; }
.today-btn { grid-column: 1 / -1; justify-self: start; min-height: 40px; padding: 6px 14px; font-size: 14px; }
.msg { margin: 4px 0 0; font-size: 14px; }
.msg:empty { display: none; }
.msg.error { color: var(--error); }
.msg.note { color: var(--muted); }
.mode-field .radio { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-weight: 400; cursor: pointer; }
.mode-field input[type="radio"], .check input[type="checkbox"] { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; }
.jump-links { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.jump-links a { display: inline-block; padding: 7px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--accent-dark); transition: background-color 0.15s, border-color 0.15s; }
.jump-links a:hover { background: var(--accent-soft); border-color: var(--accent-mid); }
.result-table { margin-top: 14px; }
.result-table td:last-child, .result-table th:last-child { text-align: right; }

/* 글자수 결과 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.stat dt { color: var(--muted); font-size: 13px; line-height: 1.4; }
.stat dd { margin: 2px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat dd small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-main { background: var(--accent-soft); border-color: var(--accent-mid); }
.stat-main dd { font-size: 28px; color: var(--accent-dark); }

/* 제목 안의 링크(예: 홈의 "도구")는 제목과 같은 모양으로 보이고, 마우스를 올리면 밑줄이 생긴다 */
h2 > a { color: inherit; text-decoration: none; }
h2 > a:hover, h2 > a:focus-visible { text-decoration: underline; }

/* 움직임을 줄이도록 설정한 사용자에게는 전환 효과를 끈다 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .card:hover, .card:focus-visible { transform: none; }
}

/* 화면에는 보이지 않고 스크린리더만 읽는 글 */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* 비만도(BMI) 계산기 */
.bmi-result { margin: 8px 0 4px; padding: 18px 16px 14px; background: var(--accent-soft); border: 1px solid var(--accent-mid); border-radius: var(--radius-lg); }
.bmi-result[hidden] { display: none; }
.bmi-value { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: var(--accent-dark); }
.bmi-value small { margin-left: 6px; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.bmi-level { display: inline-block; margin: 10px 0 14px; padding: 5px 14px; border-radius: 999px; font-size: 17px; font-weight: 800; background: #e3f6ec; color: #0b5b3a; }
.bmi-level[data-level="under"] { background: #dcebfa; color: #0c447c; }
.bmi-level[data-level="normal"] { background: #d7f2e3; color: #0b5b3a; }
.bmi-level[data-level="pre"] { background: #fdf0c4; color: #6b4a00; }
.bmi-level[data-level="obese1"] { background: #fde2c8; color: #7a3d00; }
.bmi-level[data-level="obese2"] { background: #fbd5cc; color: #8a2412; }
.bmi-level[data-level="obese3"] { background: #f3c4c4; color: #6e1414; }
.bmi-scale { position: relative; padding: 0 0 12px; margin: 0 0 12px; }
.bmi-bar { display: flex; height: 12px; overflow: hidden; border-radius: 999px; }
.bmi-bar span { display: block; height: 100%; }
.bmi-marker { position: absolute; top: -5px; width: 4px; height: 22px; margin-left: -2px; background: var(--navy); border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.bmi-facts { margin: 0; padding-left: 20px; color: var(--text); }
.bmi-table tbody tr.is-current td { background: var(--accent-soft); font-weight: 800; color: var(--accent-dark); }

/* 글(가이드) */
.guide-meta { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.guide-body { margin-top: 4px; }
.guide-body h2 { margin-top: 34px; padding-top: 4px; }
.guide-body li { margin-bottom: 6px; }
.answer { padding: 16px 18px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 4px 14px 14px 4px; color: var(--accent-dark); font-size: 17px; }
.cta-box { margin: 36px 0 8px; padding: 22px 20px; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.cta-box h2 { margin: 0 0 6px; font-size: 20px; color: #fff; }
.cta-box p { margin: 0 0 14px; color: #d7e6f8; }
.cta-box p:last-child { margin-bottom: 0; }
.cta-box .btn { color: var(--navy); background: #fff; }
.cta-box .btn:hover { color: var(--navy); background: #eaf2fc; }
.post-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 20px; }
.post-card::after { top: 22px; transform: translate(-6px, 0); }
.post-card:hover::after, .post-card:focus-visible::after { transform: translate(0, 0); }
.post-card strong { font-size: 18px; line-height: 1.4; }
.post-card span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.post-card small { color: var(--muted); font-size: 13px; }

/* 면적 구조 그림 (글: 공급·전용·계약·서비스면적) */
.area-diagram { margin: 18px 0 8px; padding: 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.area-diagram figcaption { margin-top: 10px; color: var(--muted); font-size: 13px; }
.ad-row { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 10px; }
.ad-label { font-size: 14px; font-weight: 700; color: var(--text); }
.ad-track { display: flex; min-width: 0; overflow: hidden; border-radius: 8px; }
.ad-row:nth-child(1) .ad-track { width: 60%; }
.ad-row:nth-child(2) .ad-track { width: 80%; }
.ad-row:nth-child(3) .ad-track { width: 100%; }
.ad-row:nth-child(4) .ad-track { width: 20%; }
.ad-seg { display: grid; place-items: center; min-width: 0; padding: 8px 2px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ad-own { background: #185fa5; color: #fff; }
.ad-common { background: #9cc3ec; color: #0c2a4d; }
.ad-etc { background: #d3e5f8; color: #0c447c; }
.ad-service { background: #fdf0c4; color: #6b4a00; border: 1px dashed #c9a227; }
.area-table td:first-child { font-weight: 700; white-space: nowrap; }
.area-table td:last-child { white-space: normal; text-align: left; }
.area-table th:last-child { text-align: left; }

/* 홈: 도구·글을 한 줄로 나란히 놓는다. 넓은 화면에서는 4개가 한 번에 보이고, 더 있으면 옆으로 넘긴다 */
.section-head-row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; }
.carousel-nav { display: flex; gap: 8px; }
.carousel-nav[hidden] { display: none; }
.carousel-btn { width: 38px; min-height: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent-dark); font-size: 22px; line-height: 1; }
.carousel-btn:hover { background: var(--accent-soft); color: var(--accent-dark); }
.carousel-btn:disabled { opacity: 0.4; cursor: default; background: var(--surface); }
.carousel-track { display: flex; gap: 14px; margin: 0 -2px; padding: 2px 2px 14px; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.carousel-track:focus-visible { outline: 3px solid #9ec1ff; outline-offset: 2px; border-radius: var(--radius); }
.carousel-track > li { flex: 0 0 72%; min-width: 0; scroll-snap-align: start; }
.carousel-track .card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 14px; }
.carousel-track .card::after { display: none; }
.carousel-track .card-icon { width: 44px; height: 44px; font-size: 18px; }
.carousel-track .card strong { font-size: 16px; line-height: 1.4; }
.carousel-track .card span:last-child { font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.carousel-track .post-card small { margin-top: auto; }
.carousel-hint { margin: 0; text-align: right; }
.carousel-hint[hidden] { display: none; }
@media (min-width: 600px) {
  .carousel-track > li { flex-basis: calc((100% - 28px) / 3); }
}
@media (min-width: 900px) {
  .carousel-track > li { flex-basis: calc((100% - 42px) / 4); }
  .carousel-track .card strong, .carousel-track .post-card strong { font-size: 15px; }
  .carousel-track .card span:last-child, .carousel-track .post-card span { font-size: 13px; }
}
