/* ==========================================================================
   1. GLOBAL RESET & BASE BACKGROUND
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* This background remains completely untouched now */
    background: radial-gradient(circle at top left, #616CF8, #171961);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
}

/* ==========================================================================
   2. MAIN CONTAINER (DEFAULT GLASSMORPHISM STATE)
   ========================================================================== */
.main_body {
    width: 95%;
    max-width: 1400px;
    margin: 1rem auto;
    padding: 2rem;
    
    /* Default Dark Mode Glassmorphism Style */
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 2rem;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    
    /* FIX: Set baseline default text color to pure white right here, if needed black change to #000000 */
    color: #ffffff; 
    
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

/* Internal Dynamic Cards inside main_body */
.main_body .dynamic-card {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), background 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.main_body .dynamic-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.12);
    border-color: #f07a8a;
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.4);
}

.main_body .dynamic-card:active {
    transform: scale(0.99);
}

/* ==========================================================================
   3. UNIVERSAL TYPOGRAPHY SYSTEM (COLOR-INHERITING & BULLETPROOF)
   ========================================================================== */

/* Targets h3/h4 anywhere inside .main_body, inheriting the active theme color */
.main_body h3 {
    font-size: 2em;
    font-weight: 700;
    color: inherit;
    text-align: center;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.main_body h4 {
    font-size: 1.5em;
    font-weight: 600;
    color: inherit;
    text-align: center;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

/* Catch-all configuration: Every single element variant inherits the theme master file color */
.main_body p, 
.main_body div,
.main_body span,
.main_body .intro-text, 
.main_body .verse_meaning {
    font-size: 1em;
    line-height: 1.6;
    color: inherit;
    text-align: justify;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

/* Catches lists deeply nested inside structural or layout divs */
.main_body ul, 
.main_body ol {
    padding-left: 2rem;
    margin: 0.5rem 0 1rem 0;
}

.main_body li {
    font-size: 1em;
    line-height: 1.6;
    color: inherit; 
    text-align: justify;
    margin-bottom: 0.4rem;
}

/* Core Content Classes */
.main_body .verse_sanskrit {
    font-family: 'Times New Roman', Georgia, serif;
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    color: inherit;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.main_body .verse_trans {
    text-align: center;
    font-size: 1em;
    color: inherit;
    opacity: 0.85; /* Uses opacity to subtly distinguish translation rather than hardcoded grays */
    font-style: italic;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.main_body .explanation-content strong {
    color: inherit;
    font-weight: 700;
}

.main_body hr.verse_separator {
    margin: 1.5rem 0;
    border: 0;
    height: 1px;
    background: currentColor; /* Inherits whatever the active text color profile dictates */
    opacity: 0.4;
    transition: background 0.3s ease, opacity 0.3s ease;
}

.main_body p a {
    color: #0055aa;
    text-decoration: none;
    font-size: 0.85rem;
    vertical-align: super;
    transition: color 0.3s ease;
}

/* Theme overrides adapt link color for dark/highcontrast screens */
.main_body.highcontrast-mode p a { color: #ffd700; }

.main_body p a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   4. MAIN_BODY ONLY - STYLE SWITCHES (Toggled on .main_body element)
   ========================================================================== */

/* --- Light Mode Variation --- */
.main_body.light-mode {
    background: #f5f0eb;
    color: #1e2a3a;
    border: 1px solid #e0d6c8;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.main_body.light-mode .dynamic-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}
.main_body.light-mode .dynamic-card:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: #f07a8a;
}

/* --- Sepia Mode Variation --- */
.main_body.sepia-mode {
    background: #f4ecd8;
    color: #2c2416;
    border: 1px solid #d4c4a0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.main_body.sepia-mode .dynamic-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
.main_body.sepia-mode .dynamic-card:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #b97f6e;
}

/* --- High Contrast Mode Variation --- */
.main_body.highcontrast-mode {
    background: #000000;
    color: #ffffff;
    border: 3px solid #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.main_body.highcontrast-mode .dynamic-card {
    background: #000000;
    border: 1px dashed #ffffff;
}
.main_body.highcontrast-mode .dynamic-card:hover {
    background: #222222;
    border-color: #ffd700;
    border-style: solid;
}

/* ==========================================================================
   5. FIXED ACCESSIBILITY CONTROL WIDGET UI
   ========================================================================== */
.accessibility-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accessibility-toggle {
    background: #f07a8a;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accessibility-toggle:hover {
    transform: scale(1.08);
    background: #ff8a9a;
}

.accessibility-panel {
    display: none;
    background: rgba(10, 12, 26, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 240px;
    flex-direction: column;
    gap: 1.2rem;
}

.accessibility-panel.open { display: flex; }

.accessibility-panel label {
    font-size: 0.85rem;
    color: #cbd5e6;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 500;
}

.accessibility-panel select,
.accessibility-panel input[type="range"] {
    width: 100%;
    padding: 0.5rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #f0f0f0;
    font-size: 0.9rem;
}

.accessibility-panel select option {
    background: #171961;
    color: #fff;
}

.accessibility-panel select:focus {
    outline: none;
    border-color: #f07a8a;
}

.accessibility-panel .reset-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 2rem;
    padding: 0.6rem 1rem;
    color: #f0f0f0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.accessibility-panel .reset-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: #ffffff;
}

/* ==========================================================================
   6. BREAKPOINTS & RESPONSIVE DESIGN INTERFACE
   ========================================================================== */
@media (max-width: 768px) {
    .main_body {
        width: 92%;
        margin: 1rem auto;
        padding: 1.25rem;
        border-radius: 1.5rem;
    }
    
    .main_body .dynamic-card {
        padding: 1.2rem;
        border-radius: 1rem;
    }
    
    .main_body h3 { font-size: 1.65rem; }
    .main_body h4 { font-size: 1.25rem; }
    
    .accessibility-menu {
        bottom: 15px;
        right: 15px;
    }
    .accessibility-toggle {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
    .accessibility-panel {
        min-width: 210px;
        padding: 1.1rem;
    }
}