/* listings.html (SPEC-070) — marketplace.html layout blocks that this page
 * actually uses (tokens, header, search bar, location line, results meta,
 * grid/cards, empty state, modal, breakpoints) plus the MAP category rail
 * (.theme-category-filter / __btn / __add-btn / --category-color) copied from
 * index.html and re-flowed as a static row instead of a map overlay.
 * No marketplace product categories (.mp-categories__grid / .mp-cat). */

:root {
    --mp-ink: #f1f5f9;
    --mp-muted: #94a3b8;
    --mp-bg: #0b0e14;
    --mp-surface: #12161f;
    --mp-card: #161b26;
    --mp-border: #2a3242;
    --mp-search: #1a2030;
    --mp-search-icon: #242b3a;
    --mp-blue: #3b82f6;
    --mp-blue-hover: #60a5fa;
    --mp-overlay: rgba(8, 11, 18, 0.88);
    --mp-action: #0f172a;
    --mp-cats-bg: linear-gradient(180deg, #10151f 0%, #0b0e14 100%);
    --mp-shell: min(1240px, calc(100% - 32px));
    color-scheme: dark;
}

* { box-sizing: border-box; }

body.listings-page {
    margin: 0;
    min-height: 100vh;
    background: var(--mp-bg);
    color: var(--mp-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.listings-page h1,
body.listings-page h2,
body.listings-page h3 {
    color: var(--mp-ink);
}

.mp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.mp-shell {
    width: var(--mp-shell);
    margin: 0 auto;
}

/* Header (marketplace.html .mp-header block) */
.mp-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--mp-border);
    background: rgba(11, 14, 20, 0.92);
    backdrop-filter: blur(14px);
}

.mp-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
}

.mp-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--mp-ink);
    text-decoration: none;
    font-weight: 800;
}

.mp-brand__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.1;
}

.mp-brand__name {
    font-size: 16px;
    font-weight: 800;
}

.mp-brand__explore {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--mp-muted);
    letter-spacing: -0.01em;
}

.mp-brand__mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--mp-blue);
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.mp-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mp-nav a {
    color: var(--mp-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
}

.mp-nav a[aria-current="page"],
.mp-nav a:hover {
    color: var(--mp-ink);
    background: var(--mp-surface);
}

/* Search — full-width bar (marketplace.html .mp-search-bar block) */
.mp-search-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    border-bottom: 1px solid var(--mp-border);
    background: var(--mp-search);
}

.mp-search-bar__icon {
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    border: 0;
    padding: 0;
    background: var(--mp-search-icon);
    color: var(--mp-ink);
    cursor: pointer;
}

.mp-search-bar__icon:hover {
    background: #30384a;
}

.mp-search-bar__icon svg {
    width: 20px;
    height: 20px;
}

