/* 며칠쉴까 - 모바일 우선 스타일 (외부 폰트 없음) · 디자인 B: 소프트 카드 */

:root {
  color-scheme: light;
  --bg: #f2f4f8;           /* 연한 회청색 바탕 */
  --surface: #ffffff;
  --text: #18202b;
  --muted: #5d6675;
  --line: #e3e7ee;
  --primary: #3454d1;      /* 차분한 남색 */
  --primary-ink: #ffffff;
  --tint: #eef1fc;         /* 강조색을 옅게 깐 바탕 */
  --tint-strong: #e8ecfb;
  --focus: #a9b8f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --sun: #d93f4c;          /* 일요일·공휴일 */
  --sat: #3454d1;          /* 토요일 */
  --holiday-bg: #fdebed;
  --sub: #b4570f;          /* 대체공휴일 */
  --sub-bg: #fff0e1;
  --leave: #0f7a5a;        /* 연차 */
  --leave-bg: #dff4ec;
  --range-bg: #fff7d6;     /* 선택한 연휴 기간 */
  --range-line: #dcae00;
  --radius: 18px;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.6 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--primary); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* 머리말 */
.site-header { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-height: 56px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0 -8px; }
.site-nav a { font-size: 0.95rem; text-decoration: none; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.site-nav a[aria-current="page"] { color: var(--primary); font-weight: 800; background: var(--tint-strong); }

.hero { padding: 36px 0 12px; }
.hero h1 { font-size: 1.75rem; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.03em; }
.hero .hero-example {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 8px 16px;
  border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.95rem; font-weight: 600; box-shadow: var(--shadow);
}
.hero-example b { font-size: 1.15rem; color: var(--primary); }
.hero p { margin: 0; color: var(--muted); }

h2 { font-size: 1.35rem; margin: 0 0 12px; }

.panel {
  background: var(--surface);
  border: 0;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 24px 18px;
  margin: 32px 0;
}

/* 연차 선택 */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 10px; padding: 0; }


.options { margin-top: 18px; display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 1rem; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }

/* 추천 카드 */
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; }
.result-note { color: var(--muted); font-size: 0.95rem; margin: 0 0 12px; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint-strong); }
/* 추천 결과의 1위 카드 강조 */
.cards-ranked > .card:first-child .card-days { font-size: 2rem; color: var(--primary); }
.cards-ranked > .card:first-child .rank { width: auto; padding: 0 10px; border-radius: 999px; font-size: 0.85rem; }
.cards-ranked > .card:first-child .rank::after { content: "위 · 추천"; margin-left: 1px; }

