.site-header {
  position: relative;
  z-index: 20;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
}

.site-nav {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-nav__brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav__link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.site-nav__link:hover,
.site-menu[open] > .site-nav__link {
  color: var(--primary);
}

.site-nav__toggle {
  display: none;
  width: auto;
  padding: 0.3rem 0.7rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

/* A header menu — a <details> whose summary is the menu's label, with
   its panel dropping down below it (see site_menu_controller.js). */
.site-menu {
  position: relative;
}

/* Undoes the page-wide <summary> spacing, which would sit a menu's
   label lower than the plain links beside it — and, once open, push
   it up (details[open] > summary adds a bottom margin). */
.site-menu > summary,
.site-menu[open] > summary {
  list-style: none;
  margin: 0;
}

.site-menu > summary::-webkit-details-marker {
  display: none;
}

.site-menu > summary.site-nav__link::after {
  content: " ▾";
  font-size: 0.75em;
}

.site-menu__panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  padding: 1rem 1.1rem;
}

.site-menu__panel--right {
  left: auto;
  right: 0;
}

.site-menu__panel a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.site-menu__panel a:hover {
  color: var(--primary);
}

.site-menu__panel h3 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-menu__panel--explore {
  display: grid;
  grid-template-columns: repeat(3, minmax(8.5rem, auto));
  gap: 1.5rem;
}

.site-menu__panel--list {
  min-width: 13rem;
}

.site-menu__name {
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.site-nav__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.site-nav__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-nav__logout {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

/* The site-wide search box, with its live preview dropping down below
   it (see site_search_controller.js). */
.site-search {
  position: relative;
}

.site-search input[type="search"] {
  width: 15rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
}

.site-search__preview {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  width: 24rem;
  max-width: calc(100vw - 2rem);
}

.site-search__panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  padding: 0.9rem 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.site-search__section + .site-search__section {
  margin-top: 0.75rem;
}

.site-search__section h3 {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.site-search__result {
  padding: 0.2rem 0;
}

.site-search__result a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.site-search__result a:hover {
  color: var(--primary);
}

.site-search__result .card-meta {
  margin-left: 0.4rem;
}

.site-search__all {
  display: block;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.site-search__page-section {
  margin-bottom: 1.75rem;
}

/* Narrow screens: the whole row folds behind ☰, each menu's panel
   opening in place rather than floating. */
@media (max-width: 760px) {
  .site-nav {
    flex-wrap: wrap;
  }

  .site-nav__toggle {
    display: block;
  }

  .site-nav__links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-top: 0.5rem;
  }

  .site-nav__links--open {
    display: flex;
  }

  .site-menu__panel,
  .site-search__preview {
    position: static;
    width: auto;
    margin-top: 0.5rem;
    box-shadow: none;
  }

  .site-menu__panel--explore {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .site-search input[type="search"] {
    width: 100%;
  }
}

/* Every page's footer (layouts/_site_footer): the legal pages. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 3rem;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer__links {
  display: flex;
  gap: 1.25rem;
}

.site-footer__links a {
  color: var(--muted);
}

.site-footer__links a:hover {
  color: var(--primary);
}

@media (max-width: 760px) {
  .site-footer {
    padding: 1rem;
  }
}

/* The Terms of Use and Privacy Policy (legal/): long-form reading. */
.legal-page {
  max-width: 46rem;
  line-height: 1.6;
}

.legal-page h2 {
  margin-top: 2rem;
}

.legal-page li + li {
  margin-top: 0.35rem;
}
