/* ============================================
   Header Styles - GitHub Primer Exact Style
   https://github.com (Light Mode)
   ============================================ */

/* Scroll Lock */
html.gh-drawer-lock,
body.gh-drawer-lock {
    overflow: hidden;
}

/* ===== Header Base ===== */
.gh-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    height: var(--header-height);
    background-color: var(--color-canvas-default);
    border-bottom: 1px solid var(--color-border-default);
}

.gh-header-backdrop {
    display: none;
}

.gh-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    max-width: var(--container-max);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ===== Logo ===== */
.gh-header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.gh-header-logo:hover {
    text-decoration: none;
}

.gh-header-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-success-emphasis);
    border-radius: var(--radius-md);
    color: white;
}

.gh-header-logo-icon svg {
    width: 18px;
    height: 18px;
}

.gh-header-logo-text {
    display: flex;
    flex-direction: column;
}

.gh-header-logo-brand {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-fg-default);
    line-height: 1.2;
}

.gh-header-logo-tagline {
    font-size: 11px;
    color: var(--color-fg-muted);
}

/* ===== Desktop Navigation ===== */
.gh-header-nav {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.gh-header-menu {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gh-header-item {
    position: relative;
}

.gh-header-link {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--color-fg-default);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: color 80ms;
}

.gh-header-link:hover {
    color: var(--color-fg-muted);
    text-decoration: none;
}

.gh-header-link-icon {
    width: 16px;
    height: 16px;
    color: var(--color-fg-muted);
}

/* Chevron Icon */
.gh-header-chevron {
    width: 12px;
    height: 12px;
    color: var(--color-fg-muted);
    transition: transform 80ms;
}

.gh-header-item--dropdown:hover .gh-header-chevron {
    transform: rotate(180deg);
}

/* ===== Dropdown ===== */
.gh-header-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    padding-top: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 80ms, visibility 80ms;
    pointer-events: none;
}

.gh-header-item--dropdown:hover > .gh-header-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gh-header-dropdown-inner {
    background-color: var(--color-canvas-overlay);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-overlay);
    padding: var(--space-1) 0;
    overflow: hidden;
}

.gh-header-dropdown-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    text-decoration: none;
    transition: background-color 80ms;
}

.gh-header-dropdown-link:hover {
    background-color: var(--color-canvas-subtle);
    text-decoration: none;
}

.gh-dropdown-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--color-fg-muted);
    flex-shrink: 0;
}

.gh-dropdown-link-icon svg {
    width: 16px;
    height: 16px;
}

.gh-dropdown-link-icon--primary {
    color: var(--color-success-fg);
}

.gh-dropdown-link-icon--warning {
    color: var(--color-warning-fg);
}

.gh-dropdown-link-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gh-dropdown-link-title {
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--color-fg-default);
}

.gh-dropdown-link-desc {
    font-size: var(--text-xs);
    color: var(--color-fg-muted);
}

/* ===== Auth & Actions ===== */
.gh-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.gh-header-auth-link {
    padding: 5px 16px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-fg-default);
    text-decoration: none;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    transition: background-color 80ms;
}

.gh-header-auth-link:hover {
    background-color: var(--color-canvas-subtle);
    text-decoration: none;
}

.gh-header-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 5px 16px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-fg-onEmphasis);
    background-color: var(--color-success-emphasis);
    border: 1px solid rgba(31, 35, 40, 0.15);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background-color 80ms;
}

.gh-header-cta:hover {
    background-color: #1e40af;
    text-decoration: none;
    color: var(--color-fg-onEmphasis);
}

.gh-header-cta svg {
    width: 14px;
    height: 14px;
}

/* ===== User Menu ===== */
.gh-header-user {
    position: relative;
}

.gh-header-user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.gh-header-user-btn:hover {
    opacity: 0.8;
}

.gh-header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-canvas-subtle);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-full);
    color: var(--color-fg-muted);
}

.gh-header-avatar svg {
    width: 16px;
    height: 16px;
}

.gh-header-user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--color-fg-default);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-header-user-chevron {
    width: 12px;
    height: 12px;
    color: var(--color-fg-muted);
    transition: transform 80ms;
}

.gh-header-user-btn[aria-expanded="true"] .gh-header-user-chevron {
    transform: rotate(180deg);
}

.gh-header-user-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background-color: var(--color-canvas-overlay);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-overlay);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 80ms, visibility 80ms, transform 80ms;
}

.gh-header-user-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gh-user-menu-header {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-default);
}

.gh-user-menu-email {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-fg-default);
}

.gh-user-menu-divider {
    height: 1px;
    background-color: var(--color-border-default);
    margin: var(--space-1) 0;
}

.gh-user-menu-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-fg-default);
    text-decoration: none;
    transition: background-color 80ms;
}