.card-main {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 18px; font: inherit; color: inherit; cursor: pointer;
}
.card-main:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rank {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.card-title { font-weight: 800; font-size: 1.15rem; }
.ratio { margin-left: auto; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.card-days { font-size: 1.6rem; font-weight: 800; color: var(--sun); line-height: 1.3; letter-spacing: -0.02em; }
.card-period { font-size: 1.05rem; }
.card-leave { margin-top: 6px; }
.chip {
  display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 999px;
  background: var(--leave-bg); color: var(--leave); font-weight: 700; font-size: 0.95rem;
}
.card-days, .card-period, .card-leave, .alts, .alts span { display: block; }
.alts { margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); font-size: 0.9rem; color: var(--muted); }

.card-actions { display: none; gap: 10px; padding: 0 18px 18px; flex-wrap: wrap; }
.card.is-selected .card-actions, .card-actions.is-open { display: flex; }
.card-actions.is-open { padding: 12px 0 0; }
.card-days small { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.card-meta { display: block; margin-top: 6px; font-size: 0.88rem; color: var(--muted); }
.chip-half { background: var(--tint); color: var(--primary); }
.alts-title { font-weight: 700; color: var(--text); }
.sub-title { font-size: 1.05rem; margin: 18px 0 10px; }
.plain { margin: 6px 0 0; padding-left: 1.2em; }
.btn-block { display: flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* 연차 입력: − [ 2 일 ] + */
.stepper { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 10px; max-width: 380px; }
.step-btn {
  min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface);
  font: 800 1.5rem/1 var(--font); color: var(--primary); cursor: pointer;
}
.step-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.stepper .unit-wrap .input { text-align: center; padding-right: 2.2em; padding-left: 2.2em; font-size: 1.3rem; }
.stepper .input::-webkit-outer-spin-button, .stepper .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .input { -moz-appearance: textfield; appearance: textfield; }

/* 계산 방식 4개 (휴대폰 2×2, 넓은 화면 4칸) */
.seg-4 { grid-template-columns: 1fr 1fr; }
.seg-item { display: contents; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-row .field { margin-bottom: 8px; }
select.input { appearance: auto; font-weight: 600; }

/* 연간 분배 플래너 */
.plan-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.plan-tab {
  min-height: 56px; padding: 8px 6px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  font: 600 0.88rem/1.3 var(--font); color: var(--text); cursor: pointer; display: grid; gap: 2px; justify-items: center; text-align: center;
}
.plan-tab .plan-tab-name { font-size: 1.05rem; font-weight: 800; }
.plan-tab.is-on { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.plan-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-summary { font-size: 1.1rem; margin: 0 0 10px; }
.plan-summary strong { color: var(--primary); }
.data-table.plan-table td, .data-table.plan-table th { white-space: normal; vertical-align: top; }
.plan-table td:first-child, .plan-table th:first-child { width: 2em; text-align: center; }
.plan-table td:last-child, .plan-table th:last-child { white-space: nowrap; font-weight: 800; text-align: right; }
.plan-table tfoot td { font-weight: 800; border-top: 2px solid var(--text); border-bottom: 0; }
.muted { color: var(--muted); font-size: 0.88rem; }
.more-links { margin: 10px 0 0; text-align: center; font-size: 0.95rem; }
.sub-table td:first-child { white-space: nowrap; }
.plan-leave { display: block; margin-top: 2px; color: var(--leave); font-size: 0.92rem; font-weight: 600; }

/* 링크 복사 */
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.share-row .btn { flex: 0 0 auto; min-width: 140px; }
.share-status { margin: 0; font-size: 0.92rem; color: var(--leave); font-weight: 600; flex: 1 1 200px; }
.share-fallback { margin-top: 8px; font-size: 0.9rem; font-weight: 500; }

/* 날짜 선택 모드 안내 막대 (달력 위에 붙어 있음) */
.pick-bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; margin: 0 -4px 14px; padding: 10px 12px;
  background: var(--tint); border: 2px solid var(--primary); border-radius: 12px;
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
}
.pick-bar p { margin: 0; font-weight: 700; flex: 1 1 220px; }
.pick-bar-actions { display: flex; gap: 8px; flex: 1 1 220px; }
.pick-bar-actions .btn { min-height: 44px; flex: 1 1 0; }

.btn {
  flex: 1 1 140px; min-height: 48px; padding: 10px 14px;
  border-radius: 12px; border: 2px solid var(--primary);
  background: var(--surface); color: var(--primary);
  font: 700 1rem/1.2 var(--font); cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.empty { color: var(--muted); }

/* 달력 */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 0.9rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch {
  min-width: 26px; height: 24px; padding: 0 4px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid transparent; font-size: 0.72rem; font-weight: 800;
}
.sw-sun { background: var(--holiday-bg); color: var(--sun); }
.sw-sat { background: var(--tint-strong); color: var(--sat); }
.sw-sub { background: var(--sub-bg); color: var(--sub); }
.sw-leave { background: var(--leave-bg); color: var(--leave); border-color: var(--leave); }
.sw-range { background: var(--range-bg); border: 2px dashed var(--range-line); }
.sw-pick { background: var(--tint); color: var(--primary); border: 3px solid var(--primary); }

.months { display: grid; grid-template-columns: 1fr; gap: 20px; }

.month { background: #f8f9fc; border: 0; border-radius: var(--radius); padding: 16px 14px; scroll-margin-top: 12px; }
.month h3 { margin: 0 0 12px; font-size: 1.2rem; }

.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--muted); padding: 2px 0; }
.dow.sun { color: var(--sun); }
.dow.sat { color: var(--sat); }

.day {
  min-height: 52px; border-radius: 8px; padding: 3px 2px;
  display: flex; flex-direction: column; align-items: center;
  font: 600 0.95rem/1.4 var(--font); color: var(--text); position: relative;
  border: 2px solid transparent; background: transparent; margin: 0; min-width: 0;
}
button.day { cursor: pointer; }
button.day:hover { border-color: var(--focus); }
button.day:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.months.is-pick .day:not(.blank) { background-color: #fafbfc; }
.day.blank { visibility: hidden; }
.day .lbl {
  font-size: 0.7rem; line-height: 1.15; font-weight: 600; text-align: center;
  max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.day.sat { color: var(--sat); }
.day.sun { color: var(--sun); }
.day.holiday { background: var(--holiday-bg); color: var(--sun); }
.day.substitute { background: var(--sub-bg); color: var(--sub); }
.day.sat-work { color: var(--text); }
/* 연속 휴일 기간: 색과 함께 굵은 점선 테두리로 구분 */
.day.in-range { border: 2px dashed var(--range-line); background-color: var(--range-bg); }
.day.holiday.in-range { background-color: var(--holiday-bg); }
.day.substitute.in-range { background-color: var(--sub-bg); }
/* 연차·반차: 실선 테두리 + "연차"/"반차" 글자 */
.day.leave, .day.half { background: var(--leave-bg); color: var(--leave); border: 2px solid var(--leave); }
.day.half { background: linear-gradient(135deg, var(--leave-bg) 50%, var(--surface) 50%); }
/* 내가 고른 날: 굵은 파란 테두리 + ✓ */
.day.picked { border: 3px solid var(--primary); }
.day .dn { white-space: nowrap; }
.day.picked::before { content: "✓"; position: absolute; top: -2px; left: 2px; font-size: 0.68rem; font-weight: 800; color: var(--primary); }

.month-list { list-style: none; margin: 14px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.month-list li { padding: 1px 0; }
.month-list .d { font-weight: 700; display: inline-block; min-width: 4.6em; }
.month-list .sub { color: var(--sub); }
.month-list .none { color: var(--muted); }

/* 연휴 안내 링크 */
.guide-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.guide-links a {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; font-weight: 700; background: var(--surface);
}
.guide-links span { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

/* 연휴별 페이지 본문 */
.article h2 { margin-top: 24px; }
.article .panel > h2:first-child { margin-top: 0; }
.article table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.article th, .article td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.article th { background: #f0f3f7; }
.cta {
  display: block; text-align: center; margin: 20px 0 4px; padding: 16px;
  border-radius: 12px; background: var(--primary); color: #fff; font-weight: 800; text-decoration: none;
}

/* 입력 양식 (연차 일수·연차수당 계산기) */
.field { display: grid; gap: 8px; margin-bottom: 24px; }
.field > label, .field > .label { font-weight: 700; }
.field .hint { font-size: 0.9rem; color: var(--muted); }
p.hint { font-size: 0.9rem; color: var(--muted); margin: 0 0 20px; }
.input {
  width: 100%; min-height: 52px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px;
  font: 600 1.1rem/1.3 var(--font); color: var(--text); background: var(--surface);
}
.input:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--primary); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }
.unit-wrap { position: relative; }
.unit-wrap .input { padding-right: 3em; text-align: right; font-variant-numeric: tabular-nums; }
.unit-wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 6px 10px;
  border: 2px solid var(--line); border-radius: 12px; font-weight: 700; cursor: pointer; background: var(--surface);
}
.seg input:checked + label { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
details.more { margin-top: 4px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--primary); min-height: 44px; display: flex; align-items: center; }

.notice {
  border-radius: 12px; padding: 12px 14px; background: #fff7e0; color: #5c4400;
  border: 1px solid #f0d58a; font-size: 0.95rem; margin: 12px 0 0;
}
.error { color: var(--sun); font-weight: 700; margin: 0; }

.big-result { margin: 0 0 4px; font-size: 1rem; color: var(--muted); font-weight: 700; }
.big-number { margin: 0; font-size: 2.6rem; font-weight: 800; color: var(--primary); line-height: 1.15; font-variant-numeric: tabular-nums; }
.big-number small { font-size: 1.2rem; }
.facts { display: grid; gap: 0; margin: 14px 0 0; }
.facts > div { display: grid; grid-template-columns: 5em 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; min-width: 0; font-variant-numeric: tabular-nums; }

.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.steps li { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 52px; position: relative; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.steps .step-label { font-weight: 800; display: block; }
.steps .step-formula { color: var(--muted); display: block; font-size: 0.95rem; }
.steps .step-value { font-weight: 800; font-size: 1.15rem; display: block; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-size: 0.85rem; }
.data-table tr.is-now td { background: var(--tint-strong); font-weight: 800; }
.data-table tr.is-past td { color: var(--muted); }

.rules { padding-left: 1.2em; margin: 0; }
.rules li { margin: 6px 0; }
.law { font-size: 0.88rem; color: var(--muted); }

.tool-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tool-links a {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; font-weight: 700; background: var(--surface);
}
.tool-links span { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

/* 꼬리말 */
.data-info { font-size: 0.82rem; line-height: 1.55; margin: 0 0 8px; }
.site-footer .data-info p { margin: 0 0 2px; }
.data-info a { color: inherit; }
.site-footer { margin-top: 32px; padding: 24px 0 40px; background: #e9edf3; color: var(--muted); font-size: 0.92rem; }
.site-footer p { margin: 0 0 8px; }
.site-footer .privacy-note { color: var(--text); font-weight: 700; }

/* 이미지 미리보기 창 */
dialog { border: 0; border-radius: var(--radius); padding: 16px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); display: block; }
dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
dialog p { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 태블릿 이상 */
@media (min-width: 640px) {
  .hero h1 { font-size: 2.1rem; }
  .panel { padding: 28px; }
  .guide-links, .tool-links { grid-template-columns: repeat(2, 1fr); }
  .seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day .lbl { font-size: 0.72rem; }
}

/* 넓은 화면에서도 조건 → 결과 → 달력 순서로 위에서 아래로 쌓습니다.
   달력만 한 줄에 두 달씩, 넉넉한 간격으로 놓습니다. */
@media (min-width: 900px) {
  .months { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
  .month { padding: 20px; }
  .day { min-height: 56px; }
}

@media (min-width: 900px) {
  .tool-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: start; margin: 32px 0; }
  .tool-layout > .panel { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
