/* 책 공장 디자인 시스템 v5 (2026-10-30) — 토큰 한 벌, 모든 화면이 같은 것을 쓴다.
   서체: Pretendard Variable 하나(동적 부분 글꼴, jsDelivr). 고정폭은 시스템 고정폭으로 대체하고 웹폰트를 받지 않는다.
   색: 따뜻한 그라파이트 중립색 + 강조색 하나(옥스블러드). 상태색(진행·완료·주의)은 점과 칩에만.
   한글: keep-all, 15px 이상에서만 음수 자간, 행간 본문 1.6·제목 1.3, 블록 여백은 4px 격자에서 작게. */
/* The Pretendard stylesheet is linked from each page's <head> (preconnect + link), not @imported here: an @import is
   fetched only after this file arrives, which delays text. */

:root {
  color-scheme: light;   /* the one palette is light: form controls, scrollbars and dialogs stay light under a dark OS setting */
  /* 중립 */
  --ink: #1b1b19;
  --ink-2: #45453f;
  --mute: #666660;
  --mute-2: #8c8c85;
  --line: #e1e1dc;
  --line-2: #ecece8;
  --paper: #f4f4f1;
  --paper-2: #e9e9e4;
  --white: #ffffff;
  /* 강조 하나 */
  --accent: #7a2630;
  --accent-2: #5f1c25;
  --accent-soft: #f5e9ea;
  --accent-line: #e4c6c9;
  /* 상태 */
  --run: #9a6400;   --run-dot: #d9a300;  --run-soft: #f8f0dc;
  --ok: #2d6a3e;    --ok-dot: #3f9a5a;   --ok-soft: #e6f1e8;
  --bad: var(--accent); --bad-soft: var(--accent-soft);
  /* 호환 별칭(옛 부품이 쓰던 이름) */
  --seal: var(--accent); --seal-soft: var(--accent-soft); --coral: var(--accent); --coral-soft: var(--accent-soft);
  --teal: var(--ink); --teal-2: #000; --teal-soft: var(--paper-2);
  --green: var(--ok); --green-soft: var(--ok-soft); --amber: var(--run); --amber-soft: var(--run-soft); --soft: var(--paper);
  /* 모양 */
  --r: 6px; --r-s: 4px; --r-l: 8px; --pill: 999px;
  --sh-1: 0 1px 1px rgba(27,27,25,.04);
  --sh-2: 0 4px 14px rgba(27,27,25,.08), 0 1px 2px rgba(27,27,25,.05);
  /* 입체: 떠 있는 패널(윗면 하이라이트+얕은 그림자) / 파인 홈(입력·아이콘 자리) */
  --sh-raise: inset 0 1px 0 #fff, 0 1px 2px rgba(27,27,25,.07), 0 6px 14px -8px rgba(27,27,25,.16);
  --sh-raise-hi: inset 0 1px 0 #fff, 0 2px 4px rgba(27,27,25,.08), 0 10px 20px -8px rgba(27,27,25,.2);
  --sh-well: inset 0 1px 3px rgba(27,27,25,.13), inset 0 0 0 1px rgba(27,27,25,.03);
  --sh-3: 0 20px 48px rgba(27,27,25,.16), 0 2px 6px rgba(27,27,25,.08);
  /* 글자 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --serif: "Apple Myungjo", "Nanum Myeongjo", "Noto Serif KR", Batang, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "D2Coding", monospace;
  --fs-cap: 12px; --fs-sm: 13px; --fs-ui: 14px; --fs-body: 15px; --fs-read: 16px; --fs-h3: 18px; --fs-h2: 22px; --fs-h1: 28px;
  --ease: cubic-bezier(.2,.6,.3,1);
}

* { box-sizing: border-box; }
img { object-fit: contain; } /* a picture boxed in both directions keeps its shape; crops must say object-fit: cover */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--fs-body)/1.6 var(--font); color: var(--ink); background: var(--paper); letter-spacing: -.01em;
       word-break: keep-all; overflow-wrap: break-word; line-break: strict; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
