/* ═══════════════════════════════════════════════════════════════
   3RG WebSearch v2 — dark brand theme (matches 3rdrockgrid.com)
   Tokens: bg #0C0C0C · surface #141414 · elevated #1C1C1C
           orange #E07820 · orange-light #F0933A
           text #EAEAE8 · muted #A8A8A4 · borders #2E2E2A
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0C0C0C;
    --surface:   #141414;
    --elevated:  #1C1C1C;
    --sunken:    #090909;
    --accent:    #E07820;
    --accent-2:  #F0933A;
    --text:      #EAEAE8;
    --muted:     #A8A8A4;
    --faint:     #686864;
    --border:    #2E2E2A;
    --border-hi:   rgba(224, 120, 32, 0.45);  /* accent @ 45% — recomputed from config */
    --accent-soft: rgba(224, 120, 32, 0.10);  /* accent @ 10% */
    --accent-line: rgba(224, 120, 32, 0.25);  /* accent @ 25% */
    --font-head: 'Orbitron', sans-serif;
    --font-ui:   'Rajdhani', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    color-scheme: dark;

    /* ═══════════════════════════════════════════════════════════════
       PER-AREA BRANDING KNOBS
       Each region of the page — HEADER (top bar), HERO (landing grid
       name above the search box), RESULTS (search cards + detail pages),
       and FOOTER — has its own background, text colour and font so a
       theme file (digi.css / hgcity.css) can style each independently.
       Defaults below just point back at the core tokens above, so the
       3RG theme is unchanged; override only what you need in a theme.
       ═══════════════════════════════════════════════════════════════ */

    /* ── HEADER (the top bar with the logo + grid name + nav) ── */
    --header-bg:           rgba(9, 9, 9, 0.96); /* top-bar background          */
    --header-text:         var(--text);         /* grid name beside the logo   */
    --header-font:         var(--font-head);    /* font of that grid name       */
    --header-name-display: inline;              /* set to `none` to HIDE the
                                                   grid name in the top bar     */

    /* ── HERO (landing page: the grid name shown above the search box) ── */
    --hero-name-color:     var(--text);         /* colour of that big grid name */
    --hero-name-font:      var(--font-head);    /* font  of that big grid name  */
    --hero-name-display:   block;               /* set to `none` to HIDE the
                                                   grid name above the search   */

    /* ── RESULTS (search result cards + detail pages) ── */
    --results-bg:          var(--surface);      /* card / detail background     */
    --results-text:        var(--text);         /* result titles               */
    --results-font:        var(--font-body);    /* result body text            */

    /* ── FOOTER ── */
    --footer-bg:           var(--sunken);       /* footer background           */
    --footer-text:         var(--faint);        /* footer text                 */
    --footer-font:         var(--font-body);    /* footer font                 */
}

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand img { height: 39px; width: auto; display: block; }
.brand-name {
    display: var(--header-name-display);
    font-family: var(--header-font);
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--header-text);
    white-space: nowrap;
}
.topnav { display: flex; gap: 6px; }
.topnav a {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.topnav a:hover { color: var(--text); text-decoration: none; background: var(--elevated); }
.topnav a.active {
    color: var(--accent-2);
    border-color: var(--border-hi);
    background: var(--accent-soft);
}

/* ── Layout ──────────────────────────────────────────────────── */
.wrap { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 18px 16px 28px; }

.page-title {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.page-title i { color: var(--accent); }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }

/* ── Search form ─────────────────────────────────────────────── */
.search-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}
.search-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-input {
    flex: 1 1 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
}
.search-input:focus-within { border-color: var(--border-hi); }
.search-input i { color: var(--faint); }
.search-input input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    min-width: 80px;
}
select {
    background: var(--sunken);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 10px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #0C0C0C;
    border: none;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    padding: 9px 18px;
    cursor: pointer;
}
.btn:hover { background: var(--accent-2); text-decoration: none; color: #0C0C0C; }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--elevated); color: var(--text); }

/* ── Result cards ────────────────────────────────────────────── */
.results { display: flex; flex-direction: column; gap: 10px; }

.card {
    display: flex;
    gap: 0;
    background: var(--results-bg);
    font-family: var(--results-font);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border-hi); }

