/* CSS is how you can add style to your website, such as colors, fonts, and positioning of your
   HTML content. To learn how to do something, just try searching Google for questions like
   "how to change link color." */

/* Academic CSS - Separate Body and Sidebar Layout */
:root {
    /* Academic color palette */
    --primary: #2c3e50;
    --secondary: #7f8c8d;
    --accent: #3498db;
    --light-accent: #ecf0f1;
    --border: #bdc3c7;
    --white: #ffffff;
    
    /* Typography scale */
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    
    /* Layout */
    --sidebar-width: 250px;
    --content-width: calc(100% - var(--sidebar-width) - var(--space-lg));
    --header-height: 80px;
    --navbar-height: 50px;
    --footer-height: 60px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: var(--primary);
    background-color: var(--white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.site-header {
    background-color: var(--primary);
    color: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--white);
    text-decoration: none;
}

.site-title:hover {
    color: var(--light-accent);
}

/* Navigation */
.site-nav {
    background-color: var(--light-accent);
    height: var(--navbar-height);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
}

.nav-menu {
    display: flex;
    list-style: none;
    height: 100%;
    align-items: center;
    gap: var(--space-lg);
}

.nav-menu li {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-menu a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.nav-menu a:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--accent);
}

/* Main Content Layout */
.main-wrapper {
    display: flex;
    flex: 1;
    max-width: 1200px;
    margin: var(--space-lg) auto;
    padding: 0 var(--space-lg);
    gap: var(--space-lg);
    min-height: calc(100vh - var(--header-height) - var(--navbar-height) - var(--footer-height) - 2 * var(--space-lg));
}

/* Sidebar */
.site-sidebar {
    width: var(--sidebar-width);
    background-color: var(--light-accent);
    padding: var(--space-md);
    border-radius: 5px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: 0;
}

.sidebar-section {
    margin-bottom: var(--space-lg);
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-xs);
}

.sidebar-section ul {
    list-style: none;
    margin-left: 0;
}

.sidebar-section li {
    margin-bottom: var(--space-xs);
}

.sidebar-section a {
    color: var(--secondary);
    text-decoration: none;
    padding: var(--space-xs) 0;
    display: block;
    transition: color 0.2s ease;
}

.sidebar-section a:hover {
    color: var(--accent);
    padding-left: var(--space-xs);
}

/* Page Body Content - PRIMARY CONTENT AREA */
.page-body {
    width: var(--content-width);
    background-color: var(--white);
    padding: var(--space-lg);
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-grow: 1;
}

/* Main content within page body */
.main-content {
    width: 100%;
}

/* Footer */
.site-footer {
    background-color: var(--primary);
    color: var(--white);
    height: var(--footer-height);
    margin-top: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
}

.footer-links a {
    color: var(--light-accent);
    text-decoration: none;
    font-size: 0.9em;
}

.footer-links a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* Content Styles */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

h1 {
    font-size: var(--text-3xl);
    border-bottom: 2px solid var(--border);
    padding-bottom: var(--space-xs);
}

h2 {
    font-size: var(--text-2xl);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-xs);
}

h3 {
    font-size: var(--text-xl);
}

p {
    margin-bottom: var(--space-md);
    text-align: justify;
    text-justify: inter-word;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

a:hover {
    border-bottom: 1px solid var(--accent);
}

/* Lists */
ul, ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

li {
    margin-bottom: var(--space-xs);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    :root {
        --text-base: 0.9375rem;
        --text-lg: 1rem;
        --text-xl: 1.125rem;
        --text-2xl: 1.25rem;
        --text-3xl: 1.5rem;
        --sidebar-width: 100%;
        --content-width: 100%;
    }
    
    .main-wrapper {
        flex-direction: column;
        padding: 0 var(--space-sm);
        margin: var(--space-sm) auto;
        gap: var(--space-md);
    }
    
    .site-sidebar {
        width: 100%;
        order: 2;
        border-right: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        padding: var(--space-md);
        margin-top: var(--space-md);
    }
    
    .page-body {
        width: 100%;
        order: 1;
        padding: var(--space-md);
        margin-top: 0;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-sm);
        padding: var(--space-xs) 0;
    }
    
    .nav-menu li {
        height: auto;
    }
    
    .site-header, .site-nav {
        padding: 0 var(--space-sm);
    }
    
    .header-content, .nav-container {
        padding: 0;
    }
    
    .site-title {
        font-size: var(--text-xl);
    }
    
    /* Mobile sidebar integration */
    .sidebar-section {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }
    
    .sidebar-section h3 {
        width: 100%;
        margin-bottom: var(--space-xs);
    }
    
    .sidebar-section ul {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-sm);
        width: 100%;
    }
    
    .sidebar-section li {
        margin-bottom: 0;
    }
    
    .sidebar-section a {
        padding: var(--space-xs) var(--space-sm);
        background-color: rgba(0,0,0,0.05);
        border-radius: 3px;
        white-space: nowrap;
    }
    
    .sidebar-section a:hover {
        padding-left: var(--space-sm);
    }
    
    p {
        text-align: left;
    }
    
    .footer-links {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .site-header {
        height: auto;
        padding: var(--space-sm);
    }
    
    .site-nav {
        height: auto;
    }
    
    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-xs);
    }
    
    .nav-menu li {
        text-align: center;
    }
    
    .nav-menu a {
        display: block;
        padding: var(--space-sm);
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }
    
    .main-wrapper {
        min-height: calc(100vh - 100px);
    }
    
    .sidebar-section ul {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .sidebar-section a {
        text-align: center;
    }
    
    .page-body, .site-sidebar {
        padding: var(--space-sm);
    }
}

/* Tablet Devices */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-wrapper {
        max-width: 95%;
        padding: 0 var(--space-md);
    }
    
    .site-sidebar {
        width: 220px;
    }
    
    .page-body {
        width: calc(100% - 220px - var(--space-lg));
    }
}

/* Desktop Layout */
@media (min-width: 1025px) {
    .site-sidebar {
        width: var(--sidebar-width);
        position: sticky;
        top: calc(var(--header-height) + var(--navbar-height) + var(--space-lg));
        max-height: calc(100vh - var(--header-height) - var(--navbar-height) - var(--space-lg) * 2);
        overflow-y: auto;
    }
    
    .page-body {
        width: var(--content-width);
        flex-grow: 1;
    }
}

/* Print Styles */
@media print {
    .site-header, .site-nav, .site-sidebar, .site-footer {
        display: none;
    }
    
    .main-wrapper {
        display: block;
        margin: 0;
        padding: 0;
    }
    
    .page-body {
        box-shadow: none;
        padding: 0;
        width: 100%;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #ecf0f1;
        --secondary: #bdc3c7;
        --accent: #3498db;
        --light-accent: #2c3e50;
        --border: #34495e;
        --white: #1a252f;
    }
    
    .site-header, .site-footer {
        background-color: #1a252f;
    }
    
    .site-nav {
        background-color: #2c3e50;
    }
    
    .nav-menu a {
        color: var(--white);
    }
    
    .site-sidebar {
        background-color: #2c3e50;
    }
    
    .page-body {
        background-color: #1a252f;
        color: var(--primary);
    }
}