/* ==========================================================================
   eyes.plus -- Broadcast Control Room Editorial Experience
   ========================================================================== */

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

:root {
    --deep-broadcast: #18181E;
    --signal-white: #E8E8EC;
    --warm-ash: #C8C8D0;
    --pale-silver: #B0B0BC;
    --bright-silver: #D0D0DA;
    --phosphor-green: #5A8F6E;
    --soft-phosphor: #7BC4A0;
    --steel-panel: #252530;
    --iron-edge: #3A3A48;
    --amber-alert: #D4A853;

    --font-display: 'Space Mono', monospace;
    --font-body: 'Inter', sans-serif;
    --font-accent: 'IBM Plex Mono', monospace;

    --content-max-width: 860px;
    --content-offset: 8vw;
    --monitoring-width: 200px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-broadcast);
    color: var(--pale-silver);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    font-weight: 400;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Progress Indicator (left edge) --- */
#progress-track {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 100vh;
    background: var(--iron-edge);
    z-index: 100;
    cursor: pointer;
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: var(--phosphor-green);
    transition: height 0.1s linear;
    animation: pulse-opacity 4s ease-in-out infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* --- IRE Scale Gutter --- */
#ire-scale {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 300px;
    z-index: 90;
}

.ire-mark {
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 400;
    color: var(--iron-edge);
    letter-spacing: 0.05em;
    user-select: none;
}

#ire-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phosphor-green);
    box-shadow: 0 0 8px var(--phosphor-green);
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.3s ease-out;
    top: 0;
}

/* --- Monitoring Strip (right sidebar) --- */
#monitoring-strip {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--monitoring-width);
    height: 100vh;
    background: var(--steel-panel);
    border-left: 1px solid var(--iron-edge);
    z-index: 90;
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.6s ease;
    overflow: hidden;
}

#monitoring-strip.visible {
    opacity: 1;
}

.monitor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.monitor-label {
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.25em;
    color: var(--phosphor-green);
    text-transform: uppercase;
    margin-bottom: 8px;
    width: 100%;
    text-align: center;
}

/* Vectorscope */
#vectorscope {
    width: 100%;
    max-width: 170px;
}

.scope-ring {
    fill: none;
    stroke: var(--iron-edge);
    stroke-width: 0.5;
}

.scope-crosshair {
    stroke: var(--iron-edge);
    stroke-width: 0.3;
    stroke-dasharray: 2 4;
}

.scope-point {
    fill: var(--soft-phosphor);
    transition: cx 0.6s ease, cy 0.6s ease;
}

/* Histogram */
#histogram {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    padding: 0 4px;
}

.histogram-bar {
    flex: 1;
    background: linear-gradient(to top, var(--iron-edge), var(--soft-phosphor));
    min-width: 2px;
    transition: height 0.4s ease;
}

/* Waveform Monitor */
#waveform-monitor {
    width: 100%;
    max-width: 170px;
    height: 50px;
}

#monitor-wave-path {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 1.5;
    opacity: 0.8;
}

/* Monitor Readout */
#monitor-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--iron-edge);
}

.readout-label {
    font-family: var(--font-display);
    font-size: 8px;
    letter-spacing: 0.3em;
    color: var(--iron-edge);
    text-transform: uppercase;
}

#readout-value {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--phosphor-green);
    margin-top: 2px;
}

/* --- Section 1: CARRIER (Hero) --- */
#carrier {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.carrier-content {
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

#hero-waveform {
    width: 100%;
    height: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.8s ease;
}

#hero-wave-path {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 1.5;
}

#hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    color: var(--signal-white);
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#hero-subtitle {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--soft-phosphor);
    margin-top: 12px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.6s ease;
}

/* --- Waveform Breaks --- */
.waveform-break {
    width: 100vw;
    height: 80px;
    overflow: hidden;
    position: relative;
}

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

.break-wave {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 1.5;
}

.break-wave-1 { opacity: 0.8; }
.break-wave-2 { opacity: 0.5; }
.break-wave-3 { opacity: 0.3; }
.break-wave-square-1 { opacity: 0.7; }
.break-wave-square-2 { opacity: 0.4; }
.break-wave-noise-1 { opacity: 0.6; }
.break-wave-noise-2 { opacity: 0.35; }

/* --- Editorial Sections --- */
.editorial-section {
    padding: 80px 0;
    position: relative;
}

.section-content {
    max-width: var(--content-max-width);
    margin-left: calc(50% - var(--content-max-width) / 2 - var(--content-offset));
    padding: 0 24px;
    padding-right: calc(var(--monitoring-width) + 40px);
}

.slug-line {
    display: block;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--phosphor-green);
    margin-bottom: 20px;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    letter-spacing: -0.01em;
    color: var(--warm-ash);
    margin-bottom: 32px;
    line-height: 1.25;
}

.section-heading.underline-draw {
    position: relative;
    display: inline-block;
}

