/* ============================================================================
   BRAINIX LP // bnx-scenes.css  (SECTION SCENE STYLES)
   Pairs with bnx-scenes.js. Load after bnx-fx.css.
   Rest state of every diagram is the finished look. Loops run only while
   the element carries .bnx-play (never set under reduced motion).
   ============================================================================ */

/* ---------------------------------------------------------------------------
   0. CARD TRANSITIONS (restores hover lift + smooth border / shadow)
   --------------------------------------------------------------------------- */
html.bnx-on .bento-6grid > .bento-module,
html.bnx-on .workflow-3steps > .wf-step-card {
    transition:
        opacity 0.7s var(--bnx-ease),
        transform 0.7s var(--bnx-ease),
        filter 0.7s ease,
        translate 0.25s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

html.bnx-on .bento-6grid > .bento-module.is-visible,
html.bnx-on .workflow-3steps > .wf-step-card.is-visible {
    transition-delay:
        calc(var(--bnx-i, 0) * 90ms),
        calc(var(--bnx-i, 0) * 90ms),
        calc(var(--bnx-i, 0) * 90ms),
        0s, 0s, 0s;
}

html.bnx-on .bento-6grid > .bento-module:hover { translate: 0 -4px; }

/* ---------------------------------------------------------------------------
   1. SIMULATOR
   --------------------------------------------------------------------------- */
.bnx-sim.bnx-play { animation: bnxSimOn 1.5s ease-out 1; }

@keyframes bnxSimOn {
    0% { border-color: rgba(255, 0, 60, 0.12); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.92), 0 0 0 rgba(255, 0, 60, 0); }
    30% { border-color: #ff5c8a; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.92), 0 0 90px rgba(255, 0, 60, 0.6); }
    100% { border-color: rgba(255, 0, 60, 0.48); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.92), 0 0 50px rgba(255, 0, 60, 0.22); }
}

html.bnx-on:not(.bnx-reduced) .sim-mode-btn.bnx-pulse { animation: bnxPulse 1.8s ease-out infinite; }

@keyframes bnxPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 60, 0.7); }
    70%, 100% { box-shadow: 0 0 0 12px rgba(255, 0, 60, 0); }
}

/* ---------------------------------------------------------------------------
   2. SECURITY BOX : only one line leaves the PC
   --------------------------------------------------------------------------- */
.bnx-vault {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: stretch;
    margin: 0 0 16px;
    padding: 16px;
    background: #0b0d14;
    border: 1px solid #282c3e;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    color: #e2e8f0;
}

.bnx-vault-pc {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid #ff003c;
    border-radius: 5px;
    background: rgba(255, 0, 60, 0.08);
    box-shadow: 0 0 22px rgba(255, 0, 60, 0.18);
}

