/* CalcPulse — 폰이 기본. 넓은 화면은 @media (min-width:720px)·(min-width:1024px)로만 넓힌다(max-width 미디어쿼리 쓰지 않음).
   색·크기·간격은 시안(notes/066 CalcPulse 2장) 값. 다크모드 없음. */
:root {
  --bg: #F8FAFC; --surface: #FFFFFF; --ink: #0F172A; --ink-2: #475569; --ink-3: #64748B;
  --line: #E2E8F0; --line-2: #CBD5E1; --fill: #F1F5F9;
  --accent: #0F766E; --accent-hover: #0B5A54; --accent-soft: #E6F3F1; --code: #115E59;
  --font: Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --strip-h: 65px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.pg-list, .pg-doc { background: var(--surface); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input { font: inherit; color: inherit; }
img, svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hero, .tile-v, .ctl input, td { font-variant-numeric: tabular-nums; }
.site-head { order: 0; } main { order: 2; flex: 1 0 auto; width: 100%; } .site-foot { order: 3; }

/* ── 머리 ───────────────────────────── */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.head-in { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 0 16px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); text-decoration: none; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #FFFFFF; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.logo-name { font-size: 16px; font-weight: 700; }
.top-nav { display: flex; }
.top-nav a { height: 44px; padding: 0 12px; display: flex; align-items: center; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top-nav .n-about, .pg-calc .top-nav .n-calc, .pg-list .top-nav .n-calc { display: none; }

/* ── 계산기: 결과(폰에서는 위에 붙음) ───────── */
.calc-top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px;
}
.calc-top .badge { display: none; }
.calc-top h1 { margin: 0; font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--ink-2); }
.calc-res { display: flex; flex-direction: column; gap: 12px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero { font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; color: var(--accent); overflow-wrap: anywhere; }
.hero.long { font-size: 34px; }
.hero.xl { font-size: 26px; }
.sub { font-size: 14px; line-height: 1.35; color: var(--ink-2); }
.chart-sm { flex: none; width: 96px; height: 48px; }
.chart-doughnut .chart-sm { width: 48px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 10px 12px; border-radius: 10px; background: var(--fill); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-k { font-size: 12px; line-height: 1.3; font-weight: 600; color: var(--ink-2); }
.tile-v { font-size: 20px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.tile-n { display: none; }
.chart-lg { display: none; }

/* ── 계산기: 입력 줄 ───────────────── */
.calc-in { padding: 4px 16px 0; }
.in-title { display: none; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 62px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row label { font-size: 15px; font-weight: 500; line-height: 1.3; min-width: 0; }
.ctl { flex: none; display: flex; align-items: center; gap: 4px; }
.step { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.step:active { background: var(--fill); }
.ctl input { width: 92px; height: 44px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; text-align: center; }
.ctl input:focus { outline: none; border: 2px solid var(--accent); padding: 0 3px; }
/* 폰에서 칸을 누르면 키보드가 올라오며 칸이 위에 붙은 결과(약 230px)·아래 띠 밑으로 숨지 않게 */
.ctl input { scroll-margin: 236px 0 80px; }
.step:focus-visible, .acc > summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calc > .lead { margin: 0; padding: 14px 16px 20px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }

/* ── 본문 아코디언 ───────────────── */
.doc { padding: 0 16px; }
.acc { border-bottom: 1px solid var(--line); }
.acc:last-child { border-bottom: 0; }
.acc > summary { list-style: none; min-height: 52px; padding: 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; line-height: 1.35; font-weight: 600; cursor: pointer; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary h2, .acc > summary h3 { margin: 0; font: inherit; }
.chev { flex: none; transition: transform .15s; }
.acc[open] > summary .chev { transform: rotate(180deg); }
.acc-body { padding: 0 0 18px; font-size: 15px; line-height: 1.65; color: var(--ink); }
.acc-body > :first-child { margin-top: 0; }
.acc-body p { margin: 0 0 12px; }
.acc-body h3 { margin: 18px 0 6px; font-size: 16px; line-height: 1.35; font-weight: 700; }
.acc-body ul { margin: 0; padding-left: 20px; }
.acc-body li { margin: 0 0 8px; }
.acc-body a, .doc-page a, .hub-page a { font-weight: 600; }
.formula { background: var(--fill); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 0 0 16px; }
.formula h3 { margin: 0 0 8px; }
.formula p { font-size: 14px; margin: 0 0 8px; }
.formula p:last-child { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; color: var(--code); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.faq > div { margin: 0 0 12px; font-size: 14px; }
.faq > div > p { margin: 0; }
.faq > div > p:first-child { font-weight: 600; margin-bottom: 2px; }
.more { font-size: 14px; color: var(--ink-2); }

/* ── 다른 계산기 4개 ───────────────── */
.related { margin: 24px 16px 0; }
.related h2 { margin: 0 0 4px; font-size: 17px; line-height: 1.35; font-weight: 700; }
.rel-grid a { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.rel-grid a p { margin: 0; }
.rel-grid a p:first-child { font-size: 15px; font-weight: 600; }
.rel-grid a p:last-child { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.rel-grid a:hover p:first-child { color: var(--accent); }

/* ── 아래 띠(폰) ───────────────────── */
.pg-calc { padding-bottom: calc(var(--strip-h) + env(safe-area-inset-bottom)); }
.strip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.strip::-webkit-scrollbar { display: none; }
.strip a { flex: none; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--fill); color: var(--ink); font-size: 14px; font-weight: 600; display: flex; align-items: center; text-decoration: none; white-space: nowrap; }
.strip a:hover { color: var(--ink); background: var(--line); }
.strip a[aria-current="page"] { background: var(--accent); color: #FFFFFF; font-weight: 700; }
.strip a.all { background: transparent; border: 1px solid var(--line-2); }

/* ── 바닥글 ─────────────────────── */
.site-foot { margin-top: 32px; background: var(--surface); border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.foot-in { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 4px; margin: 0 auto; }
.foot-in p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; column-gap: 16px; }
.foot-links a { min-height: 44px; display: flex; align-items: center; color: var(--ink-3); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

/* ── 계산기 목록 ─────────────────── */
.list-page { padding: 18px 16px 8px; }
.list-page h1 { margin: 0 0 12px; font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
#cp-search { display: block; width: 100%; height: 48px; padding: 0 14px; margin: 0 0 6px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 16px; }
#cp-search:focus { outline: none; border: 2px solid var(--accent); padding: 0 13px; }
.item { min-height: 66px; padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.item:hover { color: var(--ink); }
.item:hover .item-n { color: var(--accent); }
.item[hidden] { display: none; }
.item-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-n { font-size: 16px; font-weight: 600; line-height: 1.3; }
.item-d { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.item svg, .guides-row svg { flex: none; }
.empty { margin: 0; padding: 20px 0; font-size: 15px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.guides-row { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--accent); font-size: 15px; font-weight: 700; text-decoration: none; }

/* ── 가이드·정책 ─────────────────── */
.doc-page, .hub-page { padding: 20px 16px 8px; font-size: 16px; line-height: 1.65; }
.doc-page h1, .hub-page h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -0.02em; }
.doc-page h2 { margin: 28px 0 8px; font-size: 20px; line-height: 1.3; font-weight: 700; }
.doc-page p { margin: 0 0 14px; }
.doc-page ul { margin: 0 0 14px; padding-left: 20px; }
.doc-page li { margin: 0 0 8px; }
.doc-page hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.doc-page section h2 { margin-top: 24px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.lead { color: var(--ink-2); }
.doc-page .lead, .hub-page .lead { font-size: 17px; line-height: 1.55; }
.muted { font-size: 14px; color: var(--ink-3); }
.email { font-weight: 600; color: var(--accent); }
.sep { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 4px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 14px; line-height: 1.45; text-align: left; }
.table-wrap th { background: var(--fill); font-weight: 600; }
.table-wrap th, .table-wrap td { padding: 10px 14px; border-top: 1px solid var(--line); }
.table-wrap thead th { border-top: 0; }
.badge { display: inline-block; margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 6px; }
.hub-page .badge { margin: 0 0 10px; }
.cards { display: grid; gap: 12px; margin-top: 8px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.card:hover { color: var(--ink); border-color: var(--accent); }
.card h2 { margin: 0; font-size: 18px; line-height: 1.35; font-weight: 700; }
.card p { margin: 0; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.go { font-size: 14px; font-weight: 600; color: var(--accent); }

/* ── 720px~ : 띠가 머리 아래 줄로, 본문 폭 720px ── */
@media (min-width: 720px) {
  .head-in { height: 60px; padding: 0 16px 0 24px; max-width: 1120px; }
  .site-head .top-nav a.n { display: flex; }
  .top-nav a.on, .top-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
  .pg-calc { padding-bottom: 0; }
  .strip { position: static; order: 1; flex-wrap: wrap; overflow: visible; padding: 12px 24px; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  .calc-page { max-width: 720px; margin: 0 auto; }
  .calc-top { padding: 18px 24px 16px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .calc-in { padding: 4px 24px 0; }
  .calc > .lead { padding: 14px 24px 20px; }
  .doc { padding: 0 24px; }
  .related { margin: 24px 24px 0; }
  .rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .foot-in { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 24px; max-width: 1120px; }
  .foot-in p { flex: 1 1 320px; }
  .foot-links { justify-content: flex-end; }
  .list-page { max-width: 720px; margin: 0 auto; padding: 28px 24px 8px; }
  .list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
  .item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 16px; }
  .empty { border-bottom: 0; }
  .guides-row { margin-top: 8px; }
  .pg-doc { background: var(--bg); }
  .doc-page { max-width: 720px; margin: 24px auto 0; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  .hub-page { max-width: 720px; margin: 0 auto; padding: 32px 24px 8px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

/* ── 1024px~ : 두 칸(입력 5 / 결과 7), 본문은 펼쳐진 글 ── */
@media (min-width: 1024px) {
  .calc-page { max-width: 1120px; padding: 32px 24px 0; }
  .calc { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "badge badge" "h1 h1" "lead lead" "in res"; column-gap: 24px; align-items: start; }
  .calc-top { display: contents; }
  .calc-top .badge { display: inline-block; grid-area: badge; justify-self: start; margin: 0 0 12px; }
  .calc-top h1 { grid-area: h1; font-size: 34px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); max-width: 820px; }
  .calc > .lead { grid-area: lead; padding: 0; margin: 12px 0 24px; font-size: 18px; max-width: 820px; }
  .calc-in { grid-area: in; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 24px 12px; }
  .in-title { display: block; margin: 12px 0 4px; font-size: 18px; line-height: 1.35; font-weight: 700; }
  .row:last-child { border-bottom: 0; }
  .ctl input { scroll-margin: 16px 0; }
  .calc-res { grid-area: res; position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; gap: 16px; }
  .hero { font-size: 48px; }
  .hero.long { font-size: 40px; }
  .hero.xl { font-size: 30px; }
  .sub { font-size: 15px; }
  .chart-sm { display: none; }
  .tile { padding: 12px 14px; }
  .tile-n { display: block; font-size: 12px; line-height: 1.35; color: var(--ink-3); }
  .chart-lg { display: block; border-top: 1px solid var(--line); padding-top: 14px; }
  .chart-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
  .chart-lg svg { width: 100%; height: auto; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); }
  .legend li { display: flex; align-items: center; gap: 6px; }
  .legend i { width: 14px; height: 10px; border-radius: 3px; flex: none; }
  .legend i.dash { height: 0; border-top: 2px dashed var(--ink-3); border-radius: 0; }
  .donut-lg { display: flex; align-items: center; gap: 24px; }
  .donut-lg svg { width: 168px; flex: none; }
  .donut-lg .legend { flex-direction: column; font-size: 14px; gap: 10px; margin: 0; }
  .donut-lg .legend b { color: var(--ink); font-weight: 700; margin-left: 4px; }
  .doc { max-width: 760px; margin: 40px auto 0; padding: 8px 40px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  .acc { border-bottom: 0; }
  .acc > summary { min-height: 0; padding: 24px 0 8px; cursor: default; font-size: 20px; line-height: 1.3; font-weight: 700; }
  .acc:first-child > summary { font-size: 24px; }
  .acc > summary .chev { display: none; }
  .acc-body { font-size: 16px; padding-bottom: 8px; }
  .related { max-width: 1120px; margin: 32px auto 0; padding: 0; }
  .related h2 { font-size: 20px; margin-bottom: 12px; }
  .rel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .rel-grid a { justify-content: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .rel-grid a:hover { border-color: var(--accent); }
  .list-page { max-width: 960px; }
  .doc-page { max-width: 760px; padding: 40px; }
  .hub-page { max-width: 960px; }
}
