/* Site header and primary nav. Mobile-first. */

.site-header {
  border-bottom: var(--border-width) solid var(--border-color);
}

.site-header__inner {
  width: 100%;
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding: var(--gap-medium) var(--content-padding);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-small) var(--gap-large);
}

/* Brand + theme switcher, grouped at the left of the bar. */
.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-medium);
}

.site-brand {
  font-size: var(--font-size-lg);
  font-weight: bold;
  text-decoration: none;
  color: var(--theme-fg-color);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--gap-small) var(--gap-medium);
}

.site-nav a {
  text-decoration: none;
  color: var(--theme-accent-color);
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Theme switcher: an icon-only button beside the brand. Cycles
   system → light → dark; the glyph reflects the current choice. */
.theme-toggle {
  font: inherit;
  font-size: var(--font-size-lg);
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border: none;
  background: none;
  color: var(--theme-accent-color);
  display: inline-flex;
  align-items: center;
}

.theme-toggle:hover {
  opacity: 0.7;
}

/* Account dropdown: a native <details> menu so personal links don't crowd the
   bar. The username is the trigger; items drop into a bordered panel. */
.nav-menu {
  position: relative;
}

.nav-menu > summary {
  cursor: pointer;
  list-style: none;
  /* Match the nav links exactly (guards against summary UA-font quirks). */
  font: inherit;
  color: var(--theme-accent-color);
}

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

/* The shared Phosphor caret (mask + currentColor) instead of a Unicode ▾, so the
   disclosure glyph matches the select and the filter triggers. Rotates on open. */
.nav-menu > summary::after {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.5ch;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: var(--caret-mask) center / contain no-repeat;
  mask: var(--caret-mask) center / contain no-repeat;
  transition: transform 0.15s ease;
}

.nav-menu[open] > summary::after {
  transform: rotate(180deg);
}

.nav-menu__items {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 100;
  margin-top: var(--gap-small);
  display: flex;
  flex-direction: column;
  gap: var(--gap-small);
  padding: var(--gap-medium);
  border: var(--border-width) solid var(--border-color);
  background-color: var(--theme-bg-color);
  white-space: nowrap;
}

/* Each menu row is icon + label. A fixed-width icon column keeps the labels
   left-aligned regardless of glyph width. Icons inherit the link's accent
   colour (the heart is the one deliberate exception — see below). */
.nav-menu__item {
  display: flex;
  align-items: center;
  gap: 0.6ch;
}

.nav-menu__item .ph,
.nav-menu__item .fav-star {
  flex-shrink: 0;
  width: 1em;
  text-align: center;
}

/* The favorites row reuses the app's masked heart, but here it's just a menu
   glyph: it inherits the link's colour like the Phosphor icons beside it
   (rather than the raspberry follow-state colour) and stays an outline to
   match their weight. Reset the trailing margin it carries as an event-tag. */
.nav-menu__item .fav-star {
  margin-left: 0;
}

.nav-menu__item .fav-star::before {
  background-color: currentColor;
}

/* Cookie courtesy notice — fixed to the bottom, non-blocking, shown once on
   first visit. Sits below the mobile filter sheets (z 1000) so a sheet covers
   it. Dismissal lives in localStorage, so it adds no cookie of its own. */
.cookie-notice {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--gap-small) var(--gap-large);
  padding: var(--gap-medium) var(--content-padding);
  background: var(--theme-bg-color);
  border-top: var(--border-width) solid var(--border-color);
  color: var(--theme-fg-color);
  font-size: var(--font-size-small);
}

.cookie-notice__text {
  margin: 0;
  max-width: 64ch;
}

/* The count pill: a small accent-filled number attached to something else —
   unread notifications in the menu, the applied-filter count on a mobile filter
   trigger. One definition for both (was duplicated as .filter-trigger__badge).
   min-width + centring keep a single- and double-digit count the same shape;
   flex-shrink:0 stops it collapsing inside the flex filter-trigger row. */
.badge {
  display: inline-block;
  flex-shrink: 0;
  min-width: 1.5em;
  padding: 0 0.4em;
  background-color: var(--theme-accent-color);
  color: var(--theme-on-accent);
  font-size: var(--font-size-small);
  font-weight: bold;
  line-height: 1.5;
  text-align: center;
}

/* Unread-notifications dot on the account-menu trigger. */
.unread-dot {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background-color: var(--theme-accent-color);
  vertical-align: middle;
}
