/* ==========================================================================
   CUBA REPORT DESIGN SYSTEM & STYLESHEET
   Department of State Theme - Deep Navy & Gold Official Aesthetic
   ========================================================================== */

:root {
    /* Color Palette (HSL & Hex) */
    --bg-darkest: #050B12;
    --bg-dark: #0A1420;
    --bg-card: #101E2E;
    --bg-card-hover: #16273B;
    --bg-sidebar: #08111B;
    --border-color: rgba(212, 175, 55, 0.25);
    --border-color-subtle: rgba(255, 255, 255, 0.08);

    --text-primary: #F0F4F8;
    --text-secondary: #BAC7D5;
    --text-muted: #8292A4;

    --gold-primary: #D4AF37;
    --gold-bright: #F5D77F;
    --gold-dark: #A4811B;

    --blue-accent: #2C5E8A;
    --blue-glow: rgba(44, 94, 138, 0.3);

    /* Fonts */
    --font-heading: 'Cinzel', 'Merriweather', serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-prose: 'Merriweather', Georgia, serif;

    /* Animations & Easing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.2s var(--ease-out-expo);
    --transition-normal: 0.35s var(--ease-out-expo);

    /* Layout Dimensions */
    --header-height: 72px;
    --sidebar-width: 320px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body.dark-theme {
    background-color: var(--bg-darkest);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(20, 38, 60, 0.5) 0%, transparent 75%),
        radial-gradient(circle at 100% 50%, rgba(15, 30, 48, 0.3) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Reading Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright));
    width: 0%;
    z-index: 1000;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}

/* Header Styles */
.site-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background-color: rgba(5, 11, 18, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 900;
    display: flex;
    align-items: center;
}

.header-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.seal-icon {
    width: 44px;
    height: 44px;
    color: var(--gold-primary);
}

.seal-svg {
    width: 100%;
    height: 100%;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.agency-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gold-bright);
}

.report-subtitle {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color-subtle);
    border-radius: 20px;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 220px;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
    width: 280px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    font-size: 0.8rem;
    opacity: 0.6;
    pointer-events: none;
}

.search-count {
    position: absolute;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--gold-bright);
    font-weight: 600;
}

/* TOC Toggle Button */
.toc-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--gold-bright);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.toc-toggle-btn:hover {
    background-color: rgba(212, 175, 55, 0.15);
    border-color: var(--gold-bright);
}

/* Main Layout */
.app-layout {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    position: relative;
}

/* Sidebar TOC */
.sidebar-toc {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color-subtle);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1.5rem;
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.toc-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--gold-bright);
    letter-spacing: 0.5px;
}

.toc-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.toc-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.toc-link .chapter-num {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gold-primary);
    min-width: 28px;
    font-size: 0.8rem;
}

.toc-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.toc-link.active {
    background-color: rgba(212, 175, 55, 0.1);
    color: var(--gold-bright);
    border-left-color: var(--gold-bright);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 2.5rem 4rem;
    max-width: 980px;
}

/* Cover Section */
.cover-section {
    position: relative;
    background: linear-gradient(180deg, #0A1626 0%, #050B12 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5rem 3rem;
    text-align: center;
    margin-bottom: 4rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.cover-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(44, 94, 138, 0.25), transparent 70%);
    pointer-events: none;
}

.seal-hero {
    width: 90px;
    height: 90px;
    margin: 0 auto 2rem;
    color: var(--gold-bright);
}

.seal-svg-large {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.4));
}

.main-title {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 12px;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.main-subtitle {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--gold-bright);
    margin-bottom: 2.5rem;
}

.cover-divider {
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    margin: 0 auto 2rem;
}

