/* BLACK X Blog Experience V1
   Django-native visual layer inspired by circular and depth galleries.
   Scoped to /blog/ only through data-blog-visual-experience="v1". */

.blackx-discover-page[data-blog-visual-experience="v1"] {
  --bx-blog-accent: var(--discover-gold, #d7b66a);
  --bx-blog-ink: #08090c;
  --bx-blog-panel: rgba(14, 17, 21, 0.88);
  --bx-blog-panel-strong: rgba(9, 11, 14, 0.96);
  --bx-blog-line: rgba(215, 182, 106, 0.24);
  --bx-blog-silver: rgba(219, 224, 229, 0.72);
  --bx-blog-green: #1f6f5f;
}

/* =========================================================
   Hero — pure depth photography stage
   ========================================================= */
.blackx-discover-page[data-blog-visual-experience="v1"] .bx-blog-gallery-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: clamp(620px, calc(100svh - var(--header-height, 72px)), 900px);
  padding: 0 !important;
  overflow: clip;
  border-bottom: 1px solid rgba(215, 182, 106, 0.22);
  background:
    radial-gradient(circle at 50% 42%, rgba(31, 111, 95, 0.13), transparent 32%),
    radial-gradient(circle at 50% 56%, rgba(215, 182, 106, 0.08), transparent 48%),
    linear-gradient(180deg, #06080a 0%, #0a0d10 52%, #060709 100%);
}

.blackx-discover-page[data-blog-visual-experience="v1"] .bx-blog-gallery-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 22%, rgba(5, 7, 9, 0.14) 56%, rgba(5, 7, 9, 0.72) 100%),
    linear-gradient(90deg, rgba(5, 7, 9, 0.62), transparent 18%, transparent 82%, rgba(5, 7, 9, 0.62));
}

.blackx-discover-page[data-blog-visual-experience="v1"] .bx-blog-gallery-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  height: auto;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 9, 0.58) 0%, transparent 18%, transparent 75%, rgba(5, 7, 9, 0.84) 100%);
}

.bx-blog-gallery-hero__title {
  position: relative;
  z-index: 20;
  width: min(92vw, 1200px);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.bx-blog-gallery-hero__title h1,
.blackx-discover-page[data-blog-visual-experience="v1"] .bx-blog-gallery-hero h1 {
  max-width: none;
  margin: 0;
  text-align: center;
  font-size: clamp(3rem, 8vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
  font-weight: 800;
  color: #f7f4ec;
  background: linear-gradient(118deg, #ffffff 0%, #e5e8eb 36%, #d7b66a 64%, #bfc5cb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 28px 90px rgba(0, 0, 0, 0.44);
}

.bx-blog-photo-gallery {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  perspective: 1500px;
  transform-style: preserve-3d;
  pointer-events: none;
  contain: layout paint style;
}

.bx-blog-photo-gallery__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(220px, 23vw, 390px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid rgba(226, 197, 124, 0.24);
  border-radius: clamp(20px, 2.2vw, 32px);
  background: linear-gradient(145deg, rgba(31, 111, 95, 0.26), rgba(215, 182, 106, 0.12)), #11151a;
  box-shadow: 0 30px 82px rgba(0, 0, 0, 0.54), 0 0 34px rgba(215, 182, 106, 0.05);
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  transition:
    transform 680ms cubic-bezier(0.2, 0.78, 0.18, 1),
    opacity 420ms ease;
}

.bx-blog-photo-gallery__item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.02);
}

.bx-blog-photo-gallery__item::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, transparent 54%, rgba(4, 6, 8, 0.5) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 30%);
}

.bx-blog-photo-gallery__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(244, 241, 232, 0.88);
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  text-align: center;
  background: radial-gradient(circle at 50% 30%, rgba(215, 182, 106, 0.17), transparent 32%), linear-gradient(145deg, rgba(31, 111, 95, 0.24), rgba(7, 9, 11, 0.95));
}

/* =========================================================
   Publishers — stable circular coverflow carousel
   ========================================================= */
