/*
 Theme Name:   MurrinMedia Base Theme
 Theme URI:    https://murrinmedia.com.au/
 Description:  Base theme based on Bricks.
 Author:       MurrinMedia
 Author URI:   https://murrinmedia.com.au/
 Template:     bricks
 Version:      1.1
 Text Domain:  bricks
*/
/* ==========================================================
   HEADER MODIFIERS
   Add to the header Section (class "header"):
   .header--pill     menu sits inside a rounded pill
   .header--overlay  header floats over the hero on pages whose
                     first section is a .hero (other pages unchanged)
   --header-height is measured by a small script in functions.php.
   ========================================================== */

/* PILL */
.header--pill .header__container {
  padding: 1rem 3em;
  border: 2px solid var(--bricks-border-color);
  border-radius: var(--radius-full);
  background-color: var(--tertiary-l-6);
}

/* OVERLAY */
body:has(#brx-content > .hero:first-child) #brx-header:has(.header--overlay) {
  position: absolute;
  top: var(--wp-admin--admin-bar--height, 0px); /* below the WP admin bar when logged in */
  left: 0;
  right: 0;
  z-index: 100;
}
body:has(#brx-content > .hero:first-child) .header.header--overlay {
  background: transparent;
  border-bottom: 0;
}
/* Push hero content below the floating header */
body:has(#brx-header .header--overlay) #brx-content > .hero:first-child {
  --hero-offset: var(--header-height, 8rem);
}
/* ==========================================================
   IN-APP BROWSERS
   Stop Facebook/Instagram's in-app browser (and others) inflating
   text sizes, which breaks hero headlines on phones.
   ========================================================== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ==========================================================
   HEADER FIXES (from murrinmedia.com.au)
   ========================================================== */
/* Keep the header and its dropdowns above page content on every page */
#brx-header {
  position: relative;
  z-index: 100;
}
@media (min-width: 1100px) {
  /* Invisible bridge so a dropdown doesn't close while the mouse
     crosses the gap between the menu and the dropdown */
  #brx-header .mm .mm__nav-items > .brxe-dropdown > .brx-dropdown-content::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 2rem;
  }
}
@media (max-width: 1100px) {
  /* Phone menu top row: logo left, close right.
     Back takes the logo's place inside a sub-menu. */
  #brx-header .mm .mm__mobile-nav {
    position: relative;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-height: 5.5rem;
  }
  #brx-header .mm .mm__mobile-logo { order: -1; width: 9.5rem; }
  #brx-header .mm .mm__toggle-close { order: 2; }
  #brx-header .mm .mm__mobile-nav .mm-close-dropdown-btn { top: 50%; transform: translate(100%, -50%); }
  #brx-header .mm .mm__mobile-nav[data-submenu-open="True"] .mm-close-dropdown-btn { transform: translate(0, -50%); }
  #brx-header .mm .mm__mobile-nav[data-submenu-open="True"] .mm__mobile-logo { visibility: hidden; }
}
/* NB: never put transform, filter or backdrop-filter on the header,
   its section or container: the phone menu is position:fixed inside it
   and would be trapped. For a frosted look, blur a ::before layer. */

/* ==========================================================
   STICKY + SHRINK
   Add to the header Section (class "header"):
   .header--sticky  header stays at the top while scrolling
   .header--shrink  once scrolled: smaller padding and logo, a
                    background and a shadow. Use with --sticky.
   Both work with .header--pill and .header--overlay. A small
   script in functions.php adds .is-scrolled to #brx-header.
   Per-site settings:
   ========================================================== */
:root {
  --header-scrolled-bg: var(--white); /* bar background once scrolled (not pill) */
  --header-shrink-pad: 0.75rem;       /* top/bottom padding once scrolled */
  --header-shrink-logo: 9rem;         /* logo width once scrolled */
}
#brx-header:has(.header--sticky) {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
}
/* Overlay over a hero: fixed instead of absolute so it follows the scroll */
body:has(#brx-content > .hero:first-child) #brx-header:has(.header--overlay.header--sticky) {
  position: fixed;
}
/* Lock the outer height so shrinking never pulls the page up */
#brx-header:has(.header--shrink) {
  height: var(--header-height, auto);
  pointer-events: none;
}
#brx-header:has(.header--shrink) > * {
  pointer-events: auto;
}
.header.header--shrink,
.header--shrink .header__container,
.header--shrink .header__logo {
  transition: padding 0.3s ease, width 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}
/* Scrolled. The doubled ID beats the overlay's transparent background. */
#brx-header#brx-header.is-scrolled .header.header--shrink {
  padding-block: var(--header-shrink-pad);
  background-color: var(--header-scrolled-bg);
  box-shadow: var(--shadow-m);
}
#brx-header#brx-header.is-scrolled .header--shrink .header__logo {
  width: var(--header-shrink-logo);
}
/* Pill: the page shows around the pill; the pill tightens and lifts */
#brx-header#brx-header.is-scrolled .header.header--pill {
  background-color: transparent;
  border-bottom-color: transparent;
  box-shadow: none;
}
#brx-header#brx-header.is-scrolled .header.header--pill.header--shrink {
  padding-block: 0.5rem;
}
#brx-header#brx-header.is-scrolled .header--pill.header--shrink .header__container {
  padding-block: 0.5rem;
  box-shadow: var(--shadow-m);
}
@media (prefers-reduced-motion: reduce) {
  .header.header--shrink,
  .header--shrink .header__container,
  .header--shrink .header__logo { transition: none; }
}
/* ==========================================================
   PILL TO BAR
   .header--pill-to-bar (with --pill, --sticky and --shrink):
   a floating pill at the top that stretches into a full-width
   bar once the page scrolls. The pill's background lives on a
   ::before layer so it can grow without moving the logo or links.
   ========================================================== */
#brx-header:has(.header--pill-to-bar) {
  overflow-x: clip;
}
.header--pill.header--pill-to-bar .header__container {
  position: relative;
  isolation: isolate;
  background-color: transparent;
  border-color: transparent;
}
.header--pill.header--pill-to-bar .header__container::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid var(--bricks-border-color);
  border-radius: var(--radius-full);
  background-color: var(--tertiary-l-6);
  transition: left 0.35s ease, right 0.35s ease, border-radius 0.35s ease, box-shadow 0.35s ease;
}
#brx-header#brx-header.is-scrolled .header--pill.header--pill-to-bar .header__container {
  box-shadow: none;
}
#brx-header#brx-header.is-scrolled .header.header--pill.header--pill-to-bar {
  padding-block: 0;
}
#brx-header.is-scrolled .header--pill.header--pill-to-bar .header__container::before {
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: var(--shadow-m);
}
@media (prefers-reduced-motion: reduce) {
  .header--pill.header--pill-to-bar .header__container::before { transition: none; }
}
