/* sitebar.css: the bar on every page (build/sitebar.py). Uses the page's own tokens, so it takes each game's
   colours; falls back to neutral values on the homepage. Loaded from the site root by every page. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sitebar { position: relative; z-index: 20; border-bottom: 1px solid var(--line); background: var(--bg); font-family: var(--font-body); }
.sitebar-in { max-width: 1120px; margin: 0 auto; min-height: 56px; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center; gap: 8px 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* logo */
.sb-logo { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 16px; white-space: nowrap; }
.sb-mark { width: 30px; height: 16px; flex: none; }

/* game switcher */
.sb-game { position: relative; z-index: 3; }   /* its menu opens over the search box */
.sb-game summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius, 4px); color: var(--fg); font-size: 15px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; transition: background-color .15s var(--ease, ease); }
.sb-game summary::-webkit-details-marker { display: none; }
.sb-game summary:hover, .sb-game[open] summary { background: var(--raise); }
.gm { width: 16px; height: 16px; flex: none; }
.gl { height: 18px; width: auto; flex: none; }
.sb-menu .gl, .sb-menu .gm { width: 40px; object-fit: contain; }   /* in the list every logo gets one slot, so names line up */
.chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s var(--ease, ease); }
.sb-game[open] .chev { transform: rotate(180deg); }
.sb-menu { position: absolute; left: 0; top: calc(100% + 4px); min-width: 220px; margin: 0; padding: 4px; list-style: none; display: grid; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius, 4px); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.sb-menu a, .sb-menu .soon { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 2px; color: var(--fg); text-decoration: none; font-size: 14px; }
.sb-menu a:hover { background: var(--raise); }
.sb-menu a[aria-current] { background: var(--raise); }
.sb-menu .soon { color: var(--muted); }
.sb-menu .soon .gm { opacity: .5; }
.sb-menu small { margin-left: auto; font-size: 12px; color: var(--muted); }

/* search, in the middle */
.sb-search { position: relative; z-index: 2; justify-self: center; width: 100%; max-width: 360px; margin: 0; }
.sb-search input { width: 100%; height: 36px; padding: 0 36px 0 12px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius, 4px);
  color: var(--fg); font: inherit; font-size: 14px; }
.sb-search input::placeholder { color: var(--muted); }
.sb-search input:focus { outline: none; border-color: var(--muted); }
.sb-search input::-webkit-search-cancel-button { display: none; }
.sb-search kbd { position: absolute; right: 8px; top: 8px; min-width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 2px; font: 500 12px/1 var(--font-body); color: var(--muted); pointer-events: none; }
.sb-search input:focus + kbd, .sb-search input:not(:placeholder-shown) + kbd { display: none; }
.sb-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; display: grid; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius, 4px); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.sb-results a { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px; padding: 4px 8px; min-height: 40px;
  border-radius: 2px; color: var(--fg); text-decoration: none; font-size: 14px; }
.sb-results a[aria-selected=true], .sb-results a:hover { background: var(--raise); }
.sb-results .ri { width: 36px; height: 24px; display: grid; place-items: center; overflow: hidden; border-radius: 2px; background: var(--raise); }
.sb-results .ri img { width: 100%; height: 100%; object-fit: cover; }
.sb-results .ri.contain img { object-fit: contain; }
.sb-results b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-results small { display: block; font-size: 12px; color: var(--muted); }
.sb-results[hidden] { display: none; }
.sb-results .ri span { font-size: 11px; font-weight: 600; color: var(--muted); }
.sb-results li { list-style: none; }
.sb-results .none { padding: 8px 10px; font-size: 14px; color: var(--muted); }

/* the current game's sections */
.sb-pages { display: flex; gap: 4px; justify-self: end; }
.sb-pages a { display: flex; align-items: center; height: 56px; padding: 0 8px; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .15s var(--ease, ease); }
.sb-pages a:hover, .sb-logo:hover { color: var(--fg); }
.sb-pages a[aria-current] { color: var(--fg); border-bottom-color: var(--accent, var(--fg)); }

@media (max-width: 900px) {
  .sitebar-in { grid-template-columns: auto minmax(0, 1fr); padding-top: 8px; }
  .sb-game { justify-self: end; }
  .sb-search { grid-column: 1 / -1; max-width: none; }
  .sb-search kbd { display: none; }
  .sb-pages { grid-column: 1 / -1; justify-self: stretch; overflow-x: auto; scrollbar-width: none; }
  .sb-pages a { height: 44px; }
  .sb-menu { left: auto; right: 0; }
}
@media (max-width: 420px) { .sb-logo span { font-size: 15px; } }

/* each game in the switcher opens its sections: a flyout to the side with a mouse, in place on touch and phones */
.sb-g { position: relative; }
.sb-grow { display: flex; align-items: center; border-radius: 2px; }
.sb-grow:hover, .sb-g.open > .sb-grow, .sb-g.current > .sb-grow { background: var(--raise); }
.sb-glink { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 36px; padding: 0 10px; color: var(--fg); text-decoration: none; font-size: 14px; }
.sb-gbtn { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 2px; background: none; color: var(--muted); cursor: pointer; }
.sb-gbtn:hover { color: var(--fg); }
.chev-r { width: 12px; height: 12px; color: currentColor; flex: none; }
.sb-g.open .chev-r { transform: rotate(90deg); }
.sb-sub { display: none; margin: 0; padding: 4px; list-style: none; gap: 2px; }
.sb-sub a { display: flex; align-items: center; height: 32px; padding: 0 10px; border-radius: 2px; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.sb-sub a:hover, .sb-sub a[aria-current] { color: var(--fg); background: var(--raise); }
.sb-g.open > .sb-sub { display: grid; }
@media (hover: hover) and (min-width: 901px) {
  /* one side menu at a time (sitebar.js opens it on hover, with menu aim), flush against the list so there is no gap */
  .sb-sub { position: absolute; left: 100%; top: -5px; min-width: 160px; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius, 4px); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
  .sb-sub::before { content: ""; position: absolute; left: -8px; top: 0; bottom: 0; width: 8px; }
  .sb-g:focus-within > .sb-sub { display: grid; }
  .sb-g.open { z-index: 2; }
  /* only the open row is highlighted; the game you are on is marked by a semi-bold name instead */
  .sb-g.current:not(.open) > .sb-grow { background: none; }
  .sb-g.current:not(.open) > .sb-grow:hover { background: var(--raise); }
  .sb-g.current .sb-glink span { font-weight: 600; }

  .sb-g.open .chev-r { transform: none; }
}
@media (max-width: 900px) {
  .sb-sub { padding-left: 36px; }
  .sb-g.current > .sb-sub { display: grid; }          /* on phones the current game's sections show straight away */
  .sb-g.current .chev-r { transform: rotate(90deg); }
}
@media (max-width: 480px) { .sb-game > summary > span { display: none; } }   /* phones: the game's logo alone in the switcher button */
