.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: 100px;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 14px max(var(--gutter), (100% - var(--page)) / 2);
  background: color-mix(in srgb, var(--white) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  transition: translate .2s var(--ease-out);
}
.site-header[data-hidden] { translate: 0 calc(-100% - 1px); }
.site-header[data-instant], .site-header:focus-within { transition: none; }
.site-header:focus-within, .site-header:has(.menu-toggle[aria-expanded="true"]) { translate: 0 0; }
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  opacity: 0;
  transition: opacity .2s ease;
}
.site-header[data-scrolled]::after { opacity: 1; }

.logo { display: inline-flex; flex-direction: column; justify-content: center; min-height: 44px; color: var(--cobalt); text-decoration: none; flex-shrink: 0; }
.logo-type { font-family: var(--display); font-size: 25px; line-height: 1; letter-spacing: -.02em; }
.logo-by { margin-top: 5px; font-size: 14px; line-height: 1; font-weight: 600; letter-spacing: .01em; color: var(--ink); }
/* Preserve the logo's space and keyboard route while Home's hero names the club. */
@media (min-width: 1024px) {
  .site-header[data-home-wordmark-visible]:not(:focus-within):not(:has(.menu-toggle[aria-expanded="true"])) .logo { opacity: 0; pointer-events: none; }
}

#main-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.nav-account { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; font-size: 16px; text-decoration: none; }
.nav-account:is(:hover, [aria-current]) { text-decoration: underline; text-underline-offset: 4px; }
.nav-links {
  position: relative;
  isolation: isolate;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pink) 32%, var(--white));
}
.nav-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--cobalt);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link[aria-current] { font-weight: 800; }
.nav-links:not([data-pill-ready]) .nav-link[aria-current] { background: var(--pink); }
.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100px;
  height: 44px;
  border-radius: 999px;
  background: var(--pink);
  transform-origin: top left;
  pointer-events: none;
  opacity: 0;
  transition: translate .2s var(--ease-out), scale .2s var(--ease-out), opacity .15s var(--ease-out);
}
.nav-pill[data-instant] { transition: none; }
.nav-join { position: relative; display: grid; justify-items: center; }
.nav-join-status { position: absolute; top: 100%; margin: 2px 0 0; color: var(--cocoa); font-size: 14px; line-height: 1.3; white-space: nowrap; }
.nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: scale .1s var(--ease-out), background-color .15s ease;
}
a.nav-cta:active:not(:focus-visible) { scale: .97; transition-duration: .16s; }
@media (hover: hover) and (pointer: fine) { a.nav-cta:hover { background: var(--cobalt); } }
.nav-more { display: none; }

.menu-toggle {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pink) 45%, var(--white));
  color: var(--cobalt);
  font-size: 14px;
  font-weight: 700;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .site-header { gap: 12px; }
  .logo-type { font-size: 22px; }
  .nav-link { padding: 0 11px; font-size: 14px; }
  .nav-cta { padding: 0 15px; font-size: 14px; }
  #main-nav { gap: 8px; }
}

/* Phones: the menu is closed before the first paint, so opening it never moves the page. */
@media (max-width: 1023px) {
  .site-header { min-height: 72px; padding-block: 10px; gap: 12px; }
  .logo-type { font-size: 20px; }
  .header-actions { margin-left: auto; }
  /* The same state note sits inside the existing 52px pill; no extra header row. */
  .nav-join { grid-template-rows: 52px; }
  .nav-cta { grid-area: 1 / 1; line-height: 1.2; }
  .nav-join:has(.nav-join-status:not([hidden])) .nav-cta { align-items: start; padding-block: 7px 27px; }
  .nav-join-status { position: static; grid-area: 1 / 1; align-self: end; margin: 0 0 6px; color: var(--cream); font-size: 14px; line-height: 1; pointer-events: none; }
  .nav-join:has(.nav-cta[aria-current="page"]) .nav-join-status { color: var(--cocoa); }
  .js .menu-toggle { display: inline-flex; }
  .js #main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 8px var(--gutter) 24px;
    background: var(--white);
    box-shadow: 0 18px 30px -18px color-mix(in srgb, var(--ink) 30%, transparent);
    transform-origin: top right;
    transition: opacity .2s var(--ease-out), scale .2s var(--ease-out), display .2s allow-discrete;
    max-height: calc(100svh - var(--header-height));
    overflow-y: auto;
  }
  /* The open menu is a solid sheet to the bottom of the screen; no page content shows cut off beneath it. */
  .js #main-nav[data-open] { height: calc(100svh - var(--header-height)); }
  .js #main-nav:not([data-open]) { display: none; opacity: 0; scale: .97; transition-duration: .15s; }
  .js #main-nav[data-instant] { transition: none; }
  @starting-style { .js #main-nav[data-open] { opacity: 0; scale: .97; } }
  html:not(.js) .site-header { flex-wrap: wrap; }
  html:not(.js) #main-nav { flex-wrap: wrap; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0; padding: 0; background: none; border-radius: 0; }
  .nav-link { min-height: 52px; padding: 0; font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: -.02em; border-bottom: 1.5px solid var(--line); border-radius: 0; }
  .nav-link[aria-current] { font-weight: 400; text-decoration: none; background: var(--blush); }
  .nav-pill { display: none; }
  .nav-cta { justify-content: center; font-size: 15px; padding-inline: 14px; }
  .nav-account { align-self: start; padding: 0; }
  .nav-more { display: flex; flex-wrap: wrap; gap: 0 24px; }
  .nav-more a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
  .nav-more a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }
}
@media (max-width: 389px) {
  .logo-type { font-size: 18px; max-width: 90px; }
  .logo-by { display: none; }
  .nav-cta { font-size: 14px; padding-inline: 12px; }
  .header-actions { gap: 6px; }
}

@view-transition { navigation: auto; }

.site-header { view-transition-name: club-header; }
main { view-transition-name: club-content; }

::view-transition-group(*) { animation-duration: .2s; }
::view-transition-group(club-header) { animation-duration: 0s; z-index: 2; }
::view-transition-old(club-header) { display: none; }
::view-transition-new(club-header) { animation: none; }
::view-transition-group(club-content) { animation: none; }
::view-transition-old(club-content) { animation: section-out .15s var(--ease-out) both; }
::view-transition-new(club-content) { animation: section-in .2s var(--ease-out) both; }

@keyframes section-out { to { opacity: 0; translate: 0 -.75rem; } }
@keyframes section-in { from { opacity: 0; translate: 0 .75rem; } }

@media (min-width: 1024px) {
  .nav-pill { view-transition-name: club-pill; }
  .nav-link[href="/ideas/"] { view-transition-name: club-ideas; }
  .nav-link[href="/guides/"] { view-transition-name: club-guides; }
  .nav-link[href="/membership/"] { view-transition-name: club-membership; }
  ::view-transition-group(club-pill) {
    animation-duration: .2s;
    animation-timing-function: var(--ease-out);
    z-index: 3;
  }
  ::view-transition-old(club-pill) { display: none; }
  ::view-transition-new(club-pill) { animation: none; }
  ::view-transition-group(club-ideas),
  ::view-transition-group(club-guides),
  ::view-transition-group(club-membership) { animation-duration: 0s; z-index: 4; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header { transition: none !important; }
  .nav-pill { transition: opacity .15s var(--ease-out); }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation-duration: 0s !important; }
}
