/* ============================================================================
 * ICAN Mamdani Index — Orbital System CSS
 * Hub-spoke orbital visualization for elected officials
 * ============================================================================ */

/* ===== ORBITAL CONTAINER ===== */
.orbital-system {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 450;
}

/* ===== HUB NODE ===== */
.hub-node {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, var(--surface-light), var(--bg));
    border: 2px solid var(--hub-color, var(--ican-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    box-shadow:
        0 0 40px var(--hub-glow, rgba(45, 109, 229, 0.3)),
        0 0 80px var(--hub-glow-soft, rgba(45, 109, 229, 0.1)),
        inset 0 0 15px var(--hub-glow-inset, rgba(45, 109, 229, 0.06));
    transition: all 0.25s ease;
}

.hub-node::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(45, 109, 229, 0.1);
    pointer-events: none;
}

.hub-node::after {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    border: 1px dashed var(--hub-dashed, rgba(45, 109, 229, 0.08));
    pointer-events: none;
}

.hub-node:hover {
    box-shadow:
        0 0 50px var(--hub-glow, rgba(45, 109, 229, 0.35)),
        0 0 100px var(--hub-glow-soft, rgba(45, 109, 229, 0.12)),
        inset 0 0 20px var(--hub-glow-inset, rgba(45, 109, 229, 0.06));
}

.hub-text {
    font-size: 13px;
    font-weight: 800;
    color: var(--hub-color, var(--ican-blue));
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 0 12px var(--hub-glow, rgba(45, 109, 229, 0.5));
}

.hub-sub {
    font-size: 6px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.04em;
    text-shadow: none;
}

/* ===== RANGE RING ===== */
.range-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--ring-size, 0px);
    height: var(--ring-size, 0px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px dashed rgba(45, 109, 229, 0.12);
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.range-ring::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(45, 109, 229, 0.04);
}

/* ===== RADAR SWEEP ===== */
.radar-sweep {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--ring-size, 0px);
    height: var(--ring-size, 0px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(45, 109, 229, 0.1) 20deg,
        transparent 50deg
    );
    animation: sweep-spin 4s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease,
                width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.radar-sweep.active {
    opacity: 1;
}

@keyframes sweep-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== IFF SCAN FLASH ===== */
.iff-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ican-blue);
    text-shadow: 0 0 8px rgba(45, 109, 229, 0.6);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

.iff-label.flash {
    animation: iff-flash 1.2s ease forwards;
}

@keyframes iff-flash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== ORBITAL ROTATOR ===== */
.orbital-rotator {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    will-change: transform;
}

.orbital-rotator.orbiting {
    animation: orbit-spin 240s linear infinite;
}

@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

/* ===== SATELLITE NODES ===== */
.sat {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: auto;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s ease;
    cursor: pointer;
    z-index: 10;
}

.sat.deployed {
    opacity: 1;
}

/* Counter-rotate content so it stays upright during orbit */
.sat-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
}

.orbital-rotator.orbiting .sat-content {
    animation: counter-spin 240s linear infinite;
}

@keyframes counter-spin {
    to { transform: rotate(-360deg); }
}

/* ===== SATELLITE CORE ===== */
.sat-core {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.sat:hover .sat-core {
    transform: scale(1.15);
}

/* Score arc ring */
.score-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), black calc(100% - 3.5px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), black calc(100% - 3.5px));
}

.sat-inner {
    position: absolute;
    inset: 3.5px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--surface-light), var(--bg));
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

/* Satellite text (portal uses sat-label/sat-sublabel; state maps use sat-initials) */
.sat-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sat-sublabel {
    font-size: 5.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
    opacity: 0.7;
}

.sat-initials {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.85);
}

/* ===== NAMETAG BELOW SATELLITE ===== */
.sat-nametag {
    margin-top: 4px;
    text-align: center;
    pointer-events: none;
}

