/* HUMAN-FRIENDLY DOOMER THEME */

body {
    /* Change from Pitch Black to Deep Charcoal (reduces eye strain) */
    background-color: #121212; 
    
    /* Change from White to Silver/Light Grey */
    color: #c0c0c0; 
    
    /* Better font stack: Menlo/Consolas are thicker and easier to read than Courier */
    font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace; 
    
    /* Increase spacing to let the text breathe */
    line-height: 1.8; 
    font-size: 1.125rem; /* 18px - Slightly larger text */
    
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased; /* Makes text crisper */
}

/* SIDEBAR NAVIGATION */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 200px;
    background-color: #0f0f0f; /* Slightly darker than body */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Start from top */
    align-items: stretch;
    z-index: 1000;
    transition: transform 0.3s ease;
    padding-top: 20px;
}

/* Sidebar profile image */
.sidebar-logo {
    display: flex;
    justify-content: center;
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-profile-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid #333;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.sidebar-profile-image:hover {
    transform: scale(1.05);
    border-color: #ff5555;
}

/* Profile Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 0;
    max-width: 450px;
    width: 90%;
    text-align: center;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #666;
    font-size: 1.75rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #ff5555;
}

.modal-profile-section {
    margin: 0;
}

.modal-profile-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.modal-caption {
    color: #c0c0c0;
    font-size: 0.875rem;
    margin: 15px 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
    text-align: center;
}

.modal-secondary-section {
    padding: 15px 20px 25px 20px;
}

.modal-secondary-image {
    max-width: 100%;
    height: 280px;
    object-fit: contain;
}

.sidebar-toggle {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background-color: #0f0f0f;
    border: 1px solid #333;
    color: #c0c0c0;
    cursor: pointer;
    z-index: 1001;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: #1a1a1a;
    border-color: #ff5555;
}

.sidebar-toggle::before {
    content: '☰';
    display: block;
}

.nav-button {
    background-color: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: #c0c0c0;
    font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1rem;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin: 0;
}

.nav-button:hover {
    background-color: #1a1a1a;
    color: #ffffff;
}

.nav-button.active {
    border-left-color: #ff5555;
    background-color: rgba(255, 85, 85, 0.1);
    color: #ffffff;
}

.container {
    /* Take full width minus sidebar, then center content inside */
    margin-left: 200px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Copy Markdown Button */
.copy-markdown-btn {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #555;
    font-family: inherit;
    font-size: 0.6875rem;
    padding: 4px 8px;
    cursor: pointer;
    transition: color 0.2s ease;
    width: auto;
    max-width: none;
}

.copy-markdown-btn:hover {
    color: #c0c0c0;
}

.copy-markdown-btn.copied {
    color: #4a9;
}

.copy-markdown-btn svg {
    flex-shrink: 0;
}

/* Content wrapper for positioning */
.content-wrapper {
    position: relative;
    max-width: 700px;
    width: 100%;
    text-align: left;
}

/* All direct children get max-width for centered column look (except copy button) */
.container > *:not(.copy-markdown-btn):not(.content-wrapper) {
    max-width: 700px;
    width: 100%;
    text-align: left; /* Text left-aligned within centered container */
}

/* HEADERS */
h1, h2, h3, h4 {
    color: #ffffff; /* Headers stay bright white for contrast */
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-top: 40px;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    text-align: left;
}

h1 {
    font-size: 1.5rem;
    text-align: left;
}

/* EMPHASIS (Bold text) */
strong {
    color: #ffffff; /* Make bold text pop in white */
    font-weight: 700;
}

/* LISTS (The Axioms) */
ul {
    padding-left: 1.5em;
    list-style-type: disc;
    list-style-position: outside;
    text-align: left;
}

li {
    margin-bottom: 15px;
    text-align: left;
}

/* THE MATH (LaTeX) - Inline math stays inline */
mjx-container {
    font-size: 115% !important;
    opacity: 0.9;
}

/* Display math ($$...$$) gets block treatment */
mjx-container[display="true"] {
    display: block;
    padding: 15px 0;
    text-align: center;
}

