/* ============================================================
   Kings Heavy Duty Truck Parts — public site theme
   Dark industrial / heavy-duty aesthetic, red accent.
   Responsive desktop + mobile. No external assets (CSP 'self').
   ============================================================ */
:root {
  --bg:            #10131a;   /* near-black industrial */
  --bg-2:         #161b24;   /* panel */
  --bg-3:         #1c2230;   /* raised card */
  --fg:            #e8ebf2;   /* light text */
  --muted:         #9aa3b2;   /* secondary text */
  --accent:        #d81f2a;   /* Kings red */
  --accent-2:      #ff2e3c;   /* brighter red */
  --accent-fg:     #ffffff;
  --border:        #2a3140;
  --border-2:      #3a4457;
  --ok:            #2fae63;
  --ok-bg:         #12331f;
  --err:           #e2555a;
  --err-bg:        #3a1416;
  --warn-bg:       #3a2f12;
  --warn:          #e0b64a;
  --max:           1180px;
  --pad:           20px;
  --radius:        8px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
/* industrial texture: subtle diagonal steel banding */
body {
  background-image:
    linear-gradient(180deg, #0c0f16 0%, var(--bg) 420px);
  background-attachment: fixed;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- Header ---------- */
header.site {
  border-bottom: 1px solid var(--border);
  background: #0a0d13;
  position: sticky; top: 0; z-index: 20;
}
header.site .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px; gap: 16px;
}
header.site .brand { display: flex; align-items: center; gap: 12px; color: var(--fg); }
header.site .brand .wordmark { font-weight: 800; font-size: 1.15rem; letter-spacing: .5px; }
header.site .brand .wordmark b { color: var(--accent-2); }
header.site .brand svg { width: 42px; height: 42px; flex: none; }
header.site nav { display: flex; align-items: center; gap: 18px; }
header.site nav a { color: var(--fg); font-weight: 600; font-size: .95rem; }
header.site nav a:hover { color: var(--accent-2); }
header.site nav a.active { color: var(--accent-2); }
header.site .tagline { color: var(--muted); font-size: .72rem; letter-spacing: 2px; text-transform: uppercase; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(216,31,42,.22), transparent 60%),
    linear-gradient(180deg, #12151c 0%, #0d1017 100%);
  border-bottom: 1px solid var(--border);
}
.hero .container { padding-top: 64px; padding-bottom: 64px; }
.hero .kicker {
  color: var(--accent-2); font-weight: 800; letter-spacing: 3px;
  text-transform: uppercase; font-size: .8rem; margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; margin: 0 0 18px;
  font-weight: 800; letter-spacing: -.5px;
}
.hero h1 .red { color: var(--accent-2); }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 0 28px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .strip {
  margin-top: 34px; display: flex; flex-wrap: wrap; gap: 22px;
  color: var(--muted); font-size: .9rem;
}
.hero .strip b { color: var(--fg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-fg);
  padding: 12px 20px; border-radius: var(--radius); border: 0;
  font-weight: 700; cursor: pointer; text-decoration: none; font-size: .95rem;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--fg); border: 1px solid var(--border-2); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent-2); background: transparent; }
.btn.ghost { background: transparent; color: var(--accent-2); border: 1px solid var(--accent); }

/* ---------- Section headings ---------- */
.section { padding: 52px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.section-head h2 { font-size: 1.8rem; margin: 0; letter-spacing: -.3px; }
.section-head .sub { color: var(--muted); margin: 0; }
.eyebrow { color: var(--accent-2); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: .75rem; }

/* ---------- Inventory cards ---------- */
.inv-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.inv-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.inv-card:hover { border-color: var(--border-2); }
.inv-photo {
  aspect-ratio: 16 / 10; background: #0c0f16;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.inv-photo img { width: 100%; height: 100%; object-fit: cover; }
.inv-photo .placeholder { width: 100%; height: 100%; display: block; }
.inv-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.inv-body .part-no { color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .5px; }
.inv-body h3 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.inv-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.inv-body .veh { color: var(--muted); font-size: .88rem; margin: 0; }
.inv-price { font-size: 1.35rem; font-weight: 800; color: var(--fg); margin-top: auto; }
.inv-price .na { color: var(--muted); font-weight: 600; font-size: 1rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  border: 1px solid var(--border-2);
}
.badge.sold { background: #2a1113; color: #e2555a; border-color: #5a2428; }
.badge.available { background: #10351f; color: #46d17f; border-color: #1f5a37; }
.badge.archived { background: #2a2a33; color: #9aa3b2; border-color: #45454f; }
.badge.cond { background: var(--bg-2); color: var(--muted); }
.tag { color: var(--muted); font-size: .78rem; }

/* ---------- Filters ---------- */
.filters {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 24px;
}
.filters .row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.field { margin: 10px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .85rem; color: var(--fg); }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--radius);
  font: inherit; color: var(--fg); background: #0d1017;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(216,31,42,.25);
}
.filters .actions { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.result-bar { color: var(--muted); margin: 0 0 18px; }
.result-bar b { color: var(--fg); }

/* ---------- Pagination (Phase 9E) ---------- */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 30px 0 0; }
.pagination .btn.ghost { padding: 8px 14px; }
.pagination .page-link { color: var(--fg); background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-weight: 600; }
.pagination .page-link:hover { border-color: var(--accent); color: var(--accent-2); text-decoration: none; }
.pagination .page-current { color: var(--accent-2); font-weight: 800; padding: 8px 12px; border: 1px solid var(--accent); border-radius: var(--radius); }

/* ---------- Notices ---------- */
.notice { padding: 12px 16px; border-radius: var(--radius); margin: 14px 0; border: 1px solid var(--border-2); }
.notice.info { background: var(--bg-2); color: var(--fg); }
.notice.success { background: var(--ok-bg); border-color: #1f5a37; color: #7fe0a6; }
.notice.error { background: var(--err-bg); border-color: #5a2428; color: #ff9a9f; }
.notice .err-list { margin: 8px 0 0; padding-left: 18px; }
.notice .err-list li { margin: 2px 0; }

/* ---------- Empty state ---------- */
.empty {
  border: 1px dashed var(--border-2); border-radius: var(--radius);
  padding: 44px 24px; text-align: center; color: var(--muted); background: var(--bg-2);
}
.empty h3 { color: var(--fg); margin: 0 0 8px; font-size: 1.3rem; }
.empty p { margin: 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: start; }
.contact-aside { color: var(--muted); }
.contact-aside .block { margin-bottom: 18px; }
.contact-aside .block h4 { margin: 0 0 4px; color: var(--fg); }
.contact-aside .row-item { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--fg); }

/* ---------- Footer ---------- */
footer.site { margin-top: 60px; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 26px 0; }
footer.site .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: center; }
footer.site .brand-sm { color: var(--fg); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  header.site .container { flex-direction: column; align-items: flex-start; gap: 8px; }
  header.site nav a { margin-left: 0; margin-right: 14px; }
  .hero .container { padding-top: 40px; padding-bottom: 40px; }
  footer.site .container { flex-direction: column; }
  /* Phase 9E: stack the filter fields into two columns on phones. */
  .filters .row { grid-template-columns: repeat(2, 1fr); }
  .field-search { grid-column: 1 / -1; }
}
