/* ============================================================================
   Homeboss Theme — HEADER + base layout wrapper
   ----------------------------------------------------------------------------
   Consumes tokens.css. The header sits on --surface-base (white). The agent logo
   renders AS-IS: a max-width with height:auto preserves its native aspect ratio
   (Jerry's is 1288x739) — never cropped or recolored. Agent brand COLORS never
   enter the palette; only --action / --surface-* / --text-* tokens are used here,
   so nothing pairs --action over --footer-bg (tests/themeFooter.test.ts).
   ============================================================================ */

/* --- Call/text bar: a dismissible promo strip. On desktop it sits at the top in
   normal flow and scrolls away as the STICKY header takes over; on mobile it pins
   to the bottom of the viewport (below). It is no longer sticky on desktop, so it
   never double-pins against the sticky header at top:0. ---------------------- */
.hb-callbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  background-color: var(--action);
  color: var(--surface-base);
  font-family: var(--font-body);
  font-size: var(--fs-small);
}

.hb-callbar__label {
  font-weight: 600;
}

.hb-callbar__link {
  color: var(--surface-base);
  text-decoration: underline;
  font-weight: 600;
}

.hb-callbar__dismiss {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--surface-base);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

/* On mobile the bar sits at the BOTTOM of the viewport instead of the top. */
@media (max-width: 640px) {
  .hb-callbar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
  }
}

/* --- Header + logo lockup --------------------------------------------------- *
   The header is a DARK-NAVY bar (--footer-bg) with logo + brokerage at the LEFT,
   the page-driven nav CENTERED, and the phone + gold "Book a Call" button at the
   RIGHT. It is STICKY — pinned to the top of the viewport so the nav + Book a Call
   stay reachable as the visitor scrolls (Bob's redesign). The dismissible call/text
   bar above scrolls away beneath it, so nothing double-pins at top:0. On navy, nav
   links + wordmark render in the light footer-text token and the current/hover
   state is gold; agent brand COLORS never enter.                                  */
.hb-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--footer-bg);
  color: var(--footer-text);
}

.hb-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  /* ONE desktop row: lockup | nav | contact. flex-wrap:wrap previously let the three
     groups stack into a tall four-row header; nowrap keeps them on a single line (the
     <=640px query below switches to a stacked column with the disclosure toggle). */
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

/* Left lockup: logo (or wordmark) followed by the brokerage name on ONE line, no headshot. */
.hb-lockup {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.hb-lockup__logo {
  display: block;
  width: auto;
  height: auto; /* preserve native aspect ratio — logo is untouched, never cropped or recolored */
  /* Height-capped to nav height so a TALL logo (Jerry's is 1288x739) can no longer blow the header up
     into an oversized band. max-height binds first for a tall/square logo; max-width caps a very wide
     one. With both set and width/height auto, the native aspect ratio is preserved either way. */
  max-height: 56px;
  max-width: min(14rem, 55vw);
}

.hb-lockup__wordmark {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--footer-text);
}

/* --- Contact action: ONE compact cluster (the gold Book-a-Call CTA) --------- */
/* The phone number + Call/Text are NOT repeated in the header — they live in the
   dismissible call/text bar — so the header stays a single row: lockup | nav | Book. */
.hb-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.hb-contact__action {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--footer-text);
  border-radius: 4px;
  color: var(--footer-text);
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
}

.hb-contact__action:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* The primary CTA: the gold "Book a Call" button (dark navy ink on gold). */
.hb-contact__action--book {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--accent-gold-ink);
}

.hb-contact__action--book:hover {
  background-color: var(--accent-gold-hover);
  border-color: var(--accent-gold-hover);
  color: var(--accent-gold-ink);
}

/* --- Primary navigation (theme-rendered from WordPress pages) --------------- */
/* header.php now renders .hb-nav from the site's published pages (inc/nav.php):
   Home, About, area pages, Reviews, Podcast, Blog, Contact in a fixed order,
   Reviews/Podcast/Blog gated. Links use the same token palette as
   the contact actions so agent brand colors never enter. On desktop the list is a
   centered inline row and the toggle is hidden; at <=640px the list collapses into a
   real disclosure behind the toggle (a stacked menu, not a squeezed row). */
