/* 생성물 — 손으로 고치지 마라. 역할별 소스를 아래 순서로 이어붙인 것이다(싣는 순서 = 우선순위). */

/* ══ styles/calendar.css ══ */
/* JP 달력(/calendar-2026/ja · /calendar-2027/ja · /calendar/ja) — 격자·월 확대·메모·인쇄 시트.
 *
 * 화면 값은 tokens.css 의 이름으로만 받는다. **인쇄 시트(.print-sheet·.ps-*)만 물리 단위(mm·pt)를 쓴다** —
 * A4 실치수로 재서 넘침을 판정하는 자리라 화면 스케일 축이 아니다(tokens.css §2 주석).
 *
 * 인쇄(설계 §4·정본 P7): A4 가로 1장. 화면에서는 인쇄 시트(#print-sheet)를 화면 밖에 mm 단위 고정 크기로 놓아
 * 두고 JS가 넘침을 잰다 — 넘치면 인쇄를 호출하지 않고 월간을 권한다. 인쇄 시에는 시트만 남긴다(body.has-sheet).
 */

/* ── 연간 격자 ── */
.cal-year { display: grid; gap: var(--gap-block); grid-template-columns: 1fr; }
/* 브레이크포인트는 층 1 의 두 값(--bp-sm 560 · --bp-md 860)만 쓴다 — @media 는 var() 를 못 읽으므로 값을 그대로 적는다. */
@media (min-width: 560px) { .cal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 860px) { .cal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cal-month { background: var(--surface); padding: var(--s2); min-width: 0; }
.cal-month h3 { font-size: var(--t3); line-height: var(--gap-line); font-weight: 700; margin-bottom: var(--gap-item); }
.cal-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.cal-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cal-table th { font-size: var(--t1); line-height: var(--gap-line); font-weight: 600; color: var(--ink-2); padding: var(--s1) 0; border: 0; text-align: center; }
.cal-table td { text-align: center; vertical-align: top; padding: 0; border: 0; font-size: var(--t2); line-height: var(--gap-line); }
.cal-day .cal-d { font-weight: 600; }
/* 일요일·공휴일·토요일은 색만으로 구분하지 않는다 — 셀 표식(.cal-mk)과 공휴일 이름 줄이 글자로 함께 읽힌다. */
.cal-sun .cal-d, .cal-hol .cal-d { color: var(--bad); }
.cal-sat .cal-d { color: var(--accent); }
.cal-off { background: var(--bg); }
.cal-mk {
  display: inline-block; font-size: var(--t1); line-height: var(--gap-line);
  margin-left: var(--s1); padding-inline: var(--s1);
  border: calc(var(--s1) / 4) solid var(--line); color: var(--ink-2);
}
.cal-btn {
  display: block; width: 100%; min-height: var(--touch); padding: var(--s1) 0;
  font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer;
  box-shadow: none;   /* 날짜 칸은 버튼 돌출 밖 */
}
.cal-btn:hover { background: var(--bg); }
.cal-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.cal-btn[aria-pressed="true"] .cal-d { color: var(--accent-ink); }
.cal-year .cal-table td { height: var(--touch); }
.cal-mh { margin-top: var(--gap-item); font-size: var(--t1); line-height: var(--gap-line); color: var(--ink-2); overflow-wrap: break-word; }
.cal-mh b { color: var(--ink); font-weight: 600; margin-right: var(--s1); }
.cal-mh span { display: inline-block; margin-right: var(--s2); }
.cal-legend h3 { font-size: var(--t1); line-height: var(--gap-line); font-weight: 700; color: var(--ink-2); }
.cal-legend p { font-size: var(--t1); line-height: var(--gap-line); color: var(--ink-2); }
.cal-source { font-size: var(--t2); line-height: var(--gap-line); color: var(--ink-2); overflow-wrap: break-word; }
.cal-source a { color: var(--ink-2); }
.cal-controls { display: grid; gap: var(--gap-block); }
/* 인쇄 안내(W08) — 주 산출 아래 접힘. 열면 버튼과 안내 문단이 한 묶음으로 보인다. */
.printrow > :not(summary) { margin-top: var(--gap-item); }
.printrow > summary > h2 { font-size: var(--t3); line-height: var(--gap-line); }
.cal-count { font-size: var(--t2); line-height: var(--gap-line); color: var(--ink-2); }
.cal-hlist td { white-space: normal; text-align: left; }
.cal-hlist td:first-child, .cal-hlist td:nth-child(2) { white-space: nowrap; }

/* ── 월 확대 패널(W08: 선택기 바로 뒤 주 산출) ── */
.cal-panelhead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--gap-item); margin-bottom: var(--gap-item); }
.cal-big .cal-month { padding: var(--s4); }
.cal-big .cal-table td { height: calc(var(--touch) + var(--s4)); }
.cal-big .cal-btn { min-height: calc(var(--touch) + var(--s4)); }
.cal-big .cal-table td, .cal-big .cal-btn { font-size: var(--t3); line-height: var(--gap-line); }
.cal-big .cal-mh { font-size: var(--t2); line-height: var(--gap-line); }

