@charset "utf-8";

/* --- 0. PALETTE & VARIABLES (Monochromatic Slate Theme) --- */
:root {
    /* BASE HUE: Cool Slate Blue */
    /* Backgrounds */
    --bg-page: #f0f4f8;         /* Very light cool tint - easier on eyes than stark white */
    --bg-content: #ffffff;      /* Pure white for reading areas */
    --bg-highlight: #e1e7ef;    /* Light slate for buttons/headers backgrounds */
    --bg-hover: #d3deeb;        /* Slightly darker slate for hover states */

    /* Text & Borders */
    --text-main: #102a43;       /* Deepest Blue/Black - High Contrast */
    --text-muted: #486581;      /* Medium Slate for secondary text */
    --border-color: #bcccdc;    /* Soft Slate for structural definition */
    
    /* Interactive & Focus */
    --primary-color: #243b53;   /* Strong, authoritative Slate Blue */
    --link-color: #334e68;      /* Distinct, readable link blue */
    --focus-ring: #102a43;      /* Deepest hue for accessibility focus rings */

    /* SENIOR OPTIMIZATIONS */
    --touch-min: 48px;          /* Minimum touch target size */
    --line-height: 1.7;         /* Extra breathing room */
    --content-max-width: 800px; 
}

/* --- 1. GLOBAL RESET --- */
* { box-sizing: border-box; }

html {
    /* LARGE DEFAULT FONT SIZE */
    font-size: 20px; 
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: var(--line-height);
    -webkit-text-size-adjust: 100%;
}

/* HIGH VISIBILITY FOCUS STATE (Navigation via keyboard) */
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* --- 2. LAYOUT CONTAINER --- */
#pap {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    background-color: var(--bg-content);
    padding: 20px;
    min-height: 100vh;
}

@media (min-width: 768px) {
    body { padding: 40px 20px; }
    #pap {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 50px; 
        box-shadow: 0 4px 12px rgba(16, 42, 67, 0.08); /* Shadow tinted blue */
        min-height: auto;
    }
}

/* --- 3. TYPOGRAPHY --- */
h1, h2, h3 {
    color: var(--primary-color); /* Unified header color */
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    line-height: 1.3;
}

h1 { 
    font-size: 1.8rem; 
    font-weight: 800; 
    text-align: center; 
}

h3 { 
    font-size: 1.4rem; 
    font-weight: 700; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 10px; 
}

p { margin-bottom: 1.5rem; max-width: 65ch; } 

.sc { font-variant: small-caps; }

/* CLEAR HYPERLINKS */
a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
}
a:hover { 
    color: var(--primary-color); 
    background-color: var(--bg-highlight); 
    text-decoration-thickness: 3px; 
}

/* --- 4. HEADER & CONTROLS --- */
.content-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

/* Unified Button Style (Large Touch Targets) */
.back-link, .tree-controls button, .nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-min); 
    padding: 0 24px;
    background-color: var(--bg-highlight);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation; 
}

.back-link:hover, .tree-controls button:hover, .nav-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--primary-color);
}

/* --- 5. ACCORDION / TREE --- */
.tree-controls { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 25px; 
}
.tree-controls button { flex: 1; }

.tree details { margin-bottom: 15px; }

.tree summary {
    cursor: pointer;
    list-style: none;
    padding: 15px;
    background-color: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 700;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--primary-color);
}
.tree summary:hover { background-color: var(--bg-hover); }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::after { 
    content: '+'; 
    font-size: 1.8rem; 
    font-weight: bold; 
    color: var(--primary-color); 
}
.tree details[open] > summary::after { content: '−'; }

.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 0; 
}

.tree li a {
    display: flex;
    align-items: center;
    padding: 15px 20px; 
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    min-height: 55px; 
    font-size: 1rem;
}

/* Top Level Items - Inverted Monochromatic Scheme */
.top-level { 
    background-color: var(--primary-color) !important; 
    color: #ffffff !important;
    border-color: var(--text-main) !important;
}
.top-level::after { color: #ffffff !important; }

/* --- 6. DEVOTIONAL CONTENT STYLES --- */
.source {
    display: inline-block;
    background: var(--bg-highlight);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.topic {
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.9em;
    margin-right: 8px;
}

.content-closing {
    margin-top: 40px;
    padding: 25px;
    background-color: var(--bg-page); /* Subtle tint */
    border-left: 6px solid var(--border-color);
    font-style: italic;
    color: var(--text-muted);
}

/* --- 7. NAVIGATION FOOTER --- */
.trail-navigation {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 50px;
    border-top: 2px solid var(--border-color);
    padding-top: 30px;
}
.nav-btn { width: 100%; font-size: 1.1em; }

@media (min-width: 768px) { 
    .trail-navigation { 
        flex-direction: row; 
    } 
    
    /* Specific overrides for Footer Buttons on Desktop */
    .trail-navigation .nav-btn { 
        width: auto; 
        flex: 1;
        
        /* Reduced sizing for desktop mouse usage */
        min-height: 38px;
        font-size: 0.9rem;
        padding: 0 16px;

        /* Visual distinction: "Ghost" button style (Transparent with border) */
        background-color: transparent;
        color: var(--text-muted);
        border-color: var(--border-color);
    }
    
    /* Hover state for Footer Buttons */
    .trail-navigation .nav-btn:hover {
        background-color: var(--bg-highlight);
        color: var(--primary-color);
        border-color: var(--primary-color);
    }
}

/* --- 8. UTILITIES --- */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 30px; right: 30px;
    font-size: 2rem;
    background-color: var(--primary-color);
    color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 64px; height: 64px; 
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(16, 42, 67, 0.4);
}
#scrollTopBtn:hover {
    background-color: var(--text-main);
}
#scrollTopBtn.show { display: block; }

.copyright {
    text-align: center;
    margin-top: 40px;
    font-size: 0.9rem;
    color: var(--text-muted);
}