/* Mobile-First Design - PWA Optimized but Desktop-Safe */

/* Mobile sizes as defaults */
:root {
    /* Primary mobile sizes */
    --center-size: 150px;
    --orbit-size: min(65px, 18vw);
    --orbit-distance: min(130px, 32vw);
    --fast-size: min(60px, 16vw);
    --fast-distance: min(110px, 28vw);
}

/* Base mobile-optimized layout */
.circular-nav-container {
    min-height: calc(100vh - 50px - env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    padding-top: calc(env(safe-area-inset-top) + 20px);
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

/* Center Circle - Mobile optimized */
.center-circle {
    width: var(--center-size);
    height: var(--center-size);
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.03), transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    padding: 10px;
}

.center-circle.main-hub {
    border: 2px solid rgba(251, 191, 36, 0.4);
    background: radial-gradient(circle at center, rgba(251, 191, 36, 0.08), transparent);
}

/* Mobile-first text sizing */
.circle-label {
    font-size: clamp(13px, 3.5vw, 18px);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.circle-subtitle {
    font-size: clamp(8px, 2.5vw, 11px);
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* Orbital container */
.nav-items {
    position: absolute;
    width: calc(var(--orbit-distance) * 2);
    height: calc(var(--orbit-distance) * 2);
    pointer-events: none;
}

/* Orbital circles positioning */
.nav-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--orbit-size);
    height: var(--orbit-size);
    margin: calc(var(--orbit-size) / -2) 0 0 calc(var(--orbit-size) / -2);
    pointer-events: all;
    transform-origin: center;
    transition: all 0.3s ease;
    transform: rotate(var(--angle)) translateY(calc(var(--orbit-distance) * -1)) rotate(calc(-1 * var(--angle)));
}

/* Domain circles - mobile optimized */
.domain-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    padding: 6px;
}

.domain-circle:active {
    transform: scale(0.95);
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.1);
}

/* Mobile-first text with clamp for safety */
.domain-number {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
    margin-bottom: 2px;
}

.domain-name {
    font-size: clamp(7px, 2vw, 11px);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.2px;
    line-height: 1.1;
    text-transform: uppercase;
}

/* Focus circles */
.focus-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    padding: 5px;
}

.focus-icon {
    width: clamp(18px, 5vw, 24px);
    height: clamp(18px, 5vw, 24px);
    margin-bottom: 2px;
    color: rgba(255, 255, 255, 0.7);
}

.focus-icon svg {
    width: 100%;
    height: 100%;
}

.focus-name {
    font-size: clamp(6px, 1.8vw, 10px);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.1px;
    line-height: 1;
    text-transform: uppercase;
}

/* FAST circles */
.fast-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    padding: 5px;
}

.fast-label {
    font-size: clamp(7px, 2vw, 10px);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.2px;
    line-height: 1.1;
    text-transform: uppercase;
}

/* DESKTOP SAFETY - Prevent it from breaking on larger screens */
@media (min-width: 768px) {
    /* Cap the sizes so they don't get too big */
    :root {
        --center-size: 140px;
        --orbit-size: 75px;
        --orbit-distance: 150px;
        --fast-size: 70px;
        --fast-distance: 130px;
    }
    
    /* Center the content in a reasonable container */
    .circular-nav-container {
        max-width: 600px;
        padding: 30px;
    }
    
    /* Slightly larger padding for desktop */
    .center-circle {
        padding: 12px;
    }
    
    .domain-circle {
        padding: 8px;
    }
    
    /* Add hover effects only on desktop */
    .domain-circle:hover,
    .focus-circle:hover,
    .fast-circle:hover {
        border-color: rgba(251, 191, 36, 0.4);
        background: rgba(251, 191, 36, 0.08);
        transform: scale(1.05);
    }
    
    /* Remove active transform on desktop (use hover instead) */
    .domain-circle:active {
        transform: scale(1);
    }
}

/* Large desktop - still contained */
@media (min-width: 1200px) {
    :root {
        --center-size: 160px;
        --orbit-size: 85px;
        --orbit-distance: 170px;
        --fast-size: 75px;
        --fast-distance: 140px;
    }
    
    .circular-nav-container {
        max-width: 700px;
    }
}

/* Very large screens - maintain reasonable proportions */
@media (min-width: 1920px) {
    :root {
        --center-size: 180px;
        --orbit-size: 95px;
        --orbit-distance: 190px;
        --fast-size: 85px;
        --fast-distance: 160px;
    }
    
    .circular-nav-container {
        max-width: 800px;
    }
}

/* Small phones need even smaller sizes */
@media (max-width: 375px) {
    :root {
        --center-size: 100px;
        --orbit-size: 55px;
        --orbit-distance: 110px;
        --fast-size: 50px;
        --fast-distance: 90px;
    }
}

/* Connection lines - subtle on all devices */
.nav-connection {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.5px;
    height: var(--orbit-distance);
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.05) 20%,
        rgba(255, 255, 255, 0.05) 80%,
        rgba(255, 255, 255, 0)
    );
    transform-origin: center top;
    transform: rotate(var(--angle)) translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

/* Week indicator */
.week-indicator {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 10px);
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Animations optimized for mobile */
.nav-level {
    perspective: 1000px;
}

.nav-level.diving-out {
    transform: scale(1.5) translateZ(200px);
    opacity: 0;
    filter: blur(10px);
}

.nav-level.pulling-in {
    transform: scale(0.3) translateZ(-300px);
    opacity: 0;
    filter: blur(8px);
}

/* Touch targets for mobile */
@media (pointer: coarse) {
    .nav-item::after {
        content: '';
        position: absolute;
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
        border-radius: 50%;
    }
}

/* Disable animations on very small devices for performance */
@media (max-width: 375px) {
    * {
        animation: none !important;
        transition-duration: 0.2s !important;
    }
}

/* Ensure proper display on tablets in portrait */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .circular-nav-container {
        max-width: 500px;
    }
}

/* Handle landscape phones specially */
@media (max-width: 812px) and (orientation: landscape) {
    :root {
        --center-size: 80px;
        --orbit-size: 50px;
        --orbit-distance: 90px;
        --fast-size: 45px;
        --fast-distance: 75px;
    }
    
    .circular-nav-container {
        padding-top: 10px;
        min-height: calc(100vh - 40px);
    }
}