/* AI API Index — 플랫 다크 디자인 토큰 */
:root {
  --bg: #0a0a0b;
  --bg-soft: #111113;
  --surface: #131316;
  --surface-strong: #1b1b1f;
  --border: #232329;
  --border-strong: #3a3a44;
  --text: #ececee;
  --text-sub: #9b9ba4;
  --text-faint: #63636d;
  --accent: #7c66f0;
  --accent-hover: #8d79f5;
  --accent-soft: rgba(124, 102, 240, 0.16);
  --accent-strong: #a394ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  /* 차트 시리즈 (다크 서피스 검증 완료) */
  --series-1: #3987e5;
  --series-2: #199e70;
  --series-3: #c98500;
  --series-4: #008300;
  --series-5: #9085e9;
  --series-6: #e66767;
  --series-7: #d55181;
  --series-8: #d95926;
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ── 헤더 ─────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header .container { display: flex; align-items: center; gap: 28px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.nav { display: flex; gap: 2px; margin-inline-start: auto; }
.nav a {
  color: var(--text-sub); font-size: 13.5px; padding: 7px 10px; border-radius: var(--r-md); white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-strong); text-decoration: none; }
.lang-select {
  margin-inline-start: 10px; background: var(--surface-strong); color: var(--text-sub);
  border: none; border-radius: var(--r-md); padding: 7px 10px; font-size: 13px;
  font-family: inherit; cursor: pointer;
}
.lang-select:focus { outline: 1px solid var(--border-strong); }

/* ── 컴팩트 페이지 헤드 ─────────────── */
.page-head { padding: 96px 0 8px; }
.page-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { margin-top: 8px; color: var(--text-sub); font-size: 15px; max-width: 640px; }
.page-stats { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--text-faint); }
.page-stat b { color: var(--text); font-weight: 700; }
.page-dot { color: var(--text-faint); }

/* ── 섹션 공통 ─────────────────────── */
section.block { padding: 56px 0; }
section.block-first { padding-top: 28px; }
.section-head { margin-bottom: 26px; }
.section-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.section-head p { color: var(--text-sub); margin-top: 6px; font-size: 14.5px; }

.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); padding: 22px;
}

