/* Shared styles for all markdown content pages (Reports, Concepts, Essay, Whitepaper) */

/* ============================================================================
   SPACING SYSTEM - 8px Vertical Rhythm
   ============================================================================ */

:root {
    --spacing-unit: 8px;
    --spacing-xs: calc(var(--spacing-unit) * 1);   /* 8px */
    --spacing-sm: calc(var(--spacing-unit) * 2);   /* 16px */
    --spacing-md: calc(var(--spacing-unit) * 3);   /* 24px */
    --spacing-lg: calc(var(--spacing-unit) * 4);   /* 32px */
    --spacing-xl: calc(var(--spacing-unit) * 5);   /* 40px */
}

/* Container - Override global .container width */
.markdown-container {
    max-width: 900px !important;
    margin: 0 auto;
    padding: 2rem;
}

/* Content body */
.markdown-content {
    line-height: 1.7;
    font-size: 1.125rem;
    font-family: 'Crimson Text', Georgia, serif;
    max-width: 750px;
}

/* Headings with vertical rhythm */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: #0D3B3C;
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    border-bottom: 2px solid #46B3A9;
    padding-bottom: var(--spacing-sm);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

.markdown-content h2 {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) 0 var(--spacing-sm) var(--spacing-md);
    border-left: 4px solid #46B3A9;
    border-bottom: none;
    background: linear-gradient(90deg, rgba(70, 179, 169, 0.08) 0%, transparent 100%);
    border-radius: 0 4px 4px 0;
}

.markdown-content h3 {
    font-size: 1.375rem;
    line-height: 1.4;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

/* Paragraphs */
.markdown-content p {
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
}

/* Tables */
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    display: block;
    overflow-x: auto;  /* Allow horizontal scroll on narrow screens */
}

.markdown-content th {
    background: #0D3B3C;
    color: #F9F8F3; /* Light text on dark background for contrast */
    padding: 1rem 0.75rem; /* Increased vertical padding */
    text-align: left;
    font-weight: 600;
    font-family: 'Source Sans Pro', sans-serif;
    border-bottom: 3px solid #46B3A9; /* Accent border under header */
}

.markdown-content td {
    padding: 0.75rem;
    border-bottom: 1px solid #E8E7E0; /* Lighter border color */
}

/* Zebra striping for better row distinction */
.markdown-content tbody tr:nth-child(even) {
    background: #F9F8F3; /* Light background for even rows */
}

.markdown-content tbody tr:nth-child(odd) {
    background: #FFFFFF; /* White background for odd rows */
}

.markdown-content tbody tr:hover {
    background: #F0F9F8; /* Subtle teal tint on hover */
    cursor: pointer;
}

/* Code */
.markdown-content code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

/* Lists with custom bullets */
.markdown-content ul {
    list-style: none;
    margin-left: 2rem;
    margin-bottom: var(--spacing-md);
}

.markdown-content ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.markdown-content ul li::before {
    content: "●";
    position: absolute;
    left: 0;
    color: #46B3A9;
    font-size: 0.8em;
    line-height: 1.9;
}

/* Nested lists */
.markdown-content ul ul {
    margin-top: var(--spacing-xs);
    margin-left: 1.5rem;
}

.markdown-content ul ul li::before {
    content: "○";
    color: #46B3A9;
}

/* Ordered lists - keep standard */
.markdown-content ol {
    margin-left: 2rem;
    margin-bottom: var(--spacing-md);
    padding-left: 0.5rem;
}

.markdown-content ol li {
    margin-bottom: var(--spacing-sm);
}

/* Preserve TOC list styling - no custom bullets */
.toc-list,
.toc-list ul {
    list-style: none;
    margin-left: 0;
}

.toc-list li::before,
.toc-list ul li::before {
    content: none;
}

/* Whitepaper-specific header */
.whitepaper-header {
    text-align: center;
    padding: 3rem 0 2rem 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 3rem;
}

.whitepaper-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-family: 'Crimson Text', Georgia, serif;
}

