/* ==========================================================================
   1. VARIABLES & CORE ARCHITECTURE
   ========================================================================== */
   :root {
    --bg-primary: #f8f9fa;
    --bg-surface: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --accent-color: #1a2a3a;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 10px 15px rgba(0,0,0,0.03);
    --alert-red: #9b2c2c;
    --alert-bg: #fff5f5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents whole-window double scrolling */
}

/* ==========================================================================
   2. HEADER & LAYOUT CONTAINERS
   ========================================================================== */
header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Keeps header fixed height */
}

.logo {
    font-size: 16px;
    color: var(--text-primary);
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
}

.header-nav a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden; /* Vital for multi-pane internal scrolling */
}

/* ==========================================================================
   3. LEFT SIDE NAVIGATION INDEX
   ========================================================================== */
nav {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

nav h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: #e2e8f0;
    color: var(--accent-color);
    font-weight: 600;
}

.nav-separator {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

/* ==========================================================================
   4. MAIN SCROLL PANEL & CONTENT CARDS
   ========================================================================== */
main {
    flex: 1;
    padding: 40px;
    overflow-y: auto; /* Houses the scroll track panel framework */
    background-color: var(--bg-primary);
}

article {
    max-width: 840px;
    margin: 0 auto;
}

.content-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
}

/* Typography Hierarchy inside Cards */
.content-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.content-card h2 {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 30px;
    border-bottom: 2px solid var(--bg-primary);
    padding-bottom: 15px;
}

.section-block {
    margin-bottom: 35px;
}

.content-card h3 {
    font-size: 18px;
    color: var(--accent-color);
    margin-bottom: 12px;
}

.content-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 15px;
}

.content-card ul {
    margin-left: 20px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.content-card li {
    margin-bottom: 8px;
    font-size: 15px;
}

.sidebar-nav {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: block;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 5px 0;
    transition: color 0.2s ease;
}

.sidebar-nav a:hover {
    color: #0066cc;
}

.sidebar-section-header {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #777;
    margin-top: 20px;
    margin-bottom: 5px;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    display: block;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 5px 0;
    transition: color 0.2s ease;
}

.sidebar-nav a:hover {
    color: #0066cc;
}

.sidebar-section-header {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #777;
    margin-top: 20px;
    margin-bottom: 5px;
    letter-spacing: 0.05em;
}

.sidebar-sub-nav {
    list-style-type: none;
    padding-left: 15px;
    margin: 0;
}

.sidebar-sub-nav li {
    margin-bottom: 5px;
}

/* FIX: Added the missing closing bracket here */
.sidebar-sub-nav a {
    font-size: 0.9rem;
    color: #555;
}
    
/* ==========================================================================
   5. FORENSIC PIPELINE & STRUCTURAL COMPONENTS
   ========================================================================== */
.sequence-container {
    margin: 25px 0;
    border-left: 3px solid var(--border-color);
    padding-left: 20px;
}

.sequence-step {
    background: #fafafa;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.step-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.step-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.step-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-style: italic;
}

.comparison-list {
    list-style: none !important;
    margin-left: 0 !important;
}

/* Forensic Breakdown Box Elements */
.forensic-breakout-box {
    background-color: var(--alert-bg);
    border: 1px solid #fed7d7;
    border-radius: 6px;
    padding: 25px;
    margin-top: 30px;
}

.forensic-breakout-box h4 {
    color: var(--alert-red);
    font-size: 16px;
    margin-bottom: 10px;
}

.forensic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

.forensic-table th, 
.forensic-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #fed7d7;
}

.forensic-table th {
    background-color: #fff;
    color: var(--text-primary);
    font-weight: 600;
}

.negative-value {
    color: var(--alert-red);
    font-weight: bold;
}

blockquote {
    border-left: 4px solid var(--alert-red);
    padding-left: 15px;
    margin: 15px 0 0 0;
    font-style: italic;
}

/* Case Study Profile Blocks */
.entity-profile {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 14px;
    border-left: 4px solid var(--text-secondary);
    background-color: #fafafa;
}

.entity-profile strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--accent-color);
}

/* ==========================================================================
   6. SUB-PANEL SYSTEM FOOTER
   ========================================================================== */
footer {
    max-width: 840px;
    margin: 60px auto 20px auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: #718096;
    font-size: 12px;
    line-height: 1.7;
}

footer p {
    margin-bottom: 12px;
}

.copyright-line {
    font-weight: 600;
    color: var(--text-secondary);
}

/* ==========================================================================
   7. FLOATING RESET CONTROL (BACK TO TOP FIX)
   ========================================================================== */
.back-to-top {
    position: fixed;        /* Absolute lock to browser viewport, ignores parents */
    bottom: 25px;          /* Clean margin tracking from screen bottom edge */
    right: 25px;           /* Anchored perfectly to bottom right tracking line */
    z-index: 9999;         /* Forces rendering on top of all container layers */
    
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Control states handled by internal JS scroll monitor */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s;
}

/* Visible trigger applied dynamically via classList toggle */
.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #000000;
    transform: translateY(-2px);
}

/* Styling for the Investigative Reporter Box */
.reporter-overview {
    background-color: #f8f9fa;
    border-left: 4px solid #4a5568;
    padding: 1.25rem;
    margin-bottom: 2rem;
    font-style: italic;
    color: #2d3748;
}

/* Styling for the Technical/Analyst Evidence notes */
.analyst-commentary {
    background-color: #f1f5f9;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    margin: 1.5rem 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9rem;
}

.deposition-quote {
    background-color: #fafafa; /* An off-white/very light gray to hint at paper */
    border-left: 3px solid #64748b; /* A neutral slate gray border, distinct from the analyst blue */
    padding: 1rem 1.25rem;
    margin: 1.75rem 0;
    font-family: Georgia, Cambria, "Times New Roman", Times, serif; /* Clean legal serif stack */
    font-size: 0.95rem;
    line-height: 1.6; /* Generous spacing for readability */
    color: #334155; /* Sharp, dark slate for high contrast */
    font-style: italic; /* Visually separates verbatim testimony from narrative text */
}

/* amount-figure: Green Scheme */
.amount-figure {
    background-color: #e6f4ea;
    border: 1px solid #a8dab5;
    color: #137333;
    padding: 1px 1px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
}

/* account-figure: Red/Coral Scheme */
.account-figure {
    background-color: #fce8e6;
    border: 1px solid #fad2cf;
    color: #c5221f;
    padding: 1px 1px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
}

.commentary-label {
    display: block;
    font-weight: bold;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.section-divider {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 2.5rem 0;
}

/* Container for an entire email entry */
.email-record {
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #64748b; /* Distinct gray bar for emails */
    background-color: #ffffff;
}

/* Metadata block at the top */
.email-meta {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: #475569;
}
.email-meta p {
    margin: 0.25rem 0;
}

/* Inside body text */
.email-text {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
}
.email-text p {
    margin-bottom: 1rem;
}
.email-text p:last-child {
    margin-bottom: 0;
}
