@charset "utf-8";

/* ==========================================================================
   1. VARIABLES & ROOT (Colors, Fonts, Settings)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;700&family=Crimson+Pro:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
    /* Paper & Ink - High Contrast for 65+ */
    --bg-body: #F2EEE9; 
    --bg-surface: #FDFBF7; 
    --text-primary: #121110;
    --text-secondary: #2A2825;
    --text-muted: #4A4641;
    
    /* Brass & Leather Accents */
    --accent-brass: #8C6239; 
    --accent-gold: #C5A065;
    --border-elegant: #D4C5B0;
    
    /* Layout & Typography */
    --max-width: 800px;
    --font-header: "Cinzel", serif;
    --font-body: "Crimson Pro", serif;
}

/* ==========================================================================
   2. MOBILE STYLES (Base CSS - Optimized for Google Pixel 8 & 65+ Audience)
   ========================================================================== */
* { box-sizing: border-box; }

html { 
    font-size: 20px;
    scroll-behavior: smooth; 
}

body {
    background-color: var(--bg-body);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    margin: 0;
}

/* The Paper Sheet */
#pap {
    width: 100%;
    background: var(--bg-surface);
    padding: 1rem;
    border-bottom: 2px solid var(--border-elegant);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-header);
    color: var(--text-secondary);
    font-weight: 500; 
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

p { 
    margin-bottom: 1rem;
    text-align: left;
    hyphens: none; 
    font-size: 1.15rem; 
}

/* Links & Tap Targets */
a { 
    color: var(--text-secondary); 
    text-decoration: none; 
    border-bottom: 2px dotted var(--text-secondary);
    transition: 0.2s; 
    padding: 4px 0;
}
a:hover {
    color: var(--text-primary); 
    border-bottom-style: solid; 
}

