/* CLYD3 — C3 Constellation Index
   Refined navigation field: tighter geometry, quieter orbit system,
   route-specific interaction, and restrained motion. */

.constellation-shell {
    position: relative;
    min-height: 700px;
    margin-top: 20px;
    border-top: 1px solid var(--line);
    overflow: hidden;
}

.constellation-stage {
    position: relative;
    width: min(100%, 1040px);
    height: 620px;
    margin: 32px auto 0;
}

/* The two main orbits are intentionally not perfectly concentric. */
.constellation-stage::before,
.constellation-stage::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) rotate(-5deg);
}

.constellation-stage::before {
    width: 500px;
    height: 470px;
    border-radius: 48% 52% 49% 51%;
    background:
        conic-gradient(
            from 28deg,
            var(--line-soft) 0deg 76deg,
            transparent 76deg 102deg,
            var(--line-soft) 102deg 223deg,
            transparent 223deg 252deg,
            var(--line-soft) 252deg 338deg,
            transparent 338deg 360deg
        );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1px), #000 calc(100% - 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 1px), #000 calc(100% - 1px));
    opacity: .95;
}

.constellation-stage::after {
    width: 315px;
    height: 335px;
    border: 1px solid var(--line-soft);
    border-radius: 52% 48% 50% 50%;
    transform: translate(-50%, -50%) rotate(9deg);
    opacity: .88;
}

.constellation-crosshair {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.constellation-crosshair::before,
.constellation-crosshair::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    background: var(--line-soft);
    transform: translate(-50%, -50%);
}

.constellation-crosshair::before {
    width: 62%;
    height: 1px;
}

.constellation-crosshair::after {
    width: 1px;
    height: 66%;
}

.constellation-core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 102px;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--paper);
    z-index: 5;
    box-shadow: 0 0 0 1px var(--teal), 0 0 0 7px rgba(13,124,120,.045);
}

.constellation-core::before,
.constellation-core::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--teal);
    pointer-events: none;
}

.constellation-core::before {
    inset: -10px;
    opacity: .58;
    animation: constellationPulse 4.8s ease-in-out infinite;
}

.constellation-core::after {
    inset: -20px;
    opacity: .15;
}

.constellation-core-inner {
    display: grid;
    justify-items: center;
    gap: 3px;
}

.constellation-core strong {
    font-family: 'DM Mono', monospace;
    font-size: 16px;
    letter-spacing: .08em;
    font-weight: 500;
}

.constellation-core span {
    font-family: 'DM Mono', monospace;
    font-size: 7px;
    letter-spacing: .16em;
    text-transform: uppercase;
    opacity: .56;
}

.constellation-node {
    --node-color: var(--teal);
    position: absolute;
    z-index: 4;
    width: 250px;
    padding: 12px 10px 12px;
    border: 0;
    background: transparent;
    transition:
        opacity 220ms ease,
        transform 260ms cubic-bezier(.2,.7,.2,1);
}

.constellation-node:hover,
.constellation-node:focus-visible {
    outline: none;
}

.constellation-node--lab {
    --node-color: var(--crimson);
}

/* Pull the four pathways closer to the core for a tighter system. */
.constellation-node--top {
    left: 50%;
    top: 6%;
    transform: translateX(-50%);
}

.constellation-node--top:hover,
.constellation-node--top:focus-visible {
    transform: translate(-50%, -3px);
}

.constellation-node--left {
    left: 7%;
    top: 50%;
    transform: translateY(-50%);
}

.constellation-node--left:hover,
.constellation-node--left:focus-visible {
    transform: translate(3px, -50%);
}

.constellation-node--right {
    right: 7%;
    top: 50%;
    transform: translateY(-50%);
}

.constellation-node--right:hover,
.constellation-node--right:focus-visible {
    transform: translate(-3px, -50%);
}

.constellation-node--bottom {
    left: 50%;
    bottom: 6%;
    transform: translateX(-50%);
}

.constellation-node--bottom:hover,
.constellation-node--bottom:focus-visible {
    transform: translate(-50%, -3px);
}

/* Route lines + endpoint nodes. */
.constellation-node::before {
    content: '';
    position: absolute;
    background: var(--line);
    transition:
        background 220ms ease,
        box-shadow 220ms ease,
        opacity 220ms ease;
    pointer-events: none;
}

.constellation-node::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--node-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--node-color) 9%, transparent);
    transition:
        transform 220ms ease,
        box-shadow 220ms ease,
        opacity 220ms ease;
    pointer-events: none;
}

.constellation-node:hover::before,
.constellation-node:focus-visible::before {
    background: var(--node-color);
    box-shadow: 0 0 10px color-mix(in srgb, var(--node-color) 26%, transparent);
}

.constellation-node:hover::after,
.constellation-node:focus-visible::after {
    transform: scale(1.4);
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--node-color) 13%, transparent);
}

.constellation-node--top::before {
    width: 1px;
    height: 86px;
    left: 50%;
    top: calc(100% + 8px);
}

.constellation-node--top::after {
    left: calc(50% - 4px);
    top: calc(100% + 98px);
}

.constellation-node--bottom::before {
    width: 1px;
    height: 86px;
    left: 50%;
    bottom: calc(100% + 8px);
}

.constellation-node--bottom::after {
    left: calc(50% - 4px);
    bottom: calc(100% + 98px);
}

.constellation-node--left::before {
    height: 1px;
    width: 102px;
    left: calc(100% + 8px);
    top: 50%;
}

.constellation-node--left::after {
    left: calc(100% + 116px);
    top: calc(50% - 4px);
}