.bnx-vault-pc b { color: #ffffff; font-size: 13px; }
.bnx-vault-pc span { padding: 3px 8px; background: #12141c; border: 1px solid #282c3e; border-radius: 3px; font-size: 11px; color: #cbd5e1; }

.bnx-vault-wires,
.bnx-vault-out { display: grid; grid-template-rows: 1fr 1fr; gap: 10px; min-width: 0; }

.bnx-vault-off,
.bnx-vault-ai { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }

.bnx-vault-wires em { order: -1; font-style: normal; font-size: 11px; }
.bnx-vault-off em { color: #7e8ba3; }
.bnx-vault-ai em { color: #ff4d79; }

.bnx-vault-wires i { display: block; position: relative; height: 2px; overflow: hidden; }
.bnx-vault-off i { background: repeating-linear-gradient(90deg, rgba(126, 139, 163, 0.5) 0 6px, transparent 6px 12px); }
.bnx-vault-ai i { background: rgba(255, 0, 60, 0.28); }

.bnx-vault-off u { align-self: flex-start; padding: 1px 8px; border: 1px solid #636b82; border-radius: 3px; font-size: 10.5px; color: #94a3b8; text-decoration: none; }

.bnx-vault-ai i::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 34%;
    background: linear-gradient(90deg, transparent, #ffffff, #ff2a5f, transparent);
    transform: translateX(-110%);
}

.bnx-vault.bnx-play .bnx-vault-ai i::after { animation: bnxWireX 2.8s ease-in-out infinite; }

@keyframes bnxWireX {
    0%, 55% { transform: translateX(-110%); }
    100% { transform: translateX(320%); }
}

@keyframes bnxWireY {
    0%, 55% { transform: translateY(-110%); }
    100% { transform: translateY(280%); }
}

.bnx-vault-out div { display: flex; align-items: center; padding: 8px 12px; border-radius: 4px; font-size: 11.5px; }
.bnx-vault-cloud { border: 1px dashed #3a4055; color: #636b82; text-decoration: line-through; }
.bnx-vault-api { border: 1px solid rgba(255, 0, 60, 0.55); background: rgba(255, 0, 60, 0.1); color: #ffffff; }

@media (max-width: 640px) {
    .bnx-vault { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .bnx-vault-pc { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .bnx-vault-pc b { width: 100%; }
    .bnx-vault-wires,
    .bnx-vault-out { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .bnx-vault-off,
    .bnx-vault-ai { align-items: center; justify-content: flex-start; text-align: center; }
    .bnx-vault-wires em { order: 0; }
    .bnx-vault-wires i { flex: none; width: 2px; height: 26px; }
    .bnx-vault-off i { background: repeating-linear-gradient(180deg, rgba(126, 139, 163, 0.5) 0 6px, transparent 6px 12px); }
    .bnx-vault-off u { align-self: center; }
    .bnx-vault-ai i::after { right: 0; bottom: auto; width: auto; height: 40%; background: linear-gradient(180deg, transparent, #ffffff, #ff2a5f, transparent); transform: translateY(-110%); }
    .bnx-vault.bnx-play .bnx-vault-ai i::after { animation-name: bnxWireY; }
    .bnx-vault-out div { justify-content: center; text-align: center; }
}

/* ---------------------------------------------------------------------------
   3. KNOWLEDGE PIPELINE
   --------------------------------------------------------------------------- */
.bnx-pipe .pipeline-pain-item,
.bnx-pipe .pipeline-gain-item {
    transition: opacity 0.6s ease, transform 0.6s var(--bnx-ease), filter 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
}

.bnx-pipe .pipeline-pain-item.bnx-sunk { opacity: 0.55; filter: grayscale(1); transform: translateY(5px) scale(0.985); }
.bnx-pipe .pipeline-gain-item:not(.bnx-lit) { opacity: 0.4; }
.bnx-pipe .pipeline-gain-item.bnx-lit { border-color: rgba(255, 0, 60, 0.6); box-shadow: 0 0 26px rgba(255, 0, 60, 0.2), inset 3px 0 0 #ff003c; }

.bnx-pipe .arrow-core-circle { transition: box-shadow 0.5s ease, transform 0.5s var(--bnx-ease), filter 0.5s ease; }
.bnx-pipe .pipeline-center-arrow:not(.bnx-fire) .arrow-core-circle { filter: grayscale(0.8) brightness(0.6); box-shadow: none; transform: scale(0.86); }
.bnx-pipe .pipeline-center-arrow.bnx-fire .arrow-core-circle { box-shadow: 0 0 0 8px rgba(255, 0, 60, 0.14), 0 0 54px rgba(255, 0, 60, 0.85); }

/* ---------------------------------------------------------------------------
   4. EXECUTE LOG
   --------------------------------------------------------------------------- */
.bnx-exlog {
    margin: 0 0 28px;
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 6px;
    background: rgba(4, 8, 12, 0.9);
    font-family: 'JetBrains Mono', 'Noto Sans JP', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    overflow: hidden;
}

.bnx-exlog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid rgba(34, 211, 238, 0.2); color: #22d3ee; font-size: 11px; font-weight: 800; letter-spacing: 2px; }
.bnx-exlog-head em { font-style: normal; font-weight: 700; letter-spacing: 0; color: #7e8ba3; }
.bnx-exlog.bnx-done .bnx-exlog-head span::after { content: ' // DONE'; color: #10b981; }

.bnx-exlog-body { display: grid; gap: 6px; padding: 12px 14px 6px; }
.bnx-exlog-line { display: flex; gap: 8px; color: #cbd5e1; opacity: 0.2; transition: opacity 0.35s ease, color 0.35s ease; }
.bnx-exlog-line i { flex: none; font-style: normal; color: #22d3ee; }
.bnx-exlog-line.bnx-on { opacity: 1; }
.bnx-exlog-line.bnx-cur { color: #ffffff; }
.bnx-exlog-line.bnx-cur span::after { content: ''; display: inline-block; width: 7px; height: 1em; margin-left: 4px; vertical-align: -2px; background: #22d3ee; animation: bnxCaret 0.8s steps(1) infinite; }

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

.bnx-exlog-bar { height: 2px; margin: 8px 14px 0; background: rgba(34, 211, 238, 0.14); }
.bnx-exlog-bar b { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--bnx-p, 1)); background: linear-gradient(90deg, #22d3ee, #ff2bd6); box-shadow: 0 0 10px #22d3ee; }

.bnx-exlog-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 14px; }
.bnx-exlog-file { padding: 5px 10px; border: 1px solid rgba(34, 211, 238, 0.4); border-radius: 3px; color: #e2e8f0; font-size: 11.5px; font-weight: 700; opacity: 0; transform: translateY(8px) scale(0.94); transition: opacity 0.35s ease, transform 0.45s var(--bnx-ease), background-color 0.35s ease; }
.bnx-exlog-file.bnx-on { opacity: 1; transform: none; }
.bnx-exlog.bnx-done .bnx-exlog-file { background-color: rgba(34, 211, 238, 0.12); }

/* ---------------------------------------------------------------------------
   5. CORE MODULES : wiring + living diagrams
   --------------------------------------------------------------------------- */
.bnx-wiregrid { position: relative; }
.bnx-wire { inset: 0; width: 100%; height: 100%; z-index: 0; overflow: visible; }
.bnx-wire path { fill: none; stroke-linejoin: round; }
.bnx-wire-base { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.bnx-wire-live { stroke: #ff003c; stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--bnx-p, 1)); }

.bnx-wiregrid > .bento-module::after {
    content: '';
    position: absolute;
    top: 14px;
    right: 14px;
    width: 7px;
    height: 7px;
    background: #ff003c;
    box-shadow: 0 0 12px #ff003c, 0 0 24px #c80064;
    opacity: 0;
    transform: rotate(45deg) scale(0);
    transition: opacity 0.4s ease, transform 0.5s var(--bnx-ease);
    pointer-events: none;
}

.bnx-wiregrid > .bento-module.bnx-wired { border-color: rgba(255, 0, 60, 0.36); }
.bnx-wiregrid > .bento-module.bnx-wired::after { opacity: 1; transform: rotate(45deg) scale(1); }

/* MODULE 01 */
.bnx-dg1-frag { display: block; }
.bnx-dg1.bnx-play .bnx-dg1-frag { animation: bnxDg1Frag 6s ease-out infinite both; animation-delay: calc(var(--bnx-i, 0) * 0.35s); }
.bnx-dg1.bnx-play .bnx-dg1-arrow,
.bnx-dg3.bnx-play .bnx-dg3-arrow { animation: bnxDgArrow 6s ease infinite both; }
.bnx-dg1.bnx-play .bnx-dg1-out { animation: bnxDg1Out 6s ease infinite both; }

@keyframes bnxDg1Frag {
    0% { opacity: 0; transform: translateX(-16px); }
    10%, 100% { opacity: 1; transform: none; }
}

@keyframes bnxDgArrow {
    0%, 24% { opacity: 0.25; }
    34% { opacity: 1; text-shadow: 0 0 14px #ff003c; }
    100% { opacity: 1; text-shadow: none; }
}

@keyframes bnxDg1Out {
    0%, 34% { opacity: 0.2; transform: scale(0.96); box-shadow: 0 0 0 rgba(255, 0, 60, 0); }
    46% { opacity: 1; transform: scale(1.02); box-shadow: 0 0 26px rgba(255, 0, 60, 0.55); }
    60%, 100% { opacity: 1; transform: none; box-shadow: 0 0 0 rgba(255, 0, 60, 0); }
}

/* MODULE 02 */
.bnx-dg2.bnx-play .bnx-dg2-row { animation: bnxDg2Row 6s ease infinite; animation-delay: calc(var(--bnx-i, 0) * 0.45s); }

@keyframes bnxDg2Row {
    0%, 16%, 100% { filter: none; text-shadow: none; }
    6% { filter: brightness(1.7); text-shadow: 0 0 12px currentColor; }
}

.bnx-dg2-status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.bnx-dg2-status span { padding: 3px 8px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 3px; font-size: 10.5px; font-weight: 800; color: #636b82; }
.bnx-dg2-status span:last-child { color: #10b981; border-color: rgba(16, 185, 129, 0.5); }

.bnx-dg2.bnx-play .bnx-dg2-status span { animation: bnxDg2Chip 6s steps(1) infinite; }
.bnx-dg2.bnx-play .bnx-dg2-status span:nth-child(1) { animation-delay: 2.4s; }
.bnx-dg2.bnx-play .bnx-dg2-status span:nth-child(2) { animation-delay: 3.6s; }
.bnx-dg2.bnx-play .bnx-dg2-status span:nth-child(3) { animation-name: bnxDg2Ok; animation-delay: 4.8s; }

@keyframes bnxDg2Chip {
    0% { color: #ffffff; border-color: #ff2a5f; background-color: rgba(255, 0, 60, 0.18); }
    20%, 100% { color: #636b82; border-color: rgba(255, 255, 255, 0.12); background-color: transparent; }
}

@keyframes bnxDg2Ok {
    0% { color: #ffffff; border-color: #10b981; background-color: rgba(16, 185, 129, 0.22); }
    20%, 100% { color: #636b82; border-color: rgba(255, 255, 255, 0.12); background-color: transparent; }
}

/* MODULE 03 */
.bnx-dg3.bnx-play .bnx-dg3-paper { animation: bnxDg3Wipe 6s ease-in-out infinite both; }

@keyframes bnxDg3Wipe {
    0%, 22% { clip-path: inset(0 100% 0 0); }
    46%, 100% { clip-path: inset(0 0 0 0); }
}

/* MODULE 04 */
.bnx-dg4.bnx-play .bnx-dg4-ai { animation: bnxDg4Pick 4.5s ease infinite; animation-delay: calc(var(--bnx-i, 0) * 1.5s); }

@keyframes bnxDg4Pick {
    0%, 30% { box-shadow: 0 0 0 2px #ffffff, 0 0 22px rgba(255, 255, 255, 0.35); transform: translateY(-2px); }
    36%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); transform: none; }
}

/* ---------------------------------------------------------------------------
   6. THREE STEPS
   --------------------------------------------------------------------------- */
.bnx-flow { position: relative; }
.bnx-flowline { top: -16px; left: 0; right: 0; height: 2px; background: rgba(255, 255, 255, 0.08); }
.bnx-flowline i { display: block; width: 100%; height: 100%; transform-origin: 0 0; transform: scaleX(var(--bnx-p, 1)); background: linear-gradient(90deg, #7b1fa2, #ff003c 60%, #22d3ee); box-shadow: 0 0 12px rgba(255, 0, 60, 0.7); }

.bnx-flow .wf-step-number { transition: opacity 0.5s ease; }
.bnx-flow .wf-step-card:not(.bnx-step-on) .wf-step-number { opacity: 0.3; }
.bnx-flow .wf-step-card.bnx-step-on { border-color: rgba(255, 0, 60, 0.5); border-left-color: #ff003c; box-shadow: 0 0 30px rgba(255, 0, 60, 0.16); }
.bnx-flow .wf-step-card.bnx-step-exec.bnx-step-on { border-color: rgba(34, 211, 238, 0.5); border-left-color: #22d3ee; box-shadow: 0 0 30px rgba(34, 211, 238, 0.18); }
.bnx-flow .wf-step-card.bnx-step-exec.bnx-step-on .wf-step-number { background-image: linear-gradient(95deg, #22d3ee, #ff2bd6); }

@media (max-width: 767px) {
    .bnx-flowline { top: 0; bottom: 0; left: -9px; right: auto; width: 2px; height: auto; }
    .bnx-flowline i { transform: scaleY(var(--bnx-p, 1)); background: linear-gradient(180deg, #7b1fa2, #ff003c 60%, #22d3ee); }
}

/* ---------------------------------------------------------------------------
   7. PRICING : break-even chart
   --------------------------------------------------------------------------- */
.bnx-be { max-width: 1080px; margin: 28px auto 0; padding: 22px 26px; background: rgba(14, 15, 23, 0.9); border: 1px solid rgba(255, 0, 60, 0.3); border-radius: 8px; }
.bnx-be-head span { display: block; margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 800; letter-spacing: 2px; color: #ff4d79; }
.bnx-be-head strong { display: block; font-size: clamp(15px, 1.7vw, 19px); font-weight: 900; line-height: 1.55; color: #ffffff; }

.bnx-be-plot { position: relative; height: clamp(130px, 22vw, 190px); margin-top: 18px; border-left: 1px solid rgba(255, 255, 255, 0.14); border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.bnx-be-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; clip-path: inset(-12px calc((1 - var(--bnx-p, 1)) * 100%) -12px 0); }
.bnx-be-buy { display: none; }
.bnx-be-sub { fill: none; stroke: #ff003c; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.bnx-be-tagbuy { position: absolute; left: 0; right: 0; padding: 4px 0 0 8px; border-top: 1px dashed rgba(11, 214, 245, 0.7); font-size: 11px; font-weight: 800; color: #0bd6f5; }
.bnx-be-tagsub { position: absolute; top: 0; right: 12%; font-size: 11px; font-weight: 800; color: #ff4d79; opacity: 0; transition: opacity 0.4s ease; }
.bnx-be-over .bnx-be-tagsub { opacity: 1; }

.bnx-be-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #ffffff; box-shadow: 0 0 0 4px rgba(255, 0, 60, 0.35), 0 0 18px #ff003c; transform: scale(0); transition: transform 0.4s var(--bnx-ease); }
.bnx-be-even .bnx-be-dot { transform: scale(1); }

.bnx-be-axis { position: relative; display: flex; justify-content: space-between; margin-top: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #7e8ba3; }
.bnx-be-axis-even { position: absolute; top: 0; transform: translateX(-50%); font-weight: 800; color: #ffffff; white-space: nowrap; }

.bnx-be-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.bnx-be-stats div { min-width: 0; padding: 10px 12px; background: #0b0d14; border: 1px solid #282c3e; border-radius: 5px; transition: border-color 0.4s ease, box-shadow 0.4s ease; }
.bnx-be-stats em { display: block; font-style: normal; font-size: 11px; font-weight: 700; color: #94a3b8; }
.bnx-be-stats b { display: block; font-family: 'JetBrains Mono', monospace; font-size: clamp(14px, 2.2vw, 22px); font-weight: 800; color: #ffffff; white-space: nowrap; transition: color 0.4s ease; }
.bnx-be-over .bnx-be-stats div:last-child { border-color: #ff003c; box-shadow: 0 0 22px rgba(255, 0, 60, 0.25); }
.bnx-be-over .bnx-be-d { color: #ff2a5f; }
.bnx-be-note { margin-top: 10px; font-size: 11.5px; color: #7e8ba3; }

@media (max-width: 640px) {
    .bnx-be { padding: 16px; }
    .bnx-be-stats { gap: 6px; }
    .bnx-be-stats div { padding: 8px 6px; }
    .bnx-be-stats em { font-size: 10px; }
}

/* ---------------------------------------------------------------------------
   8. CLOSING : fragments gather behind the final message
   --------------------------------------------------------------------------- */
.bnx-gather { inset: 0; z-index: 1; overflow: hidden; }

.bnx-gather i {
    position: absolute;
    left: calc(50% + var(--x) * 1%);
    top: calc(50% + var(--y) * 1%);
    width: 22px;
    height: 28px;
    margin: -14px 0 0 -11px;
    border: 1px solid rgba(255, 0, 60, 0.5);
    background: rgba(255, 0, 60, 0.07);
    opacity: 0.75;
    transform: rotate(var(--r));
    transition: left 1.1s var(--bnx-ease), top 1.1s var(--bnx-ease), transform 1.1s var(--bnx-ease), opacity 0.9s ease 0.25s;
}

.bnx-gather i:nth-child(3n) { border-color: rgba(192, 132, 252, 0.55); background: rgba(168, 85, 247, 0.07); }
.bnx-gathered .bnx-gather i { left: 50%; top: 50%; opacity: 0; transform: rotate(0deg) scale(0.3); }

.bnx-gather-core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 340px;
    height: 340px;
    margin: -170px 0 0 -170px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 0, 60, 0.3) 0%, rgba(123, 31, 162, 0.16) 40%, transparent 70%);
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.9s ease 0.3s, transform 1.2s var(--bnx-ease) 0.3s;
}

.bnx-gathered .bnx-gather-core { opacity: 1; transform: scale(1); }

/* ---------------------------------------------------------------------------
   9. PRINT
   --------------------------------------------------------------------------- */
@media print {
    .bnx-wire,
    .bnx-flowline,
    .bnx-gather { display: none !important; }

    .bnx-pipe .pipeline-pain-item,
    .bnx-pipe .pipeline-gain-item,
    .bnx-exlog-line,
    .bnx-exlog-file { opacity: 1 !important; transform: none !important; filter: none !important; }
}