.section-heading.underline-draw .word-underline {
    position: absolute;
    bottom: -4px;
    left: 0;
    height: 2px;
    background: var(--phosphor-green);
    width: 0%;
    transition: width 0.6s ease;
}

.section-heading.underline-draw.active .word-underline {
    width: 100%;
}

.body-text p {
    margin-bottom: 24px;
    color: var(--pale-silver);
    font-weight: 400;
}

.body-text p strong,
.body-text p em {
    font-weight: 500;
    color: var(--bright-silver);
}

/* Sparkline Words */
.sparkline-word {
    position: relative;
    display: inline-block;
    color: var(--bright-silver);
    font-weight: 500;
}

.sparkline-word::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 6'%3E%3Cpath d='M0 3 Q10 0 20 3 Q30 6 40 3 Q50 0 60 3 Q70 6 80 3 Q90 0 100 3' fill='none' stroke='%235A8F6E' stroke-width='1'/%3E%3C/svg%3E") repeat-x;
    background-size: 50px 3px;
}

/* Pull Quotes */
.pull-quote {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--soft-phosphor);
    line-height: 1.55;
    border-left: 2px solid var(--phosphor-green);
    padding: 16px 0 16px 24px;
    margin: 40px 0;
}

/* Inline Data Viz */
.inline-dataviz {
    margin: 40px 0;
    text-align: center;
}

.cie-diagram {
    width: 100%;
    max-width: 260px;
    height: auto;
}

.cie-triangle {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 1;
    opacity: 0.6;
}

.cie-vertex {
    stroke: none;
}

.cie-green { fill: var(--phosphor-green); }
.cie-phosphor { fill: var(--soft-phosphor); }
.cie-amber { fill: var(--amber-alert); }

.cie-label {
    font-family: var(--font-display);
    font-size: 10px;
    fill: var(--pale-silver);
    letter-spacing: 0.1em;
}

.dataviz-caption {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 0.8rem;
    color: var(--iron-edge);
    margin-top: 12px;
}

/* Frame Timeline */
.frame-timeline {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.timeline-base {
    stroke: var(--iron-edge);
    stroke-width: 1;
}

.frame-tick {
    stroke: var(--phosphor-green);
    stroke-width: 1;
    opacity: 0.6;
}

.frame-tick-active {
    stroke: var(--amber-alert);
    stroke-width: 2;
    opacity: 1;
}

.frame-tick-dot {
    fill: var(--amber-alert);
}

/* Signal Warning */
.signal-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(212, 168, 83, 0.08);
    border: 1px solid rgba(212, 168, 83, 0.2);
    margin: 32px 0;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--amber-alert);
}

.warning-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber-alert);
    animation: blink-dot 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Section 5: SIGNAL_LOSS background shift */
#signal-loss {
    background-color: #1E1E22;
}

/* --- Section 7: END_TRANSMISSION --- */
#end-transmission {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.end-content {
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

#end-waveform {
    width: 100%;
    height: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#end-wave-path {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 1.5;
    opacity: 0.6;
}

.end-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.01em;
    color: var(--signal-white);
    position: relative;
    z-index: 2;
    margin-bottom: 8px;
}

#end-cursor {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--phosphor-green);
    animation: cursor-blink 1.2s step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Responsive: Below 768px --- */
@media (max-width: 768px) {
    :root {
        --monitoring-width: 0px;
        --content-offset: 0vw;
    }

    #monitoring-strip {
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        padding: 6px 12px;
        gap: 8px;
        border-left: none;
        border-bottom: 1px solid var(--iron-edge);
    }

    #monitoring-strip .monitor-panel {
        display: none;
    }

    #monitoring-strip #waveform-monitor-panel {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex: 1;
    }

    #monitoring-strip #waveform-monitor-panel .monitor-label {
        margin-bottom: 0;
        font-size: 8px;
        white-space: nowrap;
    }

    #waveform-monitor {
        max-width: none;
        height: 30px;
    }

    #monitor-readout {
        flex-direction: row;
        gap: 6px;
        border-top: none;
        border-left: 1px solid var(--iron-edge);
        padding-top: 0;
        padding-left: 8px;
    }

    .section-content {
        margin-left: auto;
        margin-right: auto;
        padding-right: 24px;
    }

    #ire-scale {
        display: none;
    }

    body {
        padding-top: 48px;
    }

    #carrier {
        height: calc(100vh - 48px);
    }
}

/* --- Waveform animation dashoffset --- */
@keyframes sweep-wave {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -2400; }
}

.break-wave {
    stroke-dasharray: 2400;
    animation: sweep-wave 8s linear infinite;
}

.break-wave-2 {
    animation-delay: -2s;
}

.break-wave-3 {
    animation-delay: -4s;
}

.break-wave-square-2 {
    animation-delay: -3s;
}

.break-wave-noise-2 {
    animation-delay: -1.5s;
}

/* Selection color */
::selection {
    background: var(--phosphor-green);
    color: var(--deep-broadcast);
}
