/* ============================================================================
   BRAINIX LP // bnx-fx.css  (CORE ENGINE STYLES)
   Pairs with bnx-fx.js. Every rule is gated by html.bnx-on / html.bnx-booting,
   so the page looks unchanged when the script is not loaded.
   1. Tone variables   2. Boot sequence   3. Background + rail
   4. Two-way reveal   5. Hero entrance   6. Phrase wrapping
   7. Reduced motion + print
   Section specific scenes live in bnx-scenes.css.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. TONE VARIABLES (crimson by default, cyan inside #execute-agent)
   --------------------------------------------------------------------------- */
@property --bnx-tone {
    syntax: '<color>';
    inherits: true;
    initial-value: #ff003c;
}

html.bnx-on {
    --bnx-tone: #ff003c;
    --bnx-tone-rgb: 255, 0, 60;
    --bnx-ease: cubic-bezier(0.16, 1, 0.3, 1);
    transition: --bnx-tone 0.7s ease;
}

html.bnx-on[data-bnx-tone='exec'] {
    --bnx-tone: #22d3ee;
    --bnx-tone-rgb: 34, 211, 238;
}

/* ---------------------------------------------------------------------------
   2. BOOT SEQUENCE
   --------------------------------------------------------------------------- */
html.bnx-booting,
html.bnx-booting body {
    background: #050508;
}

html.bnx-booting body > *:not(.bnx-boot) {
    visibility: hidden;
}

