/* Joe Theme Custom Beautification & Dark Mode Default Enhancement */

/* 1. Global Polish & Variables */
html {
    --radius-wrap: 12px;
    --radius-inner: 8px;
    /* Soften the default shadows */
    --box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05) !important; 
    --box-shadow-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.12) !important;
    scroll-behavior: smooth;
}

/* 2. Enhanced Animations */
/* Smooth transitions for all major containers */
.joe_header, 
.joe_aside__item, 
.joe_post__item, 
.joe_archive__item, 
.joe_list__item,
.joe_dropdown__menu {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

/* 3. Hover Effects */
/* Lift up effect for cards */
.joe_post__item:hover, 
.joe_archive__item:hover, 
.joe_list__item:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover) !important;
    border-color: var(--theme); /* Optional: highlight border */
}

/* Button Pulse/Lift */
button:not(.disabled):hover, 
.submit:not(.disabled):hover, 
.joe_btn:not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* 4. Glassmorphism for Header */
/* We use !important to override the specific theme styles if needed, 
   but careful not to break dark/light specifics too much. */
/* MODIFIED: Use pseudo-element for backdrop-filter to avoid breaking fixed positioning of children (slideout) on Mobile */
.joe_header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    /* CRITICAL: Disable inherited backdrop-filter to prevent creating a containing block that breaks fixed position children */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important; /* Ensure no transform creates a new context */
}

.joe_header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    z-index: -1;
}

/* Dark Mode Specific Beautification */
html[data-night="night"] .joe_header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}

html[data-night="night"] .joe_header::before {
    background: rgba(30, 32, 40, 0.85);
}

/* Remove dark-mode card border line (right edge) */
html[data-night="night"] .joe_index {
    border: none !important;
}

/* 4.1 Mobile Slideout Height Fix */
.joe_header__slideout,
.joe_header__slideout.active {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: var(--slideout-vh, 100vh) !important;
    min-height: 100vh !important;
    max-height: none !important;
    box-sizing: border-box;
}

@media (max-width: 992px) {
    .joe_header__slideout {
        height: var(--slideout-vh, 100dvh) !important;
        min-height: 100dvh !important;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark Mode Card Glow */
html[data-night="night"] .joe_post__item:hover,
html[data-night="night"] .joe_archive__item:hover {
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.6) !important;
    border: 1px solid var(--theme);
}

/* 5. Modern Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--theme);
}

html[data-night="night"] ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
}
html[data-night="night"] ::-webkit-scrollbar-thumb:hover {
    background-color: var(--theme);
}

/* 6. Page/Container Spacing polish */
.joe_main {
    padding-top: 15px; /* Slight offset for cleaner look */
}

/* 7. Input Fields Polish */
.input, textarea {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.input:focus, textarea:focus {
    background: var(--background);
    border-color: var(--theme);
    box-shadow: 0 0 0 3px rgba(100, 100, 100, 0.1); /* Safe generic focus ring */
}

/* 8. Fade In Animation for Posts */
@keyframes joeFadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.joe_post__item {
    animation: joeFadeInUp 0.8s ease backwards;
}

/* Stagger animation delay if possible, but without JS we can't easily index them. 
   We can try nth-child but it's flaky with pagination. */
.joe_post__item:nth-child(1) { animation-delay: 0.1s; }
.joe_post__item:nth-child(2) { animation-delay: 0.2s; }
.joe_post__item:nth-child(3) { animation-delay: 0.3s; }
.joe_post__item:nth-child(4) { animation-delay: 0.4s; }
.joe_post__item:nth-child(5) { animation-delay: 0.5s; }

/* --- Typecho Joe Theme Beautification Part 2 --- */

/* 8. Typography & Content Reading Experience */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
}

/* Improve Article Readability */
.joe_detail__article {
    font-size: 16px;
    letter-spacing: 0.02em;
    color: var(--main);
}
.joe_detail__article p {
    margin-bottom: 1.2em;
    line-height: 1.8;
}
/* Refined Image Styles in Articles */
.joe_detail__article img {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.joe_detail__article img:hover {
    transform: scale(1.01);
}

/* 9. Better Blockquotes */
.joe_detail__article blockquote {
    border-left: 4px solid var(--theme);
    background: rgba(128, 128, 128, 0.05); /* Neutral subtle background */
    border-radius: 0 8px 8px 0;
    padding: 15px 20px;
    margin: 20px 0;
    color: var(--routine);
    font-style: italic;
}
html[data-night="night"] .joe_detail__article blockquote {
    background: rgba(255, 255, 255, 0.05);
}

/* 10. Tag Cloud Pills in Header Search */
/* Transform rectangular tags into modern pills */
.joe_header__searchout .cloud .item {
    margin: 5px;
}
.joe_header__searchout .cloud .item a {
    border-radius: 50px !important;
    padding: 6px 16px !important;
    display: inline-block;
    color: #fff !important;
    opacity: 0.9;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: all 0.3s !important;
    border: none !important;
    font-size: 13px !important;
}
.joe_header__searchout .cloud .item a:hover {
    transform: translateY(-2px) scale(1.05);
    opacity: 1;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* 11. Aside Title Decoration */
/* Add a colored bar to the left of widget titles */
.joe_aside__item-title {
    position: relative;
    padding-left: 14px;
}
.joe_aside__item-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: var(--theme);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(var(--theme), 0.3);
}

/* 12. Footer Polish */
.joe_footer {
    background: var(--background) !important;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 40px 0 !important;
    margin-top: 40px;
}
html[data-night="night"] .joe_footer {
    border-top: 1px solid rgba(255,255,255,0.05);
}
.joe_footer .item {
    color: var(--minor);
    font-size: 13px;
    margin-bottom: 8px;
    opacity: 0.8;
    transition: opacity 0.3s;
}
.joe_footer .item:hover {
    opacity: 1;
}

/* 13. Comment Section Enhancements */
.joe_comment {
    border-radius: var(--radius-wrap);
    /* Ensure comments also have the refined shadow */
    box-shadow: var(--box-shadow) !important;
}
/* Inputs styling */
.joe_comment__respond-form .head input,
.joe_comment__respond-form .body textarea {
    background: var(--background);
    border: 1px solid rgba(128,128,128, 0.15);
    border-radius: 8px;
    transition: all 0.3s ease;
    padding: 10px;
}
.joe_comment__respond-form .head input:focus,
.joe_comment__respond-form .body textarea:focus {
    border-color: var(--theme);
    background: var(--classD); /* Slightly distinct background on focus */
    box-shadow: 0 0 0 3px rgba(100, 100, 100, 0.1); 
}
html[data-night="night"] .joe_comment__respond-form .head input,
html[data-night="night"] .joe_comment__respond-form .body textarea {
    border-color: rgba(255,255,255, 0.1);
    background: rgba(0,0,0,0.2);
}

/* 14. Code Block Container Polish */
/* Give code blocks a bit more breathing room and rounded corners */
pre[class*="language-"] {
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    margin: 25px 0 !important;
    border: 1px solid rgba(128,128,128,0.1);
}


