/*
 * Site header (template-parts/site-header.php), as in the Header wireframe.
 *
 * The header runs the full width of the window, with a 48px gutter each side (24px on tablets, 16px on phones).
 *
 * Desktop: the logo on the left; on the right, the contact row above the main navigation and the booking button.
 * A menu item with sub-items (Services) opens them as a full-width bar under the header.
 *
 * Phones and narrow tablets (980px and under): the navigation tucks behind the menu button once the script runs
 * (.has-js), and each item's sub-items are listed under it inside the menu. Without the script, the navigation
 * and its sub-items show in full.
 */

/* The header band, kept at the top of the page while scrolling */

.site-header {
  --site-header-gutter: 48px;

  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 16px var(--site-header-gutter);
}

/* Logo, or the site name when there's no logo */

.site-header__brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

.custom-logo-link {
  display: inline-flex;
  align-items: center;
}

.custom-logo {
  display: block;
  width: auto;
  height: 72px;
}

.site-header__site-name {
  color: var(--teal-darker);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}

/* The right-hand column: contact row above, navigation row below */

.site-header__main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Contact row: phone and email with teal icons, a fine divider, then round social buttons */

.site-header__contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 22px;
  font-size: 14px;
}

.site-header__contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-darker);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.site-header__contact-link:hover,
.site-header__contact-link:focus-visible {
  text-decoration: underline;
}

.site-header__divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.site-header__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.site-header__social-link:hover,
.site-header__social-link:focus-visible {
  border-color: var(--teal);
  background: var(--teal-pale);
}

/* The icons ship dark; this filter turns them the theme's deep teal */

.site-header__contact-icon,
.site-header__social-icon {
  display: block;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(27%) sepia(18%) saturate(1784%) hue-rotate(126deg) brightness(92%) contrast(90%);
}

.site-header__contact-icon {
  width: 16px;
  height: 16px;
}

.site-header__social-icon {
  width: 18px;
  height: 18px;
}

/* Navigation row: the main links, then the booking button */

.site-header__nav-row {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  font-weight: 500;
}

.site-nav__link {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  border-bottom-color: var(--teal);
  color: var(--teal-darker);
}

/* An item with sub-items: its link and the arrow button side by side */

.site-nav__split {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.site-nav__bar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--teal-light);
  color: var(--teal-darker);
  cursor: pointer;
}

.site-nav__bar-toggle svg {
  transition: transform 0.2s ease;
}

.site-nav__bar-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.site-nav__item.is-current .site-nav__link,
.site-nav__item--has-bar.is-open .site-nav__link {
  border-bottom-color: var(--teal);
  color: var(--teal-darker);
}

/* The sub-items: a bar of links, with the plans set apart from the other links, such as "Bespoke", by a fine rule */

.site-nav__bar {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__bar a {
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.site-nav__bar a:hover,
.site-nav__bar a:focus-visible {
  color: var(--teal-darker);
  text-decoration: underline;
}

.site-nav__bar-item--extra a {
  color: var(--teal-darker);
}

/* The plan page the visitor is on */

.site-nav__bar a[aria-current="page"] {
  color: var(--teal-darker);
  font-weight: 600;
}

/* Booking button */

.site-header__contact-button {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--teal-darker);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.site-header__contact-button:hover,
.site-header__contact-button:focus-visible {
  background: var(--teal-dark);
  color: var(--white);
}

/* Phone menu button: three lines, shown only on narrow screens once the script runs */

.site-header__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--teal-darker);
  cursor: pointer;
}

.site-header__menu-icon,
.site-header__menu-icon::before,
.site-header__menu-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.site-header__menu-icon {
  position: relative;
}

.site-header__menu-icon::before {
  position: absolute;
  top: -7px;
  left: 0;
}

.site-header__menu-icon::after {
  position: absolute;
  top: 7px;
  left: 0;
}

/* Desktop: the sub-items as a full-width bar under the header, shown while open */

@media (min-width: 981px) {
  .site-nav__bar {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 0 var(--site-header-gutter);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--teal-pale);
    font-size: 15px;
    font-weight: 500;
  }

  .site-nav__item--has-bar.is-open .site-nav__bar {
    display: flex;
  }

  .site-nav__bar a {
    padding: 16px 22px;
  }

  .site-nav__bar-item:first-child a {
    padding-left: 0;
  }

  .site-nav__bar-item:last-child a {
    padding-right: 0;
  }

  /* A fine rule where the plans meet another link, drawn at the start of the later one */

  .site-nav__bar-item--new-group a::before {
    width: 1px;
    height: 18px;
    margin-right: 36px;
    background: var(--border);
    content: "";
  }
}

/* Phones and narrow tablets: the navigation drops under the header, behind the menu button */

@media (max-width: 980px) {
  .site-header {
    --site-header-gutter: 24px;
  }

  .site-header__inner {
    flex-wrap: nowrap;
  }

  .custom-logo {
    height: 56px;
  }

  .site-header__nav-row {
    gap: 12px;
  }

  .site-header.has-js .site-header__menu-toggle {
    display: inline-flex;
    order: 2;
  }

  .site-header.has-js .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    max-height: calc(100vh - 100%);
    overflow-y: auto;
    padding: 8px var(--site-header-gutter) 20px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    box-shadow: 0 18px 32px rgba(21, 89, 82, 0.12);
  }

  .site-header.is-menu-open .site-nav {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-nav__item {
    border-bottom: 1px solid var(--border);
  }

  .site-nav__link {
    padding: 14px 0;
    border-bottom: 0;
  }

  .site-nav__split {
    display: flex;
    justify-content: space-between;
  }

  .site-nav__bar-toggle {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
  }

  /* The sub-items listed under their item; once the script runs, only while the arrow has them open */

  .site-nav__bar {
    padding: 0 0 12px 16px;
  }

  .site-header.has-js .site-nav__item--has-bar:not(.is-open) .site-nav__bar {
    display: none;
  }

  .site-nav__bar a {
    padding: 10px 0;
  }
}

/* Phones: the contact row keeps its icons and the booking button gets smaller */

@media (max-width: 700px) {
  .site-header {
    --site-header-gutter: 16px;
  }

  .site-header__inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .custom-logo {
    height: 44px;
  }

  .site-header__main {
    gap: 8px;
  }

  .site-header__contact-row {
    gap: 8px 14px;
  }

  .site-header__contact-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .site-header__contact-icon {
    width: 20px;
    height: 20px;
  }

  .site-header__contact-button {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Very small phones: the booking button is left out; Contact is still in the menu */

@media (max-width: 359px) {
  .site-header__contact-button {
    display: none;
  }
}
