/*
Theme Name: Listoi
Theme URI: https://listoi.com
Author: Listoi
Description: An extremely fast, mobile-first classifieds theme. Geo-based listings, Google sign-in, one image per listing, automatic expiry. No page builders, no bloat.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: listoi
Tags: classifieds, marketplace, mobile-first, lightweight, accessibility-ready
*/

/* ---------------------------------------------------------------------------
   1. Tokens
   Palette is intentionally tiny: white page, near-black ink, one blue accent
   for actions, one green reserved exclusively for price. System fonts only —
   zero webfont requests is the single biggest first-paint win available.
--------------------------------------------------------------------------- */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --ink: #10151a;
  --muted: #5d6a76;
  --line: #e3e7ec;
  --accent: #1a56db;
  --accent-ink: #ffffff;
  --price: #0c7a4d;
  --danger: #b3261e;
  --radius: 14px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(16, 21, 26, .06), 0 8px 24px rgba(16, 21, 26, .06);
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------------------------------------------------------------------------
   2. Base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 10px 16px; border-radius: var(--pill); box-shadow: var(--shadow); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 16px; }

/* ---------------------------------------------------------------------------
   3. Header
--------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.04em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------------------
   4. Buttons
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--pill); border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .94rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #1449b8; border-color: #1449b8; }
.btn-ghost { border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .86rem; }
.btn-danger { color: var(--danger); border-color: #f0d5d3; background: #fff; }

/* ---------------------------------------------------------------------------
   5. Search — the signature element. The location chip lives inside the field,
   so "what" and "where" read as one control instead of two.
--------------------------------------------------------------------------- */
.hero { padding: 40px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); margin-bottom: 6px; }
.hero p { color: var(--muted); margin-bottom: 22px; }
.searchbar { position: relative; max-width: 680px; margin: 0 auto; }
.searchbar form {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--pill);
  padding: 6px 6px 6px 18px; box-shadow: var(--shadow);
}
.searchbar form:focus-within { border-color: var(--accent); }
.searchbar input[type="search"] {
  flex: 1 1 auto; min-width: 0; border: 0; padding: 12px 0; font: inherit; font-size: 1rem;
  background: transparent; color: var(--ink);
}
.searchbar input[type="search"]:focus { outline: none; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbar .btn { flex: 0 0 auto; }
.loc-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 8px 14px; border-radius: var(--pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: .86rem; font-weight: 600;
  cursor: pointer; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.loc-chip:hover { color: var(--ink); }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; text-align: left;
}
.suggest[hidden] { display: none; }
.suggest a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: var(--ink); }
.suggest a:hover, .suggest a[aria-selected="true"] { background: var(--surface); text-decoration: none; }
.suggest img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.suggest .s-title { font-size: .92rem; font-weight: 600; }
.suggest .s-meta { font-size: .8rem; color: var(--muted); }