.card-thumb {
    flex: 0 0 132px;
    position: relative;                 /* image layers over the icon fallback */
    background: var(--sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}
.card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.thumb-fallback { color: var(--faint); font-size: 2rem; }

.card-body { flex: 1; min-width: 0; padding: 12px 14px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-2);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    padding: 2px 9px;
    margin-bottom: 5px;
}
.card-title {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.card-title a { color: var(--results-text); }
.card-title a:hover { color: var(--accent-2); text-decoration: none; }
.card-meta { color: var(--muted); font-size: 0.82rem; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.card-meta i { color: var(--accent); margin-right: 4px; }
.card-desc {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Detail pages ────────────────────────────────────────────── */
.detail {
    background: var(--results-bg);
    font-family: var(--results-font);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.detail-hero { display: flex; flex-wrap: wrap; }
.detail-hero .hero-img {
    flex: 0 0 300px;
    max-width: 100%;
    position: relative;                 /* image layers over the icon fallback */
    background: var(--sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.detail-hero .hero-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.detail-hero .hero-img .thumb-fallback { font-size: 3.2rem; }
.detail-hero .hero-body { flex: 1 1 300px; min-width: 0; padding: 16px 18px; }
.detail h1 {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.35rem;
    line-height: 1.25;
    color: var(--results-text);
    overflow-wrap: anywhere;
}
.detail-desc { color: var(--muted); font-size: 0.92rem; margin-top: 10px; overflow-wrap: anywhere; }
.detail-facts {
    border-top: 1px solid var(--border);
    padding: 12px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 0.9rem;
    color: var(--muted);
}
.detail-facts i { color: var(--accent); margin-right: 6px; }
.detail-actions {
    border-top: 1px solid var(--border);
    padding: 12px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── Sub-lists on detail pages (parcel objects, picks, classifieds) ── */
.sublist { margin-top: 20px; }
.sublist h2 {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.sublist h2 i { color: var(--accent); }
.sublist table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sublist th {
    text-align: left;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}
.sublist td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(46, 46, 42, 0.6);
    color: var(--muted);
    overflow-wrap: anywhere;
}
.sublist td:first-child { color: var(--text); font-weight: 500; }
.sublist tr:hover td { background: var(--elevated); }

/* ── Land size buckets ───────────────────────────────────────── */
.bucket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.bucket {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s;
}
.bucket:hover { border-color: var(--border-hi); text-decoration: none; }
.bucket i { font-size: 1.5rem; color: var(--accent); width: 30px; text-align: center; }
.bucket .b-name { font-family: var(--font-ui); font-weight: 700; font-size: 1rem; color: var(--text); }
.bucket .b-count { color: var(--muted); font-size: 0.82rem; }

.price-tag {
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--accent-2);
}

/* ── Showcase ────────────────────────────────────────────────── */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.showcase-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.showcase-card:hover { border-color: var(--border-hi); text-decoration: none; }
.showcase-card .sc-media {
    position: relative;               /* deferred image layers over the icon */
    width: 100%;
    aspect-ratio: 2 / 1;
    background: var(--sunken);
}
.showcase-card .sc-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.showcase-card .sc-img-fallback {
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--faint); font-size: 2rem;
}
.showcase-card .sc-body { padding: 10px 12px; }
.showcase-card .sc-title { font-family: var(--font-ui); font-weight: 700; color: var(--text); }
.showcase-card .sc-desc { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

/* ── Landing hero ────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 34px 10px 26px;
}
.hero .hero-logo { height: 74px; width: auto; margin-bottom: 14px; }
.hero h1 {
    display: var(--hero-name-display);
    font-family: var(--hero-name-font);
    font-weight: 600;
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--hero-name-color);
}
.hero .tagline {
    font-family: var(--font-ui);
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--accent-2);
    margin-top: 6px;
}
.hero-search {
    max-width: 640px;
    margin: 22px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hero-search .search-input {
    flex: 1 1 260px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
}
.hero-search .search-input input { font-size: 1.05rem; }
.hero-search .btn { padding: 12px 22px; border-radius: 12px; }

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.chips.left { justify-content: flex-start; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-hi); text-decoration: none; }
.chip.active {
    color: #0C0C0C;
    background: var(--accent);
    border-color: var(--accent);
}
.chip.active i { color: #0C0C0C; }
.chip i { color: var(--accent); }
.chip .chip-count {
    font-size: 0.72rem;
    background: rgba(0,0,0,0.25);
    border-radius: 999px;
    padding: 0 7px;
}
.chip:not(.active) .chip-count { background: var(--elevated); color: var(--faint); }

/* Stat strip */
.stat-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 26px;
    margin: 26px auto 6px;
    color: var(--muted);
    font-size: 0.86rem;
}
.stat-strip .stat i { color: var(--accent); margin-right: 7px; }
.stat-strip .stat strong { color: var(--text); font-family: var(--font-ui); font-size: 1rem; }

/* Section headings on landing */
.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0 12px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
}
.section-head i { color: var(--accent); }
.section-head::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--border-hi), transparent); }

/* Area badge on land results */
.area-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--text);
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
}

/* ── Notices / empty states ──────────────────────────────────── */
.notice {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 26px 20px;
    text-align: center;
    color: var(--muted);
}
.notice i { font-size: 2rem; color: var(--faint); display: block; margin-bottom: 10px; }
.notice strong { color: var(--text); }

.result-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 0.88rem;
    margin: 4px 0 12px;
}

/* ── Deferred thumbnails: fade in as the loader fetches them ── */
img[data-src] { opacity: 0; transition: opacity 0.35s ease; }
img[data-src].loaded { opacity: 1; }

/* ── Matched-term highlight ──────────────────────────────────── */
mark {
    background: var(--accent-soft);
    color: var(--accent-2);
    border-radius: 3px;
    padding: 0 2px;
}

/* ── Trending searches ───────────────────────────────────────── */
.trending {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.trending-label {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.trending-label i { color: var(--accent); margin-right: 5px; }

/* ── Autocomplete dropdown ───────────────────────────────────── */
.ac-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-align: left;
}
.ac-item {
    padding: 9px 14px;
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
}
.ac-item:hover, .ac-item.active {
    background: var(--accent-soft);
    color: var(--accent-2);
}

/* ── Pagination ──────────────────────────────────────────────── */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
}
.pager a, .pager span.cur {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 13px;
}
.pager a:hover { color: var(--text); border-color: var(--border-hi); text-decoration: none; }
.pager span.cur { color: #0C0C0C; background: var(--accent); border-color: var(--accent); }
.pager .pager-info { color: var(--faint); font-size: 0.8rem; padding: 0 8px; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    background: var(--footer-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--footer-text);
    font-family: var(--footer-font);
    font-size: 0.8rem;
}
.footer a { color: var(--muted); }

/* ── Small screens / narrow viewer panels ────────────────────── */
@media (max-width: 560px) {
    .brand-name { display: none; }
    .card-thumb { flex-basis: 96px; }
    .card-thumb img { width: 96px; height: 84px; }
    .detail-hero .hero-img, .detail-hero .hero-img img { flex-basis: 100%; width: 100%; height: auto; }
}
