/* ============================================================
   LAYOUT: two-tier topbar (identity banner + functional nav row)
   ============================================================ */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(11, 17, 22, 0.94), rgba(19, 28, 38, 0.92));
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 0 rgba(102, 192, 244, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* hairline cyan->green signal under the whole topbar */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(102, 192, 244, 0.55) 25%,
    rgba(190, 238, 17, 0.55) 55%,
    rgba(102, 192, 244, 0.45) 75%,
    transparent 100%);
  pointer-events: none;
}

/* ---- Tier 1: identity banner with animated orbital + pulse backdrop ---- */

.topbar-banner {
  position: relative;
  height: var(--banner-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 var(--content-pad);
  overflow: hidden;
}

.topbar-banner-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}

.topbar-banner-bg .banner-pulse {
  stroke-dasharray: 160 1600;
  stroke-dashoffset: 0;
  animation: banner-pulse-sweep 5.5s linear infinite;
  filter: drop-shadow(0 0 4px var(--green-glow));
}

/* atoms get a gentle drift in opacity so the field feels alive even when
   you're not looking directly at the electrons */
.topbar-banner-bg .banner-atoms > g {
  animation: atom-breathe 6s ease-in-out infinite;
}
.topbar-banner-bg .banner-atoms > g:nth-child(2) { animation-delay: -1.5s; }
.topbar-banner-bg .banner-atoms > g:nth-child(3) { animation-delay: -3s; }
.topbar-banner-bg .banner-atoms > g:nth-child(4) { animation-delay: -4.5s; }

@keyframes banner-pulse-sweep { to { stroke-dashoffset: -1760; } }
@keyframes atom-breathe {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-banner-bg .banner-pulse,
  .topbar-banner-bg .banner-atoms > g { animation: none; }
  /* SMIL animations on <animateMotion> respect this via the global media
     query in user agents that honor it; on those that don't, the motion
     will continue but rings stop. acceptable trade-off */
}

/* Site option: animations off (set on <html> by topbar.js from the user's
   choice on options.html, defaulting to prefers-reduced-motion). Kills all CSS
   animations + transitions site-wide; topbar.js also pauses SMIL motion. This
   is the main lever for the CPU/GPU cost of the hero atom + banner on low-power
   hardware. */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
/* SMIL <animateMotion> is not a CSS animation so animation:none won't stop it.
   Hiding the particle group via CSS is the only reliable way to suppress it on
   page load before JS has a chance to call pauseAnimations(). */
html[data-motion="off"] .banner-atoms {
  display: none;
}

.topbar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--strong);
  flex-shrink: 0;
}
.topbar-brand:hover { text-decoration: none; color: var(--strong); }

/* brand mark: intentionally STATIC. logos shouldn't perpetually spin or it
   reads as AI-generated motion noise. all the kinetic identity lives in the
   banner backdrop below, not in the lockup */
.topbar-brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  color: var(--accent);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.topbar-brand-mark svg { width: 100%; height: 100%; }

.topbar-brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--strong);
}
.topbar-brand-text .brand-accent {
  background: linear-gradient(90deg, var(--accent-hi), var(--green-hi));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-brand-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 14px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
  line-height: 1;
  align-self: center;
}

.topbar-banner-actions {
  position: relative;
  z-index: 1;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* small icon-only link in the banner actions (GitHub, etc.) - sized to match
   the My Account button height so the trio aligns visually */
.banner-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  border: none;
  background: transparent;
  transition: color .12s, box-shadow .12s;
}
.banner-icon-link:hover {
  color: var(--accent-hi);
  box-shadow: none;
  text-decoration: none;
}
.banner-icon-link .nav-icon { width: 16px; height: 16px; }

/* ---- Tier 2: functional nav row ---- */

.topbar-nav {
  position: relative;
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 0 var(--content-pad);
  background: rgba(11, 17, 22, 0.45);
  border-top: 1px solid var(--border);
}

.topnav-links {
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.topnav-links > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s, background .12s;
  position: relative;
}
.topnav-links > a:hover {
  color: var(--text);
  background: rgba(102, 192, 244, 0.05);
  text-decoration: none;
}
.topnav-links > a.active {
  color: var(--accent-hi);
  border-bottom-color: var(--accent);
  background: linear-gradient(180deg, transparent, var(--accent-soft));
}
.topnav-links > a.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.topnav-links .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Theme toggle button - sun icon (shown in dark mode) / moon icon (shown in
   light mode). Both inline SVGs are always in the DOM; JS toggles display
   on click. The button reuses .banner-icon-link sizing so it matches the
   GitHub icon button next to it */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}
