/* ============================================================
   개혁신당 AI 플랫폼 — "토스 미니멀" 디자인 토큰 + 랜딩/공용
   토큰은 :root 한 곳에서만 정의한다 (console.css 가 재사용).
   ============================================================ */

:root {
  /* ── 컬러 ── */
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --text: #191F28;
  --text-sub: #4E5968;
  --text-muted: #8B95A1;
  --border: #F2F4F6;
  --border-strong: #E5E8EB;
  --accent: #FF7210;
  --accent-hover: #E16B2C;
  --accent-soft: #FFF4EB;
  --accent-soft-active: rgba(255, 114, 16, .08);
  --accent-navy: #0B2948;
  /* 레거시 별칭 — 기존 참조 호환 */
  --blue: #FF7210;
  --blue-hover: #E16B2C;
  --blue-soft: #FFF4EB;
  --blue-soft-active: rgba(255, 114, 16, .08);
  --success: #00C471;
  --success-soft: rgba(0, 196, 113, .12);
  --danger: #F04452;
  --danger-soft: rgba(240, 68, 82, .1);
  --warn: #FFB331;
  --warn-soft: rgba(255, 179, 49, .14);

  /* ── 라운드 ── */
  --r-card: 20px;
  --r-ctl: 14px;
  --r-chip: 999px;

  /* ── 그림자 ── */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .04);
  --shadow-hover: 0 8px 24px rgba(25, 31, 40, .08);

  /* ── 모션 ── */
  --ease: cubic-bezier(.22, 1, .36, 1);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── 포커스 접근성 ── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── staggered fade-up (한 번만) ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up {
  opacity: 0;
  animation: fadeUp .5s var(--ease) forwards;
}
.fade-up:nth-child(1) { animation-delay: 0ms; }
.fade-up:nth-child(2) { animation-delay: 60ms; }
.fade-up:nth-child(3) { animation-delay: 120ms; }
.fade-up:nth-child(4) { animation-delay: 180ms; }
.fade-up:nth-child(5) { animation-delay: 240ms; }
.fade-up:nth-child(6) { animation-delay: 300ms; }

/* ============================================================
   랜딩 (비로그인) — 토스 홈페이지 풍 히어로
   ============================================================ */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* ── 상단 바 (공용 / 랜딩) ── */
header.top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.02em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  display: inline-block;
}
.beta {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: .68rem;
  padding: .2em .55em;
  border-radius: var(--r-chip);
  vertical-align: middle;
  font-weight: 700;
  letter-spacing: 0;
}
header.top nav a {
  color: var(--text-sub);
  font-weight: 600;
  font-size: .92rem;
  margin-left: 1.1rem;
}
header.top nav a:hover { color: var(--text); }

/* ── 히어로 ── */
.hero {
  position: relative;
  text-align: center;
  padding: 5.5rem 1rem 4rem;
  overflow: hidden;
}
/* 연한 블루/민트 radial blob 2개 (고정, blur) */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}
.hero::before {
  width: 520px; height: 520px;
  top: -160px; left: 50%;
  transform: translateX(-62%);
  background: rgba(255, 114, 16, .08);
}
.hero::after {
  width: 460px; height: 460px;
  top: -60px; left: 50%;
  transform: translateX(28%);
  background: rgba(11, 41, 72, .05);
}
.hero h1 {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.035em;
  margin-bottom: 1.25rem;
  animation: fadeUp .6s var(--ease) both;
}
.hero h1 .accent { color: var(--blue); }
.hero > p {
  color: var(--text-sub);
  font-size: clamp(16px, 2.4vw, 19px);
  max-width: 600px;
  margin: 0 auto 2rem;
  font-weight: 500;
  animation: fadeUp .6s var(--ease) both;
  animation-delay: 80ms;
}
.hero .sub {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 0;
  animation: fadeUp .6s var(--ease) both;
  animation-delay: 200ms;
}

