/* ==========================================================================
   WarspectClient Portal — Base, Typography, Navigation & Footer
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-ground);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.62;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0;
}

p {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 1.5px 6px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--brand-600);
  color: #fff;
}

::-webkit-scrollbar {
  width: 9px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--bg-ground);
}

::-webkit-scrollbar-thumb {
  background: #2c1418;
  border-radius: 999px;
  border: 2px solid var(--bg-ground);
}

::-webkit-scrollbar-thumb:hover {
  background: #5c1920;
}

/* Accessibility Helpers */
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skipLink {
  position: fixed;
  left: -9999px;
  top: 14px;
  z-index: 300;
  background: var(--brand-600);
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.skipLink:focus {
  left: 16px;
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Layout Utilities */
.shell {
  width: var(--shell);
  margin-inline: auto;
}

.accentText {
  color: var(--brand-500);
}

.accentGradient {
  background: linear-gradient(125deg, #ffffff 0%, #fecaca 45%, #ef4444 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tabularNums {
  font-variant-numeric: tabular-nums;
}

.section {
  position: relative;
  padding: clamp(58px, 7vw, 92px) 0;
}

.sectionAlt {
  background:
    linear-gradient(180deg, rgba(15, 17, 24, 0.5) 0%, rgba(10, 11, 16, 0.92) 100%);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.sectionHead {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px 36px;
  align-items: end;
  margin-bottom: clamp(28px, 3.6vw, 42px);
}

.sectionHead.compact {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.sectionHead h2 {
  margin-top: 10px;
  font-size: clamp(27px, 3.3vw, 40px);
  line-height: 1.08;
  font-weight: 700;
}

.sectionHead p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
  justify-self: end;
  max-width: 460px;
}

/* ==========================================================================
   Unified Sticky Header
   ========================================================================== */

.siteHeader {
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: var(--header-h);
  background: rgba(5, 5, 7, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}

.siteHeader::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(239, 68, 68, 0.45) 50%, transparent 95%);
  opacity: 0.75;
  pointer-events: none;
}

.siteHeader.is-scrolled {
  background: rgba(5, 5, 7, 0.92);
  border-bottom-color: var(--border-default);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
}

.navWrap {
  width: var(--shell);
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brandLogo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity var(--t-fast) ease;
}

.brandLogo:hover {
  opacity: 0.92;
}

.brandLogo img {
  width: 136px;
  height: auto;
}

.brandBadge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239, 68, 68, 0.42);
  background: rgba(220, 38, 38, 0.14);
  color: #fca5a5;
}

.navPill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--rim-top);
}

.navPill > a {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--t-fast) ease, background var(--t-fast) ease, box-shadow var(--t-fast) ease;
  white-space: nowrap;
}

.navPill > a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}

.navPill > a.active {
  color: #fff;
  font-weight: 600;
  background: rgba(220, 38, 38, 0.18);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.42);
}

.headerActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.versionPill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 17, 24, 0.9);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color var(--t-fast) ease, color var(--t-fast) ease, background var(--t-fast) ease;
  white-space: nowrap;
}

.versionPill:hover {
  border-color: var(--border-brand);
  background: rgba(220, 38, 38, 0.1);
  color: #fff;
}

.statusDot,
.pulseDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.statusDot {
  background: var(--emerald-500);
  box-shadow: 0 0 9px rgba(16, 185, 129, 0.85);
}

.pulseDot {
  background: var(--brand-500);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulseBrand 2.2s infinite;
}

