/* ============================================================
   Scoped CSS – Inline Dynamic Impact Envelope Chart
   Namespace prefix: .inline-
   ============================================================ */

.inline-chartbox {
    --inline-navy: #2d285d;
    --inline-muted: #62697a;
    --inline-axis: #515a6b;
    --inline-grid: #e9ecf3;
    --inline-purple: #7b63bf;
    --inline-orange: #e79a3b;
    --inline-blue: #3f6f9d;
    --inline-green: #35a36f;
    --inline-red: #d64f4f;
    --inline-band: #dce9f7;
    --inline-zone-a: #f4f1f8;
    --inline-zone-b: #f3f7fb;
    --inline-border: #c9ccda;

    position: relative;
    width: 100%;
    border: 1px solid var(--inline-border);
    border-radius: 14px;
    padding: 8px 12px 10px;
    background: #ffffff;
    font-family: var(--font-para, 'Inter', system-ui, sans-serif);
    color: var(--inline-navy);
    overflow: hidden;
}

.inline-chart-viewport {
    position: relative;
    width: 100%;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

.inline-chart-viewport.is-portrait-locked {
    opacity: 0.35;
    filter: blur(1px);
    pointer-events: none;
    user-select: none;
}

svg.inline-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.inline-grid {
    stroke: var(--inline-grid);
    stroke-width: 1;
}

.inline-line-upper {
    fill: none;
    stroke: var(--inline-orange);
    stroke-width: 2.4;
    stroke-dasharray: 6 4;
    stroke-linecap: butt;
}

.inline-line-lower {
    fill: none;
    stroke: var(--inline-blue);
    stroke-width: 2.4;
    stroke-dasharray: 6 4;
    stroke-linecap: butt;
}

.inline-axis-label,
.inline-tick {
    fill: var(--inline-axis);
    font-family: var(--font-para, 'Inter', system-ui, sans-serif);
}

.inline-axis-label {
    font-size: 10px;
    font-weight: 600;
}

.inline-tick {
    font-size: 9px;
    font-weight: 500;
}

.inline-zone-label {
    fill: #7b8291;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.inline-threshold-label {
    fill: #776d9d;
    font-size: 8.5px;
    font-weight: 500;
}

/* Callout cards */
.inline-call rect {
    filter: url(#inline-shadow);
}

.inline-call-title {
    fill: var(--inline-navy);
    font-size: 10.2px;
    font-weight: 700;
}

.inline-call-body {
    fill: var(--inline-muted);
    font-size: 9px;
    font-weight: 500;
}

.inline-call-line {
    stroke: #8277a8;
    stroke-width: 1;
    fill: none;
}

/* Legend */
.inline-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 18px;
    padding: 30px 15px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

.inline-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.inline-lg-sw {
    width: 13px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.inline-lg-line {
    width: 18px;
    border-top: 2.5px solid currentColor;
    flex-shrink: 0;
}

.inline-lg-dash {
    width: 18px;
    border-top: 2px dashed currentColor;
    flex-shrink: 0;
}

/* Tooltip */
.inline-tip {
    position: fixed;
    z-index: 1050;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -115%);
    background: rgba(45, 40, 93, 0.94);
    color: #ffffff;
    border-radius: 10px;
    padding: 9px 12px;
    min-width: 168px;
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 12px 32px rgba(45, 40, 93, 0.28);
    transition: opacity 0.15s ease;
}

.inline-tip b {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    color: #35a36f;
}

/* Mobile rotate notice */
.inline-mobile-notice {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(123, 99, 191, 0.08);
    border: 1px dashed rgba(123, 99, 191, 0.35);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 12px;
    color: var(--inline-navy);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.inline-mobile-notice svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: var(--inline-purple);
    animation: inline-rotate-pulse 2s infinite ease-in-out;
}

@keyframes inline-rotate-pulse {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Full-screen rotate overlay (portrait mobile) */
.inline-rotate-overlay {
    display: none;
    position: absolute;
    inset: 8px 12px 10px;
    z-index: 5;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    padding: 24px 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    text-align: center;
}

.inline-rotate-overlay.is-visible {
    display: flex;
}

.inline-rotate-overlay svg {
    width: 44px;
    height: 44px;
    fill: var(--inline-purple);
    animation: inline-rotate-pulse 2s infinite ease-in-out;
}

.inline-rotate-overlay p {
    margin: 0;
    max-width: 260px;
    font-size: 14px;
    font-weight: 600;
    color: var(--inline-navy);
    line-height: 1.5;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991px) {
    .inline-chartbox {
        padding: 8px 8px 8px;
    }

    .inline-legend {
        gap: 8px 12px;
        font-size: 8.5px;
    }
}

@media (max-width: 767px) {
    .inline-mobile-notice {
        display: flex;
    }

    .inline-call {
        display: none !important;
    }

    .inline-legend {
        font-size: 8px;
        gap: 6px 10px;
    }
}

@media (max-width: 767px) and (orientation: landscape) {
    .inline-mobile-notice {
        display: none;
    }

    .inline-chart-viewport.is-portrait-locked {
        opacity: 1;
        filter: none;
        pointer-events: auto;
        user-select: auto;
    }

    .inline-rotate-overlay.is-visible {
        display: none !important;
    }

    .inline-call {
        display: block !important;
    }
}

@media (max-width: 767px) and (orientation: portrait) {
    .inline-chart-viewport.is-portrait-locked {
        opacity: 0.35;
        filter: blur(1px);
        pointer-events: none;
    }

    .inline-rotate-overlay.is-visible {
        display: flex;
    }
}

@media (max-width: 575px) {
    .inline-call {
        display: none !important;
    }

    .inline-legend {
        justify-content: flex-start;
    }
}