:lang(en) { letter-spacing: 0; word-break: normal; }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: var(--fs-h1); } h2 { font-size: var(--fs-h2); } h3 { font-size: var(--fs-h3); } h4 { font-size: var(--fs-read); }
p { margin: 0 0 8px; text-wrap: pretty; }
p.help, .help { font-size: var(--fs-sm); color: var(--mute); line-height: 1.6; }
small { font-size: var(--fs-sm); }
a { color: var(--accent); text-decoration: none; } @media (hover: hover) { a:hover { text-decoration: underline; text-underline-offset: 3px; } }
code, pre { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.mute { color: var(--mute); } .warn { color: var(--accent); }
::selection { background: var(--ink); color: #fff; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 입력 */
label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin: 12px 0 4px; }
input[type=text], input[type=number], input[type=password], input[type=search], input:not([type]), textarea, select {
  width: 100%; margin: 0; padding: 8px 10px; font: inherit; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: var(--sh-well); transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder, textarea::placeholder { color: var(--mute); }
@media (hover: hover) { input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) { border-color: #cfcfc9; } }
input:focus, textarea:focus, select:focus { outline: 2px solid transparent;background: var(--white); border-color: var(--ink); box-shadow: var(--sh-well), 0 0 0 3px rgba(27,27,25,.08); }
textarea { min-height: 120px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2345453f' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input[type=radio], input[type=checkbox] { accent-color: var(--ink); width: 15px; height: 15px; margin: 0 6px 0 0; vertical-align: -2px; }
input[type=file] { font-size: var(--fs-sm); }

/* 버튼: 기본은 먹색, ghost는 테두리, linkbtn은 글자만, gatego는 강조색 */
/* Zero specificity on purpose: a class that paints its own background (card, tile, chip, tab) also owns its hover.
   With the plain `button:hover` this dark fill beat every such class and put dark text on it (11-02). */
:where(button, .btn) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; margin: 0;
  font: 600 var(--fs-ui)/1.3 var(--font); letter-spacing: -.005em; color: #fff; background: var(--ink); border: 1px solid var(--ink); border-radius: var(--r-s);
  cursor: pointer; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, scale .15s ease-out; }
/* Press feedback: 0.96 scale; disabled never scales. Opt out with .static (list rows, segmented controls and landing keys keep their own pressed look). */
@media (prefers-reduced-motion: no-preference) { :where(button, .btn):active:not(:disabled):not(.static, .key, .st, .seg button, .ftabs button, .rows button, .fplist button, .linkbtn) { scale: .96; } }
@media (hover: hover) { :where(button:hover:not(:disabled), .btn:hover) { background: #333331; border-color: #333331; } }
@media (hover: hover) { .btn:hover { text-decoration: none; } }
:where(button:active:not(:disabled)) { background: #000; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost, .btn.ghost, a.btn { color: var(--ink); background: var(--white); border-color: var(--line); box-shadow: var(--sh-raise); }
@media (hover: hover) { button.ghost:hover:not(:disabled), .btn.ghost:hover, a.btn:hover { background: var(--paper); border-color: #c9c9c3; color: var(--ink); } }
button.ghost:active:not(:disabled), .btn.ghost:active, a.btn:active { background: var(--paper-2); }
button.small, .btn.small { min-height: 30px; padding: 4px 10px; font-size: var(--fs-sm); }
button.warn { color: var(--accent); }
.linkbtn { min-height: 0; padding: 2px 0; background: none; border: 0; border-radius: 2px; color: var(--accent); font-weight: 600; font-size: var(--fs-ui); }
@media (hover: hover) { .linkbtn:hover:not(:disabled) { background: none; border: 0; color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; } }

/* Notice region (replaces alert(); moved here from ui.css so every page shares it) */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(420px, 90vw); background: var(--ink); color: #f0f0ec; border-radius: var(--r); padding: 10px 36px 10px 14px; font-size: var(--fs-ui); line-height: 1.55; box-shadow: var(--sh-3); position: relative; animation: toast-in .2s var(--ease); transition: opacity .4s, transform .4s; }
.toast.err { box-shadow: inset 3px 0 0 var(--accent), var(--sh-3); }
.toast.gone { opacity: 0; transform: translateY(6px); }
.toast .tx { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; min-height: 0; padding: 0 !important; border-radius: 4px !important; background: transparent !important; border: 0 !important; color: #c9c9c3 !important; font-size: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Confirm / prompt <dialog id="ask"> (replaces confirm() and prompt()) */
dialog.ask { width: min(420px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--white); color: var(--ink); box-shadow: var(--sh-3); }
dialog.ask:modal { overscroll-behavior: contain; }
dialog.ask::backdrop { background: rgba(27,27,25,.3); overflow: hidden; overscroll-behavior: contain; }
dialog.ask p { margin: 0 0 16px; font-size: var(--fs-body); line-height: 1.6; white-space: pre-line; }
dialog.ask input { width: 100%; margin: 0 0 16px; }
.ask-btns { display: flex; justify-content: flex-end; gap: 8px; }

/* 표 */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-weight: 600; color: var(--mute); font-size: var(--fs-sm); }
table.reg th { width: 132px; min-width: 96px; white-space: normal; }

/* 자주 쓰는 배치 */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; } .row > * { min-width: 0; }
pre.log { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; max-height: 320px; overflow: auto; font-size: var(--fs-sm); line-height: 1.55; white-space: pre-wrap; }
img, video { max-width: 100%; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; } }
