/* Discovery pages (home, businesses, offers, search).
   Loaded only by those views, and every class is dx- prefixed so it can never
   touch the business pages, cart or profile that share marketplace.css.
   Tokens (--ink, --muted, --line, --accent, ...) come from marketplace.css. */

.dx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 44px; padding: 0 1.15rem; border-radius: 12px; border: 1.5px solid var(--ink);
    font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.dx-btn:active { transform: translateY(1px); }
.dx-btn--dark { background: var(--ink); color: #fff; }
.dx-btn--dark:hover { background: #000; }
.dx-link { font-weight: 700; font-size: 0.9rem; color: var(--ink); border-bottom: 1.5px solid var(--line-strong); padding-bottom: 1px; white-space: nowrap; }
.dx-link:hover { border-bottom-color: var(--ink); }
.dx-link { position: relative; }
.dx-link::before { content: ""; position: absolute; inset: -12px -6px; } /* 44px hit area, same look */
.dx-btn:focus-visible, .dx-link:focus-visible, .dx-chip:focus-visible, .dx-near:focus-visible,
.dx-card:focus-visible, .dx-offer-link:focus-visible, .dx-feat-slide:focus-visible,
.dx-feat-arrow:focus-visible, .dx-feat-dot:focus-visible, .dx-strip:focus-visible {
    outline: 2px solid var(--ink); outline-offset: 3px;
}

/* ── Filters ─────────────────────────────────────────────────── */
.dx-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.25rem; }
.dx-search {
    flex: 1 1 340px; display: flex; align-items: center; gap: 0.6rem; min-height: 56px;
    padding: 0.3rem 0.3rem 0.3rem 1rem; background: #fff; color: var(--muted);
    border: 1.5px solid var(--line-strong); border-radius: 16px; transition: border-color 0.15s, box-shadow 0.15s;
}
.dx-search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(16, 18, 20, 0.08); }
.dx-search input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: 1rem; padding: 0.5rem 0;
}
.dx-search input::placeholder { color: #6b737c; }
.dx-search input::-webkit-search-cancel-button { cursor: pointer; }

/* ── Type-ahead ──────────────────────────────────────────────── */
/* Anchored to .dx-search, which gains position for it. The panel overlaps what is below rather than
   pushing the page down as someone types. */
.dx-search { position: relative; }
.dx-suggest {
    position: absolute; z-index: 30; top: calc(100% + 0.4rem); left: 0; right: 0;
    margin: 0; padding: 0.35rem; list-style: none;
    max-height: min(60vh, 26rem); overflow-y: auto;
    background: #fff; border: 1.5px solid var(--line-strong); border-radius: 14px;
    box-shadow: 0 18px 40px rgba(16, 18, 20, 0.14);
}
.dx-suggest[hidden] { display: none; }
.dx-suggest li {
    display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
    padding: 0.6rem 0.7rem; border-radius: 10px; cursor: pointer;
}
/* Hover and keyboard selection look identical on purpose: one highlighted row, however you got there. */
.dx-suggest li:hover, .dx-suggest li.is-active { background: #f1f4f7; }
.dx-suggest-title { font-weight: 600; color: var(--ink); }
.dx-suggest-meta { flex-shrink: 0; font-size: 0.85rem; color: var(--muted); }

.dx-near {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 56px; padding: 0 1.1rem;
    border: 1.5px solid var(--line-strong); border-radius: 16px; background: #fff; color: var(--ink);
    font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dx-near:hover { border-color: var(--ink); }
.dx-near.is-on { border-color: var(--accent-ink); background: #f0fdf4; color: var(--accent-ink); }
.dx-near[disabled] { opacity: 0.6; cursor: progress; }
.dx-status { flex-basis: 100%; margin: 0; min-height: 0; font-size: 0.85rem; color: var(--muted); }
.dx-status:empty { display: none; }
.dx-status.is-error { color: #b91c1c; }
.dx-filters--simple { margin-top: 1rem; align-items: flex-end; }
.dx-filters--simple .dx-near { min-height: 48px; }
.dx-select { display: inline-flex; flex-direction: column; gap: 0.15rem; }
.dx-select-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.dx-select select {
    min-height: 48px; padding: 0 2.2rem 0 0.9rem; border: 1.5px solid var(--line-strong); border-radius: 14px;
    background: #fff; color: var(--ink); font: inherit; font-size: 0.95rem;
}

.dx-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.dx-chip {
    flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; min-height: 42px; padding: 0 1rem;
    border: 1.5px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink);
    font-size: 0.9rem; font-weight: 600; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dx-chip:hover { border-color: var(--ink); }
.dx-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ── Page + section heads ────────────────────────────────────── */
.dx-page-head { padding: 1.4rem 0 0.2rem; max-width: 980px; }
.dx-page-head h1, .dx-hero h1 {
    font-size: clamp(2rem, 4.2vw, 3.2rem); line-height: 1.04; letter-spacing: -0.03em; font-weight: 800; text-wrap: balance;
}
.dx-lede { margin-top: 0.7rem; font-size: 1.08rem; color: var(--muted); max-width: 52ch; }
.dx-section { padding-top: 0.8rem; }
.dx-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dx-section-head h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 800; letter-spacing: -0.02em; }
.dx-count { margin: 0.15rem 0 0; font-size: 0.9rem; color: var(--muted); }

/* ── Hero ────────────────────────────────────────────────────── */
.dx-hero { display: grid; gap: 1.5rem; padding: 1.6rem 0 0.4rem; }
.dx-hero.has-featured { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 2.5rem; }
.dx-hero-copy { max-width: 720px; }

.dx-feat { position: relative; border-radius: 24px; overflow: hidden; min-height: 380px; background: #14171c; box-shadow: var(--shadow); }
.dx-feat-slides { position: absolute; inset: 0; }
.dx-feat-slide { position: absolute; inset: 0; display: flex; align-items: flex-end; color: #fff; opacity: 0; visibility: hidden; transition: opacity 0.5s ease; }
.dx-feat-slide.is-active { opacity: 1; visibility: visible; }
.dx-feat-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dx-feat-scrim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 10, 14, 0.88) 0%, rgba(8, 10, 14, 0.5) 45%, rgba(8, 10, 14, 0.05) 80%); }
.dx-feat-body { position: relative; display: grid; gap: 0.35rem; padding: 1.5rem 1.5rem 4.4rem; max-width: 40ch; }
.dx-feat-kicker { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.85); }
.dx-feat-name { font-family: "Archivo", sans-serif; font-size: 1.9rem; font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; }
.dx-feat-text { font-size: 0.95rem; line-height: 1.45; color: rgba(255, 255, 255, 0.88); }
.dx-feat-controls { position: absolute; left: 1.5rem; right: 1.25rem; bottom: 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dx-feat-dots { display: flex; gap: 0.15rem; }
.dx-feat-dot { position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.dx-feat-dot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 999px; background: rgba(255, 255, 255, 0.5); transition: width 0.2s, margin 0.2s, background 0.2s; }
.dx-feat-dot.is-active::before { width: 22px; margin-left: -11px; background: #fff; }
.dx-feat-arrows { display: flex; gap: 0.4rem; }
.dx-feat-arrow { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.94); color: var(--ink); cursor: pointer; transition: transform 0.1s, background 0.15s; }
.dx-feat-arrow:hover { background: #fff; }
.dx-feat-arrow:active { transform: scale(0.96); }

.dx-badge { display: inline-flex; align-items: center; padding: 0.22rem 0.6rem; border-radius: 999px; background: #fff; color: var(--ink); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; }
.dx-badge--float { position: absolute; top: 1rem; left: 1rem; }

/* ── Cards ───────────────────────────────────────────────────── */
.dx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.dx-card, .dx-offer {
    display: flex; flex-direction: column; overflow: hidden; background: #fff; color: inherit;
    border: 1px solid var(--line); border-radius: 18px; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.dx-card:hover, .dx-offer:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 16px 34px rgba(16, 18, 20, 0.1); }
.dx-card-media, .dx-offer-media { position: relative; aspect-ratio: 16 / 11; overflow: hidden; background: linear-gradient(135deg, #e9edf1, #d8dee4); }
.dx-card-media img, .dx-offer-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.dx-card:hover .dx-card-media img { transform: scale(1.03); }
.dx-card-initial { position: absolute; inset: 0; display: grid; place-items: center; font-family: "Archivo", sans-serif; font-size: 3rem; font-weight: 800; color: rgba(16, 18, 20, 0.28); }
.dx-card-media .dx-badge, .dx-offer-media .dx-badge { position: absolute; top: 0.75rem; left: 0.75rem; box-shadow: 0 2px 8px rgba(16, 18, 20, 0.15); }
.dx-card-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem 1.15rem; flex: 1; }
.dx-card-body h3 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; }
.dx-kicker { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.dx-kicker-dist { font-weight: 600; letter-spacing: 0; text-transform: none; }
.dx-kicker-dist::before { content: "\00b7"; margin-right: 0.5rem; }
.dx-blurb { margin: 0; font-size: 0.93rem; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.dx-blurb--3 { -webkit-line-clamp: 3; line-clamp: 3; }
.dx-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.25rem 0 0; padding: 0; }
.dx-tags li { padding: 0.2rem 0.6rem; border-radius: 999px; background: #f1f3f5; color: #3b424a; font-size: 0.78rem; font-weight: 700; }
.dx-tags li.is-reward { background: #e8f7ee; color: var(--accent-ink); }
.dx-poster { margin: 0; display: flex; align-items: center; gap: 0.65rem; }
.dx-poster > span:nth-child(2) { display: grid; line-height: 1.25; min-width: 0; }
.dx-poster strong { font-size: 0.93rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-poster small { font-size: 0.8rem; color: var(--muted); }
.dx-avatar { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--ink); color: #fff; font-family: "Archivo", sans-serif; font-weight: 800; }
.dx-badge--inline { margin-left: auto; background: #f1f3f5; }
.dx-offer--plain .dx-card-body { padding: 1.15rem 1.15rem 1.2rem; gap: 0.55rem; }
.dx-address { margin: auto 0 0; padding-top: 0.4rem; font-size: 0.83rem; color: #6b737c; }
.dx-offer-link { margin-top: auto; min-height: 44px; display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 800; font-size: 0.92rem; color: var(--accent-ink); }
.dx-offer-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Latest offers: a swipeable row instead of a second wall of cards. */
.dx-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 340px); gap: 1.1rem; overflow-x: auto; padding: 0.2rem 0.2rem 1rem; scroll-snap-type: x proximity; scrollbar-width: thin; }
.dx-strip > * { scroll-snap-align: start; }

/* ── Empty state ─────────────────────────────────────────────── */
.dx-empty { display: grid; justify-items: start; gap: 0.6rem; padding: 2rem; border: 1.5px dashed var(--line-strong); border-radius: 18px; background: rgba(255, 255, 255, 0.7); }
.dx-empty h3 { font-size: 1.25rem; font-weight: 800; }
.dx-empty p { max-width: 46ch; }

/* ── Earn band ───────────────────────────────────────────────── */
.dx-earn { margin-top: 1.5rem; padding: 2rem clamp(1.25rem, 3vw, 2.5rem); border-radius: 24px; background: var(--ink); color: #fff; }
.dx-earn h2 { color: #fff; font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; max-width: 22ch; }
.dx-earn ol { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; counter-reset: step; }
.dx-earn li { display: grid; align-content: start; gap: 0.3rem; counter-increment: step; padding-top: 0.9rem; border-top: 1px solid rgba(255, 255, 255, 0.22); }
.dx-earn li::before { content: counter(step); font-size: 0.8rem; font-weight: 800; color: #86efac; }
.dx-earn li strong { font-size: 1.05rem; }
.dx-earn li span { color: rgba(255, 255, 255, 0.78); font-size: 0.93rem; line-height: 1.5; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .dx-hero.has-featured { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .dx-feat { min-height: 340px; }
}
@media (max-width: 720px) {
    .dx-page-head, .dx-hero { padding-top: 0.6rem; }
    .dx-lede { font-size: 1rem; }
    .dx-search { flex-basis: 100%; min-height: 54px; }
    .dx-near { flex: 1 1 100%; justify-content: center; min-height: 48px; }
    /* Phones: one swipeable row instead of a wrapped block that pushes results down. */
    .dx-chips { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-left: -10px; margin-right: -10px; padding: 0 10px 0.2rem; scroll-padding: 0 10px; }
    .dx-chips::-webkit-scrollbar { display: none; }
    .dx-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .dx-strip { grid-auto-columns: 84%; margin-right: -10px; padding-right: 10px; }
    .dx-feat { min-height: 320px; }
    .dx-feat-name { font-size: 1.55rem; }
    .dx-earn ol { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .dx-section-head { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
    .dx-card, .dx-offer, .dx-card-media img, .dx-feat-slide, .dx-btn, .dx-feat-arrow { transition: none; }
    .dx-card:hover, .dx-offer:hover { transform: none; }
    .dx-card:hover .dx-card-media img { transform: none; }
}

/* ── Search result that is a thing, not a business ────────────── */
/* Reuses .dx-card wholesale; only the two extra lines (which business, what price) are new. */
.dx-item-at {
    margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--ink);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; overflow: hidden;
}
.dx-item-price { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--ink); }
/* An out-of-stock result stays clickable — the customer still learns the merchant carries it — so it
   is dimmed rather than disabled, and the badge on the image carries the actual message. */
.dx-item.is-out .dx-card-media img { opacity: 0.55; }
.dx-item.is-out .dx-item-price { color: var(--muted); text-decoration: line-through; }

/* A coupon in the offers list: the deal and the code to type at checkout. */
.dx-code { margin: 0.15rem 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.75rem; font-size: 0.88rem; color: var(--muted); }
.dx-code strong { font-size: 1rem; font-weight: 800; color: var(--accent-ink, #0a5c35); text-transform: uppercase; }
.dx-code code { padding: 0.15rem 0.5rem; border: 1px dashed currentColor; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.06em; color: #1a1a1a; background: #fff; }
/* A coupon's banner has lettering on it, so it is shown whole, never cropped. */
.dx-offer--coupon .dx-offer-media { aspect-ratio: 16 / 9; height: auto; }
.dx-offer--coupon .dx-offer-media img { width: 100%; height: 100%; object-fit: cover; }
