/*
 * PPD&G site header — desktop bar, search button and mobile menu.
 * Loaded after theme.css (kept in its own file so header changes are never
 * served from an old minified/cached copy of theme.css).
 */

/* ---------- Shared ------------------------------------------------------ */
.site-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 0;
}
.site-header .nav-chevron {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  transition: transform 0.2s;
}
.site-header details[open] > summary .nav-chevron {
  transform: rotate(180deg);
}

/* Search button: a quiet square that sits to the left of Request a Quote. */
.site-header .header-search {
  position: static;
}
.site-header .header-search > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 1px solid #cfc7b7;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.site-header .header-search > summary::-webkit-details-marker {
  display: none;
}
.site-header .header-search > summary:hover,
.site-header .header-search[open] > summary {
  border-color: var(--gold);
  color: #71613f;
  background: var(--paper);
}
.site-header .header-search .icon-search {
  display: block;
}
.site-header .header-search svg {
  color: var(--gold); /* matches the phone icon */
}
.site-header .header-search .icon-close,
.site-header .header-search[open] .icon-search {
  display: none;
}
.site-header .header-search[open] .icon-close {
  display: block;
}
.site-header .search-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 25;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 15px 20px #0001;
  padding: 34px max(5%, calc((100% - 1040px) / 2)) 38px;
}
.site-header .search-panel .eyebrow {
  margin-bottom: 14px;
}

