/* ==========================================================================
   Bostello Divi Child — Global header / navigation
   Built on the "Bostello — FindSpanishHomes" design system (nav component):
   Fixed 64px top bar, transparent-over-hero on the homepage transitioning to
   a white hairline-bottom bar on scroll, hover lozenges (not underlines),
   Inter, ink #222222 / accent #FF385C / hairline #DDDDDD / lozenge #F7F7F7.
   ========================================================================== */

:root {
  --bst-bg: #FFFFFF;
  --bst-ink: #222222;
  --bst-accent: #FF385C;
  --bst-accent-press: #E00B41;
  --bst-hairline: #DDDDDD;
  --bst-hairline-soft: #EBEBEB;
  --bst-lozenge: #F7F7F7;
  --bst-muted: #6A6A6A;
  --bst-radius-sm: 8px;
  --bst-radius-md: 14px;
  --bst-header-h: 64px;
}

/* --------------------------------------------------------------------
   1. Header shell — fixed, 64px, transparent-over-hero -> white on scroll
   -------------------------------------------------------------------- */

header.et-l--header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background-color: var(--bst-bg);
  border-bottom: 1px solid var(--bst-hairline);
  transition: background-color .2s ease, border-color .2s ease;
}

body.admin-bar header.et-l--header { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar header.et-l--header { top: 46px; }
}

/* Push every page's content below the fixed header by default... */
#main-content { padding-top: var(--bst-header-h); }

/* ...except the homepage, whose full-bleed hero is designed to sit behind
   the transparent header (matches the approved "Home v2" reference). */
body.home #main-content { padding-top: 0; }

body.home:not(.bst-scrolled) header.et-l--header {
  background-color: transparent;
  border-bottom-color: transparent;
}

/* Divi's Theme Builder header paints its OWN white fill + shadow on the
   section/row/inner-content beneath the <header> element, with !important.
   Those beat a plain `header{background:transparent}` rule, so they need
   their own override (this selector out-specifies Divi's via the extra
   `body`/`header` type selectors while matching the same class count). */
header.et-l--header .et_pb_section_0_tb_header,
header.et-l--header .et_builder_inner_content {
  box-shadow: none !important;
}

/* Divi also gives the section its own 20px top/bottom padding, which
   stacked on top of the row's min-height and made the bar taller than
   intended. Height now comes from --bst-header-h alone. */
header.et-l--header .et_pb_section_0_tb_header {
  padding: 0 !important;
}

body.home:not(.bst-scrolled) header.et-l--header .et_pb_section_0_tb_header,
body.home:not(.bst-scrolled) header.et-l--header .et_pb_row_0_tb_header,
body.home:not(.bst-scrolled) header.et-l--header .et_builder_inner_content {
  background-color: transparent !important;
}

/* --------------------------------------------------------------------
   2. Header row — alignment, spacing, vertical centering
   -------------------------------------------------------------------- */

/* Match the page's own content container exactly (Divi rows here are
   width:80%, max-width:1080px, no padding) so the logo and the CTA line
   up with the hero copy and every section below, instead of sitting on a
   wider grid of their own. */
header.et-l--header .et_pb_row_0_tb_header {
  width: 80% !important;
  max-width: 1080px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  min-height: var(--bst-header-h);
  display: flex !important;
  align-items: center;
  gap: 24px;
}

/* Divi gives its rows clearfix ::before/::after pseudo-elements. Once the
   row is a flex container those become real flex items, so space-between
   was pinning the empty ::after to the right edge and leaving the menu
   column short of it. Remove them from the flow. */
header.et-l--header .et_pb_row_0_tb_header:before,
header.et-l--header .et_pb_row_0_tb_header:after {
  display: none !important;
}

header.et-l--header .et_pb_row_0_tb_header > .et_pb_column {
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
}

/* Divi hands these columns fixed 25% / 50% / 25% widths, which together
   overflowed the row and pushed the CTA past its right edge. Let each
   column size to its own content and give the middle one the slack. */
header.et-l--header .et_pb_row_0_tb_header > .et_pb_column {
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
}

header.et-l--header .et_pb_column_0_tb_header { flex: 0 0 auto; }
header.et-l--header .et_pb_column_1_tb_header { flex: 1 1 auto; justify-content: center; }
header.et-l--header .et_pb_column_2_tb_header { flex: 0 0 auto; justify-content: flex-end; }