.mp-search-bar input[type="search"] {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    border: 0;
    background: transparent;
    color: var(--mp-ink);
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    padding: 12px 16px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.mp-search-bar input::placeholder {
    color: #64748b;
    font-weight: 500;
}

.mp-search-bar input:focus {
    outline: none;
}

/* Solid high-contrast ring for keyboard focus (the inset glow alone is too faint). */
.mp-search-bar input:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.mp-search-bar:focus-within {
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

/* Location (marketplace.html .mp-location block) */
.mp-location {
    padding: 14px 0 4px;
}

.mp-location__label {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--mp-ink);
}

.mp-location__label span {
    color: var(--mp-muted);
    font-weight: 600;
}

.mp-location__label span[data-listings-place] {
    color: var(--mp-ink);
    font-weight: 700;
}

/* Category rail wrapper (replaces marketplace .mp-categories grid) */
.mp-categories {
    padding: 12px 0 4px;
    background: var(--mp-cats-bg);
}

/* ── Map category rail, from index.html ──────────────────────────────
 * .theme-category-filter base (index.html ~6266) minus the map overlay
 * positioning (position:absolute; bottom:0; gradient) so it flows in-page. */
.theme-category-filter {
    position: relative;
    --category-filter-scale: 0.75;
    --active-filter-color: #0f5fd1;
    --active-filter-ink: #ffffff;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding: calc(0.55rem * var(--category-filter-scale)) calc(0.85rem * var(--category-filter-scale)) calc(0.65rem * var(--category-filter-scale));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    pointer-events: auto;
    min-height: 67px;
    width: 100%;
    box-sizing: border-box;
}

.theme-category-filter::-webkit-scrollbar {
    display: none;
}

/* .theme-category-filter__btn (index.html ~6311) */
.theme-category-filter__btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: calc(0.5rem * var(--category-filter-scale, 1));
    min-height: calc(44px * var(--category-filter-scale, 1));
    padding: calc(0.58rem * var(--category-filter-scale, 1)) calc(1rem * var(--category-filter-scale, 1));
    border: 1px solid rgba(18, 38, 76, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #132346;
    font: inherit;
    font-size: calc(0.9rem * var(--category-filter-scale, 1));
    font-weight: 750;
    white-space: nowrap;
    flex: 0 0 auto;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 calc(10px * var(--category-filter-scale, 1)) calc(26px * var(--category-filter-scale, 1)) rgba(18, 38, 76, 0.06);
}

/* Per-category colours (index.html ~6331) — the ONE category vocabulary. */
.theme-category-filter__btn[data-category-filter="News"] { --category-color: #38bdf8; }
.theme-category-filter__btn[data-category-filter="Events"] { --category-color: #fbbf24; }
.theme-category-filter__btn[data-category-filter="Offers"] { --category-color: #f472b6; }
.theme-category-filter__btn[data-category-filter="Accommodation"] { --category-color: #4ade80; }
.theme-category-filter__btn[data-category-filter="Job-Offers"] { --category-color: #fb923c; }
.theme-category-filter__btn[data-category-filter="Food"] { --category-color: #f87171; }
.theme-category-filter__btn[data-category-filter="Fetch_Deliveries"] { --category-color: #22d3ee; }

/* Rest / active / svg (index.html ~6761) */
.theme-category-filter__btn[data-category-filter]:not(.is-active):not(:hover):not(:focus-visible):not(.theme-category-filter__add-btn) {
    border-color: color-mix(in srgb, var(--category-color) 72%, transparent);
    box-shadow:
        0 calc(10px * var(--category-filter-scale, 1)) calc(26px * var(--category-filter-scale, 1)) rgba(18, 38, 76, 0.06),
        0 0 calc(14px * var(--category-filter-scale, 1)) color-mix(in srgb, var(--category-color) 38%, transparent);
}

.theme-category-filter__btn.is-active,
.theme-category-filter__btn:hover,
.theme-category-filter__btn:focus-visible {
    border-color: var(--active-filter-color, #0f5fd1);
    background: var(--active-filter-color, #0f5fd1);
    color: #fff;
    outline: none;
    box-shadow:
        0 calc(10px * var(--category-filter-scale, 1)) calc(26px * var(--category-filter-scale, 1)) rgba(18, 38, 76, 0.08),
        0 0 calc(18px * var(--category-filter-scale, 1)) color-mix(in srgb, var(--active-filter-color, #0f5fd1) 48%, transparent);
}

/* Active and focused look the same otherwise: keyboard focus gets its own ring. */
.theme-category-filter__btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--active-filter-color, #0f5fd1);
}

.theme-category-filter__btn svg {
    stroke: currentColor;
    width: calc(21px * var(--category-filter-scale, 1));
    height: calc(21px * var(--category-filter-scale, 1));
}

/* + add-service control (index.html ~8394) */
.theme-category-filter__add-btn,
#llsvc-toggle-btn {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 52px;
    width: 52px;
    height: 31px;
    min-height: 31px;
    padding-inline: 0;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
    justify-content: center;
    align-items: flex-end;
    font-size: 36px;
    line-height: 1;
    background: #15803d;
    border-color: #166534;
    color: #fff;
    box-shadow: 0 12px 30px rgba(21, 128, 61, .38), 0 3px 10px rgba(0,0,0,.24);
}

.theme-category-filter__add-btn.is-active,
.theme-category-filter__add-btn:hover,
.theme-category-filter__add-btn:focus-visible,
.theme-category-filter__add-btn[aria-expanded="true"] {
    background: #166534;
    border-color: #14532d;
    color: #fff;
    filter: none;
}

.theme-category-filter__add-btn[hidden],
#llsvc-toggle-btn[hidden] {
    display: none;
}

/* Dark chip skin (index.html ~9242) — marketplace surface is dark. */
.theme-category-filter__btn {
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.85);
    color: #e2e8f0;
    box-shadow: none;
    transition: transform 250ms ease, background-color 250ms ease, border-color 250ms ease, color 250ms ease;
}

.theme-category-filter__btn:hover {
    transform: translateY(-2px);
}

.theme-category-filter__btn[data-category-filter]:not(.is-active):not(:hover):not(:focus-visible):not(.theme-category-filter__add-btn) {
    border-color: color-mix(in srgb, var(--category-color) 55%, transparent);
    box-shadow: 0 0 calc(14px * var(--category-filter-scale, 1)) color-mix(in srgb, var(--category-color) 22%, transparent);
}

.theme-category-filter__btn.is-active,
.theme-category-filter__btn:hover,
.theme-category-filter__btn:focus-visible {
    color: var(--active-filter-ink, #ffffff);
}

/* Without JS the active chip still takes its own category accent (index.html
 * sets --active-filter-color / --active-filter-ink from JS; here the chip's
 * own --category-color feeds the same variables). Dark ink clears 4.5:1 on
 * every bright category accent; the default #0f5fd1 "All" fill keeps white. */
.theme-category-filter__btn.is-active[data-category-filter]:not([data-category-filter=""]) {
    --active-filter-color: var(--category-color);
    --active-filter-ink: #041017;
}

/* Results (marketplace.html .mp-main block) */
.mp-main {
    padding: 20px 0 64px;
}

.mp-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.mp-results-meta {
    margin: 0 0 16px;
    color: var(--mp-ink);
    font-size: 14px;
    font-weight: 600;
}

.mp-results-meta strong {
    color: var(--mp-ink);
}

.mp-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.mp-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--mp-border);
    background: var(--mp-card);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mp-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #0f141c;
    overflow: hidden;
}

.mp-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mp-card__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #334155;
}

.mp-card__placeholder svg {
    width: 44px;
    height: 44px;
    stroke: currentColor;
}

.mp-card__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--mp-overlay);
    color: #fff;
}

.mp-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-card__title a {
    color: inherit;
    text-decoration: none;
}

.mp-card__title a:hover,
.mp-card__title a:focus-visible {
    text-decoration: underline;
}

.mp-card__price {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 800;
}

.mp-card__summary {
    margin: 0;
    padding: 10px 12px;
    color: var(--mp-muted);
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1 1 auto;
}

.mp-card__actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    background: var(--mp-action);
    border-top: 1px solid var(--mp-border);
}

.mp-action {
    display: grid;
    place-items: center;
    min-height: 40px;
    border: 0;
    background: transparent;
    color: var(--mp-blue);
    cursor: pointer;
    padding: 8px;
    text-decoration: none;
}

.mp-action:hover {
    background: rgba(59, 130, 246, 0.16);
}

.mp-action svg {
    width: 20px;
    height: 20px;
}

/* Empty state (marketplace.html .mp-empty block) */
.mp-empty {
    display: none;
    padding: 48px 20px;
    text-align: center;
    color: var(--mp-muted);
    border: 1px dashed var(--mp-border);
    border-radius: 8px;
    background: var(--mp-surface);
}

.mp-empty.is-visible {
    display: block;
}

.mp-empty a {
    color: var(--mp-blue-hover);
}

/* Listing modal (marketplace.html .mp-modal block) */
.mp-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
}

.mp-modal.is-open {
    display: grid;
}

.mp-modal__panel {
    width: min(440px, 100%);
    overflow: hidden;
    border-radius: 12px;
    background: var(--mp-card);
    border: 1px solid var(--mp-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    color: var(--mp-ink);
}

.mp-modal__media {
    aspect-ratio: 16 / 10;
    background: #0f141c;
}

.mp-modal__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mp-modal__body {
    padding: 18px 20px 20px;
}

.mp-modal__body h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.mp-modal__body p {
    margin: 0 0 16px;
    color: var(--mp-muted);
    font-size: 14px;
    line-height: 1.5;
}

.mp-modal__price {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
}

.mp-modal__link {
    display: block;
    margin: 0 0 12px;
    color: var(--mp-blue-hover);
    font-weight: 700;
}

.mp-modal__close {
    min-height: 42px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--mp-blue);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.mp-modal__close:hover {
    background: var(--mp-blue-hover);
}

@media (max-width: 1100px) {
    .mp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .mp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mp-nav {
        gap: 2px;
    }

    .mp-nav a {
        font-size: 13px;
        padding: 7px 8px;
    }
}

@media (max-width: 420px) {
    .mp-grid {
        grid-template-columns: 1fr;
    }
}
