/* bbmcp 문서 사이트 스타일.
   모바일 우선, 시스템 폰트, 다크 모드 자동 전환. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fc;
  --bg-elevated: #ffffff;
  --fg: #16202e;
  --fg-muted: #566279;
  --border: #dfe5ef;
  --brand: #1f6feb;
  --brand-dark: #0b4fbb;
  --brand-soft: #e7f1ff;
  --ok: #0f9960;
  --warn: #d9822b;
  --danger: #d64545;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 54, 0.06), 0 8px 24px rgba(16, 32, 54, 0.08);
  --maxw: 1140px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1420;
    --bg-soft: #121c2c;
    --bg-elevated: #16202f;
    --fg: #e8eefb;
    --fg-muted: #9fb0c9;
    --border: #243246;
    --brand: #4f93ff;
    --brand-dark: #2b7cff;
    --brand-soft: #16263f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; display: block; }

code, pre, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

code:not(pre code) {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.38em;
}

pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  line-height: 1.6;
}

.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }

/* ---------- header ---------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--fg);
}

.brand img { width: 32px; height: 32px; }

.nav nav {
  margin-left: auto;
  display: flex;
  gap: 0.35rem 1.1rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav nav a { color: var(--fg-muted); font-size: 0.97rem; font-weight: 600; }
.nav nav a:hover { color: var(--brand); text-decoration: none; }

/* ---------- hero ---------- */

.hero {
  padding: 4.2rem 0 3rem;
  background:
    radial-gradient(900px 420px at 10% -20%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 62%),
    radial-gradient(760px 380px at 95% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%);
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.22;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.hero p.lead {
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  color: var(--fg-muted);
  max-width: 62ch;
  margin: 0 0 1.6rem;
}

.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .badge { color: #cfe0ff; }
}

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.8rem 1.4rem;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  font-size: 1rem;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-ghost { border-color: var(--border); color: var(--fg); background: var(--bg-elevated); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- sections ---------- */

section { padding: 3.4rem 0; }
section.alt { background: var(--bg-soft); border-block: 1px solid var(--border); }

h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.3;
  margin: 0 0 0.6rem;
  letter-spacing: -0.015em;
}

h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }

.section-lead { color: var(--fg-muted); max-width: 70ch; margin: 0 0 2rem; }

.grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
}

.card h3 { margin: 0 0 0.45rem; font-size: 1.12rem; }
.card p { margin: 0; color: var(--fg-muted); font-size: 0.98rem; }

.steps { counter-reset: step; display: grid; gap: 1rem; }

.step {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem 1.2rem 3.6rem;
  position: relative;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 1.1rem;
  top: 1.15rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.step h3 { margin: 0 0 0.35rem; font-size: 1.08rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 700; }
tbody tr:last-child td { border-bottom: none; }

.table-scroll { overflow-x: auto; }

figure { margin: 1.5rem 0; }

figure img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

figcaption { color: var(--fg-muted); font-size: 0.92rem; margin-top: 0.6rem; text-align: center; }

.shots { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.shots figure { margin: 0; }

details {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  margin-bottom: 0.75rem;
}

details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.04rem;
  list-style: none;
}

details summary::-webkit-details-marker { display: none; }
details summary::before { content: "＋ "; color: var(--brand); font-weight: 800; }
details[open] summary::before { content: "－ "; }
details > *:not(summary) { color: var(--fg-muted); }

.note {
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  padding: 0.9rem 1.15rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.4rem 0;
}

.note.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.note.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.note p:last-child { margin-bottom: 0; }
.note p:first-child { margin-top: 0; }

footer.site {
  border-top: 1px solid var(--border);
  padding: 2.4rem 0 3rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

footer.site .cols { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
footer.site a { color: var(--fg-muted); }
footer.site a:hover { color: var(--brand); }

/* ---------- guide layout ---------- */

.guide {
  display: grid;
  gap: 2.5rem;
  /* minmax(0, …) keeps a long <pre> from forcing the whole grid wider than
     the viewport, which is what produces horizontal scroll on phones. */
  grid-template-columns: minmax(0, 1fr);
  padding-top: 2.5rem;
}

.guide > * { min-width: 0; }

@media (min-width: 62rem) {
  .guide { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
  .toc {
    position: sticky;
    top: 5rem;
    align-self: start;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 0.3rem; }
.toc a { color: var(--fg-muted); font-size: 0.95rem; font-weight: 600; }
.toc a:hover { color: var(--brand); }
.toc .sub { padding-left: 0.9rem; font-weight: 500; }

.guide-body h2 { margin-top: 2.6rem; scroll-margin-top: 5rem; }
.guide-body h3 { scroll-margin-top: 5rem; }
.guide-body ul, .guide-body ol { padding-left: 1.3rem; }
.guide-body p, .guide-body li, .guide-body td { overflow-wrap: anywhere; }
.guide-body li { margin-bottom: 0.4rem; }

.kbd {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.05em 0.45em;
  background: var(--bg-soft);
  font-size: 0.9em;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 50;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
