/* NoFin Catalog — front end. Everything is scoped under .nofin-cat and consumes
   the shared --nofin-* brand vars with local fallbacks, exactly like the wizard. */

.nofin-cat {
    --_primary: var(--nofin-primary, #FF6B0B);
    --_primary-hover: var(--nofin-primary-hover, #073F5B);
    --_heading: var(--nofin-heading, #073F5B);
    --_ink: var(--nofin-ink, #1a1d21);
    --_muted: var(--nofin-muted, #5b6570);
    --_line: #d9dde2;
    --_radius: 10px;
    --_font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    font-family: var(--_font);
    color: var(--_ink);
    line-height: 1.5;

    /* Claim the full width of our own immediate parent. On its own this only
       helps when that parent already has a correct width (see the Elementor
       fix below for when it doesn't). */
    display: block;
    width: 100%;
}
.nofin-cat, .nofin-cat *, .nofin-cat *::before, .nofin-cat *::after { box-sizing: border-box; }
.nofin-cat img { max-width: 100%; height: auto; }
/* our own display rules must not defeat the [hidden] attribute */
.nofin-cat [hidden] { display: none !important; }

/* Elementor's flexbox Containers ("e-con") only stretch a child to the full
   column width when the container's own "Align Items" is set to Stretch;
   otherwise a widget with no explicit width is shrink-to-fit sized against
   its OWN content — and since nothing inside our markup has a fixed pixel
   width (by design, for responsiveness), that shrink-to-fit measurement
   collapses down to roughly the cards' intrinsic content size instead of the
   column's real width. That is what made the home page slider render at a
   few hundred pixels instead of spanning its section, with its 1-of-3 cards
   packed to the left. Forcing the Elementor widget wrapper (any widget type —
   Shortcode, HTML, Text Editor) that holds our markup to stretch fixes it
   regardless of how the shortcode was embedded. Verified live against
   nofin.co.za before shipping. */
.elementor-widget:has(.nofin-cat) {
    width: 100% !important;
    align-self: stretch !important;
    flex: 1 1 auto !important;
}

/* --- Card ---------------------------------------------------------------- */

.nofin-cat__card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--_line);
    border-radius: var(--_radius);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.nofin-cat__card:has(.nofin-cat__card-link:hover),
.nofin-cat__card:has(.nofin-cat__card-link:focus-visible) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(7, 63, 91, .12);
}
.nofin-cat__card:has(.nofin-cat__card-link:focus-visible) { box-shadow: 0 0 0 2px var(--_primary-hover), 0 8px 24px rgba(7, 63, 91, .12); }

/* Whole-card click target: a stretched ::after on the title link, not a
   wrapping <a> (see templates/card.php for why). */
.nofin-cat__card-link {
    color: inherit;
    text-decoration: none;
    outline: none;
}
.nofin-cat__card-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.nofin-cat__card-media {
    position: relative;
    aspect-ratio: 3 / 2; /* 600x400 */
    background: #eef1f4;
}
.nofin-cat__card-img,
.nofin-cat__card-noimg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.nofin-cat__card-noimg { background: repeating-linear-gradient(45deg, #e9edf1, #e9edf1 10px, #eef1f4 10px, #eef1f4 20px); }

.nofin-cat__card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--nofin-negative, #b42318);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    padding: 3px 8px;
    border-radius: 4px;
}

.nofin-cat__card-body { padding: 14px 16px 16px; }
.nofin-cat__card-title {
    margin: 0 0 6px;
    font-family: var(--_font);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
    color: var(--_heading);
}
.nofin-cat__card-price {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--_primary);
}
.nofin-cat__card-fine {
    margin: 0;
    font-size: .8rem;
    color: var(--_muted);
}

/* Sold cards: dimmed, greyscale image, no lift. */
.nofin-cat__card.is-sold { opacity: .6; }
.nofin-cat__card.is-sold .nofin-cat__card-img { filter: grayscale(1); }
.nofin-cat__card.is-sold:has(.nofin-cat__card-link:hover),
.nofin-cat__card.is-sold:has(.nofin-cat__card-link:focus-visible) { transform: none; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
    .nofin-cat__card { transition: none; }
    .nofin-cat__card:has(.nofin-cat__card-link:hover) { transform: none; }
}

/* --- Button (mirrors nofin-core .nofin-btn so it works without the wizard
       stylesheet on the page). Scoped + !important to beat the host theme. --- */

.nofin-cat .nofin-btn {
    display: inline-block;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid transparent;
    border-radius: var(--_radius);
    padding: .8rem 1.25rem;
    font-family: var(--_font);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.nofin-cat .nofin-btn--primary,
.nofin-cat .nofin-btn--primary:link,
.nofin-cat .nofin-btn--primary:visited {
    background: var(--_primary) !important;
    border-color: var(--_primary) !important;
    color: var(--nofin-primary-text, #fff) !important;
}
.nofin-cat .nofin-btn--primary:hover,
.nofin-cat .nofin-btn--primary:focus-visible {
    background: var(--_primary-hover) !important;
    border-color: var(--_primary-hover) !important;
    color: #fff !important;
}
.nofin-cat .nofin-btn--ghost,
.nofin-cat .nofin-btn--ghost:link,
.nofin-cat .nofin-btn--ghost:visited {
    background: transparent !important;
    border-color: var(--_line) !important;
    color: var(--_ink) !important;
}
.nofin-cat .nofin-btn--ghost:hover,
.nofin-cat .nofin-btn--ghost:focus-visible {
    border-color: var(--_primary-hover) !important;
    color: var(--_primary-hover) !important;
}

/* --- Form controls (mirror nofin-core .nofin-field, scoped) ------------- */

.nofin-cat .nofin-field { display: block; }
.nofin-cat .nofin-field__label { display: block; font-weight: 700; margin-bottom: .35rem; font-size: .9rem; }
.nofin-cat .nofin-field__input {
    width: 100%;
    border: 1px solid var(--_line);
    border-radius: var(--_radius);
    padding: .6rem .65rem;
    font-family: var(--_font);
    font-size: 1rem;
    background: #fff;
    color: var(--_ink);
}
.nofin-cat .nofin-field__input:focus,
.nofin-cat .nofin-field__input:focus-visible { outline: 2px solid var(--_primary-hover); outline-offset: -2px; }
.nofin-cat select.nofin-field__input:disabled { background: #f4f5f7; color: var(--_muted); }

/* --- Catalog: filter bar + grid --------------------------------------- */

.nofin-cat__catalog { display: block; }

.nofin-cat__filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 16px;
    align-items: end;
    margin: 0 0 20px;
}
@media (min-width: 640px) {
    .nofin-cat__filters { grid-template-columns: 1fr 1fr; }
    .nofin-cat__filter--price { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
    .nofin-cat__filters { grid-template-columns: 1fr 1fr 1.4fr auto; }
    .nofin-cat__filter--price { grid-column: auto; }
}
.nofin-cat__filter-actions { display: flex; align-items: center; gap: 12px; }
.nofin-cat__filter-submit { padding: .6rem 1rem !important; }
.nofin-cat__clear {
    color: var(--_primary-hover);
    font-size: .9rem;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: 0;
}
.nofin-cat__count { grid-column: 1 / -1; margin: 0; color: var(--_muted); font-size: .9rem; }
.nofin-cat__price-out { font-weight: 400; color: var(--_muted); }
.nofin-cat__range { width: 100%; accent-color: var(--_primary); }

.nofin-cat__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    transition: opacity .15s ease;
    min-height: 40px;
}
@media (min-width: 560px) { .nofin-cat__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .nofin-cat__grid { grid-template-columns: repeat(var(--cols, 3), 1fr); } }
.nofin-cat__grid.is-loading { opacity: .5; pointer-events: none; }

.nofin-cat__empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--_muted);
    background: #f6f7f8;
    border: 1px solid var(--_line);
    border-radius: var(--_radius);
}
.nofin-cat__loadmore-wrap { text-align: center; margin-top: 22px; }

/* --- Car page -------------------------------------------------------- */

.nofin-cat__detail-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 900px) {
    .nofin-cat__detail-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: start; }
}

.nofin-cat__gallery-main {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--_radius);
    overflow: hidden;
    background: #eef1f4;
}
.nofin-cat__gallery-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nofin-cat__thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nofin-cat__thumb {
    width: 76px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #eef1f4;
    cursor: pointer;
}
.nofin-cat__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nofin-cat__thumb.is-active { border-color: var(--_primary); }
.nofin-cat__thumb:focus-visible { outline: 2px solid var(--_primary-hover); outline-offset: 2px; }