/* ---------------------------------------------------------------------------
   6. Category chips
--------------------------------------------------------------------------- */
.cats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 26px 0 8px; }
.cat {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: var(--pill);
  background: #fff; color: var(--ink); font-weight: 600; font-size: .94rem;
}
.cat:hover { background: var(--surface); border-color: #cfd6de; text-decoration: none; }
.cat em { font-style: normal; font-size: 1.05rem; line-height: 1; }
.cat.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------------------------------------------------------------------------
   7. Listing grid
--------------------------------------------------------------------------- */
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 14px; }
.section-head h2 { margin: 0; }
.section-head .more { margin-left: auto; font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.card:hover { border-color: #cfd6de; }
.card a.card-link { color: inherit; display: block; }
.card a.card-link:hover { text-decoration: none; }
.card .thumb { aspect-ratio: 4 / 3; background: var(--surface); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb.is-empty { display: flex; align-items: center; justify-content: center; color: #b6bfc9; font-size: 1.6rem; }
.card .body { padding: 10px 12px 12px; }
.card .price { color: var(--price); font-weight: 700; font-size: 1rem; }
.card .price.is-free { color: var(--accent); }
.card .title {
  font-size: .92rem; font-weight: 600; margin: 2px 0 4px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--pill);
  background: var(--surface); color: var(--muted); font-size: .72rem; font-weight: 600;
}
.badge.buy { background: #eef3fe; color: var(--accent); }

/* ---------------------------------------------------------------------------
   8. Filters
--------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0; }
.filters select, .filters input {
  font: inherit; font-size: .88rem; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--pill); background: #fff; color: var(--ink); max-width: 140px;
}
.results-count { color: var(--muted); font-size: .88rem; margin-left: auto; }

/* ---------------------------------------------------------------------------
   9. Single listing
--------------------------------------------------------------------------- */
.listing { display: grid; gap: 24px; padding: 20px 0 40px; }
@media (min-width: 860px) { .listing { grid-template-columns: 1.25fr 1fr; align-items: start; } }
.listing .photo { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.listing .photo img { width: 100%; }
.listing .price { color: var(--price); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.listing .facts { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.listing .facts li { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.listing .facts span:first-child { color: var(--muted); min-width: 110px; }
.listing .desc { white-space: pre-wrap; overflow-wrap: anywhere; }
.sticky-cta { position: sticky; bottom: 0; background: #fff; padding: 12px 0; border-top: 1px solid var(--line); }
@media (min-width: 860px) { .sticky-cta { position: static; border-top: 0; padding: 0; } }
.share { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.share a, .share button { font-size: .86rem; padding: 8px 14px; }
.safety { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; font-size: .86rem; color: var(--muted); }
.safety strong { color: var(--ink); }

/* ---------------------------------------------------------------------------
   10. Forms
--------------------------------------------------------------------------- */
.form { max-width: 640px; margin: 0 auto; padding: 8px 0 48px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(26, 86, 219, .15); }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label {
  border: 1px solid var(--line); border-radius: var(--pill); padding: 9px 16px;
  cursor: pointer; font-size: .9rem; font-weight: 600; margin: 0;
}
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice input:checked + span { color: var(--accent); }
.choice label:has(input:checked) { border-color: var(--accent); background: #eef3fe; color: var(--accent); }
.choice label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.dropzone {
  border: 1px dashed #c6ced8; border-radius: var(--radius); padding: 22px; text-align: center;
  color: var(--muted); font-size: .9rem; background: var(--surface);
}
.dropzone img { margin: 10px auto 0; max-height: 220px; border-radius: 10px; }
.notice { padding: 12px 16px; border-radius: var(--radius); font-size: .92rem; margin-bottom: 18px; }
.notice-ok { background: #e9f7f0; color: #0b5c3b; }
.notice-err { background: #fdecea; color: var(--danger); }

/* ---------------------------------------------------------------------------
   11. Modal (location + report)
--------------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal[hidden] { display: none; }
.modal .backdrop { position: absolute; inset: 0; background: rgba(16, 21, 26, .4); border: 0; width: 100%; }
.modal .panel {
  position: relative; background: #fff; width: 100%; max-width: 440px;
  border-radius: var(--radius) var(--radius) 0 0; padding: 20px; box-shadow: var(--shadow);
  max-height: 86vh; overflow: auto;
}
@media (min-width: 640px) { .modal .panel { border-radius: var(--radius); } }
.modal h2 { font-size: 1.1rem; }

/* ---------------------------------------------------------------------------
   12. Lists, pagination, footer, misc
--------------------------------------------------------------------------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); }
.pagination { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 28px 0; }
.pagination .page-numbers {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--pill); color: var(--ink); font-size: .9rem;
}
.pagination .page-numbers.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination a:hover { text-decoration: none; background: var(--surface); }

.mine { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; gap: 12px; align-items: center; }
.mine img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.mine .m-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.status-dot { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status-publish { color: var(--price); }
.status-expired, .status-archived { color: var(--muted); }

.entry-content { max-width: 720px; margin: 0 auto; padding: 8px 0 48px; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content ul { padding-left: 20px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 60px; color: var(--muted); font-size: .88rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
