/* CCTV Calc Place — Carbon Navy (KR)
   기준: awesome-design-md/design-md/carbon-navy-kr/DESIGN.md
   평면 · 직각 · 그림자 없음 · 회색 층 · 강조색은 네이비 하나 */

:root {
  --c-text: #161616;
  --c-text-2: #525252;
  --c-text-3: #6f6f6f;
  --c-text-4: #c6c6c6;
  --c-layer: #f4f4f4;
  --c-layer-hov: #e8e8e8;
  --c-border: #e0e0e0;
  --c-border-2: #8d8d8d;
  --c-brand: #163a6e;
  --c-brand-hov: #102c56;
  --c-brand-50: #eef2f8;
  --c-brand-100: #d9e2ef;
  --c-error: #da1e28;
  --font-sans: "Pretendard Variable", Pretendard, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
* { -webkit-font-smoothing: antialiased; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: #fff;
  letter-spacing: -0.003em;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
table { border-collapse: collapse; }

.mono, .font-mono { font-family: var(--font-mono); letter-spacing: 0; }
.muted { color: var(--c-text-2); }
.faint { color: var(--c-text-3); }
.nowrap { white-space: nowrap; }
.num { font-family: var(--font-mono); letter-spacing: 0; text-align: right; white-space: nowrap; }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.band { border-bottom: 1px solid var(--c-border); }
.band-layer { background: var(--c-layer); border-bottom: 1px solid var(--c-border); }
.section { padding: 40px 0; }
.section-sm { padding: 24px 0; }
.stack > * + * { margin-top: 24px; }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--c-border);
}
.site-header .wrap { display: flex; align-items: stretch; justify-content: space-between; height: 48px; gap: 16px; }
.brand { display: flex; align-items: center; font-size: 15px; white-space: nowrap; }
.brand b { font-weight: 600; }
.brand span { margin-left: 6px; color: var(--c-text-2); }
.site-nav { display: flex; align-items: stretch; margin-left: 24px; }
.header-left { display: flex; align-items: stretch; }
.nav-link {
  display: flex; align-items: center; padding: 0 16px; font-size: 14px; color: var(--c-text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.nav-link:hover { color: var(--c-text); background: var(--c-layer); }
.nav-link.is-active { color: var(--c-text); font-weight: 600; border-bottom-color: var(--c-brand); }
.nav-btn {
  display: none; align-items: center; align-self: center; height: 32px; padding: 0 12px;
  font-size: 14px; background: none; border: 0; cursor: pointer;
}
.nav-btn:hover { background: var(--c-layer-hov); }
.drawer { display: none; border-top: 1px solid var(--c-border); background: #fff; }
.drawer a { display: flex; align-items: center; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--c-border); font-size: 14px; }
.drawer a.is-active { font-weight: 600; box-shadow: inset 3px 0 0 var(--c-brand); }
.drawer.is-open { display: block; }
@media (max-width: 900px) {
  .site-nav { display: none; }
  .nav-btn { display: flex; }
}

/* ---------- 페이지 제목 띠 ---------- */
.page-head .wrap { padding-top: 32px; padding-bottom: 24px; }
.page-title { font-size: 28px; font-weight: 300; line-height: 1.25; }
.page-desc { margin-top: 6px; font-size: 14px; color: var(--c-text-2); max-width: 720px; }

/* 안내 띠 */
.notice { background: var(--c-brand-50); border-bottom: 1px solid var(--c-brand-100); }
.notice .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding-top: 10px; padding-bottom: 10px; font-size: 13px; }
.notice b { font-weight: 600; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; font-size: 14px; font-weight: 500; line-height: 1;
  border: 1px solid transparent; border-radius: 0; white-space: nowrap; cursor: pointer;
  transition: background-color .1s ease, color .1s ease;
}
.btn-primary { background: var(--c-brand); color: #fff; }
.btn-primary:hover { background: var(--c-brand-hov); }
.btn-secondary { background: #fff; color: var(--c-brand); border-color: var(--c-brand); }
.btn-secondary:hover { background: var(--c-brand-50); }
.btn-ghost { background: transparent; color: var(--c-brand); }
.btn-ghost:hover { background: var(--c-layer-hov); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:focus-visible { outline: 2px solid var(--c-brand); outline-offset: -2px; box-shadow: inset 0 0 0 3px #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.link { color: var(--c-brand); }
.link:hover { color: var(--c-brand-hov); text-decoration: underline; }

/* ---------- 입력 ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 960px) { .fields-4, .fields-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .fields, .fields-3, .fields-4, .fields-5 { grid-template-columns: minmax(0, 1fr); }
}
.field-label { display: block; font-size: 12px; color: var(--c-text-2); letter-spacing: .02em; margin-bottom: 8px; }
.field-input {
  display: block; width: 100%; height: 40px; padding: 0 16px; font-size: 14px; color: var(--c-text);
  background: var(--c-layer); border: 0; border-bottom: 1px solid var(--c-border-2); border-radius: 0;
  appearance: none; -webkit-appearance: none;
}
select.field-input {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 11 3 6l.7-.7L8 9.6l4.3-4.3.7.7z' fill='%23161616'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field-input::placeholder { color: var(--c-text-3); }
.field-input:focus { outline: 2px solid var(--c-brand); outline-offset: -2px; border-bottom-color: transparent; }
.on-layer .field-input { background: #fff; }
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--c-text-3); }

/* 숫자 증감 */
.stepper { display: flex; }
.stepper .field-input { text-align: center; font-family: var(--font-mono); letter-spacing: 0; padding: 0 8px; }
.stepper button {
  flex: 0 0 40px; height: 40px; border: 0; border-bottom: 1px solid var(--c-border-2);
  background: var(--c-layer); cursor: pointer; font-size: 16px; color: var(--c-text-2);
}
.stepper button:hover { background: var(--c-layer-hov); color: var(--c-text); }
.on-layer .stepper button { background: #fff; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* 슬라이더 */
.range-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.range-head .field-label { margin: 0; }
.range-value { font-family: var(--font-mono); font-size: 14px; }
.range-foot { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--c-text-3); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--c-border-2); }
input[type=range]::-moz-range-track { height: 2px; background: var(--c-border-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--c-brand); border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--c-brand); border: 0; }
input[type=range]:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }

/* 체크 칸 (HDD 용량 선택) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); }
.check-cell { position: relative; display: flex; align-items: center; justify-content: center; height: 48px; background: #fff; cursor: pointer; font-family: var(--font-mono); font-size: 14px; user-select: none; }
.check-cell input { position: absolute; opacity: 0; pointer-events: none; }
.check-cell:hover { background: var(--c-layer-hov); }
.check-cell.is-on { background: var(--c-brand); color: #fff; }

/* ---------- 계산기 2단 ---------- */
.calc-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: start; }
.calc-aside { position: sticky; top: 72px; }
@media (max-width: 960px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .calc-aside { position: static; }
}
.panel { border: 1px solid var(--c-border); background: #fff; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--c-border); }
.panel-title { font-size: 16px; font-weight: 400; }
.panel-body { padding: 24px 16px; }
.panel-layer { background: var(--c-layer); border-color: var(--c-layer); }

.section-title { font-size: 20px; font-weight: 400; margin-bottom: 16px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; margin-bottom: 16px; }
.section-head .section-title { margin: 0; }

/* 결과 숫자 */
.result-main { padding: 24px 16px; background: var(--c-layer); }
.result-label { font-size: 13px; color: var(--c-text-2); }
.result-value { margin-top: 4px; font-family: var(--font-mono); font-size: 40px; font-weight: 300; line-height: 1.15; letter-spacing: -0.01em; }
.result-value small { font-size: 20px; margin-left: 4px; color: var(--c-text-2); }
.result-sub { margin-top: 6px; font-size: 13px; color: var(--c-text-2); }

/* 정의 목록 */
.kv { border-top: 1px solid var(--c-border); }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--c-border); }
.kv dt { font-size: 13px; color: var(--c-text-3); }
.kv dd { font-size: 14px; text-align: right; }
.kv-flush > div { padding-left: 0; padding-right: 0; }

