/* home-act5.css — act 05 · "AI that builds the next AI." (#hm-act5)
   The forge session: the core receives a field, forges a verified
   specialist, the specialist solves and stands up its own helper —
   the constellation grows. Every selector is hm5-prefixed; no bare
   state classes (this block sits inside the global .act grid). */

#hm-act5 .hm5-stage {
    position: relative;
    height: clamp(258px, 26vw, 330px);
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* faint constellation lattice — right side only */
#hm-act5 .hm5-stage::before {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(26, 26, 23, 0.14) 1px, transparent 1.5px);
    background-size: 26px 26px;
    -webkit-mask-image: linear-gradient(90deg, transparent 36%, #000 62%);
    mask-image: linear-gradient(90deg, transparent 36%, #000 62%);
    pointer-events: none;
}

/* ---- honesty tag: this is vision, not shipped product ------- */
#hm-act5 .hm5-corner {
    position: absolute; top: 8px; right: 0; z-index: 5;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
    color: var(--color-muted, #6c6b61);
    border: 1px solid rgba(26, 26, 23, 0.14);
    border-radius: 999px;
    padding: 4px 10px;
    background: var(--color-bg, #f5f4ef);
}

/* ---- end-beat glow over the constellation ------------------- */
#hm-act5 .hm5-glow {
    position: absolute; left: 73%; top: 46%; z-index: 0;
    width: 58%; height: 130%;
    transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, rgba(217, 84, 43, 0.16), transparent 72%);
    opacity: 0; pointer-events: none;
}
#hm-act5 .hm5-glow.hm5-glow-on { animation: hm5-glowpulse 1.5s ease; }
@keyframes hm5-glowpulse { 0% { opacity: 0; } 35% { opacity: 1; } 100% { opacity: 0; } }

/* ---- link lines (px coords set by JS, resize-relaid) -------- */
#hm-act5 .hm5-links {
    position: absolute; inset: 0; z-index: 1;
    width: 100%; height: 100%;
    pointer-events: none; overflow: visible;
}
#hm-act5 .hm5-links .hm5-line {
    stroke: rgba(26, 26, 23, 0.18); stroke-width: 1;
    opacity: 0; transition: opacity 0.5s ease;
}
#hm-act5 .hm5-links .hm5-line.hm5-line-on { opacity: 1; }
#hm-act5 .hm5-links .hm5-line--tether { stroke-dasharray: 2 5; }
#hm-act5 .hm5-links .hm5-line--branch { stroke-dasharray: 3 4; stroke: rgba(26, 26, 23, 0.26); }
#hm-act5 .hm5-links .hm5-line--skill  { stroke: rgba(217, 84, 43, 0.55); }

/* ---- the core: a small ringed engine (click = fast-forward) - */
#hm-act5 .hm5-core {
    position: absolute; left: 13%; top: 46%; z-index: 4;
    width: 64px; height: 64px; margin: -32px 0 0 -32px;
    padding: 0; border: 0; background: none; border-radius: 50%;
    cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
#hm-act5 .hm5-core[disabled] { cursor: default; }
#hm-act5 .hm5-core:focus-visible { outline: 2px solid var(--accent, #d9542b); outline-offset: 3px; }
#hm-act5 .hm5-ring { position: absolute; border-radius: 50%; pointer-events: none; }
#hm-act5 .hm5-ring--a { inset: 9px; border: 1px solid rgba(26, 26, 23, 0.30); }
#hm-act5 .hm5-ring--b {
    inset: 1px; border: 1px dashed rgba(217, 84, 43, 0.55);
    animation: hm5-spin 9s linear infinite;
}
#hm-act5 .hm5-core:hover .hm5-ring--b { border-color: var(--accent, #d9542b); }
@keyframes hm5-spin { to { transform: rotate(360deg); } }
#hm-act5 .hm5-core-dot {
    position: absolute; left: 50%; top: 50%;
    width: 12px; height: 12px; margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: var(--accent, #d9542b);
    box-shadow: 0 0 12px rgba(217, 84, 43, 0.45);
}
#hm-act5 .hm5-core-cap {
    position: absolute; top: calc(100% + 7px); left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px; font-weight: 500; letter-spacing: 0.12em;
    color: var(--color-muted, #6c6b61);
    white-space: nowrap;
}
/* forge flare — one expanding ripple when a field is absorbed */
#hm-act5 .hm5-core::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid rgba(217, 84, 43, 0.6);
    opacity: 0; transform: scale(0.5);
    pointer-events: none;
}
#hm-act5 .hm5-core.hm5-flare::after { animation: hm5-flarewave 0.55s ease-out; }
@keyframes hm5-flarewave {
    0% { opacity: 0.9; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(1.75); }
}

