/**
 * Principia Metaphysica - Unified Header Styles
 * ==============================================
 *
 * Single source of truth for header styling across all pages.
 * Include this CSS in any page that uses pm-header.js
 *
 * Accessibility:
 * - WCAG AA compliant color contrast (4.5:1 for normal text, 3:1 for large text)
 * - Keyboard navigation fully supported with visible focus indicators
 * - ARIA attributes for screen readers
 * - Mobile responsive design
 *
 * Copyright (c) 2025-2026 Andrew Keith Watts. All rights reserved.
 */

/* ============================================
   PM Header - Glass Morphism Design
   ============================================ */

/* Skip to content link for keyboard navigation */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: #8b7fff;
    color: #fff;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.pm-header {
    background: rgba(26, 31, 58, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pm-header .header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

/* Site Title */
.pm-header .site-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8f9fa;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.pm-header .site-title:hover {
    color: #8b7fff;
}

.pm-header .site-title:focus {
    outline: 2px solid #8b7fff;
    outline-offset: 4px;
}

/* Main Navigation */
.pm-header .main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.pm-header .main-nav li {
    margin: 0;
    padding: 0;
}

.pm-header .main-nav a {
    color: rgba(255, 255, 255, 0.9); /* Enhanced contrast for WCAG AA */
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
    white-space: nowrap;
}

.pm-header .main-nav a:hover {
    background: rgba(139, 127, 255, 0.15);
    color: #fff;
}

.pm-header .main-nav a:focus {
    outline: 2px solid #8b7fff;
    outline-offset: 2px;
    background: rgba(139, 127, 255, 0.15);
    color: #fff;
}

.pm-header .main-nav a.active {
    background: linear-gradient(135deg, rgba(139, 127, 255, 0.25), rgba(255, 126, 182, 0.15));
    color: #fff;
    border: 1px solid rgba(139, 127, 255, 0.3);
}

/* User Controls */
.pm-header .user-controls-nav {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.pm-header .user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pm-header .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(139, 127, 255, 0.5);
    object-fit: cover;
}

.pm-header .user-email {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-header .logout-btn {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pm-header .logout-btn:hover {
    background: rgba(248, 113, 113, 0.3);
    border-color: rgba(248, 113, 113, 0.5);
}

.pm-header .logout-btn:focus {
    outline: 2px solid #f87171;
    outline-offset: 2px;
}

.pm-header .header-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f8f9fa;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pm-header .header-login-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.pm-header .header-login-btn:focus {
    outline: 2px solid #8b7fff;
    outline-offset: 2px;
}

.pm-header .google-icon-small {
    width: 16px;
    height: 16px;
}

/* Mobile Menu Button */
.pm-header .mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.pm-header .mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: #f8f9fa;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.pm-header .mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.pm-header .mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.pm-header .mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

.pm-header .mobile-menu-btn:focus {
    outline: 2px solid #8b7fff;
    outline-offset: 2px;
}

/* ============================================
   Breadcrumb Styles
   ============================================ */

.pm-breadcrumb {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pm-breadcrumb a {
    color: #8b7fff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pm-breadcrumb a:hover {
    color: #a394ff;
    text-decoration: underline;
}

.pm-breadcrumb .separator {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 0.25rem;
}

.pm-breadcrumb .current {
    color: #f8f9fa;
    font-weight: 500;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .pm-header *,
    .pm-header *::before,
    .pm-header *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 1024px) {
    .pm-header {
        padding: 0.75rem 1.5rem;
    }

    .pm-header .main-nav a {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .pm-header .user-email {
        display: none;
    }
}

@media (max-width: 768px) {
    .pm-header .header-content {
        flex-wrap: nowrap;
    }

    .pm-header .mobile-menu-btn {
        display: flex;
    }

    .pm-header .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(26, 31, 58, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1rem;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }

    .pm-header .main-nav.mobile-open {
        display: block;
    }

    .pm-header .main-nav ul {
        flex-direction: column;
        gap: 0.25rem;
    }

    .pm-header .main-nav a {
        display: block;
        padding: 0.75rem 1rem;
    }

    .pm-header .user-controls-nav {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-left: 0;
        margin-top: 0.5rem;
        padding-left: 0;
        padding-top: 0.75rem;
    }
}

/* ============================================
   Hide default header when pm-header is present
   ============================================ */

body:has(.pm-header) > header:not(.pm-header),
body:has(.pm-header) .app-header:not(.pm-header) {
    display: none !important;
}