.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-panel__shell {
  position: relative;
  overflow: hidden;
  min-height: clamp(570px, 68vh, 700px);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 48%, rgba(31, 111, 95, 0.12), transparent 34%),
    radial-gradient(circle at 50% 48%, rgba(215, 182, 106, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(14, 17, 21, 0.9), rgba(7, 9, 11, 0.97));
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-panel__shell::before,
.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-panel__shell::after {
  display: none;
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-section-head {
  position: relative;
  z-index: 30;
  margin-bottom: 0;
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-company-strip {
  position: relative;
  z-index: 2;
  display: block !important;
  width: 100%;
  min-width: 100%;
  height: clamp(360px, 46vh, 450px);
  padding: 0;
  overflow: hidden;
  perspective: 1200px;
  transform-style: preserve-3d;
  touch-action: pan-y;
  transform: none !important;
  contain: layout paint style;
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card {
  position: absolute !important;
  top: 50%;
  left: 50%;
  width: clamp(220px, 22vw, 286px) !important;
  min-width: clamp(220px, 22vw, 286px) !important;
  max-width: clamp(220px, 22vw, 286px) !important;
  height: 214px;
  min-height: 214px;
  margin: 0;
  backface-visibility: hidden;
  transition:
    transform 520ms cubic-bezier(0.2, 0.78, 0.18, 1),
    opacity 320ms ease,
    box-shadow 320ms ease;
  will-change: transform, opacity;
}

.blackx-residences-publishers.is-bx-circular-publishers:not(.is-bx-publisher-layout-ready) .blackx-company-card {
  opacity: 0;
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card__face {
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(22, 27, 32, 0.98), rgba(8, 10, 13, 0.98));
  box-shadow: 0 26px 66px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card.is-bx-orbit-front .blackx-company-card__face {
  border-color: rgba(215, 182, 106, 0.5);
  box-shadow: 0 34px 86px rgba(0, 0, 0, 0.58), 0 0 36px rgba(215, 182, 106, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card__logo {
  border-radius: 16px;
  background: linear-gradient(145deg, var(--bx-blog-accent), #9f7d3e);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-panel__footer {
  position: relative;
  z-index: 30;
  justify-content: center;
  margin-top: 0;
}

.blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-control {
  min-width: 112px;
  backdrop-filter: blur(10px);
}

/* =========================================================
   Featured residences — scroll-driven circular gallery
   ========================================================= */
.blackx-residences-featured.is-bx-circular-properties {
  position: relative;
  min-height: var(--bx-property-orbit-height, 270vh);
}

.blackx-residences-featured.is-bx-circular-properties .container {
  min-height: inherit;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__shell {
  position: relative;
  min-height: inherit;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__shell::before,
.blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__shell::after {
  display: none;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-section-head {
  position: sticky;
  z-index: 45;
  top: calc(var(--header-height, 72px) + 12px);
  width: min(100%, 1180px);
  margin-inline: auto;
  padding: 14px 18px;
  border: 1px solid rgba(215, 182, 106, 0.14);
  border-radius: 18px;
  background: rgba(8, 10, 12, 0.72);
  backdrop-filter: blur(16px);
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell {
  position: sticky;
  z-index: 20;
  top: clamp(130px, 17vh, 170px);
  width: min(100%, 1280px);
  height: min(72vh, 720px);
  min-height: 560px;
  margin: 24px auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(215, 182, 106, 0.18);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 48%, rgba(31, 111, 95, 0.16), transparent 30%),
    radial-gradient(circle at 50% 48%, rgba(215, 182, 106, 0.09), transparent 54%),
    linear-gradient(180deg, rgba(12, 15, 18, 0.95), rgba(6, 8, 10, 0.98));
  box-shadow: 0 42px 110px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell::before,
.blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell::after {
  display: block;
  width: 26%;
  opacity: 0.7;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  perspective: 1450px;
  contain: paint;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid.blackx-offers-rail {
  position: absolute;
  inset: 0;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100%;
  padding: 0;
  transform: none !important;
  transform-style: preserve-3d;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
  position: absolute !important;
  top: 50%;
  left: 50%;
  width: clamp(250px, 25vw, 330px) !important;
  min-width: clamp(250px, 25vw, 330px) !important;
  max-width: clamp(250px, 25vw, 330px) !important;
  max-height: min(560px, 66vh);
  margin: 0;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(21, 25, 30, 0.98), rgba(8, 10, 13, 0.98));
  box-shadow: 0 30px 82px rgba(0, 0, 0, 0.54);
  transition:
    opacity 260ms ease,
    filter 260ms ease,
    box-shadow 260ms ease;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, opacity, filter;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card.is-bx-orbit-front {
  border-color: rgba(215, 182, 106, 0.5);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.62),
    0 0 46px rgba(215, 182, 106, 0.12);
}

.blackx-residences-featured.is-bx-circular-properties .blackx-feed-card__media {
  aspect-ratio: 16 / 9;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-property-chip {
  max-height: 150px;
  overflow: auto;
}

.blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__footer {
  position: sticky;
  z-index: 44;
  top: auto;
  bottom: 18px;
  justify-content: center;
  width: fit-content;
  margin: 20px auto 0;
  padding: 8px;
  border: 1px solid rgba(215, 182, 106, 0.12);
  border-radius: 999px;
  background: rgba(8, 10, 12, 0.68);
  backdrop-filter: blur(14px);
}

.blackx-residences-featured.is-bx-circular-properties .blackx-lazy-data-placeholder,
.blackx-residences-featured.is-bx-circular-properties .blackx-empty-inline {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(500px, calc(100% - 48px));
  transform: translate(-50%, -50%);
}

/* Feed remains straightforward after the visual hero sections. */
.blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-feed-section .blackx-offers-panel__shell {
  border-radius: 28px;
}

/* =========================================================
   Responsive + accessibility fallbacks
   ========================================================= */
@media (max-width: 980px) {
  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero__inner {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero__signal {
    justify-self: start;
  }

  .bx-blog-photo-gallery__item {
    left: 72%;
    width: clamp(240px, 38vw, 360px);
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
    width: clamp(235px, 31vw, 300px) !important;
    min-width: clamp(235px, 31vw, 300px) !important;
    max-width: clamp(235px, 31vw, 300px) !important;
  }
}

@media (max-width: 767px) {
  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero {
    min-height: 760px;
  }

  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero__inner {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero__copy {
    padding: 20px;
    border-radius: 20px;
    background: rgba(7, 9, 11, 0.82);
  }

  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero h1 {
    max-width: none;
    font-size: clamp(2.15rem, 10vw, 3.35rem);
  }

  .blackx-discover-page[data-blog-visual-experience="v1"] .blackx-residences-hero__signal {
    width: min(100%, 290px);
  }

  .bx-blog-photo-gallery__item {
    top: 48%;
    left: 66%;
    width: min(66vw, 280px);
    opacity: 0.52 !important;
  }

  .bx-blog-photo-gallery::before {
    background: linear-gradient(180deg, rgba(7, 9, 11, 0.54), rgba(7, 9, 11, 0.74));
  }

  .bx-blog-photo-gallery__dots {
    right: 18px;
    bottom: 18px;
  }

  [dir="rtl"] .bx-blog-photo-gallery__dots {
    right: auto;
    left: 18px;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-offers-panel__shell {
    min-height: auto;
    padding-bottom: 18px;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-strip {
    display: flex !important;
    gap: 14px;
    height: auto;
    min-height: 0;
    padding: 14px 4px 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    perspective: none;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card {
    position: relative !important;
    top: auto;
    left: auto;
    flex: 0 0 min(78vw, 286px);
    width: min(78vw, 286px) !important;
    min-width: min(78vw, 286px) !important;
    max-width: min(78vw, 286px) !important;
    scroll-snap-align: center;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }

  .blackx-residences-featured.is-bx-circular-properties {
    min-height: auto !important;
  }

  .blackx-residences-featured.is-bx-circular-properties .container,
  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__shell {
    min-height: 0;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-section-head,
  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell,
  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__footer {
    position: relative;
    top: auto;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell {
    height: auto;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
    border-radius: 22px;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-viewport {
    height: auto;
    overflow: visible;
    perspective: none;
    contain: none;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid.blackx-offers-rail {
    position: relative;
    inset: auto;
    display: flex !important;
    gap: 14px;
    height: auto;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
    position: relative !important;
    top: auto;
    left: auto;
    flex: 0 0 min(80vw, 300px);
    width: min(80vw, 300px) !important;
    min-width: min(80vw, 300px) !important;
    max-width: min(80vw, 300px) !important;
    max-height: none;
    scroll-snap-align: center;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__footer {
    margin-top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bx-blog-photo-gallery__item,
  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card,
  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
    transition: none !important;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-strip,
  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid.blackx-offers-rail {
    display: flex !important;
    gap: 14px;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    perspective: none;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-card,
  .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    flex: 0 0 min(78vw, 300px);
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
    scroll-snap-align: center;
  }

  .blackx-residences-featured.is-bx-circular-properties {
    min-height: auto !important;
  }

  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-section-head,
  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-scroll-shell,
  .blackx-residences-featured.is-bx-circular-properties .blackx-offers-panel__footer {
    position: relative;
    top: auto;
  }
}

/* =========================================================
   Blog Visual Experience V1 R2 — final responsive/perf guards
   ========================================================= */
.blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-photo-gallery__item {
  left: 50% !important;
  filter: none !important;
}

.blackx-discover-page[data-blog-visual-revision="r2"] .blackx-residences-featured.is-bx-circular-properties .blackx-featured-grid > .blackx-feed-card {
  filter: none !important;
  transition: opacity 220ms ease, box-shadow 220ms ease;
  will-change: transform, opacity;
}

@media (max-width: 980px) {
  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-gallery-hero {
    min-height: clamp(560px, 82svh, 760px);
  }

  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-photo-gallery__item {
    width: clamp(210px, 31vw, 320px);
  }
}

@media (max-width: 767px) {
  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-gallery-hero {
    min-height: clamp(520px, 76svh, 680px);
  }

  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-gallery-hero__title h1 {
    font-size: clamp(2.6rem, 15vw, 5.4rem);
    line-height: 0.92;
  }

  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-photo-gallery__item {
    top: 50% !important;
    left: 50% !important;
    width: min(58vw, 250px);
    opacity: 1;
  }

  .blackx-residences-publishers.is-bx-circular-publishers .blackx-company-strip {
    overflow-x: auto;
    overflow-y: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-photo-gallery__item,
  .blackx-discover-page[data-blog-visual-revision="r2"] .blackx-company-card,
  .blackx-discover-page[data-blog-visual-revision="r2"] .blackx-feed-card {
    filter: none !important;
  }
}

.blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-page-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  margin-bottom: 4px;
}

[dir="rtl"] .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-page-actions {
  justify-content: flex-start;
}

@media (max-width: 767px) {
  .blackx-discover-page[data-blog-visual-revision="r2"] .bx-blog-page-actions .btn {
    width: 100%;
  }
}
