/* === GENPATSU.IO - Nuclear Control Room Instrument Panel === */

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

:root {
    --surface1: #3d3d38;
    --surface2: #2b2b28;
    --surface3: #1a1a18;
    --surface4: #0f0f0e;
    --brass: #c4b998;
    --lead: #7a7a6e;
    --ash: #8a8a7e;
    --alarm-red: #b83a2a;
    --caution-amber: #e8a825;
    --steel: #4a4a42;
    --panel: #1e1e1c;
}

html {
    scroll-behavior: auto;
}

body {
    background: var(--surface1);
    color: var(--brass);
    font-family: 'Source Serif 4', 'Noto Sans JP', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* === INSTRUMENT RACK SIDEBAR === */
.instrument-rack {
    position: fixed;
    left: 0;
    top: 0;
    width: 72px;
    height: 100vh;
    background: var(--surface2);
    border-right: 1px solid var(--steel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 100;
}

.indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--caution-amber);
    background: transparent;
    transition: background 0.5s, border-color 0.5s;
}

.indicator.caution {
    background: var(--caution-amber);
    animation: pulse-amber 4s ease-in-out infinite;
}

.indicator.alarm {
    background: var(--alarm-red);
    border-color: var(--alarm-red);
    animation: pulse-alarm 0.8s ease-in-out infinite;
}

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

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

/* === SECTIONS === */
.section {
    padding-left: 72px;
    transition: background-color 0.8s ease;
}

.section[data-bg="surface1"] { background-color: var(--surface1); }
.section[data-bg="surface2"] { background-color: var(--surface2); }
.section[data-bg="surface3"] { background-color: var(--surface3); }
.section[data-bg="surface4"] { background-color: var(--surface4); }

