/* ============================================================================
   Greybox footer — one centred row of links + one note line. That is the
   entire footer (no columns, no brand block, no sticker art, no rainbow
   ribbon, no back-to-top).

   Everything here is scoped to .gxf so it cannot touch the ct-/dl- footers on
   the contact and disclaimer pages. No Tailwind utilities are used: the build
   output (css/tailwind.min.css) is a purged subset, so new markup must ship
   with its own rules.

   Layout contract with index.html / js/navigation.js / js/pages.js:
     - .gxf-links is display:contents, so the config-ordered [data-footnav]
       links inside #footer-browse become direct flex items of .gxf-row.
     - #footer-collections-section keeps the material popup (js/footer.js)
       and is hidden as a whole by pages.js when no collections exist — the
       ID rule below exists because .gxf-menu-wrap would otherwise outrank
       the generic .hidden utility (both are 0-1-0; footer.css loads later).

   Column alignment mirrors .gx-page (css/style.css): the same --gx-gutter
   padding + --gx-content-max shell, so the footer's edges sit on the same
   vertical lines as every card row above it.
   ========================================================================== */

.gxf {
  --gxf-ink: #f4f3ee;
  --gxf-dim: #a3a3ae;
  --gxf-faint: #6e6e7a;
  --gxf-violet: #a879ff;
  --gxf-line: rgba(255, 255, 255, 0.08);
  --gxf-panel: linear-gradient(180deg, #15171c 0%, #0b0c0f 100%);

  position: relative;
  z-index: 1;
  /* Transparent on purpose: the poster backdrop (css/hero.css
   * .gx-page-ambient, fixed behind the whole page) shows through, so the
   * footer lands on the same hero-derived colour as the shelves above it
   * instead of slamming a solid black band across the bottom of the page. */
  background: transparent;
  color: var(--gxf-dim);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  padding: 1.9rem var(--gx-gutter, 3%) 2.4rem;
  border-top: 1px solid var(--gxf-line);
  box-sizing: border-box;
  isolation: isolate;
}

.gxf-shell {
  max-width: var(--gx-content-max, 82rem);
  margin-inline: auto;
}

/* Same breakpoints as .gx-page — the footer tracks the page column. */
@media (max-width: 859px) {
  .gxf { padding-inline: 12px; }
}

@media (max-width: 420px) {
  .gxf { padding-inline: 10px; }
}

/* ----------------------------------------------------------------- row ---- */

.gxf-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.6rem;
}

/* The browse group vanishes from layout so its children are laid out (and
   reordered by applyFooter) inside .gxf-row itself. */
.gxf-links {
  display: contents;
}

/* Plain text links, the Collections trigger and the Discord item share one
   rest: no button chrome, no chevron badge, just type. Direct-child selectors
   keep the popup's .gxf-menu-item rows out of this rule. */
.gxf-row > a,
.gxf-links > a,
.gxf-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0;
  border: 0;
  background: none;
  color: var(--gxf-dim);
  font: 600 0.95rem/1.25 'Manrope', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: color var(--gx-transition, 180ms ease),
    transform var(--gx-transition, 180ms ease);
}

