/* Two-brand header: USA Windows & Doors | USA Roofing.
   Shared by the homepage (new.html) and every generated page; markup comes
   from brandHeader() in scripts/build-pages.mjs, so the two can't drift.

   .bh-brands  red bar with the two brand tabs. The active brand sits on a
               white tab that joins the menu bar below it, like a folder tab.
               It scrolls away.
   .bh-bar     the active brand's own menu, phone and estimate button. Sticky. */

:root {
  --bh-red: #c41e1a;
  --bh-red-deep: #a51915;
  --bh-ink: #1b1d20;
  --bh-muted: #54595f;
  --bh-line: rgba(27, 29, 32, 0.12);
  --bh-paper: #ffffff;
  --bh-font: 'Archivo', system-ui, sans-serif;
}

/* In-page jumps (#quote, #estimate, #tile) land below the sticky menu bar. */
html { scroll-padding-top: 76px; }

.bh-brands {
  background: var(--bh-red);
  color: #fff;
  font-family: var(--bh-font);
}
.bh-brands__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 28px 0;
  display: flex;
  align-items: flex-end;
  gap: 24px;
}
.bh-tabs { display: flex; align-items: flex-end; gap: 4px; }
.bh-tab {
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 24px;
  border-radius: 8px 8px 0 0;
  transition: background-color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
.bh-tab img { display: block; height: 52px; width: auto; }
.bh-tab:not(.is-active):hover,
.bh-tab:not(.is-active):focus-visible { background: var(--bh-red-deep); }
.bh-tab:not(.is-active) img { height: 48px; opacity: 0.94; }
.bh-tab:not(.is-active):hover img { opacity: 1; }
.bh-tab.is-active { background: var(--bh-paper); }
.bh-tab:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.bh-tab.is-active:focus-visible { outline-color: var(--bh-red); }

.bh-offer {
  margin: 0 0 0 auto;
  align-self: center;
  padding-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 15px;
  line-height: 1.3;
  text-align: right;
}
.bh-offer strong { font-weight: 700; letter-spacing: -0.005em; }
.bh-offer span { color: #ffd9d6; }
.bh-offer a {
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, 0.55);
}
.bh-offer a:hover { text-decoration-color: #fff; }

/* ------------------------------------------------------------ menu bar */
.bh-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bh-paper);
  border-bottom: 1px solid var(--bh-line);
  box-shadow: 0 6px 18px -14px rgba(27, 29, 32, 0.45);
  font-family: var(--bh-font);
}
.bh-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.bh-nav { display: flex; align-items: center; gap: 4px; }
.bh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  color: var(--bh-ink);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
}
.bh-link svg { transition: transform 160ms ease-out; }
.bh-link:hover, .bh-link:focus-visible, .bh-link[aria-current="page"] { color: var(--bh-red); }
.bh-link:focus-visible { outline: 2px solid var(--bh-red); outline-offset: -6px; border-radius: 4px; }

.bh-menu { position: relative; }
.bh-panel {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  min-width: 240px;
  padding: 8px 0;
  background: var(--bh-paper);
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(27, 29, 32, 0.32), 0 2px 6px rgba(27, 29, 32, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1), transform 160ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 160ms;
  z-index: 60;
}
.bh-menu:hover .bh-panel,
.bh-menu:focus-within .bh-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.bh-menu:hover .bh-link svg, .bh-menu:focus-within .bh-link svg { transform: rotate(180deg); }
.bh-panel a {
  display: block;
  padding: 10px 20px;
  color: var(--bh-ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.bh-panel a:hover, .bh-panel a:focus-visible { background: #f6f3f0; color: var(--bh-red); outline: none; }

.bh-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.bh-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bh-ink);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
.bh-phone svg { color: var(--bh-red); }
.bh-phone:hover { color: var(--bh-red); }
.bh-cta {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border-radius: 6px;
  background: var(--bh-red);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease-out;
}
.bh-cta:hover, .bh-cta:focus-visible { background: var(--bh-red-deep); color: #fff; }
.bh-cta:focus-visible { outline: 2px solid var(--bh-ink); outline-offset: 2px; }
.bh-call { display: none; }

.bh-burger {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 12px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.bh-burger span { display: block; height: 2px; width: 100%; background: var(--bh-ink); border-radius: 2px; }

/* --------------------------------------------------------- mobile panel */
.bh-mnav__backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(15, 16, 18, 0.55); }
.bh-mnav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  width: min(360px, 88vw);
  overflow-y: auto;
  background: var(--bh-paper);
  padding: 18px 24px 32px;
  display: flex;
  flex-direction: column;
  font-family: var(--bh-font);
  box-shadow: -20px 0 40px -20px rgba(15, 16, 18, 0.5);
}
.bh-mnav[hidden], .bh-mnav__backdrop[hidden] { display: none; }
.bh-mnav__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bh-mnav__head img { height: 36px; width: auto; }
.bh-mnav__close {
  width: 44px; height: 44px; margin-right: -10px;
  border: 0; background: none; font-size: 30px; line-height: 1; color: var(--bh-ink); cursor: pointer;
}
.bh-mnav a, .bh-mnav__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--bh-line);
  background: none;
  color: var(--bh-ink);
  font: 600 17px/1.2 var(--bh-font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.bh-mnav__sub { padding: 2px 0 8px 14px; }
.bh-mnav__sub a { font-weight: 500; font-size: 16px; color: var(--bh-muted); border-bottom: 0; padding: 10px 0; }
.bh-mnav__sign { color: var(--bh-red); font-size: 22px; font-weight: 500; }
.bh-mnav a.bh-mnav__switch {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--bh-line);
  border-radius: 10px;
  font-size: 15px;
}
.bh-mnav__switch img { height: 30px; width: auto; }
.bh-mnav a.bh-mnav__cta {
  margin-top: 18px;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: var(--bh-red);
  color: #fff;
}
.bh-mnav a.bh-mnav__phone { justify-content: center; border: 0; color: var(--bh-red); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- narrow */
@media (max-width: 1180px) {
  .bh-offer span { display: none; }
  .bh-link { padding: 20px 9px; font-size: 15px; }
}
@media (max-width: 1060px) {
  .bh-offer { display: none; }
  .bh-nav { display: none; }
  .bh-burger { display: flex; }
  .bh-bar__inner { min-height: 58px; gap: 12px; }
  .bh-actions { margin-left: 0; width: 100%; }
  .bh-cta { margin-left: auto; }
}
@media (max-width: 640px) {
  .bh-brands__inner { padding: 8px 12px 0; gap: 0; }
  .bh-tabs { width: 100%; gap: 2px; }
  .bh-tab { flex: 1 1 50%; justify-content: center; height: 52px; padding: 0 10px; border-radius: 6px 6px 0 0; }
  .bh-tab img, .bh-tab:not(.is-active) img { height: auto; max-height: 34px; max-width: 100%; }
  .bh-bar__inner { padding: 0 12px 0 16px; min-height: 56px; }
  .bh-cta, .bh-phone { display: none; }
  .bh-call {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    background: var(--bh-red);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
  }
  .bh-actions { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .bh-panel, .bh-link svg, .bh-tab, .bh-cta { transition: none; }
}
