/* Webux Objekt-Detail (field block) - frontend. Ported from the lv-det-* rules
   in assets/css/site.css (Figma "10 Objekt Detail"). The .lv-t spans are the
   wx-apify token markers emitted by render.php; the :has()/:empty rules below
   collapse rows/sections whose tokens resolve empty AFTER substitution.
   Shared with site.css (kept there): .lv-det-wrap/.lv-det-similar (static page
   content "Ähnliche Objekte") and the .lv-form component (inquiry block). */

/* Layout container (same metrics as the site-level .lv-det-wrap). */
.webux-property-detail__wrap { max-width: 1200px; margin-inline: auto; }
.webux-property-detail__inhalt { padding-bottom: 88px; }

/* Breadcrumb */
.webux-property-detail__breadcrumb { border-bottom: 1px solid var(--wp--preset--color--border); }
.webux-property-detail__breadcrumb-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 45px; }
.webux-property-detail__crumb, .webux-property-detail__back { font-size: 14px; color: #8a847d; line-height: 1.2; margin: 0; }
.webux-property-detail__crumb .lv-t:not(:empty)::before { content: "\203A"; margin: 0 8px; color: #8a847d; }
.webux-property-detail__back a, .webux-property-detail__back { color: var(--wp--preset--color--primary); font-weight: 500; text-decoration: none; }
.webux-property-detail__back a:hover { color: #1a1a1a; }

/* Objektkopf */
.webux-property-detail__kopf { padding-top: 36px; padding-bottom: 36px; }
.webux-property-detail__kopf-in { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; }
.webux-property-detail__kopf-left { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.webux-property-detail__badges { display: flex; gap: 8px; }
.webux-property-detail__badges:not(:has(.webux-property-detail__badge:not(:empty))) { display: none; }
.webux-property-detail__badge { display: inline-flex; align-items: center; height: 28px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; letter-spacing: 0.26px; }
.webux-property-detail__badge:empty { display: none; }
.webux-property-detail__badge--neu { background: var(--wp--preset--color--primary); color: #fff; }
.webux-property-detail__badge--art { background: transparent; border: 1px solid #d8d2c7; color: #6b6661; }
.webux-property-detail__eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 1.82px; text-transform: uppercase; color: var(--wp--preset--color--primary); line-height: 1.2; margin: 0; }
.webux-property-detail__eyebrow .lv-t:not(:empty) ~ .lv-t:not(:empty)::before { content: "\00B7"; margin: 0 6px; }
.webux-property-detail__title { font-size: 48px; font-weight: 600; line-height: 1.05; letter-spacing: -0.96px; color: #1a1a1a; margin: 0; }
.webux-property-detail__address { font-size: 16px; color: #6b6661; line-height: 1.5; margin: 0; }
/* Address parts: hide parts whose tokens all resolved empty, separate the visible ones. */
.webux-property-detail__address-part:not(:has(.lv-t:not(:empty))) { display: none; }
.webux-property-detail__address-part:has(.lv-t:not(:empty)) ~ .webux-property-detail__address-part:has(.lv-t:not(:empty))::before { content: "\00B7"; margin: 0 6px 0 4px; }
.webux-property-detail__preis { text-align: right; flex: 0 0 auto; }
.webux-property-detail__preis:not(:has(.webux-property-detail__preis-val .lv-t:not(:empty))) { display: none; }
.webux-property-detail__preis-label { font-size: 13px; font-weight: 500; letter-spacing: 1.82px; text-transform: uppercase; color: #8a847d; margin: 0 0 6px; }
.webux-property-detail__preis-val { font-size: 36px; font-weight: 600; letter-spacing: -0.72px; color: #1a1a1a; line-height: 1.1; margin: 0; }
.webux-property-detail__preis-sub { font-size: 14px; color: #8a847d; margin: 6px 0 0; }
.webux-property-detail__preis-sub:not(:has(.lv-t:not(:empty))) { display: none; }

/* Galerie */
.webux-property-detail__galerie { padding-bottom: 96px; }
.webux-property-detail__gallery { display: flex; gap: 12px; height: 520px; }
.webux-property-detail__gallery-main { flex: 0 0 792px; max-width: 792px; border-radius: 16px; overflow: hidden; }
.webux-property-detail__gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.webux-property-detail__gallery-thumbs { flex: 1 1 0; display: flex; flex-direction: column; gap: 12px; }
.webux-property-detail__gallery-thumb { position: relative; flex: 1 1 0; border-radius: 16px; overflow: hidden; }
.webux-property-detail__gallery-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.webux-property-detail__gallery-thumb--more { display: flex; align-items: center; justify-content: center; }
.webux-property-detail__gallery-thumb--more::after { content: ""; position: absolute; inset: 0; background: rgba(26,26,26,0.55); }
.webux-property-detail__gallery-more { position: relative; z-index: 1; display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 999px; background: #fff; color: #1a1a1a; font-size: 14px; font-weight: 500; white-space: pre; }
/* Pill (and its dark overlay) only when {{image_count}} resolved non-empty. */
.webux-property-detail__gallery-thumb--more:not(:has(.lv-t:not(:empty)))::after { content: none; }
.webux-property-detail__gallery-more:not(:has(.lv-t:not(:empty))) { display: none; }
/* Data-driven gallery: image <img> src holds a wx-apify token that resolves per
   object. Hide empty slots and collapse gracefully when an object has few or no
   pictures. :has() is broadly supported. */
.webux-property-detail__gallery img[src=""] { display: none; }
.webux-property-detail__gallery-thumb:not(:has(img[src]:not([src=""]))) { display: none; }
.webux-property-detail__gallery-thumbs:not(:has(img[src]:not([src=""]))) { display: none; }
.webux-property-detail__gallery:not(:has(.webux-property-detail__gallery-thumb img[src]:not([src=""]))) .webux-property-detail__gallery-main { flex: 1 1 auto; max-width: 100%; }
.webux-property-detail__galerie:not(:has(img[src]:not([src=""]))) .webux-property-detail__gallery { display: none; }
.webux-property-detail__galerie:not(:has(img[src]:not([src=""]))) .webux-property-detail__eckdaten { margin-top: 0; }
.webux-property-detail__eckdaten { position: relative; z-index: 2; width: 1104px; max-width: calc(100% - 96px); margin: -56px auto 0; display: flex; align-items: center; background: #fff; border-radius: 16px; padding: 26px 32px; box-shadow: 0 2px 6px rgba(26,26,26,0.06), 0 16px 48px rgba(26,26,26,0.1); }
.webux-property-detail__eck { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 0 22px; }
.webux-property-detail__eck:first-child { padding-left: 0; }
.webux-property-detail__eck:last-child { padding-right: 0; }
/* Divider only between VISIBLE cells (hidden token-empty cells still match +). */
.webux-property-detail__eck:has(.lv-t:not(:empty)) ~ .webux-property-detail__eck:has(.lv-t:not(:empty)) { border-left: 1px solid #ece7de; }
.webux-property-detail__eck:not(:has(.lv-t:not(:empty))) { display: none; }
.webux-property-detail__eckdaten:not(:has(.lv-t:not(:empty))) { display: none; }
.webux-property-detail__eck-label { font-size: 12px; font-weight: 500; letter-spacing: 1.68px; text-transform: uppercase; color: #8a847d; margin: 0; }
.webux-property-detail__eck-val { font-size: 22px; font-weight: 600; letter-spacing: -0.22px; line-height: 1.25; color: #1a1a1a; margin: 0; }
/* Unit/suffix next to a token value: only visible when the value resolved non-empty. */
.webux-property-detail__sfx { display: none; }
.lv-t:not(:empty) + .webux-property-detail__sfx { display: inline; }

/* Inhalt (2-col) */
.webux-property-detail__inhalt-cols { display: flex; gap: 40px; align-items: flex-start; }
.webux-property-detail__main { flex: 0 0 760px; max-width: 760px; display: flex; flex-direction: column; gap: 56px; }
.webux-property-detail__aside { flex: 1 1 0; position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; }
.webux-property-detail__block-eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 1.82px; text-transform: uppercase; color: var(--wp--preset--color--primary); margin: 0 0 14px; }
.webux-property-detail__block-title { font-size: 28px; font-weight: 600; letter-spacing: -0.56px; line-height: 1.15; color: #1a1a1a; margin: 0 0 14px; }
.webux-property-detail__block p { font-size: 17px; line-height: 1.75; color: #403d3a; margin: 0 0 16px; }
.webux-property-detail__block p:last-child { margin-bottom: 0; }
/* Free-text detail sections (Objektbeschreibung, Lage): prose body, preserves
   source line breaks. Data-driven: empty spec rows / sections collapse via :has.
   The Lage section stays visible with empty text (map/distances may still show). */
.webux-property-detail__block-body { font-size: 17px; line-height: 1.75; color: #403d3a; white-space: pre-line; }
.webux-property-detail__block-body:empty { display: none; }
.webux-property-detail__block--text:not(.webux-property-detail__block--lage):has(.webux-property-detail__block-body:empty) { display: none; }

/* Ausstattung spec-list (rows and the whole section collapse when the tokens resolve empty) */
.webux-property-detail__specs { display: flex; flex-direction: column; padding-top: 8px; }
.webux-property-detail__spec { display: flex; align-items: flex-start; gap: 24px; padding: 18px 0; border-top: 1px solid #ece7de; }
.webux-property-detail__spec:not(:has(.webux-property-detail__spec-v .lv-t:not(:empty))) { display: none; }
.webux-property-detail__block--specs:not(:has(.webux-property-detail__spec-v .lv-t:not(:empty))) { display: none; }
.webux-property-detail__spec-k { flex: 0 0 200px; font-size: 14px; font-weight: 500; letter-spacing: 0.28px; color: #8a847d; }
.webux-property-detail__spec-v { flex: 1 1 auto; font-size: 16px; color: #1a1a1a; line-height: 1.5; }

/* Lage map — Leaflet + OpenStreetMap. Progressive enhancement: view.js builds
   the map into __map-canvas from the data-lat/data-lng coordinates. Before init
   the frame shows a neutral panel; without usable coordinates view.js sets
   [data-webux-map-state="empty"] and the frame collapses to the address text. */
.webux-property-detail__map { position: relative; height: 300px; border-radius: 16px; overflow: hidden; background: #f4efe3; border: 1px solid #ece7de; margin-top: 14px; }
.webux-property-detail__map-canvas { position: absolute; inset: 0; isolation: isolate; background: #f4efe3; }
.webux-property-detail__map .leaflet-container { height: 100%; width: 100%; font: inherit; background: #f4efe3; }
.webux-property-detail__map .leaflet-control-attribution { font-size: 10px; }
/* Brand location pin as a CSS DivIcon (no marker image asset needed) */
.webux-map-pin { display: grid; place-items: center; }
.webux-map-pin__dot { width: 20px; height: 20px; border-radius: 50%; background: var(--wp--preset--color--primary, #8b8178); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(26,26,26,0.25); }
.webux-property-detail__map-addr { position: absolute; left: 20px; bottom: 20px; z-index: 1; background: #fff; border-radius: 999px; padding: 10px 16px; font-size: 13px; font-weight: 500; color: #1a1a1a; box-shadow: 0 2px 8px rgba(26,26,26,0.12); }
.webux-property-detail__map-addr:not(:has(.lv-t:not(:empty))) { display: none; }
/* No usable coordinates → collapse the map frame, keep the address as plain text */
.webux-property-detail__map[data-webux-map-state="empty"] { height: auto; background: transparent; border: 0; overflow: visible; }
.webux-property-detail__map[data-webux-map-state="empty"] .webux-property-detail__map-canvas { display: none; }
.webux-property-detail__map[data-webux-map-state="empty"] .webux-property-detail__map-addr { position: static; box-shadow: none; padding: 8px 0 0; background: transparent; }
.webux-property-detail__dist { display: flex; margin-top: 24px; }
.webux-property-detail__dist-cell { flex: 1 1 0; padding-left: 20px; }
.webux-property-detail__dist-cell:first-child { padding-left: 0; }
.webux-property-detail__dist-cell + .webux-property-detail__dist-cell { border-left: 1px solid #ece7de; }
.webux-property-detail__dist-v { font-size: 18px; font-weight: 600; letter-spacing: -0.18px; color: #1a1a1a; line-height: 1.2; }
.webux-property-detail__dist-l { font-size: 13px; color: #8a847d; margin-top: 4px; }

/* Dokumente (boxed download rows) */
.webux-property-detail__docs { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.webux-property-detail__doc { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 22px; background: #fff; border: 1px solid #ece7de; border-radius: 12px; text-decoration: none; }
a.webux-property-detail__doc:hover { border-color: #d8d2c7; }
.webux-property-detail__doc-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.webux-property-detail__doc-name { font-size: 16px; font-weight: 500; color: #1a1a1a; margin: 0; }
.webux-property-detail__doc-meta { font-size: 13px; color: #8a847d; margin: 0; }
.webux-property-detail__doc-cta { flex: 0 0 auto; font-size: 14px; font-weight: 500; color: var(--wp--preset--color--primary); text-decoration: none; }
a.webux-property-detail__doc:hover .webux-property-detail__doc-cta { color: var(--wp--preset--color--primary-dark); }
.webux-property-detail__docs-note { font-size: 14px; line-height: 1.6; color: #8a847d; margin-top: 20px; }

/* Sidebar cards */
.webux-property-detail__contact { background: #fff; border: 1px solid #ece7de; border-radius: 16px; padding: 28px; box-shadow: 0 8px 28px rgba(26,26,26,0.06), 0 1px 2px rgba(26,26,26,0.04); }
.webux-property-detail__person { display: flex; gap: 16px; align-items: center; }
.webux-property-detail__person-foto { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--wp--preset--color--primary); }
.webux-property-detail__person-name { font-size: 18px; font-weight: 600; letter-spacing: -0.18px; color: #1a1a1a; line-height: 1.3; }
.webux-property-detail__person-role { font-size: 14px; color: #8a847d; margin-top: 3px; }
.webux-property-detail__contact-div { height: 1px; background: #ece7de; margin: 22px 0; }
.webux-property-detail__contact-lines { display: flex; flex-direction: column; gap: 8px; }
.webux-property-detail__contact-lines a { font-size: 16px; color: #1a1a1a; text-decoration: none; }
.webux-property-detail__contact-lines a.webux-property-detail__contact-tel { font-weight: 500; }
.webux-property-detail__contact-lines a.webux-property-detail__contact-mail { color: var(--wp--preset--color--primary); }
.webux-property-detail__contact-lines a:hover { color: var(--wp--preset--color--primary-dark); }
.webux-property-detail__contact-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.webux-property-detail__btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; border-radius: 999px; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.webux-property-detail__btn--primary { background: var(--wp--preset--color--primary); color: #fff; }
.webux-property-detail__btn--primary:hover { background: var(--wp--preset--color--primary-dark); }
.webux-property-detail__btn--outline { background: transparent; border-color: #d8d2c7; color: #1a1a1a; }
.webux-property-detail__btn--outline:hover { background: rgba(26,26,26,0.04); }
.webux-property-detail__contact-note { font-size: 13px; color: #8a847d; line-height: 1.55; margin: 22px 0 0; }
.webux-property-detail__fakten { background: #f4efe3; border: 0; border-radius: 16px; padding: 8px 24px; }
.webux-property-detail__fakten:not(:has(.lv-t:not(:empty))) { display: none; }
.webux-property-detail__fakt { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; }
/* Divider only between VISIBLE rows (hidden token-empty rows still match +). */
.webux-property-detail__fakt:has(.lv-t:not(:empty)) ~ .webux-property-detail__fakt:has(.lv-t:not(:empty)) { border-top: 1px solid #ece7de; }
.webux-property-detail__fakt:not(:has(.lv-t:not(:empty))) { display: none; }
.webux-property-detail__fakt-k { font-size: 14px; color: #6b6661; }
.webux-property-detail__fakt-v { font-size: 14px; font-weight: 500; color: #1a1a1a; text-align: right; }

@media (max-width: 1248px) {
  .webux-property-detail__wrap { padding-inline: 24px; box-sizing: border-box; }
}

@media (max-width: 1024px) {
  .webux-property-detail__title { font-size: 36px; letter-spacing: -0.72px; }
  .webux-property-detail__kopf-in { flex-direction: column; align-items: flex-start; gap: 20px; }
  .webux-property-detail__preis { text-align: left; }
  .webux-property-detail__gallery { height: auto; flex-direction: column; }
  .webux-property-detail__gallery-main { flex-basis: auto; max-width: 100%; height: 360px; }
  .webux-property-detail__gallery-thumbs { flex-direction: row; height: 120px; }
  .webux-property-detail__eckdaten { flex-wrap: wrap; width: 100%; max-width: 100%; gap: 16px; }
  .webux-property-detail__eck { flex-basis: calc(33.333% - 16px); border-left: 0 !important; padding: 0 !important; }
  .webux-property-detail__inhalt-cols { flex-direction: column; }
  .webux-property-detail__main { flex-basis: auto; max-width: 100%; }
  .webux-property-detail__aside { position: static; width: 100%; }
  .webux-property-detail__dist { flex-wrap: wrap; gap: 16px 0; }
  .webux-property-detail__dist-cell { flex-basis: 50%; min-width: 0; }
}

/* Phones: the desktop spec-list uses a fixed 200px label column that cannot
   shrink; with a long value ("Fussbodenheizung") that row — and thus the page —
   overflows a ~375px viewport. Stack label over value and let long tokens wrap. */
@media (max-width: 600px) {
  .webux-property-detail__spec { flex-direction: column; gap: 4px; }
  .webux-property-detail__spec-k { flex: 0 0 auto; }
  .webux-property-detail__spec-v,
  .webux-property-detail__block-body,
  .webux-property-detail__block p,
  .webux-property-detail__title { overflow-wrap: anywhere; }
  /* Two eckdaten per row instead of three (three get cramped/wrap on phones). */
  .webux-property-detail__eck { flex-basis: calc(50% - 8px); }
  /* Tame oversized display type on small screens. */
  .webux-property-detail__title { font-size: 30px; letter-spacing: -0.6px; }
  .webux-property-detail__preis-val { font-size: 30px; }
}
