/* Site-wide fixes that replace what Elementor / plugin JavaScript used to do. */

/* --- Navigation (Elementor Pro nav menu used smartmenus.js) --- */
.elementor-nav-menu--main .elementor-nav-menu .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 12em; z-index: 100; }
.elementor-nav-menu--main .elementor-nav-menu li { position: relative; }
.elementor-nav-menu--main .elementor-nav-menu li:hover > .sub-menu,
.elementor-nav-menu--main .elementor-nav-menu li:focus-within > .sub-menu { display: block; }
.elementor-nav-menu--dropdown.elementor-nav-menu__container { display: none; }
.elementor-nav-menu--dropdown.elementor-nav-menu__container.elementor-nav-menu--active { display: block; }
.elementor-menu-toggle .elementor-menu-toggle__icon--close { display: none; }
.elementor-menu-toggle.elementor-active .elementor-menu-toggle__icon--close { display: inline-block; }
.elementor-menu-toggle.elementor-active .elementor-menu-toggle__icon--open { display: none; }
.elementor-widget-nav-menu .elementor-nav-menu--dropdown { max-height: 80vh; overflow-y: auto; }

/* The "dc-has-condition" desktop menu is hidden on tablet/mobile by Elementor classes; the
   mobile-only widget handles small screens. Make sure the burger shows where it should. */
@media (max-width: 1024px) {
  .elementor-nav-menu--dropdown-tablet .elementor-nav-menu--main,
  .elementor-nav-menu--dropdown-mobile .elementor-nav-menu--main { display: none; }
}

/* --- Custom fade-in frames used on property pages (needs .in-view, added by site.js) --- */
.no-js .luxury-image-container, .no-js .press-bg { opacity: 1; }

/* --- Elementor Pro gallery (layout used to be computed by JS) --- */
.elementor-gallery__container { display: grid; grid-template-columns: repeat(var(--columns, 4), 1fr); gap: var(--gap, 10px); }
.elementor-gallery__container .e-gallery-item { position: relative; display: block; overflow: hidden; }
.elementor-gallery__container .e-gallery-image { display: block; width: 100%; aspect-ratio: var(--ratio, 3 / 2); background-size: cover; background-position: center; background-repeat: no-repeat; }
.elementor-gallery__container .elementor-gallery-item__overlay { position: absolute; inset: 0; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .3s; }
.elementor-gallery__container .e-gallery-item:hover .elementor-gallery-item__overlay { opacity: 1; }
@media (max-width: 1024px) { .elementor-gallery__container { grid-template-columns: repeat(var(--columns-tablet, 2), 1fr); } }
@media (max-width: 767px) { .elementor-gallery__container { grid-template-columns: repeat(var(--columns-mobile, 2), 1fr); } }

/* --- Video widget with a custom thumbnail overlay --- */
.elementor-widget-video .elementor-custom-embed-image-overlay { cursor: pointer; }
.elementor-widget-video .elementor-video { position: relative; }
.elementor-widget-video .elementor-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.elementor-widget-video .elementor-video:has(iframe) { aspect-ratio: 16 / 9; }
.elementor-widget-video .elementor-wrapper:has(.elementor-video iframe) .elementor-custom-embed-image-overlay { display: none; }

/* --- Animated headline: show the text statically --- */
.elementor-headline-dynamic-wrapper .elementor-headline-dynamic-text { display: none; }
.elementor-headline-dynamic-wrapper .elementor-headline-dynamic-text.elementor-headline-text-active { display: inline; }
.elementor-headline-text-active .elementor-headline-dynamic-letter { opacity: 1 !important; }

