/* CAD-Coder 재현 데모 — 발표자료와 같은 팔레트(네이비 · 주황 · 슬레이트) */
:root {
  --navy: #17324d;
  --ink: #1b2733;
  --orange: #e8590c;
  --orange-dark: #c2410c;
  --slate: #5f6e80;
  --green: #2f7d6b;
  --teal: #0f766e;
  --light: #eef2f6;
  --line: #d8dfe7;
  --white: #ffffff;
  --red: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 50, 77, .06), 0 6px 18px rgba(23, 50, 77, .07);
  --font: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "D2Coding", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--white); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -.02em; }
h2 { font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -.01em; }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
code, pre, textarea.code { font-family: var(--mono); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--slate); }
.small { font-size: 13.5px; }
.mono { font-family: var(--mono); }

/* 상단 내비게이션 */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 22px; height: 56px; overflow-x: auto; white-space: nowrap; }
.nav .brand { font-weight: 800; color: var(--navy); text-decoration: none; letter-spacing: -.01em; }
.nav .brand b { color: var(--orange); }
.nav a.l { color: var(--slate); text-decoration: none; font-size: 14.5px; font-weight: 600; }
.nav a.l:hover { color: var(--orange); }
.nav .sp { flex: 1; }

/* 히어로 */
.hero { background: var(--navy); color: #fff; padding: 56px 0 48px; }
.hero h1 { color: #fff; margin-bottom: .3em; }
.hero .eyebrow { display: inline-block; background: var(--orange); color: #fff; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero p.lead { color: #cfd9e5; font-size: 18px; max-width: 760px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 15px; padding: 11px 20px; border-radius: 10px; text-decoration: none; transition: transform .08s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-dark); }
.btn.ghost { background: rgba(255, 255, 255, .12); color: #fff; }
.btn.ghost:hover { background: rgba(255, 255, 255, .22); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.dark:hover { background: #0f2438; }
.btn.light { background: var(--light); color: var(--navy); }
.btn.light:hover { background: #e1e8ef; }
.btn[disabled] { opacity: .55; cursor: wait; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 34px; }
.stat { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 30px; font-weight: 800; color: var(--orange); line-height: 1.1; }
.stat .t { font-size: 13.5px; color: var(--slate); margin-top: 4px; }
.stat .s { font-size: 12.5px; color: var(--slate); }

/* 섹션 공통 */
section.sec { padding: 64px 0 8px; }
.sec .kicker { display: inline-block; background: var(--orange); color: #fff; font-size: 12.5px; font-weight: 700; padding: 3px 11px; border-radius: 999px; margin-bottom: 10px; }
.sec .intro { color: var(--slate); max-width: 820px; margin-bottom: 26px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--light); border-radius: var(--radius); padding: 18px 20px; }
.card.white { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.callout { background: var(--light); border-radius: 10px; padding: 12px 16px; margin: 18px 0; font-size: 15px; }
.callout b.k { color: var(--orange); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--slate); }
.pill.ok { background: #e6f4ef; border-color: #bfe0d4; color: var(--green); }
.pill.bad { background: #fdecea; border-color: #f4c7c1; color: var(--red); }
.pill.warn { background: #fff3e9; border-color: #fbd3b5; color: var(--orange-dark); }

/* 파이프라인 */
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; counter-reset: step; }
.flow .step { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; }
.flow .step::before { counter-increment: step; content: counter(step); position: absolute; top: -12px; left: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.flow .step h4 { margin: 6px 0 4px; font-size: 15.5px; }
.flow .step p { font-size: 13.5px; color: var(--slate); margin: 0; }
.envbar { margin-top: 12px; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.envbar b { color: #ffd2b8; }

table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--navy); font-size: 13px; background: var(--light); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.hl td { background: #fff4ec; font-weight: 700; }
table.t td.k { color: var(--navy); font-weight: 700; white-space: nowrap; }

/* 데모 */
.demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.panel h3 { font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--orange); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--slate); }
.chip .dot.good { background: var(--green); }
.chip .dot.mid { background: #d99100; }
.chip .dot.bad { background: var(--red); }
.desc { background: var(--light); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; max-height: 150px; overflow: auto; margin-bottom: 10px; color: #33414f; }
textarea.code { width: 100%; height: 300px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.8px; line-height: 1.5; background: #fbfcfd; color: var(--ink); tab-size: 4; }
textarea.code:focus { outline: 2px solid rgba(232, 89, 12, .35); border-color: var(--orange); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.row .grow { flex: 1; }
.viewer { position: relative; width: 100%; aspect-ratio: 4 / 3; background: linear-gradient(#f6f8fb, #e9eef4); border-radius: 10px; overflow: hidden; }
.viewer canvas { width: 100%; height: 100%; display: block; }
.viewer .legend { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--slate); background: rgba(255, 255, 255, .8); padding: 2px 8px; border-radius: 6px; }
.viewer .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--slate); font-size: 14px; text-align: center; padding: 20px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--slate); }
.seg button.on { background: var(--navy); color: #fff; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.metric { background: var(--light); border-radius: 8px; padding: 8px 10px; }
.metric .v { font-size: 17px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; word-break: break-all; }
.metric .l { font-size: 11.5px; color: var(--slate); }
.metric.hot .v { color: var(--orange); }
.status { margin-top: 10px; font-size: 14px; }
.status .err { color: var(--red); font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.note { font-size: 12.5px; color: var(--slate); margin-top: 8px; }

/* GRPO 시뮬레이터 */
.bars td.bar { width: 28%; }
.hbar { position: relative; height: 16px; background: #f1f4f8; border-radius: 4px; }
.hbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.hbar i.pos { background: var(--green); left: 50%; }
.hbar i.neg { background: var(--red); right: 50%; }
.hbar .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--slate); }
.hbar.one i { background: var(--orange); left: 0; }
.slider { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.slider input[type=range] { flex: 1; accent-color: var(--orange); }

/* 차트 (SVG) */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--slate); font-size: 11px; }
.chart .ax { stroke: var(--line); }
.chart .tt { fill: var(--navy); font-size: 12.5px; font-weight: 700; }
.legendline { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--slate); margin: 6px 0 0; }
.legendline i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.list { margin: 0; padding-left: 1.2em; }
.list li { margin: .35em 0; }
.tag-ok::before { content: "✔ "; color: var(--green); font-weight: 800; }
.tag-no::before { content: "✘ "; color: var(--red); font-weight: 800; }
.tag-info::before { content: "▸ "; color: var(--orange); font-weight: 800; }
ul.plain { list-style: none; padding-left: 0; margin: 0; }
ul.plain li { margin: .45em 0; }

footer.foot { margin-top: 72px; background: var(--light); padding: 28px 0 40px; color: var(--slate); font-size: 14px; }
footer.foot a { color: var(--navy); }

.card.white, .panel { overflow-x: auto; }
.grid2 > *, .grid3 > *, .flow > * { min-width: 0; }
@media (max-width: 900px) {
  .demo, .grid2, .grid3, .flow { grid-template-columns: minmax(0, 1fr); }
  table.t { font-size: 13px; }
  table.t th, table.t td { padding: 6px 7px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  section.sec { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .spin { animation: none; } }
