/* ==========================================================================
   Dr Esh — site header and mobile drawer
   Ported from design/assets/app.css and adapted to the wp_nav_menu markup.
   --------------------------------------------------------------------------
   Elementor's kit also declares these tokens on <body> (.elementor-kit-6).
   They are repeated here on :root so the chrome renders correctly even if
   Elementor is disabled, and so this file stands on its own. The kit's copy
   wins where both apply, which is intentional: the kit stays the editable
   source of truth.
   ========================================================================== */

:root {
  --paper: #FAF8F4;
  --paper-warm: #F4F1EA;
  --ink: #1C2521;
  --ink-muted: #4C5650;
  --eucalypt: #2E4B3F;
  --clay: #C4643C;
  --clay-deep: #A9502C;
  --clay-darkest: #8F4324;
  --sand: #E7E1D6;
  --hairline: #D8D2C6;
  --font-display: Newsreader, Georgia, "Times New Roman", serif;
  --font-body: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Dancing Script", var(--font-display);
  --wrap-max: 92rem;
  --gutter: clamp(1.5rem, 1.1rem + 1.7vw, 3.25rem);
  --gutter-tablet: 2.75rem;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.site-head *,
.drawer * { box-sizing: border-box; }

/* Scoped to the header, because the page body's .wrap elements are Elementor's
   and carry their own padding. An unscoped .wrap here would compete with them. */
.site-head .wrap {
  width: 100%;
  max-width: var(--wrap-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Roomier gutter across tablet widths, per app.css. The band is Elementor's
   tablet breakpoint, not app.css's 601-1279, because the page body below is
   built from Elementor variants and the bar has to move with it or the brand
   sits out of line with the content. Mobile falls back to the clamp, which is
   what the Elementor wrap class does at the same breakpoint. */
@media (min-width: 768px) and (max-width: 1024px) {
  .site-head .wrap { padding-inline: var(--gutter-tablet); }
}

/* ---------------- sticky bar ---------------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: transparent;
}
/* solid paper bar behind the content. Also masks the dropdown so it appears to
   slide out from behind the bar. Hairline and shadow fade in once scrolled. */
.site-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.site-head.is-scrolled::before {
  border-bottom-color: var(--hairline);
  box-shadow: 0 8px 28px -22px rgba(28, 37, 33, .45);
}

.site-head__bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.5rem;
}

.brand {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto;
}
.brand:hover,
.brand:focus-visible { color: var(--eucalypt); }

/* ---------------- desktop nav ---------------- */
.nav { display: flex; align-items: center; }
.nav__list {
  display: flex;
  align-items: center;
  gap: .35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__list > li {
  position: relative;
  border-radius: 10px;
  transition: background-color .18s var(--ease);
}
/* the pill sits on the <li> so it covers the link and its caret as one
   shape, rather than stopping short at the link edge. */
.nav__list > li:hover,
.nav__list > li:focus-within,
.nav__list > li[data-open="true"] { background: rgba(231, 225, 214, .55); }
.nav__list > li > a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 44px;
  padding: .6rem .75rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.nav__list > li > a::after {
  content: "";
  position: absolute;
  left: .75rem;
  right: .75rem;
  bottom: .7rem;
  height: 1.5px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav__list > li > a[aria-current="page"]::after,
.nav__list > li.current-menu-item > a::after { transform: scaleX(1); }
.nav__list > li > a:hover { color: var(--ink); }

/* ---------------- icon buttons ----------------
   hello-elementor's reset.css styles bare <button> with a 1px #c36 border,
   3px radius, pink text and .5rem/1rem padding, and it loads after this file.
   These selectors are scoped to the chrome so they out-specify anything at
   element level, and every inherited property is nulled explicitly. */
.site-head .burger,
.drawer .drawer__close,
.nav .nav__caret {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  background-color: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  line-height: 1;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s var(--ease);
}
.site-head .burger:hover,
.site-head .burger:focus,
.drawer .drawer__close:hover,
.drawer .drawer__close:focus,
.nav .nav__caret:hover,
.nav .nav__caret:focus {
  background: none;
  background-color: transparent;
  color: var(--eucalypt);
}

/* caret button, injected by site-chrome.js next to any parent item */
.nav .nav__caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: .35rem .3rem;
  margin-inline-start: -.5rem;
}
.nav .nav__caret svg { display: block; transition: transform .25s var(--ease); }
.nav__list > li[data-open="true"] .nav__caret svg,
.nav__list > li:hover .nav__caret svg { transform: rotate(180deg); }

/* dropdown as a floating card anchored under the trigger */
.nav__list .sub-menu {
  position: absolute;
  top: calc(100% + .6rem);
  left: 0;
  width: min(25rem, 88vw);
  list-style: none;
  margin: 0;
  padding: .6rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: 0 26px 50px -28px rgba(28, 37, 33, .45);
  z-index: 40;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
/* :focus-within is deliberately absent. It kept the panel visible after Escape,
   because focus stays on the caret button inside the same <li>. Hover covers the
   mouse, data-open covers the keyboard, and the sub-links become focusable only
   once data-open is true. */
.nav__list > li:hover > .sub-menu,
.nav__list > li[data-open="true"] > .sub-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}
.nav__list .sub-menu a {
  display: block;
  padding: .7rem .85rem;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: background .18s var(--ease);
}
.nav__list .sub-menu a:hover,
.nav__list .sub-menu a:focus-visible { background: rgba(231, 225, 214, .55); }
.nav__menu-name {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.nav__menu-desc {
  display: block;
  margin-top: .15rem;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: .9rem;
  line-height: 1.4;
  color: var(--ink-muted);
  white-space: normal;
}

/* ---------------- header actions ---------------- */
.head-actions { display: flex; align-items: center; gap: .75rem; }
.phone-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .5rem .4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.phone-btn .tel { border-bottom: 1.5px solid var(--clay); }
.phone-btn:hover,
.phone-btn:focus-visible { color: var(--eucalypt); }

/* ---------------- buttons ---------------- */
.site-head .btn,
.drawer .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .5rem 1.1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .01em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
/* Variants are scoped the same way as the base so they win on specificity.
   Unscoped, `.drawer .btn { border: 1px solid transparent }` beat
   `.btn--ghost { border-color: ... }` and the ghost outline vanished. */
.site-head .btn--clay,
.drawer .btn--clay { background: var(--clay-deep); color: var(--paper-warm); }
.site-head .btn--clay:hover,
.site-head .btn--clay:focus-visible,
.drawer .btn--clay:hover,
.drawer .btn--clay:focus-visible { background: var(--clay-darkest); color: var(--paper-warm); }
.site-head .btn--ghost,
.drawer .btn--ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.site-head .btn--ghost:hover,
.site-head .btn--ghost:focus-visible,
.drawer .btn--ghost:hover,
.drawer .btn--ghost:focus-visible { border-color: var(--ink); }

/* ---------------- burger and mobile-only phone ---------------- */
.site-head .burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

/* ---------------- focus ---------------- */
.site-head :focus-visible,
.drawer :focus-visible {
  outline: 2px solid var(--clay-deep);
  outline-offset: 3px;
  border-radius: 2px;
}
.phone-icon { display: none; }

/* ---------------- drawer ---------------- */
.drawer { position: relative; z-index: 70; }
.drawer[hidden] { display: none; }
.drawer__scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(28, 37, 33, .42);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.drawer__panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 71;
  display: flex;
  flex-direction: column;
  width: min(88vw, 22rem);
  height: 100%;
  padding: 1.25rem var(--gutter) 2rem;
  background: var(--paper);
  border-left: 1px solid var(--hairline);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s var(--ease);
}
.drawer[data-open="true"] .drawer__scrim { opacity: 1; }
.drawer[data-open="true"] .drawer__panel { transform: translateX(0); }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.drawer__head .brand { margin-right: 0; }
.drawer .drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.drawer__list,
.drawer__list .sub-menu { list-style: none; margin: 0; padding: 0; }
.drawer__list > li > a {
  display: block;
  padding: .7rem 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}
.drawer__list > li > a:hover,
.drawer__list > li > a:focus-visible { color: var(--clay-deep); }
.drawer__list .sub-menu {
  display: flex;
  flex-direction: column;
  padding: .4rem 0 .9rem;
  border-bottom: 1px solid var(--hairline);
}
.drawer__list .sub-menu a {
  display: block;
  padding: .55rem 0 .55rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink-muted);
  text-decoration: none;
}
.drawer__list .sub-menu a:hover,
.drawer__list .sub-menu a:focus-visible { color: var(--clay-deep); }
/* the parent item keeps its own hairline off when it has children below it */
.drawer__list > li.menu-item-has-children > a { border-bottom: 0; }
.drawer__list .nav__menu-desc { display: none; }

.drawer__actions {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.drawer__actions .btn { width: 100%; }

/* ---------------- breakpoint: phone icon left, brand centred, burger right ---
   940px in the original design, raised to 1199px here.

   The design's own 940px was already too low: the desktop nav needs about 975px
   including gutters, so the original overflows its own header between 941 and
   1000px. This started at 1023px, but the live menu labels are longer than the
   design's ("Weight Loss Surgery" rather than "Weight Loss"), which widens the
   nav enough to crowd the bar well above that. 1199px keeps the desktop nav to
   widths where it comfortably fits.

   This deliberately no longer matches Elementor's 1024px tablet breakpoint. The
   header is child-theme CSS, not an Elementor variant, and where the nav has to
   collapse is a function of how wide the nav is, not of the page grid. The wrap
   gutter band near the top of this file is the part that must stay at 1024 to
   track the Elementor wrap class, so leave that one alone. --- */
@media (max-width: 1199px) {
  .nav,
  .head-actions { display: none; }
  .site-head .burger { display: inline-flex; justify-self: end; }
  .site-head__bar {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: .5rem;
  }
  .site-head__bar .brand { margin-right: 0; text-align: center; }
  .phone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--eucalypt);
  }
}

@media (min-width: 1200px) {
  .drawer { display: none; }
}

/* ---------------- resources filter -------------------------------------------
   Two states for the filter on the Resources page, driven by
   assets/js/resource-filter.js. Here rather than inline in PHP so the whole
   chrome stylesheet stays the one cacheable file, and scoped tightly enough to
   be inert on every other page.

   The live region uses the parent theme's .screen-reader-text rather than a
   class of ours, so there is one visually-hidden implementation on the site. --- */
#resource-results.is-loading {
  opacity: .45;
  transition: opacity .15s ease;
}

@media (prefers-reduced-motion: reduce) {
  #resource-results.is-loading { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-head::before,
  .nav__list .sub-menu,
  .nav__caret svg,
  .drawer__scrim,
  .drawer__panel { transition-duration: .01ms; }
  .drawer__panel { transform: none; }
  .nav__list .sub-menu { transform: none; }
}