/* --- Lightweight lightbox (replaces Elementor's) --- */
.jg-lightbox { position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.jg-lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.jg-lightbox button { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #fff; font-size: 44px; line-height: 1; padding: 20px; cursor: pointer; opacity: .8; }
.jg-lightbox button:hover { opacity: 1; }
.jg-lightbox .jg-prev { left: 0; } .jg-lightbox .jg-next { right: 0; }
.jg-lightbox .jg-close { top: 10px; right: 10px; transform: none; font-size: 32px; }
.jg-lightbox .jg-count { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ccc; font: 14px/1 sans-serif; }

/* --- Contact form feedback --- */
.elementor-form .jg-form-note { margin-top: 12px; font-size: 14px; }

/* --- Instagram feed widget (static snapshot of the cached feed) --- */
#sb_instagram .sbi_item { display: block; }
#sb_instagram .sb_instagram_header, #sb_instagram .sbi_follow_btn { display: inline-block; }

/* --- Hand-built landing pages (burlingame-realtor, hillsborough-realtor) --- */
.standalone-page { font-family: "aktiv-grotesk", sans-serif; color: #232020; }

/* Hide the grid-builder facet controls, which were AJAX filters */
.wpgb-facet { display: none; }

/* Carousels: keep off-screen slides from widening the page */
.swiper, .swiper-container, .elementor-swiper { overflow: hidden; }
html, body { overflow-x: hidden; }

/* Landing pages: the Elementor kit link colour was overriding their button text colour */
.standalone-page a.btn-primary { color: #232020; }
.standalone-page a.btn-primary:hover { color: #232020; }

/* --- Mobile menu button: Elementor draws the burger in its default dark grey (#33373d),
   which disappears on the dark header. Use the header's menu colour (white) instead. --- */
.elementor-location-header .elementor-menu-toggle { background: transparent; }
.elementor-location-header .elementor-menu-toggle svg { fill: currentColor; width: 1em; height: 1em; }

/* --- Header overlays the page from the very top. The old site pushed the page down by the
   header's height and pulled it back up with a negative margin that was smaller than the
   header, leaving a strip of page background visible above the hero. --- */
.elementor-location-header { position: absolute; top: 0; left: 0; right: 0; z-index: 90; }
.elementor-location-header .elementor-top-section { margin-bottom: 0 !important; }

/* --- Mobile header: phone number and menu button on one line, menu button at the far right. --- */
@media (max-width: 1024px) {
  .elementor-location-header .elementor-element-3ff50b1 > .elementor-widget-wrap {
    display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: 14px;
  }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-nav-menu { order: 2; width: auto; margin: 0; }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-text-editor { order: 1; width: auto; margin: 0; }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-text-editor h5 { margin: 0; white-space: nowrap; }
  .elementor-location-header .elementor-menu-toggle { margin: 0; }
  .elementor-location-header .elementor-nav-menu--dropdown { position: absolute; right: 0; left: 0; top: 100%; }
}
@media (max-width: 1024px) {
  /* Give the phone number + menu button enough room: logo column narrower, right column wider. */
  .elementor-location-header .elementor-element-9fd475a { width: 38%; }
  .elementor-location-header .elementor-element-3ff50b1 { width: 62%; }
  .elementor-location-header .elementor-element-3ff50b1 > .elementor-widget-wrap { min-width: 0; }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-text-editor { flex: 0 1 auto; min-width: 0; }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-text-editor h5 { font-size: clamp(14px, 4.6vw, 22px); }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-nav-menu { flex: 0 0 auto; }
}
@media (max-width: 1024px) {
  /* Burger menu on tablet too (Elementor only shows it below 768px, but the horizontal menu
     doesn't fit a 50% column at tablet widths). */
  .elementor-location-header .elementor-nav-menu--dropdown-mobile .elementor-menu-toggle { display: flex; }
  .elementor-location-header .elementor-nav-menu--dropdown-mobile .elementor-nav-menu--dropdown.elementor-nav-menu--active { display: block; }
  /* Dropdown spans the full header width, below the header bar. */
  .elementor-location-header .elementor-widget-nav-menu,
  .elementor-location-header .elementor-widget-nav-menu > .elementor-widget-container { position: static; }
  .elementor-location-header .elementor-nav-menu--dropdown { background-color: rgba(35, 32, 32, 0.96) !important; }
}
@media (max-width: 1024px) {
  /* Let the dropdown position against the header section, not the column. */
  .elementor-location-header .elementor-element-3ff50b1,
  .elementor-location-header .elementor-element-3ff50b1 > .elementor-widget-wrap { position: static; }
  .elementor-location-header .elementor-element-3ff50b1 .elementor-widget-text-editor { margin-left: auto; }
}
