/**
 * Radial Reactions Hub
 * Esoteric, forbidding, and terrible aesthetic
 * Thumb-friendly radial menu emanating from bottom-left
 */

/* ============================================
   Hub Container
   ============================================ */

.reactions-hub {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    /* Container needs dimensions for radial positioning */
    width: 0;
    height: 0;
    transition: opacity 0.5s ease;
}

.reactions-hub.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   Chat Icon (Anchor at Origin)
   ============================================ */

.hub-chat {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid #444;
    border-radius: 50%;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.hub-chat:hover {
    transform: scale(1.1);
    border-color: #666;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.hub-chat:active {
    transform: scale(0.95);
}

.hub-chat .hub-emoji {
    font-size: 22px;
    line-height: 1;
}

/* ============================================
   Reaction Buttons (Radial Arc)
   ============================================ */

.hub-reaction {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid #444;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    padding: 0;

    /* Radial positioning using CSS custom property --angle */
    --radius: 70px;
    transform-origin: center center;
    transform:
        rotate(var(--angle))
        translateY(calc(-1 * var(--radius)))
        rotate(calc(-1 * var(--angle)));
}

.hub-reaction::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hub-reaction:hover::before {
    opacity: 1;
}

.hub-reaction:hover {
    transform:
        rotate(var(--angle))
        translateY(calc(-1 * var(--radius)))
        rotate(calc(-1 * var(--angle)))
        scale(1.15);
    border-color: #666;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6),
                0 0 8px rgba(255, 255, 255, 0.1);
}

.hub-reaction:active,
.hub-reaction.reaction-clicked {
    transform:
        rotate(var(--angle))
        translateY(calc(-1 * var(--radius)))
        rotate(calc(-1 * var(--angle)))
        scale(0.9);
}

.hub-reaction.active {
    background: linear-gradient(135deg, #2a2a2a 0%, #151515 100%);
    border-color: #888;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(0, 0, 0, 0.5);
}

.hub-reaction.active::before {
    opacity: 0.4;
}

/* ============================================
   Emoji Styling
   ============================================ */

.reaction-emoji {
    font-size: 20px;
    line-height: 1;
    filter: grayscale(0.4) contrast(1.1);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.hub-reaction:hover .reaction-emoji {
    filter: grayscale(0) contrast(1.3);
}

.hub-reaction.active .reaction-emoji {
    filter: grayscale(0) contrast(1.4) brightness(1.2);
    animation: glow 2s ease-in-out infinite;
}

/* ============================================
   Animations
   ============================================ */

@keyframes glow {
    0%, 100% {
        filter: grayscale(0) contrast(1.4) brightness(1.2);
    }
    50% {
        filter: grayscale(0) contrast(1.6) brightness(1.4) drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
    .reactions-hub {
        bottom: 1.5rem;
        left: 1.5rem;
    }

    .hub-chat {
        width: 44px;
        height: 44px;
    }

    .hub-chat .hub-emoji {
        font-size: 20px;
    }

    .hub-reaction {
        width: 36px;
        height: 36px;
        --radius: 60px;
    }

    .reaction-emoji {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .reactions-hub {
        bottom: 1rem;
        left: 1rem;
    }

    .hub-chat {
        width: 40px;
        height: 40px;
    }

    .hub-chat .hub-emoji {
        font-size: 18px;
    }

    .hub-reaction {
        width: 32px;
        height: 32px;
        --radius: 50px;
    }

    .reaction-emoji {
        font-size: 16px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .reactions-hub {
        display: none;
    }
}

/* ============================================
   Dark Mode Compatibility
   ============================================ */

@media (prefers-color-scheme: dark) {
    .hub-chat,
    .hub-reaction {
        background: linear-gradient(135deg, #0d0d0d 0%, #050505 100%);
        border-color: #333;
    }

    .hub-chat:hover,
    .hub-reaction:hover {
        border-color: #555;
    }

    .hub-reaction.active {
        background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
        border-color: #666;
    }
}
