/* ============================================================
   Rollup.Report — Editorial Fintech Design System
   Colors: #fefefe, #1a2744, #2563eb, #059669, #dc2626, #1f2937, #6b7280, #e5e7eb
   Fonts: Bitter (headings), Merriweather (body), Roboto Mono (data)
   ============================================================ */

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

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

body {
    background: #f5f5f3;
    color: #1f2937;
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 300;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

/* ---- Report Header ---- */
#report-header {
    background: #1a2744;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 5%;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #2563eb;
    color: #fefefe;
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 2px;
}

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

.brand-name {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 0.9375rem;
    color: #fefefe;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.brand-tagline {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.625rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.header-nav a {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: rgba(254, 254, 254, 0.65);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.15s ease;
}

.header-nav a:hover {
    color: #fefefe;
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.report-date,
.report-issue {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    color: rgba(254, 254, 254, 0.5);
    letter-spacing: 0.05em;
}

/* ---- Cover Section ---- */
.cover-section {
    background: #fefefe;
    padding: 4rem 5%;
    border-bottom: 1px solid #e5e7eb;
}

.report-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #2563eb;
    margin-bottom: 1.25rem;
}

.cover-title {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: clamp(1.75rem, 3vw, 2.75rem);
    color: #1a2744;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.cover-deck {
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 1.125rem;
    color: #1f2937;
    line-height: 1.75;
    margin-bottom: 2rem;
}

.cover-meta {
    display: flex;
    gap: 3rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
}

.meta-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    color: #1a2744;
    font-weight: 500;
}

.cover-divider {
    width: 48px;
    height: 3px;
    background: #2563eb;
}

