/* 리치고 개발자 센터 — 문서 사이트 스타일
   빌드 단계 없이 S3 정적 호스팅으로 바로 배포되므로 외부 의존성을 두지 않는다. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-code: #0f172a;
  --border: #e5e8eb;
  --text: #191f28;
  --text-muted: #6b7684;
  --text-faint: #8b95a1;
  --accent: #3182f6;
  --accent-weak: #e8f3ff;
  --warn-bg: #fff8e6;
  --warn-border: #ffd666;
  --danger: #f04452;
  --radius: 12px;
  --sidebar-w: 260px;
  --code-w: 460px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Pretendard,
    "Malgun Gothic", "맑은 고딕", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171c;
    --bg-subtle: #1f1f26;
    --bg-code: #0b0f1a;
    --border: #2e2e38;
    --text: #eaeaef;
    --text-muted: #a0a0ab;
    --text-faint: #7c7c88;
    --accent: #5b9dff;
    --accent-weak: #1c2b45;
    --warn-bg: #302a12;
    --warn-border: #6b5a1e;
  }
}

:root[data-theme="dark"] {
  --bg: #17171c;
  --bg-subtle: #1f1f26;
  --bg-code: #0b0f1a;
  --border: #2e2e38;
  --text: #eaeaef;
  --text-muted: #a0a0ab;
  --text-faint: #7c7c88;
  --accent: #5b9dff;
  --accent-weak: #1c2b45;
  --warn-bg: #302a12;
  --warn-border: #6b5a1e;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-code: #0f172a;
  --border: #e5e8eb;
  --text: #191f28;
  --text-muted: #6b7684;
  --text-faint: #8b95a1;
  --accent: #3182f6;
  --accent-weak: #e8f3ff;
  --warn-bg: #fff8e6;
  --warn-border: #ffd666;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.38em;
  word-break: break-word;
}

/* ── 상단바 ───────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 800;
}
.brand-sub { color: var(--text-faint); font-weight: 500; }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn:hover { background: var(--bg-subtle); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); filter: brightness(0.94); }

.nav-toggle { display: none; }

/* ── 레이아웃 ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 28px 12px 60px 24px;
  border-right: 1px solid var(--border);
}

.nav-group + .nav-group { margin-top: 26px; }
.nav-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 8px 10px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text-muted);
}
.nav-list a:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.nav-list a.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.method-tag {
  display: inline-block;
  min-width: 34px;
  margin-right: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
}

/* ── 본문 ────────────────────────────────────────────── */
.content { min-width: 0; padding: 0 0 120px; }

section.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--code-w);
  gap: 48px;
  padding: 44px 40px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
section.doc.full { grid-template-columns: minmax(0, 1fr); }

.prose { min-width: 0; max-width: 720px; }
.prose > :first-child { margin-top: 0; }

h1 { font-size: 34px; line-height: 1.35; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 25px; line-height: 1.4; letter-spacing: -0.015em; margin: 0 0 10px; scroll-margin-top: 76px; }
h3 { font-size: 17px; margin: 30px 0 8px; }
p { margin: 0 0 14px; color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 600; }
ul, ol { margin: 0 0 14px; padding-left: 20px; color: var(--text-muted); }
li { margin-bottom: 5px; }
li::marker { color: var(--text-faint); }

.lead { font-size: 17px; color: var(--text-muted); }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}

/* 엔드포인트 표기 */
.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 11px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}
.verb {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: #12b886;
}
.verb.post { background: #4c6ef5; }
.verb.delete { background: var(--danger); }
.endpoint .path { color: var(--text); white-space: nowrap; }

/* 표 */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }
table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
td { color: var(--text-muted); }
td:first-child { color: var(--text); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
td .req { color: var(--danger); font-size: 11px; margin-left: 4px; }

/* 알림 박스 */
.note {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 14px;
  color: var(--text-muted);
}
.note strong { color: var(--text); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.note p:last-child { margin-bottom: 0; }

/* ── 코드 패널 ───────────────────────────────────────── */
.code-col { position: sticky; top: 84px; min-width: 0; }

.code-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-code);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.code-card + .code-card { margin-top: 14px; }

.code-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 8px 0;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.code-label {
  margin-right: auto;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8b95a1;
}
.tab {
  padding: 6px 11px;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: #8b95a1;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { color: #d5d9e0; }
.tab[aria-selected="true"] { color: #fff; background: rgba(255, 255, 255, 0.09); }

.copy-btn {
  margin: 0 4px 0 6px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: transparent;
  color: #8b95a1;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

pre {
  margin: 0;
  padding: 15px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #dbe2ea;
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }

/* 코드 하이라이트 (수동 마크업) */
.t-str { color: #7ee787; }
.t-key { color: #79c0ff; }
.t-num { color: #f2a97e; }
.t-cm  { color: #6b7684; font-style: italic; }
.t-fn  { color: #d2a8ff; }

/* ── 히어로 ──────────────────────────────────────────── */
.hero {
  padding: 56px 40px 44px;
  border-bottom: 1px solid var(--border);
}
.hero h1 { max-width: 760px; }
.hero .lead { max-width: 640px; margin-bottom: 26px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 34px;
  max-width: 940px;
}
.card {
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 5px; font-size: 15px; color: var(--text); }
.card p { margin: 0; font-size: 13.5px; }

/* 요금 */
.price-card {
  max-width: 420px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-subtle);
}
.price-amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.price-amount small { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.price-card ul { margin: 16px 0 0; }

footer {
  padding: 28px 40px 60px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ── 반응형 ──────────────────────────────────────────── */
@media (max-width: 1180px) {
  section.doc { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .code-col { position: static; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .sidebar {
    display: none;
    position: fixed;
    top: 60px; left: 0; right: 0;
    height: calc(100vh - 60px);
    z-index: 30;
    background: var(--bg);
    border-right: 0;
    padding: 20px 24px 60px;
  }
  .sidebar.open { display: block; }
  section.doc, .hero { padding-left: 20px; padding-right: 20px; }
  footer { padding-left: 20px; padding-right: 20px; }
  h1 { font-size: 27px; }
  h2 { font-size: 21px; }
  .brand-sub { display: none; }
}
