/* ==========================================================================
   Cholab Search — design system
   에디토리얼 + 개발도구 톤. 그라데이션/글래스모피즘/이모지 아이콘 배제.
   ========================================================================== */

:root {
  --paper: #f5f3ee;
  --paper-2: #efece4;
  --card: #fffdf8;
  --ink: #16150f;
  --ink-2: #4a4738;
  --ink-3: #7b7767;
  --line: #d9d4c6;
  --line-2: #c3bdab;
  --accent: #c8451a;
  --accent-ink: #8e3011;
  --accent-soft: #f7e4da;
  --moss: #4c5d3f;
  --moss-soft: #e4ebdd;
  --ok: #3d6b3a;
  --warn: #9a6a12;
  --err: #a8321f;
  --code-bg: #191813;
  --code-fg: #e8e4d8;
  --r: 3px;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
          "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 0 var(--line), 0 12px 28px -18px rgba(22, 21, 15, .45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* 아주 옅은 종이 결 */
  background-image:
    repeating-linear-gradient(0deg, rgba(22,21,15,.014) 0 1px, transparent 1px 3px);
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
h1 { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; }
p { margin: 0 0 12px; }
code, kbd, pre { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

::selection { background: #f6d7c9; }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 243, 238, .92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.02em;
  font-size: 15.5px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.brand .sub { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  letter-spacing: .06em; text-transform: uppercase; padding-left: 9px;
  border-left: 1px solid var(--line-2); margin-left: 2px; }
.nav-links { display: flex; gap: 2px; margin-left: 8px; }
.nav-links a { color: var(--ink-2); padding: 7px 11px; border-radius: var(--r);
  font-size: 14px; text-decoration: none; }
.nav-links a:hover { background: var(--paper-2); color: var(--ink); }
.nav-links a.active { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-size: 14px; font-weight: 550;
  font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--paper-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fbf9f2; }
.btn-primary:hover { background: #2a2820; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff8f4; }
.btn-accent:hover { background: #b23c15; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-danger { border-color: #e0b8b0; color: var(--err); background: #fdf3f1; }
.btn-danger:hover { background: #fae9e5; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px;
}
.card-tight { padding: 14px 16px; }
.card-h { font-size: 13px; font-weight: 650; letter-spacing: .02em;
  text-transform: uppercase; color: var(--ink-3); font-family: var(--mono);
  margin-bottom: 12px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 5px; }
label.field > span .req { color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  color: var(--ink); background: #fffdf9; border: 1px solid var(--line-2);
  border-radius: var(--r); outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(22,21,15,.06);
}
input::placeholder { color: #a8a293; }
select { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237b7767' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px;
  color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 100px; font-size: 11.5px; font-weight: 600; font-family: var(--mono);
  border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-2); }
.badge-ok { background: var(--moss-soft); border-color: #bccfae; color: var(--ok); }
.badge-err { background: #fae9e5; border-color: #e6bcb2; color: var(--err); }
.badge-warn { background: #fbf1d8; border-color: #e6d3a3; color: var(--warn); }
.badge-accent { background: var(--accent-soft); border-color: #eabfae; color: var(--accent-ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  display: inline-block; }

/* ---------- code ---------- */
pre.code {
  background: var(--code-bg); color: var(--code-fg); padding: 16px 18px;
  border-radius: var(--r); overflow: auto; margin: 0; line-height: 1.65;
  font-size: 12.5px; border: 1px solid #26241c;
}
pre.code .k { color: #f0a86b; }        /* keyword/command */
pre.code .s { color: #b9cf8e; }        /* string */
pre.code .c { color: #7d7869; font-style: italic; }
pre.code .n { color: #d9c164; }        /* number/prop */
code.inline { background: var(--paper-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 2px; font-size: 12.5px; color: var(--ink-2); }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto;
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; font-family: var(--mono); font-size: 12px;
  padding: 9px 13px; cursor: pointer; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
  padding: 9px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: rgba(22,21,15,.022); }
table.tbl td.num { font-family: var(--mono); font-size: 12.5px; text-align: right; }
table.tbl .trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }

/* ---------- stat tiles ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; }
.stat .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 550; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 60px); }
.side { border-right: 1px solid var(--line); padding: 22px 12px; }
.side .group { margin-bottom: 22px; }
.side .group > .gt { font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); padding: 0 10px 7px; }
.side a { display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--r); color: var(--ink-2); font-size: 14px; text-decoration: none;
  margin-bottom: 1px; }
.side a:hover { background: var(--paper-2); color: var(--ink); text-decoration: none; }
.side a.active { background: var(--ink); color: #f8f6ee; }
.side a.active svg { stroke: #f8f6ee; }
.side a svg { width: 15px; height: 15px; stroke: var(--ink-3); fill: none;
  stroke-width: 1.6; flex: none; }
.side a.active svg { stroke: currentColor; }
.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { margin-bottom: 22px; }
.page-head h2 { font-size: 21px; font-family: var(--serif); font-weight: 500; }
.page-head p { color: var(--ink-3); font-size: 13.5px; margin: 3px 0 0; }
.pill-credits { font-family: var(--mono); font-size: 12px; padding: 5px 10px;
  border: 1px solid var(--line-2); border-radius: 100px; background: var(--card); }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #f8f6ee; padding: 11px 15px; border-radius: var(--r);
  font-size: 13.5px; max-width: 360px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5);
  animation: toastIn .18s ease; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--moss); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(22,21,15,.42); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .12s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r);
  max-width: 460px; width: 100%; padding: 22px; box-shadow: var(--shadow);
  animation: modalIn .16s cubic-bezier(.2,.8,.3,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99) }
                     to { opacity: 1; transform: none } }
.modal.wide { max-width: 620px; }
.modal h3 { font-size: 17px; margin-bottom: 6px; letter-spacing: -.01em; }
.modal .mdesc { font-size: 13px; color: var(--ink-3); line-height: 1.55;
  margin: 0 0 16px; }
.modal .mbody { margin-bottom: 18px; }
.modal .mactions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .mactions .btn { min-width: 74px; }
.modal .err-line { color: var(--err); font-size: 12.5px; margin-top: 8px; min-height: 16px; }
.keyreveal { background: var(--code-bg); color: #e8e4d8; border-radius: var(--r);
  padding: 14px; font-family: var(--mono); font-size: 12.5px; word-break: break-all;
  line-height: 1.6; display: flex; align-items: flex-start; gap: 10px; }
.keyreveal code { flex: 1; color: #b9cf8e; }
.keyreveal button { flex: none; }
.warn-strip { background: #fbf1d8; border: 1px solid #e6d3a3; color: #7a5410;
  border-radius: var(--r); padding: 9px 12px; font-size: 12.5px; line-height: 1.5;
  margin-bottom: 14px; }
.seg { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: var(--r);
  overflow: hidden; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: var(--paper-2); padding: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--ink); color: #f8f6ee; }

/* ---------- result list (playground) ---------- */
.result { padding: 13px 0; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result .rt { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.result .ru { font-family: var(--mono); font-size: 11.5px; color: var(--moss);
  word-break: break-all; margin: 2px 0 5px; }
.result .rs { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.result .rm { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 3px; padding: 1px 5px; background: var(--card); }
.loader { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { background: var(--paper-2); border-radius: 2px; height: 12px; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.foot { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px;
  font-size: 12.5px; color: var(--ink-3); }
.foot a { color: var(--ink-2); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); display: flex;
    gap: 4px; overflow-x: auto; padding: 10px 12px; }
  .side .group { margin: 0; display: flex; gap: 2px; }
  .side .group > .gt { display: none; }
  .side a { white-space: nowrap; margin: 0; }
  .main { padding: 18px 16px 48px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
