/* ============================================================
   macOS-Style Floating Dock Navigation
   ============================================================ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}
.top-nav.hide { transform: translateY(-100%); opacity: 0; }
.top-nav .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.top-nav .nav-links { display: flex; gap: 2rem; list-style: none; }
.top-nav .nav-links a {
    color: #334155;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
}
.top-nav .nav-links a:hover { color: #6366f1; }

/* ─── Floating Dock ─── */
.floating-dock {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    gap: 0.15rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 100px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), 0 0 0 1px rgba(255,255,255,0.2);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.floating-dock.visible {
    transform: translateX(-50%) translateY(0);
}
.dock-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.2s ease;
    position: relative;
    background: transparent;
    border: none;
    padding: 0;
}
.dock-icon svg {
    width: 22px;
    height: 22px;
    stroke: #475569;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
}
.dock-icon:hover svg { stroke: #6366f1; }
.dock-icon:hover { background: rgba(99, 102, 241, 0.08); }
.dock-icon.active svg { stroke: #6366f1; }
.dock-icon.active { background: rgba(99, 102, 241, 0.12); }

/* Tooltip */
.dock-icon .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.dock-icon:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Dot indicator for active */
.dock-icon .dot {
    position: absolute;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #6366f1;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.dock-icon.active .dot { opacity: 1; }

/* ─── Back to Top Button ─── */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9997;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255,255,255,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.3s ease;
    pointer-events: none;
}
.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.back-to-top:hover {
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(99,102,241,0.2);
}
.back-to-top svg { width: 20px; height: 20px; stroke: #6366f1; fill: none; stroke-width: 2; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .top-nav .nav-links { display: none; }
    .floating-dock { padding: 0.5rem 0.8rem; gap: 0.1rem; }
    .dock-icon { width: 38px; height: 38px; }
    .dock-icon svg { width: 18px; height: 18px; }
}
@media (max-width: 480px) {
    .floating-dock { padding: 0.4rem 0.6rem; bottom: 0.8rem; }
    .dock-icon { width: 34px; height: 34px; }
    .dock-icon svg { width: 16px; height: 16px; }
}

/* Mobile-safe navigation spacing and touch targets */
@media (max-width: 768px) {
    .top-nav {
        padding:
            max(0.85rem, env(safe-area-inset-top))
            max(1rem, env(safe-area-inset-right))
            0.85rem
            max(1rem, env(safe-area-inset-left));
    }

    .floating-dock {
        width: max-content;
        max-width: calc(100vw - 1rem);
        bottom: max(0.65rem, env(safe-area-inset-bottom));
        justify-content: center;
        padding: 0.4rem 0.55rem;
    }

    .dock-icon { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
    .dock-icon svg { width: 18px; height: 18px; }
    .back-to-top { display: none; }
}

@media (hover: none), (pointer: coarse) {
    .dock-icon .tooltip { display: none; }
}

@media (max-width: 340px) {
    .floating-dock { gap: 0; padding-inline: 0.35rem; }
    .dock-icon { width: 37px; height: 38px; }
}