.whitepaper-header .subtitle {
    font-size: 1.2rem;
    color: #6c757d;
    font-style: italic;
    font-family: 'Crimson Text', Georgia, serif;
}

.whitepaper-header .meta {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #6c757d;
}

/* Contributor note */
.contributor-note {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border-left: 4px solid #46B3A9;
}

/* Table of contents */
.toc {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    margin: 2rem 0;
    border-left: 4px solid #46B3A9;
}

.toc h3 {
    margin-top: 0;
    color: #0D3B3C;
    font-size: 1.3rem;
}

.toc ul {
    line-height: 2;
}

.toc a {
    color: #46B3A9;
    text-decoration: none;
}

.toc a:hover {
    text-decoration: underline;
}

/* ============================================================================
   TABLE OF CONTENTS (TOC)
   ============================================================================ */

.content-with-toc {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.toc-sidebar {
    position: relative;
}

.toc-sticky {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0;
    border-left: 4px solid #46B3A9;
    font-size: 0.9rem;
}

.toc-sticky h3 {
    margin-top: 0;
    color: #0D3B3C;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 700;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.4rem;
}

.toc-list li.h3 {
    margin-left: 1rem;
    font-size: 0.85rem;
}

.toc-list a {
    color: #5A5A5A;
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    transition: color 0.2s, font-weight 0.2s;
    line-height: 1.3;
}

.toc-list a:hover {
    color: #46B3A9;
    font-weight: 600;
}

.toc-list a.active {
    color: #46B3A9;
    font-weight: 700;
    border-left: 3px solid #46B3A9;
    padding-left: var(--spacing-xs);
    margin-left: calc(-1 * var(--spacing-xs));
}

.back-to-top {
    margin-top: 1rem;
    width: 100%;
    padding: 0.4rem;
    background: #46B3A9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.back-to-top:hover {
    background: #3A9A91;
}

/* Mobile table styling */
@media (max-width: 768px) {
    .markdown-content table {
        font-size: 0.9rem;
    }

    .markdown-content th,
    .markdown-content td {
        padding: 0.5rem;
    }
}

/* Mobile: Hide TOC sidebar completely */
@media (max-width: 768px) {
    .content-with-toc {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .toc-sidebar {
        display: none;
    }
}

/* Ensure markdown content doesn't get squished */
.content-with-toc .markdown-content {
    min-width: 0; /* Prevents grid blowout */
}

/* ============================================================================
   LINK STYLING WITH ACCESSIBILITY
   ============================================================================ */

/* Link styling with accessibility */
.markdown-content a {
    color: #46B3A9;
    text-decoration: underline;
    text-decoration-color: rgba(70, 179, 169, 0.4);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s, color 0.2s;
}

.markdown-content a:hover {
    color: #3A9A91;
    text-decoration-color: rgba(70, 179, 169, 1);
}

.markdown-content a:visited {
    color: #357F78;
}

.markdown-content a:focus-visible {
    outline: 2px solid #46B3A9;
    outline-offset: 3px;
    border-radius: 2px;
    background: rgba(70, 179, 169, 0.1);
}

/* ============================================================================
   KEYBOARD NAVIGATION FOCUS STATES
   ============================================================================ */

/* Focus states for accessibility */
.toc-list a:focus-visible {
    outline: 2px solid #46B3A9;
    outline-offset: 2px;
    border-radius: 3px;
    background: rgba(70, 179, 169, 0.1);
}

.back-to-top:focus-visible {
    outline: 3px solid #46B3A9;
    outline-offset: 3px;
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================================
   AI REPORT INFO BANNER
   ============================================================================ */

/* Collapsible banner for AI-generated report disclosure */
.report-meta {
    background: #F0F9F8;  /* Light teal tint matching hover states */
    border-left: 3px solid #46B3A9;  /* Site teal accent */
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.report-meta summary {
    cursor: pointer;
    font-weight: 600;
    color: #0D3B3C;  /* Dark teal matching headings */
    user-select: none;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.95rem;
}

.report-meta summary:hover {
    color: #46B3A9;  /* Site teal on hover */
}

.report-meta-content {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #E8E7E0;  /* Light border matching table borders */
    color: #333333;
    font-size: 0.9rem;
    line-height: 1.6;
}

.report-meta-content p {
    margin-bottom: 0.5rem;
}

.report-meta-content p:last-child {
    margin-bottom: 0;
}

.report-meta-content a {
    color: #46B3A9;
    text-decoration: underline;
}

.report-meta-content a:hover {
    color: #3A9A91;
}

/* ============================================================================
   FIGURE/IMAGE STYLING
   ============================================================================ */

/* Figure container for proper sizing and centering */
.markdown-content .figure-container {
    max-width: 100%;
    margin: 2rem 0;
    text-align: center;
}

/* Images within markdown content */
.markdown-content img {
    max-width: 80%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Image captions (italic text after images) */
.markdown-content img + em,
.markdown-content .figure-container em {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    font-style: italic;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive image sizing for smaller screens */
@media (max-width: 768px) {
    .markdown-content img {
        max-width: 95%;
    }

    .markdown-content img + em,
    .markdown-content .figure-container em {
        max-width: 95%;
        font-size: 0.85rem;
    }
}

/* ============================================================================
   SECTION INSIGHT/SUMMARY CARDS
   ============================================================================ */

/* Key insight box - use with blockquote containing "Key insight:" or "Summary:" */
.markdown-content blockquote {
    background: linear-gradient(135deg, #F0F9F8 0%, #F9F8F3 100%);
    border-left: 4px solid #46B3A9;
    border-radius: 0 8px 8px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem 0;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1rem;
    color: #2E2E2E;
    box-shadow: 0 2px 8px rgba(70, 179, 169, 0.1);
}

.markdown-content blockquote p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-content blockquote strong:first-child {
    color: #0D3B3C;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================================================
   TIMELINE STYLING FOR BENCHMARKS
   ============================================================================ */

/* Timeline wrapper - applied via JS to ordered lists with "Year X" pattern */
.markdown-content .timeline {
    list-style: none;
    margin-left: 0;
    padding-left: 2.5rem;
    position: relative;
}

/* Vertical line */
.markdown-content .timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: linear-gradient(180deg, #46B3A9 0%, rgba(70, 179, 169, 0.3) 100%);
    border-radius: 1px;
}

/* Timeline items */
.markdown-content .timeline li {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1.5rem;
    margin-bottom: 0;
}

.markdown-content .timeline li:last-child {
    padding-bottom: 0;
}

/* Timeline dots */
.markdown-content .timeline li::before {
    content: '';
    position: absolute;
    left: -1.85rem;
    top: 0.4rem;
    width: 12px;
    height: 12px;
    background: #46B3A9;
    border: 3px solid #F0F9F8;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #46B3A9;
}

/* Year labels styling */
.markdown-content .timeline li strong:first-child {
    color: #0D3B3C;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    background: rgba(70, 179, 169, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
}

/* ============================================================================
   ROTATION OPPORTUNITY BOX (special styling for key section intros)
   ============================================================================ */

/* Style for "Rotation Opportunity" h2 header */
.markdown-content h2#rotation-opportunity {
    background: linear-gradient(135deg, #0D3B3C 0%, #1a5a5c 100%);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    border-left: none;
}

/* Style for the bold statement following Rotation Opportunity */
.markdown-content h2#rotation-opportunity + p > strong:only-child {
    display: block;
    background: linear-gradient(135deg, rgba(70, 179, 169, 0.15) 0%, rgba(240, 199, 94, 0.12) 100%);
    border: 2px solid rgba(70, 179, 169, 0.4);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 1.25rem 1.5rem;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #0D3B3C;
    line-height: 1.6;
    margin-top: 0;
}

/* Fallback for generic h2 + strong pattern */
.markdown-content h2 + p > strong:only-child {
    display: block;
    background: linear-gradient(135deg, rgba(70, 179, 169, 0.1) 0%, rgba(240, 199, 94, 0.1) 100%);
    border: 1px solid rgba(70, 179, 169, 0.3);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0D3B3C;
    line-height: 1.5;
}