.theme-toggle .nav-icon {
  width: 18px;
  height: 18px;
  transition: transform .2s;
}
.theme-toggle:hover .nav-icon { transform: rotate(15deg); }
/* Default: sun shown, moon hidden. JS flips on theme change */
.theme-icon-moon { display: none; }

/* Top-nav dropdowns (Browse, Resources). Hover-to-open is the primary
   interaction; click also works for touch + keyboard. Focus-within keeps
   the panel open while the user tabs through its children. Active state
   on the toggle when any child page is the current page (set via JS) */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle {
  color: var(--text);
  background: rgba(102, 192, 244, 0.05);
}
.nav-dropdown-toggle .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-caret {
  width: 10px;
  height: 6px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform .15s, opacity .15s;
}
.nav-dropdown:hover .nav-caret,
.nav-dropdown:focus-within .nav-caret { transform: rotate(180deg); opacity: 1; }

/* Highlight the parent toggle when one of its children is the current
   page. JS sets .has-active on the wrapper after checking data-page */
.nav-dropdown.has-active .nav-dropdown-toggle {
  color: var(--accent-hi);
  border-bottom-color: var(--accent);
  background: linear-gradient(180deg, transparent, var(--accent-soft));
}

.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 200px;
  background: var(--bg-bot, #0a0f14);
  border: 1px solid var(--accent);
  border-top: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  padding: 4px 0;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel,
.nav-dropdown.is-open .nav-dropdown-panel { display: block; }
.nav-dropdown-panel > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.nav-dropdown-panel > a:hover {
  color: var(--text);
  background: rgba(102, 192, 244, 0.06);
  text-decoration: none;
}
.nav-dropdown-panel > a.active {
  color: var(--accent-hi);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.nav-dropdown-panel .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

[data-theme="light"] .nav-dropdown-toggle { color: #8fa8c4; }
[data-theme="light"] .nav-dropdown-toggle:hover,
[data-theme="light"] .nav-dropdown:hover .nav-dropdown-toggle,
[data-theme="light"] .nav-dropdown:focus-within .nav-dropdown-toggle { color: #e8f4ff; background: rgba(102,192,244,0.08); }
[data-theme="light"] .nav-dropdown.has-active .nav-dropdown-toggle { color: #aedcff; }
[data-theme="light"] .nav-dropdown-panel { background: #1b2838; border-color: #66c0f4; }
[data-theme="light"] .nav-dropdown-panel > a { color: #8fa8c4; }
[data-theme="light"] .nav-dropdown-panel > a:hover { color: #e8f4ff; background: rgba(102,192,244,0.08); }
[data-theme="light"] .nav-dropdown-panel > a.active { color: #aedcff; }

/* Overflow "More" menu - shown by JS when nav items don't fit */
.nav-overflow {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  margin-left: auto; /* push to right end of nav, like before-the-search */
}
.nav-overflow[hidden] { display: none; }
.nav-overflow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.nav-overflow-toggle:hover {
  color: var(--text);
  background: rgba(102, 192, 244, 0.05);
}
.nav-overflow.is-open .nav-overflow-toggle {
  color: var(--accent-hi);
  background: var(--accent-soft);
  border-bottom-color: var(--accent);
}
.nav-overflow-toggle .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.nav-overflow-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 30;
  min-width: 200px;
  background: var(--bg-bot, #0a0f14);
  border: 1px solid var(--accent);
  border-top: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  padding: 4px 0;
  max-height: 70vh;
  overflow-y: auto;
}
.nav-overflow.is-open .nav-overflow-panel { display: block; }
.nav-overflow-panel > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.nav-overflow-panel > a:hover {
  color: var(--text);
  background: rgba(102, 192, 244, 0.06);
  text-decoration: none;
}
.nav-overflow-panel > a.active {
  color: var(--accent-hi);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.nav-overflow-panel .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* search pill in the nav row */
.topbar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  align-self: center;
  min-width: 200px;
  max-width: 360px;
  flex: 0 1 320px;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.topbar-search-wrap input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  background: rgba(11, 17, 22, 0.6);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.topbar-search-wrap input::placeholder { color: var(--muted); }
.topbar-search-wrap input:focus {
  border-color: var(--accent);
  background: rgba(11, 17, 22, 0.85);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar-search-wrap input:focus + .topbar-search-icon { color: var(--accent); }

/* live results dropdown - anchored to the right edge of the search pill but
   extends leftward to show full game titles. Caps at 90vw so narrow viewports
   stay sane */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: min(540px, 90vw);
  z-index: 250;
  background: linear-gradient(180deg, rgba(19, 28, 38, 0.98), rgba(11, 17, 22, 0.98));
  border: 1px solid var(--border2);
  border-top-color: var(--accent);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(102, 192, 244, 0.08);
  max-height: 360px;
  overflow-y: auto;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}
.search-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s, color .1s;
}
.search-dropdown a:last-child { border-bottom: none; }
.search-dropdown a:hover,
.search-dropdown a.is-focused {
  background: rgba(102, 192, 244, 0.1);
  color: var(--strong);
  text-decoration: none;
}
.search-dropdown img {
  width: 92px;
  height: 34px;
  object-fit: cover;
  background: var(--s2);
  flex-shrink: 0;
}
.search-dropdown .sd-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.search-dropdown .sd-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-dropdown .sd-counts {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-dropdown .sd-tier {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  align-self: center;
}
.search-dropdown .sd-appid {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}
.search-dropdown .sd-empty {
  padding: 14px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.search-dropdown .sd-empty code {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.74rem;
}

/* hide the mobile-only toggle on desktop, show on small screens via media query below */
.topbar-mobile-toggle {
  display: none;
  width: 36px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}
.topbar-mobile-toggle svg { width: 18px; height: 18px; }
.topbar-mobile-toggle:hover { color: var(--accent); }

/* mobile drawer that slides down from the topbar */
.mobile-nav-drawer {
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  right: 0;
  z-index: 199;
  background: linear-gradient(180deg, rgba(19, 28, 38, 0.98), rgba(11, 17, 22, 0.98));
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  display: none;
}
.mobile-nav-drawer.open { display: block; }
.mobile-nav-drawer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--content-pad);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-drawer a:last-child { border-bottom: none; }
.mobile-nav-drawer a:hover { background: rgba(102, 192, 244, 0.06); text-decoration: none; }
.mobile-nav-drawer a.active { color: var(--accent-hi); background: var(--accent-soft); }
.mobile-nav-drawer a .nav-icon { width: 18px; height: 18px; color: var(--accent); }

/* legacy classes - kept for pages still using the old single-row topbar styles */
.topbar-toggle, .hamburger, .topbar-spacer, .topbar-link, .topbar-link--button { display: none !important; }

/* - Sidebar - */

.sidebar-nav {
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 150;
  background:
    linear-gradient(180deg, rgba(19, 28, 38, 0.96), rgba(11, 17, 22, 0.98));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: visible;
  -webkit-overflow-scrolling: touch;
}

.sidebar-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
  user-select: none;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
}
.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  margin: 0 -8px;
  font-size: 0.82rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color .1s, background .1s, border-color .1s;
}
.sidebar-links a:hover {
  color: var(--text);
  background: var(--s2);
  text-decoration: none;
}
.sidebar-links a.active {
  color: var(--accent-hi);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
  box-shadow: inset 2px 0 8px -2px var(--accent-glow);
}
.sidebar-links a .nav-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-links a .nav-icon svg {
  display: block;
}

.sidebar-note {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.55;
}
.sidebar-note strong { color: var(--text); font-weight: 600; }

.sidebar-contact {
  padding: 12px 16px 16px;
  margin-top: 4px;
}
.sidebar-contact-btn {
  display: block;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border2);
  transition: color .12s, border-color .12s;
}
.sidebar-contact-btn:hover {
  color: var(--green-hi);
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(190, 238, 17, 0.08), transparent);
  box-shadow: 0 0 18px -4px var(--green-glow);
  text-decoration: none;
}

.sidebar-brand-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
}
.sidebar-brand-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--s3);
  border: 1px solid var(--border2);
  margin-top: 2px;
}
.sidebar-brand-icon img { width: 32px; height: 32px; object-fit: contain; }
.sidebar-brand-copy h2 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--strong);
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
}
.sidebar-brand-copy p {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 1px;
}

/* - Main content area - no sidebar, fills the width responsively - */

.main-content {
  margin-top: var(--topnav-h);
  min-height: calc(100vh - var(--topnav-h));
  display: flex;
  flex-direction: column;
  width: 100%;
}

.main-inner {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px var(--content-pad) 56px;
}

/* - Footer - */

.sitefooter {
  border-top: 1px solid var(--border);
  padding: 16px var(--content-pad);
  font-size: 0.74rem;
  color: var(--muted);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}
.sitefooter a { color: var(--muted); }
.sitefooter a:hover { color: var(--text); text-decoration: underline; }
