/* ============================================================
   올계산기 디자인 시스템 — toss풍 클린 UI
   시그니처: 결과 숫자의 크고 차분한 공개
   ============================================================ */

/* ---------- 폰트 (Pretendard, jsdelivr) ---------- */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

/* ---------- 토큰 ---------- */
:root {
  /* 색 */
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-2: #eef1f5;
  --ink: #191f28;
  --ink-2: #4e5968;
  --ink-3: #8b95a1;
  --line: #e5e8eb;
  --line-strong: #d1d6db;

  --point: #3563e9;      /* 브랜드 포인트 블루 */
  --point-dark: #274bc7;
  --point-soft: #eaf0ff;
  --result: #12b886;     /* 결과 강조 그린 */
  --result-soft: #e6f7f0;
  --warn: #f04452;

  /* 타이포 */
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* 간격 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* 라운드 */
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;

  /* 그림자 */
  --sh-sm: 0 1px 3px rgba(25, 31, 40, 0.06);
  --sh-md: 0 4px 16px rgba(25, 31, 40, 0.08);
  --sh-lg: 0 12px 32px rgba(25, 31, 40, 0.1);

  --maxw: 1180px;
  --content-maxw: 760px;
}

/* ---------- 리셋 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--point); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.3; letter-spacing: -0.025em; margin: 0; }
:focus-visible { outline: 3px solid var(--point); outline-offset: 2px; border-radius: 4px; }

/* 숫자는 등폭으로 (계산 결과 정렬감) */
.tnum { font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums; }

/* ---------- 레이아웃 ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--sp-7);
  align-items: start;
  padding: var(--sp-6) 0 var(--sp-8);
}
.layout__main { min-width: 0; }
.layout__aside { position: sticky; top: 84px; }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__emoji { font-size: 22px; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  color: var(--ink-2); font-weight: 600; font-size: 15px;
  padding: 8px 12px; border-radius: var(--r-sm); white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }

.nav-toggle {
  display: none; border: none; background: none; padding: 8px;
  width: 44px; height: 44px; border-radius: var(--r-sm);
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px auto; border-radius: 2px; transition: .2s; }

/* ---------- 브레드크럼 ---------- */
.breadcrumb { font-size: 14px; color: var(--ink-3); padding: var(--sp-4) 0 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumb li::after { content: "›"; margin-left: 6px; color: var(--line-strong); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--point); }

/* ---------- 페이지 타이틀 ---------- */
.page-head { margin: var(--sp-4) 0 var(--sp-5); }
.page-head h1 {
  font-size: clamp(28px, 4.5vw, 40px); font-weight: 800; color: var(--ink);
}
.page-head .lead { margin: var(--sp-3) 0 0; color: var(--ink-2); font-size: clamp(16px, 2vw, 18px); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--point);
  background: var(--point-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}

/* ---------- 계산기 카드 ---------- */
.calc-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-6);
  box-shadow: var(--sh-md);
}
.calc-fields { display: grid; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-weight: 700; font-size: 15px; color: var(--ink); }
.field input, .field select {
  width: 100%; font-family: inherit; font-size: 17px; color: var(--ink);
  padding: 14px 16px; border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md); background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--point); box-shadow: 0 0 0 4px var(--point-soft);
}
.field .inline { display: flex; gap: 8px; }
.field .inline input { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 17px; border: none; border-radius: var(--r-md);
  padding: 15px 22px; transition: transform .06s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--point); color: #fff; width: 100%; }
.btn--primary:hover { background: var(--point-dark); text-decoration: none; }
.btn--ghost { background: var(--surface); color: var(--ink-2); padding: 10px 14px; font-size: 14px; }