/* ---- Editorial Column (shared) ---- */
.editorial-column {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ---- Section Headers (sticky) ---- */
.section-header {
    background: #fefefe;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
    position: sticky;
    top: 61px; /* height of report-header */
    z-index: 50;
    transition: box-shadow 0.2s ease;
}

.section-header.stuck {
    box-shadow: 0 2px 8px rgba(26, 39, 68, 0.08);
}

.section-header .editorial-column {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.section-number {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #2563eb;
    line-height: 1;
    flex-shrink: 0;
    min-width: 2.5rem;
    transition: font-size 0.2s ease;
}

.section-header.stuck .section-number {
    font-size: 1.25rem;
}

.section-header-rule {
    flex-shrink: 0;
    width: 1px;
    height: 24px;
    background: #e5e7eb;
}

.section-title {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #1a2744;
    line-height: 1.25;
    transition: font-size 0.2s ease;
}

.section-header.stuck .section-title {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}

/* ---- Editorial Sections ---- */
.editorial-section {
    background: #fefefe;
}

.editorial-section .editorial-column {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

/* ---- Body Text ---- */
.body-text {
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 1.0625rem;
    line-height: 1.85;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.body-text strong {
    font-weight: 700;
    color: #1a2744;
}

/* ---- Data Highlights ---- */
.data-highlight {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9375rem;
    color: #1a2744;
    background: #e5e7eb;
    padding: 0.1em 0.35em;
    border-radius: 2px;
}

.metric-change {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
}

.metric-change--up {
    color: #059669;
}

.metric-change--down {
    color: #dc2626;
}

.metric-change--neutral {
    color: #6b7280;
}

/* ---- Pull Quotes ---- */
.pull-quote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-size: 1.1875rem;
    font-style: italic;
    color: #1a2744;
    font-family: 'Merriweather', serif;
    font-weight: 300;
    line-height: 1.7;
}

.pull-quote em {
    font-style: normal;
    font-weight: 700;
}

/* ---- Inline Sparklines ---- */
.sparkline {
    display: inline-block;
    width: 60px;
    height: 16px;
    vertical-align: middle;
    margin: 0 0.25em;
}

/* ---- Footnote References ---- */
.footnote-ref {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    color: #2563eb;
    text-decoration: none;
    vertical-align: super;
    line-height: 0;
    transition: color 0.15s ease;
    position: relative;
    cursor: pointer;
}

.footnote-ref:hover {
    color: #1a2744;
}

/* Tooltip on hover */
.footnote-ref::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2744;
    color: #fefefe;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    padding: 0.4rem 0.65rem;
    border-radius: 3px;
    white-space: nowrap;
    max-width: 260px;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 200;
    margin-bottom: 4px;
    text-align: left;
    line-height: 1.5;
}

.footnote-ref:hover::after {
    opacity: 1;
}

/* ---- Data Panels ---- */
.data-panel {
    background: #1a2744;
    width: 100%;
    padding: 3rem 5%;
}

.data-panel-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.data-panel-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.data-panel-title {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.375rem);
    color: #fefefe;
    margin-bottom: 0.35rem;
}

.data-panel-subtitle {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ---- Charts ---- */
.chart-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.line-chart {
    width: 100%;
    height: auto;
    min-width: 500px;
}

.chart-axis-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    fill: #6b7280;
}

.chart-axis-label--x {
    text-anchor: middle;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1;
}

.chart-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-path.animated {
    stroke-dashoffset: 0;
}

.chart-path--forecast {
    stroke-dasharray: 6, 4;
}

.chart-path--forecast.animated {
    stroke-dashoffset: 0;
}

/* ---- Chart Legend ---- */
.chart-legend {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #6b7280;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot--blue { background: #2563eb; }
.legend-dot--green { background: #059669; }
.legend-dot--red { background: #dc2626; }

.legend-line {
    display: inline-block;
    width: 24px;
    height: 2px;
    flex-shrink: 0;
}

.legend-line--solid {
    background: #2563eb;
}

.legend-line--dashed {
    background: repeating-linear-gradient(
        90deg,
        #2563eb 0,
        #2563eb 5px,
        transparent 5px,
        transparent 9px
    );
}

.legend-band {
    display: inline-block;
    width: 16px;
    height: 10px;
    background: rgba(37, 99, 235, 0.3);
    border: 1px solid rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
}

/* ---- Metrics Grid (TVL Panel) ---- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    padding: 1.25rem 1.5rem;
}

.metric-network {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.metric-tvl {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 1.625rem;
    color: #fefefe;
    margin-bottom: 0.85rem;
    line-height: 1;
}

.metric-bar-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-bar.animated {
    width: var(--bar-width);
}

.metric-bar--arbitrum { background: #059669; }
.metric-bar--optimism { background: #2563eb; }
.metric-bar--zk { background: #dc2626; }
.metric-bar--other { background: #6b7280; }

.metric-share {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #fefefe;
    margin-bottom: 0.2rem;
}

.metric-change-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
}

.metric-change-label.metric-change--up { color: #059669; }
.metric-change-label.metric-change--down { color: #dc2626; }
.metric-change-label.metric-change--neutral { color: #6b7280; }

/* ---- Data Table ---- */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    min-width: 600px;
}

.data-table thead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.data-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    font-weight: 500;
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.1s ease;
}

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

.data-table td {
    padding: 0.7rem 1rem;
    color: #fefefe;
}

.td-network {
    font-weight: 500;
    color: #fefefe;
}

.td-type {
    font-size: 0.6875rem;
    color: #6b7280;
}

.td-type--optimistic { color: #2563eb; }
.td-type--zk { color: #dc2626; }

.td-cost, .td-ratio {
    text-align: right;
    font-feature-settings: "tnum";
    color: #e5e7eb;
}

.td-cost--low { color: #059669; }
.td-ratio--low { color: #059669; font-weight: 500; }

/* ---- Comparison Grid ---- */
.comparison-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.comparison-header-row,
.comparison-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-header-row {
    background: rgba(255, 255, 255, 0.05);
}

.comparison-cell {
    padding: 0.75rem 1.25rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    line-height: 1.4;
}

.comparison-cell:last-child {
    border-right: none;
}

.comparison-cell--label {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
}

.comparison-cell--optimistic {
    color: #fefefe;
    text-align: center;
}

.comparison-cell--zk {
    color: #fefefe;
    text-align: center;
}

.comparison-header-row .comparison-cell--optimistic {
    color: #2563eb;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.comparison-header-row .comparison-cell--zk {
    color: #dc2626;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.comparison-cell--strong {
    color: #059669;
}

.comparison-cell--weak {
    color: #dc2626;
}

.comparison-cell--neutral {
    color: #6b7280;
}

/* ---- Footnotes Section ---- */
.footnotes-section {
    background: #f5f5f3;
    border-top: 1px solid #e5e7eb;
    padding: 3rem 0;
}

.footnotes-title {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

.footnotes-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footnotes-list li {
    display: flex;
    gap: 1rem;
    transition: background 0.25s ease;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 3px;
}

.footnotes-list li.highlighted {
    background: rgba(37, 99, 235, 0.06);
}

.fn-number {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #2563eb;
    flex-shrink: 0;
    width: 1.25rem;
    padding-top: 0.1em;
}

.fn-text {
    font-family: 'Merriweather', serif;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.75;
    font-weight: 300;
}

.fn-back {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #2563eb;
    text-decoration: none;
    margin-left: 0.5rem;
}

/* ---- Report Footer ---- */
.report-footer {
    background: #1a2744;
    padding: 2.5rem 5%;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #2563eb;
    color: #fefefe;
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 2px;
}

.footer-name {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 0.9375rem;
    color: #fefefe;
}

.footer-meta {
    flex: 1;
    min-width: 240px;
}

.footer-disclaimer {
    font-family: 'Merriweather', serif;
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.75;
    font-weight: 300;
    margin-bottom: 0.75rem;
}

.footer-copy {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
    color: rgba(107, 114, 128, 0.6);
    letter-spacing: 0.02em;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .header-nav {
        display: none;
    }

    .cover-meta {
        gap: 1.5rem;
    }

    .section-header {
        top: 57px;
    }

    .comparison-grid {
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .header-inner {
        padding: 0.75rem 4%;
    }

    .editorial-column {
        padding-left: 4%;
        padding-right: 4%;
    }

    .cover-section {
        padding: 2.5rem 4%;
    }

    .data-panel {
        padding: 2rem 4%;
    }

    .cover-meta {
        flex-direction: column;
        gap: 1rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .comparison-grid {
        font-size: 0.6875rem;
    }

    .comparison-cell {
        padding: 0.6rem 0.75rem;
    }

    .chart-legend {
        gap: 1rem;
    }

    .footer-inner {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .chart-path {
        stroke-dashoffset: 0;
        transition: none;
    }

    .metric-bar {
        width: var(--bar-width);
        transition: none;
    }

    html {
        scroll-behavior: auto;
    }
}
