/* ============================================================
   navigation.css -- Site nav, minigames dropdown, ticker, theme toggle, auth widget/notifications/follow-list modal.
   Part of the split from the original single style.css.
   ============================================================ */

/* ---------- SITE NAV ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(245, 239, 220, 0.86);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

/* Above the mobile breakpoint: a true 3-column layout where the outer
   columns are forced to stay equal width (minmax(0, 1fr) each) no matter
   what's inside them. That's what actually centers the nav links -- and,
   just as importantly, it means the utility cluster on the right (built
   client-side, piece by piece, as the theme toggle/search/lang
   switcher/auth state each load in) can never shove the links sideways
   anymore, since the two outer tracks don't grow to fit their content.
   Below the breakpoint this is skipped entirely -- the existing
   hamburger + dropdown behavior is untouched. */
@media (min-width: 701px) {
  .site-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .nav-logo { grid-column: 1; justify-self: start; }
  .nav-links { grid-column: 2; justify-self: center; }
  .nav-utility { grid-column: 3; justify-self: end; min-width: 0; }
}

html.theme-dark .site-nav {
  background: rgba(26, 22, 15, 0.82);
}

.nav-utility {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-height: 2.2rem;
}

.nav-utility > * {
  animation: fadeInUp 0.25s ease both;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav-logo:hover { color: var(--stain-brown); }

.nav-toggle {
  color: var(--ink);
  display: none;
  font-family: var(--font-term);
  font-size: 1.5rem;
  line-height: 1;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-family: var(--font-term);
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover { border-bottom-color: var(--stain-brown); }
.nav-links a.active { border-bottom-color: var(--stain-brown); color: var(--stain-brown); }
.nav-links a:focus-visible { outline: 3px solid var(--cursed-green); outline-offset: 2px; }

/* ---------- NAV DROPDOWN (Minigames) ---------- */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-dropdown-caret {
  font-size: 0.65em;
  transition: transform 0.18s ease;
}

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  /* No margin-top here on purpose -- a gap between the trigger and this
     menu means the mouse crosses dead space that belongs to neither
     element on the way down, breaking :hover before it ever reaches the
     menu. padding-top gives the same visual breathing room without
     creating that gap, since it's still inside this element's own
     hoverable box. */
  padding: 0.9rem 0.4rem 0.4rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 11rem;
  z-index: 60;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown:focus-within .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--fluoro-white);
  color: var(--stain-brown);
  border-bottom: none;
}

@media (max-width: 700px) {
  /* No hover on touch -- the sublist just sits open, indented, inline
     with the rest of the mobile menu instead of behaving as a popover. */
  .nav-dropdown {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .nav-dropdown-menu {
    display: flex;
    position: static;
    transform: none;
    margin: 0.5rem 0 0 1rem;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: 0;
  }
  .nav-dropdown-caret { display: none; }
}

.nav-cart {
  font-family: var(--font-term);
  font-size: 1.1rem;
  background: var(--fluoro-white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.6rem;
}

@media (max-width: 700px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
    padding: 1rem 1.5rem;
    gap: 0.85rem;
  }
  .nav-links.open { display: flex; }
}

/* ---------- TICKER ---------- */
.ticker-wrap {
  background: var(--bg-black);
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 2px solid var(--ink);
}

.ticker-track {
  display: inline-flex;
  gap: 2.5rem;
  padding: 0.5rem 0;
  font-family: var(--font-term);
  font-size: 1.15rem;
  color: var(--cursed-green);
  animation: tickerScroll 42s linear infinite;
  will-change: transform;
}

.ticker-track span { white-space: nowrap; }

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; overflow-x: auto; }
}

/* ---------- THEME CONTROLS ---------- */
.theme-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-btn {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.theme-btn:hover { background: var(--fluoro-white); }

.nickname-btn {
  color: var(--ink);
  font-family: var(--font-term);
  font-size: 0.95rem;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nickname-btn:hover { background: var(--fluoro-white); }
.nickname-btn:focus-visible { outline: 3px solid var(--cursed-green); outline-offset: 2px; }

.nav-search {
  display: flex;
}

.nav-search input {
  font-family: var(--font-term);
  font-size: 0.95rem;
  padding: 0.25rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--fluoro-white);
  color: var(--ink);
  width: 9rem;
}

.nav-search input:focus-visible {
  outline: 3px solid var(--cursed-green);
  outline-offset: 1px;
}
.theme-btn:focus-visible { outline: 3px solid var(--cursed-green); outline-offset: 2px; }

.lang-switcher {
  display: flex;
  gap: 0.3rem;
}

.lang-btn {
  color: var(--ink);
  font-family: var(--font-term);
  font-size: 0.9rem;
  font-weight: bold;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}

.lang-btn:hover { background: var(--fluoro-white); }
.lang-btn:focus-visible { outline: 3px solid var(--cursed-green); outline-offset: 2px; }
.lang-btn.active {
  background: var(--ink);
  color: var(--fluoro-white);
}

/* ---------- AUTH WIDGET (nav) ---------- */
.auth-widget {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-term);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--fluoro-white);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* flair: seniority rank + best achievement, shown next to a username wherever
   it appears (nav, forum posts/replies, wiki bylines, follow lists). Routine
   UI, so stain-brown/ink only — no glitch-pink/cursed-green here. */
.flair-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-term);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
  border: 1.5px solid var(--ink);
}

.flair-seniority {
  background: var(--paper);
  color: var(--stain-brown);
}

.flair-achievement {
  background: var(--stain-brown);
  color: var(--fluoro-white);
  border-color: var(--stain-brown);
}

.flair-achievement i {
  font-size: 0.65rem;
}

.messages-link {
  position: relative;
  padding: 0.3rem 0.55rem;
}

.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  cursor: pointer;
  font-family: inherit;
}

.notif-dropdown {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: 20rem;
  max-width: 85vw;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 6px 6px 0 rgba(var(--shadow-rgb), 0.35);
  z-index: 50;
}

.notif-dropdown[hidden] {
  display: none;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-term);
  font-weight: bold;
  padding: 0.6rem 0.85rem;
  border-bottom: 2px solid var(--border-soft);
}

.notif-mark-all {
  font-family: var(--font-term);
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--stain-brown);
  cursor: pointer;
  text-decoration: underline;
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: var(--ink);
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(var(--tint-rgb), 0.04); }
.notif-item.unread { background: rgba(239, 45, 118, 0.08); }

.notif-message {
  font-size: 0.92rem;
  line-height: 1.35;
}

.notif-time {
  font-family: var(--font-term);
  font-size: 0.8rem;
  opacity: 0.65;
}

.follow-counts {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-term);
  margin: 0.3rem 0 0;
}

.follow-count-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  text-decoration: underline;
  padding: 0;
}

.follow-list-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: var(--ink);
}

.follow-list-row:last-child { border-bottom: none; }

.wiki-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.community-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-term);
  font-weight: 500;
  font-size: 0.85rem;
  background: var(--fluoro-white);
  border: 1.5px solid var(--border-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.4rem;
}

