/* 사이트 공통 스타일 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1f27;
  --muted: #5b6573;
  --border: #dfe3e8;
  --accent: #0b7a5c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 머리글 */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.lang {
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.site-name {
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

/* 홈 소개 */
.hero {
  padding: 40px 0 8px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 1.75rem;
  line-height: 1.3;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

/* 계산기 목록 */
.group {
  margin-top: 40px;
}

.group h2 {
  margin: 0 0 12px;
  font-size: 1.125rem;
}

.cards {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  display: block;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}

a.card:hover,
a.card:focus-visible {
  border-color: var(--accent);
}

.card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  background: #eef0f3;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

/* 계산기 */
[hidden] {
  display: none !important;
}

.calc {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.calc h1 {
  margin: 0 0 12px;
  font-size: 1.375rem;
  line-height: 1.3;
}

.calc label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.875rem;
}

.calc-input {
  display: flex;
  gap: 8px;
}

.calc-input input,
.calc-input select {
  height: 48px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

.calc-input input {
  flex: 1;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.calc-input input:focus-visible,
.calc-input select:focus-visible,
.share:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 입력 칸이 여러 개인 계산기: 세 칸씩 놓고, wide는 한 줄을 다 쓴다 */
.fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 8px;
}

.field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.field.wide {
  grid-column: 1 / -1;
}

.results {
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
}

.results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.results .unit {
  color: var(--muted);
}

.results .unit small {
  margin-left: 6px;
  font-size: 0.8125rem;
}

.results output {
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.results .main output {
  color: var(--accent);
  font-size: 1.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share {
  height: 44px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

/* 차 고르기(assets/js/ui/vehicle-picker.js) */
.vp {
  margin-bottom: 12px;
}

.vp-row {
  position: relative;
  display: flex;
  gap: 8px;
}

.vp-combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

.vp-input {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px 미만이면 iOS가 확대한다 */
  text-overflow: ellipsis;
}

.vp-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.vp-toggle,
.vp-tab,
.vp-back,
.vp-item {
  -webkit-tap-highlight-color: transparent;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.vp-toggle {
  height: 48px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.vp-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.vp-input:focus-visible,
.vp-clear:focus-visible,
.vp-toggle:focus-visible,
.vp-tab:focus-visible,
.vp-back:focus-visible,
.vp-item:focus-visible,
.link-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.vp-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 10;
  max-height: min(60vh, 420px);
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  list-style: none;
}

.vp-option {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  line-height: 1.35;
  cursor: pointer;
}

.vp-option:hover,
.vp-option[aria-selected="true"] {
  background: #e9f4f0;
}

.vp-opt-main,
.vp-item-main {
  font-weight: 600;
}

.vp-opt-sub {
  font-size: 0.9375rem;
}

.vp-opt-meta,
.vp-item-sub {
  color: var(--muted);
  font-size: 0.8125rem;
}

.vp-option.vp-manual {
  border-top: 1px solid var(--border);
  color: var(--accent);
}

.vp-message {
  margin: 0;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.875rem;
}

.vp-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.vp-status strong {
  color: var(--text);
  font-weight: 600;
}

.vp-status:empty {
  display: none;
}

.vp-browse {
  max-height: 60vh;
  margin-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.vp-browse-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.vp-tab,
.vp-back {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.875rem;
}

.vp-tab[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.vp-crumb {
  font-size: 0.9375rem;
}

.vp-browse-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.vp-browse-body.vp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 640px) {
  .vp-browse-body.vp-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.vp-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.35;
  text-align: left;
}

.vp-item.vp-brand {
  flex-direction: row;
  padding: 8px;
  font-size: 0.9375rem;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.vp-brand .vp-item-main {
  min-width: 0;
  word-break: break-all;
}

.vp-group {
  margin: 8px 2px 2px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* 고른 차의 값 표시: 인증값 / 직접 입력. 입력 칸 윗선 오른쪽에 얹어 줄 높이를 늘리지 않는다 */
.calc-input {
  position: relative;
}

.flag {
  position: absolute;
  top: -7px;
  left: 8px;
  padding: 0 6px;
  line-height: 1.3;
  background: #e3f2ec;
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.flag.manual {
  background: #fdf0dc;
  color: #8a5300;
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.field-note a {
  color: var(--accent);
}

.field-note strong {
  color: #8a5300;
  font-weight: 600;
}

.link-button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* 본문 글 */
.prose {
  margin-top: 40px;
}

.prose h2 {
  margin: 0 0 8px;
  font-size: 1.125rem;
}

.prose h3 {
  margin: 16px 0 6px;
  font-size: 1rem;
}

.prose p,
.prose ul {
  margin: 0 0 12px;
}

.prose ul {
  padding-left: 20px;
}

.prose a {
  color: var(--accent);
}

.notice {
  padding: 12px 16px;
  background: #eef0f3;
  border-radius: 8px;
  font-size: 0.9375rem;
}

/* 바닥글 */
.site-footer {
  margin-top: 56px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* 계산기 상세 옵션(접어 둔 입력) */
.more {
  margin-top: 12px;
}

.more summary {
  color: var(--accent);
  font-size: 0.875rem;
  cursor: pointer;
}

.more .fields {
  margin-top: 8px;
}

/* 여러 칸 계산기의 선택 상자는 칸 폭에 맞춘다 */
.field:not(.wide) .calc-input select {
  flex: 1;
  min-width: 0;
}

/* 여러 칸 계산기에서 두 칸 폭을 쓰는 입력 */
.field.span2 {
  grid-column: span 2;
}

/* 예시 값 버튼(누른 것 강조) */
.actions.preset {
  margin: 4px 0 12px;
}

.share[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* 매물 비교: 매물 입력 카드와 순위 */
.listing {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.listing-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.listing-title {
  margin: 0;
  font-size: 1rem;
}

.lc-sort {
  margin-top: 16px;
}

.ranking {
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
}

.rank-item {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}

.rank-item.muted {
  color: var(--muted);
}

.rank-item p {
  margin: 4px 0 0;
  font-size: 0.875rem;
}

.rank-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}

.rank-no {
  color: var(--accent);
  font-weight: 700;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: 0.875rem;
}

.rank-row span:first-child {
  color: var(--muted);
}

.rank-value {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-value {
  white-space: nowrap;
}

.site-footer p + p {
  margin-top: 6px;
}

.site-footer a {
  color: inherit;
}