.bnx-boot {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: #050508;
    overflow: hidden;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bnx-boot-cv {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.bnx-boot-doc {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.32s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.bnx-boot.is-doc .bnx-boot-doc {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.bnx-boot-logo {
    font-family: 'Share Tech Mono', 'Inter', monospace;
    font-size: clamp(30px, 8vw, 60px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: #ffffff;
    text-shadow: 0 0 26px rgba(255, 0, 60, 0.55);
}

.bnx-boot-logo span {
    color: #ff003c;
    text-shadow: 0 0 18px #ff003c, 0 0 44px #c80064;
}

.bnx-boot-tag {
    margin-top: 12px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: #ff4d79;
}

.bnx-boot-skip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(22px, env(safe-area-inset-bottom));
    text-align: center;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    color: rgba(203, 213, 225, 0.42);
    pointer-events: none;
    animation: bnxSkipBlink 1.6s ease-in-out infinite;
}

.bnx-boot.bnx-boot-out {
    pointer-events: none;
    animation: bnxBootOut 0.66s cubic-bezier(0.7, 0, 0.2, 1) forwards;
}

.bnx-boot.bnx-boot-out .bnx-boot-doc {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.06);
    transition: opacity 0.4s ease 0.1s, transform 0.6s ease;
}

.bnx-boot.bnx-boot-out .bnx-boot-skip {
    display: none;
}

/* The overlay is peeled away from right to left with a slanted edge */
@keyframes bnxBootOut {
    0% { clip-path: polygon(0 0, 130% 0, 100% 100%, 0 100%); }
    100% { clip-path: polygon(0 0, 0 0, -30% 100%, 0 100%); }
}

@keyframes bnxSkipBlink {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* ---------------------------------------------------------------------------
   3. BACKGROUND CANVAS + TOP PROGRESS RAIL
   --------------------------------------------------------------------------- */
#bnx-bg {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* The legacy canvas is replaced by #bnx-bg */
html.bnx-on #neural-bg-canvas {
    display: none;
}

.bnx-rail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    pointer-events: none;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, #7b1fa2 0%, var(--bnx-tone, #ff003c) 100%);
    box-shadow: 0 0 12px var(--bnx-tone, #ff003c);
}

/* ---------------------------------------------------------------------------
   4. TWO-WAY REVEAL
   data-bnx-from='bottom' : enters from below (scrolling down)
   data-bnx-from='top'    : enters from above (scrolling up)
   --------------------------------------------------------------------------- */
html.bnx-on .reveal-left,
html.bnx-on .reveal-right,
html.bnx-on .reveal-up,
html.bnx-on [data-bnx-rv] {
    transition:
        opacity 0.7s var(--bnx-ease),
        transform 0.7s var(--bnx-ease),
        filter 0.7s ease;
    transition-delay: 0s;
}

html.bnx-on .reveal-left.is-visible,
html.bnx-on .reveal-right.is-visible,
html.bnx-on .reveal-up.is-visible,
html.bnx-on [data-bnx-rv].bnx-in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition-delay: calc(var(--bnx-i, 0) * 90ms);
}

/* hidden state : coming from below */
html.bnx-on .reveal-up:not(.is-visible),
html.bnx-on [data-bnx-rv]:not(.bnx-in) {
    opacity: 0;
    transform: translate3d(0, 38px, 0) !important;
}

html.bnx-on .reveal-left:not(.is-visible) {
    opacity: 0;
    transform: translate3d(-34px, 26px, 0) !important;
}

html.bnx-on .reveal-right:not(.is-visible) {
    opacity: 0;
    transform: translate3d(34px, 26px, 0) !important;
}

/* hidden state : coming from above */
html.bnx-on .reveal-up[data-bnx-from='top']:not(.is-visible),
html.bnx-on [data-bnx-rv][data-bnx-from='top']:not(.bnx-in) {
    transform: translate3d(0, -38px, 0) !important;
}

html.bnx-on .reveal-left[data-bnx-from='top']:not(.is-visible) {
    transform: translate3d(-34px, -26px, 0) !important;
}

html.bnx-on .reveal-right[data-bnx-from='top']:not(.is-visible) {
    transform: translate3d(34px, -26px, 0) !important;
}

/* Section headings never move : they only come into focus */
html.bnx-on .sec-header-split.reveal-up:not(.is-visible),
html.bnx-on .sec-header-split.reveal-up[data-bnx-from='top']:not(.is-visible),
html.bnx-on [data-bnx-rv='focus']:not(.bnx-in),
html.bnx-on [data-bnx-rv='focus'][data-bnx-from='top']:not(.bnx-in) {
    opacity: 0;
    transform: none !important;
    filter: blur(8px);
}

html.bnx-on .sec-header-split.reveal-up.is-visible,
html.bnx-on [data-bnx-rv='focus'].bnx-in {
    filter: blur(0);
}

/* Mobile : vertical motion only, so nothing can push the page sideways */
@media (max-width: 768px) {
    html.bnx-on .reveal-left:not(.is-visible),
    html.bnx-on .reveal-right:not(.is-visible),
    html.bnx-on .reveal-up:not(.is-visible),
    html.bnx-on [data-bnx-rv]:not(.bnx-in) {
        transform: translate3d(0, 28px, 0) !important;
    }

    html.bnx-on .reveal-left[data-bnx-from='top']:not(.is-visible),
    html.bnx-on .reveal-right[data-bnx-from='top']:not(.is-visible),
    html.bnx-on .reveal-up[data-bnx-from='top']:not(.is-visible),
    html.bnx-on [data-bnx-rv][data-bnx-from='top']:not(.bnx-in) {
        transform: translate3d(0, -28px, 0) !important;
    }

    html.bnx-on .sec-header-split.reveal-up:not(.is-visible),
    html.bnx-on .sec-header-split.reveal-up[data-bnx-from='top']:not(.is-visible),
    html.bnx-on [data-bnx-rv='focus']:not(.bnx-in),
    html.bnx-on [data-bnx-rv='focus'][data-bnx-from='top']:not(.bnx-in) {
        transform: none !important;
        filter: blur(6px);
    }

    html.bnx-on .reveal-left.is-visible,
    html.bnx-on .reveal-right.is-visible,
    html.bnx-on .reveal-up.is-visible,
    html.bnx-on [data-bnx-rv].bnx-in {
        transition-delay: calc(var(--bnx-i, 0) * 60ms);
    }
}

/* ---------------------------------------------------------------------------
   5. HERO ENTRANCE (plays once, right after the boot sequence)
   Uses the individual translate property so existing transforms stay intact.
   --------------------------------------------------------------------------- */
html.bnx-on .hero-kicker-bar,
html.bnx-on .hero-lead-copy,
html.bnx-on .hero-telemetry-deck {
    transition: opacity 0.8s ease, translate 0.8s var(--bnx-ease);
}

html.bnx-on .hero-kicker-bar { transition-delay: 0.05s; }
html.bnx-on .hero-lead-copy { transition-delay: 0.28s; }
html.bnx-on .hero-telemetry-deck { transition-delay: 0.42s; }

html.bnx-on:not(.bnx-ready) .hero-kicker-bar,
html.bnx-on:not(.bnx-ready) .hero-lead-copy,
html.bnx-on:not(.bnx-ready) .hero-telemetry-deck {
    opacity: 0;
    translate: 0 16px;
}

/* The crimson headline line lights up once. The heading itself never moves. */
html.bnx-on.bnx-ready .hero-main-title .crimson-grad {
    animation: bnxHeadFlash 1.5s ease-out 0.2s 1 both;
}

@keyframes bnxHeadFlash {
    0% { filter: brightness(1) drop-shadow(0 0 0 rgba(255, 0, 60, 0)); }
    28% { filter: brightness(1.85) drop-shadow(0 0 26px rgba(255, 0, 60, 0.85)); }
    100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255, 0, 60, 0)); }
}

