/*
  public/CSS/_components/header.css
  The site header (views/_components/header.ejs): a quiet bar that stays at the
  top, with a full-screen menu on phones and an inline navigation on wide screens.
*/

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease);
}

/* The frosted background sits on a separate layer: a backdrop-filter on the
   header itself would trap the full-screen mobile menu inside the header. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--header-background);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* A hairline appears once the page has been scrolled (set by header.js). */
.site-header.is-scrolled {
  border-bottom-color: var(--hairline);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  color: inherit;
}

.logo-mark {
  width: 30px;
  height: 30px;
  transition: transform 1.2s var(--ease);
}

.logo-nucleus {
  fill: var(--accent-line);
}

.brand:hover .logo-mark {
  transform: rotate(60deg);
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

/* ---------- Mobile menu ---------- */

.menu-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  font-size: 1rem;
  font-weight: 600;
}

.menu-button-lines {
  position: relative;
  display: block;
  width: 26px;
  height: 10px;
}

.menu-button-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.35s var(--ease), top 0.35s var(--ease);
}

.menu-button-lines span:first-child {
  top: 0;
}

.menu-button-lines span:last-child {
  top: 9px;
}

.menu-button[aria-expanded="true"] .menu-button-lines span:first-child {
  top: 5px;
  transform: rotate(45deg);
}

.menu-button[aria-expanded="true"] .menu-button-lines span:last-child {
  top: 5px;
  transform: rotate(-45deg);
}

.site-nav {
  position: fixed;
  inset: var(--header-height) 0 0 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px var(--gutter) 40px;
  background: var(--mobile-menu-background);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.menu-button[aria-expanded="true"] + .site-nav {
  visibility: visible;
  opacity: 1;
}

.nav-list {
  display: grid;
}

.nav-link {
  display: block;
  padding-block: 12px;
  font-family: var(--font-heading);
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-link[aria-current="page"] {
  color: var(--accent-text);
}

.nav-cta {
  align-self: flex-start;
}

.nav-cta[aria-current="page"] {
  background: var(--primary-button-hover-background);
}

/* ---------- Wide screens ---------- */

@media (min-width: 1024px) {
  .menu-button {
    display: none;
  }

  .site-nav {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding: 0;
    background: none;
    overflow: visible;
    visibility: visible;
    opacity: 1;
  }

  .nav-list {
    display: flex;
    gap: 32px;
  }

  .nav-link {
    position: relative;
    padding-block: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0;
  }

  /* A short cobalt line under the link on hover, and under the open page. */
  .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-line);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
  }

  .nav-link:hover::after,
  .nav-link[aria-current="page"]::after {
    transform: scaleX(1);
  }

  .nav-link[aria-current="page"] {
    color: var(--link-text);
  }

  .nav-cta {
    min-height: 44px;
    padding: 10px 20px;
  }
}