.gxf-row > a:hover,
.gxf-row > a:focus-visible,
.gxf-links > a:hover,
.gxf-links > a:focus-visible,
.gxf-trigger:hover,
.gxf-trigger:focus-visible {
  color: var(--gxf-ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  outline: none;
}

/* A config-hidden footer link (navbar visibility) must vanish from the row. */
.gxf-links > a.hidden,
.gxf-links > a[hidden] {
  display: none;
}

/* ------------------------------------------------------------- social ----- */

.gxf-row > a.gxf-social {
  color: var(--gxf-violet);
}

.gxf-row > a.gxf-social:hover,
.gxf-row > a.gxf-social:focus-visible {
  color: #c4adff;
  text-decoration-color: rgba(168, 121, 255, 0.55);
}

.gxf-social svg {
  display: block;
  width: 15px;
  height: 15px;
  flex: none;
}

/* ---------------------------------------------------------------- note ---- */

.gxf-note {
  max-width: 64ch;
  margin: 1.15rem auto 0;
  text-align: center;
  color: var(--gxf-faint);
  font-size: 0.8rem;
  line-height: 1.65;
}

/* --------------------------------------------- Collections popup ---------- */
/* Trigger is now plain row type; the panel itself is unchanged (floats
   upward — the footer sits at the bottom of the document). */

.gxf-menu-wrap {
  position: relative;
}

.gxf-trigger {
  gap: 0.38rem;
  transition: color var(--gx-transition, 180ms ease);
}

.gxf-trigger[aria-expanded='true'] {
  color: var(--gxf-ink);
}

.gxf-chevron {
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0.55;
  transition: transform var(--gx-transition, 180ms ease),
    opacity var(--gx-transition, 180ms ease);
}

.gxf-trigger[aria-expanded='true'] .gxf-chevron {
  transform: rotate(225deg) translate(-2px, -2px);
  opacity: 0.9;
}

.gxf-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(10px) scale(0.96);
  min-width: 15rem;
  max-width: min(20rem, calc(100vw - 2.5rem));
  max-height: min(58vh, 23rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: var(--gxf-panel);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.78), 0 2px 0 rgba(255, 255, 255, 0.05) inset;
  opacity: 0;
  visibility: hidden;
  transform-origin: 50% 100%;
  transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.25),
    visibility 0.2s;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.gxf-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Escape hatch: if the upward panel would climb past the top of the viewport,
   js/footer.js flips it below the trigger instead. */
.gxf-menu--down {
  top: calc(100% + 12px);
  bottom: auto;
  transform-origin: 50% 0;
}

.gxf-menu::-webkit-scrollbar {
  width: 6px;
}
.gxf-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
}

.gxf-menu-item {
  --c: var(--gxf-violet);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  overflow: hidden;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  color: #dcdce4;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

/* One accent per row, cycling — colour without ornament. */
.gxf-menu-item:nth-child(6n + 1) { --c: #d0a24f; }
.gxf-menu-item:nth-child(6n + 2) { --c: #4f7dff; }
.gxf-menu-item:nth-child(6n + 3) { --c: #ff5a4d; }
.gxf-menu-item:nth-child(6n + 4) { --c: #3ad39b; }
.gxf-menu-item:nth-child(6n + 5) { --c: var(--gxf-violet); }
.gxf-menu-item:nth-child(6n + 6) { --c: #f0c477; }

.gxf-menu-item::after {
  content: '';
  width: 5px;
  height: 5px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.gxf-menu-item:hover,
.gxf-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  outline: none;
}

.gxf-menu-item:hover::after,
.gxf-menu-item:focus-visible::after {
  opacity: 1;
  transform: scale(1);
}

.gxf-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 9px var(--c);
}

/* Material ripple: spawned by js/footer.js, cleaned up on animationend. */
.gxf-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.28);
  animation: gxf-ripple 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes gxf-ripple {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* The SPA hides the whole Collections entry when the list comes back empty.
   ID wins over the .gxf-menu-wrap rules above (and over the .hidden utility). */
#footer-collections-section.hidden {
  display: none;
}

/* ----------------------------------------------------------- responsive --- */

@media (max-width: 640px) {
  .gxf { padding-top: 1.6rem; padding-bottom: 2rem; }
  .gxf-row { gap: 0.45rem 1.15rem; }
  .gxf-row > a,
  .gxf-links > a,
  .gxf-trigger { font-size: 0.9rem; }
  .gxf-note { font-size: 0.76rem; margin-top: 1rem; }
  .gxf-menu {
    left: auto;
    right: -0.5rem;
    transform: translateY(10px) scale(0.96);
    min-width: min(16rem, calc(100vw - 2rem));
  }
  .gxf-menu.is-open { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .gxf-row > a,
  .gxf-links > a,
  .gxf-trigger,
  .gxf-menu,
  .gxf-menu-item,
  .gxf-chevron {
    transition-duration: 0.01ms !important;
  }
  .gxf-ripple {
    display: none;
  }
}