.nofin-cat__offer-title {
    margin: 0;
    font-family: var(--_font);
    font-weight: 900;
    color: var(--_heading);
    font-size: 1.9rem;
    line-height: 1.15;
}
.nofin-cat__offer-variant { margin: .2rem 0 0; color: var(--_muted); font-size: 1.05rem; }
.nofin-cat__offer-price { margin: 1rem 0 .35rem; font-size: 2.15rem; font-weight: 800; color: var(--_primary); line-height: 1.1; }
.nofin-cat__offer-deposit { margin: 0 0 .2rem; font-size: 1.05rem; }
.nofin-cat__offer-fine { margin: 0; font-size: .8rem; color: var(--_muted); }
.nofin-cat__offer-cta { margin: 1.1rem 0 0; }
.nofin-cat__apply { display: block !important; width: 100%; padding: 1rem 1.25rem !important; font-size: 1.05rem !important; }

.nofin-cat__sold-panel {
    margin: 1.1rem 0 0;
    padding: 1rem 1.15rem;
    border: 1px solid var(--_line);
    border-radius: var(--_radius);
    background: #f6f7f8;
}
.nofin-cat__sold-panel p { margin: 0 0 .6rem; }
.nofin-cat__sold-panel a { display: inline-block !important; }

.nofin-cat__specs { margin: 1.5rem 0 0; display: grid; gap: 0; }
.nofin-cat__spec {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--_line);
}
.nofin-cat__spec:first-child { border-top: 1px solid var(--_line); }
.nofin-cat__specs dt { margin: 0; color: var(--_muted); }
.nofin-cat__specs dd { margin: 0; font-weight: 600; }

