/* HEADER v4, two-tier (2026-09-27, owner approved; built from nav-mockups/two-tier/).
   Linked from _header.html so every page picks it up together with the header markup; it loads after style.css,
   so these rules override the HEADER v3 rules there. Class prefix zl2 = the two-tier header.
   Tier 1: strip (42px): live beacon | Store, Staff (gated), search, bell, Sign in / avatar menu.
   Tier 2: main bar (56.7px incl. border): Guide | Plugins | Rules | Community | Wraith.
   On scroll down the strip slides away (includes.js adds .zl2-strip-away), so the sticky header is 56.7px while
   reading and 98.7px at the top of the page. includes.js also keeps --zl-header-bottom (px) on :root = the
   header's visible bottom edge, for anything that must sit under it (staff console sidebar, sticky sub navs).
   Phones (980px and below): one row, the strip overlays it; Store and Staff move into the drawer. */

/* ---- Tier 1: strip (42px including its hairline) ---- */
.zl2-strip {
  position: relative;
  z-index: 80; /* its popovers sit above the main bar */
  height: 42px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.28);
  font-size: 0.78rem;
}

.zl2-strip-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.zl2-strip-left,
.zl2-strip-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.zl2-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Live indicator: the live ON AIR beacon (live-beacon.css), scaled to the strip */
.zl2-strip .lv-beacon-pill {
  gap: 0.4rem;
  padding: 0.18rem 0.6rem 0.18rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.zl2-strip .lv-beacon-dot {
  width: 8px;
  height: 8px;
}

.zl2-strip .lv-beacon-count {
  padding: 0 0.35rem;
  font-size: 0.66rem;
}

.zl2-strip .lv-beacon-pop {
  top: calc(100% + 8px);
}

/* Store: subtle gold, no glow */
.zl2-store {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 24px;
  padding: 0 0.65rem;
  border: 1px solid rgba(255, 217, 100, 0.3);
  border-radius: 999px;
  background: rgba(255, 217, 100, 0.06);
  color: var(--nav-gold);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.zl2-store:hover,
.zl2-store:focus-visible {
  color: #fff3c4;
  border-color: rgba(255, 217, 100, 0.55);
  background: rgba(255, 217, 100, 0.12);
  text-decoration: none;
}

/* Staff link: the Administrative Tools terminal look (admin-ui.css palette, written out so it works for every
   staff member, not only plugins.admin holders who load admin-ui.css) */
.zl2-staff {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 0.65rem;
  border: 1px solid rgba(60, 255, 155, 0.45);
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #06111a, #030608);
  color: #3cff9b;
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(60, 255, 155, 0.45);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.zl2-staff::before {
  content: ">";
  margin-right: 0.35rem;
  color: #4fe3ff;
  animation: zl2-blink 1.4s steps(2) infinite;
}

.zl2-staff:hover,
.zl2-staff:focus-visible {
  color: #fff;
  background: linear-gradient(90deg, rgba(60, 255, 155, 0.28), rgba(60, 255, 155, 0.06));
  text-decoration: none;
}

@keyframes zl2-blink { 50% { opacity: 0.3; } }

/* Avatar: a 28px circle (Steam avatar, or the green signed-in dot), opens My Profile / Sign out */
.zl2-avatar-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(230, 200, 74, 0.55);
  border-radius: 50%;
  background: rgba(230, 200, 74, 0.1);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.zl2-avatar-btn .topbar-user-dot {
  flex: 0 0 auto;
}

/* Staff: the ring takes the role colour (includes.js sets --user-c from the role) */
.zl2-avatar-btn.is-staff {
  border-color: var(--user-c, rgba(230, 200, 74, 0.55));
}

.zl2-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.zl2-avatar-btn:hover,
.zl2-avatar-btn:focus-visible,
.zl2-strip .is-open > .zl2-avatar-btn {
  border-color: #ffd964;
  box-shadow: 0 0 0 2px rgba(255, 217, 100, 0.25);
  outline: none;
}

.zl2-strip .menu-item {
  position: relative;
  display: flex; /* centre the avatar circle; a block wrapper sits it on the text baseline */
  align-items: center;
}

.zl2-strip .nav-panel {
  left: auto;
  right: 0;
  padding-top: 0.35rem;
}

.zl2-strip .nav-panel-inner {
  font-size: 1rem;
}

.zl2-signout {
  width: 100%;
  border: 0;
  background: none;
  color: #dfe5f3;
  font: inherit;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

/* Search, bell and Sign in sized to the strip */
.zl2 .topbar-search {
  flex: 0 1 210px;
  min-width: 150px;
  height: 26px;
  margin: 0;
}

.zl2 .topbar-search input {
  font-size: 0.78rem;
}

.zl2 .topbar-search button {
  width: 28px;
  height: 24px;
}

.zl2 .topbar-search button svg {
  width: 14px;
  height: 14px;
}

.zl2 .topbar-auth {
  gap: 0.5rem;
}

.zl2 .topbar-login {
  height: 26px;
  padding: 0 0.7rem;
  font-size: 0.78rem;
}

.zl2 .topbar-login svg {
  width: 14px;
  height: 14px;
}

.zl2 .topbar-bell {
  width: 28px;
  height: 28px;
}

.zl2 .topbar-bell svg {
  width: 14px;
  height: 14px;
}

.zl2-strip .topbar-bell-badge {
  top: -3px;
  right: -7px;
  min-width: 11px;
  height: 12px;
  padding: 0 3px;
  font-size: 0.56rem;
  line-height: 12px;
  border-width: 1px;
}

/* ---- Tier 2: main bar (five menus, spare room on the right stays empty) ---- */
.zl2 .topbar-inner {
  justify-content: flex-start;
}

.zl2 .menu {
  flex: 1 1 auto;
}

/* Every card may use the viewport width (includes.js slides it back on screen) */
@media (min-width: 981px) {
  /* Main bar trimmed to 55.7px + 1px border: vertical padding only (logo 46px, menu fonts unchanged) */
  .zl2 .topbar-inner {
    min-height: 55.7px;
    padding-top: 4.85px;
    padding-bottom: 4.85px;
  }

  /* The logo image is block level so the link is exactly the 46px logo tall (an inline image sits in a 53.3px
     text line box, which is what made the v3 bar taller than its content) */
  .zl2 .brand picture,
  .zl2 .brand .brand-icon {
    display: block;
  }

  /* Cards attach flush under the bar: the hover bridge spans from the 35.4px menu link down to the header's
     bottom edge ((55.7 - 35.4) / 2 + 1px border = 11.15px) */
  .zl2 .topbar-inner .menu-list > .menu-item > .nav-panel {
    padding-top: 11.15px;
  }

  .zl2 .nav-panel-inner {
    max-width: calc(100vw - 2rem);
  }

  .menu-item[data-nav="plugins"] .nav-panel-inner {
    padding: 1.15rem 1.3rem 1.25rem;
    overflow: visible;
  }
}

.nav-group > .nav-links + .nav-links {
  margin-top: 2px;
}

/* ---- Guide: main list + "Popular" chip, and Ranks as a featured second column ---- */
.zl2-popular {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.6rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.zl2-popular-label {
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nav-muted);
}

.zl2-popular-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.8rem 0.22rem 0.25rem;
  border: 1px solid rgba(255, 217, 100, 0.35);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 217, 100, 0.12), rgba(255, 217, 100, 0.03));
  color: #fff3c4;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.zl2-popular-chip .nav-ico {
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
}

.zl2-popular-chip:hover,
.zl2-popular-chip:focus-visible {
  border-color: rgba(255, 217, 100, 0.7);
  box-shadow: 0 0 16px rgba(255, 217, 100, 0.25);
  text-decoration: none;
}

/* Ranks column: its own framed feature inside the Guide card */
.nav-panel-inner > .nav-group.zl2-ranks-feature {
  align-self: flex-start;
  min-width: 220px;
  padding: 0.85rem 0.8rem 0.8rem 1.4rem;
  border-radius: 12px;
  background:
    radial-gradient(260px 180px at 100% 0%, rgba(255, 217, 100, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(255, 217, 100, 0.05), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 0 0 1px rgba(255, 217, 100, 0.14);
}

.zl2-ranks-feature > .nav-title {
  font-size: 0.82rem;
}

.zl2-ranks-feature .nav-links.is-compact .nav-link {
  font-size: 0.95rem;
}

/* ---- Plugins: A to Z columns, divider, then Utilities (same title style as Plugins) ---- */
.zl2-utilities {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ---- The Wraith: the crown jewel ---- */
/* Top-level label: flame gradient text with a flickering glow and a few rising embers (absolutely positioned,
   so the bar height does not change) */
.topbar .menu-list > .menu-item.is-wraith > .menu-link {
  color: #ff9a52; /* chevron and underline colour */
  overflow: visible;
}

.zl2-ember-text {
  position: relative;
  background: linear-gradient(0deg, #ff5a1a 0%, #ff8a2a 30%, #ffc24a 60%, #fff1b8 100%);
  background-size: 100% 170%;
  background-position: 0 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  animation: zl2-flame 3.2s ease-in-out infinite;
}

@keyframes zl2-flame {
  0%   { background-position: 0 100%; filter: drop-shadow(0 0 6px rgba(255, 110, 30, 0.75)) drop-shadow(0 0 14px rgba(255, 60, 10, 0.35)); }
  18%  { filter: drop-shadow(0 0 9px rgba(255, 130, 40, 0.95)) drop-shadow(0 0 18px rgba(255, 70, 10, 0.5)); }
  27%  { filter: drop-shadow(0 0 5px rgba(255, 100, 25, 0.65)) drop-shadow(0 0 12px rgba(255, 60, 10, 0.3)); }
  45%  { background-position: 0 40%; filter: drop-shadow(0 0 11px rgba(255, 150, 50, 1)) drop-shadow(0 0 22px rgba(255, 80, 10, 0.55)); }
  63%  { filter: drop-shadow(0 0 7px rgba(255, 110, 30, 0.8)) drop-shadow(0 0 14px rgba(255, 60, 10, 0.4)); }
  80%  { background-position: 0 70%; filter: drop-shadow(0 0 10px rgba(255, 130, 40, 0.9)) drop-shadow(0 0 20px rgba(255, 70, 10, 0.5)); }
  100% { background-position: 0 100%; filter: drop-shadow(0 0 6px rgba(255, 110, 30, 0.75)) drop-shadow(0 0 14px rgba(255, 60, 10, 0.35)); }
}


.zl2-embers {
  position: absolute;
  left: 0.6rem;
  right: 1.2rem;
  bottom: 1.45rem; /* embers leave from the top of the word and rise above it */
  height: 0;
  pointer-events: none;
}

.zl2-embers i {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffc24a;
  box-shadow: 0 0 6px #ff7a1a, 0 0 2px #fff1b8;
  opacity: 0;
  animation: zl2-ember 2.8s linear infinite;
}

.zl2-embers i:nth-child(1) { left: 8%;  --dx: -4px; animation-delay: 0s; }
.zl2-embers i:nth-child(2) { left: 30%; --dx: 5px;  animation-delay: 0.9s; width: 2px; height: 2px; }
.zl2-embers i:nth-child(3) { left: 52%; --dx: -3px; animation-delay: 1.7s; }
.zl2-embers i:nth-child(4) { left: 74%; --dx: 6px;  animation-delay: 0.5s; width: 2px; height: 2px; }
.zl2-embers i:nth-child(5) { left: 92%; --dx: -5px; animation-delay: 2.2s; }

@keyframes zl2-ember {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 0.6; }
  100% { transform: translate(var(--dx), -18px) scale(0.3); opacity: 0; }
}

.topbar .menu-list > .menu-item.is-wraith > .menu-link:hover,
.topbar .menu-list > .menu-item.is-wraith > .menu-link:focus-visible,
.topbar .menu-list > .menu-item.is-wraith.is-open > .menu-link {
  color: #ffc24a;
  background: radial-gradient(120% 140% at 50% 120%, rgba(255, 90, 20, 0.28), rgba(255, 90, 20, 0.06) 70%);
}

.topbar .menu-list > .menu-item.is-wraith > .menu-link::before {
  background: linear-gradient(90deg, #ffc24a, #ff5a1a);
  box-shadow: 0 0 12px rgba(255, 106, 26, 0.75);
}

/* A faint ember underline is always lit under Wraith (full strength on hover / open) */
.topbar .menu-list > .menu-item.is-wraith > .menu-link::before {
  transform: scaleX(1);
  opacity: 0.55;
}

.topbar .menu-list > .menu-item.is-wraith > .menu-link:hover::before,
.topbar .menu-list > .menu-item.is-wraith.is-open > .menu-link::before {
  opacity: 1;
}

/* Panel: dark ember backdrop, the living-flame Wraith art faint on the right, orange border glow */
.menu-item.is-wraith .nav-panel-inner.zl2-wraith-panel {
  border-color: rgba(255, 106, 26, 0.45);
  border-top: 2px solid #ff7a2e;
  background:
    linear-gradient(90deg, rgba(9, 5, 5, 0.98) 0%, rgba(13, 6, 4, 0.94) 55%, rgba(16, 7, 4, 0.8) 100%),
    radial-gradient(700px 220px at 60% 115%, rgba(255, 80, 20, 0.28), transparent 70%),
    url("/images/wraith/suite-hero.webp") right 30% / cover no-repeat,
    #0b0605;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 0 42px rgba(255, 90, 20, 0.22);
}

.zl2-wraith-panel::after {
  background: linear-gradient(90deg, transparent, #ffc24a, transparent);
}

.zl2-wraith-panel > .nav-group + .nav-group {
  border-left-color: rgba(255, 106, 26, 0.22);
}

.zl2-wraith-panel .nav-title,
.zl2-wraith-panel .nav-title.is-link {
  color: #ff9a52;
  text-shadow: 0 0 10px rgba(255, 106, 26, 0.35);
}

.zl2-wraith-panel .nav-title.is-link:hover,
.zl2-wraith-panel .nav-title.is-link:hover .nav-title-more {
  color: #ffc24a;
}

.zl2-wraith-panel .nav-link {
  white-space: normal;
}

.zl2-wraith-panel .nav-ico {
  stroke: #ff8a3d;
  border-color: rgba(255, 106, 26, 0.3);
  background: rgba(255, 106, 26, 0.08);
}

.zl2-wraith-panel .nav-text b {
  color: #ffe2c7;
}

.zl2-wraith-panel .nav-text small {
  color: #b99a86;
}

.zl2-wraith-panel .nav-link:hover,
.zl2-wraith-panel .nav-link:focus-visible {
  background: linear-gradient(90deg, rgba(255, 106, 26, 0.24), rgba(255, 60, 20, 0.04));
  box-shadow: inset 2px 0 0 #ff7a2e;
}

.zl2-wraith-panel .nav-link:hover .nav-ico,
.zl2-wraith-panel .nav-link:focus-visible .nav-ico {
  stroke: #ffc24a;
  border-color: rgba(255, 140, 40, 0.7);
  background: rgba(255, 106, 26, 0.2);
  box-shadow: 0 0 18px rgba(255, 106, 26, 0.55);
}

.zl2-wraith-panel .nav-link:focus-visible {
  box-shadow: inset 2px 0 0 #ff7a2e, 0 0 0 2px #ff7a2e;
}

.zl2-wraith-boss {
  width: 250px;
}

/* The Wraith page itself keeps the brightest flame */
.zl2-wraith-boss .nav-link.is-wraith .nav-text b {
  color: #ffb070;
}

.zl2-wraith-analytics > .nav-links {
  display: grid;
  grid-template-columns: repeat(3, 214px);
  gap: 2px 0.4rem;
}

/* ---- Scroll: the strip slides away, only the main bar stays sticky ---- */
.topbar.zl2 {
  transition: top 0.25s ease;
}

.topbar.zl2.zl2-strip-away {
  top: -42px;
}

/* ---- Gated items: the hidden attribute always wins over the display a class above sets ---- */
.zl2 [data-staff-menu][hidden],
.zl2 .zl-admin-nav[hidden] {
  display: none !important;
}

/* ---- Desktop only / drawer only ---- */
@media (min-width: 981px) {
  .zl2-drawer-only {
    display: none !important;
  }
}

/* ---- Phones and small tablets: ONE row (logo, live indicator, search, bell, avatar, Menu) ---- */
@media (max-width: 980px) {
  .zl2 .topbar-inner {
    min-height: 60px;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .zl2 .nav-toggle {
    margin-left: auto;
  }

  /* The strip becomes an overlay on the one row, between the logo and the Menu button */
  .zl2-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    height: 60px;
    border: 0;
    background: none;
    pointer-events: none;
  }

  .zl2-strip-inner {
    padding-left: 64px;
    padding-right: 104px;
  }

  .zl2-strip-left > *,
  .zl2-strip-right > * {
    pointer-events: auto;
  }

  /* Store and Staff move into the drawer on phones */
  .zl2-store,
  .zl2-strip-right > .zl2-staff {
    display: none !important;
  }

  .zl2-strip .lv-beacon-pill {
    height: 30px;
    padding: 0 0.55rem;
  }

  .zl2 .topbar-search {
    order: 0;
    flex: 0 0 auto;
    width: 30px;
    min-width: 0;
    height: 30px;
    padding: 0;
    justify-content: center;
  }

  .zl2 .topbar-search input {
    display: none;
  }

  .zl2 .topbar-search button {
    width: 30px;
    height: 30px;
  }

  .zl2 .topbar-search button svg,
  .zl2 .topbar-bell svg,
  .zl2 .topbar-login svg {
    width: 16px;
    height: 16px;
  }

  .zl2 .topbar-auth {
    order: 1;
    margin-left: 0;
  }

  .zl2 .topbar-bell,
  .zl2-avatar-btn {
    width: 30px;
    height: 30px;
  }

  .zl2 .topbar-login {
    height: 30px;
    padding: 0 0.55rem;
  }

  .zl2 .topbar-login span {
    display: none;
  }

  .inbox-panel {
    top: 68px;
  }

  .zl2-strip .nav-panel {
    position: fixed;
    top: 68px;
    left: 12px;
    right: 12px;
  }

  .zl2-strip .nav-panel-inner {
    width: auto;
    max-width: none;
  }

  /* Guide: the Ranks feature stacks under the list */
  .nav-panel-inner > .nav-group.zl2-ranks-feature {
    min-width: 0;
    padding: 0.8rem 0.7rem;
  }

  /* Drawer: the Wraith row is full width, keep the embers over the word */
  .zl2-embers {
    right: auto;
    width: 5rem;
  }

  /* Wraith accordion: same ember card, one column */
  .menu-item.is-wraith .nav-panel-inner.zl2-wraith-panel {
    padding: 0.7rem 0.5rem 0.9rem;
    border: 0;
    border-radius: 10px;
    background:
      linear-gradient(180deg, rgba(13, 6, 4, 0.94), rgba(9, 5, 5, 0.98)),
      radial-gradient(400px 160px at 50% 110%, rgba(255, 80, 20, 0.3), transparent 70%),
      #0b0605;
    box-shadow: inset 0 0 0 1px rgba(255, 106, 26, 0.3);
  }

  .zl2-wraith-boss {
    width: auto;
  }

  .zl2-wraith-analytics > .nav-links {
    grid-template-columns: 1fr;
  }

  .zl2-wraith-panel > .nav-group + .nav-group {
    border-top-color: rgba(255, 106, 26, 0.22);
  }

  /* Drawer Staff item keeps the terminal look */
  .zl2-staff-drawer {
    color: #3cff9b !important;
    font-family: "JetBrains Mono", ui-monospace, Consolas, monospace !important;
    letter-spacing: 0.14em;
    text-shadow: 0 0 10px rgba(60, 255, 155, 0.45);
  }

}

@media (prefers-reduced-motion: reduce) {
  .topbar.zl2 {
    transition: none;
  }

  .zl2-staff::before,
  .zl2-ember-text {
    animation: none;
  }

  .zl2-ember-text {
    filter: drop-shadow(0 0 6px rgba(255, 106, 26, 0.6));
    background-position: 0 60%;
  }

  .zl2-embers {
    display: none;
  }
}