/* ANALOGY BLOCKS (Italic parts) */
em {
    color: #999; /* Dim the analogies slightly to separate them from logic */
    display: block; /* Give them their own line if possible, or just style inline */
    margin-top: 5px;
}

/* LINKS */
a {
    color: #ff5555; /* Softer Red */
    text-decoration: none;
    border-bottom: 1px dotted #ff5555;
    transition: all 0.2s ease;
}

a:hover {
    background-color: #ff5555;
    color: #121212;
}

/* Paragraphs and text content */
p {
    text-align: left;
}

/* Images in content */
.container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
}

/* Page-specific font sizes */
.page-theorem {
    font-size: 1rem;
}

.page-theorem mjx-container {
    font-size: 125% !important; /* Keep equations same visual size */
}

.page-thoughts,
.page-analogies {
    font-size: 1.0625rem;
}

.page-genz {
    font-size: 0.9375rem;
}

.page-thoughts h1,
.page-analogies h1 {
    font-size: 1.5rem;
}

.page-thoughts h2,
.page-analogies h2 {
    font-size: 1.6rem;
}

/* Sources page - tighter spacing */
.page-sources {
    font-size: 0.8125rem;
    line-height: 1.5;
}

.page-sources h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.page-sources h2 {
    font-size: 1.3rem;
    margin-top: 25px;
    margin-bottom: 10px;
}

.page-sources h3 {
    font-size: 1rem;
    margin-top: 18px;
    margin-bottom: 8px;
    padding-bottom: 8px;
}

.page-sources p {
    margin-bottom: 8px;
}

/* LOADING SCREEN */
.loading {
    text-align: center;
    padding-top: 30vh;
    font-size: 1.2rem;
    color: #666;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        padding-top: 20px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .container {
        margin-left: 0;
        padding: 80px 20px 20px 20px;
    }

    .copy-markdown-btn span {
        display: none;
    }

    .sidebar-logo {
        padding: 15px;
        margin-bottom: 15px;
    }

    .sidebar-profile-image {
        width: 70px;
        height: 70px;
    }

    .modal-content {
        max-width: 340px;
    }

    .modal-profile-image {
        height: 180px;
    }

    .modal-secondary-image {
        height: 220px;
    }

    body {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 80px 15px 20px 15px;
    }
}

/* RESPONSIVE LARGE SCREENS */
@media (min-width: 1400px) {
    .container {
        padding: 60px;
    }

    .container > * {
        max-width: 800px;
    }
}

/* AI MODEL SELECTOR & SEGMENTED CONTROL */

/* Hide copy button on AI page */
.page-ai .copy-markdown-btn {
    display: none;
}

/* Reduce AI page text size */
.page-ai {
    font-size: 0.875rem;
}

/* Reduce AI page header size and adjust spacing */
.page-ai h1 {
    font-size: 1.5rem;
    margin-top: 10px;
    margin-bottom: 20px;
}

/* AI Model Selector Container */
.ai-model-selector {
    margin: 40px 0;
    padding: 30px;
    background-color: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    gap: 0;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}

/* Hide radio inputs */
.segmented-control input[type="radio"] {
    display: none;
}

/* Segment labels */
.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 12px 20px;
    font-family: 'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #c0c0c0;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    user-select: none;
}

/* Hover state */
.segmented-control label:hover {
    color: #ffffff;
    background-color: rgba(255, 85, 85, 0.1);
}

/* Active (selected) state */
.segmented-control input[type="radio"]:checked + label {
    background-color: #ff5555;
    color: #121212;
    font-weight: 600;
}

/* Image container */
.ai-model-images {
    position: relative;
    width: 100%;
    height: 650px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Individual images */
.ai-model-image {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border-radius: 8px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Active image */
.ai-model-image.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile responsive for segmented control */
@media (max-width: 768px) {
    .segmented-control label {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .ai-model-images {
        height: 450px;
    }
}

@media (max-width: 480px) {
    .segmented-control {
        flex-direction: column;
    }

    .segmented-control label {
        border-radius: 4px;
    }
}
