/*!
 * Control Pro — badges and labels (promotions module), public site. Self-contained (cpb-*). A badge's
 * colours arrive as custom properties set from the validated catalogue (tokens or hex, AA contrast
 * checked when saved); nothing else about a badge comes from data.
 *
 * Corner badges stack in four boxes over the photo. The top-right box starts below the favorites heart
 * (MM-FAV-01: a 44px button 4px from the corner) and the top-left box ends before the heart's column (a long
 * badge wraps its words there on a narrow photo: never under the heart, never cut), the bottom-left box rises above the Sold / Reserved
 * badge (cp-availability.css: bottom-left, ~24px tall) when the card has one, and on the theme's cards of a
 * Premium listing the top-left corner is left to Sahara's own Premium tag and ribbon (its badges join the
 * bottom-left box, BadgeRenderer::corners) — so no two marks overlap. Every mark of the photo is inside the
 * positioned .cpf-media (VP-019 / VP-040), drawn over the photo in this order: theme marks (auto), the
 * corner boxes and Sold / Reserved (4), the heart (5).
 * A badge placed differently on phones is printed twice (.cpb-d / .cpb-m), one copy per device.
 */
.cpf-media { position: relative; }

.cpb-stack {
  position: absolute; z-index: 4; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  max-width: calc(100% - 12px); max-height: calc(100% - 12px); overflow: hidden; pointer-events: none;
}
.cpb-stack--tl { top: var(--cpb-y, 6px); left: var(--cpb-x, 6px); }
.cpb-stack--tr { top: var(--cpb-y, 6px); right: var(--cpb-x, 6px); align-items: flex-end; }
.cpb-stack--tr.cpb-stack--heart { top: calc(48px + var(--cpb-y, 6px)); max-height: calc(100% - 60px); }
/* :where() keeps these below a surface's own rule (the Showcase's tiles have their row left of the heart, cp-showcase.css) */
.cpb-stack--tl:where(.cpb-stack--heart) { max-width: calc(100% - var(--cpb-x, 6px) - 52px); }
.cpb-stack--tl:where(.cpb-stack--heart) > .cpb { white-space: normal; overflow-wrap: anywhere; }
.cpb-stack--bl { bottom: var(--cpb-y, 6px); left: var(--cpb-x, 6px); flex-direction: column-reverse; }
.cpb-stack--bl.cpb-stack--above { bottom: calc(32px + var(--cpb-y, 6px)); max-height: calc(100% - 44px); }
.cpb-stack--br { bottom: var(--cpb-y, 6px); right: var(--cpb-x, 6px); align-items: flex-end; flex-direction: column-reverse; }
.cpb-stack .cpb { box-shadow: 0 1px 2px rgba(16, 24, 40, .28); }

