/* Keep all ranked listings visible and consistently show two cards per row on phones. */
@media (max-width: 767px) {
  html,
  body,
  .text-Scroll,
  .discovery-chips,
  .layout-rail {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .text-Scroll::-webkit-scrollbar,
  .discovery-chips::-webkit-scrollbar,
  .layout-rail::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
  .discovery-feed-section {
    padding-right: 1px !important;
    padding-left: 1px !important;
  }

  .discovery-feed-section[data-feed-page="0"] > .section-heading {
    width: auto;
    margin-right: 15px;
    margin-left: 15px;
  }

  .layout-spotlight,
  .layout-editorial,
  .layout-grid,
  .layout-compact,
  .layout-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: visible;
    padding: 0;
  }

  .layout-property-browser,
  .property-browser-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
  }

  .layout-property-browser {
    display: block;
  }

  .property-browser-preview {
    display: none;
  }

  .layout-editorial > .editorial-feature,
  .layout-editorial > .editorial-list {
    display: contents;
  }

  .layout-spotlight .d-card,
  .layout-spotlight .d-card:not(:first-child),
  .layout-spotlight .d-card:nth-child(n),
  .layout-editorial .d-card,
  .layout-compact .d-card,
  .layout-rail .d-card {
    display: block;
    min-width: 0;
  }

  .layout-rail .d-card {
    width: auto;
  }

  .layout-spotlight .d-card:first-child {
    grid-row: auto;
  }

  .layout-spotlight .d-card .d-card-image,
  .layout-spotlight .d-card:first-child .d-card-image,
  .layout-spotlight .d-card:not(:first-child) .d-card-image,
  .layout-editorial .d-card .d-card-image,
  .layout-compact .d-card .d-card-image,
  .layout-grid .d-card .d-card-image,
  .property-browser-grid .d-card .d-card-image,
  .layout-rail .d-card .d-card-image {
    width: 100%;
    height: clamp(135px, 40vw, 190px);
    min-height: 0;
  }

  .d-card-body {
    padding: 9px;
  }

  .d-card {
    border-radius: 0 !important;
  }

  .d-card-image,
  .d-card-photo-link,
  .d-card-image img {
    border-radius: 0 !important;
  }

  .d-price {
    font-size: clamp(.94rem, 4vw, 1.12rem);
    overflow-wrap: anywhere;
  }

  .d-title {
    min-height: 2.55em;
    font-size: .84rem;
  }

  .d-location {
    font-size: .75rem;
  }

  .d-facts {
    gap: 5px 8px;
    font-size: .7rem;
  }

  .d-badge {
    top: 8px;
    left: 8px;
    padding: 4px 7px;
    max-width: calc(100% - 50px);
  }

  .d-save {
    top: 7px;
    right: 7px;
    width: 34px !important;
    height: 34px !important;
  }
}

@media (min-width: 992px) {
  .home-property-sidebar {
    position: fixed !important;
    top: var(--home-visible-header, 0px) !important;
    right: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    height: auto !important;
    padding: 22px 16px 18px;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .home-property-sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-property-picks {
    width: 100%;
    margin-bottom: 22px;
  }

  .sidebar-picks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #0000ff;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .sidebar-picks-head a {
    color: #0000ff;
    letter-spacing: 0;
    text-transform: none;
  }

  .sidebar-property-picks h3 {
    margin: 5px 0 13px;
    font-size: 1.15rem;
  }

  .sidebar-picks-list {
    display: grid;
    gap: 10px;
  }

  .sidebar-property-card {
    display: grid;
    grid-template-columns: 88px minmax(0,1fr);
    gap: 11px;
    padding: 8px;
    border: 1px solid #e1e6ee;
    border-radius: 0;
    background: #fff;
    color: #172033;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(25,42,70,.06);
    transition: transform .18s,box-shadow .18s;
  }

  .sidebar-property-card:hover {
    color: #172033;
    transform: translateY(-2px);
    box-shadow: 0 11px 25px rgba(25,42,70,.12);
  }

  .sidebar-property-card img {
    width: 88px;
    height: 82px;
    border-radius: 0;
    object-fit: cover;
  }

  .sidebar-property-card span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
  }

  .sidebar-property-card b,
  .sidebar-property-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-property-card b {
    color: #111827;
    font-size: .86rem;
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.25;
  }

  .sidebar-property-card small {
    margin: 5px 0;
    color: #697386;
    font-size: .7rem;
    font-weight: 500;
    line-height: 1.25;
  }

  .sidebar-property-card strong {
    color: #0000ff;
    font-size: .86rem;
    font-weight: 850;
    letter-spacing: -.015em;
  }

  .sidebar-property-card em {
    color: #7a8495;
    font-size: .66rem;
    font-style: normal;
    font-weight: 600;
  }
}

