/* yuru.be Navigation & Transitions Styles */

/* ========================================
   SMOOTH SCROLLING
   ======================================== */

html {
    scroll-behavior: smooth;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   PAGE TRANSITIONS
   ======================================== */

body {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-enter {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-exit {
    opacity: 0;
}

/* View Transitions API support */
@supports (view-transition-name: none) {
    ::view-transition-old(main-content),
    ::view-transition-new(main-content) {
        animation-duration: 0.3s;
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }

    ::view-transition-old(main-content) {
        animation-name: slideOutLeft;
    }

    ::view-transition-new(main-content) {
        animation-name: slideInRight;
    }
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */

.scroll-to-top {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--bg, #000);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 50%;
    color: var(--fg, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 8000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.scroll-to-top:hover {
    background: var(--hover, rgba(255,255,255,0.05));
    border-color: rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.5);
    box-shadow: 0 0 20px rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.2);
    transform: translateY(0) scale(1);
}

.scroll-to-top:active {
    transform: translateY(0) scale(0.9);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-to-top svg {
    width: 20px;
    height: 20px;
}

/* Move down on mobile to not overlap chatbot */
@media (max-width: 480px) {
    .scroll-to-top {
        bottom: 4.5rem;
        right: 1rem;
    }
}

/* ========================================
   BREADCRUMB NAVIGATION
   ======================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--dim, rgba(255,255,255,0.4));
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--dim, rgba(255,255,255,0.4));
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--accent, #86efac);
}

.breadcrumb-separator {
    color: var(--border, rgba(255,255,255,0.1));
    user-select: none;
}

.breadcrumb-current {
    color: var(--fg, #fff);
    font-weight: 500;
}

/* ========================================
   LOADING INDICATOR
   ======================================== */

.page-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--accent, #86efac) 0%,
        rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.5) 100%
    );
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease, width 0.3s ease;
}

body.page-loading .page-loading-indicator {
    opacity: 1;
    width: 70%;
    transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   SKIP TO MAIN CONTENT LINK
   ======================================== */

.skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg, #000);
    border: 2px solid var(--accent, #86efac);
    border-radius: 8px;
    color: var(--accent, #86efac);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    z-index: 10001;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
    outline: none;
}

/* ========================================
   ACTIVE PAGE INDICATOR
   ======================================== */

a.active-page {
    position: relative;
}

a.active-page::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent, #86efac);
    border-radius: 1px;
}

/* For links in grids/cards */
.link.active-page,
.ai-card.active-page {
    background: rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.08);
    border-color: rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.3);
}

.link.active-page::after,
.ai-card.active-page::after {
    display: none;
}

/* ========================================
   KEYBOARD NAVIGATION FOCUS STYLES
   ======================================== */

/* Enhanced focus for keyboard navigation */
.link:focus-visible,
.ai-card:focus-visible,
.btn:focus-visible,
.back-btn:focus-visible,
.tool-btn:focus-visible {
    outline: 2px solid var(--accent, #86efac);
    outline-offset: 2px;
    z-index: 1;
}

/* Focus ring animation */
@keyframes focusRing {
    0% { outline-offset: 2px; }
    50% { outline-offset: 4px; }
    100% { outline-offset: 2px; }
}

.link:focus-visible,
.ai-card:focus-visible {
    animation: focusRing 1s ease-in-out infinite;
}

/* ========================================
   ENHANCED HOVER STATES
   ======================================== */

/* Ensure consistent timing across all interactive elements */
.link,
.ai-card,
.btn,
.back-btn,
.tool-btn,
.card-interactive,
.theme-color,
.numpad-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect on active state */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Add subtle glow on hover for all interactive elements */
.link:hover,
.ai-card:hover,
.btn:hover,
.back-btn:hover,
.tool-btn:hover {
    box-shadow: 0 0 16px rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.12);
}

/* ========================================
   LOADING SKELETON SCREENS
   ======================================== */

.skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--hover, rgba(255,255,255,0.05)) 0%,
        rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.08) 50%,
        var(--hover, rgba(255,255,255,0.05)) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5rem;
    width: 40%;
    margin-bottom: 1rem;
}

.skeleton-button {
    height: 44px;
    width: 120px;
    border-radius: 8px;
}

.skeleton-card {
    height: 200px;
    border-radius: 10px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.7rem;
    }

    .scroll-to-top {
        width: 44px;
        height: 44px;
    }

    .scroll-to-top svg {
        width: 18px;
        height: 18px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .scroll-to-top {
        width: 52px;
        height: 52px;
    }

    /* Remove hover effects, keep focus */
    .link:hover,
    .ai-card:hover,
    .btn:hover,
    .back-btn:hover {
        box-shadow: none;
    }

    /* Active state for touch */
    .link:active,
    .ai-card:active,
    .btn:active,
    .back-btn:active {
        transform: scale(0.97);
        background: rgba(var(--accent-r,134),var(--accent-g,239),var(--accent-b,172),0.15);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .scroll-to-top,
    .skip-link,
    .page-loading-indicator {
        display: none !important;
    }

    .breadcrumb {
        margin-bottom: 1rem;
    }
}

/* ========================================
   REDUCED MOTION PREFERENCES
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .scroll-to-top,
    .link,
    .ai-card,
    .btn,
    .breadcrumb-link {
        transition: none !important;
        animation: none !important;
    }

    .skeleton {
        animation: none;
        background: var(--hover);
    }
}