/* Below Divi's own menu breakpoint: just logo (left) + hamburger (right).
   The desktop CTA column is hidden here — the drawer carries its own CTA,
   so we don't show "Find your home" twice. This also fixes the hamburger
   sitting mid-row instead of pinned to the true right edge. */
@media (max-width: 980px) {
  header.et-l--header .et_pb_row_0_tb_header { justify-content: space-between; }

  /* Divi's phone breakpoint sets every column to width:100% because it
     normally STACKS them vertically. We keep them on one row, so two
     full-width columns overflowed the bar and pushed the hamburger off
     the right edge of the screen. Size them to their content instead. */
  header.et-l--header .et_pb_row_0_tb_header > .et_pb_column {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  header.et-l--header .et_pb_column_1_tb_header {
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
  }
  header.et-l--header .et_pb_column_2_tb_header { display: none !important; }
  header.et-l--header .et_pb_menu_inner_container { justify-content: flex-end !important; }
}

/* Divi's own script decides, by measuring available width, whether to show
   the inline link list or the hamburger — and our layout changes above
   threw that measurement off, so BOTH ended up hidden on real phones.
   Stop relying on it: force the correct one ourselves at each width. */
@media (min-width: 981px) {
  header.et-l--header .et-menu-nav { display: flex !important; }
  header.et-l--header .et_mobile_nav_menu { display: none !important; }
}

@media (max-width: 980px) {
  header.et-l--header .et_pb_menu__menu > nav.et-menu-nav { display: none !important; }
  header.et-l--header .et_mobile_nav_menu {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    /* Divi's own 0 6px margin here left the icon shy of the edge. */
    margin: 0 !important;
  }
  header.et-l--header .mobile_nav {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
  header.et-l--header .mobile_menu_bar {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
}

/* --------------------------------------------------------------------
   3. Logo — ink on white, white on transparent hero
   -------------------------------------------------------------------- */

header.et-l--header .et_pb_text_0_tb_header a {
  color: var(--bst-ink) !important;
  font-weight: 700;
  text-decoration: none !important;
  transition: color .2s ease;
}

body.home:not(.bst-scrolled) header.et-l--header .et_pb_text_0_tb_header a {
  color: #FFFFFF !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

header.et-l--header .et_pb_text_0_tb_header em { transition: color .2s ease; }

/* --------------------------------------------------------------------
   4. Desktop nav links — lozenge hover, no underline
   -------------------------------------------------------------------- */

header.et-l--header .et-menu-nav > ul.et-menu {
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 2px;
}

/* Keep each top-level label on one line WITHOUT putting white-space on the
   <ul>: white-space inherits, and on the <ul> it flowed down into the
   language dropdown, laying its four items out in one clipped row. */
header.et-l--header .et-menu-nav > ul.et-menu > li > a {
  white-space: nowrap;
}

header.et-l--header .et-menu-nav > ul.et-menu > li { margin: 0 !important; }

header.et-l--header .et-menu-nav > ul.et-menu > li > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px !important;
  border-radius: var(--bst-radius-sm);
  font-weight: 600;
  font-size: 15px;
  color: var(--bst-ink);
  text-decoration: none !important;
  border-bottom: none !important;
  transition: background-color .15s ease, color .15s ease;
}

header.et-l--header .et-menu-nav > ul.et-menu > li > a:hover,
header.et-l--header .et-menu-nav > ul.et-menu > li > a:focus-visible {
  background-color: var(--bst-lozenge);
}

body.home:not(.bst-scrolled) header.et-l--header .et-menu-nav > ul.et-menu > li > a {
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

body.home:not(.bst-scrolled) header.et-l--header .et-menu-nav > ul.et-menu > li > a:hover,
body.home:not(.bst-scrolled) header.et-l--header .et-menu-nav > ul.et-menu > li > a:focus-visible {
  background-color: rgba(255, 255, 255, .18);
}

/* --------------------------------------------------------------------
   4b. Dropdown arrow
   Divi draws this as the character "3" in its ETmodules icon font,
   absolutely positioned at top:0 right:0 — so it clings to the link's
   top-right corner instead of sitting next to the label, and it depends
   on the same webfont that failed us on the hamburger. Replaced with a
   CSS chevron: no webfont, vertically centred, and it flips on open.
   -------------------------------------------------------------------- */

header.et-l--header .et-menu-nav > ul.et-menu > li.menu-item-has-children > a {
  position: relative;
  padding-right: 32px !important;
}

header.et-l--header .et-menu-nav > ul.et-menu > li.menu-item-has-children > a:after {
  content: '' !important;
  font-family: inherit !important;
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 1px 0;
  background: none;
  transform: rotate(45deg);
  transition: transform .2s ease, margin-top .2s ease;
}

/* Point it upward while the dropdown is open. */
header.et-l--header .et-menu-nav > ul.et-menu > li.menu-item-has-children:hover > a:after,
header.et-l--header .et-menu-nav > ul.et-menu > li.menu-item-has-children:focus-within > a:after {
  transform: rotate(-135deg);
  margin-top: -2px;
}

/* Language dropdown panel */
header.et-l--header .sub-menu,
header.et-l--header .bst-language-submenu {
  background-color: #FFFFFF !important;
  border: 1px solid var(--bst-hairline) !important;
  border-radius: var(--bst-radius-sm) !important;
  box-shadow: rgba(0, 0, 0, .02) 0 0 0 1px, rgba(0, 0, 0, .04) 0 2px 6px, rgba(0, 0, 0, .1) 0 4px 8px !important;
  padding: 6px !important;
}

/* The dropdown is a vertical list: one full-width row per language.
   (Divi's .et-menu li rule makes every item inline-block, submenu
   included, so it needs stating explicitly here.) */
header.et-l--header .sub-menu {
  white-space: normal;
  /* Divi's stock dropdown is a fixed 240px, far wider than two-letter
     language labels need. Size it to its content instead. */
  width: auto !important;
  min-width: 150px !important;
}

header.et-l--header .sub-menu li {
  display: block !important;
  width: 100% !important;
  float: none !important;
}

header.et-l--header .sub-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px !important;
  width: 100%;
  color: var(--bst-ink) !important;
  text-shadow: none !important;
  border-radius: 6px;
  white-space: nowrap;
}

header.et-l--header .sub-menu a:hover {
  background-color: var(--bst-lozenge);
}

/* --------------------------------------------------------------------
   5. Hamburger — color follows header state, from the design system
   -------------------------------------------------------------------- */

/* Divi renders the hamburger as a CHARACTER ("a") in its ETmodules icon
   font, coloured via an undefined `--gcid-primary-color` variable. That
   ties our icon to a webfont load and to a Divi variable we don't own, so
   we drop it entirely and draw the bars ourselves — full control, correct
   Bostello colours, and nothing to load before it can appear. */
header.et-l--header .mobile_menu_bar:before {
  display: none !important;
}

header.et-l--header .mobile_menu_bar {
  position: relative;
  color: var(--bst-ink);
  transition: color .2s ease;
  cursor: pointer;
}

/* One element, three bars: the middle bar is the box, the outer two are
   box-shadows of it. `currentColor` means all three follow the colour set
   on .mobile_menu_bar above, so there is a single place to change it. */
header.et-l--header .mobile_menu_bar:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 2px;
  margin: -1px 0 0 -11px;
  border-radius: 2px;
  background-color: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
  transition: background-color .2s ease, box-shadow .2s ease;
}

/* Over the hero the bars go white — and because hero photography can be
   light (this one is near-white at the top, which is exactly why a plain
   white icon vanished), they carry the same soft shadow the logo and nav
   links use, so the icon stays legible over any part of any photo. */
body.home:not(.bst-scrolled) header.et-l--header .mobile_menu_bar {
  color: #FFFFFF;
}

body.home:not(.bst-scrolled) header.et-l--header .mobile_menu_bar:after {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

/* header.js injects a real <svg> icon and flags the button. When that has
   happened the CSS-drawn bars above stand down, so only one icon renders.
   If the script never runs, the CSS bars remain as the fallback. */
header.et-l--header .mobile_menu_bar.bst-has-icon:after {
  display: none !important;
}

header.et-l--header .mobile_menu_bar .bst-burger {
  display: block;
  color: inherit;
  overflow: visible;
}

body.home:not(.bst-scrolled) header.et-l--header .mobile_menu_bar .bst-burger {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

/* Never show Divi's own full-screen mobile dropdown — replaced by the
   Bostello slide-in drawer below. */
header.et-l--header .et_mobile_nav_menu .et_mobile_menu,
header.et-l--header .et_pb_menu .et_mobile_menu {
  display: none !important;
}

/* --------------------------------------------------------------------
   6. Primary CTA button — Bostello button token
   -------------------------------------------------------------------- */

header.et-l--header .et_pb_button_0_tb_header.et_pb_button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px !important;
  background-color: var(--bst-ink) !important;
  border: none !important;
  border-radius: var(--bst-radius-sm) !important;
  color: #FFFFFF !important;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  box-shadow: none !important;
  transition: background-color .15s ease;
}

header.et-l--header .et_pb_button_0_tb_header.et_pb_button:after { display: none !important; }

header.et-l--header .et_pb_button_0_tb_header.et_pb_button:hover {
  background-color: var(--bst-accent) !important;
  color: #FFFFFF !important;
}

header.et-l--header .et_pb_button_0_tb_header.et_pb_button:active {
  background-color: var(--bst-accent-press) !important;
}

/* ==========================================================================
   7. Mobile slide-in drawer (built by header.js, replaces Divi's dropdown)
   ========================================================================== */

.bst-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 34, 34, .45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
  z-index: 9998;
}

.bst-drawer-overlay.is-open { opacity: 1; visibility: visible; }

.bst-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 85%;
  max-width: 360px;
  background: var(--bst-bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, .12);
}

.bst-drawer.is-open { transform: translateX(0); }

/* Logged-in admins have the WordPress toolbar pinned at the top; without
   this the drawer's own header hides behind it. Visitors are unaffected. */
body.admin-bar .bst-drawer,
body.admin-bar .bst-drawer-overlay { top: 32px; height: calc(100% - 32px); }

@media (max-width: 782px) {
  body.admin-bar .bst-drawer,
  body.admin-bar .bst-drawer-overlay { top: 46px; height: calc(100% - 46px); }
}

.bst-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bst-header-h);
  padding: 0 20px 0 24px;
  border-bottom: 1px solid var(--bst-hairline);
}

