/*
 * AUIPivot 첫 화면 스타일 (auigrid.com 의 home.css 와 같은 구조, 기준색만 남색)
 *
 * 구성 순서
 *   1. 디자인 토큰 (색상, 경계선)
 *   2. 기본 요소
 *   3. 사이트 헤더
 *   4. 히어로 (페이지 제목)
 *   5. 피벗 데모 (창, 도구 모음, 측정값, 피벗 + 필드 패널)
 *   6. 본문 섹션 (프레임워크, AI/MCP, 빠른 시작, API, 가격, FAQ)
 *   7. 사이트 푸터
 *   8. 반응형
 */

/* 1. 디자인 토큰 ---------------------------------------------------------- */
/* 기준 색: #1f4e79 (auisoft.net 의 AUIPivot 아이콘 색). */
:root {
  --color-primary: #1f4e79;
  --color-primary-dark: #163a5a;
  --color-primary-soft: #e8eff6;
  --color-accent: #337ab7;
  --color-accent-soft: #eaf2f9;
  --color-error: #c23a3a;
  --color-ink: #1c2733;
  --color-muted: #5a6878;
  --color-line: #dde6ef;
  --color-surface-soft: #f4f8fb;
}

/* 상단 헤더 · 푸터만 차콜(#222729) 계열을 씁니다(auigrid.com 과 같은 톤). */
.site-header, .site-footer {
  --color-primary: #222729;
  --color-primary-dark: #3b4347;
  --color-ink: #222729;
  --color-muted: #5f6a70;
  --color-line: #e2e5e7;
}

/* 2. 기본 요소 ------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body { margin: 0; font-family: "Inter", "Segoe UI", system-ui, sans-serif; color: var(--color-ink); background: #fff; }
a { color: inherit; text-decoration: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 22px; border-radius: 8px;
  font-weight: 700; font-size: 15px; border: 1px solid transparent; cursor: pointer;
}
.button--small { height: 36px; padding: 0 16px; font-size: 14px; }
.button--primary { background: var(--color-primary); color: #fff; }
.button--primary:hover { background: var(--color-primary-dark); }

/* 3. 사이트 헤더 ---------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-line);
}
.site-header__inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
/* 3×3 마크: 첫 행과 첫 열(행·열 레이블)은 옅게, 나머지(값)는 진하게 */
.brand__mark {
  width: 28px; height: 28px; border-radius: 6px; background: #1f4e79;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px;
}
.brand__mark span { background: #fff; border-radius: 1px; }
.brand__mark span:nth-child(-n+3), .brand__mark span:nth-child(3n+1) { opacity: .55; }
.site-header nav { margin-left: auto; }

/* 4. 히어로 -------------------------------------------------------------- */
.hero {
  background:
    radial-gradient(600px 300px at 20% -5%, var(--color-accent-soft) 0%, transparent 70%),
    radial-gradient(900px 400px at 50% -10%, var(--color-primary-soft) 0%, transparent 70%);
  padding: 64px 24px 24px; text-align: center;
}
.hero__title {
  font-size: clamp(28px, 4.2vw, 48px); line-height: 1.25; margin: 20px auto 32px; max-width: 1140px;
  font-weight: 800; letter-spacing: -1px; text-wrap: balance;
}
.hero__title .hero__accent { color: var(--color-primary); }
.hero__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; font-size: 14.5px; font-weight: 600; }
.hero__links a { color: var(--color-primary); padding: 4px 0; border-bottom: 1px solid transparent; }
.hero__links a:hover { border-bottom-color: currentColor; }

/* 5. 피벗 데모 ------------------------------------------------------------ */
/* 피벗 보고서는 열이 많지 않아 아래 본문 섹션과 같은 폭(1352px)으로 둡니다. */
.demo { max-width: 1352px; margin: 36px auto 0; padding: 0 24px; }

.demo-window {
  border: 1px solid var(--color-line); border-radius: 12px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(31, 78, 121, .12); background: #fff;
}

