/*
Theme Name: Marketplace Custom
Theme URI: https://example.com
Author: John
Description: Custom classifieds-marketplace homepage theme (Jiji-style browsing, admin-approved vendor storefronts).
Version: 1.0
Text Domain: marketplace-custom
*/

/* ============ Design tokens ============ */
:root{
  --bg: #0E1117;
  --bg-alt: #161B24;
  --bg-alt-2: #1D2430;
  --text: #EDEFF2;
  --text-dim: #9AA4B2;
  --border: #232935;
  --accent: #4FD1C5;      /* teal — waveform / tech accent */
  --accent-warm: #FFB454; /* amber — CTAs, prices */
  --radius: 10px;
  --maxw: 1180px;
  --font-head: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}
img{ max-width:100%; display:block; }
a{ color: inherit; text-decoration:none; }
.wrap{ max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

h1,h2,h3{ font-family: var(--font-head); margin:0 0 .4em; font-weight: 600; }

/* ============ Header ============ */
.site-header{
  border-bottom: 1px solid var(--border);
  position: sticky; top:0; z-index: 50;
  background: rgba(14,17,23,.92);
  backdrop-filter: blur(6px);
}
.site-header .wrap{
  display:flex; align-items:center; gap:24px;
  height:72px;
}
.site-logo{ font-family: var(--font-head); font-size:1.3rem; font-weight:700; white-space:nowrap; }
.site-logo span{ color: var(--accent); }

.header-search{ flex:1; display:flex; max-width:560px; }
.header-search input{
  flex:1; border:1px solid var(--border); border-right:none;
  background: var(--bg-alt); color: var(--text);
  padding: 11px 14px; border-radius: var(--radius) 0 0 var(--radius);
  font-family: var(--font-body); font-size: .95rem;
}
.header-search input::placeholder{ color: var(--text-dim); }
.header-search button{
  border:1px solid var(--accent); background: var(--accent); color:#08171A;
  padding: 0 18px; border-radius: 0 var(--radius) var(--radius) 0;
  font-weight:600; cursor:pointer;
}

.header-actions{ display:flex; align-items:center; gap:18px; margin-left:auto; }
.header-actions a{ font-size:.9rem; color: var(--text-dim); }
.header-actions a:hover{ color: var(--text); }
.btn-sell{
  background: var(--accent-warm); color:#241300;
  padding:9px 16px; border-radius: var(--radius); font-weight:600;
}

/* ============ Hero ============ */
.hero{
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}
.hero h1{ font-size: clamp(1.8rem, 3.4vw, 2.6rem); max-width: 14ch; }
.hero p{ color: var(--text-dim); max-width: 46ch; margin: 0 0 22px; }

.hero-search{ display:flex; max-width: 640px; }
.hero-search select{
  border:1px solid var(--border); border-right:none; background:var(--bg-alt);
  color: var(--text); padding:0 12px; border-radius: var(--radius) 0 0 var(--radius);
  font-size:.9rem;
}
.hero-search input{
  flex:1; border:1px solid var(--border); border-left:none; border-right:none;
  background: var(--bg-alt); color: var(--text); padding: 13px 14px; font-size:.95rem;
}
.hero-search button{
  background: var(--accent); color:#08171A; border:none; padding: 0 22px;
  border-radius: 0 var(--radius) var(--radius) 0; font-weight:700; cursor:pointer;
}

/* the one orchestrated motion moment: a waveform line drawing itself in on load */
.waveform{ margin-top: 34px; height: 30px; overflow:hidden; }
.waveform svg{ width: 100%; height: 100%; }
.waveform path{
  stroke: var(--accent); stroke-width:2; fill:none;
  stroke-dasharray: 900; stroke-dashoffset: 900;
  animation: draw 1.4s ease-out forwards .2s;
}
@media (prefers-reduced-motion: reduce){
  .waveform path{ animation: none; stroke-dashoffset: 0; }
}
@keyframes draw{ to{ stroke-dashoffset: 0; } }

/* ============ Category grid ============ */
.section{ padding: 44px 0; }
.section-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:20px; }
.section-head h2{ font-size:1.3rem; }
.section-head a{ font-size:.85rem; color: var(--accent); }

