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

/* ══ 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/nenrei.css ══ */
/* 西暦・和暦・年齢早見表(/nenrei-hayami/ja) — 표·검색 강조·출력 구간·인쇄. calendar.css 위에 얹는다.
 *
 * 화면 값은 tokens.css 의 이름으로만 받는다. **인쇄 시트(.print-sheet·.ps-*)만 물리 단위(mm·pt)** —
 * 용지는 A4 세로·여러 쪽(달력의 가로 1장·고정 치수·넘침 측정은 쓰지 않는다).
 * 표 행은 쪽 경계에서 나뉘지 않고, 기준연도 캡션과 4열 헤더는 thead라서 쪽마다 반복된다.
 */

/* ── 표 ── */
.nn-base { font-size: var(--t3); line-height: var(--gap-line); font-weight: 600; color: var(--ink); }
.nn-range { font-size: var(--t2); line-height: var(--gap-line); color: var(--ink-2); }
.nn-table th, .nn-table td { white-space: nowrap; }
/* 표의 최소 내용 폭이 스크롤 상자 밖(main 의 grid 트랙)으로 새지 않게 한다 — 영어판(sym3-en)은 4열 nowrap 머리(Before birthday / On/after birthday)와
   로마자+원문 연호 셀이 390 폭을 넘어, 상자가 스크롤하는 대신 면 전체가 옆으로 늘어났다(main 434px). 폭 격리(CSS Containment L2)로 상자 안에서만 스크롤한다. */
.table-scroll { contain: inline-size; }
.nn-table th[scope="row"] { color: var(--ink); }
/* 西暦·和暦 열은 글자라 왼쪽 정렬(머리글도 같이) */
.nn-table td:nth-child(2), .nn-table thead th:nth-child(1), .nn-table thead th:nth-child(2) { text-align: left; }
.nn-era { display: block; white-space: nowrap; font-size: var(--t2); line-height: var(--gap-line); }
/* 검색 일치행 — 배경 + 글자 표식(색만으로 구분하지 않는다) */
.nn-table tr.nn-hit th, .nn-table tr.nn-hit td { background: var(--bg); }
.nn-mark {
  display: inline-block; margin-left: var(--s2); padding-inline: var(--s1);
  font-size: var(--t1); line-height: var(--gap-line); font-weight: 600;
  color: var(--accent); border: calc(var(--s1) / 4) solid var(--accent);
}
.nn-notes { display: grid; gap: var(--gap-item); }
.nn-notes p { font-size: var(--t2); line-height: var(--gap-line); color: var(--ink-2); }
.nn-sources { display: grid; gap: var(--gap-item); font-size: var(--t2); line-height: var(--gap-line); }

/* ── 조작 — 검색·기준연도는 표 스크롤 밖(W09 자리) ── */
.nn-controls { display: grid; gap: var(--gap-block); }
#nn-search-error { color: var(--bad); }
#nn-output { display: grid; gap: var(--gap-block); }
/* 검색 결과(G3-08) — 표로 점프하는 대신 검색창 바로 아래에서 열 제목째 읽는다. 한 행 복사도 이 자리에서.
   표와 같은 마크업이라 열 정렬·두 줄 和暦 규칙이 그대로 적용된다. */
.nn-result { display: grid; gap: var(--gap-block); }
.nn-result .nn-table { width: 100%; }
.nn-result .nn-table:empty { display: none; }

/* 인쇄 때만 보이는 경고(정본 데이터를 확인하지 못한 채 브라우저 자체 인쇄) */
.print-only { display: none; }

/* ── 인쇄 시트(A4 세로·여러 쪽) — 화면에서는 밖에 두고 높이 0으로 잘라 둔다 ── */
/* gap-exempt: 인쇄 시트 — A4 실치수(mm·pt) 축, 화면 스케일 밖 */
.print-sheet { width: 186mm; height: 0; overflow: hidden; font-size: 10pt; line-height: 1.4; }
.print-sheet .nn-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.print-sheet .nn-table th, .print-sheet .nn-table td { border: 0.2mm solid #888; padding: 1mm 2mm; text-align: right; white-space: nowrap; }
.print-sheet .nn-table th { font-weight: 600; }
.print-sheet .nn-table th[scope="row"], .print-sheet .nn-table td:nth-child(2), .print-sheet .nn-table thead th:nth-child(1), .print-sheet .nn-table thead th:nth-child(2) { text-align: left; }
.print-sheet .nn-table .ps-cap { text-align: left; font-weight: 700; border: 0; padding: 0 0 1.5mm; }
.print-sheet .nn-table thead { display: table-header-group; }
.print-sheet .nn-table tr { break-inside: avoid; page-break-inside: avoid; }
.print-sheet .nn-era { display: block; }
/* gap-exempt: 인쇄 시트 */
.ps-warn { font-size: 10pt; font-weight: 700; margin: 0 0 2mm; color: #000; }
/* gap-exempt: 인쇄 시트 */
.ps-rules, .ps-src { font-size: 8.5pt; margin: 3mm 0 0; color: #000; }
/* 출력 각주의 출처 링크 — 종이에서도 원문 위치가 읽히도록 URL 문자열을 라벨 옆에 함께 찍는다 */
/* gap-exempt: 인쇄 시트 */
.ps-links { margin: 1.5mm 0 0; padding-left: 5mm; font-size: 8.5pt; color: #000; }
/* gap-exempt: 인쇄 시트 */
.ps-links li { margin: 0.5mm 0; }
.ps-links a { color: #000; text-decoration: none; }
.ps-url { overflow-wrap: anywhere; }

@page { size: A4 portrait; margin: 12mm; }
@media print {
  /* 정적 페이지 그대로 인쇄될 때(JS·데이터 없음): 조작·규칙·FAQ·privacy·머리·꼬리는 뺀다. 표·안내·출처는 남는다. */
  .nn-controls, #nn-output, #nn-rules, .faq, #privacy, #privacy-on-this-page, .site-header, .site-footer, #nn-data-notice { display: none !important; }   /* sym3-en: en 프라이버시 절 id */
  /* 화면의 표 높이 상한·스크롤은 종이에서 뜻이 없다 — 풀어 주지 않으면 111행이 한 화면 높이에서 잘린다. */
  .table-scroll { max-height: none; overflow: visible; }
  .print-only { display: block; }
  .nn-table thead { display: table-header-group; }
  .nn-table tr { break-inside: avoid; page-break-inside: avoid; }
  .nn-table tr.nn-hit th, .nn-table tr.nn-hit td { background: none; }
  .nn-mark { display: none; }
}

/* ══ 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 문단 항목 간)도 컴포넌트 기본값으로 올라갔다. 면 한정 사본을 여기 다시 두지 않는다. */
