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

:root {
    --bg-color: #ffffff;
    --text-color: #212121;
    --primary-color: #007bff;
    --sidebar-width: 260px;
    --font-main: 'Century Gothic', CenturyGothic, Geneva, AppleGothic, sans-serif;

}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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


/* --- Sidebar Styles --- */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #f8f8f8;
    padding: 40px;
    box-sizing: border-box;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-pic {
    width: 180px;     
    height: 220px;      
    object-fit: cover;
    margin-bottom: 30px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sidebar-nav a {
    color: #555;
    margin: 10px 0;
    font-size: 1.1em;
}

.sidebar-nav a.active {
    color: var(--text-color);
    font-weight: bold;
}


/* --- Main Content Styles --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 60px;
    width: calc(100% - var(--sidebar-width));
    max-width: 820px;
}

.main-content h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.main-content p {
    font-size: 1.1em;
    line-height: 1.7;
}



/* --- Responsive Design (Mobile/Tablet) --- */
@media (max-width: 768px) {
    body {
        flex-direction: row; /* Changed back to row for overlay */
    }

    /* Show hamburger button on mobile */
    #mobile-menu-button {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%; /* Hidden off-screen */
        width: var(--sidebar-width);
        height: 100vh;
        background-color: #f8f8f8;
        padding: 40px;
        border-right: 1px solid #e0e0e0;
        border-bottom: none;
        z-index: 999;
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* When sidebar is open */
    .sidebar.is-open {
        left: 0;
    }

    /* Hide profile picture on mobile */
    .sidebar .profile-pic {
        display: none;
    }

    /* Reset sidebar nav to vertical on mobile when in sidebar */
    .sidebar-nav {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        margin-top: 20px;
    }

    .sidebar-nav a {
        margin: 15px 0;
        font-size: 1.2em;
    }
    
    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 80px 30px 30px 30px; /* Extra top padding for hamburger */
    }

    /* Overlay backdrop when menu is open */
    .mobile-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    }

    .mobile-backdrop.is-open {
        opacity: 1;
        visibility: visible;
    }
}



* --- Additions for Readings Page --- */

.reading-section {
    margin-bottom: 50px;
}

.reading-section h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}


/* --- Bookshelf Styles (Clickable LI, no underline) --- */
.bookshelf {
    list-style: disc;
    padding-left: 20px;
}

.bookshelf li {
    margin-bottom: 12px;
    cursor: pointer;
}

.bookshelf li a {
    text-decoration: none; 
    color: inherit; 
    display: block;
    transition: background-color 0.2s ease-in-out;
    padding: 4px 8px;
    margin: -4px -8px; 
    border-radius: 4px;
}

.bookshelf li a:hover {
    background-color: #f5f5f5;
}


/* --- Papershelf Styles (standard links) --- */
.papershelf {
    list-style: disc;
    padding-left: 20px;
}

.papershelf li {
    margin-bottom: 12px;
    line-height: 1.6;
}


/* --- Online Reading & Textbooks Styles --- */
.list-container p {
    margin-bottom: 20px;
    line-height: 1.7;
}

.title-link {
    font-weight: bold;
    color: #2a7ae2; 
}

.title-link:hover {
    text-decoration: underline;
    color: #212121;
}





/* --- Additions for Section Header Linking (Corrected Alignment) --- */

html {
    scroll-behavior: smooth;
}

.reading-section h2 a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    position: relative;    
    display: inline-block;   
}

.link-icon {
    position: absolute;      
    left: -1.4em;           
    top: 50%;             
    transform: translateY(-50%);
    width: 0.8em;
    height: 0.8em;
    opacity: 0;             
    transition: opacity 0.2s ease-in-out;
    fill: currentColor;
}

.reading-section h2 a:hover .link-icon {
    opacity: 0.6;
}





/* --- Additions for Bookmarks Page --- */

.quote-list {
    list-style: disc;
    padding-left: 20px;
}

.quote-list li {
    margin-bottom: 24px;
    font-size: 1.1em;
    line-height: 1.7;
}

.quote-list li a {
    color: #2a7ae2; 
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.quote-list li a:hover {
    color: #212121; 
}




/* --- ASCII Art Style --- */
.ascii-art {
    color: black;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8em;
    line-height: 1.2;
    text-align: left;
    margin-top: 80px;
    margin-bottom: 20px;
    overflow-x: auto;
    user-select: none;
}



/* --- Style for "stealth" links that look like normal text --- */
.stealth-link {
    color: inherit;         
    text-decoration: none;   
    cursor: pointer;        
}

/* Ensure it doesn't change style on hover either */
.stealth-link:hover {
    color: inherit;
    text-decoration: none;
}


/* --- Hamburger Menu Button --- */
#mobile-menu-button {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    background: var(--bg-color);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#mobile-menu-button:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

#mobile-menu-button span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-color);
    margin: 3px 0;
    transition: all 0.3s ease-in-out;
    transform-origin: center;
}

/* Animation for the hamburger icon to turn into an 'X' */
#mobile-menu-button.is-active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#mobile-menu-button.is-active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

#mobile-menu-button.is-active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}