/* 자율스터디 SSO - 개발자 문서 */

:root {
    --primary: #1f4fd8;
    --text: #1f2329;
    --text-sub: #5d636b;
    --text-weak: #8a9099;
    --line: #e3e6ea;
    --bg-soft: #f6f7f9;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", "D2Coding", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: #fff;
    word-break: keep-all;
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 상단 ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 15px; }
.brand img { height: 26px; width: auto; display: block; }
.brand b { color: var(--primary); }
.brand .divider { width: 1px; height: 18px; background: var(--line); }

.top-link { font-size: 14px; color: var(--text-sub); text-decoration: none; }
.top-link:hover { color: var(--primary); }

/* ---------- 레이아웃 ---------- */

.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 48px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.toc {
    position: sticky;
    top: 60px;
    align-self: start;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 32px 0;
}

.toc-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--text-weak); letter-spacing: .04em; }

.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }

.toc a {
    display: block;
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text-sub);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.toc a:hover { color: var(--text); }
.toc a.active { color: var(--primary); font-weight: 600; border-left-color: var(--primary); background: #f3f6fd; }

.content { padding: 32px 0 96px; min-width: 0; }

section { padding-bottom: 24px; }
section + section { border-top: 1px solid var(--line); padding-top: 32px; }

h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.35; letter-spacing: -.02em; }
h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -.01em; }
h3 { margin: 28px 0 8px; font-size: 16px; }

p { margin: 0 0 14px; }
.lead { font-size: 16px; color: var(--text-sub); }

ul { margin: 0 0 14px; padding-left: 20px; }
li { margin: 4px 0; }

a { color: var(--primary); }

code {
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: .88em;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
}

/* ---------- 코드 블록 ---------- */

pre {
    position: relative;
    margin: 0 0 18px;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    color: var(--code-text);
    background: var(--code-bg);
    border-radius: 8px;
}

pre code { padding: 0; font-size: inherit; color: inherit; background: none; border: 0; white-space: pre; }

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 10px;
    font: inherit;
    font-family: var(--font);
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
}

pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, .16); }

/* ---------- 표 ---------- */

table {
    width: 100%;
    margin: 0 0 18px;
    border-collapse: collapse;
    font-size: 14px;
    display: block;
    overflow-x: auto;
}

table th, table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table thead th { font-size: 13px; color: var(--text-sub); background: var(--bg-soft); }
table tr > th:first-child { white-space: nowrap; }
table:not(:has(thead)) th { width: 1%; color: var(--text-sub); font-weight: 600; }

.endpoints td:first-child { white-space: nowrap; }

.req {
    display: inline-block;
    padding: 0 6px;
    margin-left: 4px;
    font-size: 11px;
    color: #b42318;
    background: #fef3f2;
    border-radius: 4px;
}

/* ---------- 안내 상자 ---------- */

.callout {
    margin: 0 0 18px;
    padding: 14px 16px;
    font-size: 14px;
    border-radius: 8px;
    border-left: 4px solid;
}

.callout.info { background: #eef3fd; border-color: var(--primary); }
.callout.warn { background: #fff8eb; border-color: #f59e0b; }

/* ---------- 흐름 ---------- */

.flow {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 20px 0 24px;
}

.flow-step {
    position: relative;
    padding: 14px 12px 12px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.flow-step span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: 0 auto 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
}

/* ---------- 버튼 미리보기 ---------- */

.button-preview {
    display: flex;
    justify-content: center;
    padding: 28px;
    margin-bottom: 14px;
    background: var(--bg-soft);
    border: 1px dashed var(--line);
    border-radius: 8px;
}

.sso-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1f2329;
    text-decoration: none;
    background: #fff;
    border: 1px solid #c4c9d0;
    border-radius: 6px;
}

.sso-login-btn:hover { background: #f5f6f8; }

/* ---------- 체크리스트 ---------- */

.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-weak);
    border-radius: 4px;
}

.foot { margin-top: 32px; font-size: 13px; color: var(--text-weak); }

/* ---------- 반응형 ---------- */

@media (max-width: 860px) {
    .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
    .toc { position: static; max-height: none; padding: 20px 0 0; }
    .toc ol { display: flex; flex-wrap: wrap; gap: 4px; }
    .toc a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
    .toc a.active { border-color: var(--primary); }
    .flow { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .brand span:last-child { font-size: 13px; }
    h1 { font-size: 24px; }
}

.steps { margin: 0 0 18px; padding-left: 22px; }
.steps li { margin: 6px 0; }
