/* Navigation, search and personal-space enhancements. */
.nav {
  align-items: center;
  gap: 4px;
}

.nav > a,
.nav-group > summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  list-style: none;
  white-space: nowrap;
}

.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "⌄"; margin-left: 6px; font-size: 11px; }
.nav-group[open] > summary,
.nav-group > summary:hover,
.nav > a:hover,
.nav > a.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
  color: var(--text);
}

.nav-group { position: relative; }
.nav-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  width: 300px;
  padding: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
}

.nav-menu a {
  display: grid;
  gap: 2px;
  min-height: 54px;
  align-content: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  color: var(--text);
}

.nav-menu a:hover { border-color: var(--line); background: var(--surface-2); }
.nav-menu small { color: var(--muted); font-size: 12px; }
.nav-menu-compact { width: 180px; }
.nav-menu-compact a { min-height: 42px; }

.site-search-trigger span { font-size: 22px; line-height: 1; }
.site-search-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
}

.site-search-dialog::backdrop { background: rgba(0, 0, 0, .68); backdrop-filter: blur(7px); }
.site-search-shell { display: grid; gap: 14px; padding: 22px; }
.site-search-shell > header { display: flex; align-items: center; justify-content: space-between; }
.site-search-shell h2 { margin: 2px 0 0; font-size: clamp(24px, 4vw, 38px); }
.site-search-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--surface-2);
}
.site-search-input-wrap input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 18px; }
.site-search-input-wrap kbd { padding: 3px 7px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-search-filters { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.site-search-filters button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); white-space: nowrap; }
.site-search-filters button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.site-search-status { min-height: 20px; color: var(--muted); font-size: 13px; }
.site-search-results { display: grid; max-height: min(480px, 55vh); overflow-y: auto; border-top: 1px solid var(--line); }
.site-search-result { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 13px; align-items: center; min-height: 70px; padding: 10px 8px; border-bottom: 1px solid var(--line); color: var(--text); }
.site-search-result:hover { background: var(--surface-2); }
.search-result-type { color: var(--accent); font-size: 12px; }
.search-result-copy { display: grid; min-width: 0; gap: 4px; }
.search-result-copy strong, .search-result-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-copy small { color: var(--muted); }
.search-result-arrow { color: var(--muted); }

.post-card { position: relative; }
.card-favorite {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 18px;
}
.post-card > .card-favorite { position: absolute; top: 14px; right: 14px; }
.card-favorite.is-favorite { border-color: #f0bc3f; color: #f0bc3f; }
.article-favorite { position: static; display: inline-flex; width: auto; height: auto; padding: 0 14px; font-size: inherit; }
.prompt-favorite { margin-left: auto; }

.profile-summary { display: flex; margin-bottom: 22px; padding: 18px 0; border-block: 1px solid var(--line); }
.profile-account-copy { display: grid; gap: 5px; }
.profile-account-copy strong { font-size: 20px; }
.profile-account-copy span { color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.profile-panel { min-width: 0; border-top: 2px solid var(--accent); }
.profile-panel > header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.profile-panel h3 { margin: 2px 0 0; }
.profile-panel header > span { color: var(--accent); font-size: 24px; font-weight: 700; }
.profile-panel header button, .profile-account-action { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.profile-list { display: grid; max-height: 520px; overflow-y: auto; }
.profile-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.profile-row > a { display: grid; min-width: 0; gap: 5px; padding: 15px 2px; color: var(--text); }
.profile-row strong, .profile-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row span { color: var(--muted); font-size: 13px; }
.profile-remove { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 20px; }
.profile-published-copy { display: grid; min-width: 0; gap: 5px; padding: 15px 2px; }
.profile-published-copy strong, .profile-published-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-post-delete { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.profile-empty { margin: 0; padding: 24px 2px; color: var(--muted); }
.profile-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 34px; }
.profile-shortcuts a { display: grid; min-height: 112px; align-content: space-between; padding: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.profile-shortcuts a:nth-child(2n) { border-top-color: #43c6df; }
.profile-shortcuts a:nth-child(3n) { border-top-color: #f0bc3f; }
.profile-shortcuts a:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(0, 0, 0, .16); }
.profile-shortcuts span { color: var(--muted); font-size: 13px; }

.community-moderation { margin: 24px 0; padding: 16px; border: 1px solid #f0bc3f; background: var(--surface); }
.community-moderation > article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.community-moderation article p { margin: 5px 0 0; color: var(--muted); }
.community-moderation article > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; }
.community-moderation button, .community-report { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); background: transparent; color: var(--text); }

@media (max-width: 980px) {
  .nav-group { grid-column: 1 / -1; width: 100%; }
  .nav-group > summary { width: 100%; justify-content: space-between; }
  .nav-menu { position: static; width: 100%; margin: 4px 0 8px; box-shadow: none; backdrop-filter: none; }
  .nav > a { width: 100%; }
  .profile-grid, .profile-shortcuts { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .site-search-shell { padding: 15px; }
  .site-search-result { grid-template-columns: 52px minmax(0, 1fr); }
  .search-result-arrow { display: none; }
  .profile-grid, .profile-shortcuts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-shortcuts a { transition: none; }
  .profile-shortcuts a:hover { transform: none; }
}
