/* =============================================================================
   세금타임 (TaxTime) - 디자인 시스템 v1
   rate/health와 동일한 토큰 구조(라이트/다크 토글) + 세금 도메인 전용 네이비 팔레트
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;

  --border-subtle: #e2e8f0;
  --border-line: #cbd5e1;
  --border-focus: #1e3a8a;

  --text-main: #0f172a;
  --text-body: #1e293b;
  --text-sub: #475569;
  --text-muted: #64748b;

  /* Primary: 신뢰·공식성을 나타내는 네이비 (세금/법령 도메인) */
  --primary: #1e3a8a;
  --primary-hover: #1e40af;
  --primary-active: #172554;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #047857;
  --success-light: #ecfdf5;
  --warning: #b45309;
  --warning-light: #fffbeb;
  --danger: #be123c;
  --danger-light: #fff1f2;

  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-full: 9999px;
  --shadow-sm: 0 2px 8px -2px rgba(15,23,42,.08), 0 1px 4px -1px rgba(15,23,42,.04);
  --shadow-md: 0 10px 24px -4px rgba(15,23,42,.1), 0 4px 8px -2px rgba(15,23,42,.05);

  --max-w-main: 1080px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #0b1220; --bg-surface: #111a2c; --bg-subtle: #16223a; --bg-card: #111a2c;
    --border-subtle: #223151; --border-line: #2c3f66;
    --text-main: #f1f5f9; --text-body: #e2e8f0; --text-sub: #94a3b8; --text-muted: #64748b;
    --primary: #60a5fa; --primary-hover: #93c5fd; --primary-light: #16223a; --primary-border: #2c3f66;
  }
}
:root[data-theme="dark"] {
  --bg-main: #0b1220; --bg-surface: #111a2c; --bg-subtle: #16223a; --bg-card: #111a2c;
  --border-subtle: #223151; --border-line: #2c3f66;
  --text-main: #f1f5f9; --text-body: #e2e8f0; --text-sub: #94a3b8; --text-muted: #64748b;
  --primary: #60a5fa; --primary-hover: #93c5fd; --primary-light: #16223a; --primary-border: #2c3f66;
}
:root[data-theme="light"] {
  --bg-main: #f8fafc; --bg-surface: #ffffff; --bg-subtle: #f1f5f9; --bg-card: #ffffff;
  --text-main: #0f172a; --primary: #1e3a8a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-body);
  line-height: 1.6;
  word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--max-w-main); margin: 0 auto; padding: 0 20px; }

/* Header */
.tx-skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.tx-skip:focus { left: 0; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
  height: var(--header-h);
}
.tx-header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; color: var(--text-main); flex-shrink: 0; }
.brand-icon { font-size: 1.3rem; }
.tx-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tx-nav a {
  font-size: .88rem; font-weight: 600; color: var(--text-sub); padding: 8px 12px; border-radius: var(--r-sm);
  white-space: nowrap;
}
.tx-nav a:hover { background: var(--bg-subtle); color: var(--text-main); }
.tx-nav a.active { background: var(--primary-light); color: var(--primary); }
.nav-link {
  font-size: .9rem; font-weight: 600; color: var(--text-sub); padding: 8px 12px; border-radius: var(--r-sm);
}
.nav-link:hover { background: var(--bg-subtle); color: var(--text-main); }
@media (max-width: 640px) {
  .tx-nav { display: none; }
}
.tx-theme-btn {
  border: 1px solid var(--border-subtle); background: var(--bg-subtle); border-radius: var(--r-full);
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--text-sub);
}
.tx-theme-icon-dark { display: none; }
:root[data-theme="dark"] .tx-theme-icon-light { display: none; }
:root[data-theme="dark"] .tx-theme-icon-dark { display: inline-flex; }

/* Hero */
.tx-hero {
  padding: 40px 0 28px;
}
.tx-hero h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; color: var(--text-main);
  letter-spacing: -0.02em; text-wrap: balance; margin: 8px 0 10px;
}
.tx-hero p { color: var(--text-sub); font-size: 1rem; margin: 0; }
.tx-crumbs { font-size: .82rem; color: var(--text-muted); margin-bottom: 10px; }
.tx-crumbs a { color: var(--text-muted); }
.tx-crumbs a:hover { color: var(--primary); }