/* ---- the incoming field chip -------------------------------- */
#hm-act5 .hm5-chip {
    position: absolute; left: 13%; top: 13%; z-index: 4;
    transform: translate(-50%, -50%);
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
    color: var(--color-text, #1a1a17);
    background: var(--color-bg, #f5f4ef);
    border: 1px solid rgba(26, 26, 23, 0.22);
    border-radius: 999px;
    padding: 5px 11px;
    white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease, top 0.45s cubic-bezier(0.55, 0, 0.7, 0.4),
                transform 0.45s cubic-bezier(0.55, 0, 0.7, 0.4);
}
#hm-act5 .hm5-chip svg { width: 12px; height: 12px; color: var(--accent, #d9542b); flex: none; }
#hm-act5 .hm5-chip.hm5-chip-in { opacity: 1; }
#hm-act5 .hm5-chip.hm5-chip-feed { top: 46%; opacity: 0; transform: translate(-50%, -50%) scale(0.55); }
#hm-act5 .hm5-snap, #hm-act5 .hm5-snap * { transition: none !important; }

/* ---- forged nodes ------------------------------------------- */
#hm-act5 .hm5-node {
    position: absolute; z-index: 3;
    width: 34px; height: 34px; margin: -17px 0 0 -17px;
    border-radius: 9px;
    background: var(--color-bg, #f5f4ef);
    border: 1px solid rgba(26, 26, 23, 0.26);
    box-shadow: 0 1px 0 rgba(26, 26, 23, 0.05);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: left 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), top 0.55s cubic-bezier(0.2, 0.7, 0.2, 1),
                opacity 0.3s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
#hm-act5 .hm5-node.hm5-in { opacity: 1; }
#hm-act5 .hm5-node > svg { width: 16px; height: 16px; color: var(--color-text, #1a1a17); display: block; }
#hm-act5 .hm5-node--spec { cursor: pointer; }
#hm-act5 .hm5-node--spec:hover, #hm-act5 .hm5-node--spec:focus-visible {
    border-color: var(--accent, #d9542b);
}
#hm-act5 .hm5-node--spec:focus-visible { outline: 2px solid var(--accent, #d9542b); outline-offset: 2px; }
#hm-act5 .hm5-node--helper {
    width: 22px; height: 22px; margin: -11px 0 0 -11px;
    border-radius: 6px;
}
#hm-act5 .hm5-node--helper > svg { width: 11px; height: 11px; color: var(--color-muted, #6c6b61); }

/* verify shimmer — nothing unverified joins */
#hm-act5 .hm5-node::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(115deg, transparent 32%, rgba(217, 84, 43, 0.35) 50%, transparent 68%);
    background-size: 220% 100%; background-position: 130% 0;
    background-repeat: no-repeat;
    opacity: 0; pointer-events: none;
}
#hm-act5 .hm5-node.hm5-verify { border-color: rgba(217, 84, 43, 0.5); }
#hm-act5 .hm5-node.hm5-verify::after { opacity: 1; animation: hm5-shimmer 0.65s linear infinite; }
@keyframes hm5-shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* attested badge */
#hm-act5 .hm5-badge {
    position: absolute; right: -5px; top: -5px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--color-success, #22c55e);
    color: #fff;
    font: 700 12px/16px var(--font-sans, system-ui, sans-serif);
    text-align: center;
    opacity: 0; transform: scale(0.4);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#hm-act5 .hm5-node.hm5-attested .hm5-badge { opacity: 1; transform: scale(1); }
#hm-act5 .hm5-node--helper .hm5-badge { width: 14px; height: 14px; font-size: 12px; line-height: 14px; right: -5px; top: -5px; }

/* stamp under a specialist */
#hm-act5 .hm5-node-tag {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    margin-top: 6px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
    color: var(--color-muted, #6c6b61);
    white-space: nowrap; pointer-events: none;
}
#hm-act5 .hm5-node-tag b { color: var(--color-success, #22c55e); font-weight: 600; }

