/* 도장 공방 — 웹앱 스타일 라이브러리 W03 Page(에디토리얼): 종이·잉크·한 가지 포인트, 명조 제목, 구분선 */
[data-web-style="W03"] {
  --primary: #A2452A;
  --primaryHover: #813720;
  --onPrimary: #FFFFFF;
  --bg: #F5EFE5;
  --surface: #FFFCF7;
  --ink: #242723;
  --muted: #625D55;
  --line: #D4CABC;
  --strongLine: #887D70;
  --soft: #EEDDD2;
  --secondary: #E3D6BF;
  --error: #A3262A;
  --radius: 0px;
  --space: 32px;
  --touch: 48px;
  --font-heading: "DGB Hahmlet", "Hahmlet", "AppleMyungjo", serif;
  --font-body: "DGB Plex", "IBM Plex Sans KR", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-number: "DGB Mono", "IBM Plex Mono", ui-monospace, monospace;
  --gutter: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; transition: color 150ms, text-decoration-color 150ms; }
a:hover { color: var(--primary); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
img, svg { display: block; }

.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--surface); padding: 10px 16px; z-index: 10; }
.skip:focus { top: 12px; }

/* ── 머리 ─────────────────────────── */
.site { border-bottom: 1px solid var(--line); }
.site__inner, main, .footer__inner { max-width: 1240px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.site__inner { display: flex; align-items: center; gap: 40px; min-height: 84px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-heading); font-weight: 700; font-size: 24px; letter-spacing: -0.01em; }
.brand img { width: 36px; height: 36px; }
.nav { display: flex; gap: 28px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 0; font-size: 15px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
main:focus { outline: none; }

/* ── 머리말 ───────────────────────── */
.intro { padding: 56px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--primary); letter-spacing: 0.02em; margin-bottom: 16px; }
.eyebrow::before { content: "— "; }
.intro h1 { font-size: clamp(34px, 5.2vw, 60px); letter-spacing: -0.02em; line-height: 1.12; }
.lead { margin-top: 20px; max-width: 64ch; font-size: 17px; color: var(--ink); }

.subhead { margin: 56px 0 24px; padding-top: 32px; border-top: 1px solid var(--line); }
.subhead h2 { font-size: 28px; }
.subhead p { margin-top: 8px; color: var(--muted); max-width: 68ch; }

/* ── 입력 ─────────────────────────── */
.entry { max-width: 620px; margin-bottom: 40px; }
.entry__label { display: block; font-weight: 600; margin-bottom: 8px; }
.entry__hint { margin-top: 10px; font-size: 14px; color: var(--muted); }
.ui-input {
  width: 100%; min-height: 52px; padding: 12px 16px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--strongLine); border-radius: var(--radius);
  font: inherit;
}
.ui-input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.entry__input { font-family: var(--font-heading); font-size: 30px; font-weight: 700; padding: 14px 18px; }
.entry__input--area { font-size: 22px; line-height: 1.4; resize: vertical; min-height: 96px; }
.entry--band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 760px; }
.entry--band .entry__hint { grid-column: 1 / -1; margin-top: 0; }
.entry__row--wide { grid-column: 1 / -1; max-width: 360px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ── 버튼 ─────────────────────────── */
.ui-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--touch); padding: 12px 22px;
  background: var(--primary); color: var(--onPrimary);
  border: 1px solid transparent; border-radius: 0;
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}
.ui-button:hover { background: var(--primaryHover); }
.ui-button.secondary { background: var(--surface); color: var(--ink); border-color: var(--strongLine); }
.ui-button.secondary:hover { border-color: var(--ink); background: var(--surface); }
.ui-button:disabled { background: var(--line); color: var(--muted); border-color: transparent; cursor: default; }
.ui-button--small { min-height: 44px; padding: 8px 14px; font-size: 15px; font-weight: 500; }

