/* Aukuro – top bar menu on every page (markup: tools/gen_nav.py, behaviour: assets/js/nav.js). Builds on site.css
   (.topbar, .brand, .guide-cta, .online-pill, .mc-btn, tokens). Desktop > 900px: one row, grouped dropdowns.
   ≤ 900px: ☰ → full-height panel sliding in from the right with collapsible groups. */

/* Seasonal decoration hook: an empty strip along the very top edge of the bar (lights, garlands …). Never catches
   clicks and never changes the bar's height – decorate .topbar-deco (background, ::before/::after or children). */
.topbar-deco { position: absolute; left: 0; right: 0; top: 0; height: 0; overflow: visible; pointer-events: none; z-index: 1; }

.mainnav { margin-left: auto; }
.mn-head, .mn-foot { display: none; }
.mn-list { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.mn-item { position: relative; }
.mn-top { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; color: #e8e8e8; text-decoration: none; background: none;
  border: 0; cursor: pointer; font: 600 17px var(--font-head); line-height: 1.1; text-shadow: 2px 2px 0 #000; white-space: nowrap; }
.mn-top:hover, .mn-group.open > .mn-top { color: #ffff55; }
.mn-item.is-current > .mn-top, .mn-top[aria-current="page"] { color: #ffff55; box-shadow: inset 0 -3px 0 #ffff55; }
/* pixel caret: two stacked bars (no font glyph) */
.mn-caret { display: inline-block; width: 8px; height: 6px; flex: none; margin-top: 2px;
  background: linear-gradient(currentColor, currentColor) 0 0 / 8px 2px no-repeat, linear-gradient(currentColor, currentColor) 2px 2px / 4px 2px no-repeat,
  linear-gradient(currentColor, currentColor) 3px 4px / 2px 2px no-repeat; filter: drop-shadow(1px 1px 0 #000); transition: transform .12s; }
.mn-group.open > .mn-top .mn-caret { transform: rotate(180deg); }

/* desktop dropdown */
.mn-sub { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; display: none; min-width: 270px; margin: 0; padding: 6px; list-style: none;
  background: rgba(14, 14, 22, .97); border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255,255,255,.10), inset -2px -2px 0 rgba(0,0,0,.55), 0 10px 24px rgba(0,0,0,.45); }
.mn-sub::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }  /* hover bridge over the gap */
.mn-group.open > .mn-sub { display: block; }
.mn-group:last-of-type .mn-sub, .mn-group:nth-last-child(2) .mn-sub { left: auto; right: 0; }
.mn-sub a { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; color: #e8e8e8; text-decoration: none; border: 2px solid transparent; }
.mn-sub a:hover, .mn-sub a:focus-visible { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); outline: none; }
.mn-sub a:hover .mn-l, .mn-sub a:focus-visible .mn-l { color: #ffff55; }
.mn-sub a[aria-current="page"] { background: rgba(255,255,85,.10); border-color: rgba(255,255,85,.35); }
.mn-sub a[aria-current="page"] .mn-l { color: #ffff55; }
.mn-sub a[aria-current="page"] .mn-l::after { content: " ●"; font-size: 12px; vertical-align: 2px; }
.mn-l { display: inline-flex; align-items: center; gap: 8px; font: 600 18px var(--font-head); text-shadow: 2px 2px 0 #000; }
.mn-l .dc-ico { color: #8f97ff; }
.mn-d { font: 400 14px/1.3 var(--font-body); color: var(--muted); }

/* right side of the bar */
.topbar > .nav-dc { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; color: #fff;
  background: #5865F2; border: 2px solid #000; box-shadow: inset 2px 2px 0 #8f97ff, inset -2px -3px 0 #3a43a8; }
.topbar > .nav-dc:hover, .topbar > .nav-dc:focus-visible { background: #6d79f5; }
.topbar > .nav-dc .dc-ico { width: 20px; height: 20px; }
.topbar > .svc-user { flex: none; margin: 0; padding: 6px 12px; font-size: 15px; text-decoration: none; white-space: nowrap;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
[data-svc-user].in::before { content: "● "; color: var(--green); }
.mn-burger { display: none; }
.mn-scrim { display: none; }

/* not enough room for everything: Pradžia goes first (the logo is the home link), then the login button's text */
@media (max-width: 1240px) {
  .mn-item:first-child { display: none; }
  .mn-top { padding: 6px 7px; }
}
@media (max-width: 1100px) {  /* the small brand icon instead of the wide logo: room for the menu + login + online count */
  .brand-logo { display: none; }
  .brand-icon { display: block; }
}
@media (max-width: 1060px) {
  .topbar { gap: 12px; }
  .topbar > .nav-dc { display: none; }  /* Discord stays in Bendruomenė; the login button keeps its whole label */
  .topbar > .svc-user { max-width: 150px; }
  .mn-top { font-size: 16px; padding: 6px 5px; }
}

/* ------------------------------------------------------------------ mobile panel */
@media (max-width: 900px) {
  /* backdrop-filter makes the bar the containing block of position: fixed children – the panel must cover the viewport */
  .topbar { gap: 10px; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(8, 8, 14, .92); }
  .topbar > .nav-dc, .topbar > .svc-user { display: none; }
  .guide-cta { margin-left: auto; }
  .topbar > .online-pill { margin-left: 0; }
  .mn-burger { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; flex: none;
    width: 44px; height: 40px; padding: 0; cursor: pointer; background: linear-gradient(#5a5a66, #3c3c46); border: 2px solid #000;
    box-shadow: inset 2px 2px 0 #8a8a99, inset -2px -3px 0 #24242c; }
  .mn-burger i { display: block; width: 22px; height: 4px; background: #fff; box-shadow: 2px 2px 0 #000; }
  .mn-burger:active { transform: translateY(2px); }
  .mn-burger[aria-expanded="true"] { background: linear-gradient(#ffd95e, #f0a92a); box-shadow: inset 2px 2px 0 #fff2b8, inset -2px -3px 0 #a86a10; }

  .mainnav { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; display: flex; flex-direction: column; width: min(360px, 88vw);
    height: 100vh; height: 100dvh; margin: 0; overflow-y: auto; overscroll-behavior: contain; background: #12121c;
    border-left: 3px solid #000; box-shadow: inset 3px 0 0 rgba(255,255,255,.08), -8px 0 24px rgba(0,0,0,.5);
    transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
    padding: 0 0 max(16px, env(safe-area-inset-bottom)); }
  .mainnav.open { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  .mn-scrim { position: fixed; inset: 0; z-index: 1000; display: block; background: rgba(0,0,0,.55); }
  .mn-scrim[hidden] { display: none !important; }
  html.mn-open, html.mn-open body { overflow: hidden; }
  html.mn-open .topbar { z-index: 1000; }

  .mn-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px 12px 18px; background: #12121c; border-bottom: 2px solid #000; }
  .mn-title { font: 400 22px var(--font-pixel); color: #ffff55; text-shadow: 2px 2px 0 #3f3f15; }
  .mn-close { width: 44px; height: 44px; flex: none; color: #fff; cursor: pointer; font: 600 20px var(--font-body); background: linear-gradient(#5a5a66, #3c3c46);
    border: 2px solid #000; box-shadow: inset 2px 2px 0 #8a8a99, inset -2px -3px 0 #24242c; }
  .mn-list { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0; }
  .mn-item, .mn-item:first-child { display: block; border-bottom: 2px solid rgba(255,255,255,.06); }
  .mn-item[hidden] { display: none; }
  .mn-top { display: flex; width: 100%; min-height: 54px; padding: 12px 18px; font-size: 22px; justify-content: space-between; text-align: left; }
  .mn-item.is-current > .mn-top, .mn-top[aria-current="page"] { box-shadow: inset 4px 0 0 #ffff55; }
  .mn-caret { transform: scale(1.5); }
  .mn-group.open > .mn-top .mn-caret { transform: scale(1.5) rotate(180deg); }
  .mn-sub, .mn-group:last-of-type .mn-sub, .mn-group:nth-last-child(2) .mn-sub { position: static; min-width: 0; padding: 0 10px 10px 14px;
    background: none; border: 0; box-shadow: none; }
  .mn-sub::before { display: none; }
  .mn-sub a { min-height: 52px; justify-content: center; padding: 8px 12px; border-left: 2px solid rgba(255,255,255,.12); }
  .mn-l { font-size: 20px; }
  .mn-d { font-size: 14px; }
  .mn-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px 8px; margin-top: auto; }
  .mn-foot .mc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1 1 140px; min-height: 48px;
    padding: 8px 12px; font-size: 18px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mn-foot .mn-dc { background: #5865F2; box-shadow: inset 2px 2px 0 #8f97ff, inset -2px -3px 0 #3a43a8; }
  .mn-foot .mn-dc:hover { background: #6d79f5; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .mainnav, .mainnav.open { transition: none; }
}
@media (max-width: 520px) {
  .online-pill { padding: 6px 8px; font-size: 14px; }
}
@media (max-width: 360px) {
  .online-pill .online-text { display: none; }
}
