/* ============================================================
   HamTech Automation — cutting-edge layer
   Live hero (circuit-lava artwork, embers, circuit pulses),
   circuit-board services map, scroll progress, sudo easter egg.
   ============================================================ */

:root {
    --ce-orange: #ff7a2f;
    --ce-amber: #ffb347;
    --ce-ember: #ff4d00;
    --ce-board: #121212;
    --ce-line: rgba(255, 122, 47, 0.28);
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--ce-ember), var(--ce-orange), var(--ce-amber));
    box-shadow: 0 0 12px rgba(255, 122, 47, 0.8);
    z-index: 3000;
    pointer-events: none;
}

/* ============================================================
   HERO — live layers
   ============================================================ */
.hero-scene {
    position: absolute;
    inset: 0;
    z-index: 1;            /* above photo+overlay, below .container (z2) */
    overflow: hidden;
    pointer-events: none;
}

/* center scrim for copy legibility + edge vignette + slight overall calm-down */
.hero-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(46% 42% at 50% 46%, rgba(3, 1, 0, 0.78) 0%, rgba(3, 1, 0, 0.5) 58%, transparent 100%),
        radial-gradient(140% 130% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.82) 100%),
        linear-gradient(rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.34));
}

/* film grain over everything in the hero */
.hero-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}

/* --- aerial circuit-board-over-lava artwork --- */
.hero-board {
    position: absolute;
    inset: 0;
    background: #080302 url("../assets/img/hero-circuit-lava.jpg") center / cover no-repeat;
    filter: brightness(0.72) saturate(0.92);
}

/* --- current pulses riding the artwork's lines (above the scrim) --- */
.hero-traces { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.hero-traces path.lit {
    fill: none;
    stroke: rgba(255, 196, 100, 0.9);    /* hot amber surge over the orange lines */
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 60 620;
    stroke-dashoffset: 680;
    filter: drop-shadow(0 0 6px rgba(255, 120, 0, 0.9));
    animation: ce-trace 9s linear infinite;
}
.hero-traces path.lit.d2 { animation-delay: 2.8s; animation-duration: 12s; }
.hero-traces path.lit.d3 { animation-delay: 5.5s; animation-duration: 8.5s; }
.hero-traces path.lit.d4 { animation-delay: 1.6s; animation-duration: 10.5s; }
.hero-traces path.lit.d5 { animation-delay: 7s;   animation-duration: 11s; }
.hero-traces path.lit.d6 { animation-delay: 4.2s; animation-duration: 13s; }
.hero-traces circle {
    fill: rgba(255, 205, 120, 0.9);
    filter: drop-shadow(0 0 5px rgba(255, 110, 10, 0.8));
    animation: ce-node-pulse 4.6s ease-in-out infinite;
}
@keyframes ce-trace { to { stroke-dashoffset: 0; } }
@keyframes ce-node-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.7; }
}

/* --- ember canvas --- */
#hero-embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }

/* ============================================================
   SERVICES — circuit-board node map
   ============================================================ */
.circuit-board {
    position: relative;
    width: 100%;          /* full flex-basis inside Bootstrap's .row */
    max-width: 1000px;
    height: 800px;        /* room for all 10 nodes */
    margin: 0 auto;
    background:
        radial-gradient(60% 55% at 50% 50%, rgba(255, 122, 47, 0.06), transparent 70%),
        var(--ce-board);
    border: 1px solid rgba(255, 122, 47, 0.18);
    border-radius: 14px;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7), 0 18px 50px -20px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}
/* PCB grid texture */
.circuit-board::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 122, 47, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 122, 47, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
    pointer-events: none;
}