.prepared-by {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.agency-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

/* Report Sections */
.report-section {
    margin-bottom: 5rem;
    padding-top: 1.5rem;
}

.chapter-banner, .section-banner {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(10, 20, 32, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.chapter-badge, .section-pre-title {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold-primary);
    margin-bottom: 0.5rem;
    background: rgba(212, 175, 55, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.chapter-banner h2, .section-banner h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: #FFFFFF;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.chapter-tagline {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--text-muted);
}

/* Prose Typography */
.prose p {
    font-family: var(--font-prose);
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.6rem;
    line-height: 1.8;
}

.prose .lead-para {
    font-size: 1.18rem;
    color: var(--text-primary);
    font-weight: 400;
}

.prose h3.subsection-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold-bright);
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

/* Quotes */
blockquote.featured-quote {
    position: relative;
    background: rgba(16, 30, 46, 0.6);
    border-left: 4px solid var(--gold-primary);
    border-radius: 0 6px 6px 0;
    padding: 1.8rem 2rem;
    margin: 2.5rem 0;
    font-style: italic;
}

blockquote.featured-quote p {
    font-family: var(--font-prose);
    font-size: 1.12rem;
    color: #FFFFFF;
    margin-bottom: 0.8rem;
}

blockquote.featured-quote cite {
    display: block;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-style: normal;
    color: var(--gold-bright);
    font-weight: 500;
}

blockquote.highlight-box {
    background: rgba(44, 94, 138, 0.15);
    border: 1px solid rgba(44, 94, 138, 0.4);
    border-radius: 6px;
    padding: 2rem;
    margin: 2.5rem 0;
}

blockquote.highlight-box p {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Footnote References */
.footnote-ref {
    color: var(--gold-bright);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85em;
    padding: 0 0.2em;
}

.footnote-ref:hover {
    text-decoration: underline;
}

/* Interactive Table for Tricontinental */
.interactive-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 3rem 0;
    overflow: hidden;
}

.table-header-bar {
    background: rgba(212, 175, 55, 0.1);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header-bar h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--gold-bright);
}

.table-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gold-primary);
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.table-responsive {
    max-height: 420px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

.data-table th {
    background: var(--bg-dark);
    font-family: var(--font-heading);
    color: var(--gold-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.data-table td:first-child {
    font-weight: 600;
    color: var(--gold-bright);
    width: 30%;
}

/* TOC Grid Page */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.toc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color-subtle);
    border-radius: 6px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
}

.toc-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    background: var(--bg-card-hover);
}

.toc-card-num {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold-primary);
    margin-bottom: 0.5rem;
}

.toc-card-body h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
}

.toc-card-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.toc-card-page {
    margin-top: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-bright);
    letter-spacing: 1px;
}

/* Media Cards / Photos */
.media-card {
    margin: 2.5rem 0;
}

.media-frame {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.report-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid var(--border-color-subtle);
    transition: transform var(--transition-normal);
}

.report-img:hover {
    transform: scale(1.015);
}

.caption-overlay, figcaption.caption-overlay {
    margin-top: 0.75rem;
    background: rgba(5, 11, 18, 0.9);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--gold-primary);
    line-height: 1.5;
}

.margin-top-sm {
    margin-top: 0.75rem;
}

/* Footnotes Section */
.footnotes-section {
    border-top: 1px solid var(--border-color);
    padding-top: 3rem;
}

.footnotes-list {
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.footnotes-list li {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.footnote-backref {
    color: var(--gold-bright);
    text-decoration: none;
    margin-left: 0.4rem;
}

/* Footer */
.site-footer {
    background-color: var(--bg-darkest);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem;
    text-align: center;
    margin-top: 4rem;
}

.footer-seal {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    color: var(--gold-primary);
}

.seal-svg-small {
    width: 100%;
    height: 100%;
}

.site-footer p {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.footer-copy {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    margin-top: 0.5rem;
}

/* Search Highlight */
mark.search-highlight {
    background-color: rgba(212, 175, 55, 0.4);
    color: #FFFFFF;
    border-radius: 2px;
    padding: 0 2px;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar-toc {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }

    .sidebar-toc.open {
        transform: translateX(0);
    }

    .toc-close-btn {
        display: block;
    }

    .main-content {
        padding: 2rem;
        max-width: 100%;
    }

    .main-title {
        font-size: 2.8rem;
        letter-spacing: 6px;
    }
}

@media (max-width: 640px) {
    .header-container {
        padding: 0 1rem;
    }

    .agency-title {
        font-size: 0.75rem;
    }

    .search-box input {
        width: 140px;
    }

    .search-box input:focus {
        width: 180px;
    }

    .cover-section {
        padding: 3rem 1.5rem;
    }

    .main-title {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .main-subtitle {
        font-size: 1rem;
    }
}