/* ── CTA 필 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--blue);
  color: #fff;
  padding: 1rem 2.2rem;
  border-radius: var(--r-chip);
  font-weight: 700;
  font-size: 1.02rem;
  border: none;
  cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
  box-shadow: 0 4px 16px rgba(255, 114, 16, .28);
  animation: fadeUp .6s var(--ease) both;
  animation-delay: 140ms;
}
.btn:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255, 114, 16, .34); }
.btn:active { transform: scale(.97); }

/* ── 기능 3개 카드 ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 880px;
  margin: 3.5rem auto 0;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 1.75rem 1.5rem;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.feature-card .fc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: .35rem; letter-spacing: -.01em; }
.feature-card p { color: var(--text-sub); font-size: .9rem; line-height: 1.55; }

/* ============================================================
   공용 콘텐츠 (docs 등 head/foot 사용 페이지)
   ============================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }

button {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r-ctl);
  padding: .55rem 1.1rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  transition: background .2s var(--ease), transform .12s var(--ease);
}
button:hover { background: var(--blue-hover); }
button:active { transform: scale(.97); }
button.danger { background: var(--danger); }
button.danger:hover { background: #d8323f; }

input[type=text], input:not([type]) {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctl);
  padding: .7rem 1rem;
  font-size: .92rem;
  font-family: inherit;
  width: 100%;
  background: var(--card);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input[type=text]:focus, input:not([type]):focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
form { display: flex; gap: .6rem; }
form input { flex: 1; }

/* chat bubbles (app.js 가 .me/.ai 를 생성) */
#chat-log {
  height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  padding: 1rem;
  margin-bottom: .85rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  background: var(--bg);
}
.me {
  align-self: flex-end;
  background: #F2620A;
  color: #fff;
  padding: .65rem 1rem;
  border-radius: 18px 18px 4px 18px;
  max-width: 72%;
  word-break: break-word;
  font-size: .92rem;
  line-height: 1.5;
}
.ai {
  align-self: flex-start;
  background: var(--border);
  color: var(--text);
  padding: .65rem 1rem;
  border-radius: 18px 18px 18px 4px;
  max-width: 72%;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: .92rem;
  line-height: 1.5;
}

pre#stt-out {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  padding: 1rem;
  margin-top: .85rem;
  font-size: .875rem;
  font-family: var(--mono);
}

/* KB 결과 (app.js 가 .fact > b/p/small 생성) */
.fact {
  border-left: 3px solid var(--blue);
  padding: .75rem 1rem;
  margin: .6rem 0;
  background: var(--bg);
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
}
.fact b { font-size: .82rem; color: var(--text-sub); display: block; margin-bottom: .25rem; font-weight: 700; }
.fact p { font-size: .9rem; color: var(--text); }
.fact small { color: var(--text-muted); font-size: .78rem; }

/* ── docs-page 레거시 pre 렌더 (사용 중단, 호환 유지) ── */
.docs {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.7;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   /docs 마크다운 렌더 페이지 — .docs-page 스코프
   ============================================================ */

/* ── 미니 헤더 ── */
.docs-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.docs-header .brand { font-size: 1rem; }
.docs-title-badge {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--border);
  padding: .2em .6em;
  border-radius: var(--r-chip);
  letter-spacing: .02em;
}
.docs-dash-link {
  margin-left: auto;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
}
.docs-dash-link:hover { color: var(--accent-hover); }

/* ── 2단 레이아웃 ── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  gap: 0;
  padding: 2rem 1.5rem 5rem;
  align-items: start;
}

/* ── 사이드 TOC ── */
.docs-toc {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 1.25rem;
}
.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
}
.docs-toc li { margin: 0; }
.docs-toc a {
  display: block;
  padding: .35rem .85rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-sub);
  border-left: 2px solid transparent;
  margin-left: -2px;
  line-height: 1.4;
  transition: color .15s, border-color .15s;
}
.docs-toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ── 본문 ── */
.docs-body {
  max-width: 880px;
  min-width: 0;
  font-family: var(--font);
  line-height: 1.75;
  color: var(--text);
}

/* h1 */
.docs-body h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 0 0 1.5rem;
  line-height: 1.2;
}
/* h2 — 상단 보더 구분 */
.docs-body h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 2.5rem 0 .9rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-strong);
  color: var(--text);
}
.docs-body h2:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
/* h3 */
.docs-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.75rem 0 .6rem;
  color: var(--text);
}
/* h4 */
.docs-body h4 {
  font-size: .95rem;
  font-weight: 700;
  margin: 1.25rem 0 .4rem;
  color: var(--text-sub);
}

