/* Nerdcave guild site: the sub-tab bar under the top bar, on every
   page that belongs to a main tab (Guild, Raids: index.html, raids.html; the
   tools: app.html's guild shell). One strip of glass with the pages of the
   current main tab; a lit "ink" slides under the current one (js/subbar.js
   places it; without JavaScript the current tab is lit by itself). On a phone
   the tabs scroll sideways and the edges that hide more tabs fade.

   Self-contained: its colours are set on .subbar itself, so it looks the same
   over guild.css (Guild, Raids) and over the live site's stylesheets (the
   tools). The Guild and Raids pages pin it under their fixed top bar (and
   grow --top by its height, so everything that keeps clear of the bar keeps
   clear of this one too); on the tools page it sticks under the sticky top
   bar (css/shell.css).

   Also here, because every page has a bar: the parts of the site that hide
   while they have nothing to show (<html data-empty>, js/site.js). */

.subbar {
  --sb-h: 52px;
  --sb-accent: #f2c14e;
  --sb-accent-rgb: 242, 193, 78;
  --sb-text: #f6eedf;
  --sb-text-2: #d8ccb2;
  --sb-text-3: #b3a68c;
  --sb-ink: #1e1404;
  --sb-warn: #f4c76c;
  --sb-warn-rgb: 244, 199, 108;
  --sb-ease: cubic-bezier(.22, .9, .24, 1);
  position: fixed; left: 0; right: 0; top: 64px; z-index: 49;
  height: var(--sb-h); display: flex; align-items: center; padding: 0 clamp(16px, 2.6vw, 40px);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--sb-text);
  background: linear-gradient(180deg, rgba(13, 10, 7, .74), rgba(13, 10, 7, .6));
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 14px 34px -22px rgba(0, 0, 0, .9);
}
:root[data-theme="crystal"] .subbar {
  --sb-accent: #b39bff; --sb-accent-rgb: 179, 155, 255; --sb-ink: #0c0820;
  --sb-text: #eef0ff; --sb-text-2: #c6cae2; --sb-text-3: #a2a8c6;
  background: linear-gradient(180deg, rgba(5, 6, 12, .76), rgba(5, 6, 12, .62));
}
/* a thread of light along the bottom edge */
.subbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(var(--sb-accent-rgb), .32) 50%, transparent); }
.subbar *, .subbar *::before, .subbar *::after { box-sizing: border-box; }
.subbar .ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* the tools page: under the sticky guild top bar, in the page's flow */
.ncp-shell.subbar { position: sticky; top: 64px; left: auto; right: auto; }

/* the Guild and Raids pages: the fixed bars grow by this one */
:root:has(body > .subbar:not(.ncp-shell)) { --sub: 52px; --top: calc(64px + var(--sub)); }

.subbar-group { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 1240px; height: 100%; margin: 0 auto; min-width: 0; }
.subbar-group[hidden] { display: none; }
.subbar-title { display: inline-flex; align-items: center; gap: 9px; flex: none; height: 26px; padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, .1);
  font-size: 13px; font-weight: 700; line-height: 1; letter-spacing: .18em; text-transform: uppercase; color: var(--sb-accent); }
.subbar-title .ic { width: 17px; height: 17px; }

.subbar-track { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 2px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
.subbar-track::-webkit-scrollbar { display: none; }
.subbar-track.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.subbar-track.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px); mask-image: linear-gradient(90deg, transparent, #000 56px); }
.subbar-track.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent); }

.stab { position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 999px; font-size: 14px; font-weight: 500; line-height: 1; letter-spacing: .005em; white-space: nowrap;
  color: var(--sb-text-2); text-decoration: none; cursor: pointer; transition: color .2s, background-color .2s; }
.stab .ic { opacity: .72; transition: opacity .2s, color .2s; }
.stab:hover { color: var(--sb-text); background-color: rgba(255, 255, 255, .045); }
.stab:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: -2px; }
.stab[aria-current="page"] { color: #fff; background-color: transparent; }
.stab[aria-current="page"] .ic { color: var(--sb-accent); opacity: 1; }
/* no ink yet (no JavaScript, or before it runs): the current tab lights itself */
.subbar:not(.ink-ready) .stab[aria-current="page"] { background-color: rgba(255, 255, 255, .09); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }

/* the sliding ink: a glass pill with a glowing thread on the bar's edge */
.subbar-ink { position: absolute; z-index: 0; left: 0; top: 50%; height: 36px; margin-top: -18px; width: var(--ink-w, 0); border-radius: 999px;
  pointer-events: none; opacity: 0; transform: translateX(var(--ink-x, 0));
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), inset 0 1px 0 rgba(255, 255, 255, .24), 0 8px 26px -10px rgba(var(--sb-accent-rgb), .6);
  transition: transform .5s var(--sb-ease), width .5s var(--sb-ease), opacity .25s; }
.subbar-ink.on { opacity: 1; }
.subbar-ink.no-anim { transition: none; }
.subbar-ink::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -8px; height: 2px; border-radius: 2px; background: var(--sb-accent);
  box-shadow: 0 0 10px rgba(var(--sb-accent-rgb), .95), 0 0 26px rgba(var(--sb-accent-rgb), .55); }

/* a count (Members 59) */
.stab-count { display: inline-grid; place-items: center; min-width: 24px; height: 21px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sb-text-2); background: rgba(255, 255, 255, .08); }
.stab-count:empty { display: none; }
.stab[aria-current="page"] .stab-count { color: var(--sb-ink); background: var(--sb-accent); }

/* the tools' character sheet: "Race › Pocket Demon" */
.subbar-crumb { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 0 8px 0 4px; font-size: 14px; color: var(--sb-text-3); white-space: nowrap; }
.subbar-crumb::before { content: "›"; font-size: 18px; line-height: 1; color: var(--sb-text-3); }
.subbar-crumb b { font-weight: 600; color: var(--sb-text); }
.subbar-crumb[hidden] { display: none; }

@media (max-width: 1080px) {
  .subbar-title { display: none; }
}
@media (max-width: 760px) {
  .subbar { --sb-h: 48px; top: 56px; padding: 0 6px; }
  .ncp-shell.subbar { top: 56px; }
  :root:has(body > .subbar:not(.ncp-shell)) { --sub: 48px; --top: calc(56px + var(--sub)); }
  .stab { height: 34px; padding: 0 12px; gap: 7px; }
  .subbar-ink { height: 34px; margin-top: -17px; }
  .subbar-ink::after { bottom: -7px; }
}

/* motion: none for those who asked, and in Calm mode */
@media (prefers-reduced-motion: reduce) {
  .subbar-ink, .stab { transition: none; }
}
html.calm .subbar-ink, html.still .subbar-ink { transition: none; }

/* ---- parts with nothing to show yet: their tab, panel, links and cards ------- */
html[data-empty~="faq"] [data-needs="faq"],
html[data-empty~="fame"] [data-needs="fame"],
html[data-empty~="night"] [data-needs="night"],
html[data-empty~="recruiting"] [data-needs="recruiting"],
html[data-empty~="feed"] [data-needs="feed"] { display: none !important; }
