/* ===== Reset & Variables ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --secondary: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== Header ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.logo span { color: var(--primary); }
.logo:hover { text-decoration: none; }

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}
.nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.nav a.active {
  background: var(--primary);
  color: #fff;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--gray-700);
  border-radius: 6px;
}
.menu-toggle:hover { background: var(--gray-100); }

/* Mobile Nav */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
  }
  .nav.open { display: flex; }
  .nav a {
    padding: 12px 16px;
    font-size: 1rem;
  }
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
  color: #fff;
  padding: 40px 0 44px;
  text-align: center;
}
.hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
  line-height: 1.3;
}
.hero p {
  font-size: 1rem;
  opacity: 0.92;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .hero { padding: 28px 0 32px; }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.95rem; }
}

/* ===== Sections ===== */
.section { padding: 36px 0; }
.section-alt {
  background: #fff;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--gray-900);
}

/* ===== Cards ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #93c5fd;
}
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 12px;
}
.card-icon.civil { background: #dbeafe; }
.card-icon.national { background: #d1fae5; }
.card-icon.private { background: #fef3c7; }
.card-icon.military { background: #ede9fe; }

.card h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.card p {
  font-size: 0.88rem;
  color: var(--gray-500);
  flex-grow: 1;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
  text-decoration: none;
}
.btn-lg {
  padding: 13px 24px;
  font-size: 1.02rem;
}

/* ===== Calculator ===== */
.calc-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 800px) {
  .calc-wrapper { grid-template-columns: 1fr; }
}

.calc-form, .calc-result {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.calc-form h2, .calc-result h2 {
  font-size: 1.15rem;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--gray-700);
}
.form-group input:not([type="checkbox"]),
.form-group select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group input[readonly] {
  background: var(--gray-50);
  color: var(--gray-600);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.form-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 4px;
  line-height: 1.4;
}

/* Result */
.result-placeholder {
  text-align: center;
  padding: 36px 16px;
  color: var(--gray-500);
}
.result-main {
  text-align: center;
  padding: 18px 12px;
  margin-bottom: 16px;
  background: var(--primary-light);
  border-radius: 10px;
}
.result-main .label {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.result-main .amount {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.result-main .unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
}

.result-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.compare-box {
  text-align: center;
  padding: 12px 8px;
  border-radius: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
.compare-box .label {
  font-size: 0.78rem;
  color: var(--gray-500);
}
.compare-box .value {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 2px;
}
.compare-box.early .value { color: var(--warning); }

.gap-alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #ea580c;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.9rem;
  color: #9a3412;
  margin-bottom: 14px;
  line-height: 1.5;
}
.gap-alert strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: #c2410c;
}
.gap-alert .gap-sub {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: #78716c;
  line-height: 1.45;
}

.result-detail {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--gray-600);
}
.detail-row span:last-child {
  font-weight: 600;
  color: var(--gray-800);
}

.disclaimer {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.45;
}

/* Sticky result on desktop */
@media (min-width: 801px) {
  .calc-result { position: sticky; top: 72px; }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-900);
  color: #9ca3af;
  padding: 36px 0 20px;
  margin-top: 48px;
  font-size: 0.88rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.footer-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links a { color: #9ca3af; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 16px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* Checkbox fix */
.checkbox-group {
  cursor: pointer;
}
.checkbox-group input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-group label {
  cursor: pointer;
  user-select: none;
}
