/*
 * Site Navigation (thrive/site-navigation). Markup: includes/site-navigation.php.
 *
 * Type, spacing, colour and motion match the old Bricks header (Bricks "Header" template 1408
 * + the "… - Navigation" panel templates), measured on the live site 2026-11-09 at
 * 1440/1024/992/991/800/767/600/478/390px. Breakpoints are Bricks': ≤991 (tablet portrait:
 * mobile menu), ≤767 (mobile landscape: Contact moves into the menu, 20px gutters), ≤478
 * (mobile portrait). The bar stays 80px at every width: the HashBar pin in
 * css/jump-links.css offsets the header by exactly 80px.
 */

.thr-nav {
  --thr-ink: #173F35;
  --thr-paper: #FCFBF5;
  --thr-muted: #55645F;
  --thr-rule: #D3D3CB;
  --thr-hover: #B8461A;
  --thr-badge: #63B1BC;
  --thr-beige: #E9E4D9;
  --thr-back: #8B9F9A;

  position: relative;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--thr-ink);
  text-align: left;
}

.thr-nav *,
.thr-nav *::before,
.thr-nav *::after {
  box-sizing: border-box;
}

/* Resets at class-only specificity (:where), so every component rule below beats them. */
.thr-nav :where(ul) {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thr-nav :where(a) {
  color: inherit;
  text-decoration: none;
}

.thr-nav :where(button) {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Focus rings come from css/thrive.css (`* > :focus`, orange, !important), as site-wide. */

.thr-nav__sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------------------------ bar */

/* 80px with its 1px rule; 40px gutters (20px ≤767). DOM order is logo, toggle, menu,
   Contact (so the drawer follows its toggle for keyboard users); `order` lays them out. */
.thr-nav__bar {
  height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  background: var(--thr-paper);
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
}

/* 70×50 box with the 70×40 logo 3px down, as the old header. */
.thr-nav__logo {
  order: 0;
  display: block;
  flex: none;
  height: 50px;
  padding-top: 3px;
  line-height: 0;
}

.thr-nav__menu {
  order: 1;
  margin-left: auto;
  display: flex;
  align-items: center;
}

.thr-nav__list {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Inter 16/400/20.8px. No change on hover or while open: only the chevron turns. */
.thr-nav__top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--thr-ink);
}

.thr-nav__chev {
  flex: none;
  width: 12px;
  height: 12px;
}

.thr-nav__top[aria-expanded="true"] .thr-nav__chev {
  transform: rotate(180deg);
}

/* `.icon svg { transition: 300ms }`, as the old header's nav links. */
@media (prefers-reduced-motion: no-preference) {
  .thr-nav__chev {
    transition: transform 300ms ease;
  }
}

/* Contact 84px after the last link. */
.thr-nav__actions {
  order: 2;
  display: flex;
  flex: none;
  margin-left: 84px;
}

/* Contact is the old header's Bricks button: `bricks-button outline bricks-color-primary`
   brings the orange outline, Inter 14/500, the 6px radius, hover fade and `.3s all ease`
   from the site's own Bricks styles. Only its box is set here: 144px, 11px 10px. */
.thr-nav .thr-nav__button {
  width: 144px;
  padding: 11px 10px;
  justify-content: center;
  text-align: center;
}

.thr-nav__toggle {
  order: 3;
  display: none;
}

.thr-nav__foot {
  display: none;
}

/* ---------------------------------------------------------------------------------- panels */

/*
 * Desktop: the old .thrive-menu-item screens. A full-width sheet 3px up into the bar (y=77),
 * cream, `20px 40px 30px`, a 1px rgba(0,0,0,.2) rule, no shadow. It slides down from behind
 * the bar and fades, `all 0.5s ease-in-out`, and its content fades, `opacity 0.5s
 * ease-in-out`. The panel clips the sheet at its top edge. Closed, the panel is visibility:
 * hidden (unfocusable, unread), delayed until the close slide has run.
 */
.thr-nav__panel {
  position: absolute;
  top: calc(100% - 3px);
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}

.thr-nav__panel.is-open {
  visibility: visible;
}

.thr-nav__sheet {
  max-height: calc(100vh - var(--thr-nav-bottom, 80px) + 3px);
  max-height: calc(100dvh - var(--thr-nav-bottom, 80px) + 3px);
  overflow-y: auto;
  padding: 20px 40px 30px;
  background: var(--thr-paper);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-100%);
}

.thr-nav__panel.is-open .thr-nav__sheet {
  opacity: 1;
  transform: none;
}

.thr-nav__panel-inner {
  max-width: 1800px;
  margin: 0 auto;
  overflow: hidden;
  opacity: 0;
}

.thr-nav__panel.is-open .thr-nav__panel-inner {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .thr-nav__panel {
    transition: visibility 0s linear 0.5s;
  }

  .thr-nav__panel.is-open {
    transition-delay: 0s;
  }

  .thr-nav__sheet {
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
  }

  .thr-nav__panel-inner {
    transition: opacity 0.5s ease-in-out;
  }
}

/* The Back bar is for mobile screens. */
.thr-nav__back-bar {
  display: none;
}