/* 단락 / 목록 */
.docs-body p { margin: 0 0 1rem; }
.docs-body ul, .docs-body ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}
.docs-body li { margin-bottom: .3rem; }

/* ── 표 ── */
.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  display: block;
}
.docs-body th {
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .6rem .85rem;
  border-bottom: 2px solid var(--border-strong);
}
.docs-body td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-body tr:hover td { background: var(--accent-soft-active); }

/* ── 코드 블록 ── */
.docs-body pre {
  background: var(--accent-navy);
  color: #CBD5E1;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.65;
}
.docs-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ── 인라인 코드 ── */
.docs-body code {
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: .15em .42em;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .85em;
}

/* ── blockquote ── */
.docs-body blockquote {
  border-left: 4px solid var(--accent);
  background: #FFF8F2;
  margin: 1rem 0 1.5rem;
  padding: .85rem 1.25rem;
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  color: var(--text-sub);
  font-size: .92rem;
}
.docs-body blockquote p { margin: 0; }

/* ── 체크박스 목록 ── */
.docs-body ul li input[type=checkbox] {
  accent-color: var(--accent);
  margin-right: .4rem;
  width: 14px;
  height: 14px;
}
.docs-body ul li:has(input[type=checkbox]) {
  list-style: none;
  margin-left: -1.5rem;
  padding-left: .1rem;
}

/* ── hr ── */
.docs-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── 링크 ── */
.docs-body a { color: var(--accent); }
.docs-body a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── AI 코딩 에이전트 히어로 카드 ── */
.docs-ai-card {
  background: var(--accent-navy);
  border-radius: var(--r-card);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  color: #fff;
}
.docs-ai-card-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
}
.docs-ai-card-header svg {
  flex-shrink: 0;
  color: var(--accent);
}
.docs-ai-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}
.docs-ai-card-desc {
  font-size: .88rem;
  color: rgba(255,255,255,.7);
  margin-bottom: 1rem;
  line-height: 1.55;
}
.docs-ai-prompt-wrap {
  position: relative;
  background: rgba(0,0,0,.45);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.docs-ai-prompt {
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.7;
  color: #a3e6b8;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding-right: 6.5rem;
}
.docs-ai-copy-btn {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: none;
  border-radius: var(--r-ctl);
  padding: .3rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s;
  white-space: nowrap;
}
.docs-ai-copy-btn:hover { background: rgba(255,255,255,.22); }
.docs-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}
.docs-ai-chip {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.9);
  font-size: .75rem;
  font-weight: 600;
  padding: .25em .7em;
  border-radius: var(--r-chip);
}
.docs-ai-footer {
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}
@media (max-width: 760px) {
  .docs-ai-card { padding: 1.25rem 1rem; }
  .docs-ai-prompt { padding-right: 0; }
  .docs-ai-copy-btn { position: static; display: block; margin-top: .6rem; }
}

/* ── 모바일: TOC 상단 이동 ── */
@media (max-width: 760px) {
  .docs-layout {
    grid-template-columns: 1fr;
    padding: 1rem 1rem 4rem;
  }
  .docs-toc {
    position: static;
    max-height: none;
    padding-right: 0;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
  }
  .docs-toc ul { border-left: none; display: flex; flex-wrap: wrap; gap: .3rem; }
  .docs-toc a { border-left: none; padding: .3rem .7rem; background: var(--border); border-radius: var(--r-chip); font-size: .78rem; }
  .docs-toc a:hover { background: var(--accent-soft); border-left-color: transparent; }
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
  padding: 2rem 1rem;
}
footer a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
footer a:hover { color: var(--text-sub); }

/* ── 반응형 ── */
@media (max-width: 760px) {
  .feature-grid { grid-template-columns: 1fr; max-width: 420px; }
  .hero { padding: 3.5rem 1rem 2.5rem; }
}

/* ── reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
  .fade-up, .hero h1, .hero > p, .hero .sub, .btn { opacity: 1; transform: none; }
}
