/* ==========================================================================
   HomeCalc — Clean Real Estate & Housing Finance UI
   ========================================================================== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-sub: #f8fafc;
  --ink: #111827;
  --ink-body: #374151;
  --ink-muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #eff6ff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 16px rgba(17, 24, 39, 0.04);
}

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

body {
  margin: 0;
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: -0.02em; }
.brand-text small { font-size: 11px; color: var(--ink-muted); }

.main-nav {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
}
.nav-tab {
  border: 0;
  background: transparent;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.15s ease;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.main-wrap { padding-top: 28px; padding-bottom: 64px; }

.hero-strip { margin-bottom: 18px; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.hero-strip h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.hero-strip p { margin: 0; color: var(--ink-muted); font-size: 14.5px; }

.ad-slot {
  border: 1px dashed var(--line-strong);
  background: #edf0f5;
  border-radius: 10px;
  min-height: 84px;
  display: grid;
  place-items: center;
  margin: 18px 0 22px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
}

.tool-panel { display: none; }
.tool-panel.is-active { display: block; }

.calc-grid {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; }

.sub-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.sub-label--blue { color: var(--blue); }
.sub-label--amber { color: var(--amber); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.dual-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dual-col {
  background: var(--surface-sub);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-body); }
.field select,
.input-unit input {
  width: 100%;
  height: 40px;
  padding: 0 46px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.field select { padding-right: 12px; font-weight: 500; font-size: 13.5px; }
.input-unit input:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.input-unit { position: relative; display: flex; align-items: center; }
.input-unit span {
  position: absolute;
  right: 11px;
  font-size: 12px;
  color: var(--ink-muted);
  pointer-events: none;
}

.divider { height: 1px; background: var(--line); margin: 18px 0; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-body);
  cursor: pointer;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
}
.mode-btn {
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
.mode-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qchip {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-sub);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-body);
}
.qchip:hover { border-color: var(--blue); color: var(--blue); }

.info-note {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-body);
  line-height: 1.65;
}
.info-note code {
  background: #e5e7eb;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* KPI & Result */
.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--blue-soft);
  color: var(--blue);
}
.status-pill.is-amber { background: var(--amber-soft); color: var(--amber); }

.kpi-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.kpi-hero.is-amber { background: linear-gradient(135deg, #92400e 0%, #d97706 100%); }
.kpi-label { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.8); margin-bottom: 4px; }
.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kpi-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.kpi-mini span { display: block; font-size: 11px; color: rgba(255, 255, 255, 0.76); }
.kpi-mini strong { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* VS Bars */
.vs-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}
.vs-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.vs-head span { font-weight: 800; font-variant-numeric: tabular-nums; }
.vs-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 5px;
}
.vs-fill { height: 100%; border-radius: 999px; transition: width 0.25s ease; }
.vs-fill--blue { background: var(--blue); }
.vs-fill--amber { background: var(--amber); }
.vs-row small { font-size: 11.5px; color: var(--ink-muted); }

.sub-box {
  background: var(--surface-sub);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.sub-box h3 { margin: 0 0 12px; font-size: 14px; }

.detail-list {
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.detail-list > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.detail-list dt { color: var(--ink-muted); }
.detail-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* Buttons */
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-primary {
  flex: 1;
  min-width: 150px;
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-outline {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  font-size: 13px;
}
.btn-outline:hover { border-color: var(--ink); }
.btn-text {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
}
.btn-text:hover { color: #dc2626; }

/* SEO & Table */
.seo-article h2 { margin: 0 0 18px; font-size: 18px; letter-spacing: -0.02em; }
.seo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 26px; }
.seo-grid h3 { margin: 0 0 6px; font-size: 14.5px; }
.seo-grid p { margin: 0; font-size: 13.5px; color: var(--ink-body); line-height: 1.72; word-break: keep-all; }

.mini-table-wrap { overflow-x: auto; }
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 6px;
}
.mini-table th, .mini-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.mini-table th { background: var(--surface-sub); color: var(--ink-muted); font-weight: 700; }

.faq-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.faq-box h3 { margin: 0 0 12px; font-size: 15px; }
.faq-box details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface-sub);
}
.faq-box summary { font-weight: 700; cursor: pointer; font-size: 13.5px; }
.faq-box details p { margin: 8px 0 0; font-size: 13px; color: var(--ink-body); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer-left strong { color: var(--ink); }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  z-index: 100;
}

@media (max-width: 960px) {
  .calc-grid, .seo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero-strip h1 { font-size: 21px; }
  .form-grid, .dual-inputs { grid-template-columns: 1fr; }
  .kpi-value { font-size: 23px; }
  .main-nav { width: 100%; overflow-x: auto; }
  .nav-tab { white-space: nowrap; flex: 1; text-align: center; padding: 8px 9px; font-size: 12px; }
}