/* ---------------------------------------------------------------------------
   6. PHRASE WRAPPING (no single orphan character on narrow screens)
   .bnx-ph      : one phrase, never broken inside
   .bnx-phrased : a heading whose text has been split into .bnx-ph spans
   --------------------------------------------------------------------------- */
.bnx-ph {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
}

@media (max-width: 768px) {
    html.bnx-on .bnx-phrased {
        font-size: clamp(19px, 5.6vw, 24px) !important;
        line-height: 1.5 !important;
        letter-spacing: -0.01em !important;
    }

    html.bnx-on .bnx-phrased .nowrap,
    html.bnx-on .bnx-phrased .bx-keep-line {
        display: inline !important;
        white-space: normal !important;
    }

    html.bnx-on .bnx-phrased .bnx-ph {
        display: inline-block !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 380px) {
    html.bnx-on .bnx-phrased {
        font-size: 18px !important;
    }
}

/* ---------------------------------------------------------------------------
   7. REDUCED MOTION + PRINT
   --------------------------------------------------------------------------- */
html.bnx-reduced .reveal-left,
html.bnx-reduced .reveal-right,
html.bnx-reduced .reveal-up,
html.bnx-reduced [data-bnx-rv] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
}

html.bnx-reduced .hero-kicker-bar,
html.bnx-reduced .hero-lead-copy,
html.bnx-reduced .hero-telemetry-deck {
    opacity: 1 !important;
    translate: none !important;
    transition: none !important;
}

html.bnx-reduced .hero-main-title .crimson-grad {
    animation: none !important;
}

html.bnx-reduced .bnx-boot,
html.bnx-reduced .bnx-rail {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html.bnx-on {
        transition: none;
    }

    .bnx-boot-skip {
        animation: none;
    }
}

@media print {
    .bnx-boot,
    #bnx-bg,
    .bnx-rail {
        display: none !important;
    }

    html.bnx-booting body > *:not(.bnx-boot) {
        visibility: visible !important;
    }

    html.bnx-on .reveal-left,
    html.bnx-on .reveal-right,
    html.bnx-on .reveal-up,
    html.bnx-on [data-bnx-rv],
    html.bnx-on .hero-kicker-bar,
    html.bnx-on .hero-lead-copy,
    html.bnx-on .hero-telemetry-deck {
        opacity: 1 !important;
        transform: none !important;
        translate: none !important;
        filter: none !important;
    }
}
