/* 마루재가복지센터 공통 스타일
   Layout: 대청마루 — 마루 판재(세로 결) 띠를 구획 장치로 쓰고, 그 위에 큰 글씨의 정보 블록을 놓는다.
   고령층·보호자를 위해 본문 18px, 터치 영역 44px 이상. */
:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #1d2725;
  --muted: #55625e;
  --line: #d9dfda;
  --pine: #1f5a4c;
  --pine-soft: #e3eee9;
  --on-pine: #ffffff;
  --grain: #b9824a;
  --wood-1: #d8b48a;
  --wood-2: #cba37a;
  --wood-3: #e1c19c;
  --flag: #fff1d6;
  --flag-ink: #7a4d12;
  --display: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", serif;
  --body: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a19; --surface: #1c2422; --ink: #e8ece9; --muted: #a7b3ae; --line: #2f3a37;
    --pine: #6fbfa6; --pine-soft: #1f322d; --on-pine: #0e1a17; --grain: #d9a56f;
    --wood-1: #5a4330; --wood-2: #4c3828; --wood-3: #634a35; --flag: #3a2c14; --flag-ink: #f2c98a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141a19; --surface: #1c2422; --ink: #e8ece9; --muted: #a7b3ae; --line: #2f3a37;
  --pine: #6fbfa6; --pine-soft: #1f322d; --on-pine: #0e1a17; --grain: #d9a56f;
  --wood-1: #5a4330; --wood-2: #4c3828; --wood-3: #634a35; --flag: #3a2c14; --flag-ink: #f2c98a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* hidden 속성이 display 지정보다 항상 우선하도록 (챗봇 창 열림·닫힘에 사용) */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 18px; line-height: 1.75;
  word-break: keep-all; overflow-wrap: anywhere;
}
img { max-width: 100%; }
a { color: var(--pine); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, label:focus-within {
  outline: 3px solid var(--grain); outline-offset: 3px; border-radius: 4px;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.35; text-wrap: balance; margin: 0; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.narrow { max-width: 820px; }
.eyebrow { font-size: .85rem; font-weight: 700; letter-spacing: .08em; color: var(--grain); }
.num { font-variant-numeric: tabular-nums; }
.fine { font-size: .88rem; color: var(--muted); line-height: 1.65; }
.skip { position: absolute; left: -999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a[target="_blank"]::after { content: "↗"; font-size: .8em; margin-left: .25em; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; z-index: 30; }

/* Header */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { width: 40px; height: 40px; flex: none; object-fit: contain; }
.brand-mark { width: 36px; height: 36px; border-radius: 6px; background: repeating-linear-gradient(90deg, var(--wood-1) 0 9px, var(--wood-2) 9px 10px, var(--wood-3) 10px 19px); border: 2px solid var(--grain); flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.nav { display: flex; gap: 4px 22px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1rem; padding-block: 6px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--pine); }
.nav a[aria-current="page"] { color: var(--pine); border-bottom-color: var(--pine); font-weight: 700; }
.head-call { font-weight: 700; color: var(--pine); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
@media (max-width: 900px) {
  .head-row { padding-bottom: 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; gap: 20px; padding-bottom: 6px; scrollbar-width: none; }
}

/* Buttons */
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 22px; border-radius: 10px; font: inherit; font-weight: 700; font-size: 1.05rem; text-decoration: none; border: 2px solid var(--pine); cursor: pointer; }
.btn-primary { background: var(--pine); color: var(--on-pine); }
.btn-ghost { color: var(--pine); background: transparent; }

/* Hero (home) */
.hero { padding-block: 60px 40px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: end; }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); margin-top: 14px; }
.hero-lead { margin-top: 20px; font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero-lead strong { color: var(--ink); }
.hero .actions { margin-top: 30px; }
.hero-note { margin-top: 14px; font-size: .9rem; color: var(--muted); }
.figure-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.figure-card .label { font-size: .95rem; color: var(--muted); }
.figure-card .big { font-family: var(--display); font-size: clamp(2.6rem, 2rem + 2vw, 3.4rem); font-weight: 700; color: var(--pine); line-height: 1.2; }
.figure-card .big span { font-size: 1.2rem; margin-left: 4px; }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-top: 18px; }
.split .gov { flex: 85; background: var(--pine); }
.split .self { flex: 15; background: var(--grain); }
.split-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .95rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.gov { background: var(--pine); } .dot.self { background: var(--grain); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } .hero { padding-block: 40px 32px; } }