/* Premium desktop discovery system: varied editorial layouts with consistent card quality. */
@media (min-width: 768px) {
  .discovery-feed-section {
    padding-top: 38px;
    padding-bottom: 52px;
  }

  .discovery-feed-section > .section-heading,
  .discovery-feed-section > .layout-grid,
  .discovery-feed-section > .layout-rail,
  .discovery-feed-section > .layout-spotlight,
  .discovery-feed-section > .layout-editorial,
  .discovery-feed-section > .layout-compact {
    width: min(1480px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .discovery-feed-section > .layout-property-browser {
    width: min(1480px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .layout-property-browser {
    display: grid;
    grid-template-columns: minmax(560px, 1.12fr) minmax(440px, .88fr);
    gap: 24px;
    align-items: start;
  }

  .property-browser-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .property-browser-grid .d-card-image {
    height: 100%;
  }

  .property-browser-grid .d-card {
    height: 330px;
    background: #e8edf3;
  }

  .property-browser-grid .d-card-body {
    position: absolute;
    z-index: 4;
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    padding: 13px 14px;
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 15px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 8px 25px rgba(12,24,48,.16);
    backdrop-filter: blur(12px);
  }

  .property-browser-grid .d-title { order: 1; margin: 0 0 3px; font-size: 1rem; }
  .property-browser-grid .d-location { order: 2; }
  .property-browser-grid .d-price { order: 3; margin-top: 9px; font-size: .98rem; }
  .property-browser-grid .d-facts { order: 4; display: none; }

  .property-browser-preview {
    position: sticky;
    top: 92px;
    overflow: hidden;
    border: 1px solid rgba(25, 42, 70, .1);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(22, 38, 70, .13);
  }

  .browser-preview-gallery {
    display: grid;
    grid-template-columns: minmax(0, 2.25fr) minmax(120px, .75fr);
    gap: 10px;
    height: 360px;
    padding: 14px 14px 0;
  }

  .browser-preview-gallery a {
    display: block;
    min-width: 0;
    overflow: hidden;
    border-radius: 16px;
  }

  .browser-preview-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
  }

  .browser-preview-gallery a:hover img {
    transform: scale(1.035);
  }

  .browser-preview-side {
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-height: 0;
  }

  .browser-preview-body {
    padding: 24px;
  }

  .browser-preview-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
  }

  .browser-preview-kicker {
    color: #0000ff;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
  }

  .browser-preview-heading h3 {
    margin: 4px 0 0;
    font-size: clamp(1.35rem, 2vw, 2rem);
    letter-spacing: -.04em;
  }

  .browser-preview-price {
    flex: none;
    font-size: 1.25rem;
    font-weight: 850;
  }

  .browser-preview-price small {
    color: #7a8495;
    font-size: .72rem;
    font-weight: 500;
  }

  .browser-preview-location {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 20px;
    color: #747e8f;
  }

  .browser-preview-location i {
    color: #0000ff;
  }

  .browser-preview-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #e7eaf0;
  }

  .browser-preview-tabs span {
    padding: 11px 8px;
    color: #747e8f;
    text-align: center;
  }

  .browser-preview-tabs .active {
    border-bottom: 2px solid #0000ff;
    color: #111827;
    font-weight: 750;
  }

  .browser-preview-copy {
    margin: 20px 0;
    color: #697386;
    line-height: 1.75;
  }

  .browser-preview-body h4 {
    margin: 0 0 12px;
    font-size: 1.05rem;
  }

  .browser-preview-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .browser-preview-facts span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid #dfe4ec;
    border-radius: 999px;
    background: #fafbfc;
    font-weight: 700;
  }

  .browser-preview-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    margin-top: 20px;
    border-radius: 13px;
    background: #0000ff;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
  }

  .browser-preview-action:hover {
    background: #0000d8;
    color: #fff;
  }

  .discovery-feed-section > .section-heading {
    margin-bottom: 22px;
    padding: 22px 24px;
    border-radius: 20px;
  }

  .discovery-feed-section > .section-heading h2 {
    font-size: clamp(1.55rem, 2vw, 2.15rem);
    letter-spacing: -.035em;
  }

  .d-card {
    border-color: rgba(25, 42, 70, .1);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(22, 38, 70, .08);
    transform: translateZ(0);
  }

  .d-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 48px rgba(22, 38, 70, .16);
  }

  .d-card-image::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 35%;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(5, 12, 28, .15));
  }

  .d-card-body {
    padding: 18px;
  }

  .d-price {
    color: #111827;
    font-size: 1.32rem;
    letter-spacing: -.025em;
  }

  .d-title {
    margin-top: 8px;
    font-size: 1rem;
  }

  .d-facts {
    padding-top: 11px;
    border-top: 1px solid #edf0f5;
  }

  .layout-grid {
    gap: 20px;
  }

  .layout-grid .d-card-image {
    height: 230px;
  }

  .layout-spotlight {
    grid-template-columns: minmax(0, 1.55fr) repeat(2, minmax(240px, .8fr));
    gap: 18px;
  }

  .layout-spotlight .d-card:first-child {
    position: relative;
    min-height: 548px;
  }

  .layout-spotlight .d-card:first-child .d-card-image {
    height: 360px;
  }

  .layout-spotlight .d-card:not(:first-child) {
    display: block;
  }

  .layout-spotlight .d-card:not(:first-child) .d-card-image {
    width: 100%;
    height: 155px;
    min-height: 0;
  }

  .layout-spotlight .d-card:not(:first-child) .d-card-body {
    padding: 14px;
  }

  .layout-spotlight .d-card:not(:first-child) .d-facts {
    margin-top: 7px;
  }

  .layout-editorial {
    grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr);
    gap: 22px;
  }

  .editorial-feature .d-card-image {
    height: 440px;
  }

  .editorial-list {
    gap: 14px;
  }

  .editorial-list .d-card {
    grid-template-columns: 165px minmax(0, 1fr);
  }

  .editorial-list .d-card-image {
    height: 100%;
    min-height: 158px;
  }

  .layout-compact {
    gap: 18px;
  }

  .layout-compact .d-card {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .layout-compact .d-card-image {
    height: 180px;
  }

  .layout-rail {
    gap: 18px;
    padding: 8px 4px 22px;
  }

  .layout-rail .d-card {
    flex-basis: 340px;
  }

  .layout-rail .d-card-image {
    height: 220px;
  }
}

@media (min-width: 768px) and (max-width: 1100px) {
  .layout-property-browser {
    display: block;
  }

  .property-browser-preview {
    display: none;
  }

  .property-browser-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-spotlight {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  }

  .layout-spotlight .d-card:nth-child(n + 4) {
    display: none;
  }
}
/* Balance the editorial feed: one feature, three companions, then a full-width grid. */
@media (min-width: 768px) {
  .layout-editorial { align-items: stretch; }
  .editorial-feature,
  .editorial-feature > .d-card { height: 100%; }
  .editorial-list { grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .editorial-more {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
  }
  .editorial-more .d-card-image { height: 210px; }
}

@media (max-width: 767px) {
  .editorial-more {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-top: 1px;
  }
  .editorial-more .d-card-image {
    width: 100%;
    height: clamp(135px, 40vw, 190px);
    min-height: 0;
  }
}
