/* domovita-listing.css - property listing page structure.

   Design critique 2026-11-16 (Anthony agreed every point). Loaded ONLY by
   tmpl/property/default.php via registerAndUseStyle('com_domovita.listing'),
   so nothing here reaches any other view. Bump the version in that call when
   this file changes - the ?v= is hardcoded in the view, not read from Joomla.

   Sections:
     1. Sticky section bar (.dv-secnav)
     2. "At a glance" panel (.dv-glance)
     3. Formatted agent description (.dv-desc-formatted)
     4. Mobile: contact bar replaces the bottom tab bar while it shows

   Shared tokens come from domovita.css custom properties, always with a
   literal fallback so this file renders the same if a token is missing. */

/* ---- 1. Sticky section bar ----------------------------------------------
   Sits directly under the sticky site header (.dv-header, z-index 1000).
   The script in the template measures the header and writes the real offset
   into the inline `top`; the var() fallback is the desktop header height.
   z-index 990 keeps it under the header (and its mega-menu panels), under
   the sticky contact bar (1040) and the mobile tab bar (1000). */
.dv-secnav {
    position: sticky;
    top: var(--dv-secnav-top, 80px);
    z-index: 990;
    /* Same 1200px column as .property-detail-container below it - full-column
       width read as a stray white strip on desktop (live check 2026-11-16). */
    max-width: 1200px;
    margin: 0 auto 8px;
    border-radius: 12px;
    background: var(--dv-surface, #FFFFFF);
    border-bottom: 1px solid var(--dv-hairline, rgba(31, 58, 95, 0.12));
    box-shadow: 0 1px 0 rgba(31, 58, 95, 0.04);
    font-family: var(--dv-font-body, Inter, system-ui, sans-serif);
}
.dv-secnav[hidden],
.dv-secnav__item[hidden] {
    display: none;
}
.dv-secnav__list {
    display: flex;
    gap: 4px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.dv-secnav__list::-webkit-scrollbar {
    display: none;
}
.dv-secnav__item {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}
.dv-secnav__link {
    display: block;
    padding: 12px 12px 10px;
    border-bottom: 2px solid transparent;
    color: var(--dv-deep-navy, #1F3A5F);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}
.dv-secnav__link:hover,
.dv-secnav__link:focus {
    color: var(--dv-btn-primary, #2F6FCC);
    text-decoration: none;
}
/* #2F6FCC on white measures 4.92:1 - passes AA for 14px text. */
.dv-secnav__link.is-current {
    color: var(--dv-btn-primary, #2F6FCC);
    border-bottom-color: var(--dv-btn-primary, #2F6FCC);
    font-weight: 600;
}
.dv-secnav__link:focus-visible {
    outline: 2px solid var(--dv-btn-primary, #2F6FCC);
    outline-offset: -2px;
    border-radius: 4px;
}
@media (max-width: 768px) {
    .dv-secnav__list {
        padding: 0 16px;
        /* Fade the right edge so a cut-off link reads as "scrolls sideways". */
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    }
    .dv-secnav__link {
        padding: 12px 10px 10px;
    }
}

/* Headings land below the header AND this bar. The document already carries
   scroll-padding-top for the header (set by the menu module), so each target
   only needs to clear the section bar on top of that. --dv-secnav-h is the
   bar's measured height, written by the template script (0 when hidden). */
#dv-overview,
#dv-location-section,
#dv-history-section,
#dv-lr-section,
#dv-contact-section,
#dv-costs-section,
#dv-risk-section,
#dv-area-section,
#dv-people-section,
#dv-schools-section,
#dv-amenities-section,
#dv-cvp {
    scroll-margin-top: calc(var(--dv-secnav-h, 48px) + 8px);
}

/* Google Maps paints its controls with very large z-index values; keep them
   inside the map box so they can never slide over the sticky bars. */
.property-detail-container .map-container {
    isolation: isolate;
}

/* ---- 2. "At a glance" panel ---------------------------------------------
   The existing key-facts strip (.property-key-features, styled in
   domovita.css) with a heading and three more facts. Two-class selectors so
   these win over the base strip without !important. */
.dv-glance__title {
    margin: 18px 0 8px;
    color: var(--dv-deep-navy, #1F3A5F);
    font-family: var(--dv-font-body, Inter, system-ui, sans-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}
.property-key-features.dv-glance .key-feature-icon svg {
    display: block;
}
.dv-glance__label {
    color: var(--dv-ink-3, #5A6472);
    font-weight: 400;
}
@media (max-width: 600px) {
    /* Two even columns instead of a ragged wrap: the strip was 177px tall
       with four facts at 390px; with up to nine it must stay a tidy grid. */
    .property-key-features.dv-glance {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
    }
    .property-key-features.dv-glance .key-feature {
        min-width: 0;
        padding: 10px 12px;
        border-left: none;
        border-top: 1px solid var(--dv-hairline, rgba(31, 58, 95, 0.12));
        font-size: 14px;
    }
    .property-key-features.dv-glance .key-feature:nth-child(-n+2) {
        border-top: none;
    }
    .property-key-features.dv-glance .key-feature:nth-child(even) {
        border-left: 1px solid var(--dv-hairline, rgba(31, 58, 95, 0.12));
    }
}

/* ---- 3. Formatted agent description -------------------------------------
   Output of DescriptionFormatHelper::format() - display-only layout of a
   plain-text description (bullets, sentence case, paragraphs). */
.dv-desc-formatted p {
    margin: 0 0 12px;
    line-height: 1.65;
}
.dv-desc-formatted .dv-desc-heading {
    margin: 22px 0 4px;
}
.dv-desc-formatted .dv-desc-heading strong {
    color: var(--dv-deep-navy, #1F3A5F);
    font-weight: 600;
}
.dv-desc-features {
    margin: 0 0 18px;
    padding-left: 20px;
    columns: 2 240px;
    column-gap: 28px;
}
.dv-desc-features li {
    margin: 0 0 4px;
    line-height: 1.5;
    break-inside: avoid;
}

/* ---- 4. Mobile: contact bar replaces the tab bar ------------------------
   At <=768px the sticky contact bar (.dv-sticky-contact, ~63px) sat on top
   of the 60px tab bar (mod_domovita_mobile_tabs) - a quarter of the screen
   between them. While the contact bar shows, the tab bar slides away and the
   contact bar sits on the bottom edge with the safe-area inset as padding
   (the old -60px lift now applies only where :has() is unsupported - see the
   template). The tab bar comes back the moment the contact bar hides.

   The floating stack then rests on the contact bar, not on the tab bar:
     - feedback button: 63px bar + 14px gap = 77px (+ inset). The plugin's
       own rule (plg_system_domovita) put it at 132px, which assumed the tab
       bar AND the scroll-to-top pill underneath it.
     - scroll-to-top pill: tabs.css parks it at 76px (+ inset), exactly where
       the feedback button now goes, so it moves one storey up instead:
       77 + 42px button + 14px gap = 133px (+ inset).
     - cookie button (.cc-trigger): bottom-LEFT at 76px (+ inset), already
       13px clear of the 63px bar - unchanged.
   Selectors start with `html` so they outrank the plugin's and tabs.css's
   same-shaped rules whatever order the stylesheets load in. */
@media (max-width: 768px) {
    .dv-mobile-tabs {
        transition: transform 0.25s ease, visibility 0s linear 0s;
    }
    html body:has(.dv-sticky-contact--visible) .dv-mobile-tabs {
        transform: translateY(100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.25s ease, visibility 0s linear 0.25s;
    }
    html body:has(.dv-sticky-contact--visible) .dv-sticky-contact {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    html body:has(.dv-sticky-contact--visible) .dv-feedback-fab {
        bottom: calc(77px + env(safe-area-inset-bottom, 0px));
    }
    html body:has(.dv-sticky-contact--visible) #sptotop,
    html body:has(.dv-sticky-contact--visible) .sp-scroll-up {
        bottom: calc(133px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .dv-mobile-tabs,
    html body:has(.dv-sticky-contact--visible) .dv-mobile-tabs {
        transition: none;
    }
}
@media print {
    .dv-secnav {
        display: none;
    }
}

/* Save / track / compare / notes icons are inline SVG now (were emoji) - keep
   them centred on the label line in the action bar and the sidebar buttons. */
.dv-action-icon,
.dv-fav-icon,
.dv-track-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
