@font-face {
  font-family: "LXGW WenKai KR";
  src: url("./assets/fonts/LXGWWenKaiKR-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #fff;
  --ink: #25342f;
  --muted: #646f69;
  --accent: #285447;
  --accent-hover: #193e33;
  --accent-soft: #eaf0eb;
  --line: #dfe4dd;
  --warm: #a57045;
  --radius: 18px;
  --shadow: 0 4px 24px rgb(29 52 40 / 4%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-synthesis: none;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
a { color: var(--accent); text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
img { max-width: 100%; height: auto; }
svg { vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a57045; outline-offset: 4px; }
::selection { background: #dce9da; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.4; word-break: keep-all; }
h1 { margin-bottom: .65rem; font-size: clamp(1.65rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
.skip-link { position: fixed; top: 10px; left: 16px; z-index: 100; padding: .75rem 1rem; border-radius: 8px; background: var(--ink); color: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.site-header { min-height: 104px; max-width: 1360px; margin: auto; padding: 24px 48px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; flex-shrink: 0; }
.brand-seal { display: grid; place-items: center; width: 44px; height: 48px; border: 1px solid var(--accent); border-radius: 12px 12px 4px 4px; font-family: "LXGW WenKai KR", serif; font-size: 30px; }
.brand-name { display: grid; gap: 2px; line-height: 1.2; white-space: nowrap; }
.brand-name small { color: var(--muted); font-size: .82rem; }
.brand-name strong { font-size: 1.5rem; letter-spacing: -.035em; }
.header-note { margin: 0; color: var(--muted); font-size: .82rem; }
.header-action { margin-left: auto; display: inline-flex; align-items: center; gap: 18px; padding: 9px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; font-size: .86rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.header-action:hover { background: var(--accent-soft); border-color: var(--accent); }
.site-layout { max-width: 1360px; padding: 40px 48px 0; margin: auto; display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 48px; align-items: start; }
.site-sidebar { position: sticky; top: 28px; }
.nav-heading { margin: 0 12px 18px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .1em; }
.site-nav { display: grid; gap: 5px; }
.site-nav a { display: flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: .9rem; transition: background-color .15s, color .15s; }
.site-nav a:hover { color: var(--accent); background: #eff1eb; }
.site-nav a[aria-current="page"], .site-nav a.active, .site-nav a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.site-nav a[aria-current="page"]::after, .site-nav a.active::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: auto; }
.sidebar-note { margin: 32px 12px 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: .73rem; line-height: 1.9; color: var(--muted); }
.page-column { min-width: 0; }
#page-root { min-height: 62vh; scroll-margin-top: 24px; }
#page-root:focus { outline: none; }
.page { min-width: 0; }
.page-header { margin-bottom: 28px; }
.page-header p { max-width: 64ch; color: var(--muted); font-size: .94rem; }
.eyebrow { margin-bottom: 10px; font-size: .73rem; letter-spacing: .1em; font-weight: 700; color: var(--warm); }
.card { min-width: 0; padding: clamp(20px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card-grid > .card { margin-top: 0; }
.card h2 { margin-bottom: 18px; }
.card a:not(.btn) { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
small.muted, .hint, .field-hint { font-size: .8rem; color: var(--muted); }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; line-height: 1.5; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:hover { background: #f2f4ef; border-color: #afbbb1; }
.btn-primary { color: white; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { color: white; background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); border-color: #d6e1d7; }
.btn-secondary:hover { background: #dce7df; }
.print-actions, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.preview-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.field-label { display: block; margin-bottom: 8px; }
.checkbox-field { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.checkbox-field input { flex-shrink: 0; margin: 0; }
form { margin: 0; }
fieldset { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
legend { margin-bottom: 14px; padding: 0; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin-bottom: 18px; }
.field > label, label.field, .field-label { font-size: .86rem; font-weight: 600; }
.field :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea), .select, input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]), textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #c9d2ca; border-radius: 8px; background: white; color: var(--ink); font-size: 1rem; font-weight: 400; line-height: 1.5; }
select { max-width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
input:disabled, select:disabled, textarea:disabled { background: #f0f2ed; color: var(--muted); }
input::placeholder, textarea::placeholder { color: #737d76; }
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.status { padding: 14px 18px; margin-block: 18px; border: 1px solid #dce4d9; border-radius: 10px; background: #f0f4ed; color: #395344; font-size: .9rem; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status[role="alert"], .status.error { background: #fff3ef; border-color: #ebc9bc; color: #8a392b; }
.preview-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.preview-grid > * { min-width: 0; margin-top: 0; }
.preview-panel { min-width: 0; padding: 24px; background: #efeee8; border: 1px solid var(--line); border-radius: var(--radius); }
.output-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 22px; align-items: start; }
.output-preview-item { min-width: 0; margin: 0; }
.output-preview-label { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-bottom: 10px; font-size: .88rem; font-weight: 600; cursor: pointer; }
.output-preview-label input { flex: 0 0 auto; margin: 0; }
.output-page-preview { box-sizing: border-box; container-type: inline-size; position: relative; display: flex; align-items: center; justify-content: center; width: 100%; max-width: 360px; aspect-ratio: 210 / 297; margin-inline: auto; overflow: hidden; border: 1px solid #dedbd1; border-radius: 4px; background: #fff; box-shadow: 0 8px 24px rgb(32 45 36 / 12%); color: #171717; }
.output-page-preview--ceremony .ceremony-lines { box-sizing: border-box; position: absolute; top: 8.08%; left: 50%; transform: translateX(-50%); writing-mode: vertical-rl; list-style: none; width: max-content; max-width: none; height: 85.86%; margin: 0; padding: 0; color: #171717; font: 4.87cqw/1.1 'Sontribe WenKai', serif; }
.output-page-preview--ceremony .ceremony-lines.is-great-grandchild { top: 8.08%; height: 85.86%; font-size: 4.37cqw; }
.output-page-preview--ceremony .ceremony-lines.is-grandchild { top: 9.43%; height: 83.16%; }
.output-page-preview--ceremony .ceremony-lines li:not(:last-child) { margin-left: 7.14cqw; }
.output-page-preview--ceremony .ceremony-lines.is-five-lines li:not(:last-child) { margin-left: 12.86cqw; }
.output-page-preview--ceremony .hanja-token { display: inline-block; position: relative; inline-size: 1em; block-size: 1em; line-height: 1; text-align: center; }
.output-page-preview--ceremony .hanja-reading { position: absolute; top: 50%; right: calc(100% + .08em); transform: translateY(-50%); writing-mode: horizontal-tb; white-space: nowrap; font-size: .4em; line-height: 1; color: #777; }
.output-page-preview--ceremony .ceremony-lines.without-reading .hanja-reading { visibility: hidden; }
.output-page-preview--jibang .jibang-tablet { width: 28.57%; max-width: none; margin: 0; }
.prose { font-size: .96rem; line-height: 1.95; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 32px; }
.prose ul, .prose ol { padding-left: 1.5em; margin-block: 0 24px; }
.prose li { padding-left: .3em; margin-bottom: .75em; }
.prose li > ul, .prose li > ol { margin-top: .65em; margin-bottom: .6em; }
.prose li::marker { color: var(--accent); font-weight: 600; }
.prose ol.steps { padding-left: 1.8em; }
.prose ol.steps > li { padding: 0 0 20px 8px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.prose ol.steps > li:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.reference-figure { margin: 0; }
.reference-figure img { display: block; width: auto; max-width: 100%; height: auto; margin-inline: auto; border-radius: 4px; }
.reference-figure a { display: block; }
.reference-caption { margin-top: 14px; color: var(--muted); font-size: .8rem; text-align: center; }
.prose .reference-figure { margin-top: 24px; }
.schedule-list { list-style: none; margin: 0; padding: 0; }
.schedule-list li { display: flex; align-items: baseline; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.schedule-list li:last-child { border: 0; }
.schedule-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .82rem; }
.ceremony-info-table { min-width: 930px; }
.ceremony-info-table caption { padding: 0 0 14px; color: var(--muted); font-size: .84rem; text-align: left; }
.ceremony-info-table thead th { background: #f3f5f0; white-space: nowrap; text-align: center; }
.ceremony-info-table th, .ceremony-info-table td { padding: 10px 8px; }
.ceremony-info-table td { vertical-align: middle; }
.ceremony-info-table tbody + tbody tr:first-child > * { border-top: 2px solid var(--line); }
.ceremony-info-table .family-group { background: var(--accent-soft); color: var(--accent); text-align: center; vertical-align: middle; }
.ceremony-info-table .priest-cell { white-space: nowrap; }
.ceremony-info-table .hanja-cell { font-family: "LXGW WenKai KR", serif; white-space: nowrap; }
.ceremony-info-table .solar-date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ceremony-info-table .descendant-start-cell, .ceremony-info-table thead th:nth-child(5) { border-left: 2px solid var(--line); }
.ceremony-info-table .output-start-cell, .ceremony-info-table thead th:nth-child(6) { border-left: 2px solid var(--line); }
.ceremony-info-table .output-action-cell { text-align: center; }
.ceremony-info-table .output-action-cell .btn { margin-inline: auto; }
.ceremony-info-table tr.is-current-month > .solar-range-cell { background: #fff1d9; }
.ceremony-info-table tbody.has-current-month .family-group { background: #fff1d9; color: #825422; }
.ceremony-info-table tr.is-current-month .solar-date-cell { color: #825422; font-weight: 700; }
.ceremony-info-table .jibang-action-cell { min-width: 126px; }
.ceremony-info-table .prayer-action-cell { min-width: 82px; white-space: nowrap; }
.prayer-action-cell .btn { min-height: 36px; padding: 5px 6px; font-size: .76rem; }
.jibang-table-actions { display: grid; gap: 6px; }
.jibang-table-actions .btn { width: 100%; min-height: 36px; padding: 5px 7px; font-size: .78rem; white-space: nowrap; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 48px; padding: 22px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }

@media (min-width: 1500px) {
  .site-header, .site-layout { max-width: 1440px; }
  .site-layout { gap: 64px; }
}
@media (max-width: 1100px) {
  .site-header { padding-inline: 28px; }
  .site-layout { padding-inline: 28px; grid-template-columns: 160px minmax(0, 1fr); gap: 28px; }
  .preview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .site-header { min-height: 84px; padding: 18px 20px; gap: 16px; }
  .brand-seal { width: 36px; height: 40px; font-size: 26px; }
  .brand-name { gap: 1px; }
  .brand-name strong { font-size: 1.3rem; }
  .brand-name small { font-size: .76rem; }
  .header-note { display: none; }
  .header-action { font-size: .8rem; padding-inline: 10px; gap: 8px; }
  .site-layout { display: block; padding: 0 20px; }
  .site-sidebar { position: static; margin-inline: -20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-heading, .sidebar-note { display: none; }
  .site-nav { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px 20px 8px; scrollbar-width: thin; scrollbar-color: #bac7bd transparent; }
  .site-nav a { white-space: nowrap; flex-shrink: 0; min-height: 42px; padding: 9px 13px; font-size: .83rem; }
  .site-nav a[aria-current="page"]::after, .site-nav a.active::after { display: none; }
  .page-column { padding-top: 28px; }
  .page-header { margin-bottom: 22px; }
  .card-grid { grid-template-columns: 1fr; gap: 16px; }
  .card { border-radius: 14px; }
  .card + .card { margin-top: 16px; }
  .card-grid > .card { margin-top: 0; }
  .preview-panel { padding: 16px; }
  .site-footer { margin-top: 32px; }
}
@media (max-width: 420px) {
  .site-header { padding-inline: 16px; }
  .brand { gap: 9px; }
  .site-layout { padding-inline: 16px; }
  .site-sidebar { margin-inline: -16px; }
  .site-nav { padding-inline: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .print-actions .btn { flex-grow: 1; }
  .schedule-list li { gap: 12px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
