/* 셈씨 공통 스타일 — 모든 계산기 페이지가 함께 씁니다 */
/* Layout: one calm column (max 34rem) under a slim brand bar; each calculator = inputs → result → explanation → FAQ */
:root {
  --bg: #F3F6F5;
  --surface: #FFFFFF;
  --fg: #142420;
  --muted: #5A6C67;
  --line: #D8E2DF;
  --bar: #CFDDD9;
  --accent: #0C6B59;
  --accent-soft: #E0EFEB;
  --accent-fg: #FFFFFF;
  --warn: #A9420F;
  --warn-soft: #FBEDE5;
  --accent2: #C2851A;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1412; --surface: #141E1B; --fg: #E4EDEA; --muted: #93A6A0; --line: #273430;
    --bar: #2C3D38; --accent: #4CC3A6; --accent-soft: #163029; --accent-fg: #062019;
    --warn: #F0905F; --warn-soft: #2E1C14; --accent2: #E3AE4B; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1412; --surface: #141E1B; --fg: #E4EDEA; --muted: #93A6A0; --line: #273430;
  --bar: #2C3D38; --accent: #4CC3A6; --accent-soft: #163029; --accent-fg: #062019;
  --warn: #F0905F; --warn-soft: #2E1C14; --accent2: #E3AE4B; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.6; }
img, svg { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h3 { font-size: 1.05rem; font-weight: 700; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* brand bar */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .bar { max-width: 34rem; margin: 0 auto; padding-inline: 16px; padding-block: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--fg); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; flex: none; color: var(--accent); }
.site-nav a { font-size: 0.9rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

.wrap { max-width: 34rem; margin: 0 auto; padding-inline: 16px; padding-block: 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.crumbs { font-size: 0.85rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.head { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 0.8rem; font-weight: 500; color: var(--accent); letter-spacing: 0.04em; }
.lede { color: var(--muted); }

/* form */
.inputs { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 480px) { .inputs { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
label { font-weight: 700; font-size: 0.95rem; }
.chip { font-size: 0.75rem; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
input[type="date"], input[type="number"], input[type="text"] {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; min-height: 54px;
  padding: 12px 14px; font: 500 1.06rem var(--font-num); color: var(--fg); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { grid-column: 1 / -1; font-size: 0.875rem; color: var(--muted); }
.link-btn { font: inherit; font-size: 0.85rem; color: var(--accent); background: none; border: 0; padding: 2px 4px; cursor: pointer; border-radius: 6px; }

.notice { padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--fg); }
.notice.is-error { background: var(--warn-soft); color: var(--warn); font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 12px; padding: 12px 18px; min-height: 48px; cursor: pointer; }
.btn:active { transform: translateY(1px); }
.copy-fallback { width: 100%; min-height: 120px; padding: 12px; font: 0.9rem/1.6 var(--font-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }

/* sections */
.block { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
summary { list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .15s; }
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.d-body { padding: 0 16px 16px; }
.d-body p + p { margin-top: 8px; }
.faq { gap: 8px; }
.faq summary { font-weight: 500; }

.table-scroll { overflow-x: auto; padding: 0 8px 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
td:last-child, th:last-child { text-align: right; }
td.d { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
tr.now td { background: var(--accent-soft); font-weight: 700; }
tr.now td:first-child { border-radius: 8px 0 0 8px; }
tr.now td:last-child { border-radius: 0 8px 8px 0; }
.tag { display: inline-block; margin-left: 6px; font-size: 0.7rem; font-weight: 700; color: var(--accent-fg); background: var(--accent); padding: 1px 6px; border-radius: 6px; vertical-align: 1px; }

/* calculator list (home) */
.cat { display: flex; flex-direction: column; gap: 10px; }
.cat-title { font-size: 0.85rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); text-decoration: none; transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.card-icon svg { width: 24px; height: 24px; }
.card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.card-title { font-weight: 700; font-size: 1.05rem; }
.card-desc { font-size: 0.9rem; color: var(--muted); }
.card-go { flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }

/* generic result card */
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.r-label { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.r-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; line-height: 1.05; padding-block: 4px 6px; }
.big .n { font-weight: 700; font-size: clamp(2.8rem, 14vw, 4.2rem); letter-spacing: -0.04em; color: var(--accent); font-variant-numeric: tabular-nums; }
.big.money .n { font-size: clamp(2rem, 9.5vw, 2.9rem); letter-spacing: -0.03em; }
.big .unit { font-size: 1.4rem; font-weight: 700; }
.big .of { font-size: 1rem; color: var(--muted); margin-left: 6px; }
.big.off .n { color: var(--muted); }
.reading { font-weight: 500; }
.rows { margin: 10px 0 0; display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-block: 10px; border-top: 1px dashed var(--line); }
.row dt { color: var(--muted); font-size: 0.92rem; flex: none; }
.row dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
.pill { font-size: 0.8rem; font-weight: 700; color: var(--accent-fg); background: var(--accent); padding: 3px 10px; border-radius: 999px; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* controls */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.seg button { font: inherit; font-size: 0.92rem; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 9px; min-height: 42px; padding: 6px 4px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.quick { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; }
.qbtn { font: inherit; font-size: 0.85rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.qbtn:hover { border-color: var(--accent); color: var(--accent); }
.affix { position: relative; }
.affix input { padding-right: 56px; }
.affix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; pointer-events: none; }
.field-reading { font-size: 0.85rem; color: var(--accent); font-weight: 500; min-height: 1.35em; }
.field.full { grid-column: 1 / -1; }
.field-note { font-size: 0.85rem; color: var(--muted); }
.check { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 500; font-size: 0.92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bar); margin-top: 8px; }
.split-bar span { display: block; height: 100%; }
.split-bar .p { background: var(--accent); }
.split-bar .i { background: var(--accent2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.legend .p { background: var(--accent); }
.legend .i { background: var(--accent2); }
.explain { padding: 4px 16px 6px; }
.explain .row dt { color: var(--fg); font-weight: 700; }
.explain .row dd { font-weight: 400; color: var(--muted); text-align: right; }
.explain .row:first-child { border-top: 0; }
.tabpanel { display: flex; flex-direction: column; gap: 16px; }
tr.pick { cursor: pointer; }
tr.past td { color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .inner { max-width: 34rem; margin: 0 auto; padding-inline: 16px; padding-block: 20px 32px; font-size: 0.82rem; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
