/* ================================================
   layer-2.report — Styles
   Fintech Trust Blue / Research Report Aesthetic
   ================================================ */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Colors */
:root {
    --white: #FFFFFF;
    --card-gray: #F5F7FA;
    --trust-blue: #1565C0;
    --deep-blue: #0D47A1;
    --text-dark: #1A1A1A;
    --text-gray: #6B6B6B;
    --up-green: #2E7D32;
    --down-red: #C62828;
    --border-gray: #E0E0E0;
    --row-hover: #F0F4FA;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--white);
}

/* ================================================
   Report Header (Hero, 60vh)
   ================================================ */
#report-header {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--white);
    padding: 0 2rem;
}

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

.header-left {
    flex: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header-left.visible {
    opacity: 1;
}

.report-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--deep-blue);
    margin-bottom: 0.5rem;
}

.dateline {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.summary {
    font-size: 0.95rem;
    color: var(--text-dark);
    max-width: 560px;
    line-height: 1.7;
}

/* Key Metric Card in Header */
.key-metric-card {
    background: var(--card-gray);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 220px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.key-metric-card.visible {
    opacity: 1;
}

.key-metric-label {
    font-size: 0.8rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.key-metric-value {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--deep-blue);
}

.key-metric-trend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.key-metric-trend.visible {
    opacity: 1;
}

/* Blue Accent Line */
.blue-accent-line {
    height: 3px;
    background: var(--trust-blue);
    max-width: 1120px;
    margin: 0 auto;
    width: 0;
    transition: width 0.4s ease;
}

.blue-accent-line.drawn {
    width: 100%;
}

/* ================================================
   Trend Arrows (CSS Triangles)
   ================================================ */
.trend-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.trend-arrow.up {
    border-bottom: 8px solid var(--up-green);
}

.trend-arrow.down {
    border-top: 8px solid var(--down-red);
}

.trend-up {
    color: var(--up-green);
    font-size: 0.8rem;
    font-family: 'DM Mono', monospace;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.trend-down {
    color: var(--down-red);
    font-size: 0.8rem;
    font-family: 'DM Mono', monospace;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ================================================
   Key Metrics Bar (Section 2)
   ================================================ */
#metrics-bar {
    background: var(--white);
    padding: 2rem;
}

.metrics-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.metric-card {
    background: var(--card-gray);
    border: 1px solid var(--border-gray);
    border-left: 3px solid transparent;
    border-radius: 4px;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    transition: border-left-color 0.15s ease, box-shadow 0.15s ease;
    opacity: 0;
    transform: translateY(8px);
}

.metric-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, border-left-color 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
    border-left-color: var(--trust-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--deep-blue);
    font-variant-numeric: tabular-nums;
}

.metric-value.mono {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
}

.metric-trend {
    margin-top: 0.5rem;
}

/* ================================================
   Chart Section (Section 3)
   ================================================ */
#charts-section {
    background: var(--white);
    padding: 2rem;
}

.charts-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
}

.chart-container {
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 1.25rem;
    background: var(--white);
}

.chart-line {
    flex: 0 0 55%;
}

.chart-bar {
    flex: 1;
}

.section-header {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--deep-blue);
    margin-bottom: 1rem;
}

.chart-wrapper {
    width: 100%;
    position: relative;
}

.chart-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG Chart Styles */
.chart-gridline {
    stroke: var(--border-gray);
    stroke-width: 0.5;
}

.chart-axis-label {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    fill: var(--text-gray);
}

.chart-data-line {
    fill: none;
    stroke: var(--trust-blue);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-area-fill {
    fill: rgba(21, 101, 192, 0.08);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.chart-area-fill.visible {
    opacity: 1;
}

.chart-bar-rect {
    fill: var(--trust-blue);
    opacity: 0.8;
    transition: opacity 0.15s ease;
    cursor: pointer;
}

.chart-bar-rect:hover {
    opacity: 1;
}

.chart-tooltip-dot {
    fill: var(--trust-blue);
    r: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.bar-tooltip {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    fill: var(--text-dark);
    text-anchor: middle;
    opacity: 0;
    pointer-events: none;
}

/* ================================================
   Data Table (Section 4)
   ================================================ */
#data-table-section {
    background: var(--white);
    padding: 2rem;
}

.table-inner {
    max-width: 1120px;
    margin: 0 auto;
}

.table-scroll {
    overflow-x: auto;
}

#protocol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#protocol-table thead th {
    background: var(--card-gray);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dark);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-gray);
    white-space: nowrap;
    user-select: none;
}

#protocol-table thead th.sortable {
    cursor: pointer;
}

#protocol-table thead th.sortable:hover {
    color: var(--trust-blue);
}

.sort-indicator {
    display: inline-block;
    width: 8px;
    height: 12px;
    vertical-align: middle;
    margin-left: 4px;
    position: relative;
}

.sort-indicator::before,
.sort-indicator::after {
    content: '';
    position: absolute;
    left: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.sort-indicator::before {
    top: 0;
    border-bottom: 4px solid var(--border-gray);
}

.sort-indicator::after {
    bottom: 0;
    border-top: 4px solid var(--border-gray);
}

.sort-indicator.asc::before {
    border-bottom-color: var(--trust-blue);
}

.sort-indicator.desc::after {
    border-top-color: var(--trust-blue);
}

#protocol-table tbody tr {
    border-bottom: 1px solid var(--border-gray);
    opacity: 0;
    transition: opacity 0.2s ease, background 0.15s ease;
}

#protocol-table tbody tr.visible {
    opacity: 1;
}

#protocol-table tbody tr:nth-child(odd) {
    background: var(--white);
}

#protocol-table tbody tr:nth-child(even) {
    background: var(--card-gray);
}

#protocol-table tbody tr:hover {
    background: var(--row-hover);
}

#protocol-table tbody td {
    padding: 0.65rem 1rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
}

#protocol-table tbody td:first-child {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--deep-blue);
}

#protocol-table tbody td:last-child {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-gray);
}

/* ================================================
   Footer
   ================================================ */
#report-footer {
    background: var(--white);
    padding: 0 2rem 2rem;
    margin-top: 2rem;
}

.footer-line {
    margin-bottom: 1.5rem;
}

.footer-inner {
    max-width: 1120px;
    margin: 0 auto;
}

.footer-methodology,
.footer-disclaimer {
    font-size: 0.78rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.footer-methodology strong {
    color: var(--text-dark);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-gray);
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 900px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .key-metric-card {
        align-items: flex-start;
        width: 100%;
    }

    .metrics-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-inner {
        flex-direction: column;
    }

    .chart-line,
    .chart-bar {
        flex: 1 1 100%;
    }
}

@media (max-width: 600px) {
    .metrics-inner {
        grid-template-columns: 1fr;
    }

    #report-header {
        min-height: auto;
        padding-top: 3rem;
        padding-bottom: 1.5rem;
    }
}
