/**
 * Hello Home — landing-page header.
 *
 * Logo left, buttons right, on a white bar. Stands in for the theme header
 * on a page where the site menu is more exit than navigation.
 *
 * Matches the theme's own bar closely enough that the swap is not obvious:
 * 65px tall, logo around 130px wide, small buttons hard right.
 */

/**
 * The theme header goes when this one is present.
 *
 * Safe to put in a stylesheet rather than in page CSS because this file is
 * registered globally but only ENQUEUED when the widget actually renders --
 * so the rule reaches exactly the pages carrying a replacement header, and
 * nothing else. Dropping the widget from a page restores the site header on
 * its own, with nothing to remember to undo.
 *
 * Hiding #masthead is only half of it. The theme header is position: fixed,
 * so it is out of flow and the space for it is reserved by padding on
 * #content -- NOT on body, which is what misled the first version of this
 * rule. Hide the header without clearing that padding and you get 65px of
 * page background above the replacement, which on this site's dark body
 * reads as a black bar.
 */
#masthead {
  display: none;
}

#content.site-content {
  padding-top: 0;
}

.hello-header {
  --hello-pad-y: 0;
  --hello-pad-x: clamp(16px, 3vw, 40px);
  --hello-width: 100%;
  background: var(--hello-bg, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.hello-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 65px;
}

/* ---- logo --------------------------------------------------------------- */

.hello-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.hello-header__logo-img {
  display: block;
  width: auto;
  height: 38px;
  /* The theme rounds images in post content; a logo has no corners to round. */
  border-radius: 0;
}

/* ---- buttons ------------------------------------------------------------ */

.hello-header__actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
}

/* Smaller than the page's calls to action: this is chrome, not the pitch. */
.hello-header .hello-btn.hello-header__btn {
  padding: 9px 20px;
  border-width: 2px;
  font-size: 14px;
  white-space: nowrap;
}

/**
 * "Quiet" is the old nav item -- Shop was a menu link, and DC want it as a
 * button without it competing with Get 7 Days Free. Plain text until it is
 * hovered, then it picks up the accent.
 */
.hello-header .hello-btn.hello-header__btn--quiet {
  background: transparent;
  border-color: transparent;
  color: inherit;
}
.hello-header .hello-btn.hello-header__btn--quiet:hover,
.hello-header .hello-btn.hello-header__btn--quiet:focus-visible {
  background: transparent;
  border-color: transparent;
  color: var(--hello-accent);
}

/* ---- optional sticky ---------------------------------------------------- */

/**
 * Fixed, not sticky -- and the INNER is what gets fixed, not the section.
 *
 * position:sticky was the obvious implementation and it never worked on a
 * builder page. Sticky can only travel inside its own parent's box, and
 * WPBakery wraps a shortcode in wpb_wrapper > vc_column-inner > wpb_column >
 * vc_row, every one of which is exactly as tall as the header itself. Zero
 * range, so the bar scrolled away like any static element. Measured on the
 * hybrid page: the header's top went from 0 to -1200 after a 1200px scroll.
 *
 * Fixing the inner rather than the section is what keeps the layout honest.
 * A fixed element is out of flow, so fixing the section would collapse it to
 * nothing and yank the whole page up 65px. Here the section stays in flow as
 * an empty strip of exactly the bar's height -- it holds the space open --
 * and the inner is lifted out of it to the top of the viewport. The strip is
 * never actually seen: at the top of the page the bar covers it exactly, and
 * once scrolled it is above the viewport.
 *
 * This escapes the row containment entirely. The one thing that would break
 * it is an ancestor with a transform, filter or contain, since those make a
 * containing block for fixed children -- none on the chain today, and
 * WPBakery only adds them when a row animation is switched on.
 */
/* 65px of bar plus the 1px rule under it. The spacer has to match the fixed
   bar's OUTER height or the page sits a pixel high. */
.hello-header--sticky {
  min-height: 66px;
}

.hello-header--sticky .hello-widget__inner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  /* The background and rule come with it -- they were on the section, which
     is now just the spacer left behind. */
  background: var(--hello-bg, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

/**
 * The admin bar is fixed at the top for logged-in users, so the header has to
 * start below it or the two overlap. WordPress's own breakpoints: 32px tall
 * normally, 46px at 782px and under, and below 601px it switches to
 * position:absolute and scrolls away with the page -- so the header takes the
 * top back.
 *
 * No z-index fight: the admin bar sits at 99999 and this at 60, so it stays
 * above where it belongs.
 */
body.admin-bar .hello-header--sticky .hello-widget__inner {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .hello-header--sticky .hello-widget__inner {
    top: 46px;
  }
}

@media screen and (max-width: 600px) {
  body.admin-bar .hello-header--sticky .hello-widget__inner {
    top: 0;
  }
}

/* ---- narrow ------------------------------------------------------------- */

@media (max-width: 599px) {
  /**
   * The logo shrinks before the buttons do. Losing a call to action costs
   * more than losing a few pixels of wordmark, and at this width the three
   * buttons are already the tighter constraint.
   */
  .hello-header__logo-img {
    height: 30px;
  }
  .hello-header .hello-btn.hello-header__btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .hello-header__bar {
    min-height: 56px;
  }

  /* The spacer tracks the bar it is holding space for: 56 + the 1px rule. */
  .hello-header--sticky {
    min-height: 57px;
  }
}