/* ── 메모 편집 ── */
#memo { display: grid; gap: var(--gap-item); }
#memo-date { font-size: var(--t4); line-height: var(--t5-lh); font-weight: 600; }
.cal-holname { font-size: var(--t2); line-height: var(--gap-line); font-weight: 600; color: var(--bad); }

/* ── 확인 대화상자(삭제·미저장 이탈) ── */
.cal-dialog {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  padding: var(--s4);
}
.cal-dialogbox {
  background: var(--surface); color: var(--ink);
  border: calc(var(--s1) / 4) solid var(--line); border-radius: var(--r1);
  box-shadow: var(--shadow-2);
  padding: var(--s5); width: 100%; max-width: calc(var(--s6) * 14);
  display: grid; gap: var(--gap-block);
}
.cal-dialogbox h2 { font-size: var(--t4); line-height: var(--t5-lh); }
.cal-dialogbox p { font-size: var(--t2); line-height: var(--gap-line); color: var(--ink-2); }

/* ── 인쇄 시트(A4 가로 297×210mm, 여백 8mm → 281×194mm) — 화면에서는 밖에 두고 크기만 잰다 ── */
/* gap-exempt: 인쇄 시트 — A4 실치수(mm·pt) 축, 화면 스케일 밖 */
.print-sheet { position: absolute; left: -400vw; top: 0; width: 281mm; height: 194mm; overflow: hidden;
  background: #fff; color: #000; font-family: var(--sk-font-ja); font-size: 8pt; line-height: 1.25; }
.print-sheet:empty { display: none; }
/* gap-exempt: 인쇄 시트 */
.ps-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2mm 6mm; margin: 0 0 2mm; }
.ps-head h2 { font-size: 14pt; font-weight: 700; margin: 0; }
.ps-ws { font-size: 9pt; }
.ps-exp { font-size: 9pt; font-weight: 700; }
.print-sheet .cal-month { background: none; border: 0; border-radius: 0; padding: 0; }
.print-sheet .cal-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.print-sheet .cal-table td { border: 0.2mm solid #888; }
.print-sheet .cal-day .cal-d { color: #000; }
.print-sheet .cal-sun .cal-d, .print-sheet .cal-hol .cal-d { font-weight: 700; text-decoration: underline; }
.print-sheet .cal-off { background: #e6e6e6; }
.print-sheet .cal-mk { border-color: #000; color: #000; }
.print-sheet .cal-mt { display: block; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
/* gap-exempt: 인쇄 시트 */
.ps-annual { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2mm 3mm; }
/* gap-exempt: 인쇄 시트 */
.ps-annual .cal-month h3 { font-size: 9pt; margin: 0 0 0.8mm; }
.ps-annual .cal-table th { font-size: 6.5pt; padding: 0; }
.ps-annual .cal-table td { height: 6.4mm; font-size: 7pt; }
.ps-annual .cal-mk { font-size: 5.5pt; padding: 0.2mm 0.4mm; }
.ps-annual .cal-mt { font-size: 5.5pt; padding: 0 0.4mm; }
/* gap-exempt: 인쇄 시트 */
.ps-annual .cal-mh { font-size: 6.5pt; margin: 0.8mm 0 0; color: #000; }
.ps-annual .cal-mh b { color: #000; }
/* gap-exempt: 인쇄 시트 */
.ps-monthly .cal-month h3 { font-size: 12pt; margin: 0 0 1.5mm; }
.ps-monthly .cal-table th { font-size: 9pt; }
.ps-monthly .cal-table td { height: 25mm; font-size: 11pt; text-align: left; vertical-align: top; padding: 1mm; }
.ps-monthly .cal-mk { font-size: 8pt; }
/* gap-exempt: 인쇄 시트 */
.ps-monthly .cal-mt { font-size: 9pt; margin-top: 1mm; }
/* gap-exempt: 인쇄 시트 */
.ps-monthly .cal-mh { font-size: 9pt; margin: 2mm 0 0; color: #000; }
.ps-monthly .cal-mh b { color: #000; }
/* gap-exempt: 인쇄 시트 */
.ps-legend, .ps-src { font-size: 7.5pt; margin: 2mm 0 0; color: #000; }

@page { size: A4 landscape; margin: 8mm; }
@media print {
  html, body { background: #fff; color: #000; }
  /* 시트가 있으면 시트만. 머리·꼬리는 본문 밖이라 따로 뺀다. */
  body.has-sheet .site-header, body.has-sheet .site-footer { display: none !important; }
  body.has-sheet main.wrap > :not(.print-sheet) { display: none !important; }
  body.has-sheet main.wrap { max-width: none; margin: 0; padding: 0; }
  body.has-sheet .print-sheet { position: static; left: auto; width: auto; height: auto; overflow: visible; }
  /* 시트가 없으면(JS·데이터 없음) 정적 페이지 그대로 — 조작·대화상자는 뺀다. */
  .skip, .cal-controls, .printrow, #memo, #copyrow, .cal-panelhead button, .cal-dialog, .site-header nav { display: none !important; }
  /* 접어 둔 범례는 종이에서는 펼쳐 찍는다 — 접힘은 화면에서 첫 화면을 비우려는 장치지 내용 삭제가 아니다. */
  details.cal-legend > summary { list-style: none; }
  details.cal-legend > :not(summary) { display: block !important; }
  .cal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal-month { break-inside: avoid; }
}

/* ══ styles/pages.css ══ */
/* 면 한정 규칙 — 마지막에 싣는다.
 *
 * 규칙 하나하나는 `:where(.p-면이름)` 로 그 면에만 걸어 둔다. :where() 는 특정도를 0으로 세므로
 * 컴포넌트 규칙과 우선순위 다툼을 만들지 않는다. 면 이름 클래스는 <html> 에 붙는다.
 *
 * 층②a 에서 이 파일은 크게 줄었다 — 예전에 여기 있던 것 대부분(테두리 없는 fieldset·묶음 구분선·라벨 크기·
 * 관련 도구 목록·시·분·초 입력 묶음·요일 줄·결과 수 한 단계 작게 등)이 컴포넌트의 **기본값**이 되었다.
 * 값은 tokens.css 의 이름으로만 받는다.
 */

/* ── 퍼센트 계산기 — 수치 입력은 오른쪽 정렬(확정 화면) ──
 * 이 면의 입력은 `type="text"`(부호·`%` 접미까지 원문으로 받으려고)라 inputmode 로 잡히는 공통 규칙을 비껴간다.
 * 자릿수가 오른쪽에서 맞아야 소수점이 흔들리지 않는다 — 확정 문서의 수치 표기 규칙과 같은 축이다. */
:where(.p-percentage-calculator-ko, .p-percentage-calculator-en) .card input[type="text"] { text-align: right; }

/* ── cm↔Mm — 과학표기 예시의 줄바꿈을 원문 그대로 유지한다 ── */
:where(.p-centimeters-to-megameters-en) .example p { white-space: pre-line; }

/* ── 수능 디데이 — 결과 묶음 아래 출처 상자 ── */
:where(.p-suneung-dday-ko) .srcbox { display: grid; gap: var(--gap-item); }
:where(.p-suneung-dday-ko) .srcbox .note { overflow-wrap: break-word; }

/* ── 일본 달력 허브 — 연도 카드 제목은 도구 카드 제목보다 한 단계 작다(카드가 연도 두 장뿐) ── */
:where(.p-calendar-ja, .p-dallyeok-ko) .tool h3 { font-size: var(--t3); line-height: var(--gap-line); font-weight: 700; color: var(--ink); }   /* sym3-ko: 한국어 달력 허브(/dallyeok/ko)도 같은 규칙 */


/* ── 날짜 계산기 — 수직 간격 4단 귀속 블록은 2026-09-17 전 면 공용화로 **철거**했다.
 * 같은 역할·같은 값이 base·templates·components 의 기본값이 됐고(수직 밀도 검사가 번들 전체를 본다),
 * naljja 만의 규칙(.togs 세로 중앙·FAQ 첫 문답 0·details 문단 항목 간)도 컴포넌트 기본값으로 올라갔다. 면 한정 사본을 여기 다시 두지 않는다. */
