/**
 * Roark Expose — general layout (docs/plans/archive/jira-2026-09/1390-expose-layout.md).
 *
 * White section cards on a light grey page background: the flat/background
 * colors, border-radius and padding are set per widget instance in
 * PropertyExposeTemplate.php via each widget's own CardStylingTrait controls
 * (or, for Lage+Karte, via a wrapper inner section carrying `.roark-expose-
 * location-map-card`). This file covers what those controls cannot express:
 * the two-layer box-shadow (Elementor's Box Shadow control is single-layer),
 * the unified 24px/16px vertical rhythm between cards, the sticky sidebar,
 * and the 75ch text measure.
 */

/* ── Card heading scale (systematized) ───────────────────────────────────
 * Every white section card on the exposé (Eckdaten, Beschreibung, Fläche,
 * Preis, Ausstattung, Energieausweis, Sonstiges, Lage, Ansprechpartner,
 * Weitere Immobilien) has exactly ONE title, all at the same level-1 size/
 * weight — previously these were hardcoded per-widget-instance in
 * PropertyExposeTemplate.php (`primaryHeading()`/`secondaryHeading()`),
 * which is what caused Fläche/Lage to render smaller than the other cards.
 * Level 2 is for an in-card SUBSECTION heading only — "Garage / Stellplatz"
 * inside the Eckdaten card, the map address line inside the Lage+Karte
 * card, and the "Videos" sub-heading inside the (card-less) gallery.
 *
 * Each widget still exposes its own Elementor "Title/Heading Typography"
 * control (Style tab) — if an editor sets one explicitly, Elementor writes
 * a per-element selector (scoped by the post/element id) that is always
 * more specific than the plain class selectors below, so it still wins.
 */
:root {
    --roark-expose-card-title-size: 22px;
    --roark-expose-card-title-weight: 700;
    --roark-expose-card-title-line-height: 1.3;
    --roark-expose-card-title-margin: 0 0 1rem;

    --roark-expose-subtitle-size: 18px;
    --roark-expose-subtitle-weight: 600;
    --roark-expose-subtitle-line-height: 1.35;
    --roark-expose-subtitle-margin: 0 0 0.75rem;
}

@media (max-width: 767px) {
    :root {
        --roark-expose-card-title-size: 20px;
        --roark-expose-subtitle-size: 16px;
    }
}

.roark-eckdaten__title,
.roark-flaeche__title,
.roark-features__title,
.roark-ausstattung__title,
.roark-energieausweis__title,
.roark-expose-agent__title,
.roark-expose-text-heading,
.roark-price-section-label,
.roark-other-offers__title,
.roark-expose-map__title {
    font-family: inherit;
    font-size: var(--roark-expose-card-title-size);
    font-weight: var(--roark-expose-card-title-weight);
    line-height: var(--roark-expose-card-title-line-height);
    margin: var(--roark-expose-card-title-margin);
}

.roark-eckdaten__parking-title,
.roark-expose-map__address,
.roark-expose-videos__title {
    font-family: inherit;
    font-size: var(--roark-expose-subtitle-size);
    font-weight: var(--roark-expose-subtitle-weight);
    line-height: var(--roark-expose-subtitle-line-height);
    margin: var(--roark-expose-subtitle-margin);
}

/* ── Two-layer card shadow ──────────────────────────────────────────────
 * Applied with !important because Elementor's own Box Shadow control
 * (single-layer) generates CSS on the same selectors; this is the only
 * reliable way to guarantee the exact two-layer shadow regardless of that
 * control's own (unset) default.
 */
.roark-eckdaten,
.roark-expose-text,
.roark-flaeche,
.roark-price-section,
.roark-ausstattung,
.roark-energieausweis,
.roark-expose-documents,
.roark-expose-agent,
.roark-inquiry-wrap,
.roark-expose-location-map-card {
    box-shadow: var(--roark-shadow-card, 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .06)) !important;
}

/* ── Lage + Karte combined card ─────────────────────────────────────────
 * ExposeMapWidget has no CardStylingTrait of its own, so the card look for
 * this pair is applied to the wrapper inner section instead of a widget.
 */