/* === SECTION 1: NORMAL OPERATION === */
.normal-operation {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-inner {
    text-align: center;
    width: 100%;
    max-width: 900px;
    padding: 0 40px;
}

.title-group {
    margin-bottom: 60px;
}

.title-jp {
    font-family: 'Shippori Mincho', serif;
    font-weight: 800;
    font-size: 128px;
    color: var(--brass);
    letter-spacing: -0.02em;
    line-height: 1;
}

.title-domain {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: var(--lead);
    letter-spacing: 0.25em;
    margin-top: 12px;
}

/* === READOUT BARS === */
.readout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.readout-bar {
    height: 6px;
    background: var(--surface3);
    position: relative;
    overflow: hidden;
}

.readout-fill {
    height: 100%;
    width: var(--fill, 0%);
    background: var(--brass);
    transition: width 1s ease;
}

.readout-fill.alarm-fill {
    background: var(--alarm-red);
}

.readout-fill.caution-fill {
    background: var(--caution-amber);
}

.readout-fill.overflow-fill {
    width: 110%;
}

.status-nominal {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--lead);
    letter-spacing: 0.05em;
    margin-top: 40px;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.status-nominal.visible {
    opacity: 1;
}

/* === SECTION 2: THE REACTOR === */
.reactor-section {
    min-height: 150vh;
    padding-top: 80px;
    padding-bottom: 80px;
}

.reactor-split {
    display: flex;
    padding: 0 40px;
    gap: 0;
}

.reactor-text {
    width: 62%;
    padding-right: 40px;
    border-right: 3px solid var(--steel);
}

.reactor-diagram {
    width: 38%;
    padding-left: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.section-heading {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: 32px;
    color: var(--brass);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.section-subheading {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 20px;
    color: var(--brass);
    margin-bottom: 32px;
}

.reactor-text p {
    margin-bottom: 24px;
    color: var(--brass);
}

/* Reactor SVG */
.reactor-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.diagram-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    fill: var(--lead);
    letter-spacing: 0.05em;
}

.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.draw-path.drawn {
    stroke-dashoffset: 0;
}

/* === SECTION 3: INITIATING EVENT === */
.initiating-event {
    min-height: 150vh;
    padding-top: 80px;
    padding-bottom: 80px;
}

.narrow-column {
    max-width: 580px;
    margin: 0 auto;
    padding: 0 24px;
}

.narrow-column p {
    margin-bottom: 24px;
    color: var(--brass);
}

/* === ALARM PLACARDS === */
.alarm-placard {
    background: var(--panel);
    border-left: 2px solid var(--alarm-red);
    padding: 1rem 1.5rem;
    margin: 24px 0;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.alarm-placard.revealed {
    opacity: 1;
    transform: translateX(0);
}

.placard-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: var(--alarm-red);
    letter-spacing: 0.05em;
}

/* === SECTION 4: CASCADE === */
.cascade-section {
    min-height: 200vh;
    padding-top: 80px;
    padding-bottom: 80px;
    animation: micro-tremor 8s ease-in-out infinite;
}

@keyframes micro-tremor {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(0.5px); }
    75% { transform: translateX(-0.5px); }
}

.cascade-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.cascade-block {
    transform: translateX(var(--offset, 0));
    margin-bottom: 32px;
}

.cascade-block p {
    margin-bottom: 24px;
    color: var(--brass);
}

.cascade-placard {
    transform: translateX(calc(-40px + var(--offset, 0)));
}

.cascade-placard.revealed {
    transform: translateX(var(--offset, 0));
}

.cascade-readouts {
    transform: translateX(var(--offset, 0));
    margin: 32px 0;
}

.alarm-text {
    color: var(--alarm-red) !important;
}

.caution-text {
    color: var(--caution-amber) !important;
}

/* === SECTION 5: CONTAINMENT === */
.containment-section {
    min-height: 150vh;
    padding-top: 80px;
    padding-bottom: 80px;
}

.containment-narrow {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 24px;
}

.containment-narrow p {
    margin-bottom: 24px;
    color: var(--brass);
}

.inline-readout {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: var(--alarm-red);
    letter-spacing: 0.05em;
}

/* The Containment Breach Line */
.breach-line {
    border: none;
    height: 2px;
    background: var(--alarm-red);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-top: 48px;
    margin-bottom: 48px;
}

.containment-wide {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

.containment-wide p {
    margin-bottom: 24px;
    color: var(--brass);
}

/* === SECTION 6: AFTERMATH === */
.aftermath-section {
    min-height: 200vh;
    padding-top: 80px;
    padding-bottom: 40px;
}

.aftermath-content {
    display: flex;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

.timeline-container {
    position: relative;
    width: 80px;
    flex-shrink: 0;
}

.timeline-svg {
    width: 40px;
    height: 800px;
}

.timeline-line {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s ease;
}

.timeline-line.drawn {
    stroke-dashoffset: 0;
}

.timeline-labels {
    position: absolute;
    top: 0;
    left: 44px;
    width: 100px;
}

.timeline-label {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--lead);
    letter-spacing: 0.05em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.timeline-label.visible {
    opacity: 1;
}

.aftermath-text {
    flex: 1;
    padding-left: 40px;
    margin: 0 30%;
    margin-left: 40px;
}

.aftermath-paragraph {
    color: var(--ash);
    margin-bottom: 4rem;
}

/* === FOOTER === */
.site-footer {
    text-align: center;
    padding: 60px 0;
}

.site-footer span {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--steel);
    letter-spacing: 0.05em;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .instrument-rack {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--steel);
    }

    .section {
        padding-left: 0;
        padding-top: 48px;
    }

    .title-jp {
        font-size: 64px;
    }

    .reactor-split {
        flex-direction: column-reverse;
    }

    .reactor-text,
    .reactor-diagram {
        width: 100%;
        padding: 24px;
        border-right: none;
    }

    .reactor-text {
        border-top: 3px solid var(--steel);
    }

    .cascade-block {
        transform: translateX(calc(var(--offset, 0) * 0.3));
    }

    .containment-narrow {
        max-width: 90vw;
    }

    .aftermath-text {
        margin: 0;
        padding-left: 20px;
    }
}
