/* =========================================================================
   KnoWellian Scientific Stylesheet
   Project: The Finite Loom
   Version: 4.3 (Mobile-Calibrated Baseline + Desktop Auto-Expand)
   ========================================================================= */

/* 1. GLOBAL RESET AND LAYOUT */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; 
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.7;
    background-color: #243c79;
    color: #ffffff;
    margin: 0 auto;
    padding-bottom: 50px;
    /* Mobile / Default Max Width */
    max-width: 100%;
}

/* 2. TEXT INDENTATION & MARGINS (ORIGINAL MOBILE-CALIBRATED VALUES) */
h1 { 
    font-family: 'Helvetica', Arial, sans-serif; 
    color: #eeeeee; 
    text-align: center; 
    font-size: 2.1em; 
    border-bottom: 2px solid #5577bb; 
    padding: 0.5em 0; 
    margin: 1em 20px; 
}

h2, h3, h4, ul, ol, hr { 
    margin-left: 20px; 
    margin-right: 20px; 
    font-family: 'Helvetica', Arial, sans-serif; 
}

h2 { 
    border-bottom: 1px solid #5577bb; 
    padding-top: 1em; 
}

h3 { 
    font-style: italic; 
    border: none; 
    color: #00d4ff; /* KnoWellian Cyan */
}

h4 { 
    font-style: italic; 
    border: none; 
    color: #f0b429;
}

/* Exact Original Paragraph & Blockquote Spacing for Phone Screens */
p, blockquote {
    margin-left: 35px;
    margin-right: 20px;
    margin-top: 1.2em;
    margin-bottom: 1.2em;
}

blockquote {
    background: rgba(10, 20, 50, 0.4);
    border-left: 4px solid #f0b429;
    padding: 10px 15px;
}

/* 3. PREFORMATTED ASCII ARCHITECTURE DIAGRAMS (MOBILE SAFE) */
pre {
    margin-left: 20px;
    margin-right: 20px;
    padding: 15px;
    background: rgba(5, 10, 25, 0.85);
    border: 1px solid rgba(119, 153, 255, 0.3);
    border-left: 4px solid #00d4ff;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.82em;
    line-height: 1.4;
    color: #79c0ff;
}

/* 4. TABLE STYLING (CENTERED) */
table {
    margin-left: auto;
    margin-right: auto;
    margin-top: 2em;
    margin-bottom: 2em;
    border-collapse: collapse;
    width: auto;
    max-width: 95%;
    background: rgba(10, 20, 50, 0.4);
    border: 1px solid rgba(119, 153, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

th, td {
    padding: 12px 18px;
    border: 1px solid rgba(119, 153, 255, 0.2);
    text-align: left;
}

th {
    background: rgba(119, 153, 255, 0.2);
    color: #00d4ff; /* KnoWellian Cyan */
    font-family: 'Helvetica', Arial, sans-serif;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 1px;
}

/* 5. EDGE-TO-EDGE IMAGES */
img { 
    width: 100% !important; 
    max-width: 100% !important; 
    display: block !important; 
    margin: 2em 0 !important; 
}

/* 6. MATHJAX CORE LOGIC: THE PC-CHROME & MOBILE RESOLUTION */
mjx-container {
    display: inline-block !important; 
    width: auto !important;           
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    vertical-align: middle;
}

/* ZFPD & DERIVATION MOBILE LIST STYLING */
.zfpd-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 1em 20px !important;
}

.zfpd-list li {
    background: rgba(10, 20, 50, 0.5);
    border: 1px solid rgba(119, 153, 255, 0.25);
    border-left: 4px solid #00d4ff;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.95em;
    line-height: 1.5;
    word-break: break-word;
}

.zfpd-list li strong {
    color: #e6edf3;
}

/* INLINE LaTeX ($) */
mjx-container:not([display="true"]) {
    white-space: nowrap;
}

mjx-container:not([display="true"]) mjx-math {
    color: #00d4ff !important;
    font-weight: bold;
}

/* BLOCK LaTeX ($$) */
mjx-container[display="true"] {
    display: flex !important;         
    flex-direction: column;
    align-items: flex-start; 
    
    margin: 2.2em auto !important;
    padding: 20px !important;
    background: rgba(10, 20, 50, 0.75) !important;
    border-left: 5px solid #7799ff !important;
    border-top: 1px solid rgba(119, 153, 255, 0.2) !important;
    border-right: 1px solid rgba(119, 153, 255, 0.2) !important;
    border-bottom: 1px solid rgba(119, 153, 255, 0.2) !important;

    max-width: 95% !important; 
    width: 95% !important;           
    
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 0 20px rgba(0, 212, 255, 0.05);

    overflow-x: auto !important;
    overflow-y: hidden;
    box-sizing: border-box !important;
}

mjx-container[display="true"] > mjx-math {
    width: auto !important;
    min-width: min-content;
}

/* 7. LINKS & NAVIGATION */
a { 
    color: #88ccff; 
    text-decoration: none; 
}

a:visited { 
    color: #6699cc; 
}

a:hover {
    text-decoration: underline;
}

/* =========================================================================
   8. RESPONSIVE DESKTOP EXPANSION (WIDESCREEN RUNWAY)
   ========================================================================= */
/* On desktop screens (laptops, monitors >= 1025px), expand width */
@media screen and (min-width: 1025px) {
    body { 
        max-width: 1280px; /* Smooth expansion from 1024px to 1280px */
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5); 
    }

    /* Give paragraphs and equations a bit more breathing room on wide monitors */
    p, blockquote {
        margin-left: 45px;
        margin-right: 35px;
    }

    mjx-container[display="true"] {
        max-width: 100% !important;
        width: 100% !important;
        padding: 25px 30px !important;
    }
}

/* =========================================================================
   9. OUTREACH HUB & ARCHIVE LAYOUT CLASSES
   ========================================================================= */
.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 10px;
}

.text-center {
    text-align: center;
}

.main-nav {
    background-color: rgba(10, 20, 50, 0.95);
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid #5577bb;
    position: sticky;
    top: 0;
    z-index: 100;
    font-family: 'Helvetica', Arial, sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.main-nav a {
    color: #eeeeee;
    margin: 0 15px;
    font-weight: bold;
    font-size: 1.05em;
    text-decoration: none;
    display: inline-block;
    padding: 5px;
}

.main-nav a:hover {
    color: #00d4ff;
}

.grid-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.card {
    background: rgba(10, 20, 50, 0.4);
    border: 1px solid rgba(119, 153, 255, 0.3);
    padding: 25px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    display: block;
}

.card:hover {
    transform: translateY(-4px);
    border-color: #00d4ff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 212, 255, 0.1);
}

.card h2 {
    margin: 0;
    color: #00d4ff;
    border-bottom: none;
    padding-top: 0;
    font-size: 1.4em;
}

.card p {
    margin: 10px 0 0 0;
    color: #dddddd;
    font-family: 'Times New Roman', Times, serif;
}

.content-list {
    list-style-type: none;
    padding: 0;
    margin: 20px auto;
    font-family: 'Helvetica', Arial, sans-serif;
}

.content-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(119, 153, 255, 0.2);
}

.content-list li:last-child {
    border-bottom: none;
}

.legend {
    background: rgba(10, 20, 50, 0.4);
    border: 1px solid rgba(119, 153, 255, 0.3);
    padding: 15px 25px;
    display: inline-block;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: left;
    font-family: 'Helvetica', Arial, sans-serif;
    font-size: 0.9em;
    color: #eeeeee;
}