.cat-grid{
  display:grid; gap:14px;
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 640px){ .cat-grid{ grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px){ .cat-grid{ grid-template-columns: repeat(6, 1fr); } }

.cat-tile{
  background: var(--bg-alt); border:1px solid var(--border); border-radius: var(--radius);
  padding: 18px 10px; text-align:center; transition: border-color .15s, transform .15s;
}
.cat-tile:hover{ border-color: var(--accent); transform: translateY(-2px); }
.cat-tile .ico{ font-size:1.6rem; margin-bottom:8px; }
.cat-tile span{ font-size:.8rem; color: var(--text-dim); }

/* ============ Listing grid ============ */
.listing-grid{
  display:grid; gap:16px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px){ .listing-grid{ grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px){ .listing-grid{ grid-template-columns: repeat(4, 1fr); } }

.listing-card{
  background: var(--bg-alt); border:1px solid var(--border); border-radius: var(--radius);
  overflow:hidden;
}
.listing-card .thumb{
  aspect-ratio: 4/3; background: var(--bg-alt-2);
  display:flex; align-items:center; justify-content:center; color: var(--text-dim); font-size:.8rem;
}
.listing-card .body{ padding: 12px 14px; }
.listing-card .price{ color: var(--accent-warm); font-weight:700; font-family: var(--font-head); }
.listing-card .title{ font-size:.88rem; margin: 4px 0 6px; color: var(--text); }
.listing-card .meta{ font-size:.75rem; color: var(--text-dim); }
.listing-card .vendor-badge{
  display:inline-block; margin-top:8px; font-size:.68rem; color: var(--accent);
  border:1px solid var(--border); border-radius: 6px; padding: 2px 7px;
}

/* ============ Category/listings archive ============ */
.cat-bar{
  position: sticky; top:72px; z-index:40;
  background: var(--bg); border-bottom:1px solid var(--border);
  overflow-x:auto; white-space:nowrap; scrollbar-width:none;
}
.cat-bar::-webkit-scrollbar{ display:none; }
.cat-bar .wrap{ display:flex; gap:8px; padding:12px 20px; height:auto; }
.cat-pill{
  flex:0 0 auto; padding:7px 14px; border:1px solid var(--border);
  border-radius:999px; font-size:.82rem; color: var(--text-dim);
}
.cat-pill.active{ background: var(--accent); color:#08171A; border-color:var(--accent); font-weight:600; }

.archive-layout{ display:grid; grid-template-columns: 1fr; gap:24px; padding:28px 0; }
@media (min-width: 860px){ .archive-layout{ grid-template-columns: 220px 1fr; } }

.filters{ border:1px solid var(--border); border-radius: var(--radius); padding:16px; align-self:start; }
.filters h3{ font-size:.85rem; margin-bottom:10px; }
.filters label{ display:block; font-size:.8rem; color: var(--text-dim); margin:10px 0 4px; }
.filters input{
  width:100%; background: var(--bg-alt); border:1px solid var(--border); color: var(--text);
  border-radius:6px; padding:8px 10px; font-size:.85rem;
}
.filters button{
  margin-top:14px; width:100%; background: var(--accent); color:#08171A; border:none;
  padding:9px; border-radius:6px; font-weight:600; cursor:pointer;
}

.listing-card img{
  width:100%; height:100%; object-fit:cover;
  opacity:0; transition: opacity .25s;
}
.listing-card img.loaded{ opacity:1; }

.load-more-wrap{ text-align:center; padding: 28px 0 8px; }
.load-more-wrap button{
  background: var(--bg-alt); border:1px solid var(--border); color: var(--text);
  padding:11px 26px; border-radius: var(--radius); cursor:pointer; font-size:.9rem;
}
.load-more-wrap button:hover{ border-color: var(--accent); }
.load-more-wrap button[disabled]{ opacity:.5; cursor:default; }

/* ============ Footer ============ */
.site-footer{ border-top:1px solid var(--border); padding: 36px 0; margin-top: 30px; }
.site-footer .wrap{ display:flex; flex-wrap:wrap; gap:20px; justify-content:space-between; align-items:center; }
.site-footer p{ color: var(--text-dim); font-size:.82rem; margin:0; }