.cpb {
  --cpb-pad-y: 4px; --cpb-pad-x: 8px;
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; box-sizing: border-box; margin: 0;
  padding: var(--cpb-pad-y) var(--cpb-pad-x); border: 1px solid var(--cpb-line, transparent);
  background: var(--cpb-bg, #3d7a10); color: var(--cpb-fg, #fff);
  font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1.1; letter-spacing: .01em;
  text-transform: none; white-space: nowrap; vertical-align: middle;
}
.cpb .fa { flex: 0 0 auto; font-size: .95em; line-height: 1; }
.cpb__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cpb--s { --cpb-pad-y: 2px; --cpb-pad-x: 6px; font-size: 10.5px; }
.cpb--l { --cpb-pad-y: 6px; --cpb-pad-x: 11px; font-size: 13.5px; }
.cpb--p-tight { --cpb-pad-y: 2px; --cpb-pad-x: 5px; }
.cpb--p-roomy { --cpb-pad-y: 6px; --cpb-pad-x: 12px; }
.cpb--s.cpb--p-tight { --cpb-pad-y: 1px; --cpb-pad-x: 4px; }
.cpb--l.cpb--p-roomy { --cpb-pad-y: 8px; --cpb-pad-x: 15px; }
.cpb--b2 { border-width: 2px; }
.cpb--pill { border-radius: 999px; }
.cpb--rounded { border-radius: 7px; }
.cpb--rect { border-radius: 3px; }
.cpb--circle { border-radius: 999px; justify-content: center; min-width: 2.5em; min-height: 2.5em; padding: 0 .5em; }
.cpb--ribbon { border-radius: 0; padding-right: calc(var(--cpb-pad-x) + 7px); clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%); }
.cpb--tag { border-radius: 0 3px 3px 0; padding-left: calc(var(--cpb-pad-x) + 7px); clip-path: polygon(7px 0, 100% 0, 100% 100%, 7px 100%, 0 50%); }
.cpb--icon { padding: var(--cpb-pad-y); min-width: calc(1em + 2 * var(--cpb-pad-y) + 2px); justify-content: center; }
.cpb--icon .cpb__t {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/*
 * A price badge and its reference struck through beside it (CP-ADV-01 S6: an announced reduction states the
 * earlier price — BadgeRenderer::claim()). Over the photo like every corner mark, so no card changes size; the
 * reference wraps under the badge when the corner is narrow. Neutral white and ink (contrast > 12:1).
 */
.cpb-claim { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; max-width: 100%; min-width: 0; }
.cpb-ref {
  display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%; box-sizing: border-box; margin: 0;
  padding: 3px 6px; border: 1px solid #d0d5dd; border-radius: 3px; background: #fff; color: #1d2939;
  font-family: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.1; white-space: nowrap; vertical-align: middle;
}
.cpb-ref s { text-decoration-thickness: 1.5px; }
.cpb-stack .cpb-ref { box-shadow: 0 1px 2px rgba(16, 24, 40, .28); }
.cpb-ref--words { white-space: normal; overflow-wrap: anywhere; font-size: 12.5px; padding: 4px 8px; }
.cpb-ref__basis { color: #475467; font-weight: 500; }
.cpb-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* rows beside the title and the price (homepage showcase cards) */
.cpb-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; min-width: 0; }
.cpb-row--beside_price { display: inline-flex; margin: 0 0 0 6px; vertical-align: middle; }
.cpb-row--a-center { justify-content: center; }
.cpb-row--a-end { justify-content: flex-end; }

/*
 * The listing's own page: one row under the title (cp_listing_banner(), before the gallery). It wraps, never
 * overflows the column; long words are cut with an ellipsis inside their badge, never beyond the page.
 */
.cpb-detail { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; min-width: 0; max-width: 100%; }
.cpb-detail--center { justify-content: center; }
.cpb-detail--end { justify-content: flex-end; }
.cpb-detail .cpb { max-width: 100%; }

/* an administrator's preview (BadgeFront, ?cp_preview=badges): the photo of the listing being designed for, framed */
.cpb-focus { position: absolute; inset: 0; z-index: 6; border: 3px solid #175cd3; border-radius: inherit; pointer-events: none; }

/* a narrow photo (6 cards a row): smaller corner badges */
@container (max-width: 149.98px) {
  .cpb-stack .cpb { --cpb-pad-y: 2px; --cpb-pad-x: 5px; font-size: 10px; }
  .cpb-stack .cpb-ref { padding: 2px 4px; font-size: 9.5px; }
}

@media (max-width: 767px) { .cpb-d { display: none !important; } }
@media (min-width: 768px) { .cpb-m { display: none !important; } }

/*
 * Demonstration catalogue (docs/control-pro/DEMO-CATALOG.md): the listing-page banner and the note that
 * replaces the contact block. Neutral slate, never the Premium amber or the Sold red, so a demonstration
 * reads as neither; this sheet is on every page where a demonstration listing can appear.
 */
.cp-demo-banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 10px 0 14px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #b9c0cc; background: #f2f4f7; color: #1d2939; font-size: 14px; line-height: 1.45;
}
.cp-demo-banner__mark {
  flex: 0 0 auto; margin-top: 1px; padding: 3px 7px; border-radius: 3px;
  background: #475467; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.1; letter-spacing: .04em;
}
.cp-demo-banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-demo-banner__title { font-size: 15px; font-weight: 700; }
.cp-demo-banner__text { overflow-wrap: anywhere; }
.cp-demo-note {
  margin: 8px 0; padding: 10px 12px; border-radius: 10px;
  background: #f2f4f7; color: #1d2939; border: 1px solid #b9c0cc; font-size: 14px; line-height: 1.45;
}