/* Sub-page head */
.page-head { padding-block: 48px 36px; }
.page-head h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.7rem); margin-top: 10px; }
.page-head p.lead { margin-top: 14px; color: var(--muted); font-size: 1.1rem; max-width: 38em; }

/* Floorboards band */
.maru { height: 40px; background:
  repeating-linear-gradient(90deg, transparent 0 139px, var(--grain) 139px 141px),
  repeating-linear-gradient(90deg, var(--wood-1) 0 46px, var(--wood-3) 46px 94px, var(--wood-2) 94px 141px); }
.maru.tall { height: 56px; }

section.block { padding-block: 64px; }
section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.sec-head { display: grid; gap: 10px; max-width: 40em; margin-bottom: 32px; }
.sec-head p { color: var(--muted); }
.prose p + p { margin-top: 14px; }
.prose { max-width: 40em; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { padding-top: 18px; border-top: 3px solid var(--line); counter-increment: s; }
.steps li.us { border-top-color: var(--pine); }
.steps li::before { content: counter(s); font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--grain); display: block; line-height: 1; margin-bottom: 10px; }
.steps h3 { font-size: 1.15rem; }
.steps p { margin-top: 6px; font-size: 1rem; color: var(--muted); }
.who { display: inline-block; margin-top: 10px; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--pine-soft); color: var(--pine); }
.who.ext { background: transparent; border: 1px solid var(--line); color: var(--muted); }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }

