/* ============================================================
   Business Systems — "The Nervous System" (Connect module)
   Steward: S9 Engineering   Page: notion-based-operating-systems.html
   Sprint 10 (Phase 2, v3.1, M1b) signature experience. Additive,
   scoped IIFE + this sheet, deletable unit. Does not touch
   main.js, theme.js, or any other namespace. Absorbs the honest
   content of the retired solutions .bsx- scene (business functions
   + their state changes), authored fresh here under .cnt- and
   driven by visitor-triggered propagation instead of an auto-loop.

   Motion: ratified grammar, cubic-bezier(0.22, 1, 0.36, 1),
   GPU-only (transform/opacity). Nothing moves until the visitor
   triggers an event; the propagation runs once per trigger and
   settles — never a perpetual loop, and never a fragments-into-a-
   core consolidation (that motif is Studio's). Reduced motion
   renders a completed propagation's connected end-state, static.
   ============================================================ */

/* --- Hero soft cue --- */
.cnt-soft-cue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease, gap 0.2s ease;
}
.cnt-soft-cue:hover,
.cnt-soft-cue:focus-visible { color: var(--text-primary); gap: 9px; }
.cnt-soft-cue i { width: 16px; height: 16px; }

/* --- sr-only for the aria-live propagation narration --- */
.cnt-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Stage layout --- */
.cnt-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: center;
    max-width: 960px;
    margin: 40px auto 0;
}
@media (min-width: 860px) {
    .cnt-stage { grid-template-columns: 1.35fr 1fr; gap: 36px; }
}

/* --- The relational web --- */
.cnt-web {
    border: 1px solid var(--border-hairline, var(--border));
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 16px 16px 12px;
}
.cnt-svg { width: 100%; height: auto; display: block; color: var(--text-primary); }

/* resting links: a calm connected web (already connected — no chaos) */
.cnt-link {
    stroke: currentColor;
    stroke-opacity: 0.12;
    stroke-width: 1.2;
    transition: stroke-opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
}
.cnt-link.is-lit { stroke: var(--accent); stroke-opacity: 0.85; stroke-width: 1.8; }

/* nodes */
.cnt-node-box {
    fill: var(--surface-glass);
    stroke: currentColor;
    stroke-opacity: 0.28;
    stroke-width: 1.2;
    transition: stroke 0.25s ease, stroke-opacity 0.25s ease, fill 0.25s ease;
}
.cnt-node-name {
    fill: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    transition: fill 0.25s ease;
}
.cnt-node-conseq {
    fill: var(--success);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 7.5px;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* the source of a change */
.cnt-node.is-source .cnt-node-box {
    stroke: var(--accent);
    stroke-opacity: 1;
    fill: color-mix(in srgb, var(--accent) 12%, var(--surface-glass));
}
.cnt-node.is-source .cnt-node-name { fill: var(--accent-text, var(--accent)); }

/* a function the change reached */
.cnt-node.is-hit .cnt-node-box { stroke: var(--success); stroke-opacity: 0.9; }
.cnt-node.is-hit .cnt-node-name { transform: translateY(-4px); }
.cnt-node.is-hit .cnt-node-conseq { opacity: 1; }
.cnt-node-name { transition: fill 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1); }

/* the signal pulse emitted from the source */
.cnt-pulse {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}
.cnt-pulse.is-firing { animation: cnt-pulse 0.7s ease-out; }
@keyframes cnt-pulse {
    0% { opacity: 0.55; transform: scale(0.4); }
    100% { opacity: 0; transform: scale(1.9); }
}

/* the truth-line (visible, concise) + belief */
.cnt-truth {
    margin: 12px 2px 0;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
    color: var(--text-muted);
    min-height: 1.4em;
    transition: color 0.2s ease;
}
.cnt-truth.is-set { color: var(--success-text); }

/* --- Controls --- */
.cnt-controls-head {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 14px;
}
.cnt-events { display: flex; flex-direction: column; gap: 10px; }

.cnt-event {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--border-hairline, var(--border));
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.cnt-event:hover { border-color: var(--accent); transform: translateX(2px); }
.cnt-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cnt-event.is-active { border-color: var(--accent); background: var(--surface-hover); }
.cnt-event-title { font-weight: 600; font-size: 0.98rem; color: var(--text-primary); }
.cnt-event-sub {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem; letter-spacing: 0.04em; color: var(--text-muted);
}

.cnt-belief {
    margin: 18px 0 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Supporting notes --- */
.cnt-notes { max-width: 720px; margin: 44px auto 0; display: flex; flex-direction: column; gap: 14px; }
.cnt-note { display: flex; align-items: flex-start; gap: 12px; margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--text-secondary); }
.cnt-note i { width: 18px; height: 18px; color: var(--accent-text, var(--accent)); flex-shrink: 0; margin-top: 2px; }
.cnt-note a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }

/* --- CTA --- */
.cnt-cta { max-width: 640px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cnt-cta-actions { margin-top: 18px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }

/* --- Mobile sticky-CTA guard (Sprints 3-6 pattern) --- */
.cnt-hide-sticky .mobile-sticky-cta { opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }

@media (max-width: 600px) {
    .cnt-web { padding: 12px 10px 8px; }
    .cnt-event { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .cnt-link, .cnt-node-box, .cnt-node-name, .cnt-node-conseq, .cnt-event, .cnt-soft-cue, .cnt-truth { transition: none; }
    .cnt-pulse.is-firing { animation: none; opacity: 0; }
    .cnt-node.is-hit .cnt-node-name { transform: translateY(-4px); }
}