/*
 * Bricks panels: a "Navigation: X" part holding a GutenBricks "… - Navigation" template
 * (About Us, What We Do). The template's section brings its own padding, background, rule
 * and (on mobile) Back bar. The site's Bricks custom CSS hides every .thrive-menu-item
 * (absolute, slid up, opacity 0; fixed and off-canvas at ≤991px) until the old header's JS
 * set data-open. Here the panel does the showing and hiding, so undo that positioning.
 */
.thr-nav__panel--bricks .thr-nav__sheet {
  padding: 0;
  background: none;
  border-bottom: 0;
}

.thr-nav .thr-nav__panel .thrive-menu-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  height: auto !important;
  transform: none !important;
  opacity: 1 !important;
  z-index: auto !important;
}

.thr-nav .thr-nav__panel .thrive-menu-item > div {
  opacity: 1 !important;
}

/* Community grid: 4 across at full width, 3 at 1024. The -1px hides the first row's rules. */
.thr-nav__grid {
  margin-top: -1px !important;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(260px, calc((100% - 121px) / 4))), 1fr));
  column-gap: 40px;
}

.thr-nav__grid li {
  border-top: 1px solid var(--thr-rule);
}

.thr-nav__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0 20px;
}

.thr-nav__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* The old panel's community name: Inter 15/500/22.5px, 0.75px tracking (16/700 uppercase ≤991). */
.thr-nav__row .thr-nav__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.05em;
}

/* The old panel's "View All Communities": Inter 14/500/19.6px. */
.thr-nav__row.is-emphasis .thr-nav__name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
}

.thr-nav__icon {
  flex: none;
  margin-top: 5px;
}

.thr-nav__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

/* No counterpart in the old header (its neighbourhoods were badges). */
.thr-nav__subtitle {
  font-size: 14px;
  line-height: 1.4;
  color: var(--thr-muted);
}

/* The old badge: Inter 11/700/11px, 0.55px tracking, uppercase, 6px padding, 4px radius,
   white on teal. Colour and text are picked per row (background inline, --light class);
   contrast is the editor's call, see taste/site-navigation. */
.thr-nav__badge {
  display: inline-block;
  padding: 6px;
  border-radius: 4px;
  background: var(--thr-badge);
  color: var(--thr-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.thr-nav__badge--light {
  color: #fff;
}

a.thr-nav__row:hover .thr-nav__name,
a.thr-nav__row[aria-current="page"] .thr-nav__name,
a.thr-nav__link:hover .thr-nav__name,
a.thr-nav__link[aria-current="page"] .thr-nav__name,
a.thr-nav__group-title:hover {
  color: var(--thr-hover);
}

/* Simple links (menu sub-items): block.js sets --thr-nav-x so the list starts under its button. */
.thr-nav__groups {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 96px;
  width: max-content;
  max-width: 100%;
  margin-left: var(--thr-nav-x, 0px);
}

.thr-nav__group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 200px;
}

.thr-nav__group-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--thr-muted);
}

