/* Listing presentation shared by every theme: highlights and formatted descriptions.
 *
 * ListingView builds both: `highlights` (the other pieces of a Zameen title, "Prime Location") and `description_html`
 * (paragraphs, lists, labels, a native "Read the full description" fold). Everything inherits the theme's font and
 * colour; lines and fills are mixed from currentColor, so the same rules read on dark and light themes.
 * A theme may tune two variables: --em-tag-radius (tags and the fold button) and --em-desc-accent (list markers).
 */

/* ---------- Highlights: quiet tags under the property heading ---------- */
.em-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: .8125em;
    line-height: 1.25;
}
.em-highlights > li {
    display: inline-flex;
    align-items: center;
    gap: .55em;
    max-width: 100%;
    margin: 0;
    padding: .5em .95em;
    border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
    border-radius: var(--em-tag-radius, 999px);
    background: color-mix(in srgb, currentColor 6%, transparent);
    font-weight: 500;
    letter-spacing: .01em;
    overflow-wrap: anywhere;
}
.em-highlights > li::before {
    content: "";
    flex: none;
    width: .4em;
    height: .4em;
    border-radius: 50%;
    background: var(--em-desc-accent, currentColor);
    opacity: .75;
}

/* ---------- Description: paragraphs, labels, lists ---------- */
.em-desc { overflow-wrap: break-word; }
/* Only the blocks built here are spaced: a theme's own aside in the text (a pull quote) keeps its margins. */
.em-desc > :is(p, ul, ol, details),
.em-desc-more > :is(p, ul, ol) { margin: 0; }
.em-desc > * + :is(p, ul, ol, details),
.em-desc-more > * + :is(p, ul, ol) { margin-top: 1em; }

.em-desc-label { line-height: 1.4; break-after: avoid; }
.em-desc-label > strong { font-weight: 700; }
/* A label written in capitals is set smaller and spaced, so it reads as a heading instead of shouting. */
.em-desc-label--caps { font-size: .84em; letter-spacing: .05em; }
.em-desc * + .em-desc-label { margin-top: 1.8em; }
.em-desc .em-desc-label + * { margin-top: .55em; }
.em-desc p + :is(ul, ol) { margin-top: .6em; }

.em-desc .em-desc-key { font-weight: 600; }

.em-desc ul,
.em-desc ol { margin-left: 0; margin-right: 0; padding: 0; list-style: none; }
.em-desc li { position: relative; margin: 0; padding: 0 0 0 1.5em; }
.em-desc li + li { margin-top: .45em; }
.em-desc ul > li::before {
    content: "";
    position: absolute;
    left: .3em;
    top: .66em;
    top: calc(.5lh - .21em);
    width: .42em;
    height: .42em;
    border-radius: 50%;
    background: var(--em-desc-accent, currentColor);
    opacity: .6;
}
.em-desc ol { padding-left: 1.6em; list-style: decimal outside; }
.em-desc ol > li { padding-left: .35em; }
.em-desc ol > li::marker {
    color: var(--em-desc-accent, color-mix(in srgb, currentColor 70%, transparent));
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
/* Long lists of short names (banks, shops, restaurants) flow in columns where there is room: two, or three for the shortest. */
.em-desc .em-desc-cols { columns: 2 15em; column-gap: 2.25em; }
.em-desc .em-desc-cols--3 { columns: 3 10em; }
.em-desc .em-desc-cols > li { break-inside: avoid; }

/* ---------- "Read the full description": a native fold, no script ---------- */
.em-desc-more { margin-top: 1.4em; }
.em-desc-more > summary {
    display: inline-flex;
    align-items: center;
    gap: .7em;
    padding: .75em 1.25em;
    border: 1px solid color-mix(in srgb, currentColor 34%, transparent);
    border-radius: var(--em-tag-radius, 999px);
    background: color-mix(in srgb, currentColor 5%, transparent);
    color: inherit;
    font-size: .875em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .01em;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    break-inside: avoid;
    transition: background-color .2s ease, border-color .2s ease;
}
.em-desc-more > summary::-webkit-details-marker { display: none; }
.em-desc-more > summary::marker { content: ""; }
.em-desc-more > summary::after {
    content: "";
    flex: none;
    width: .45em;
    height: .45em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-.15em) rotate(45deg);
    transition: transform .3s ease;
}
.em-desc-more > summary:hover {
    border-color: color-mix(in srgb, currentColor 60%, transparent);
    background: color-mix(in srgb, currentColor 11%, transparent);
}
.em-desc-more > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.em-desc-more[open] > summary { border-color: color-mix(in srgb, currentColor 18%, transparent); background: transparent; }
.em-desc-more[open] > summary::after { transform: translateY(.12em) rotate(-135deg); }
.em-desc-more__close,
.em-desc-more[open] .em-desc-more__open { display: none; }
.em-desc-more[open] .em-desc-more__close { display: inline; }
.em-desc-more > summary + * { margin-top: 1.4em; }

