.ec-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--ec-primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.85);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  will-change: transform, background, box-shadow;
}

/* Keep the fixed header below Drupal's admin toolbar when logged in. */
body.toolbar-fixed .ec-header {
  top: 39px;
}

body.toolbar-fixed.toolbar-horizontal.toolbar-tray-open .ec-header {
  top: 79px;
}

@media (max-width: 975px) {
  body.toolbar-fixed.toolbar-horizontal.toolbar-tray-open .ec-header {
    top: 118px;
  }
}

header[role=banner] {
  height: 150px;
}

.ec-header.scrolled {
  padding: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.ec-header__container {
  width: min(100% - 32px, var(--ec-container));
  margin: 0 auto;
}

.ec-brand-logo {
  display: block;
  max-width: 240px;
  width: 100%;
  height: auto;
}

.ec-header.scrolled .ec-brand-logo {
  width: 50%;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left center;
}

/** FULL SIZE AND MOBILE MENU STUFF **/
.ec-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand toggle"
    "panel panel";
  align-items: center;
  column-gap: 1rem;
  width: 100%;
  min-width: 0;
  padding: 14px 0;
  transition: padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ec-header__inner > * {
  min-width: 0;
}

.ec-header__branding {
  grid-area: brand;
}

.ec-header__brand {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.ec-header__inner .ec-header__buttonWrapper {
  grid-area: toggle;
  justify-self: end;
  text-align: right;
}

.ec-header__inner .ec-header__menuBlock {
  grid-area: panel;
}
/** END FULL SIZE AND MOBILE MENU STUFF **/

.ec-header__menuBlock {
  display: block;
  min-width: 0;
  width: 100%;
}

.ec-header.scrolled .ec-header__inner {
  padding: 8px 0;
}

[data-theme="dark"] .ec-header {
  background: rgba(15, 23, 42, 0.72);
  border-bottom-color: rgba(229, 231, 235, 0.12);
}

.ec-header__menuPanel {
  display: none;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.ec-header__nav {
  display: flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--ec-font-heading);
  font-weight: 500;
  position: relative;
}

.ec-header__navLink {
  text-wrap: nowrap;
  display: block;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  color: #1e40af;
  cursor: pointer;
  padding: 0.85rem 0.65rem;
  border-radius: 8px;
  transition: color 0.3s ease, background-color 0.3s ease;
}
.ec-header__navLink:hover {
  color: #fff;
}
.ec-header__nav .animation {
  position: absolute;
  height: 100%;
  top: 0;
  z-index: -1;
  transition: all 0.5s ease 0s;
  border-radius: 8px;
}

.ec-header__nav .start-none {
  width: 0;
  left: 0;
}

/* Hover menu hard coded positions and colors */
.ec-header__navItem:nth-child(1):hover ~ .animation {
  width: 105px;
  left: 0;
  background-color: var(--ec-accent-pink-dark);
}

.ec-header__navItem:nth-child(2):hover ~ .animation {
  width: 145px;
  left: 105px;
  background-color: var(--ec-accent-blue);
}

.ec-header__navItem:nth-child(3):hover ~ .animation {
  width: 75px;
  left: 250px;
  background-color: var(--ec-accent-voilet);
}

.ec-header__navItem:nth-child(4):hover ~ .animation {
  width: 85px;
  left: 325px;
  background-color: var(--ec-accent-orange);
}

.ec-header__navItem:nth-child(5):hover ~ .animation {
  width: 115px;
  left: 380px;
  background-color: var(--ec-accent-purple);
}

.ec-header__subnav {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0 0 0 1rem;
}

.ec-header__buttons {
  display: grid;
  gap: 10px;
}

.ec-header__buttons .ec-button {
  margin-left: 0;
  line-height: 1.75rem;
}

.ec-header__burger {
  display: inline-flex;
  border: 1px solid var(--ec-border);
  background: var(--ec-surface);
  border-radius: var(--ec-radius-md);
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Mobile */
@media (max-width: 1023px) {
  .ec-header__menuPanel.is-open {
    display: grid;
  }

  .ec-header__nav {
    display: grid;
    gap: 10px;
  }

  .ec-header__navLink {
    text-align: left;
    border: 1px solid var(--ec-border);
    background: var(--ec-surface);
  }

  .ec-header__navItem:nth-child(1) a:hover {
    background-color: var(--ec-accent-pink-dark);
  }
  .ec-header__navItem:nth-child(2) a:hover {
    background-color: var(--ec-accent-blue);
  }
  .ec-header__navItem:nth-child(3) a:hover {
    background-color: var(--ec-accent-voilet);
  }
  .ec-header__navItem:nth-child(4) a:hover {
    background-color: var(--ec-accent-orange);
  }
  .ec-header__navItem:nth-child(5) a:hover {
    background-color: var(--ec-accent-purple);
  }

  .ec-header__nav .animation {
    display: none;
  }

  .ec-header__buttons {
    display: grid;
    gap: 10px;
  }
}

@media (min-width: 1024px) {
  .ec-header__inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "brand panel";
    row-gap: 0;
  }

  .ec-header__inner .ec-header__buttonWrapper {
    display: none;
  }

  .ec-header__menuBlock {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .ec-header__menuPanel {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
  }

  .ec-header__nav {
    display: flex;
  }

  .ec-header__buttons {
    display: flex;
    align-items: center;
  }

  .ec-header__buttons .ec-button {
    margin-left: 1rem;
  }

  .ec-header__burger {
    display: none;
  }
}