a.thr-nav__group-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.thr-nav__links {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.thr-nav__link {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.thr-nav__link .thr-nav__name {
  font-size: 18px;
  line-height: 1.2;
}

/* ---------------------------------------------------------------------- ≤991: mobile menu */

@media (max-width: 991px) {
  /* Contact stays in the bar to 768px, 20px left of the toggle. */
  .thr-nav__actions {
    margin-left: auto;
  }

  /* The old 25×18 Bricks "spring" toggle, in a 44px tap target that overhangs the gutter. */
  .thr-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0 -9.5px 0 10.5px; /* the 25px bars sit 20px from Contact and on the gutter */
  }

  .thr-nav__bars,
  .thr-nav__bars::before,
  .thr-nav__bars::after {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--thr-ink);
  }

  /* .brxa--spring with the old header's overrides: bars at 2, 10 and 19px of the 18px box. */
  .thr-nav__bars {
    position: relative;
    top: -6px;
  }

  .thr-nav__bars::before,
  .thr-nav__bars::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .thr-nav__bars::before {
    top: 8px;
  }

  .thr-nav__bars::after {
    top: 17px;
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars {
    background-color: transparent;
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars::before {
    top: 0;
    transform: translate3d(0, 10px, 0) rotate(45deg);
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars::after {
    top: 0;
    transform: translate3d(0, 10px, 0) rotate(-45deg);
  }

  /* The old mobile menu: cream, from y=76 to the bottom of the screen. */
  .thr-nav__menu {
    position: absolute;
    top: calc(100% - 4px);
    left: 0;
    right: 0;
    height: calc(100vh - var(--thr-nav-bottom, 80px) + 4px);
    height: calc(100dvh - var(--thr-nav-bottom, 80px) + 4px);
    margin-left: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--thr-paper);
    opacity: 0;
    visibility: hidden;
  }

  .thr-nav.is-open .thr-nav__menu {
    opacity: 1;
    visibility: visible;
  }

  /* Links 20px apart, Inter 24/300/31.2px, 20px sides, chevron pointing right. */
  .thr-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding-top: 1px;
  }

  .thr-nav__top {
    display: flex; /* block-level, so its list item adds no line gap: links exactly 20px apart */
    width: 100%;
    padding: 0 20px;
    justify-content: space-between;
    font-size: 24px;
    font-weight: 300;
    line-height: 1.3;
  }

  .thr-nav__top .thr-nav__chev,
  .thr-nav__top[aria-expanded="true"] .thr-nav__chev {
    transform: rotate(-90deg);
  }

  /* The beige block that fills the rest of the menu, 61px below the last link. Contact
     sits in it at ≤767px; above that it stays empty, as it did. */
  .thr-nav__foot {
    display: flex;
    flex: 1 0 auto;
    align-items: flex-start;
    margin-top: 60px; /* 61px measured; the 31.2px link heights round up by one */
    padding: 20px;
    background: var(--thr-beige);
  }

  .thr-nav .thr-nav__foot .thr-nav__button {
    display: none;
  }

  /* Each panel is a full screen that slides in from the right, as the old ones did. */
  .thr-nav__panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--thr-paper);
    pointer-events: auto;
    transform: translateX(100%);
  }

  .thr-nav__panel.is-open {
    transform: none;
  }

  .thr-nav__sheet {
    min-height: 100%;
    max-height: none;
    overflow: visible;
    padding: 20px;
    transform: none;
  }

  .thr-nav__panel.is-open .thr-nav__sheet {
    transform: none;
  }

  .thr-nav__panel--bricks .thrive-menu-item {
    min-height: 100%;
  }

  /* The old Back bar: 39px, Inter 14/500/21px, #8b9f9a, a 14px themify angle-left 3px from the word. */
  .thr-nav__back-bar {
    display: flex;
    align-items: flex-start;
    height: 39px;
  }

  .thr-nav .thr-nav__back {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    color: var(--thr-back);
  }

  .thr-nav__grid {
    display: block;
    margin-top: 0 !important;
  }

  .thr-nav__grid li:first-child {
    border-top: 0;
  }

  .thr-nav__row {
    min-height: 60px;
    padding: 10px 0;
    align-items: center;
    gap: 12px;
  }

  .thr-nav__text {
    gap: 4px;
  }

  .thr-nav__row .thr-nav__name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: uppercase;
  }

  .thr-nav__row.is-emphasis .thr-nav__name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
  }

  .thr-nav__subtitle {
    font-size: 13px;
  }

  .thr-nav__icon {
    margin-top: 0;
  }

  .thr-nav__groups {
    flex-direction: column;
    width: auto;
    gap: 20px;
    margin-left: 0;
  }

  .thr-nav__group {
    gap: 4px;
  }

  .thr-nav__links {
    gap: 0;
  }

  .thr-nav__link {
    display: flex;
    min-height: 44px;
    justify-content: center;
  }

  .thr-nav__link .thr-nav__name {
    font-size: 16px;
  }
}

/* ------------------------------------------------------------- ≤767: Contact in the menu */

@media (max-width: 767px) {
  .thr-nav__bar {
    padding: 0 20px;
  }

  .thr-nav__actions {
    display: none;
  }

  .thr-nav__toggle {
    margin-left: auto;
  }

  .thr-nav .thr-nav__foot .thr-nav__button {
    display: inline-flex;
    padding: 19px 10px;
  }
}

/* ≤478: the old menu's first link sat 40px down. */
@media (max-width: 478px) {
  .thr-nav__list {
    padding-top: 41px;
  }
}

html.thr-nav-locked {
  overflow: hidden;
}

/*
 * Mobile motion, matched to the old header:
 * - the menu fades like Bricks' nav-nested mobile menu (opacity, transform, visibility .2s ease);
 * - a panel screen slides in from the right and fades, 0.5s ease-in-out, like the old
 *   .thrive-menu-item screens;
 * - the toggle is Bricks' "spring" hamburger (.brxa--spring): the outer bars close in, then
 *   cross; on close they uncross, then spread. Same delays and curves.
 */
@media (max-width: 991px) and (prefers-reduced-motion: no-preference) {
  .thr-nav__menu {
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .thr-nav__panel {
    transition: transform 0.5s ease-in-out, visibility 0s linear 0.5s;
  }

  .thr-nav__panel.is-open {
    transition: transform 0.5s ease-in-out, visibility 0s;
  }

  .thr-nav__sheet {
    transition: opacity 0.5s ease-in-out;
  }

  .thr-nav__bars {
    transition: background-color 0s linear 0.13s;
  }

  .thr-nav__bars::before {
    transition: top 0.1s cubic-bezier(0.33333, 0.66667, 0.66667, 1) 0.2s, transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }

  .thr-nav__bars::after {
    transition: top 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1) 0.2s, transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars {
    transition-delay: 0.22s;
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars::before {
    transition: top 0.1s cubic-bezier(0.33333, 0, 0.66667, 0.33333) 0.15s, transform 0.13s cubic-bezier(0.215, 0.61, 0.355, 1) 0.22s;
  }

  .thr-nav__toggle[aria-expanded="true"] .thr-nav__bars::after {
    transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s cubic-bezier(0.215, 0.61, 0.355, 1) 0.22s;
  }
}