.bst-drawer-logo {
  font-weight: 700;
  font-size: 17px;
  color: var(--bst-ink);
}

.bst-drawer-logo em { font-style: italic; color: var(--bst-accent); }

.bst-drawer-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--bst-radius-sm);
  font-size: 22px;
  line-height: 1;
  color: var(--bst-ink);
  cursor: pointer;
}

.bst-drawer-close:hover { background-color: var(--bst-lozenge); }

.bst-drawer-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 8px 16px;
}

/* The menu is cloned out of Divi's header, so it can arrive carrying
   theme and plugin rules meant for a horizontal desktop bar or an
   absolutely-positioned dropdown. Inside the drawer we own the layout
   outright: reset the list to a plain vertical stack. */
.bst-drawer-nav ul,
.bst-drawer-nav li {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  float: none !important;
  width: auto !important;
  max-width: none !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* !important because the reset above clears borders with !important. */
.bst-drawer-nav > ul > li { border-bottom: 1px solid var(--bst-hairline-soft) !important; }

.bst-drawer-nav > ul > li:last-child { border-bottom: 0 !important; }

.bst-drawer-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border-radius: var(--bst-radius-sm);
  font-weight: 600;
  font-size: 16px;
  color: var(--bst-ink);
  text-decoration: none;
}