/* micro tick rail — the specialist solving */
#hm-act5 .hm5-rail {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    margin-bottom: 6px;
    display: flex; gap: 3px;
    opacity: 0; transition: opacity 0.25s ease;
    pointer-events: none;
}
#hm-act5 .hm5-rail i { width: 8px; height: 3px; border-radius: 2px; background: rgba(26, 26, 23, 0.14); }
#hm-act5 .hm5-node.hm5-solving .hm5-rail { opacity: 1; }
#hm-act5 .hm5-node.hm5-solving .hm5-rail i { animation: hm5-tick 0.3s ease forwards; }
#hm-act5 .hm5-node.hm5-solving .hm5-rail i:nth-child(1) { animation-delay: 0.05s; }
#hm-act5 .hm5-node.hm5-solving .hm5-rail i:nth-child(2) { animation-delay: 0.3s; }
#hm-act5 .hm5-node.hm5-solving .hm5-rail i:nth-child(3) { animation-delay: 0.55s; }
@keyframes hm5-tick { to { background: var(--accent, #d9542b); } }

/* ---- end beat ----------------------------------------------- */
#hm-act5 .hm5-endbeat .hm5-node.hm5-docked {
    border-color: rgba(217, 84, 43, 0.6);
    box-shadow: 0 0 0 3px rgba(217, 84, 43, 0.10);
}
#hm-act5 .hm5-endline {
    position: absolute; left: 50%; bottom: 8px; z-index: 4;
    transform: translateX(-50%);
    margin: 0;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12.5px; font-weight: 500; letter-spacing: 0.04em;
    color: var(--color-muted, #6c6b61);
    white-space: nowrap;
    opacity: 0; transition: opacity 0.6s ease;
    pointer-events: none;
}
#hm-act5 .hm5-endline.hm5-on { opacity: 1; }

/* ---- specialist card ---------------------------------------- */
#hm-act5 .hm5-card {
    position: absolute; z-index: 6;
    width: 220px;
    background: var(--color-bg, #f5f4ef);
    border: 1px solid rgba(26, 26, 23, 0.22);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 14px 30px -16px rgba(26, 26, 23, 0.4);
    opacity: 0; pointer-events: none;
    transform: translate(-50%, -100%);
    transition: opacity 0.18s ease;
    -webkit-user-select: text; user-select: text;
}
#hm-act5 .hm5-card.hm5-on { opacity: 1; pointer-events: auto; }
#hm-act5 .hm5-card.hm5-card--below { transform: translate(-50%, 0); }
#hm-act5 .hm5-card-field {
    display: block;
    font: 600 13px/1.3 var(--font-sans, system-ui, sans-serif);
    letter-spacing: -0.01em;
    color: var(--color-text, #1a1a17);
    margin-bottom: 5px;
}
#hm-act5 .hm5-card-row {
    display: block;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px; font-weight: 500; line-height: 1.6;
    color: var(--color-muted, #6c6b61);
}
#hm-act5 .hm5-card-row i { font-style: normal; opacity: 0.75; }
#hm-act5 .hm5-ok { color: var(--color-success, #22c55e); font-weight: 600; }

/* ---- loop clearing ------------------------------------------ */
#hm-act5 .hm5-clearing .hm5-node,
#hm-act5 .hm5-clearing .hm5-links .hm5-line,
#hm-act5 .hm5-clearing .hm5-endline,
#hm-act5 .hm5-clearing .hm5-chip { opacity: 0 !important; transition: opacity 0.4s ease; }

/* ---- fast-forward (core click) ------------------------------ */
#hm-act5.hm5-fast .hm5-stage *,
#hm-act5.hm5-fast .hm5-stage *::before,
#hm-act5.hm5-fast .hm5-stage *::after {
    transition-duration: 0.01s !important;
    animation-duration: 0.01s !important;
}

/* ---- reduced motion: static full constellation -------------- */
@media (prefers-reduced-motion: reduce) {
    #hm-act5 .hm5-ring--b,
    #hm-act5 .hm5-core::after,
    #hm-act5 .hm5-glow,
    #hm-act5 .hm5-node::after,
    #hm-act5 .hm5-rail i { animation: none !important; }
    #hm-act5 .hm5-node,
    #hm-act5 .hm5-chip,
    #hm-act5 .hm5-links .hm5-line { transition: none !important; }
}

/* ---- small screens ------------------------------------------ */
@media (max-width: 560px) {
    #hm-act5 .hm5-node-tag { display: none; }
    #hm-act5 .hm5-chip { left: 4px; transform: translate(0, -50%); font-size: 12px; }
    #hm-act5 .hm5-chip.hm5-chip-feed { left: 13%; transform: translate(-50%, -50%) scale(0.55); }
    #hm-act5 .hm5-endline { white-space: normal; text-align: center; width: 92%; font-size: 12px; }
    #hm-act5 .hm5-corner { font-size: 12px; padding: 3px 8px; }
}