.roark-expose-location-map-card {
    background: #ffffff;
    border-radius: var(--roark-radius-card, 14px);
    padding: 24px;
}

/* The Lage text widget lives INSIDE the combined card: flatten its own card
   look (the generic .roark-expose-text shadow above would otherwise draw a
   card within the card). Scoped to this wrapper only. */
.roark-expose-location-map-card .roark-expose-text {
    box-shadow: none !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* Elementor gives the inner column's widget-wrap 10px of its own padding;
   inside the card that would add to the card's 24px and misalign the Lage
   heading against every other section (34px vs 24px). */
.roark-expose-location-map-card .elementor-widget-wrap.elementor-element-populated,
.roark-expose-location-map-card .elementor-column-wrap {
    padding: 0 !important;
}

.roark-expose-location-map-card .elementor-widget-wrap > .elementor-element + .elementor-element {
    margin-top: 16px;
}

@media (max-width: 767px) {
    .roark-expose-location-map-card {
        padding: 16px;
    }
}

/* ── Unified 24px / 16px vertical rhythm between cards ──────────────────
 * Applies to the main-left column, the sidebar and the footer column — the
 * three columns that hold section "cards" directly. Per-widget ad-hoc
 * section spacing (e.g. ExposePriceWidget's `section_spacing`) is zeroed
 * out in the template so this is the single source of the gap.
 */
.roark-expose-main-left > .elementor-widget-wrap > .elementor-element,
.roark-expose-main-right > .elementor-widget-wrap > .elementor-element,
.roark-expose-footer-col > .elementor-widget-wrap > .elementor-element {
    margin-bottom: 24px;
}

.roark-expose-main-left > .elementor-widget-wrap > .elementor-element:last-child,
.roark-expose-main-right > .elementor-widget-wrap > .elementor-element:last-child,
.roark-expose-footer-col > .elementor-widget-wrap > .elementor-element:last-child {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .roark-expose-main-left > .elementor-widget-wrap > .elementor-element,
    .roark-expose-main-right > .elementor-widget-wrap > .elementor-element,
    .roark-expose-footer-col > .elementor-widget-wrap > .elementor-element {
        margin-bottom: 16px;
    }
}

/* ── Sticky sidebar (c3) — desktop only, never the mobile ≤767px bar ────
 * The sidebar (CTA button, agent card, two valuation buttons) is often
 * taller than the viewport once the agent card grows (company + phone +
 * mobile + long e-mail + address). A plain `position: sticky` then pins the
 * top of the sidebar in place while its bottom overflows past the viewport
 * edge — the last button becomes unreachable by scrolling until the page's
 * own end (where the column finally runs out and the sidebar detaches).
 * Capping the sidebar's own height to the viewport (minus the sticky top
 * offset, mirrored at the bottom) and letting it scroll internally keeps
 * every child reachable regardless of how tall the agent card gets. */
@media (min-width: 1025px) {
    .roark-expose-main-right {
        position: sticky;
        top: 24px;
        align-self: flex-start;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        overflow-x: hidden;
        /* Thin, subtle scrollbar so it doesn't compete visually with the
           cards. NOT paired with `scrollbar-gutter: stable`: reserving that
           gutter up front narrows the sidebar's content width on *every*
           exposé (scrollable or not), which was enough to reflow the agent
           card's longer text rows onto an extra line and change its
           height — a worse regression than the few px the scrollbar itself
           shifts content by when it actually appears. */
        scrollbar-width: thin;
        /* Fallback fade color = PropertyExposeTemplate::PAGE_BG_SETTINGS
           default; expose-sidebar-scroll.js overrides this per-instance
           with the sidebar's *actual* computed ancestor background, so the
           hint below still blends correctly if that's ever customized. */
        --roark-scroll-fade-rgb: 247, 247, 249;
    }

    .roark-expose-main-right::-webkit-scrollbar {
        width: 6px;
    }

    .roark-expose-main-right::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, .15);
        border-radius: 3px;
    }

    .roark-expose-main-right::-webkit-scrollbar-track {
        background: transparent;
    }

    /* ── Scroll-shadow hint ───────────────────────────────────────────────
     * A capped sidebar taller than the viewport scrolls internally with no
     * visual cue that it does — the bottom just looks cut off. A pure
     * background-only "scroll shadow" (the usual JS-free technique) can't
     * work here: the sidebar's children (the solid CTA button, the white
     * agent card) are opaque and routinely sit flush against the scrolled
     * viewport's top/bottom edge, and a background gradient always paints
     * *behind* them. So this is a tiny JS enhancement instead
     * (expose-sidebar-scroll.js) that toggles `.is-scrollable-top` /
     * `.is-scrollable-bottom` on scroll/resize; the fade itself is a real
     * `position: sticky` overlay box, which — per the CSS painting order —
     * renders above the sidebar's own (non-positioned-in-front) content
     * regardless of what's currently flush to that edge. No JS = no hint
     * (progressive enhancement: the sidebar still scrolls and every button
     * stays reachable either way).
     */
    .roark-expose-main-right::before,
    .roark-expose-main-right::after {
        content: '';
        display: block;
        position: sticky;
        left: 0;
        height: 28px;
        /* `.elementor-widget-wrap` (the sidebar's one real child) is itself
           `position: relative` (Elementor's own default) — without an
           explicit z-index these pseudo-elements would stack by DOM order
           among the z-index:auto siblings, which puts the *top* one behind
           that wrap. A positive z-index always wins regardless of order. */
        z-index: 2;
        pointer-events: none;
        opacity: 0;
        transition: opacity .15s ease;
    }

    .roark-expose-main-right::before {
        top: 0;
        margin-bottom: -28px;
        background: linear-gradient(to bottom, rgba(var(--roark-scroll-fade-rgb), .95) 0%, rgba(var(--roark-scroll-fade-rgb), 0) 100%);
    }

    .roark-expose-main-right::after {
        bottom: 0;
        margin-top: -28px;
        background: linear-gradient(to top, rgba(var(--roark-scroll-fade-rgb), .95) 0%, rgba(var(--roark-scroll-fade-rgb), 0) 100%);
    }

    .roark-expose-main-right.is-scrollable-top::before,
    .roark-expose-main-right.is-scrollable-bottom::after {
        opacity: 1;
    }
}