.nofin-cat__detail-desc { margin-top: 28px; line-height: 1.6; }
.nofin-cat__detail-related { margin-top: 36px; }

/* --- Vehicle summary (above the wizard) ----------------------------- */

.nofin-cat__summary {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--_line);
    border-radius: var(--_radius);
    background: #fff;
    max-width: 34rem;
}
.nofin-cat__summary-img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; }
.nofin-cat__summary-body { min-width: 0; }
.nofin-cat__summary-label { margin: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--_muted); }
.nofin-cat__summary-name { margin: .1rem 0; font-weight: 900; color: var(--_heading); }
.nofin-cat__summary-price { margin: 0; color: var(--_primary); font-weight: 800; }

/* --- Slider -------------------------------------------------------------- */

.nofin-cat__slider { margin: 0; }
.nofin-cat__slider-title {
    margin: 0 0 14px;
    font-family: var(--_font);
    font-weight: 900;
    color: var(--_heading);
    font-size: 1.4rem;
}
.nofin-cat__slider-viewport { position: relative; }

.nofin-cat__slider-track {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0 0 4px;
    list-style: none;
    overflow-x: auto;
    /* proximity (not mandatory): snaps on swipe without rubber-banding off the
       last page when N cards don't divide the viewport exactly. */
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    .nofin-cat__slider-track { scroll-behavior: auto; }
}
.nofin-cat__slider-track::-webkit-scrollbar { display: none; }
.nofin-cat__slider-track:focus-visible { outline: 2px solid var(--_primary-hover); outline-offset: 2px; }

.nofin-cat__slider-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}
@media (min-width: 768px) {
    .nofin-cat__slider-slide { flex-basis: calc(50% - 8px); }
}
@media (min-width: 1024px) {
    .nofin-cat__slider-slide { flex-basis: calc(33.333% - 11px); }
}

.nofin-cat__slider-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 1px solid var(--_line);
    border-radius: 999px;
    background: #fff;
    color: var(--_heading);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(7, 63, 91, .12);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.nofin-cat__slider-arrow[data-slider-arrow="prev"] { left: -8px; }
.nofin-cat__slider-arrow[data-slider-arrow="next"] { right: -8px; }
.nofin-cat__slider-arrow:not(:disabled):hover,
.nofin-cat__slider-arrow:not(:disabled):focus-visible {
    background: var(--nofin-positive, #137a3d);
    border-color: var(--nofin-positive, #137a3d);
    color: #fff;
}
.nofin-cat__slider-arrow:disabled { opacity: .35; cursor: default; box-shadow: none; }
@media (min-width: 1024px) and (hover: hover) {
    .nofin-cat__slider-arrow:not([hidden]) { display: block; }
}

.nofin-cat__slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.nofin-cat__slider-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--_line);
    cursor: pointer;
}
.nofin-cat__slider-dot.is-active { background: var(--_primary); }

.nofin-cat__slider-cta { margin: 18px 0 0; text-align: center; }
