/* 근로계산기 공통 스타일. 외부 글꼴·이미지를 쓰지 않는다. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1f27;
  --muted: #55606e;
  --border: #c9d0d9;
  --accent: #1456c8;
  --accent-text: #ffffff;
  --accent-soft: #eaf1fd;
  --warn-bg: #fff4dc;
  --warn-text: #5c3b00;
  --error: #b3261e;
  --focus: #b3261e;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --surface: #1b2028;
    --text: #e8ebf0;
    --muted: #aab4c1;
    --border: #46505e;
    --accent: #8ab8ff;
    --accent-text: #0c1626;
    --accent-soft: #1f2c44;
    --warn-bg: #3a2c0c;
    --warn-text: #ffdf9e;
    --error: #ffb4ab;
    --focus: #ffd166;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 10;
}
.skip-link:focus { top: 12px; }

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

/* 머리말 · 꼬리말 */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.site-name { font-weight: 800; font-size: 1.125rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.site-nav a { margin-left: 16px; font-size: 0.9375rem; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: 0.875rem; }
.site-footer nav a { margin-right: 16px; }
.site-footer p { margin: 8px 0 0; }

main { padding: 28px 0 0; }

h1 { font-size: 1.625rem; line-height: 1.35; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; line-height: 1.4; margin: 40px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 1.0625rem; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); margin-bottom: 20px; }
.small { font-size: 0.875rem; color: var(--muted); }

/* 카드 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 20px;
}

/* 입력 양식 */
fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
legend, .label { display: block; font-weight: 700; margin-bottom: 6px; padding: 0; }
.hint { display: block; font-size: 0.875rem; color: var(--muted); margin: 2px 0 6px; font-weight: 400; }
.field { margin: 0 0 20px; }
.row { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }

input[type="date"], input[type="number"], input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 8px;
}
input[aria-invalid="true"] { border: 2px solid var(--error); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--surface);
}
.choice input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.error { color: var(--error); font-size: 0.9375rem; margin: 6px 0 0; font-weight: 600; }

button.primary {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-weight: 800;
  font-size: 1.0625rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }

details.optional { border-top: 1px solid var(--border); padding-top: 16px; margin-bottom: 20px; }
details.optional > summary { font-weight: 700; cursor: pointer; padding: 9px 0; } /* 손가락으로 누르기 쉽게 높이 44px 이상 */
details.optional > summary + * { margin-top: 16px; }

/* 결과 */
.result-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 560px) { .result-grid { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; }
.stat dt { font-size: 0.875rem; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.stat dd small { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
dl.result-grid { margin-top: 0; }

/* 두 기준 나란히 비교 (좁은 화면에서도 2칸) */
.result-grid.compare { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.compare .stat { padding: 12px; }
.compare .stat dt { font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.compare .stat dd { font-size: 1.75rem; }

/* 공유 */
.share { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
button.secondary {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
}
button.secondary:hover { background: var(--accent-soft); }
.share p { margin-bottom: 6px; }
#share-status:empty { display: none; }

/* 상세 내역 탭 */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.tabs [role="tab"] {
  flex: 1;
  min-height: 44px;
  padding: 8px;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--accent-text); font-weight: 800; }

.notice { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 12px 16px; margin: 0 0 12px; }
.notice strong { font-weight: 800; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8125rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; padding-right: 14px; white-space: nowrap; }
td.date { white-space: nowrap; }
td .status { display: block; font-size: 0.8125rem; }
@media (max-width: 480px) {
  .card { padding: 16px; }
  #result table { font-size: 0.875rem; }
  #result th, #result td { padding-right: 8px; }
  #result td.num, #result th.num { padding-right: 10px; }
}
tr.expired td { color: var(--muted); }
tfoot td { font-weight: 800; border-bottom: 0; }

details.more { margin-top: 16px; }
details.more > summary { cursor: pointer; font-weight: 700; min-height: 32px; }

/* 설명 글 */
.prose ul { padding-left: 1.2em; margin: 0 0 12px; }
.prose li { margin-bottom: 4px; }
.prose table { margin-bottom: 12px; }

/* 첫 화면 도구 목록 */
.tool-list { list-style: none; padding: 0; margin: 0; }
.tool-list a { display: block; text-decoration: none; color: var(--text); }
.tool-list a:hover .tool-title { text-decoration: underline; }
.tool-title { font-weight: 800; font-size: 1.125rem; color: var(--accent); }
.tool-desc { color: var(--muted); margin: 4px 0 0; }

[hidden] { display: none !important; }
