/* Apple-like Header Styles */

/* The header container injected by JS */
.site-header-container {
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    height: 44px;
    background-color: #ffffff;
    font-family: "SF Pro Text", "Myriad Set Pro", "SF Pro Icons", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
    font-size: 14px;
    color: #1d1d1f;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
}

.site-header-container a {
    color: #86868b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-header-container a:hover {
    color: #1d1d1f;
}

/* Inner content wrapper to center and align items */
.site-header-inner {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 22px;
    height: 44px; /* Fixed height for inner content */
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Target elements generated from Markdown */

/* Logo (first paragraph) */
.site-header-inner > p:first-of-type {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
    z-index: 10001; /* Above overlay */
    position: relative;
}

/* Navigation List */
.site-header-inner > ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 24px;
    height: 100%;
    align-items: center;
}

.site-header-inner > ul li {
    margin: 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 44px; /* Match header height for touch target */
    position: relative;
    z-index: 10001; /* Above overlay */
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px; /* Thicker lines */
    background-color: #1d1d1f;
    position: absolute;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.mobile-menu-btn span:first-child {
    top: 19px; /* Center - 2px */
}

.mobile-menu-btn span:last-child {
    top: 25px; /* Center + 4px */
}

/* Mobile Styles */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .site-header-inner > ul {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: #ffffff;
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 40px 40px; /* Top padding to clear header */
        gap: 0;
        z-index: 10000; /* Behind logo/button, above content */
        
        /* Animation State: Closed */
        clip-path: inset(0 0 100% 0); /* Hidden from bottom up */
        visibility: hidden;
        transition: clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.5s;
        
        overflow-y: auto;
    }

    .site-header-inner > ul li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .site-header-inner > ul li:first-child {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .site-header-inner > ul li a {
        display: block;
        padding: 14px 0;
        font-size: 24px;
        font-weight: 600;
        color: #1d1d1f;
    }

    /* Menu Open State */
    body.menu-open {
        overflow: hidden; /* Lock scroll */
    }

    body.menu-open .site-header-container {
        /* No height change, just keep it transparent/blurred or solid if needed */
        background-color: transparent; /* Let the ul background show through if needed, or keep it */
    }

    body.menu-open .site-header-inner > ul {
        visibility: visible;
        clip-path: inset(0 0 0 0); /* Fully visible */
        transition: clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Staggered Animation for List Items */
    body.menu-open .site-header-inner > ul li {
        opacity: 1;
        transform: translateY(0);
    }

    body.menu-open .site-header-inner > ul li:nth-child(1) { transition-delay: 0.05s; }
    body.menu-open .site-header-inner > ul li:nth-child(2) { transition-delay: 0.1s; }
    body.menu-open .site-header-inner > ul li:nth-child(3) { transition-delay: 0.15s; }
    body.menu-open .site-header-inner > ul li:nth-child(4) { transition-delay: 0.2s; }
    body.menu-open .site-header-inner > ul li:nth-child(5) { transition-delay: 0.25s; }
    body.menu-open .site-header-inner > ul li:nth-child(6) { transition-delay: 0.3s; }
    body.menu-open .site-header-inner > ul li:nth-child(7) { transition-delay: 0.35s; }

    /* Button Animation */
    body.menu-open .mobile-menu-btn span:first-child {
        transform: rotate(45deg);
        top: 21px; /* Adjusted for 2px height */
    }

    body.menu-open .mobile-menu-btn span:last-child {
        transform: rotate(-45deg);
        top: 21px; /* Adjusted for 2px height */
    }
}

/* Header Logo Image Styles */
.site-header-inner > p:first-of-type img {
    height: 28px;
    width: auto;
    display: block;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}

.site-header-inner > p:first-of-type a {
    display: flex;
    align-items: center;
}

.site-header-inner > p:first-of-type a:hover img {
    opacity: 0.8;
}