/* 타일 격자 */
.tiles { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); }
.tile { background: #fff; padding: 16px; }
.tile-label { font-size: 13px; color: var(--c-text-2); }
.tile-value { margin-top: 4px; font-family: var(--font-mono); font-size: 24px; font-weight: 300; line-height: 1.2; }
.tile-value small { font-size: 13px; margin-left: 2px; color: var(--c-text-2); }
.tile-note { margin-top: 4px; font-size: 12px; color: var(--c-text-3); }
.tile.is-brand { background: var(--c-brand); color: #fff; }
.tile.is-brand .tile-label, .tile.is-brand .tile-note, .tile.is-brand small { color: var(--c-brand-100); }
.tile.is-off { background: var(--c-layer); color: var(--c-text-3); }
@media (max-width: 900px) { .tiles { --cols: 2 !important; } }

/* 표 */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); }
.data-table { width: 100%; font-size: 14px; }
.data-table th { background: var(--c-border); font-weight: 600; font-size: 13px; text-align: left; padding: 12px; white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--c-layer); }
.data-table .num { text-align: right; }
.data-table tfoot td { padding: 12px; border-top: 1px solid var(--c-border-2); font-weight: 600; }

/* 태그 */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; font-size: 12px; border-radius: 1rem; background: var(--c-layer-hov); color: var(--c-text-2); white-space: nowrap; }
.tag-brand { background: var(--c-brand-50); color: var(--c-brand); }

