/* Desktop Enhancements - Keyboard navigation and split-screen layout */
/* WP06 Phase 3: Desktop UX improvements */

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

/* Keyboard-focused article card */
.article-card.keyboard-focused {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 4px;
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), 0.15),
        var(--shadow-card);
    transition: outline 150ms ease, box-shadow 150ms ease;
}

[data-theme="dark"] .article-card.keyboard-focused {
    outline-color: var(--color-primary-400);
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), 0.25),
        var(--shadow-card);
}

/* Subtle animation for keyboard focus */
@keyframes focusPulse {
    0%, 100% {
        outline-offset: 4px;
    }
    50% {
        outline-offset: 6px;
    }
}

.article-card.keyboard-focused {
    animation: focusPulse 2s ease-in-out infinite;
}

/* Screen reader only announcer */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================================
   SPLIT-SCREEN LAYOUT (Wide Desktop ≥1280px)
   ============================================================================= */

/* Split-screen mode when an article is expanded on wide screens */
@media (min-width: 1280px) {
    /* Container becomes split layout when article is expanded */
    .articles-container.split-screen-active {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }

    /* Article list takes left side */
    .articles-container.split-screen-active .articles-grid {
        grid-column: 1;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        padding-right: 1rem;
    }

    /* Expanded details panel takes right side */
    .articles-container.split-screen-active .split-screen-panel {
        grid-column: 2;
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        background: var(--color-bg-secondary, #f9fafb);
        border-radius: 1.5rem;
        padding: 1.5rem;
        border: 1px solid var(--border-color, #e5e7eb);
        box-shadow: var(--shadow-lg);
    }

    [data-theme="dark"] .split-screen-panel {
        background: var(--color-bg-tertiary, #1f2937);
        border-color: rgba(255, 255, 255, 0.1);
    }

    /* Hide inline details when split-screen is active */
    .articles-container.split-screen-active .article-card .details-panel {
        display: none;
    }

    /* Split screen panel header */
    .split-screen-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--border-color, #e5e7eb);
    }

    .split-screen-panel-title {
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--color-text-primary);
        margin: 0;
    }

    .split-screen-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: none;
        border-radius: 8px;
        background: transparent;
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: background 150ms ease, color 150ms ease;
    }

    .split-screen-close:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--color-text-primary);
    }

    [data-theme="dark"] .split-screen-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Custom scrollbar for split-screen panels */
    .articles-container.split-screen-active .articles-grid::-webkit-scrollbar,
    .split-screen-panel::-webkit-scrollbar {
        width: 8px;
    }

    .articles-container.split-screen-active .articles-grid::-webkit-scrollbar-track,
    .split-screen-panel::-webkit-scrollbar-track {
        background: transparent;
    }

    .articles-container.split-screen-active .articles-grid::-webkit-scrollbar-thumb,
    .split-screen-panel::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
    }

    .articles-container.split-screen-active .articles-grid::-webkit-scrollbar-thumb:hover,
    .split-screen-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.25);
    }

    [data-theme="dark"] .articles-container.split-screen-active .articles-grid::-webkit-scrollbar-thumb,
    [data-theme="dark"] .split-screen-panel::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }

    [data-theme="dark"] .articles-container.split-screen-active .articles-grid::-webkit-scrollbar-thumb:hover,
    [data-theme="dark"] .split-screen-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* =============================================================================
   KEYBOARD SHORTCUTS HELP OVERLAY
   ============================================================================= */

.keyboard-shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.keyboard-shortcuts-overlay.active {
    opacity: 1;
    visibility: visible;
}

.keyboard-shortcuts-modal {
    background: var(--color-bg-primary, #ffffff);
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .keyboard-shortcuts-modal {
    background: var(--color-bg-secondary, #1f2937);
}

.keyboard-shortcuts-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--color-text-primary);
}

.keyboard-shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.keyboard-shortcuts-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.keyboard-shortcuts-list li:last-child {
    border-bottom: none;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: var(--color-bg-tertiary, #f3f4f6);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-family: ui-monospace, monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

[data-theme="dark"] .shortcut-key {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.shortcut-description {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

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

@media (prefers-reduced-motion: reduce) {
    .article-card.keyboard-focused {
        animation: none;
    }
}
