/* Link Orbit Frontend Styles */

/* CSS Variables */
.link-orbit-wrapper {
    --primary-orange: #ff6b35;
    --light-orange: #ff8c5a;
    --accent-orange: #ffa366;
    --gradient-sunset: linear-gradient(135deg, #ff6b35 0%, #ffa366 100%);
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;

    /* Light Theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-card: #ffffff;
    --bg-input: rgba(255, 163, 102, 0.08);
    --text-primary: #0f0f0f;
    --text-secondary: #6c757d;
    --text-tertiary: #9ca3af;
    --border-color: #d1d5db;
}

/* Dark Theme */
.link-orbit-wrapper[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --bg-card: #1e1e1e;
    --bg-input: rgba(255, 163, 102, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #6b7280;
    --border-color: #374151;
}

/* Auto theme - follows system preference */
@media (prefers-color-scheme: dark) {
    .link-orbit-wrapper[data-theme="auto"] {
        --bg-primary: #0f0f0f;
        --bg-secondary: #1a1a1a;
        --bg-tertiary: #2d2d2d;
        --bg-card: #1e1e1e;
        --bg-input: rgba(255, 163, 102, 0.05);
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --text-tertiary: #6b7280;
        --border-color: #374151;
    }
}

/* Base - Break out of theme containers */
.link-orbit-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    overflow: hidden;
}

.link-orbit-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Orbit Page */
.link-orbit-page {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.5rem 1rem 6rem;
    gap: 0;
    position: relative;
    animation: linkOrbitFadeIn 0.6s ease;
    overflow: hidden;
}

@media (max-height: 700px) {
    .link-orbit-page {
        padding: 1rem 0.5rem 5rem;
    }
}

@keyframes linkOrbitFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.link-orbit-page::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 107, 53, 0.05), transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: linkOrbitAmbientPulse 8s ease-in-out infinite;
}

@keyframes linkOrbitAmbientPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
}

/* Orbit Container */
.link-orbit-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    transform-origin: center center;
}

/* Scale based on viewport - small screens */
@media (max-width: 500px), (max-height: 600px) {
    .link-orbit-container {
        transform: scale(0.6);
    }
}

/* Medium screens */
@media (min-width: 501px) and (max-width: 768px) and (min-height: 601px) {
    .link-orbit-container {
        transform: scale(0.75);
    }
}

/* Medium-large screens */
@media (min-width: 769px) and (max-width: 1200px) and (min-height: 601px) and (max-height: 900px) {
    .link-orbit-container {
        transform: scale(0.9);
    }
}

/* Large screens */
@media (min-width: 769px) and (min-height: 901px) {
    .link-orbit-container {
        transform: scale(1.1);
    }
}

/* Very large screens */
@media (min-width: 1400px) and (min-height: 1000px) {
    .link-orbit-container {
        transform: scale(1.3);
    }
}

/* Extra large screens */
@media (min-width: 1800px) and (min-height: 1200px) {
    .link-orbit-container {
        transform: scale(1.5);
    }
}

/* Sun (Center) */
.link-orbit-sun {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-sunset);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 400ms ease;
    animation: linkOrbitSunRotate 20s linear infinite;
}

@keyframes linkOrbitSunRotate {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.link-orbit-sun.dimmed {
    transform: scale(0.85);
    opacity: 0.6;
    animation-play-state: paused;
}

.link-orbit-sun .sun-emoji {
    font-size: 1.5rem;
    z-index: 2;
    animation: linkOrbitEmojiFloat 3s ease-in-out infinite;
}

.link-orbit-sun .sun-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    z-index: 2;
}

.link-orbit-sun .sun-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 2;
}

@keyframes linkOrbitEmojiFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.05); }
}

.link-orbit-sun-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.4), transparent 70%);
    animation: linkOrbitPulse 3s ease-in-out infinite;
}

@keyframes linkOrbitPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

@media (max-width: 768px) {
    .link-orbit-sun { width: 60px; height: 60px; }
    .link-orbit-sun .sun-emoji { font-size: 1.5rem; }
}

/* Orbit Rings */
.link-orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    border-radius: 50%;
    pointer-events: none;
    transition: all 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-orbit-ring.dimmed {
    opacity: 0.15;
    pointer-events: none;
}


.link-orbit-ring.active .link-orbit-path,
.link-orbit-ring.expanded .link-orbit-path {
    border-color: rgba(255, 107, 53, 0.9);
    border-style: solid;
    border-width: 2px;
    box-shadow: 0 0 25px rgba(255, 107, 53, 0.6), inset 0 0 20px rgba(255, 107, 53, 0.2);
}

.link-orbit-path {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.3), inset 0 0 15px rgba(255, 107, 53, 0.1);
    cursor: pointer;
    pointer-events: auto;
    transition: all 400ms ease;
    animation: linkOrbitRingRotate 60s linear infinite, linkOrbitRingGlow 3s ease-in-out infinite;
}

@keyframes linkOrbitRingGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 107, 53, 0.3), inset 0 0 15px rgba(255, 107, 53, 0.1); }
    50% { box-shadow: 0 0 25px rgba(255, 107, 53, 0.5), inset 0 0 20px rgba(255, 107, 53, 0.2); }
}