/* ── Sidebar CTA buttons (c3b) ───────────────────────────────────────────
 * The two outline valuation buttons ("Lagebewertung starten" /
 * "Immobilienbewertung starten") are plain Elementor buttons — width
 * defaults to fit-content, so two different label lengths render two
 * different (left-aligned) widths that don't match the 100%-wide agent
 * card above them. Force both to the full sidebar column width so the
 * whole column reads as one consistent block. Vertical spacing between
 * them and the agent card already comes from the vertical-rhythm rule
 * above (24px / 16px between direct children of the column). */
.roark-expose-main-right .roark-agent-iframe-open {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

/* ── Text measure (c4) ──────────────────────────────────────────────── */
.roark-expose-text-content {
    max-width: 75ch;
}

/* ── Dedupe "Exposé anfordern" CTAs ────────────────
 * The page used to carry three inquiry CTAs: one right below the gallery
 * (full width), one at the top of the desktop sidebar, and the mobile
 * sticky "Anfrage" bar (expose-mobile.css/js). The gallery one is removed
 * from the template for new installs (PropertyExposeTemplate::
 * buildGallerySection()); this rule hides it everywhere else, including on
 * existing installs whose saved `_elementor_data` still has it — the
 * element id is deterministic (AbstractRoarkTemplate::makeId(), keyed on
 * the template slug + 'w_inquiry_button_top'), so it is the same id on
 * every install regardless of when the page was created.
 *
 * The sidebar CTA is desktop/tablet only: hidden at the same ≤767px
 * breakpoint where the mobile sticky bar takes over (its own id is keyed on
 * 'w_inquiry_button_bottom' — the widget instance kept in
 * buildMainRightColumn()), so a visitor is never shown two different ways
 * to open the same inquiry form at once, nor left with none.
 */
.elementor-element-54bb0af {
    display: none !important;
}

@media (max-width: 767px) {
    .elementor-element-3d675f9 {
        display: none !important;
    }
}
