/*
 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.2
 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.
   ========================================================== */

/* PLAIN (no overlay, no pill): always opaque, so a sticky header
   never lets the page show through before .is-scrolled is added.
   Overlay (on hero pages) and pill set their own transparency. */
.header {
  background-color: var(--header-bg);
}
.header.header--pill {
  background-color: transparent;
}

/* 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-bg: var(--white);          /* bar background before scrolling (plain headers) */
  --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; }
}

/* ==========================================================
   DARK MOBILE MENU
   .header--dark-mobile (add to the header Section): below 1100px the
   slide-out menu is dark (--bg-dark) with light links, a faint logo
   top-left, the close button top-right, and "Back" in place of the logo
   inside a sub-menu. Set the Mobile Logo image to the light-on-dark logo.
   Optional: a <span class="mm__link-desc"> inside a dropdown link shows
   as a short description under the link name.
   ========================================================== */
@media (max-width: 1099px) {
  #brx-header .header--dark-mobile .mm .mm__nav-items-wrapper {
    background-color: var(--bg-dark);
  }
  #brx-header .header--dark-mobile .mm .mm__nav-items,
  #brx-header .header--dark-mobile .mm .mm__dropdown-content {
    background-color: transparent;
  }
  /* sub-menu has no solid background, so fade the main list out behind it */
  #brx-header .header--dark-mobile .mm .mm__nav-items > li,
  #brx-header .header--dark-mobile .mm .mm__nav-items > .brxe-dropdown > .brx-submenu-toggle {
    transition: opacity 0.3s ease;
  }
  #brx-header .header--dark-mobile .mm .mm__nav-items:has(> .brxe-dropdown.open) > li:not(.open),
  #brx-header .header--dark-mobile .mm .mm__nav-items > .brxe-dropdown.open > .brx-submenu-toggle {
    opacity: 0;
    pointer-events: none;
  }
  /* close and back buttons */
  #brx-header .header--dark-mobile .mm .mm__toggle-close,
  #brx-header .header--dark-mobile .mm .mm__toggle-close i,
  #brx-header .header--dark-mobile .mm .mm-close-dropdown-btn,
  #brx-header .header--dark-mobile .mm .mm-close-dropdown-btn i {
    color: var(--white);
    background: transparent;
  }
  #brx-header .header--dark-mobile .mm .mm__toggle-close { font-size: 2rem; }
  /* links (the last-item button keeps its own style) */
  #brx-header .header--dark-mobile .mm .mm__nav-items > li > a:not(.bricks-button),
  #brx-header .header--dark-mobile .mm .mm__nav-items > li > .brx-submenu-toggle,
  #brx-header .header--dark-mobile .mm .mm__nav-items > li > .brx-submenu-toggle > *,
  #brx-header .header--dark-mobile .mm .mm__dropdown-content > li > a {
    color: var(--white);
    background-color: transparent;
    border-color: color-mix(in srgb, var(--white) 12%, transparent);
    font-size: var(--text-l);
    font-weight: 600;
  }
  #brx-header .header--dark-mobile .mm .mm__dropdown-content > li > a:hover {
    color: var(--tertiary);
    background-color: transparent;
  }
  #brx-header .header--dark-mobile .mm .mm__nav-items > li > a[aria-current="page"]:not(.bricks-button),
  #brx-header .header--dark-mobile .mm .mm__dropdown-content > li > a[aria-current="page"] {
    color: var(--tertiary);
  }
  #brx-header .header--dark-mobile .mm .mm__nav-items > li,
  #brx-header .header--dark-mobile .mm .mm__dropdown-content > li {
    border-color: color-mix(in srgb, var(--white) 12%, transparent);
  }
  /* sub-menu links: name with an optional description underneath */
  #brx-header .header--dark-mobile .mm .mm__dropdown-content > li > a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  #brx-header .header--dark-mobile .mm .mm__link-desc {
    display: block;
    font-size: var(--text-s);
    font-weight: 400;
    color: color-mix(in srgb, var(--white) 65%, transparent);
  }
  /* top row: faint logo left, close right */
  #brx-header .header--dark-mobile .mm .mm__mobile-nav {
    position: relative;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-height: 5.5rem;
    background-color: transparent;
  }
  #brx-header .header--dark-mobile .mm .mm__mobile-logo {
    display: block;
    order: -1;
    width: 9.5rem;
    height: auto;
    opacity: 0.45;
  }
  #brx-header .header--dark-mobile .mm .mm__mobile-logo img {
    width: 100%;
    height: auto;
  }
  #brx-header .header--dark-mobile .mm .mm__toggle-close { order: 2; }
  #brx-header .header--dark-mobile .mm .mm-close-dropdown-btn {
    left: var(--mm-pad-h, 2rem);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-m);
    font-weight: 600;
    gap: 0.4em;
  }
  #brx-header .header--dark-mobile .mm .mm__mobile-nav[data-submenu-open="True"] .mm__mobile-logo {
    visibility: hidden;
  }
}