.demo-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px;
  border-bottom: 1px solid var(--color-line); font-size: 13px; color: var(--color-muted);
}
.demo-toolbar label { display: flex; align-items: center; gap: 6px; }
.demo-toolbar select, .demo-toolbar button {
  font: inherit; font-size: 13px; height: 30px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--color-line); background: #fff; color: var(--color-ink); cursor: pointer;
}
/* 보고서 선택이 주 조작이므로 강조합니다. */
.demo-toolbar .demo-toolbar__main { color: var(--color-ink); font-weight: 600; }
.demo-toolbar .demo-toolbar__main select { min-width: 230px; border-color: var(--color-primary); font-weight: 600; }
.demo-toolbar__check { cursor: pointer; }
.demo-toolbar__check input { margin: 0; accent-color: var(--color-primary); }
.demo-toolbar .demo-toolbar__code { margin-left: auto; font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.demo-toolbar .demo-toolbar__code[aria-expanded="true"] { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.demo-toolbar__divider { width: 1px; height: 20px; background: var(--color-line); }
.demo-toolbar :disabled { opacity: .5; cursor: default; }

/* View code 패널 */
.demo-code { border-bottom: 1px solid var(--color-line); background: #1e2329; color: #e6e9eb; }
.demo-code__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px;
  font-size: 12px; color: #9aa6ad; border-bottom: 1px solid #2f363b;
}
.demo-code__bar button {
  font: inherit; font-weight: 700; height: 28px; padding: 0 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid #4a535a; background: #2a3035; color: #fff;
}
.demo-code__bar button:hover { background: #343b41; }
.demo-code pre {
  margin: 0; padding: 12px 14px; max-height: 360px; overflow: auto;
  font: 12.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 2;
}
.demo-code .code-comment { color: #7f8c94; }
.demo-code .code-string { color: #9fd3a8; }

.demo-status {
  margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--color-line);
  font-size: 13px; color: var(--color-muted); background: var(--color-surface-soft);
}
.demo-status.is-error { color: var(--color-error); }

.demo-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-bottom: 1px solid var(--color-line); }
.demo-metrics div { padding: 8px 14px; border-right: 1px solid var(--color-line); }
.demo-metrics div:last-child { border-right: 0; }
.demo-metrics dt { font-size: 11px; color: var(--color-muted); }
.demo-metrics dd { margin: 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 피벗(왼쪽) + 필드 패널(오른쪽). 패널은 AUIPivot 이 pivotPanelId 영역에 직접 그립니다. */
.demo-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 620px; }
.demo-body.is-panel-hidden { grid-template-columns: minmax(0, 1fr); }
.demo-body.is-panel-hidden .demo-panel { display: none; }
.demo-pivot { width: 100%; height: 620px; min-width: 0; }
.demo-panel { width: 340px; height: 620px; border-left: 1px solid var(--color-line); min-width: 0; overflow: hidden; }
/* 엔진이 패널 영역에 position:absolute 와 계산한 left/top 을 넣어 떠 있는 패널로 만듭니다.
   위쪽 내용(View code 등)이 열리면 위치가 어긋나므로 그리드 칸 안에 고정하고, 안쪽 폭은 칸에 맞춥니다. */
/* 엔진이 패널 안쪽에 z-index 1049 를 주므로, 패널을 z-index 1 의 쌓임 맥락으로 묶어 고정 헤더(z-index 10) 아래에 둡니다. */
#demo-panel { position: relative !important; left: auto !important; top: auto !important; z-index: 1 !important; }
.demo-pivot { position: relative; z-index: 1; }
#demo-panel > * { width: 100% !important; height: 100% !important; box-sizing: border-box; }

.demo-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 14px;
  border-top: 1px solid var(--color-line); background: var(--color-surface-soft);
  font-size: 12px; color: var(--color-muted); font-variant-numeric: tabular-nums;
}
.demo-footer p { margin: 0; }
.demo-noscript { margin: 0; padding: 24px; font-size: 14px; line-height: 1.7; color: var(--color-muted); }

/* 6. 본문 섹션 ------------------------------------------------------------ */
.stacks, .ai, .starter, .api, .pricing, .faq { max-width: 1352px; margin: 56px auto 0; padding: 0 24px; }
.stacks { margin-top: 48px; }
.section-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.section-lead { margin: 0 0 18px; color: var(--color-muted); font-size: 15px; line-height: 1.65; max-width: 900px; }
.section-lead a, .ai__note a, .faq a, .ai-way a, .pricing-card a, .starter__notice a { color: var(--color-accent); }
.section-lead code, .setup p code, .prompt-list code, .faq code, .stack code {
  font-size: .88em; background: var(--color-surface-soft); padding: 1px 5px; border-radius: 4px;
}

/* 6-1. 지원 프레임워크 */
.stacks__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stack { border: 1px solid var(--color-line); border-radius: 12px; padding: 18px; background: #fff; }
.stack h3 { margin: 12px 0 6px; font-size: 16px; }
.stack p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--color-muted); }
.stack__icon {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  font: 800 15px/1 ui-monospace, Consolas, monospace;
}
.stack__icon--js { background: #f7df1e; color: #222; }
.stack__icon--ts { background: #3178c6; color: #fff; }
.stack__icon--react { background: #20232a; color: #61dafb; }
.stack__icon--vue { background: #f1f8f4; }

/* 6-2. 코드 블록 */
.code {
  margin: 0; padding: 12px 14px; overflow: auto; border-radius: 8px; background: #1e2329; color: #e6e9eb;
  font: 12.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 2; max-width: 100%;
}
.code-card { border-radius: 12px; overflow: hidden; background: #1e2329; }
.code-card .code { border-radius: 0; max-height: 520px; }
.code-card__bar {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 14px;
  font: 12px ui-monospace, Consolas, monospace; color: #9aa6ad; border-bottom: 1px solid #2f363b;
}
.code-card__bar button, .copy-line button {
  font-family: "Inter", system-ui, sans-serif; font-size: 12px; font-weight: 700; height: 28px; padding: 0 12px;
  border-radius: 6px; cursor: pointer; border: 1px solid #4a535a; background: #2a3035; color: #fff;
}
.code-card__bar button:hover, .copy-line button:hover { background: #343b41; }

/* 6-3. AI / MCP */
.ai__ways { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ai-way { border: 1px solid var(--color-line); border-radius: 12px; padding: 18px; background: #fff; }
.ai-way h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-way p { margin: 0 0 12px; font-size: 13.5px; color: var(--color-muted); }
.ai-way__tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--color-primary-soft); color: var(--color-primary);
}
.copy-line {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: #1e2329; border-radius: 8px; padding: 6px 6px 6px 14px;
}
.copy-line code { color: #9fd3a8; font: 14px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; overflow-x: auto; white-space: nowrap; }
.copy-line button { flex: none; }
.ai__subtitle { margin: 28px 0 10px; font-size: 16px; font-weight: 800; }
.ai__tools { display: grid; gap: 8px; }
/* 긴 코드 한 줄 때문에 휴대폰에서 페이지가 넓어지지 않게 칸을 화면 폭에 맞춥니다. */
.ai__tools > *, .ai__facts > *, .ai__ways > *, .copy-line code { min-width: 0; }
.setup { border: 1px solid var(--color-line); border-radius: 10px; background: #fff; }
.setup summary { cursor: pointer; padding: 12px 16px; font-weight: 700; font-size: 14.5px; }
.setup[open] summary { border-bottom: 1px solid var(--color-line); }
.setup p { margin: 12px 16px 8px; font-size: 13.5px; color: var(--color-muted); }
.setup .code { margin: 0 16px 14px; }
.ai__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.tool-list { margin: 0; border: 1px solid var(--color-line); border-radius: 10px; overflow: hidden; }
.tool-list div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--color-line); font-size: 13.5px; }
.tool-list div:first-child { border-top: 0; }
.tool-list dt code { font: 600 13px ui-monospace, Consolas, monospace; color: var(--color-primary); }
.tool-list dd { margin: 0; color: var(--color-muted); }
.prompt-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.prompt-list li + li { margin-top: 8px; }
.ai__note { margin: 16px 0 0; font-size: 13px; line-height: 1.6; color: var(--color-muted); }

/* 6-4. 빠른 시작 */
.starter__notice {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; font-size: 14px; line-height: 1.65;
  background: #fff8e6; border: 1px solid #f1d58a; color: #5c4a14;
}
.starter__notice code { font-size: .88em; background: rgba(255, 255, 255, .7); padding: 1px 5px; border-radius: 4px; }
.ai-notes { border-left: 3px solid var(--color-primary); background: var(--color-surface-soft); border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 0 0 16px; }
.ai-notes h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.ai-notes ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.65; }
.ai-notes li + li { margin-top: 4px; }
.ai-notes code { font-size: .88em; background: #fff; padding: 1px 5px; border-radius: 4px; }

/* 6-5. API 요약 */
.api__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.api__grid > * { min-width: 0; }
.api-card { border: 1px solid var(--color-line); border-radius: 12px; background: #fff; overflow: hidden; }
.api-card h3 { margin: 0; padding: 12px 14px; font-size: 15px; font-weight: 800; border-bottom: 1px solid var(--color-line); background: var(--color-surface-soft); }
.api-card__note { font-weight: 500; font-size: 12.5px; color: var(--color-muted); }
.api-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.api-card tr + tr { border-top: 1px solid var(--color-line); }
.api-card th, .api-card td { padding: 8px 14px; text-align: left; vertical-align: top; }
.api-card th { font-weight: 400; width: 46%; }
.api-card th code { font: 600 12.5px ui-monospace, Consolas, monospace; color: var(--color-primary); overflow-wrap: anywhere; }
.api-card td { color: var(--color-muted); }
.api-card td code { font-size: .9em; background: var(--color-surface-soft); padding: 0 4px; border-radius: 3px; }
/* 해당 버전에서 새로 생긴 API 표시 */
.api-new {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; vertical-align: 1px;
  font: 700 10.5px/1.6 "Inter", system-ui, sans-serif; background: var(--color-primary-soft); color: var(--color-primary);
}

/* 6-6. 가격·라이선스 */
.pricing__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pricing__grid > * { min-width: 0; }
.pricing-card { border: 1px solid var(--color-line); border-radius: 12px; padding: 18px 20px; background: #fff; }
.pricing-card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.pricing-card ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; color: var(--color-muted); }
.pricing__more {
  margin-top: 14px; padding: 16px 20px; border-radius: 12px; background: var(--color-primary-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; font-size: 14.5px;
}
.pricing__more p { margin: 0; }

/* 6-7. FAQ */
.faq details { border-bottom: 1px solid var(--color-line); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 15px; }
.faq details p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.7; color: var(--color-muted); max-width: 900px; }

/* 6-8. 404 페이지 (404.html) */
.not-found {
  min-height: calc(100vh - 220px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 64px 24px 24px;
  background: radial-gradient(900px 400px at 50% -10%, var(--color-primary-soft) 0%, transparent 70%);
}
.not-found__code { margin: 0; font-size: clamp(72px, 14vw, 120px); font-weight: 800; letter-spacing: -4px; line-height: 1; color: var(--color-primary); }
.not-found__title { margin: 12px 0 8px; font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -.5px; }
.not-found__lead { margin: 0 0 24px; max-width: 560px; color: var(--color-muted); font-size: 15.5px; line-height: 1.65; }
.not-found__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-top: 22px; font-size: 14.5px; font-weight: 600; }
.not-found__links a { color: var(--color-primary); padding: 4px 0; border-bottom: 1px solid transparent; }
.not-found__links a:hover { border-bottom-color: currentColor; }
.not-found__ai { margin: 28px 0 0; font-size: 13px; color: var(--color-muted); }
.not-found__ai a { color: var(--color-accent); }
.not-found__ai code { font-size: .92em; background: var(--color-surface-soft); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

/* 7. 사이트 푸터 ---------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-line); padding: 24px; margin-top: 56px; text-align: center;
  font-size: 13px; color: var(--color-muted);
}
.site-footer a { color: var(--color-ink); }

/* 8. 반응형 -------------------------------------------------------------- */
@media (max-width: 1100px) {
  .stacks__list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .stacks, .ai, .starter, .api, .faq, .pricing { padding: 0 16px; }
  .pricing__grid, .api__grid, .ai__ways, .ai__facts { grid-template-columns: 1fr; }
  .api-card th, .api-card td { display: block; width: auto; padding: 0; }
  .api-card tr { display: block; padding: 8px 14px; }
  .api-card td { padding-top: 2px; }
  .tool-list div { grid-template-columns: 1fr; gap: 2px; }
  .site-header__inner { justify-content: space-between; padding: 0 16px; }
  .hero { padding: 48px 16px 24px; }
  .demo { padding: 0 16px; }
  .demo-toolbar .demo-toolbar__code { margin-left: 0; }
  .demo-metrics { grid-template-columns: 1fr 1fr; }
  .demo-metrics div { border-bottom: 1px solid var(--color-line); }
  /* 좁은 화면: 필드 패널을 피벗 아래로 내립니다. */
  .demo-body, .demo-body.is-panel-hidden { grid-template-columns: minmax(0, 1fr); height: auto; }
  .demo-pivot { height: 480px; }
  .demo-panel { width: 100%; height: 460px; border-left: 0; border-top: 1px solid var(--color-line); }
}
@media (max-width: 560px) {
  .stacks__list { grid-template-columns: 1fr; }
}