/* ---------- 결과 (시그니처) ---------- */
.result {
  margin-top: var(--sp-5); border-radius: var(--r-lg);
  background: var(--result-soft); border: 1px solid #c9efdf;
  padding: var(--sp-6); text-align: center;
  opacity: 0; transform: translateY(8px);
  transition: opacity .4s ease, transform .4s ease;
}
.result.is-visible { opacity: 1; transform: none; }
.result__label { font-size: 15px; font-weight: 700; color: #0c9b74; }
.result__value {
  font-size: clamp(40px, 8vw, 60px); font-weight: 800; color: #0b7a5c;
  line-height: 1.1; margin: 8px 0;
}
.result__sub { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: center; margin-top: var(--sp-4); }
.result__sub .item { text-align: center; }
.result__sub .item b { display: block; font-size: 22px; font-weight: 800; color: var(--ink); }
.result__sub .item span { font-size: 13px; color: var(--ink-3); }

/* ---------- 본문 프로즈 ---------- */
.prose { max-width: var(--content-maxw); margin-top: var(--sp-7); }
.prose h2 {
  font-size: clamp(22px, 3vw, 27px); font-weight: 800; color: var(--ink);
  margin: var(--sp-7) 0 var(--sp-4); padding-top: var(--sp-2);
}
.prose h3 { font-size: 19px; font-weight: 700; margin: var(--sp-5) 0 var(--sp-2); }
.prose p { color: var(--ink-2); margin: 0 0 var(--sp-4); }
.prose ul, .prose ol { color: var(--ink-2); padding-left: 1.2em; margin: 0 0 var(--sp-4); }
.prose li { margin: 6px 0; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--sp-4) 0; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prose th { background: var(--surface); font-weight: 700; }
.callout {
  background: var(--surface); border-left: 4px solid var(--point);
  border-radius: var(--r-sm); padding: var(--sp-4) var(--sp-5); margin: var(--sp-4) 0;
  color: var(--ink-2);
}

/* ---------- FAQ 아코디언 ---------- */
.faq { max-width: var(--content-maxw); margin-top: var(--sp-4); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 4px; font-size: 17px; font-weight: 700; color: var(--ink);
}
.faq-q .icon { flex: none; transition: transform .25s; color: var(--ink-3); font-size: 14px; }
.faq-item[open] .faq-q .icon, .faq-q[aria-expanded="true"] .icon { transform: rotate(180deg); }
.faq-a { padding: 0 4px 20px; color: var(--ink-2); }

/* ---------- 계산기 카드 그리드 ---------- */
.calc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4); margin-top: var(--sp-4);
}
.calc-tile {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5); transition: border-color .15s, box-shadow .15s, transform .1s;
}
.calc-tile:hover { border-color: var(--point); box-shadow: var(--sh-md); text-decoration: none; transform: translateY(-2px); }
.calc-tile__emoji { font-size: 24px; }
.calc-tile__name { font-weight: 700; color: var(--ink); font-size: 16px; }
.calc-tile__desc { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* 카테고리 칩 */
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px; font-weight: 600; font-size: 15px; color: var(--ink);
}
.cat-chip:hover { border-color: var(--point); color: var(--point); text-decoration: none; }

/* 섹션 타이틀 */
.section-title { font-size: clamp(20px, 2.6vw, 24px); font-weight: 800; margin: var(--sp-7) 0 var(--sp-2); }
.section-sub { color: var(--ink-3); margin: 0 0 var(--sp-4); }

/* ---------- 광고 슬롯 ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md);
  color: var(--ink-3); font-size: 12px; min-height: 90px; margin: var(--sp-4) 0;
}
.ad-slot--top { min-height: 100px; }
.ad-slot--sidebar { min-height: 600px; }
@media (max-width: 900px) { .ad-slot--sidebar { min-height: 250px; } }

/* ---------- 푸터 ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: var(--sp-8); padding: var(--sp-7) 0 var(--sp-6); }
.footer-mega { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-5) var(--sp-4); }
.footer-col h4 { font-size: 14px; color: var(--ink); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 7px 0; }
.footer-col a { font-size: 14px; color: var(--ink-2); }
.footer-col a:hover { color: var(--point); }
.footer-bottom { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-bottom a { color: var(--ink-3); }

/* ---------- 홈 히어로 ---------- */
.hero { padding: var(--sp-8) 0 var(--sp-6); text-align: center; }
.hero h1 { font-size: clamp(32px, 6vw, 54px); font-weight: 800; letter-spacing: -0.03em; }
.hero .accent { color: var(--point); }
.hero p { font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-2); margin: var(--sp-4) auto 0; max-width: 560px; }
.hero-search { max-width: 520px; margin: var(--sp-6) auto 0; }

/* ---------- 유틸 ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mt-0 { margin-top: 0; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  body { font-size: 16px; }
  .layout { grid-template-columns: 1fr; gap: var(--sp-5); }
  .layout__aside { position: static; }
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
    box-shadow: var(--sh-lg); transform: translateY(-120%); transition: transform .25s; }
  .nav.is-open { transform: translateY(0); }
  .nav a { padding: 12px; font-size: 16px; }
  .nav-toggle { display: block; }
  .calc-card { padding: var(--sp-5); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .result { opacity: 1; transform: none; }
}