/* Specific Typography Classes */
.content-header {
	align-items: center;
    text-align: center;
	border-bottom: 2px dotted var(--border-elegant); 
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}
.content-header h3 {
    font-size: .9rem;
    margin-bottom: 0.5rem; 
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.source {
    font-family: var(--font-header);
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: flex;
	justify-content: center;
    align-items: center;
 	text-transform: uppercase;
    font-weight: 700;
}
.trail-emoji {
    font-size: 1.2rem;
    display: inline-block;
    vertical-align: middle;
    transform: rotate(90deg);    
    color: transparent;
    text-shadow: 0 0 0 var(--text-secondary);
    margin-left: 10px;
    margin-right: 0px;
}
.topic { 
    font-family: var(--font-header);
    font-size: .9rem; 
    font-weight: 700; 
    color: var(--text-secondary); 
    margin-right: 0.5rem; 
    text-transform: uppercase;
    letter-spacing: 0.1em; 
}
.sc {
    font-variant: small-caps;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* UI Components */
.reflection-section {
    margin: 1.5rem 0 1rem; /* Reduced from 2.5rem 0 */
    padding-top: 1.5rem;
    border-top: 2px double var(--border-elegant);
}
.reflect-btn {
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    font-family: var(--font-header);
    padding: 1rem;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 700;
    width: 100%; /* Keeps button stretched */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 8px;
}
.reflection-box {
    display: none; 
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
    font-family: var(--font-body);
    background: #FFF;

    border: 2px dashed var(--text-muted);
    min-height: 150px;
    font-size: 1.1rem;
    color: var(--text-primary);
    border-radius: 8px;
}
.print-reflection-output { display: none; }

.data-warning {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

/* Navigation & Action Bar */
.action-container {
    text-align: center;
    margin-top: 0.5rem; /* Reduced from 1.5rem to pull Print Trail up */
    font-size: .9rem;
    font-family: var(--font-header);
}
.action-btn { 
    cursor: pointer; 
    color: var(--text-secondary); 
    margin: 0 10px; 
    padding: 10px;
    text-transform: uppercase;
    border-bottom: none;
    font-weight: 700;
}
.trail-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 1rem; /* Reduced from 2rem */
    padding-top: 0.5rem; /* Reduced from 1rem */
    border-top: 2px solid var(--border-elegant);
    font-family: var(--font-header);
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
    width: 100%;
}
.trail-navigation > :first-child { text-align: left; }
.trail-navigation > :nth-child(2) { text-align: center; }
.trail-navigation > :last-child { text-align: right; }
.trail-navigation a { border-bottom: none; padding: 10px; }
.trail-navigation > :first-child:not(:empty)::before { content: "\2190\00a0"; }
.trail-navigation > :last-child:not(:empty)::after { content: "\00a0\2192"; }
.trail-navigation > :first-child:empty, .trail-navigation > :last-child:empty { visibility: hidden; }

/* Index Page Specifics */
.archival-plate {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px dotted var(--border-elegant);
}
.logo-wrapper { margin-bottom: 0.5rem; }
.logo-text {
    font-family: var(--font-header);
    font-size: 1.15rem; 
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.arrival-note p { font-size: 1.1rem; }

/* Stats Gauge */
#stats-container {
    background: var(--bg-surface);
    border: 2px solid var(--border-elegant);
    padding: 1.5rem;
    margin: 2rem auto;
    border-radius: 8px;
    text-align: center;
    flex-direction: column; /* Forces vertical stacking when JS sets flex */
    gap: 0.8rem; /* Adds spacing between stacked items */
}
.stats-label {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.progress-bar-bg {
    height: 8px;
    background: #E0D5C1;
    border-radius: 4px;
    width: 100%; /* Ensures the bar spans the width of the container */
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent-brass);
    border-radius: 4px;
    transition: width 1s ease-out;
}
.stats-data { 
    font-size: 1rem; 
    font-weight: 700; 
    display: flex; 
    flex-direction: column; /* Stacks the percentages and count text vertically */
    gap: 0.3rem; 
}
.stats-divider {
    display: none; /* Hides the vertical pipe since data is stacked */
}

/* Tree List (Index Map) */
.tree details { margin-bottom: 1rem; }
.tree summary { 
    cursor: pointer; 
    font-family: var(--font-header); 
    font-size: 1rem;
    font-weight: 700; 
    padding: 0.8rem 0;
    border-bottom: 1px dotted var(--border-elegant);
}
.tree ul { 
    list-style: none; 
    padding-left: 1rem; 
    margin: 0.5rem 0; 
    border-left: 3px solid var(--border-elegant); 
}
.tree li a { 
    display: block; 
    padding: 0.6rem 0.5rem;
    font-size: 1.1rem; 
    border-bottom: none; 
}
/* Progress Tracking Styling */
.tree li a.completed {
    color: var(--text-muted);
    text-decoration: line-through;
}
.tree li a.completed::before {
    content: "✓ ";
    text-decoration: none;
    color: var(--accent-brass);
}

.tree-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}
.tree-controls button {
    background: transparent;
    border: 2px solid var(--border-elegant);
    color: var(--text-primary);
    font-family: var(--font-header);
    padding: 0.8rem 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    border-radius: 8px;
}

/* Utilities */
.reset-container {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 2px dotted var(--border-elegant);
}
.reset-link {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    padding: 10px;
}
.content-footer { 
    text-align: center; 
    margin-top: 1rem; /* Reduced from 2rem to pull closer to navigation */
    padding: 0.5rem 0; /* Reduced from 1rem 0 */
    border-top: 2px solid var(--border-elegant); 
}
.copyright { text-align: center; font-size: 0.85rem; font-family: var(--font-header); text-transform: uppercase; }

#scrollTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    background-color: var(--text-secondary);
    color: white;
    padding: 15px 20px;
    border-radius: 50%;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

/* ==========================================================================
   3. DESKTOP STYLES (14-inch Laptop - Optimized for 65+ Audience)
   ========================================================================== */
@media (min-width: 1024px) {
    body { 
        padding: 3rem 0; 
        font-size: 22px;
    }
    
    #pap {
        max-width: var(--max-width);
        margin: 0 auto;
        padding: 3rem 5rem; /* Reduced from 4rem 5rem for less top/bottom blank space */
        box-shadow: 0 10px 30px rgba(26, 25, 24, 0.1); 
        border: 1px solid var(--border-elegant);
        border-radius: 8px;
        min-height: auto;
    }
    
    /* Adjustments for wider screens */
    p { font-size: 1.2rem; }
    .logo-text { font-size: 2rem; }
    
    .reflection-box { font-size: 1.2rem; }

    #scrollTopBtn {
        bottom: 40px;
        right: 40px;
    }
    
    /* Hover effects (more relevant on desktop with a mouse) */
    .tree li a:hover {
        background: rgba(140, 98, 57, 0.1);
        border-radius: 4px;
    }
    .reflect-btn:hover, .action-btn:hover, .tree-controls button:hover {
        background-color: var(--text-secondary);
        color: var(--bg-surface);
    }
}

/* ==========================================================================
   4. PRINT STYLES
   ========================================================================== */
@media print {
    @page { margin: 1.5cm; size: auto; }
    body { background: none; color: #000; font-size: 14pt; }
    #pap { box-shadow: none; border: none; padding: 0; margin: 0; width: 100%; max-width: 100%; }
    p { orphans: 3; widows: 3; break-inside: avoid; color: #000 !important; }
    a { text-decoration: none; border: none; color: #000; }
    
    .nav-btn, .action-container, .reset-container, .reflect-btn, 
    .reflection-box, .data-warning, #scrollTopBtn, .content-footer, 
    .trail-navigation, .tree-controls, #stats-container {
        display: none !important;
    }
    
    .reflection-section { border: none; margin-top: 1rem; }
    
    .print-reflection-output {
        display: block !important;
        border: 2px solid #000;
        padding: 1.5rem;
        font-family: var(--font-body);
        font-size: 12pt;
        margin-top: 1rem;
        white-space: pre-wrap;
    }
    .print-reflection-output::before {
        content: "My Reflections:";
        display: block;
        font-weight: bold;
        border-bottom: 2px solid #000;
        margin-bottom: 1rem;
        font-family: var(--font-header);
        font-size: 14pt;
    }
}