@keyframes pulseBrand {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.menuButton,
.mobileNavActions {
  display: none;
}

/* ==========================================================================
   Subpage Hero Framing
   ========================================================================== */

.pageHero {
  position: relative;
  padding: calc(var(--header-h) + 46px) 0 48px;
  background:
    radial-gradient(ellipse 68% 58% at 18% 0%, rgba(220, 38, 38, 0.18), transparent 68%),
    radial-gradient(ellipse 46% 42% at 88% 12%, rgba(220, 38, 38, 0.08), transparent 62%),
    var(--bg-ground);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.pageHero .shell {
  position: relative;
  z-index: 2;
}

.gridBackdrop {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 0%, #000 10%, transparent 92%);
  mask-image: radial-gradient(ellipse 85% 75% at 50% 0%, #000 10%, transparent 92%);
  pointer-events: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.breadcrumb a {
  transition: color var(--t-fast) ease;
}

.breadcrumb a:hover {
  color: #fff;
}

.breadcrumb span[aria-current="page"] {
  color: var(--brand-400);
  font-weight: 600;
}

.pageHero h1 {
  margin-top: 12px;
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 820px;
}

.pageHeroLead {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 16px;
  max-width: 650px;
  line-height: 1.65;
}

/* ==========================================================================
   404 Error State
   ========================================================================== */

.errorStage {
  padding: calc(var(--header-h) + 84px) 0 110px;
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse 60% 55% at 50% 15%, rgba(220, 38, 38, 0.16), transparent 68%),
    var(--bg-ground);
}

.errorStage .shell {
  position: relative;
  z-index: 2;
}

.errorCode {
  font-family: var(--font-mono);
  font-size: clamp(72px, 12vw, 132px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.06em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(239, 68, 68, 0.35) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 12px 0 14px;
}

.errorStage h1 {
  font-size: clamp(26px, 3.6vw, 40px);
  margin-inline: auto;
  max-width: 620px;
}

.errorStage p {
  margin: 14px auto 0;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 15.5px;
}

.errorActions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ==========================================================================
   Unified Footer
   ========================================================================== */

.siteFooter {
  position: relative;
  background: #040406;
  padding-top: 62px;
  border-top: 1px solid var(--border-subtle);
}

.siteFooter::before {
  content: "";
  position: absolute;
  inset: -1px 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent 8%, rgba(239, 68, 68, 0.35) 50%, transparent 92%);
  pointer-events: none;
}

.footerGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  padding-bottom: 46px;
}

.footerCol {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.footerBrandDesc {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 340px;
  margin-top: 6px;
}

.footerStatusPill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.footerTitle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.footerLink {
  color: var(--text-secondary);
  font-size: 13.5px;
  transition: color var(--t-fast) ease, transform var(--t-fast) ease;
}

.footerLink:hover {
  color: #fff;
  transform: translateX(2px);
}

.footerBottom {
  border-top: 1px solid var(--border-subtle);
  padding: 20px 0 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.footerLegal {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footerLegal a {
  transition: color var(--t-fast) ease;
}

.footerLegal a:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   Base Responsive Breakpoints
   ========================================================================== */

@media (max-width: 980px) {
  .sectionHead {
    grid-template-columns: minmax(0, 1fr);
  }
  .sectionHead p {
    justify-self: start;
    max-width: 600px;
  }
  .footerGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .headerActions {
    display: none;
  }

  .menuButton {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    padding: 0 10px;
    cursor: pointer;
    transition: border-color var(--t-fast) ease, background var(--t-fast) ease;
  }

  .menuButton:hover {
    border-color: var(--border-strong);
  }

  .menuButton span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform var(--t-base) var(--ease-out), opacity var(--t-fast) ease;
  }

  .menuButton[aria-expanded="true"] span:first-child {
    transform: translateY(3.5px) rotate(45deg);
  }

  .menuButton[aria-expanded="true"] span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
  }

  .navPill {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--border-default);
    background: rgba(5, 5, 7, 0.97);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    flex-direction: column;
    align-items: stretch;
    padding: 16px var(--container-pad) 20px;
    gap: 8px;
    display: none;
    box-shadow: var(--shadow-lg);
  }

  .navPill.open {
    display: flex;
  }

  .navPill > a {
    padding: 11px 14px;
    font-size: 15px;
  }

  .mobileNavActions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-subtle);
  }

  .footerGrid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
