/* ===== CSS Variables ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --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;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 960px;
  --header-height: 56px;
}

/* ===== Reset ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

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

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.site-logo .logo-icon {
  font-size: 1.25rem;
}

.site-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--gray-600);
  font-weight: 500;
  padding: 4px 0;
}

.site-nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-700);
  padding: 4px;
}

/* ===== Main ===== */
.main-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px;
  width: 100%;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 32px 0 40px;
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero p {
  font-size: 1rem;
  color: var(--gray-500);
  max-width: 500px;
  margin: 0 auto;
}

/* ===== Cards Grid ===== */
.category-section {
  margin-bottom: 40px;
}

.category-section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.calculator-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s, border-color 0.2s;
  display: block;
}

.calculator-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  text-decoration: none;
}

.calculator-card .card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.calculator-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.calculator-card p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* ===== Calculator Page ===== */
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 8px;
  line-height: 1.3;
}

.page-description {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 24px;
  line-height: 1.6;
}

.calc-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.calc-card h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-select {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  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='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== Radio Group ===== */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-label {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.radio-label input[type="radio"] {
  accent-color: var(--primary);
}

.radio-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ===== Button ===== */
.btn-primary {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* ===== Results ===== */
.result-section {
  display: none;
  margin-top: 20px;
}

.result-section.visible {
  display: block;
}

.result-highlight {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--white);
  margin-bottom: 16px;
}

.result-highlight .result-label {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-bottom: 4px;
}

.result-highlight .result-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.result-highlight .result-sub {
  font-size: 0.8125rem;
  opacity: 0.8;
  margin-top: 4px;
}

.result-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.result-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.result-box .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.result-box .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
}

.result-box.green .value {
  color: var(--success);
}

.result-box.red .value {
  color: var(--danger);
}

/* ===== Detail Table ===== */
.detail-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  margin-top: 12px;
}

.detail-toggle:hover {
  background: var(--gray-100);
}

.detail-toggle .arrow {
  transition: transform 0.2s;
  font-size: 0.75rem;
}

.detail-toggle.open .arrow {
  transform: rotate(180deg);
}

.detail-content {
  display: none;
  margin-top: 12px;
}

.detail-content.visible {
  display: block;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

.detail-table th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
  font-size: 0.8125rem;
}

.detail-table td {
  color: var(--gray-700);
}

.detail-table td:last-child {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-table th:last-child {
  text-align: right;
}

.detail-table .total-row td {
  font-weight: 700;
  color: var(--gray-900);
  border-top: 2px solid var(--gray-200);
  border-bottom: none;
}

/* ===== Table Wrapper & Result Table ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 480px;
}

.result-table th,
.result-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}

.result-table th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
  font-size: 0.8125rem;
  position: sticky;
  top: 0;
}

.result-table td {
  color: var(--gray-700);
  font-variant-numeric: tabular-nums;
}

.result-table tr:hover td {
  background: var(--gray-50);
}

/* ===== Secondary Button ===== */
.btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  background: #fff;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== Content Sections ===== */
.content-section {
  margin-top: 32px;
}

.content-section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.content-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 16px 0 8px;
}

.content-section p {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 12px;
}

.content-section ul,
.content-section ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.content-section li {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 4px;
}

/* ===== FAQ ===== */
.faq-item {
  border-bottom: 1px solid var(--gray-100);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 16px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-800);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-question .faq-icon {
  flex-shrink: 0;
  font-size: 0.875rem;
  transition: transform 0.2s;
  color: var(--gray-400);
}

.faq-question.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding-bottom: 16px;
}

.faq-answer.visible {
  display: block;
}

.faq-answer p {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.7;
}

/* ===== Related Calculators ===== */
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.related-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: all 0.2s;
}

.related-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* ===== Ad Slot (CLS 방지용 투명 공간 확보) ===== */
.ad-slot {
  min-height: 90px;
  margin: 24px 0;
  background: transparent;
}

@media (min-width: 768px) {
  .ad-slot {
    min-height: 250px;
  }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 32px 16px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.footer-links a:hover {
  color: var(--white);
  text-decoration: none;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.6;
}

/* ===== Calculator Mini (for homepage cards) ===== */
.calc-mini-form {
  margin-top: 12px;
}

.calc-mini-form .form-group {
  margin-bottom: 10px;
}

.calc-mini-form .form-group label {
  font-size: 0.75rem;
}

.calc-mini-form .form-input {
  height: 40px;
  font-size: 0.875rem;
  padding: 0 12px;
}

.calc-mini-form .btn-primary {
  height: 40px;
  font-size: 0.875rem;
}

.calc-mini-result {
  margin-top: 12px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  text-align: center;
  display: none;
}

.calc-mini-result.visible {
  display: block;
}

.calc-mini-result .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-lg);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 8px 0;
    font-size: 1rem;
  }

  .nav-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 1.375rem;
  }

  .hero p {
    font-size: 0.875rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .result-row {
    grid-template-columns: 1fr;
  }

  .result-highlight .result-value {
    font-size: 1.5rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .calc-card {
    padding: 16px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.font-mono { font-variant-numeric: tabular-nums; }

/* ===== Notice & Disclaimer ===== */
.notice-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.notice-box p {
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 8px;
  line-height: 1.6;
}

.notice-box ul {
  padding-left: 18px;
  margin-bottom: 0;
}

.notice-box li {
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 4px;
}

.disclaimer {
  font-size: 0.8125rem;
  color: var(--gray-500);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  line-height: 1.6;
}

.logo-icon svg {
  display: block;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: -8px 0 24px;
  font-size: 0.85rem;
  color: #6b7280;
}
.post-author {
  color: var(--primary);
  font-weight: 600;
}
