:root {
  --navy: #0f2942;
  --navy-2: #163a5f;
  --blue: #2563eb;
  --red: #e11d2e;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e5e9f0;
  --text: #1c2733;
  --text-dim: #64748b;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}

/* header */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 20px; padding: 14px 20px; flex-wrap: wrap; }
.logo { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.logo span { color: #7fb3ff; }
.quick-search { flex: 1 1 260px; display: flex; max-width: 460px; }
.quick-search input {
  flex: 1; border: none; border-radius: 8px 0 0 8px; padding: 10px 14px; font-size: 14px;
}
.quick-search button {
  border: none; background: var(--blue); color: #fff; padding: 0 18px; border-radius: 0 8px 8px 0;
  cursor: pointer; font-weight: 700;
}
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #cbd7e6;
}
.main-nav a.active, .main-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }

/* hero */
.hero { padding: 44px 0 24px; }
.hero h1 { font-size: 28px; margin: 0 0 8px; color: var(--navy); }
.hero p { color: var(--text-dim); margin: 0; font-size: 15px; }

/* filter bar */
.filter-bar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 18px 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row select, .filter-row input {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fbfcfe;
}
.filter-row input[type="number"] { width: 132px; }
.filter-row button {
  background: var(--navy); color: #fff; border: none; padding: 10px 18px; border-radius: 8px;
  font-weight: 700; cursor: pointer; font-size: 13px;
}
.filter-row button:hover { background: var(--navy-2); }
.reset-link { font-size: 13px; color: var(--text-dim); padding: 0 4px; }

.result-count { color: var(--text-dim); font-size: 14px; margin: 6px 0 14px; }
.empty-state { text-align: center; padding: 60px 0; color: var(--text-dim); font-size: 15px; }

/* car grid */
.car-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.car-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.car-card:hover { box-shadow: 0 8px 20px rgba(15,41,66,.12); transform: translateY(-2px); }
.car-thumb { position: relative; aspect-ratio: 4/3; background: #e2e8f0; }
.car-thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge-nation {
  position: absolute; top: 8px; left: 8px; background: rgba(15,41,66,.85); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.car-info { padding: 12px 14px 14px; }
.car-title { font-size: 15px; font-weight: 800; margin: 0 0 2px; }
.car-sub { font-size: 12.5px; color: var(--text-dim); margin: 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-price { font-size: 18px; font-weight: 900; color: var(--red); margin: 0 0 4px; }
.car-meta { font-size: 12.5px; color: var(--text-dim); margin: 0; }

/* pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 30px 0 50px; }
.pagination a {
  min-width: 36px; text-align: center; padding: 8px 6px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 13px; font-weight: 600;
}
.pagination a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* detail page */
.main-detail { padding: 24px 20px 60px; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 14px; color: var(--blue); font-weight: 600; }
.detail-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; }
.g-item.main-photo { grid-column: 1 / -1; }
.g-item img { width: 100%; border-radius: 10px; background: #e2e8f0; aspect-ratio: 4/3; object-fit: cover; }
.g-item.main-photo img { aspect-ratio: 16/10; }

.detail-info { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: sticky; top: 84px; }
.detail-info h1 { font-size: 22px; margin: 10px 0 2px; }
.detail-sub { color: var(--text-dim); margin: 0 0 10px; font-size: 14px; }
.detail-price { font-size: 28px; font-weight: 900; color: var(--red); margin: 0 0 16px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table th { text-align: left; width: 96px; color: var(--text-dim); padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-weight: 600; }
.spec-table td { padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.cta-box { margin-top: 18px; text-align: center; }
.cta-box p { font-size: 13px; color: var(--text-dim); margin: 0 0 10px; }
.btn-secondary {
  display: inline-block; background: var(--blue); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-weight: 700; font-size: 14px; width: 100%;
}

/* footer */
.site-footer { margin-top: 40px; padding: 26px 0 40px; color: var(--text-dim); font-size: 12.5px; border-top: 1px solid var(--border); }
.footer-inner p { margin: 4px 0; }
.foot-brand { font-weight: 700; color: var(--text); }

@media (max-width: 860px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-info { position: static; }
}
@media (max-width: 560px) {
  .header-inner { gap: 10px; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; }
  .quick-search { order: 2; }
  .hero h1 { font-size: 22px; }
}