/* Where the browser can animate to an auto height, the full description slides open. */
@supports (interpolate-size: allow-keywords) {
    .em-desc-more { interpolate-size: allow-keywords; }
    .em-desc-more::details-content {
        block-size: 0;
        overflow-y: clip;
        transition: block-size .5s cubic-bezier(.2, .7, .2, 1), content-visibility .5s allow-discrete;
    }
    .em-desc-more[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .em-desc-more > summary,
    .em-desc-more > summary::after,
    .em-desc-more::details-content { transition: none; }
}

/* ---------- Theme fits ---------- */

/* Corners follow each theme's own chips and buttons (aurum is scoped by its property page: aurora shares the "au" prefix). */
.au-prop, .au-prop-body, .bs, .mn, .nr, .pr, .sw { --em-tag-radius: 0; }
.cn, .nd { --em-tag-radius: 2px; }
.fh { --em-tag-radius: 3px; }
.mx { --em-tag-radius: 6px; }
.sk { --em-tag-radius: 8px; }
/* Brutal draws everything in heavy ink. */
.br .em-highlights > li,
.br .em-desc-more > summary { border: 2px solid currentColor; font-weight: 700; }

/* A theme's drop cap belongs to an opening paragraph, never to a label or a list item. */
:is(.au-prose, .bs-dropcap, .dr-prose, .pr-desc):has(> .em-desc > :is(ul, ol, .em-desc-label):first-child)::first-letter {
    float: none;
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
}
/* Text already set in newspaper columns keeps its lists in one column. */
.bs-copy .em-desc-cols,
.nr-prose--cols .em-desc-cols { columns: auto; }

/* Centred headings get centred tags. */
.bs-article__head > .em-highlights,
.pr-cat__head > .em-highlights { justify-content: center; }

/* Swiss: the tags take the row under the title (the price stays beside it). */
.sw .sw-prop__head-in > .em-highlights { grid-column: 1 / -1; margin-top: 22px; }
@media (min-width: 961px) {
    .sw .sw-prop__head-in > .em-highlights { grid-column: 1 / span 9; }
}

/* Noir sets only its paragraphs in the body colour: lists and labels follow them. */
.nr .nr-prose > .em-desc { color: var(--bone-2, currentColor); font-size: 17.5px; line-height: 1.8; }
.nr .nr-feature__story .nr-prose > .em-desc { font-size: 18px; }

/* ---------- phones: Call and WhatsApp at the foot of the property page (site/partials/contact-bar) ---------- */
.em-contact-bar { display: none; }
@media (max-width: 760px) {
    .em-contact-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147481000;
        display: flex; align-items: center; gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: var(--ef-raised, #fff); color: var(--ef-ink, #15171c);
        border-top: 1px solid var(--ef-line, rgba(21, 23, 28, .15));
        box-shadow: 0 -12px 30px -18px rgba(0, 0, 0, .45);
        font-family: var(--ef-font, inherit);
    }
    .em-contact-bar__price { display: grid; flex: 1; min-width: 0; margin: 0; line-height: 1.25; }
    .em-contact-bar__price b { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
    .em-contact-bar__price span { overflow: hidden; font-size: 12px; color: var(--ef-muted, #5f6571); text-overflow: ellipsis; white-space: nowrap; }
    .em-contact-bar__btn {
        display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px;
        min-width: 48px; height: 46px; padding: 0 14px;
        border: 1px solid var(--ef-line, rgba(21, 23, 28, .15)); border-radius: var(--ef-radius, 12px);
        background: var(--ef-surface, #fff); color: var(--ef-ink, #15171c);
        font: 700 14px/1 var(--ef-font, inherit); text-decoration: none;
    }
    .em-contact-bar__btn--wa { border-color: #1fa855; background: #1fa855; color: #fff; }
    .em-contact-bar__btn:focus-visible { outline: 2px solid var(--ef-focus, #1f4fd1); outline-offset: 2px; }
    .em-contact-bar__ic { width: 18px; height: 18px; }
    /* a theme with its own phone dock for the property (Aurora, Broadsheet, Coastal, Farmhouse, Marina, Noir) keeps it */
    body:has(.au-actionbar, .bs-actionbar, .cs-dock, .fh-side-card, .mr-glass, .nr-dock) .em-contact-bar { display: none; }
    /* otherwise the bar replaces the theme's floating WhatsApp button and keeps the page's end clear */
    body:has(.em-contact-bar):not(:has(.au-actionbar, .bs-actionbar, .cs-dock, .fh-side-card, .mr-glass, .nr-dock)) { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    body:has(.em-contact-bar) :is(.st-wa, .au-wa, .bz-wa, .br-wa, .cn-wa, .cs-wa, .dr-wa, .fh-wa, .hv-wa, .mr-wa, .mx-wa, .mn-wa, .nr-wa, .nd-wa, .pa-wa, .pr-wa, .sk-wa, .sw-wa, .vd-wa) { display: none !important; }
}
@media print { .em-contact-bar { display: none !important; } }