.gh-user-menu-link:hover {
    background-color: var(--color-canvas-subtle);
    text-decoration: none;
}

.gh-user-menu-link svg {
    width: 16px;
    height: 16px;
    color: var(--color-fg-muted);
}

/* ===== Mobile Menu Button ===== */
.gh-header-mobile-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-fg-default);
}

.gh-header-mobile-btn:hover {
    background-color: var(--color-canvas-subtle);
}

.gh-header-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 16px;
    height: 16px;
    gap: 4px;
}

.gh-header-hamburger span {
    display: block;
    width: 14px;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
    transition: transform 0.15s ease;
}

.gh-header-mobile-btn[aria-expanded="true"] .gh-header-hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.gh-header-mobile-btn[aria-expanded="true"] .gh-header-hamburger span:nth-child(2) {
    opacity: 0;
}

.gh-header-mobile-btn[aria-expanded="true"] .gh-header-hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ===== Mobile Drawer ===== */
.gh-drawer {
    display: none;
}

.gh-drawer.is-open {
    display: block;
}

.gh-drawer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(31, 35, 40, 0.5);
    z-index: var(--z-modal);
}

.gh-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(85vw, 320px);
    height: 100dvh;
    background-color: var(--color-canvas-default);
    z-index: calc(var(--z-modal) + 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-overlay);
    animation: slideIn 0.15s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Drawer Header */
.gh-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-default);
}

.gh-drawer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.gh-drawer-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: var(--color-success-emphasis);
    border-radius: var(--radius-sm);
    color: white;
}

.gh-drawer-logo-icon svg {
    width: 16px;
    height: 16px;
}

.gh-drawer-logo-text {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-fg-default);
}

.gh-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--color-fg-muted);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.gh-drawer-close:hover {
    background-color: var(--color-canvas-subtle);
    color: var(--color-fg-default);
}

.gh-drawer-close svg {
    width: 16px;
    height: 16px;
}

/* Drawer User */
.gh-drawer-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-default);
}

.gh-drawer-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--color-canvas-subtle);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-full);
    color: var(--color-fg-muted);
}

.gh-drawer-avatar svg {
    width: 20px;
    height: 20px;
}

.gh-drawer-user-info {
    display: flex;
    flex-direction: column;
}

.gh-drawer-username {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-fg-default);
}

.gh-drawer-useremail {
    font-size: var(--text-xs);
    color: var(--color-fg-muted);
}

/* Drawer Navigation */
.gh-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.gh-drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3);
    margin: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-fg-onEmphasis);
    background-color: var(--color-success-emphasis);
    border: 1px solid rgba(31, 35, 40, 0.15);
    border-radius: var(--radius-md);
    text-decoration: none;
}

.gh-drawer-cta:hover {
    background-color: #1e40af;
    text-decoration: none;
    color: var(--color-fg-onEmphasis);
}

.gh-drawer-cta svg {
    width: 16px;
    height: 16px;
}

.gh-drawer-section {
    margin-bottom: var(--space-2);
}

.gh-drawer-section-title {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-fg-muted);
}

.gh-drawer-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-fg-default);
    text-decoration: none;
    border-radius: var(--radius-md);
}

.gh-drawer-link:hover {
    background-color: var(--color-canvas-subtle);
    text-decoration: none;
}

.gh-drawer-link svg {
    width: 16px;
    height: 16px;
    color: var(--color-fg-muted);
    flex-shrink: 0;
}

/* Drawer Footer */
.gh-drawer-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border-default);
}

.gh-drawer-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 5px 16px;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-fg-default);
    background-color: var(--color-canvas-subtle);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    text-decoration: none;
}

.gh-drawer-footer-btn:hover {
    background-color: #f3f4f6;
    text-decoration: none;
}

.gh-drawer-footer-btn--primary {
    color: var(--color-fg-onEmphasis);
    background-color: var(--color-success-emphasis);
    border-color: rgba(31, 35, 40, 0.15);
}

.gh-drawer-footer-btn--primary:hover {
    background-color: #1e40af;
    color: var(--color-fg-onEmphasis);
}

.gh-drawer-contact {
    margin-top: var(--space-3);
    text-align: center;
}

.gh-drawer-phone {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-accent-fg);
    text-decoration: none;
}

.gh-drawer-phone:hover {
    text-decoration: underline;
}

.gh-drawer-phone svg {
    width: 14px;
    height: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .gh-header-nav {
        display: none;
    }

    .gh-header-actions {
        display: none;
    }

    .gh-header-mobile-btn {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    .gh-header-inner {
        padding: 0 var(--space-3);
    }

    .gh-header-logo-tagline {
        display: none;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .gh-header-dropdown,
    .gh-header-user-menu,
    .gh-drawer-panel {
        transition: none;
        animation: none;
    }
}
