/* ==========================================================================
   LaTeX / Computer Modern Web Font Setup (CDNJS - MIME Safe)
   ========================================================================== */
@font-face {
    font-family: 'Computer Modern Serif';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/fonts/KaTeX_Main-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: optional;
}

@font-face {
    font-family: 'Computer Modern Serif';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/fonts/KaTeX_Main-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: optional;
}

@font-face {
    font-family: 'Computer Modern Serif';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/fonts/KaTeX_Main-Bold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: optional;
}

/* ==========================================================================
   Modern Reset & Base Setup
   ========================================================================== */
html {
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Protect MathJax layout from clipping */
mjx-container, mjx-container * {
    box-sizing: content-box !important;
}

html, body, h1, h2, h3, h4, p, ul, ol, li {
    margin: 0;
    padding: 0;
}

:root {
    --my-color: #87b6e6;        /* Light Blue */
    --primary-color: #0f2d59;   /* Deep Navy */
    --secondary-color: #2a6f97; /* Accent Blue */
    --text-color: #333333;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --white: #ffffff;
}

body {
    color: var(--text-color);
    background-color: var(--light-bg);
    line-height: 1.6;
    font-size: 1.14rem; /* Font size ko 1.05rem se bada kar 1.18rem kar diya gaya hai */
    font-family: 'Computer Modern Serif', "CMU Serif", Georgia, serif;
    
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Header / Banner Styling
   ========================================================================== */
header {
    background: linear-gradient(135deg, #ffffff 0%, #87b6e6 50%, #0F4C81 100%);
    color: var(--white);
    padding: 17px 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    box-shadow: 0 3px 10px rgba(0,0,0,.15);
    border-bottom: 4px solid var(--secondary-color);
    border-radius: 6px;
}

.logo {
    flex-shrink: 0;
    padding: 0px 50px;
}

.logo img {
    width: 150px;
    height: auto;
    display: block;
}

.logo a {
    display: inline-block;
    transition: transform 0.2s ease;
}

.logo a:hover {
    transform: scale(1.03);
}

.header-title {
    text-align: left;
}

header h1 {
    font-size: 2.6rem;
    font-weight: 500;
    margin-bottom: 5px;
    letter-spacing: 0.9px;  
    color: #031f3b;
    text-align: left;
}

header p {
    font-size: 1.3rem;
    opacity: 10.95;
    color: #000000;
    letter-spacing: 0.0px;
    text-align: left;
}

header p em {
    font-style: italic;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
nav {
    background-color: var(--white);
    box-shadow: 0 2px 5px rgba(100, 160, 228, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 5px solid var(--border-color);
    margin-top: 10px;
}

.nav-container {
    max-width: 1350px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    background: none;
    border: none;
    padding: 15px 15px;
    font-size: 1.1rem; /* 1.05rem se 1.1rem */
    font-weight: 600;
    -webkit-text-stroke: 0px transparent;
    color: #0F4C81;
    letter-spacing: -0.1px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    font-family: 'Computer Modern Serif', "CMU Serif", serif;
    text-decoration: none;
    display: inline-block;
}

.nav-btn:hover {
    color: var(--secondary-color);
    background-color: #bed4eb;
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
}

/* ==========================================================================
   Main Content Area & Justified Text Styling
   ========================================================================== */
.container {
    max-width: 1300px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    position: relative; /* Base reference for left sidebar */
}

main {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px #87b6e6;
    border: 1px solid var(--border-color);
}

/* Headings remain clean and left-aligned */
h1, h2, h3, h4, .welcome-header h2 {
    text-align: left;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.85rem;
    font-weight: normal;
}

h3 {
    color: var(--secondary-color);
    margin: 25px 0 10px 0;
    font-size: 1.5rem;
    font-weight: normal;
}

/* Justified Body Text Rules */
p {
    margin-bottom: 15px;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

ul, ol {
    margin-bottom: 20px;
    padding-left: 25px;
}

li {
    margin-bottom: 8px;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

/* Callout Box */
.callout-box {
    background-color: #f1f7fc;
    border: 0px solid var(--border-color); /* Fixed error: 1fr changed to 1px */
    border-left: 1px solid var(--secondary-color);
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px 8px 8px 8px;
    text-align: justify;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.callout-box:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 5px #2a6f97;
    border-left-color: var(--primary-color);
}

.welcome-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Pushes text to left, logo to far right */
}

.welcome-header h2 {
  order: 1; /* Appears first (Left) */
  margin: 0;
}

.welcome-logo {
  order: 2; /* Appears second (Right) */
  transform: translateY(-15px);
  max-height: 60px; 
}

.article-card {
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    background: #fafafa;
}

.article-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    text-align: left;
    display: block;
}

/* Code Blocks */
pre {
    background-color: #f4f6f9;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-family: Consolas, monospace;
    font-size: 0.95rem;
    overflow-x: auto;
    margin-bottom: 15px;
    text-align: left;
}

/* ==========================================================================
   Sidebar Styling
   ========================================================================== */
aside {
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    height: fit-content;
    width: 340px;
}

.sidebar-widget {
    margin-bottom: 25px;
}

.sidebar-widget h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.15rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.sidebar-widget p {
    text-align: left;
}

.sidebar-list {
    list-style: none;
    padding-left: 0;
}

.sidebar-list li {
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
    text-align: left;
}

.sidebar-list a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.sidebar-list a:hover {
    text-decoration: underline;
}

.btn {
    display: block;
    width: 100%;
    background-color: var(--my-color);
    color: var(--white);
    text-align: center;
    padding: 5px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 8px;
    transition: background 0.2s ease;
    font-family: 'Computer Modern Serif', "CMU Serif", serif;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--secondary-color);
}

.btn-alt {
    background-color: #0F4C81;
}

/* Left outer sidebar */
.sidebar-left-outer {
    position: absolute;
    right: 100%;          /* Pushes outside left to Grid/Container */
    margin-right: 5px;   
    margin-left: 0px;   
    width: 135px;         
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    height: 180px;
}

.cp-logo {
  order: 2;
  transform: translate(0px, 15px);
  max-height: 200px; 
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background: linear-gradient(135deg, #ffffff 0%, #6b96c0 50%, #0F4C81 100%);
    color: var(--white);
    padding: 15px 20px;
    margin-top: 60px;
    font-size: 1rem;
    text-align: center;
}

footer p {
    margin: 4px 0;
    text-align: center;
}

footer a {
    color: #040404;
    text-decoration: none;
    margin: 0 8px;
}

footer a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Responsive Rules
   ========================================================================== */
@media (max-width: 850px) {
    header {
        flex-direction: column;
        text-align: center;
    }
    .header-title, header h1, header p {
        text-align: center;
    }
    .container {
        grid-template-columns: 1fr;
    }
}