/*
 * article.css
 * Styles specific to article pages, including the navigation and main content windows.
 * This version includes distinct styles for desktop and mobile views.
 */

#gallery-window .content {
    overflow-y: auto;
    /* Allow vertical scrolling */
    height: 100%;
    padding: 1rem;
    /* Reduced padding for a more subtle look */
}

/* Indent paragraphs within the article for better readability */
#gallery-window .content p {
    text-indent: 1em;
    /* Reduced indent for a more subtle effect */
}

/* Allow asides to break out of the container's padding for a full-width effect */
#gallery-window .content aside {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0.5rem 1rem;
    /* Add padding back to the aside's content */
}

.article-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border: 2px solid var(--border-color);
}

/* --- DESKTOP STYLES (769px and wider) --- */
@media (min-width: 769px) {

    /* Main content window takes up the remaining space */
    #gallery-window .content {
        padding: 1.5rem;
        /* Reduced padding for desktop view */
        max-height: none;
        top: 0;
        left: 260px;
        right: 0;
        bottom: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Adjust aside for desktop padding */
    #gallery-window .content aside {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        padding: 1rem 1.5rem;
    }

    /* Desktop navigation window with constrained height and scrolling content */
    #nav-window {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 250px;
        height: auto;
        max-height: calc(100vh - 40px);
        /* Constrain height to viewport with margins */
        z-index: var(--z-window-base);
        display: flex;
        /* Ensure flex properties apply */
        flex-direction: column;
    }

    #nav-window .content {
        max-height: none;
        /* Allows content to fill the parent's height */
        overflow-y: auto;
        /* Enables scrolling within the nav content */
    }
}

/* --- MOBILE STYLES (768px and narrower) --- */
@media (max-width: 768px) {

    /* Allow the main body to scroll on mobile */
    body {
        overflow-y: auto;
    }

    /* Standard windows become part of the document flow */
    .window:not(#nav-window) {
        position: relative !important;
        width: auto !important;
        left: 0 !important;
        top: 0 !important;
        margin: 10px;
        z-index: auto !important;
    }

    /* --- Mobile Navigation Pendant Styles --- */

    /* Collapsed state: A floating button */
    .window#nav-window {
        position: fixed !important;
        top: auto !important;
        left: auto !important;
        bottom: 80px !important;
        right: 20px !important;
        width: 50px;
        height: 50px;
        border-radius: 0;
        z-index: var(--z-start-menu) !important;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--inv-bg-color);
        border: 2px solid var(--inv-text-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }

    /* Hide original window parts when collapsed */
    .window#nav-window:not(.expanded) .title-bar,
    .window#nav-window:not(.expanded) .content {
        display: none;
    }

    /* Display the '◈' symbol for the button */
    .window#nav-window::before {
        content: '◈';
        font-family: 'Symbola', sans-serif;
        font-size: 28px;
        color: var(--inv-text-color);
    }

    /* Hide the symbol when expanded */
    .window#nav-window.expanded::before {
        display: none;
    }

    /* Expanded state: A full-screen overlay */
    .window#nav-window.expanded {
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        width: auto !important;
        height: auto !important;
        margin: 0;
        cursor: default;
        background-color: var(--win-bg-color);
        border: 2px solid var(--border-color);
        color: var(--text-color);
        box-sizing: border-box;
        /* Ensures padding/border are included in the element's total size */
    }

    /* Show original window parts when expanded */
    .window#nav-window.expanded .title-bar {
        display: flex;
        cursor: default;
        width: 100%;
        /* **FIX:** Make title bar full width */
        height: auto;
        /* **FIX:** Allow height to adjust to content, overriding fixed height */
    }

    /* This makes the content area scrollable within the expanded overlay */
    .window#nav-window.expanded .content {
        display: block;
        flex-grow: 1;
        /* Allow content to fill the remaining space */
        overflow-y: auto;
        /* **THIS ENABLES SCROLLING** */
        padding: 1rem;
        max-height: none;
        /* Ensure it's not limited by other rules */
    }
}

/* --- List Styling for Articles --- */

/* Common properties for both list types */
#gallery-window .content ul,
#gallery-window .content ol {
    margin: 1em 0;
    padding-left: 2.5em;
    /* Provides space for markers */
    font-size: 14px
}

#gallery-window .content li {
    margin-bottom: 0.5em;
}

/* Restore bullets for unordered lists */
#gallery-window .content ul {
    list-style: disc;
}

/* Restore numbers for ordered lists, as requested */
#gallery-window .content ol {
    list-style: decimal;
}