/* Cards */
.tx-content-card, .content-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.tx-card-title-head, .card-title-head {
  font-size: 1.15rem; font-weight: 800; color: var(--text-main); margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.tx-content-card p { margin: 0 0 12px; color: var(--text-body); }
.tx-content-card ul, .tx-content-card ol { padding-left: 1.3em; color: var(--text-body); }
.tx-divider { height: 1px; background: var(--border-subtle); margin: 24px 0; }

/* Table */
.tx-table-wrap, .table-wrap { overflow-x: auto; margin: 10px 0; }
.tx-table-wrap table, .table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.tx-table-wrap th, .table-wrap th {
  background: var(--primary-light); color: var(--primary); text-align: left; padding: 10px 12px;
  border-bottom: 2px solid var(--primary-border); white-space: nowrap; font-weight: 700;
}
.tx-table-wrap td, .table-wrap td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-body); }

/* Calculator */
.tx-calc-box { border: 2px solid var(--primary-border); }
.tx-calc-form { display: grid; gap: 14px; margin: 14px 0; }
.tx-calc-form label {
  display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--text-sub);
}
.tx-calc-form label.tx-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.tx-calc-form input[type="number"], .tx-calc-form select {
  font-size: 1rem; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-line);
  background: var(--bg-subtle); color: var(--text-main); font-variant-numeric: tabular-nums;
}
.tx-calc-form input:focus, .tx-calc-form select:focus { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.tx-calc-btn {
  background: var(--primary); color: #fff; border: none; border-radius: var(--r-sm); padding: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: background .15s;
}
.tx-calc-btn:hover { background: var(--primary-hover); }
.tx-calc-result {
  margin-top: 18px; padding: 20px; border-radius: var(--r-md); background: var(--primary-light);
  border: 1px solid var(--primary-border); text-align: center;
}
.tx-calc-result-label { font-size: .85rem; color: var(--text-sub); font-weight: 600; }
.tx-calc-result-amount { font-size: 2rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; margin: 4px 0; }
.tx-calc-result-detail { font-size: .82rem; color: var(--text-muted); }
.tx-calc-disclaimer { font-size: .78rem; color: var(--text-muted); margin-top: 12px; }

/* FAQ */
.tx-faq-wrap { display: flex; flex-direction: column; gap: 10px; }
.tx-faq-item { border: 1px solid var(--border-subtle); border-radius: var(--r-md); overflow: hidden; background: var(--bg-surface); }
.tx-faq-summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none;
  font-weight: 700; color: var(--text-main);
}
.tx-faq-summary::-webkit-details-marker { display: none; }
.tx-faq-q-badge {
  width: 22px; height: 22px; border-radius: var(--r-full); background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: .78rem; flex-shrink: 0;
}
.tx-faq-question { flex: 1; }
.tx-faq-arrow { color: var(--text-muted); transition: transform .2s; }
.tx-faq-item[open] .tx-faq-arrow { transform: rotate(90deg); }
.tx-faq-answer-inner { padding: 0 16px 16px 48px; color: var(--text-sub); font-size: .92rem; }

/* Ad slot */
.tx-ad-container { margin: 20px 0; }
.tx-ad-label { font-size: .7rem; color: var(--text-muted); letter-spacing: .08em; margin-bottom: 6px; text-align: center; }
.tx-ad-slot { border: 1px dashed var(--border-line); border-radius: var(--r-md); padding: 16px; }
.tx-ad-promo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tx-ad-promo-icon { font-size: 1.8rem; }
.tx-ad-promo-body { flex: 1; min-width: 180px; }
.tx-ad-promo-badge { font-size: .72rem; color: var(--primary); font-weight: 700; }
.tx-ad-promo-title { margin: 2px 0; font-size: 1rem; color: var(--text-main); }
.tx-ad-promo-desc { margin: 0; font-size: .85rem; color: var(--text-sub); }
.tx-ad-promo-btn {
  background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--r-full);
  font-size: .85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}

/* Calculator hub cards (index) */
.tx-calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0; }
.tx-calc-card {
  display: block; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.tx-calc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tx-calc-card-icon { font-size: 1.6rem; margin-bottom: 10px; }
.tx-calc-card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--text-main); }
.tx-calc-card p { margin: 0; font-size: .85rem; color: var(--text-sub); }

/* Footer */
.site-footer { border-top: 1px solid var(--border-subtle); margin-top: 40px; padding: 28px 0; }
.site-footer .wrap { display: flex; flex-direction: column; gap: 12px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { font-size: .82rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }
.footer-family { font-size: .82rem; color: var(--text-muted); line-height: 1.9; }
.footer-family a { color: inherit; }
.footer-family a:hover { color: var(--primary); }
.footer-source { font-size: .76rem; color: var(--text-muted); margin: 0; line-height: 1.6; }
.footer-source a { color: var(--primary); text-decoration: underline; }
.footer-copy { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 640px) {
  .tx-content-card, .content-card { padding: 18px; border-radius: var(--r-md); }
  .tx-calc-result-amount { font-size: 1.6rem; }
}
