/* --- CSS Variables and Base Styles --- */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-red: #ff4757;
    --accent-green: #00d4aa;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* --- Fixed Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    height: 80px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
}

.site-header h1 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Desktop Layout & Scrollspy Sidebar --- */
.layout-container {
    display: flex;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 0;
}

.scrollspy-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 20px;
}

.scrollspy-sidebar ul { list-style: none; border-left: 1px solid var(--card-border); }
.scrollspy-sidebar a {
    display: block;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
    border-left: 2px solid transparent;
    margin-left: -1px;
}
.scrollspy-sidebar a:hover { color: var(--text-primary); background-color: var(--card-bg); }
.scrollspy-sidebar a.active {
    color: var(--text-primary);
    font-weight: 600;
    transform: translateX(5px);
    border-left-color: var(--accent-green);
}

/* --- Mobile Navigation: Hamburger & Overlay --- */
.mobile-nav-toggle { display: none; } /* Hidden on desktop */
.mobile-nav-overlay { display: none; } /* Hidden on desktop */

/* --- Main Content Styling --- */
.container { width: 100%; }
.page { padding-bottom: 8vh; margin-bottom: 8vh; scroll-margin-top: 100px; }
.page:last-child { margin-bottom: 0; padding-bottom: 0; }
.note {
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 70px;
    width: 100%;
}
.date { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 10px; letter-spacing: 2px; text-transform: uppercase; }
.note .title { font-size: 2.5rem; font-weight: 700; margin-bottom: 30px; line-height: 1.2; }
.post-image { display: block; width: 100%; height: auto; border-radius: 16px; margin-bottom: 20px; background-color: var(--bg-secondary); opacity: 0; transition: opacity 0.5s ease-in-out; }
.post-image.loaded { opacity: 1; }
.grumpy, .optimist { position: relative; padding: 20px; margin-bottom: 20px; border-left-width: 3px; border-left-style: solid; border-radius: 0 10px 10px 0; font-size: 1.1rem; line-height: 1.8; color: rgba(255, 255, 255, 0.9); white-space: pre-wrap; }
.grumpy { border-left-color: var(--accent-red); background: linear-gradient(90deg, rgba(255, 71, 87, 0.1) 0%, transparent 100%); }
.grumpy::before { content: '😤'; position: absolute; left: -40px; top: 20px; font-size: 2rem; filter: grayscale(0.3); }
.optimist { border-left-color: var(--accent-green); background: linear-gradient(90deg, rgba(0, 212, 170, 0.1) 0%, transparent 100%); }
.optimist::before { content: '✨'; position: absolute; left: -40px; top: 20px; font-size: 2rem; }

/* --- Utility, Loading, and Error States --- */
.loading, .error { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.loading-spinner, .mini-spinner { border: 3px solid var(--card-border); border-top-color: var(--accent-green); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; }
.loading-spinner { width: 50px; height: 50px; }
.mini-spinner { width: 30px; height: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { padding: 40px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 20px; max-width: 500px; }
.error h2 { color: var(--accent-red); margin-bottom: 20px; }
.note-placeholder { display: flex; justify-content: center; align-items: center; min-height: 150px; color: var(--text-secondary); }

/* --- Responsive Media Queries --- */
@media (max-width: 900px) {
    /* Hide desktop sidebar */
    .scrollspy-sidebar {
        display: none;
    }

    .layout-container {
        padding: 80px 15px 0;
    }

    .note {
        padding: 25px;
    }

    /* Show and style the hamburger button */
    .mobile-nav-toggle {
        display: block;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        padding: 10px;
        cursor: pointer;
        z-index: 1200;
    }
    .mobile-nav-toggle .bar {
        display: block;
        width: 25px;
        height: 3px;
        background-color: var(--text-primary);
        margin: 5px 0;
        transition: all 0.3s ease;
    }

    /* Show and style the overlay */
    .mobile-nav-overlay {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(15px);
        z-index: 1100;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transform: scale(0.95);
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    }
    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
        transform: scale(1);
    }
    .mobile-nav-overlay ul { list-style: none; text-align: center; padding: 0 20px; }
    .mobile-nav-overlay li { margin: 15px 0; }
    .mobile-nav-overlay a { color: var(--text-secondary); text-decoration: none; font-size: 1.5rem; font-weight: 300; transition: color 0.2s ease; }
    .mobile-nav-overlay a.active { color: var(--text-primary); }
}