/* Phone number: icon + number on desktop, a square icon button on mobile. */
.site-header .header-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  min-height: 48px;
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
}
.site-header .header-phone svg {
  color: var(--gold);
  flex: none;
}
.site-header .header-phone:hover .header-phone-number {
  color: #71613f;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Narrower screens: the phone becomes a square call button next to search. */
@media (max-width: 1240px) {
  .site-header .header-phone {
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #cfc7b7;
    background: #fff;
  }
  .site-header .header-phone-number {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .site-header .header-phone:hover {
    border-color: var(--gold);
    background: var(--paper);
  }
}

/* Compact dropdown (e.g. Who We Are → Careers): a small panel under its item. */
@media (min-width: 1081px) {
  .site-header .main-nav .nav-dropdown--compact {
    position: relative;
  }
  .site-header .main-nav .nav-dropdown--compact .mega {
    left: auto;
    right: -24px;
    top: calc(100% + 18px);
    width: 320px;
    display: block;
    padding: 26px 28px 28px;
    border: 1px solid var(--line);
    border-top: 2px solid var(--gold);
  }
  .site-header .main-nav .nav-dropdown--compact .mega > div {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .site-header .main-nav .nav-dropdown--compact .mega .eyebrow {
    margin: 0;
  }
  .site-header .main-nav .nav-dropdown--compact .mega a {
    font-size: 21px;
  }
}

/* Menu button + drawer extras are mobile-only. */
.site-header .menu-toggle,
.site-header .nav-drawer-footer {
  display: none;
}

/* ---------- Mobile / tablet (≤ 1080px) ---------------------------------- */
@media (max-width: 1080px) {
  .site-header,
  .content-page .site-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 5%;
  }
  .site-header .header-actions {
    gap: 8px;
    margin-left: auto;
  }
  .site-header .header-phone,
  .site-header .header-search > summary,
  .site-header .menu-toggle {
    width: 44px;
    height: 44px;
    min-height: 0;
    box-sizing: border-box;
  }
  .site-header .headerquote {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 13px;
    gap: 12px;
  }

  html.js .site-header .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fff;
    cursor: pointer;
  }
  .site-header .menu-toggle-bars {
    position: relative;
    display: block;
    width: 18px;
    height: 12px;
  }
  .site-header .menu-toggle-bars i {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.2s, opacity 0.2s, top 0.2s;
  }
  .site-header .menu-toggle-bars i:nth-child(1) {
    top: 0;
  }
  .site-header .menu-toggle-bars i:nth-child(2) {
    top: 5.25px;
  }
  .site-header .menu-toggle-bars i:nth-child(3) {
    top: 10.5px;
  }
  .site-header.is-menu-open .menu-toggle-bars i:nth-child(1) {
    top: 5.25px;
    transform: rotate(45deg);
  }
  .site-header.is-menu-open .menu-toggle-bars i:nth-child(2) {
    opacity: 0;
  }
  .site-header.is-menu-open .menu-toggle-bars i:nth-child(3) {
    top: 5.25px;
    transform: rotate(-45deg);
  }

  /* The navigation becomes a panel under the header. */
  html.js .site-header > .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 24;
    width: auto;
    order: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    padding: 6px 5% 30px;
    background: var(--paper);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 30px #28211722;
    font-size: 16px;
  }
  html.js .site-header.is-menu-open > .main-nav {
    display: flex;
  }
  html.js .site-header > .main-nav > a,
  html.js .site-header > .main-nav > details > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #ded7c7;
    font: 24px/1.25 Georgia, "Times New Roman", serif;
    letter-spacing: -0.3px;
    color: var(--ink);
    text-decoration: none;
  }
  html.js .site-header > .main-nav > a[aria-current] {
    color: #71613f;
  }
  html.js .site-header > .main-nav .nav-chevron {
    width: 14px;
    height: 14px;
    color: var(--gold);
  }
  html.js .site-header > .main-nav > details {
    position: static;
  }
  html.js .site-header > .main-nav .mega {
    position: static;
    display: block;
    padding: 6px 0 18px;
    background: transparent;
    border: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
  html.js .site-header > .main-nav .mega > div {
    display: block;
  }
  html.js .site-header > .main-nav .mega .eyebrow {
    margin: 10px 0 8px;
  }
  html.js .site-header > .main-nav .mega a {
    display: block;
    padding: 11px 0 11px 16px;
    border-left: 1px solid #c9b98e;
    font: 19px/1.3 Georgia, "Times New Roman", serif;
  }
  html.js .site-header > .main-nav .mega small {
    display: block;
    font: 13px/1.5 Arial, Helvetica, sans-serif;
    color: #686c61;
    margin-top: 2px;
  }
  html.js .site-header > .main-nav .mega aside {
    display: none;
  }
  html.js .site-header > .main-nav .nav-drawer-footer {
    display: block;
    padding-top: 24px;
  }
  html.js .site-header > .main-nav .drawer-quote {
    width: 100%;
    justify-content: space-between;
  }
  html.js .site-header > .main-nav .drawer-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    min-height: 48px;
    border: 1px solid #cfc7b7;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
    text-decoration: none;
  }
  html.js .site-header > .main-nav .drawer-phone svg {
    color: var(--gold);
  }


  .site-header .search-panel {
    padding: 22px 5% 26px;
  }
  /* Lock page scroll while the menu is open. Only <html> is locked: locking
     <body> too turns it into the scroll box and the sticky header jumps
     back to the top of the page (out of view) when the page is scrolled. */
  html.menu-is-open {
    overflow: hidden;
  }
  html.js .site-header > .main-nav {
    overscroll-behavior: contain;
  }
}

/* Small phones: Request a Quote moves into the menu panel. */
@media (max-width: 520px) {
  html.js .site-header .headerquote {
    display: none;
  }
  .site-header .logo:not(.logo-image) {
    font-size: 34px;
  }
}
@media (max-width: 360px) {
  .site-header,
  .content-page .site-header {
    display: flex;
    padding: 14px 4%;
  }
  .site-header .logo small {
    white-space: normal;
    max-width: 130px;
    line-height: 1.6;
  }
}

/* Without JavaScript the navigation simply wraps below the logo. */
html:not(.js) .site-header {
  flex-wrap: wrap;
}

/* ---------- Back to top -------------------------------------------------- */
#ast-scroll-top {
  display: none !important; /* Astra's button needs Astra's CSS/JS; this theme ships its own. */
}
.back-to-top {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 0 0 1px #ffffff40, 0 8px 20px #2821172e;
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease, background .2s ease;
}
.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.back-to-top:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
html.js .back-to-top:not(.is-visible) {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}
html.menu-is-open .back-to-top {
  display: none;
}
@media (max-width: 600px) {
  .back-to-top {
    left: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
}