.segmented { display: inline-flex; border: 1px solid var(--strongLine); margin-bottom: 32px; flex-wrap: wrap; }
.segmented__item { min-height: var(--touch); padding: 10px 22px; border: 0; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.segmented__item + .segmented__item { border-left: 1px solid var(--strongLine); }
.segmented__item[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }

/* ── 작업대 ───────────────────────── */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-areas: "gallery bench"; gap: 48px; align-items: start; }
.gallery { grid-area: gallery; min-width: 0; }
.bench { grid-area: bench; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); padding: 24px; overscroll-behavior: contain; }
.bench__title { font-size: 20px; margin-bottom: 16px; }
.bench__stage {
  aspect-ratio: 1; display: grid; place-items: center; padding: 28px;
  background-color: #FFFEFB;
  background-image: linear-gradient(var(--soft) 1px, transparent 1px), linear-gradient(90deg, var(--soft) 1px, transparent 1px);
  background-size: 24px 24px; background-position: center;
  border: 1px solid var(--line);
}
.bench__stage--sign { aspect-ratio: 2 / 1; padding: 16px; }
.bench__art { position: relative; width: 100%; height: 100%; }
.bench__art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bench__caption { margin: 12px 0 18px; font-size: 14px; color: var(--muted); min-height: 1.6em; }
.bench__actions { border-top: 1px solid var(--line); padding-top: 18px; }
.export { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.export + .export { margin-top: 12px; }
.export__size { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.export__size legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.export__size .chip span { min-height: 40px; padding: 6px 12px; font-family: var(--font-number); }
.export__size .chip b, .export__size .chip input:checked + span b { font-weight: 500; } /* 고정폭 글꼴은 한 굵기만 싣는다 */
.export-print { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.export .ui-button { flex: 1 1 auto; }
.status { margin-top: 12px; font-size: 14px; min-height: 1.6em; }
.status[data-tone="error"] { color: var(--error); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.progress { width: 100%; height: 8px; margin-top: 14px; accent-color: var(--primary); }

.bench__more { margin-top: 20px; border-top: 1px solid var(--line); }
.bench__more summary { cursor: pointer; padding: 16px 0 12px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: var(--touch); }
.bench__more summary::-webkit-details-marker { display: none; }
.bench__more summary::after { content: "펼치기"; font-weight: 400; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.bench__more[open] summary::after { content: "접기"; }
.bench__controls { display: grid; gap: 22px; padding-bottom: 8px; }

.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field legend, .field > label { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; display: block; }
.field__hint { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.field--button { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field--button .field__hint { margin: 0; }
.field--check label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
.field--check input { width: 20px; height: 20px; accent-color: var(--primary); }
.field--color { display: flex; align-items: center; gap: 12px; }
.field--color label { margin: 0; font-weight: 500; }
.field--color input { width: 52px; height: 40px; border: 1px solid var(--strongLine); background: var(--surface); padding: 2px; }
.field--range input { width: 100%; accent-color: var(--primary); min-height: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.chip b { font-weight: 500; }
.chip:hover span { border-color: var(--strongLine); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip input:checked + span b { font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.chip__icon { width: 18px; height: 18px; flex: none; }
.swatch { width: 16px; height: 16px; flex: none; border: 1px solid rgba(0, 0, 0, 0.15); }
.chip input:checked + span .swatch { border-color: var(--surface); }

/* 시안 목록: 활자 견본처럼 구분선으로 나눈 칸 */
.gallery__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.gallery__head h2 { font-size: 20px; }
.gallery__count { font-family: var(--font-number); font-size: 14px; color: var(--muted); }
.gallery__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.gallery__grid li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.gallery__empty { color: var(--muted); padding: 40px 0; border-top: 1px solid var(--line); }
.card {
  display: flex; flex-direction: column; gap: 10px; width: 100%; height: 100%;
  padding: 16px 14px 12px; background: transparent; border: 0; color: inherit;
  font: inherit; text-align: left; cursor: pointer; transition: background-color 150ms;
}
.card:hover { background: var(--surface); }
.card[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--primary); }
.card:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.card__art { position: relative; aspect-ratio: 1; display: grid; place-items: center; width: 100%; }
.card__art--sign { aspect-ratio: 2 / 1; }
.card__art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__wait { font-size: 13px; color: var(--muted); }
.card__label { font-size: 13px; color: var(--muted); line-height: 1.4; }
.card[aria-pressed="true"] .card__label { color: var(--ink); font-weight: 600; }

/* ── 손글씨 판 ─────────────────────── */
.pad { background: var(--surface); border: 1px solid var(--line); padding: 20px; max-width: 960px; }
.pad__toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.pad__spacer { flex: 1; }
.pad__board { position: relative; }
.pad__canvas {
  display: block; width: 100%; aspect-ratio: 5 / 2; touch-action: none; cursor: crosshair;
  background-color: #FFFEFB;
  background-image: linear-gradient(transparent calc(72% - 1px), var(--line) calc(72% - 1px), var(--line) 72%, transparent 72%);
  border: 1px solid var(--strongLine);
}
.pad__placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--font-heading); font-size: 22px; pointer-events: none; }
.pad__export { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 14px; }

/* ── 한꺼번에 ─────────────────────── */
.batch { display: grid; grid-template-columns: minmax(0, 620px); }

/* ── 글 ───────────────────────────── */
.prose { max-width: 70ch; padding-bottom: 32px; }
.prose h2 { font-size: 24px; margin: 36px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose ol, .prose ul { padding-left: 1.3em; margin: 0; display: grid; gap: 8px; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 10px; }
.credits { list-style: none; padding: 0 !important; border-top: 1px solid var(--line); gap: 0 !important; font-size: 14px; }
.credits li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.credits span { color: var(--muted); flex: 1 1 260px; }

.footer { border-top: 1px solid var(--line); margin-top: 80px; }
.footer__inner { padding-top: 28px; padding-bottom: 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; color: var(--muted); }
.footer a { color: var(--muted); }
.noscript { padding: 24px; text-align: center; }
.notfound { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 16px; text-align: center; padding: 32px 16px; }
.notfound h1 { font-size: clamp(28px, 5vw, 44px); }
.notfound .ui-button { text-decoration: none; margin-top: 8px; }

.print-sheet { display: none; }

/* ── 반응형 ───────────────────────── */
@media (max-width: 1023px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bench" "gallery"; gap: 32px; }
  .bench { position: static; max-height: none; overflow: visible; }
  .bench__stage { max-width: 420px; margin: 0 auto; width: 100%; }
  .bench__stage--sign { max-width: 560px; }
}
@media (max-width: 639px) {
  [data-web-style="W03"] { --gutter: 16px; }
  .site__inner { gap: 4px 20px; padding-top: 14px; padding-bottom: 6px; min-height: 0; }
  .nav { gap: 18px; overflow-x: auto; flex-wrap: nowrap; width: 100%; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .intro { padding: 32px 0 24px; margin-bottom: 24px; }
  .intro h1 { font-size: 32px; }
  .lead { font-size: 16px; }
  .entry__input { font-size: 24px; }
  .entry--band { grid-template-columns: minmax(0, 1fr); }
  .bench { padding: 16px; }
  .gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 12px 10px 10px; }
  .pad { padding: 12px; }
  .pad__canvas { aspect-ratio: 5 / 3; }
  .subhead h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── 인쇄용 한 장(한꺼번에 → 인쇄) ─── */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body > :not(.print-sheet) { display: none !important; }
  .print-sheet { display: grid; grid-template-columns: repeat(auto-fill, var(--cell, 2.5cm)); gap: 6mm 5mm; justify-content: start; }
  .print-sheet figure { margin: 0; width: var(--cell, 2.5cm); break-inside: avoid; }
  .print-sheet img { width: 100%; height: auto; }
  .print-sheet figcaption { font-size: 9pt; text-align: center; margin-top: 1mm; color: #333; }
}