/* ── 광고 슬롯 ─────────────────────── */
.ad-slot { margin: 26px auto; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-slot ins.adsbygoogle { display: block; width: 100%; }
.ad-placeholder {
  width: 100%; min-height: 90px; border-radius: var(--r-lg);
  background: var(--bg-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.ad-placeholder b { font-size: 12px; color: var(--text-faint); font-weight: 600; letter-spacing: .08em; }
.ad-placeholder span { font-size: 11.5px; color: var(--text-faint); }

/* ── 사이드레일 광고 (넓은 화면 전용, 스크롤 고정) ── */
.side-rail {
  position: fixed; top: 84px; width: 160px; z-index: 30; display: none;
}
.rail-left  { left:  calc(50vw - 752px); }
.rail-right { right: calc(50vw - 752px); }
.side-rail .ad-placeholder { min-height: 600px; }
.side-rail ins.adsbygoogle { display: block; width: 160px; height: 600px; }
@media (min-width: 1560px) { .side-rail { display: block; } }
aside.side-rail:empty { display: none; } /* 사용하지 않는 쪽 레일 숨김 */

/* ── 필터/컨트롤 ───────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.chip {
  padding: 6px 13px; border-radius: var(--r-md); font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text-sub); cursor: pointer; border: none;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; }
.chip:hover { background: var(--surface-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent-strong); }
.search-input {
  margin-inline-start: auto; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-md); padding: 8px 12px; font-size: 13.5px; width: 200px; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--border-strong); }
.search-input::placeholder { color: var(--text-faint); }

/* ── 비교 테이블 ───────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 980px; }
table.cmp th {
  position: sticky; top: 0; background: var(--surface-strong); color: var(--text-sub);
  font-size: 12px; font-weight: 600; text-align: right; padding: 11px 12px; white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.cmp th:first-child { text-align: left; padding-left: 16px; }
table.cmp th .arrow { color: var(--accent-strong); margin-left: 3px; }
table.cmp td { padding: 10px 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
table.cmp td:first-child { text-align: left; padding-left: 16px; }
table.cmp tbody tr:nth-child(even) { background: var(--bg-soft); }
table.cmp tbody tr:hover { background: var(--surface-strong); }
.model-cell { display: flex; align-items: center; gap: 9px; }
.model-cell i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.model-cell .mn { font-weight: 650; }
.model-cell .pv { color: var(--text-faint); font-size: 12px; }
.tag { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-strong); margin-left: 6px; vertical-align: 1px; }
td.na { color: var(--text-faint); }
.table-note { color: var(--text-faint); font-size: 12.5px; margin-top: 10px; }

/* ── 차트 ─────────────────────────── */
.chart-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 1px 3px rgba(0,0,0,.35); padding: 22px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-sub); }
.chart-legend .lg i { width: 8px; height: 8px; border-radius: 50%; }
.chart-svg text { font-family: inherit; }
.chart-source { margin-top: 12px; font-size: 11.5px; color: var(--text-faint); }
.chart-source a { color: var(--text-faint); text-decoration: underline; }
.chart-source a:hover { color: var(--text-sub); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tab-btn {
  padding: 7px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 600;
  background: transparent; color: var(--text-sub); border: 1px solid var(--border); cursor: pointer;
}
.tab-btn:hover { background: var(--surface-strong); color: var(--text); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.viz-tooltip {
  position: fixed; z-index: 90; pointer-events: none; background: var(--surface-strong);
  border-radius: var(--r-md); box-shadow: 0 6px 20px rgba(0,0,0,.5);
  padding: 10px 12px; font-size: 12.5px; color: var(--text); max-width: 260px; display: none;
}
.viz-tooltip b { display: block; margin-bottom: 3px; }
.viz-tooltip .tt-sub { color: var(--text-sub); }

/* ── 모델 비교(최대 4개) ─────────────── */
.compare-pickers { gap: 14px; }
.compare-slot { display: flex; flex-direction: column; gap: 5px; flex: 1 1 180px; min-width: 160px; }
.compare-slot span { font-size: 12px; font-weight: 600; color: var(--text-faint); }
.compare-slot select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-md); padding: 8px 10px; font-size: 13.5px; font-family: inherit; width: 100%;
}
.compare-slot select:focus { outline: none; border-color: var(--border-strong); }
.compare-grid { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 6px; }
table.compare-table { min-width: 640px; }
table.compare-table td.best { color: var(--accent-strong); font-weight: 700; }
table.compare-table td.spec-label { text-align: start; color: var(--text-sub); font-weight: 600; white-space: nowrap; }
table.compare-table th.cmp-model { text-align: start; }

/* ── 계산기 ───────────────────────── */
.calc-grid { display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }
.calc-grid table.cmp { min-width: 0; }
.calc-field { margin-bottom: 16px; }
.calc-field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; font-weight: 600; }
.calc-field input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-md); padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.calc-field input:focus { outline: none; border-color: var(--border-strong); }
.calc-hint { font-size: 12px; color: var(--text-faint); }

/* ── 가이드/FAQ ───────────────────── */
.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.guide-item { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 1px 3px rgba(0,0,0,.35); padding: 18px 20px; }
.guide-item h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.guide-item h3 small { color: var(--text-faint); font-weight: 500; font-size: 12px; margin-left: 6px; }
.guide-item p { font-size: 13.5px; color: var(--text-sub); }
details.faq { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 1px 3px rgba(0,0,0,.35); padding: 16px 20px; margin-bottom: 10px; }
details.faq summary { font-weight: 650; font-size: 14.5px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.faq summary::after { content: "+"; color: var(--text-faint); font-size: 18px; }
details.faq[open] summary::after { content: "−"; }
details.faq p { margin-top: 10px; color: var(--text-sub); font-size: 14px; }
ul.data-notes { margin: 12px 0 0 18px; }
ul.data-notes li { color: var(--text-sub); font-size: 13.5px; margin-bottom: 7px; }

/* ── 푸터 ─────────────────────────── */
.site-footer { padding: 44px 0 56px; margin-top: 40px; background: var(--bg-soft); }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-size: 13px; color: var(--text); margin-bottom: 10px; }
.site-footer p, .site-footer li { font-size: 13px; color: var(--text-faint); }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--text-sub); }
.footer-note { margin-top: 28px; font-size: 12px; color: var(--text-faint); }

/* ── RTL(아랍어 등): 데이터 뷰는 LTR 유지 ── */
[dir="rtl"] .table-wrap, [dir="rtl"] .chart-card { direction: ltr; }

/* ── 반응형 ───────────────────────── */
@media (max-width: 1080px) {
  .nav { display: none; }
}
@media (max-width: 900px) {
  .page-head { padding-top: 84px; }
  .page-head h1 { font-size: 26px; }
  .calc-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .search-input { margin-left: 0; width: 100%; }
}
