/*
Theme Name: Dark Apple
Theme URI: https://xu2.xyz
Version: 6.0
*/

/* ========================
   1. GLOBAL RESET & TOKENS
   ======================== */
:root {
    --color-bg: #000;
    --color-surface: #111;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-text: #f5f5f7;
    --color-muted: #86868b;
    --color-accent: #fff;
    --nav-height: 64px;
    --nav-height-sm: 56px;
    --radius: 16px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.19, 1, 0.22, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--color-text);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent);
}

a:visited {
    color: var(--color-text);
}

h1,
h2,
h3,
h4,
h5 {
    color: var(--color-text);
    font-weight: 600;
}

/* ========================
   2. HEADER / NAV
   ======================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--color-border);
    z-index: 9000;
    transition: background 0.3s var(--ease-smooth);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Logo LEFT, Nav RIGHT */
}

/* --- Logo --- */
.nav-logo a {
    display: flex;
    align-items: center;
}

.nav-logo img {
    height: 48px;
    width: auto;
    display: block;
    mix-blend-mode: screen;
    filter: brightness(1.15);
    transition: transform 0.25s var(--ease-smooth);
}

.nav-logo a:hover img {
    transform: scale(1.04);
}

/* --- Desktop Nav Links --- */
.nav-links {
    display: flex;
    align-items: center;
}

.nav-links ul {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
}

.nav-links ul li a {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.02em;
    transition: color 0.2s var(--ease-smooth);
    padding: 4px 0;
    position: relative;
}

.nav-links ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #fff;
    transition: width 0.25s var(--ease-smooth);
}

.nav-links ul li a:hover {
    color: #fff;
}

.nav-links ul li a:hover::after {
    width: 100%;
}

.nav-links ul li.current_page_item a {
    color: #fff;
}

/* --- Hamburger Button (hidden on desktop) --- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    z-index: 9100;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.35s var(--ease-spring), opacity 0.2s;
}

/* Hamburger → X animation */
.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(3.25px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
    transform: translateY(-3.25px) rotate(-45deg);
}

/* --- Overlay --- */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 8900;
    opacity: 0;
    transition: opacity 0.3s var(--ease-smooth);
}

.nav-open .nav-overlay {
    display: block;
    opacity: 1;
}

/* ========================
   3. MAIN / CONTENT
   ======================== */
.site-main {
    min-height: calc(100vh - var(--nav-height) - 80px);
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 60px) 40px 80px;
}

/* Post cards in archive/home */
.post-card {
    padding: 32px 0;
    border-bottom: 1px solid var(--color-border);
}

.post-title a {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    transition: opacity 0.2s;
}

.post-title a:hover {
    opacity: 0.7;
}

.post-excerpt {
    color: var(--color-muted);
    margin-top: 8px;
    font-size: 15px;
}

/* ========================
   4. FOOTER
   ======================== */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 48px 40px;
    text-align: center;
}

.footer-inner p {
    color: var(--color-muted);
    font-size: 13px;
}

/* ========================
   5. RESPONSIVE: TABLET (max 900px)
   ======================== */
@media (max-width: 900px) {
    .nav-container {
        max-width: 100%;
        padding: 0 24px;
        /* Three-zone layout: spacer | logo | hamburger */
        display: grid;
        grid-template-columns: 48px 1fr 48px;
        align-items: center;
    }

    /* Logo centered via grid */
    .nav-logo {
        grid-column: 2;
        text-align: center;
        display: flex;
        justify-content: center;
    }

    .nav-logo img {
        height: 40px;
    }

    /* Toggle in THIRD column (right side) */
    .nav-toggle {
        display: flex;
        grid-column: 3;
        justify-self: end;
    }

    /* Slide-in drawer from RIGHT */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 260px;
        height: 100vh;
        background: rgba(12, 12, 14, 0.95);
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        border-left: 1px solid var(--color-border);
        padding-top: calc(var(--nav-height) + 32px);
        flex-direction: column;
        align-items: flex-start;
        z-index: 9050;
        transition: right 0.4s var(--ease-spring);
        box-shadow: none;
    }

    .nav-open .nav-links {
        right: 0;
        box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
    }

    .nav-links ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
        padding: 0 8px;
    }

    .nav-links ul li {
        width: 100%;
    }

    .nav-links ul li a {
        display: block;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 500;
        color: #fff;
        border-radius: 10px;
        transition: background 0.2s;
    }

    .nav-links ul li a:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .nav-links ul li a::after {
        display: none;
    }

    .site-main {
        padding: calc(var(--nav-height) + 40px) 24px 60px;
    }

    .site-footer {
        padding: 40px 24px;
    }
}

/* ========================
   6. RESPONSIVE: MOBILE (max 480px)
   ======================== */
@media (max-width: 480px) {
    :root {
        --nav-height: var(--nav-height-sm);
    }

    .nav-logo img {
        height: 36px;
    }

    .nav-links {
        width: 240px;
    }

    .nav-links ul li a {
        font-size: 15px;
        padding: 12px 16px;
    }

    .site-main {
        padding: calc(var(--nav-height-sm) + 32px) 20px 50px;
    }

    .site-footer {
        padding: 32px 20px;
    }

    .post-title a {
        font-size: 18px;
    }
}

/* ========================
   7. UTILITY
   ======================== */
/* Hide WP default admin bar shift */
.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}