/* Book Roasting — base tokens and shared editorial components
   색은 역할(9 Colors)을 식별하는 언어로만 쓴다. UI 자체는 종이와 잉크. */

:root {
  /* 글자 크기 5단. 테마가 값만 바꾼다 */
  --fs-label: 12px;
  --fs-aux: 14px;
  --fs-body: 17px;
  --fs-3: 20px;
  --fs-2: clamp(22px, 2.6vw, 30px);
  --fs-1: clamp(30px, 4.2vw, 50px);
  --fs-d: clamp(32px, 5vw, 64px);
  --fs-lead: 19px;
  --paper: #f5f0e6;
  --paper-2: #ede6d7;
  --paper-3: #e4dac7;
  --sheet: #fbf9f4;
  --ink: #1f1d1a;
  --ink-2: #45413a;
  --ink-3: #6b655b;
  --gray: #8c8478;
  --rule: #d9d0bf;
  --rule-2: #c4b9a5;
  --focus: #1f1d1a;

  /* 9 Colors. 역할 식별 전용 */
  --c-black: #1f1d1a;
  --c-red: #a3372b;
  --c-silver: #7a828a;
  --c-gold: #a47a1c;
  --c-light: #cdbb8c;
  --c-purple: #5a4877;
  --c-blue: #3f6690;
  --c-green: #4f7a52;
  --c-white: #ffffff;

  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --measure: 36em;
  --radius: 3px;
  --shadow-sheet: 0 1px 0 rgba(31, 29, 26, .04), 0 10px 24px -14px rgba(31, 29, 26, .28);
  --shadow-card: 0 1px 0 rgba(31, 29, 26, .05), 0 6px 14px -10px rgba(31, 29, 26, .35);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.75;
  word-break: keep-all;
  font-variant-numeric: lining-nums;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--sheet); padding: 8px 14px; border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

/* ---------- Type ---------- */
.serif { font-family: var(--serif); }
.eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-label); font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
}
.fw-label {
  font-size: var(--fs-label); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gray);
}
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-aux); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: var(--sheet);
  font-weight: 600; font-size: var(--fs-body); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--sheet); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: var(--fs-aux); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}

/* ---------- Color chips (색 + 글자 라벨, 색만으로 정보를 주지 않는다) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
}
.chip::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--chip, var(--ink)); box-shadow: inset 0 0 0 1px rgba(31, 29, 26, .25);
}
[data-color="BLACK"] { --chip: var(--c-black); --role: var(--c-black); }
[data-color="RED"] { --chip: var(--c-red); --role: var(--c-red); }
[data-color="SILVER"] { --chip: var(--c-silver); --role: var(--c-silver); }
[data-color="GOLD"] { --chip: var(--c-gold); --role: var(--c-gold); }
[data-color="LIGHT"] { --chip: var(--c-light); --role: #9c8a58; }
[data-color="PURPLE"] { --chip: var(--c-purple); --role: var(--c-purple); }
[data-color="BLUE"] { --chip: var(--c-blue); --role: var(--c-blue); }
[data-color="GREEN"] { --chip: var(--c-green); --role: var(--c-green); }
[data-color="WHITE"] { --chip: var(--c-white); --role: #b9b3a8; }

/* ---------- Paper objects ---------- */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-sheet);
  border-radius: 2px;
}
.index-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: var(--shadow-card);
  background-image: linear-gradient(to bottom, transparent 43px, rgba(163, 55, 43, .28) 43px, rgba(163, 55, 43, .28) 44px, transparent 44px);
}
.ruled {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.9em - 1px), var(--rule) calc(1.9em - 1px), var(--rule) 1.9em);
  line-height: 1.9em;
}

/* 교정 표시 */
.mark-del { text-decoration: line-through; text-decoration-color: var(--role, var(--c-red)); text-decoration-thickness: 2px; }
.mark-under {
  background-image: linear-gradient(to top, var(--role, var(--c-red)) 0, var(--role, var(--c-red)) 2px, transparent 2px);
  background-repeat: no-repeat; padding-bottom: 1px;
}
.mark-ins { color: var(--role, var(--c-red)); font-family: var(--serif); font-style: normal; }
.stamp {
  display: inline-block; padding: 2px 8px;
  border: 1.5px solid currentColor; border-radius: 2px;
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  transform: rotate(-2deg);
}
.stamp--ok { color: var(--ink); }
.stamp--draft { color: var(--gray); border-style: dashed; }
.stamp--empty { color: var(--rule-2); border-style: dotted; }

/* 워드마크. ¶(단락 기호)는 편집 부호에서 왔다 */
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; margin: 0; }
.wordmark__mark { font-family: var(--serif); font-weight: 900; font-size: var(--fs-3); color: var(--c-red); line-height: 1; }
.wordmark__text { font-family: var(--serif); font-weight: 700; font-size: var(--fs-3); letter-spacing: -.01em; }
.wordmark--sm { font-family: var(--serif); font-weight: 700; }

/* 점선 리더 (목차) */
.leader { flex: 1; min-width: 20px; border-bottom: 1.5px dotted var(--rule-2); transform: translateY(-5px); }

.container { width: min(1160px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) { .container { width: min(1160px, 100% - 64px); } }