/* Services */
.services { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.svc { padding: 28px 28px 28px 0; display: grid; gap: 10px; align-content: start; }
.svc + .svc { padding-left: 28px; border-left: 1px solid var(--line); }
.svc .tag { font-size: .85rem; color: var(--muted); }
.svc ul { margin: 4px 0 0; padding-left: 1.1em; color: var(--muted); font-size: 1rem; }
@media (max-width: 860px) {
  .services { grid-template-columns: 1fr; }
  .svc, .svc + .svc { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
}

/* Tools band (home) */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.tool { display: grid; gap: 10px; align-content: start; padding: 28px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.tool:hover { border-color: var(--pine); }
.tool .go { color: var(--pine); font-weight: 700; margin-top: 6px; }
.tool p { color: var(--muted); font-size: 1rem; }
@media (max-width: 760px) { .tools { grid-template-columns: 1fr; } }

/* Tables */
.table-scroll { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: .85rem; color: var(--muted); font-weight: 500; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grade-table td:first-child { font-weight: 700; white-space: nowrap; }
.cond { font-size: .85rem; color: var(--muted); font-weight: 400; display: block; }
.info-table th { width: 9em; color: var(--ink); font-weight: 700; font-size: .95rem; vertical-align: top; }

/* Cost calculator */
.cost-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: start; }
.calc { background: var(--bg); border: 2px solid var(--pine); border-radius: 14px; padding: 26px; display: grid; gap: 18px; min-width: 0; }
.calc h3 { font-size: 1.25rem; }
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 700; font-size: 1rem; }
.field .hint { font-size: .88rem; color: var(--muted); }
select, input[type="text"], input[type="tel"], input[type="email"], textarea {
  font: inherit; font-size: 1.05rem; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%; min-height: 50px;
}
textarea { min-height: 140px; resize: vertical; }
.result { border-top: 1px dashed var(--line); padding-top: 16px; display: grid; gap: 8px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; font-size: 1rem; }
.result-row b { font-variant-numeric: tabular-nums; }
.result-main b { font-family: var(--display); font-size: 1.9rem; color: var(--pine); }
@media (max-width: 860px) { .cost-grid { grid-template-columns: 1fr; } }

/* Meaning + staff */
.meaning { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.meaning div { display: grid; gap: 8px; }
.meaning .word { font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
.meaning .word em { font-style: normal; color: var(--grain); }
.meaning p { color: var(--muted); font-size: 1rem; }
@media (max-width: 760px) { .meaning { grid-template-columns: 1fr; gap: 24px; } }
.staff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.person { display: flex; gap: 16px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-width: 0; }
.avatar { flex: none; width: 60px; height: 60px; border-radius: 50%; background: var(--pine-soft); color: var(--pine); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.4rem; }
.person b { font-size: 1.15rem; }
.person .role { font-size: .95rem; color: var(--pine); font-weight: 700; }
.person .cred { font-size: .9rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 860px) { .staff { grid-template-columns: 1fr; } }

/* FAQ accordion */
.faq-group + .faq-group { margin-top: 48px; }
.faq-group h2 { font-size: 1.4rem; margin-bottom: 12px; }
details.qa { border-bottom: 1px solid var(--line); }
details.qa:first-of-type { border-top: 1px solid var(--line); }
details.qa summary { list-style: none; cursor: pointer; display: flex; gap: 14px; align-items: baseline; padding: 18px 4px; font-weight: 700; font-size: 1.08rem; min-height: 44px; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before { content: "Q"; font-family: var(--display); color: var(--grain); font-size: 1.2rem; flex: none; }
details.qa summary::after { content: "+"; margin-left: auto; color: var(--pine); font-size: 1.4rem; line-height: 1; flex: none; }
details.qa[open] summary::after { content: "−"; }
details.qa .a { padding: 0 4px 22px 32px; color: var(--ink); }
details.qa .a p + p, details.qa .a ul, details.qa .a p + ul { margin-top: 10px; }
details.qa .a ul { padding-left: 1.2em; margin-bottom: 0; }
.faq-preview { display: grid; gap: 0; }

/* Self-test */
.test-layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
.test-sec { border-top: 2px solid var(--ink); padding-top: 20px; }
.test-sec + .test-sec { margin-top: 44px; }
.test-sec h2 { font-size: 1.35rem; }
.test-sec .how { margin-top: 6px; color: var(--muted); font-size: .95rem; }
.q { display: grid; grid-template-columns: minmax(8em, 1fr) auto; gap: 8px 16px; align-items: center; padding-block: 12px; border-bottom: 1px solid var(--line); }
.q-name { font-weight: 500; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label, .chips label { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: .98rem; }
.seg input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .chips label:has(input:checked) { background: var(--pine); border-color: var(--pine); color: var(--on-pine); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
@media (max-width: 640px) { .q { grid-template-columns: 1fr; } }
.score-card { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 96px); background: var(--surface); border: 2px solid var(--pine); border-radius: 14px; padding: 24px; display: grid; gap: 12px; }
.score-card .grade { font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--pine); line-height: 1.25; }
.score-card .score { font-variant-numeric: tabular-nums; color: var(--muted); }
.score-card .desc { font-size: 1rem; }
.score-card .limit { font-size: .95rem; padding-top: 10px; border-top: 1px dashed var(--line); }
.meter { height: 10px; border-radius: 5px; background: var(--pine-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--pine); width: 0; transition: width .25s; }
@media (prefers-reduced-motion: reduce) { .meter span { transition: none; } }
@media (max-width: 900px) {
  .test-layout { grid-template-columns: 1fr; }
  .score-card { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); top: auto; padding: 14px 18px; gap: 4px 12px; grid-template-columns: 1fr auto; align-items: center; box-shadow: 0 6px 24px rgb(0 0 0 / .15); }
  .score-card .eyebrow, .score-card .meter, .score-card .desc, .score-card .limit, .score-card .btn-ghost { display: none; }
  .score-card .grade { font-size: 1.4rem; }
  .score-card .score { grid-column: 1; font-size: .9rem; }
  .score-card .btn-primary { grid-column: 2; grid-row: 1 / span 2; min-height: 46px; padding: 8px 14px; font-size: .95rem; }
}

/* Notice */
.notice { padding: 16px 20px; border-radius: 10px; background: var(--flag); color: var(--flag-ink); font-size: .98rem; }

/* Contact form */
.contact-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.form { display: grid; gap: 20px; }
.req { color: var(--grain); }
.consent { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; font-size: .95rem; }
.consent ul { margin: 8px 0 12px; padding-left: 1.2em; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--pine); flex: none; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-msg { padding: 14px 18px; border-radius: 10px; font-weight: 500; }
.form-msg.ok { background: var(--pine-soft); color: var(--pine); }
.form-msg.err { background: var(--flag); color: var(--flag-ink); }
.side-info { display: grid; gap: 24px; }
.side-info .phone { font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--pine); text-decoration: none; }
@media (max-width: 860px) { .contact-layout { grid-template-columns: 1fr; } }

/* Contact band */
.contact { background: var(--pine); color: var(--on-pine); padding-block: 60px; }
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; }
.contact h2 { color: var(--on-pine); }
.contact p { margin-top: 14px; opacity: .92; }
.phone-box { background: var(--bg); color: var(--ink); border-radius: 14px; padding: 26px; display: grid; gap: 6px; }
.phone-box .tel { font-family: var(--display); font-size: clamp(1.9rem, 1.5rem + 1.5vw, 2.5rem); font-weight: 700; color: var(--pine); text-decoration: none; font-variant-numeric: tabular-nums; }
.phone-box .sub { font-size: .95rem; color: var(--muted); }
.phone-box a.sub { color: var(--pine); font-weight: 700; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* Footer */
footer.site-foot { padding-block: 40px 96px; font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); }
.foot-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; }
.foot-grid dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0 0; }
.foot-grid dt { font-weight: 700; color: var(--ink); }
.foot-grid dd { margin: 0; }
.foot-brand { display: inline-flex; align-items: center; gap: 10px; }
.foot-brand img { width: 32px; height: 32px; }
.foot-name { color: var(--ink); font-family: var(--display); font-size: 1.1rem; font-weight: 700; }
.foot-links { display: flex; flex-direction: column; gap: 8px; }
.foot-links a { color: var(--ink); }
.foot-links .policy { font-weight: 700; }
@media (max-width: 680px) { .foot-grid { grid-template-columns: 1fr; } .foot-grid dl { grid-template-columns: 1fr; } .foot-grid dt { margin-top: 6px; } }