.sat-name {
    display: block;
    font-size: 7.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.faction-tag {
    display: inline-block;
    font-size: 6px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 1px;
    margin-top: 2px;
}

/* ===== FACTION STYLING: ALLIED (green) ===== */
.sat-core.allied,
.sat-core.state-sat {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.sat-core.allied .sat-inner,
.sat-core.state-sat .sat-inner {
    border-color: rgba(16, 185, 129, 0.2);
}

.sat-core.allied .sat-initials,
.sat-core.state-sat .sat-label {
    color: var(--allied-3);
}

.sat-core.state-sat .sat-sublabel {
    color: rgba(16, 185, 129, 0.7);
}

.sat-core.state-sat .score-arc {
    background: conic-gradient(var(--allied-3) 360deg, rgba(255, 255, 255, 0.04) 360deg);
}

/* Shield pip (allied indicator) */
.shield-pip {
    position: absolute;
    top: -4px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--surface);
    border: 1.5px solid var(--allied-2);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: var(--allied-3);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.faction-tag.allied,
.faction-tag.state-tag {
    color: var(--allied-3);
    background: rgba(16, 185, 129, 0.1);
    border: 0.5px solid rgba(16, 185, 129, 0.25);
}

/* ===== FACTION STYLING: HOSTILE (red) ===== */
.sat-core.hostile {
    box-shadow: 0 0 16px rgba(236, 26, 51, 0.15);
}

.sat-core.hostile .sat-inner {
    border-color: rgba(236, 26, 51, 0.12);
}

.sat-core.hostile .sat-initials {
    color: var(--hostile-3);
}

/* Targeting reticle */
.reticle {
    position: absolute;
    inset: -6px;
    pointer-events: none;
}

.reticle-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--hostile-3);
    border-style: solid;
    border-width: 0;
    opacity: 0.7;
}

.reticle-corner.tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; }
.reticle-corner.tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; }
.reticle-corner.bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.reticle-corner.br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; }

/* Threat pip (hostile score indicator) */
.threat-pip {
    position: absolute;
    top: -4px;
    right: -2px;
    height: 14px;
    padding: 0 4px;
    background: rgba(236, 26, 51, 0.2);
    border: 1px solid rgba(236, 26, 51, 0.5);
    border-radius: 2px;
    display: flex;
    align-items: center;
    font-size: 7px;
    font-weight: 700;
    color: var(--hostile-3);
    letter-spacing: 0.02em;
    box-shadow: 0 0 8px rgba(236, 26, 51, 0.25);
}

/* Hostile pulse ring */
.sat-core.hostile::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px solid rgba(236, 26, 51, 0.2);
    animation: hostile-pulse 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hostile-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.12); opacity: 0; }
}

.faction-tag.hostile {
    color: var(--hostile-3);
    background: rgba(236, 26, 51, 0.08);
    border: 0.5px solid rgba(236, 26, 51, 0.2);
}

/* ===== FACTION STYLING: NEUTRAL (white) ===== */
.sat-core.neutral {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.sat-core.neutral .sat-inner {
    border-color: rgba(255, 255, 255, 0.12);
    border-style: dashed;
}

.sat-core.neutral .sat-initials {
    color: var(--neutral);
}

.faction-tag.neutral {
    color: var(--neutral);
    background: rgba(255, 255, 255, 0.08);
    border: 0.5px solid rgba(255, 255, 255, 0.2);
}

/* ===== LOCAL SATELLITE (blue — portal only) ===== */
.sat-core.local-sat {
    box-shadow: 0 0 20px rgba(45, 109, 229, 0.25);
}

.sat-core.local-sat .sat-inner {
    border-color: rgba(45, 109, 229, 0.2);
}

.sat-core.local-sat .sat-label {
    color: var(--ican-blue);
}

.sat-core.local-sat .sat-sublabel {
    color: rgba(45, 109, 229, 0.7);
}

.sat-core.local-sat .score-arc {
    background: conic-gradient(var(--ican-blue) 360deg, rgba(255, 255, 255, 0.04) 360deg);
}

.faction-tag.local-tag {
    color: var(--ican-blue);
    background: rgba(45, 109, 229, 0.1);
    border: 0.5px solid rgba(45, 109, 229, 0.25);
}

/* ===== COLLAPSE ANIMATION ===== */
.sat.collapsing {
    transform: translate(-50%, -50%) scale(0) !important;
    opacity: 0 !important;
    transition: transform 0.4s cubic-bezier(0.36, 0, 0.66, -0.56),
                opacity 0.3s ease !important;
}