/* 부하 막대 */
.meter { margin-top: 24px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.meter-value { font-family: var(--font-mono); font-size: 20px; font-weight: 300; }
.meter-track { height: 8px; background: var(--c-border); }
.meter-fill { height: 100%; width: 0; background: var(--c-brand); transition: width .2s ease; }
.meter-fill.is-over { background: var(--c-error); }
.meter-note { margin-top: 8px; font-size: 13px; color: var(--c-text-2); }
.meter-note.is-over { color: var(--c-error); }

/* 줄 목록 */
.line-list { border-top: 1px solid var(--c-border); }
.line-list li { border-bottom: 1px solid var(--c-border); }
.line-list a, .line-list .line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 24px; padding: 14px 8px; margin: 0 -8px; }
.line-list a:hover { background: var(--c-layer); }
.line-name { width: 160px; flex-shrink: 0; font-size: 14px; font-weight: 600; color: var(--c-brand); }
.line-desc { font-size: 14px; color: var(--c-text-2); }
.line-list .line .line-name { color: var(--c-text); }

/* 본문 설명 */
.prose { font-size: 14px; color: var(--c-text-2); line-height: 1.7; max-width: 760px; }
.prose b { color: var(--c-text); font-weight: 600; }
.formula { padding: 16px; background: var(--c-layer); }
.formula-title { font-size: 13px; color: var(--c-text-2); }
.formula-code { margin-top: 6px; font-family: var(--font-mono); font-size: 14px; }
.formula-desc { margin-top: 4px; font-size: 12px; color: var(--c-text-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 화각 시각화 ---------- */
.fov-stage { background: var(--c-layer); padding: 16px; }
.fov-stage svg { width: 100%; height: auto; }
.subject-box { width: 200px; height: 200px; margin: 0 auto; background: var(--c-layer); border: 1px solid var(--c-border-2); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.subject-box img { mix-blend-mode: multiply; object-fit: contain; max-width: 100%; max-height: 100%; }

/* ---------- 계산서 ---------- */
.report {
  background: #fff; border: 1px solid var(--c-border); padding: 40px;
  max-width: 860px; margin: 0 auto; color: var(--c-text); font-size: 13px;
}
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--c-text); }
.report-title { font-size: 24px; font-weight: 300; line-height: 1.2; }
.report-no { font-family: var(--font-mono); font-size: 12px; color: var(--c-text-3); text-align: right; }
.report-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--c-border); }
.report-meta > div { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-border); }
.report-meta > div:nth-last-child(-n+2) { border-bottom: 0; }
.report-meta dt { width: 64px; flex-shrink: 0; color: var(--c-text-3); }
.report h3 { margin-top: 28px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.report .data-table { font-size: 13px; }
.report .data-table th, .report .data-table td { padding: 8px 10px; }
.report .data-table tbody tr:hover td { background: none; }
.report .data-table th { background: var(--c-layer); }
.report-table { border: 1px solid var(--c-border); }
.report-total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 12px; padding: 16px; background: var(--c-brand-50); }
.report-total .v { font-family: var(--font-mono); font-size: 24px; font-weight: 300; }
.report-notes { padding-left: 18px; list-style: decimal; color: var(--c-text-2); line-height: 1.7; }
.report-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--c-border); display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: var(--c-text-3); }
@media (max-width: 640px) {
  .report { padding: 20px 16px; }
  .report-meta { grid-template-columns: minmax(0, 1fr); }
  .report-meta > div:nth-last-child(2) { border-bottom: 1px solid var(--c-border); }
}

/* ---------- 푸터 ---------- */
.site-footer { margin-top: 64px; background: var(--c-layer); border-top: 1px solid var(--c-border); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 24px; padding-bottom: 24px; font-size: 13px; color: var(--c-text-2); }
.site-footer a:hover { color: var(--c-text); text-decoration: underline; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--c-layer); }
::-webkit-scrollbar-thumb { background: var(--c-text-4); }
