/*
 * Invisible Header - Revolutionary Navigation
 * The world's first truly invisible, intent-based navigation
 * Only appears when user demonstrates navigation intent
 */

/* ============================================
   The Ghost Header - Invisible by Default
   ============================================ */
.ghost-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 52px;

    /* Initially hidden above viewport */
    transform: translateY(-100%);
    opacity: 0;

    /* Smooth, natural transitions */
    transition:
        transform 200ms cubic-bezier(0.4, 0.0, 0.2, 1),
        opacity 180ms ease-out;

    /* Weightless appearance - like air */
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    /* Subtle bottom edge - almost invisible */
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);

    /* Prevent selection during interaction */
    user-select: none;
    -webkit-user-select: none;

    /* Ensure it stays above content */
    pointer-events: auto;
}

/* When revealed through intent */
.ghost-header.revealed {
    transform: translateY(0);
    opacity: 1;
}

/* Navigation container */
.ghost-nav {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
    max-width: 800px; /* Match article width */
    margin: 0 auto;
}

/* ============================================
   The Volver Button - Minimal, Elegant
   ============================================ */
.ghost-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin: -10px -14px; /* Expand hit area invisibly */

    /* Remove button defaults for purity */
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;

    /* Typography - refined and subtle */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: rgba(0, 0, 0, 0.65);

    /* Subtle interaction feedback */
    transition:
        color 150ms ease,
        transform 100ms ease;

    /* Prevent text selection */
    -webkit-tap-highlight-color: transparent;
}

/* Hover state - uses site's theme color */
.ghost-back:hover {
    color: var(--color-primary-hover);
}

/* Active state - subtle feedback */
.ghost-back:active {
    transform: scale(0.98);
}

/* Focus state for accessibility - uses site's theme color */
.ghost-back:focus-visible {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
    border-radius: 4px;
}

/* The arrow icon */
.ghost-arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: transform 150ms ease;
}

/* Arrow movement on hover */
.ghost-back:hover .ghost-arrow {
    transform: translateX(-2px);
}

/* The label text */
.ghost-label {
    line-height: 1;
}

/* ============================================
   Respect User Preferences
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .ghost-header {
        transition: opacity 200ms ease;
    }

    .ghost-header.revealed {
        transform: translateY(0) !important;
    }

    .ghost-arrow,
    .ghost-back:hover .ghost-arrow {
        transform: none !important;
    }

    .ghost-back:active {
        transform: none !important;
    }
}

/* ============================================
   Mobile Optimizations
   ============================================ */
@media (max-width: 768px) {
    .ghost-header {
        /* Slightly taller for mobile touch */
        height: 56px;
    }

    .ghost-nav {
        padding: 0 20px;
    }

    .ghost-back {
        /* Larger touch target (minimum 44x44px) */
        padding: 12px 16px;
        margin: -12px -16px;

        /* Slightly larger text on mobile */
        font-size: 16px;
    }
}

/* Small mobile screens */
@media (max-width: 380px) {
    .ghost-nav {
        padding: 0 16px;
    }
}

/* ============================================
   Color Scheme Consistency
   ============================================ */
/* Removed dark mode support to maintain consistent white header */
/* The header should always be light regardless of device theme */

/* ============================================
   Print Styles - Hide for clean printing
   ============================================ */
@media print {
    .ghost-header {
        display: none !important;
    }
}

/* ============================================
   GPU Optimization Hints
   ============================================ */
.ghost-header {
    will-change: transform, opacity;
    transform: translate3d(0, -100%, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ghost-header.revealed {
    transform: translate3d(0, 0, 0);
}