.hb-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.hb-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

.hb-nav__item {
  margin: 0;
}

.hb-nav__link {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--footer-text);
  text-decoration: none;
}

.hb-nav__link:hover,
.hb-nav__link[aria-current="page"] {
  color: var(--accent-gold);
  text-decoration: underline;
}

/* --- Areas group: a hover/focus dropdown holding the area (city) pages ------ */
/* The area pages are grouped under one "Areas" parent instead of scattering as
   top-level items. The submenu is CSS-only (no JS dependency): it is revealed on
   hover and on keyboard focus of the group (:focus-within, reachable because the
   group label is a focusable <button>). On mobile it flattens (below). */
.hb-nav__item--group {
  position: relative;
}

.hb-nav__group-label {
  font-family: var(--font-body);
  font-weight: 600;
  /* A <button> does NOT inherit font metrics from its container the way the sibling
     <a> .hb-nav__link does — without these three lines the UA button default (~13px)
     rendered the "Areas" label visibly smaller than every other nav link. Inheriting
     font-size / line-height / letter-spacing makes the group label pixel-match its
     siblings. Locked by tests/themeNav.test.ts so it cannot silently regress. */
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: var(--footer-text);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.hb-nav__item--group:hover .hb-nav__group-label,
.hb-nav__item--group:focus-within .hb-nav__group-label,
.hb-nav__item--current .hb-nav__group-label {
  color: var(--accent-gold);
}

.hb-nav__submenu {
  list-style: none;
  margin: 0;
  padding: 0.6rem 0.9rem;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background-color: var(--footer-bg);
  border: 1px solid var(--accent-gold);
  border-radius: 4px;
  /* Hidden but kept in flow so the group's :focus-within can reveal it on Tab. */
  opacity: 0;
  visibility: hidden;
  z-index: 110;
}

.hb-nav__item--group:hover .hb-nav__submenu,
.hb-nav__item--group:focus-within .hb-nav__submenu {
  opacity: 1;
  visibility: visible;
}

.hb-nav__subitem {
  margin: 0;
}

/* Mobile toggle: hidden on desktop where the list shows inline. */
.hb-nav__toggle {
  display: none;
}

/* --- Mobile: a real disclosure for six+ items, not a squeeze --------------- */
@media (max-width: 640px) {
  .hb-header__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hb-lockup {
    align-items: center;
  }

  .hb-nav {
    flex-direction: column;
    align-items: center;
  }

  .hb-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    background: transparent;
    border: 1px solid var(--footer-text);
    border-radius: 4px;
    color: var(--footer-text);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--fs-small);
    cursor: pointer;
  }

  .hb-nav__toggle-bar {
    width: 1rem;
    height: 2px;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
  }

  /* With JS the list collapses behind the toggle; opening reveals a stacked menu.
     Without JS the data-collapsible flag is never set, so the list stays visible. */
  .hb-nav[data-collapsible] .hb-nav__list {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    margin-top: 0.85rem;
  }

  .hb-nav[data-collapsible].is-open .hb-nav__list {
    display: flex;
  }

  .hb-nav__link {
    display: block;
    padding: 0.35rem 0;
  }

  /* The Areas dropdown flattens on mobile: once the collapsed list is open, the
     submenu is always shown, stacked and slightly indented, not a floating popup. */
  .hb-nav__submenu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    border: 0;
    padding: 0.35rem 0 0.35rem 1rem;
    min-width: 0;
    align-items: center;
  }
}

/* --- Base content wrapper -------------------------------------------------- */
.hb-main {
  background-color: var(--surface-base);
}

/* Body measure capped near 70 characters (--measure) for long-form readability. */
.hb-prose {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.5rem 1.25rem;
}