.cb-traces { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cb-traces path {
    fill: none;
    stroke: var(--ce-line);
    stroke-width: 2;
    stroke-linecap: round;
}
.cb-traces path.cb-powered {
    stroke: var(--ce-orange);
    filter: drop-shadow(0 0 6px rgba(255, 122, 47, 0.9));
}
.cb-traces .cb-pulse {
    fill: var(--ce-amber);
    filter: drop-shadow(0 0 6px rgba(255, 179, 71, 1));
}

/* --- core node --- */
.cb-core {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 132px;
    height: 132px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: radial-gradient(circle at 38% 32%, #2a2a2a, #131313 70%);
    border: 1.5px solid rgba(255, 122, 47, 0.65);
    box-shadow: 0 0 28px rgba(255, 122, 47, 0.35), inset 0 0 22px rgba(255, 77, 0, 0.18);
    z-index: 3;
}
.cb-core img { width: 56px; height: auto; filter: drop-shadow(0 0 6px rgba(255, 122, 47, 0.5)); }
.cb-core small {
    font-size: 0.58rem;
    letter-spacing: 0.22em;
    color: var(--ce-amber);
    font-weight: 700;
}
.cb-core::after {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 122, 47, 0.35);
    animation: ce-core-ring 3s ease-out infinite;
}
@keyframes ce-core-ring {
    0%   { transform: scale(0.92); opacity: 0.9; }
    100% { transform: scale(1.28); opacity: 0; }
}

/* --- service nodes --- */
.cb-node {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    width: 168px;
    min-height: 96px;
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    background: linear-gradient(160deg, #1d1d1d, #121212);
    border: 1px solid rgba(255, 122, 47, 0.3);
    border-radius: 10px;
    color: #eee;
    text-align: center;
    z-index: 3;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s ease, border-color 0.25s ease;
}
.cb-node i {
    font-size: 1.35rem;
    color: var(--ce-orange);
    transition: color 0.25s ease, text-shadow 0.25s ease;
}
.cb-node .cb-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.25;
}
.cb-node .cb-status {
    font-size: 0.56rem;
    letter-spacing: 0.24em;
    font-weight: 700;
    color: #5d5d5d;
    transition: color 0.25s ease;
}
.cb-node .cb-status::before {
    content: "● ";
    color: #4a4a4a;
    transition: color 0.25s ease;
}
.cb-node:hover,
.cb-node:focus-visible,
.cb-node.cb-on {
    transform: translate(-50%, -50%) scale(1.07);
    border-color: var(--ce-amber);
    box-shadow: 0 0 26px rgba(255, 122, 47, 0.5), inset 0 0 16px rgba(255, 77, 0, 0.12);
    outline: none;
    z-index: 4;
}
.cb-node:hover i, .cb-node:focus-visible i, .cb-node.cb-on i {
    color: var(--ce-amber);
    text-shadow: 0 0 14px rgba(255, 179, 71, 0.9);
}
.cb-node:hover .cb-status, .cb-node:focus-visible .cb-status, .cb-node.cb-on .cb-status { color: var(--ce-amber); }
.cb-node:hover .cb-status::before, .cb-node:focus-visible .cb-status::before, .cb-node.cb-on .cb-status::before { color: #3ddc84; }

.cb-hint {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    color: #8a8a8a;
    margin-top: 1.1rem;
    text-transform: uppercase;
}

/* --- mobile: stacked column with a spine --- */
@media (max-width: 767.98px) {
    .circuit-board {
        height: auto;
        padding: 26px 18px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .circuit-board::after {
        content: "";
        position: absolute;
        top: 30px;
        bottom: 30px;
        left: 50%;
        width: 2px;
        background: linear-gradient(180deg, transparent, var(--ce-line) 12%, var(--ce-line) 88%, transparent);
    }
    .cb-traces { display: none; }
    .cb-core { position: static; transform: none; order: -1; }
    .cb-node { position: static; transform: none; width: 100%; max-width: 320px; }
    .cb-node:hover, .cb-node:focus-visible, .cb-node.cb-on { transform: scale(1.03); }
}

/* ============================================================
   Trade Services banner (Northpath acquisition) + nav dot
   ============================================================ */
.nav-trade { position: relative; }
.nav-trade-dot {
    display: inline-block;
    width: 6px; height: 6px;
    margin: 0 0 8px 4px;
    border-radius: 50%;
    background: var(--ce-orange);
    box-shadow: 0 0 8px var(--ce-orange);
    animation: ce-node-pulse 2.8s ease-in-out infinite;
    vertical-align: middle;
}

.trade-banner {
    max-width: 1000px;
    margin: 2.2rem auto 0;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    background:
        radial-gradient(120% 200% at 100% 0%, rgba(255, 77, 0, 0.10), transparent 55%),
        var(--ce-board);
    border: 1px solid rgba(255, 122, 47, 0.35);
    border-radius: 12px;
    box-shadow: 0 0 34px -12px rgba(255, 122, 47, 0.4);
}
.trade-banner-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ce-amber);
    margin-bottom: 8px;
}
.trade-banner-eyebrow .tb-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ce-orange);
    box-shadow: 0 0 8px var(--ce-orange);
    animation: ce-node-pulse 2.8s ease-in-out infinite;
}
.trade-banner-text { flex: 1 1 420px; }
.trade-banner-text p { color: #cfc9c3; font-size: 0.95rem; line-height: 1.55; }
.trade-banner-text a { color: var(--ce-amber); }
.trade-banner-cta { flex: none; white-space: nowrap; }

/* ============================================================
   SUDO easter egg terminal
   ============================================================ */
.sudo-terminal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 5, 0.82);
    backdrop-filter: blur(4px);
}
.sudo-terminal.open { display: flex; }
.sudo-terminal-window {
    width: min(640px, 92vw);
    background: #0c0e0c;
    border: 1px solid rgba(61, 220, 132, 0.4);
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(61, 220, 132, 0.18);
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.84rem;
    color: #3ddc84;
    overflow: hidden;
}
.sudo-terminal-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    background: #111511;
    border-bottom: 1px solid rgba(61, 220, 132, 0.25);
    color: #7ee2a8;
    letter-spacing: 0.08em;
}
.sudo-terminal-bar button {
    background: none;
    border: 0;
    color: #7ee2a8;
    font: inherit;
    cursor: pointer;
}
.sudo-terminal-body {
    padding: 18px 18px 22px;
    min-height: 220px;
    white-space: pre-wrap;
    line-height: 1.55;
}
.sudo-terminal-body .cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #3ddc84;
    animation: ce-blink 1s steps(1) infinite;
    vertical-align: -2px;
}
@keyframes ce-blink { 50% { opacity: 0; } }

/* ============================================================
   Reduced motion — kill the show, keep the content
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-traces path.lit,
    .hero-traces circle,
    .cb-core::after { animation: none !important; }
    #hero-embers { display: none; }
}
