/* ===================================
   Cortex -- Compliance Footer
   Shared by the in-flow app footer (_Layout) and the fixed slim bar
   (_LoginLayout). Reuses the design tokens from site.css :root.
   =================================== */

.cortex-compliance {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 2vw 1.5rem;
  color: var(--cortex-text-muted);
  font-family: var(--cortex-font-body);
  font-size: 0.85rem;
  line-height: 1.45;
  /* The scaffolded `.footer { white-space: nowrap }` in _Layout.cshtml.css
     inherits down here, so the legal warning ran as one ~1150px line — wider
     than a phone viewport, which produced the horizontal "swipe reveals empty
     space" overscroll on the range page (and any app-footer page) on mobile.
     Reset to normal so the warning wraps within its max-width on every width.
     (On desktop the text already fit the viewport, so this only fixes mobile
     and lets the warning finally respect its own max-width.) */
  white-space: normal;
}

.cortex-compliance-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.cortex-compliance-links a {
  color: var(--cortex-cyan);
  text-decoration: none;
  transition: color 0.3s;
}

.cortex-compliance-links a:hover {
  color: var(--cortex-purple);
}

.cortex-compliance-warning {
  margin: 0;
  max-width: 80ch;
  color: var(--cortex-text-muted);
}

/* ---- Range/index page: keep the footer below the fold ----
   The grid is capped at `max-height: calc(100vh - chrome)`. On wide desktops
   it's height-limited so the content ~= one viewport and the footer lands just
   below the fold. But on narrow/tall windows the grid becomes width-limited
   (square), comes up shorter than its max-height, and the in-flow footer creeps
   up into view, crowding the grid. Turn the range page into a sticky-footer
   column so the content always fills at least one viewport and the footer is
   pushed to just below the fold (scroll to reveal). Scoped via #range-viewer
   (the same pattern as range/layout.css) so Settings keeps its footer at the
   natural page bottom. */
body.cortex-app:has(#range-viewer) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.cortex-app:has(#range-viewer) > .container {
  flex: 1 0 auto;
}

/* ---- Fixed slim bar variant (login / landing pages) ----
   body.login-page is overflow:hidden, so an in-flow footer would be clipped.
   Pin it to the bottom and lift it above the landing hero's stacked layers. */
.cortex-compliance--bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 1.25rem;
  padding: 0.6rem 1.25rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  background: rgba(13, 22, 27, 0.82);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--cortex-border);
  font-size: 0.78rem;
}

.cortex-compliance--bar .cortex-compliance-warning {
  flex-basis: 100%;
  text-align: center;
  max-width: none;
  font-size: 0.72rem;
  opacity: 0.85;
}

/* Keep the fixed bar from covering the auth form CTA on short viewports. */
body.login-page {
  padding-bottom: 5.5rem;
}

@media (max-width: 575.98px) {
  /* Un-pin the bar on phones: let it flow in-document below the form so it
     scrolls out of the initial viewport and can never overlap the CTA. */
  .cortex-compliance--bar {
    position: static;
    justify-content: flex-start;
    gap: 0.3rem 1rem;
  }
  body.login-page {
    padding-bottom: 0;   /* no fixed bar to clear on mobile */
  }
}