/* Chat widget */
.chat-btn { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 22px; border-radius: 28px; border: 0; background: var(--pine); color: var(--on-pine); font: inherit; font-weight: 700; font-size: 1.02rem; cursor: pointer; box-shadow: 0 6px 20px rgb(0 0 0 / .18); }
.chat-btn svg { width: 22px; height: 22px; }
.chat-panel { position: fixed; right: 20px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 20; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 140px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgb(0 0 0 / .22); overflow: hidden; }
.chat-head { padding: 14px 18px; background: var(--pine); color: var(--on-pine); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chat-head b { font-size: 1.02rem; }
.chat-head span { display: block; font-size: .8rem; opacity: .85; }
.chat-head button { background: transparent; border: 0; color: inherit; font-size: 1.5rem; cursor: pointer; min-width: 44px; min-height: 44px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 10px; align-content: start; background: var(--bg); }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; font-size: .98rem; line-height: 1.6; }
.msg.bot { background: var(--surface); border: 1px solid var(--line); justify-self: start; }
.msg.user { background: var(--pine); color: var(--on-pine); justify-self: end; }
.msg a { color: inherit; font-weight: 700; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; background: var(--surface); }
.chat-chips button { font: inherit; font-size: .88rem; padding: 6px 12px; min-height: 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.chat-form { display: flex; gap: 8px; padding: 12px; background: var(--surface); border-top: 1px solid var(--line); }
.chat-form input { min-height: 46px; font-size: 1rem; }
.chat-form button { flex: none; min-width: 64px; border-radius: 8px; border: 0; background: var(--pine); color: var(--on-pine); font: inherit; font-weight: 700; cursor: pointer; }
.chat-note { padding: 0 12px 10px; background: var(--surface); font-size: .78rem; color: var(--muted); }