.constellation-node--right::before {
    height: 1px;
    width: 102px;
    right: calc(100% + 8px);
    top: 50%;
}

.constellation-node--right::after {
    right: calc(100% + 116px);
    top: calc(50% - 4px);
}

/* When a route is active, let it own the field and quiet the rest. */
.constellation-stage:has(.constellation-node:hover) .constellation-node:not(:hover),
.constellation-stage:has(.constellation-node:focus-visible) .constellation-node:not(:focus-visible) {
    opacity: .38;
}

.constellation-stage:has(.constellation-node:hover) .constellation-core,
.constellation-stage:has(.constellation-node:focus-visible) .constellation-core {
    box-shadow: 0 0 0 1px var(--teal), 0 0 0 9px rgba(13,124,120,.035);
}

.constellation-node-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    font-family: 'DM Mono', monospace;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: var(--soft-ink);
}

.constellation-node-meta span:first-child {
    color: var(--node-color);
}

.constellation-node h3 {
    margin: 0;
    font-size: clamp(33px, 3vw, 48px);
    line-height: .96;
    letter-spacing: -.05em;
    font-weight: 500;
    transition: color 220ms ease, transform 220ms ease;
}

.constellation-node:hover h3,
.constellation-node:focus-visible h3 {
    color: var(--node-color);
    transform: translateX(2px);
}

.constellation-node p {
    max-width: 225px;
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.55;
    color: var(--soft-ink);
}

.constellation-node-arrow {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 15px;
    color: var(--node-color);
    opacity: .7;
    transition: transform 220ms ease, opacity 220ms ease;
}

.constellation-node:hover .constellation-node-arrow,
.constellation-node:focus-visible .constellation-node-arrow {
    transform: translate(4px, -4px);
    opacity: 1;
}

.constellation-coordinates {
    position: absolute;
    font-family: 'DM Mono', monospace;
    font-size: 8px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--soft-ink);
    opacity: .68;
}

.constellation-coordinates--a { left: 12%; top: 12%; }
.constellation-coordinates--b { right: 10%; bottom: 10%; }
.constellation-coordinates--c { right: 8%; top: 16%; color: var(--teal); }

@keyframes constellationPulse {
    0%, 100% { transform: scale(.97); opacity: .38; }
    50% { transform: scale(1.05); opacity: .82; }
}

@keyframes constellationNodeDrift {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -2px; }
}

@keyframes constellationNodeDriftSide {
    0%, 100% { translate: 0 0; }
    50% { translate: 2px 0; }
}

@media (prefers-reduced-motion: no-preference) {
    .constellation-node--top::after,
    .constellation-node--bottom::after {
        animation: constellationNodeDrift 5.8s ease-in-out infinite;
    }

    .constellation-node--left::after,
    .constellation-node--right::after {
        animation: constellationNodeDriftSide 6.4s ease-in-out infinite;
    }

    .constellation-node--lab::after {
        animation-duration: 5.2s;
    }
}

@media (max-width: 1120px) {
    .constellation-stage {
        width: min(100%, 860px);
        height: 590px;
    }

    .constellation-stage::before { width: 430px; height: 410px; }
    .constellation-stage::after { width: 275px; height: 292px; }

    .constellation-node { width: 225px; }

    .constellation-node--left { left: 5%; }
    .constellation-node--right { right: 5%; }

    .constellation-node--left::before,
    .constellation-node--right::before { width: 78px; }

    .constellation-node--left::after { left: calc(100% + 92px); }
    .constellation-node--right::after { right: calc(100% + 92px); }
}

@media (max-width: 760px) {
    .constellation-shell {
        min-height: auto;
        margin-top: 0;
        overflow: visible;
    }

    .constellation-stage {
        width: 100%;
        height: auto;
        margin: 36px 0 0;
        padding: 10px 0 10px 40px;
        display: grid;
        gap: 16px;
        background-image: linear-gradient(var(--line), var(--line));
        background-size: 1px calc(100% - 120px);
        background-repeat: no-repeat;
        background-position: 18px 94px;
    }

    .constellation-stage::before,
    .constellation-stage::after,
    .constellation-crosshair,
    .constellation-coordinates {
        display: none;
    }

    .constellation-core {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 82px;
        margin: 0 0 16px;
    }

    .constellation-stage > .constellation-core::after {
        display: none;
    }

    .constellation-node,
    .constellation-node--top,
    .constellation-node--left,
    .constellation-node--right,
    .constellation-node--bottom {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        width: 100%;
        transform: none;
        padding: 18px 18px 18px 20px;
        border: 1px solid var(--line);
        background: transparent;
        opacity: 1 !important;
    }

    .constellation-node:hover,
    .constellation-node:focus-visible,
    .constellation-node--top:hover,
    .constellation-node--top:focus-visible,
    .constellation-node--left:hover,
    .constellation-node--left:focus-visible,
    .constellation-node--right:hover,
    .constellation-node--right:focus-visible,
    .constellation-node--bottom:hover,
    .constellation-node--bottom:focus-visible {
        transform: translateX(4px);
    }

    .constellation-node::before {
        width: 1px !important;
        height: 17px !important;
        left: -21px !important;
        right: auto !important;
        top: -17px !important;
        bottom: auto !important;
        background: var(--line);
    }

    .constellation-node::after {
        left: -25px !important;
        right: auto !important;
        top: 24px !important;
        bottom: auto !important;
        animation: none !important;
    }

    .constellation-node h3 {
        font-size: clamp(36px, 12vw, 52px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .constellation-core::before,
    .constellation-node::after {
        animation: none !important;
    }
}
