/* ==========================================================================
   Midnight Signal - tokens, reset, base type, layout, background system
   ========================================================================== */

:root {
  /* Ground ramp. Never introduce a fourth ground. */
  --bg: #071226;
  --surface: #0B1933;
  --surface-raised: #102347;

  /* Ink */
  --ink: #F4F7FF;
  --ink-muted: #AAB9D4;

  /* Action system. accent for text and strokes, accent-strong behind white. */
  --accent: #3678FF;
  --accent-strong: #1D5FE8;
  --accent-soft: rgba(54, 120, 255, 0.12);

  /* Atmosphere and data only. Never an action. */
  --indigo: #625BFF;
  --violet: #9065FF;
  --cyan: #28D7F2;

  /* Functional */
  --success: #2FBF8F;
  --warning: #F2B33D;
  --danger: #FF6B6B;

  --border: rgba(164, 190, 255, 0.14);
  --border-strong: rgba(164, 190, 255, 0.26);

  /* Type */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --space-xl: 64px;
  --space-xxl: 104px;

  /* Radius. Stated rule: panels 16, controls 10, badges pill. */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-pill: 999px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 760px;
  --gutter: 24px;
  --measure: 68ch;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Reset. Wrapped in :where() so specificity stays 0 and components always win.
   Astra element styles are neutralized here without stripping its stylesheet.
   -------------------------------------------------------------------------- */

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

:where(body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, pre) {
  margin: 0;
  padding: 0;
}

/* Astra styles bare lists with element-level selectors (list-style: disc plus a
   left margin), which outranks a :where() reset. This one has to beat it, so it
   is written at real specificity rather than zero. */
body.bcs :is(ul, ol) {
  list-style: none;
  margin: 0;
  padding: 0;
}

:where(blockquote, figure) { border: 0; }

:where(img, svg, video, iframe) {
  display: block;
  max-width: 100%;
  height: auto;
}

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

:where(a) { color: var(--accent); text-decoration: none; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset for the sticky nav when jumping to an anchor. */
  scroll-padding-top: 96px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body.bcs {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Headings: display face, tight leading, hierarchy from weight and color. */
body.bcs h1, body.bcs h2, body.bcs h3, body.bcs h4, body.bcs h5, body.bcs h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

body.bcs h1 { font-size: clamp(2.25rem, 1.35rem + 3.6vw, 3.9rem); line-height: 1.06; }
body.bcs h2 { font-size: clamp(1.75rem, 1.25rem + 1.9vw, 2.6rem); line-height: 1.1; }
body.bcs h3 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem); line-height: 1.18; letter-spacing: -0.01em; }
body.bcs h4 { font-size: 1.125rem; line-height: 1.3; letter-spacing: 0; }

/* Italic descenders need headroom at display sizes. */
body.bcs h1 em, body.bcs h2 em { font-style: italic; line-height: 1.14; padding-bottom: 0.06em; }

.lede {
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 56ch;
}

.label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.num {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Focus. Visible on every interactive element, on every ground. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Screen-reader only, and Astra's skip link restyled onto our palette. */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed !important;
  top: 12px; left: 12px;
  z-index: 200;
  width: auto !important; height: auto !important;
  margin: 0 !important;
  padding: 10px 18px;
  clip: auto !important;
  clip-path: none !important;
  background: var(--accent-strong);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Layout. One shared container across every section so left edges align.
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: var(--container-narrow); }

.section { padding-block: clamp(56px, 4vw + 36px, 104px); position: relative; }
.section--tight { padding-block: clamp(40px, 3vw + 24px, 68px); }
.section--divider { border-top: 1px solid var(--border); }

.stack > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }

.section-head { max-width: 58ch; margin-bottom: var(--space-lg); }
.section-head p { color: var(--ink-muted); margin-top: var(--space-md); }

/* Hairline divider list. Reached for before a card, per the direction. */
.rule-list { border-top: 1px solid var(--border); }
.rule-list > li {
  border-bottom: 1px solid var(--border);
  padding-block: var(--space-md);
}

/* --------------------------------------------------------------------------
   Background system. CSS and inline SVG only. No video, no particle library.
   -------------------------------------------------------------------------- */

.bcs-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Gradient wash plus a faint grid. */
.bcs-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 35, 71, 0.55) 0%, rgba(7, 18, 38, 0) 46%),
    linear-gradient(28deg, rgba(98, 91, 255, 0.10) 0%, rgba(7, 18, 38, 0) 58%);
}

.bcs-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(164, 190, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(164, 190, 255, 0.05) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 0%, transparent 78%);
}

/* Two soft glows. Violet and cyan, atmosphere only. */
.bcs-bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.bcs-bg__glow--violet {
  width: 46vw; height: 46vw;
  min-width: 420px; min-height: 420px;
  top: -16vw; right: -10vw;
  background: radial-gradient(circle, rgba(144, 101, 255, 0.34) 0%, rgba(144, 101, 255, 0) 70%);
  animation: bcs-drift-a 64s var(--ease) infinite alternate;
}

.bcs-bg__glow--cyan {
  width: 38vw; height: 38vw;
  min-width: 320px; min-height: 320px;
  top: 32vh; left: -14vw;
  background: radial-gradient(circle, rgba(40, 215, 242, 0.20) 0%, rgba(40, 215, 242, 0) 70%);
  animation: bcs-drift-b 78s var(--ease) infinite alternate;
}

@keyframes bcs-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-5%, 5%, 0) scale(1.09); }
}

@keyframes bcs-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6%, -4%, 0) scale(1.07); }
}

/* Fine network lines, inline SVG, pinned behind the hero. */
.bcs-bg__lines {
  position: absolute;
  top: 0; left: 50%;
  width: min(1600px, 132vw);
  transform: translateX(-50%);
  opacity: 0.34;
}

/* Everything the theme renders sits above the background layer. */
#page { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Scroll reveal. Degrades to visible when JS never runs, and stays visible
   under prefers-reduced-motion.
   -------------------------------------------------------------------------- */

html.js .reveal {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

html.js .reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal,
  html.js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .bcs-bg__glow { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Astra containment. We own the markup, so neutralize only its wrappers.
   -------------------------------------------------------------------------- */

body.bcs #content,
body.bcs .site-content,
body.bcs .ast-container {
  max-width: none;
  width: auto;
  padding: 0;
  margin: 0;
  display: block;
  background: transparent;
}

body.bcs #primary,
body.bcs .site-main,
body.bcs .entry-content {
  margin: 0;
  padding: 0;
  width: auto;
  max-width: none;
  background: transparent;
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .bcs-bg, .bcs-header, .bcs-footer, .toc { display: none !important; }
  body.bcs { background: #FFFFFF; color: #111111; }
  body.bcs h1, body.bcs h2, body.bcs h3 { color: #111111; }
}