.bst-drawer-nav a:hover,
.bst-drawer-nav a:focus-visible { background-color: var(--bst-lozenge); }

.bst-drawer-nav .menu-item-has-children > a::after {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--bst-muted);
  border-bottom: 2px solid var(--bst-muted);
  transform: rotate(-45deg);
  transition: transform .2s ease;
}

.bst-drawer-nav .menu-item-has-children.is-open > a::after { transform: rotate(45deg); }

.bst-drawer-nav .sub-menu {
  max-height: 0;
  overflow: hidden;
  padding-left: 12px;
  transition: max-height .25s ease;
}

.bst-drawer-nav .menu-item-has-children.is-open > .sub-menu { max-height: 480px; }

.bst-drawer-nav .sub-menu a { font-weight: 400; font-size: 15px; padding: 12px 16px; }

/* The language switcher's submenu is styled as a floating dropdown card
   for the desktop bar. Inside the drawer it is just an indented list. */
.bst-drawer .bst-drawer-nav .sub-menu {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: none !important;
}

.bst-drawer-cta {
  flex: 0 0 auto;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--bst-hairline);
}

.bst-drawer-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: var(--bst-radius-sm);
  background-color: var(--bst-ink);
  color: #FFFFFF !important;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .15s ease;
}

.bst-drawer-cta a:hover { background-color: var(--bst-accent); }

body.bst-drawer-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  header.et-l--header,
  .bst-drawer,
  .bst-drawer-overlay,
  .bst-drawer-nav .sub-menu,
  .bst-drawer-nav .menu-item-has-children > a::after {
    transition: none !important;
  }
}