.link-orbit-ring:nth-child(2) .link-orbit-path { animation-duration: 80s; animation-direction: reverse; }
.link-orbit-ring:nth-child(3) .link-orbit-path { animation-duration: 100s; }
.link-orbit-ring:nth-child(4) .link-orbit-path { animation-duration: 120s; animation-direction: reverse; }
.link-orbit-ring:nth-child(5) .link-orbit-path { animation-duration: 140s; }
.link-orbit-ring:nth-child(6) .link-orbit-path { animation-duration: 160s; animation-direction: reverse; }
.link-orbit-ring:nth-child(7) .link-orbit-path { animation-duration: 180s; }
.link-orbit-ring:nth-child(8) .link-orbit-path { animation-duration: 200s; animation-direction: reverse; }
.link-orbit-ring:nth-child(9) .link-orbit-path { animation-duration: 220s; }
.link-orbit-ring:nth-child(10) .link-orbit-path { animation-duration: 240s; animation-direction: reverse; }

@keyframes linkOrbitRingRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.link-orbit-ring.active .link-orbit-path,
.link-orbit-ring.expanded .link-orbit-path {
    animation-play-state: paused;
}

.link-orbit-path::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    pointer-events: auto;
}

/* Ring Labels */
.link-orbit-ring-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.7;
    transition: all 300ms ease;
    pointer-events: auto;
    cursor: pointer;
    padding: 1rem;
    border-radius: 12px;
}

.link-orbit-ring-label:hover { opacity: 1; }
.link-orbit-ring.active .link-orbit-ring-label { opacity: 0.5; }

.link-orbit-ring-label .ring-emoji {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.link-orbit-ring-label:hover .ring-emoji {
    transform: scale(1.2);
}

.link-orbit-ring-label .ring-text {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .link-orbit-ring-label .ring-emoji { font-size: 1.2rem; }
}

/* Orbit Nodes (Links) */
.link-orbit-node {
    position: absolute;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    margin-left: -22px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--accent, #ff6b35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.3);
    transition: opacity 300ms ease, transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), z-index 0ms;
    z-index: 60;
}

.link-orbit-node.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    animation: linkOrbitNodeAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes linkOrbitNodeAppear {
    from { opacity: 0; transform: scale(0.3) rotate(-180deg); }
    to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.link-orbit-node:hover {
    transform: scale(1.2);
    z-index: 200;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.link-orbit-node:hover .node-glow { opacity: 0.8; }

.link-orbit-node:hover .node-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* For nodes at the bottom, show tooltip above */
.link-orbit-node[style*="top: calc(50% + 1"],
.link-orbit-node[style*="top: calc(50% + 2"] {
    .node-tooltip {
        top: auto;
        bottom: calc(100% + 12px);
    }
    .node-tooltip::after {
        bottom: auto;
        top: 100%;
        border-bottom-color: transparent;
        border-top-color: var(--bg-secondary);
    }
}

.link-orbit-node:active { transform: scale(0.95); }

.link-orbit-node .node-icon {
    font-size: 1.2rem;
    z-index: 2;
    transition: transform 0.2s ease;
}

.link-orbit-node:hover .node-icon {
    transform: scale(1.1);
}

.link-orbit-node .node-glow {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent, #ff6b35), transparent 70%);
    opacity: 0.3;
    transition: opacity 300ms ease;
}

@media (max-width: 768px) {
    .link-orbit-node { width: 40px; height: 40px; margin-top: -20px; margin-left: -20px; }
    .link-orbit-node .node-icon { font-size: 1.1rem; }
}

/* Node Tooltips */
.node-tooltip {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: all 200ms ease;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.node-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--bg-secondary);
}

.node-tooltip .tooltip-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.node-tooltip .tooltip-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Profile Info */
.link-orbit-profile {
    margin-top: 0;
    margin-bottom: 3.5rem;
    text-align: center;
    animation: linkOrbitSlideUp 0.6s ease 0.2s both;
}

@keyframes linkOrbitSlideUp {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.link-orbit-profile .profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
}

.link-orbit-profile .profile-handle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .link-orbit-profile { margin-top: 1.5rem; }
    .link-orbit-profile .profile-name { font-size: 1.25rem; }
}

/* Links Bar (Bottom) */
.link-orbit-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    z-index: 50;
    animation: linkOrbitBarSlideUp 200ms ease forwards;
    max-width: calc(100vw - 4rem);
}

.link-orbit-bar.hidden { display: none; }

@keyframes linkOrbitBarSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.link-orbit-bar .bar-header {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.link-orbit-bar .bar-emoji { font-size: 0.9rem; }
.link-orbit-bar .bar-label { font-weight: 600; }

.link-orbit-bar .bar-items {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.link-orbit-bar .bar-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 200ms ease;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.link-orbit-bar .bar-item:hover,
.link-orbit-bar .bar-item.hovered {
    background: var(--accent, #ff6b35);
    border-color: var(--accent, #ff6b35);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.link-orbit-bar .bar-item:active { transform: translateY(0); }
.link-orbit-bar .bar-item-icon { font-size: 1.1rem; }
.link-orbit-bar .bar-item-title { white-space: nowrap; }

@media (max-width: 768px) {
    .link-orbit-bar {
        bottom: 1rem;
        padding: 0.5rem 0.75rem;
        max-width: calc(100vw - 2rem);
    }
    .link-orbit-bar .bar-item {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Instructions */
.link-orbit-instructions {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: linkOrbitFadeIn 0.6s ease 0.4s both;
}

.link-orbit-instructions.hidden { display: none; }

@media (max-width: 768px) {
    .link-orbit-instructions {
        bottom: 1rem;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}
