/* ============================================================
   genpatsu.quest — Decommissioned Reactor Instructional Console
   Palette (DESIGN.md): #0e0f12 #161821 #2b2f3a #e8b659 #c97a2b
                        #7d8a96 #a02732 #f0e6d0 #f4ecd6 #3a2a14
   ============================================================ */

:root {
    --bg-deep: #0e0f12;
    --bg-panel: #161821;
    --bevel: #2b2f3a;
    --amber: #e8b659;
    --amber-dim: #c97a2b;
    --cathode: #7d8a96;
    --scram-red: #a02732;
    --paper: #f0e6d0;
    --paper-warm: #f4ecd6;
    --umber: #3a2a14;
    --gutter-l: 84px;
    --gutter-r: 280px;
    --chart-h: 56px;
}

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

html, body {
    background: var(--bg-deep);
    color: var(--paper);
    font-family: 'Cormorant Garamond', Georgia, serif;
    overflow-x: hidden;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><line x1='8' y1='1' x2='8' y2='6' stroke='%23e8b659' stroke-width='0.8'/><line x1='8' y1='10' x2='8' y2='15' stroke='%23e8b659' stroke-width='0.8'/><line x1='1' y1='8' x2='6' y2='8' stroke='%23e8b659' stroke-width='0.8'/><line x1='10' y1='8' x2='15' y2='8' stroke='%23e8b659' stroke-width='0.8'/><circle cx='8' cy='8' r='1' fill='none' stroke='%23e8b659' stroke-width='0.6'/></svg>") 8 8, crosshair;
}

body {
    min-height: 100vh;
    padding-bottom: var(--chart-h);
    position: relative;
    /* tungsten-warmed black with very subtle scanline */
    background:
        repeating-linear-gradient(0deg, rgba(232, 182, 89, 0.012) 0, rgba(232, 182, 89, 0.012) 1px, transparent 1px, transparent 3px),
        radial-gradient(ellipse at 50% 30%, #14161e 0%, var(--bg-deep) 70%);
}

/* ----- Phosphor afterglow canvas ----- */
#phosphor-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.22;
    z-index: 50;
}

/* ============================================================
   LEFT GUTTER — neutron energy ladder
   ============================================================ */
.energy-ladder {
    position: fixed;
    left: 0; top: 0;
    bottom: var(--chart-h);
    width: var(--gutter-l);
    z-index: 8;
    padding: 92px 8px 12px 14px;
    pointer-events: none;
    border-right: 1px solid var(--bevel);
    background: linear-gradient(90deg, rgba(20,22,30,0.4), transparent);
}

.ladder-axis {
    position: relative;
    height: calc(100% - 56px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 1px solid var(--bevel);
    padding-left: 6px;
}

.ladder-tick {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: var(--cathode);
    letter-spacing: 0.04em;
    position: relative;
}

.ladder-tick::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--cathode);
}

.ladder-tick.top { color: var(--amber-dim); }
.ladder-tick.bottom { color: var(--amber); }

.ladder-label {
    position: absolute;
    bottom: 14px;
    left: 14px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8.5px;
    letter-spacing: 0.18em;
    color: var(--cathode);
}

/* ============================================================
   ISOMETRIC SUBSTRATE
   ============================================================ */
.substrate {
    position: absolute;
    top: 0;
    left: var(--gutter-l);
    right: var(--gutter-r);
    height: 6400px; /* matches scroll length */
    pointer-events: none;
    z-index: 1;
}

#cutaway-svg {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0.85;
}

.iso-zone .iso-label {
    fill: var(--cathode);
    font-family: 'Saira Stencil One', cursive;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.iso-zone .iso-label.small {
    font-size: 9px;
    fill: var(--amber-dim);
}

#reticle {
    transition: transform 220ms cubic-bezier(0.18, 0.9, 0.42, 1.0);
    pointer-events: none;
}

#reticle circle, #reticle line {
    animation: reticle-pulse 4.2s cubic-bezier(0.18, 0.9, 0.42, 1.0) infinite;
}

@keyframes reticle-pulse {
    0%   { opacity: 0.25; }
    14%  { opacity: 0.95; }
    100% { opacity: 0.25; }
}

/* ============================================================
   HUD LAYER — parallax 0.92x
   ============================================================ */
.hud-layer {
    position: relative;
    z-index: 5;
    will-change: transform;
}

/* Coolant pump breath: ±0.4px translateY at 0.07 Hz */
@keyframes coolant-breath {
    0%   { transform: translateY(-0.4px); }
    50%  { transform: translateY(0.4px); }
    100% { transform: translateY(-0.4px); }
}

.hud-layer .placard,
.hud-layer .annunciator-panel,
.hud-layer .shift-column {
    animation: coolant-breath 14.28s ease-in-out infinite;
}

/* ============================================================
   PLACARD / MASTHEAD
   ============================================================ */
.placard {
    position: relative;
    margin: 26px var(--gutter-r) 24px calc(var(--gutter-l) + 24px);
    padding: 18px 28px 16px;
    border: 1px solid var(--bevel);
    background: linear-gradient(180deg, var(--bg-panel), #0f1118);
    box-shadow:
        inset 1px 1px 0 var(--bevel),
        inset -1px -1px 0 #06070a,
        0 1px 0 rgba(232, 182, 89, 0.04);
    z-index: 6;
}

.placard::before, .placard::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--cathode);
    background: var(--bg-deep);
}
.placard::before { top: 6px; left: 6px; }
.placard::after  { top: 6px; right: 6px; }

.placard-line {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.kanji-mark {
    font-family: 'Shippori Mincho', 'Yu Mincho', serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4vw, 3rem);
    color: var(--amber);
    letter-spacing: 0.08em;
    line-height: 1;
    text-shadow: 0 0 12px rgba(232, 182, 89, 0.18);
}

.placard-sep {
    font-family: 'Shippori Mincho', serif;
    color: var(--cathode);
    font-size: 1.4rem;
    margin: 0 4px;
}

.placard-text {
    font-family: 'Saira Stencil One', cursive;
    font-size: clamp(1.05rem, 1.6vw, 1.4rem);
    letter-spacing: 0.16em;
    color: var(--paper);
    text-transform: uppercase;
}

.placard-sub {
    margin-top: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.74rem;
    color: var(--cathode);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.placard-dot { color: var(--amber-dim); }

.placard-time {
    color: var(--amber);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   ANNUNCIATOR PANEL (right gutter)
   ============================================================ */
.annunciator-panel {
    position: fixed;
    right: 16px;
    top: 26px;
    bottom: calc(var(--chart-h) + 16px);
    width: calc(var(--gutter-r) - 32px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--bevel) transparent;
}

.annunciator-panel::-webkit-scrollbar { width: 4px; }
.annunciator-panel::-webkit-scrollbar-track { background: transparent; }
.annunciator-panel::-webkit-scrollbar-thumb { background: var(--bevel); }

.annunciator-tile {
    flex: 0 0 auto;
}

.tile-bevel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 56px;
    padding: 6px 12px;
    background: linear-gradient(180deg, #1c1f2a, var(--bg-panel));
    border: 1px solid #0a0b10;
    box-shadow:
        inset 1px 1px 0 var(--bevel),
        inset -1px -1px 0 #06070a;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><line x1='8' y1='1' x2='8' y2='6' stroke='%23e8b659' stroke-width='0.8'/><line x1='8' y1='10' x2='8' y2='15' stroke='%23e8b659' stroke-width='0.8'/><line x1='1' y1='8' x2='6' y2='8' stroke='%23e8b659' stroke-width='0.8'/><line x1='10' y1='8' x2='15' y2='8' stroke='%23e8b659' stroke-width='0.8'/><circle cx='8' cy='8' r='1' fill='none' stroke='%23e8b659' stroke-width='0.6'/></svg>") 8 8, crosshair;
    transition:
        box-shadow 240ms cubic-bezier(0.18, 0.9, 0.42, 1.0),
        background 240ms cubic-bezier(0.18, 0.9, 0.42, 1.0);
}

.annunciator-tile.open .tile-bevel {
    background: linear-gradient(180deg, #0d0f15, #14161e);
    /* Inverted bevel — pressed-in switch */
    box-shadow:
        inset -1px -1px 0 var(--bevel),
        inset 1px 1px 0 #06070a;
}

.annunciator-tile:hover .tile-bevel {
    /* hairline 0.5px amber inset rectangle */
    box-shadow:
        inset 1px 1px 0 var(--bevel),
        inset -1px -1px 0 #06070a,
        inset 0 0 0 0.5px var(--amber);
}

.annunciator-tile.open:hover .tile-bevel {
    box-shadow:
        inset -1px -1px 0 var(--bevel),
        inset 1px 1px 0 #06070a,
        inset 0 0 0 0.5px var(--amber);
}

.tile-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tile-lamp {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #1a1c24, #0a0b10);
    box-shadow: inset 0 0 2px rgba(255,255,255,0.04);
    flex-shrink: 0;
}

.tile-lamp.armed {
    background: radial-gradient(circle at 30% 30%, var(--amber-dim), #5a3611 70%, #2a1a08);
    box-shadow:
        0 0 6px rgba(201, 122, 43, 0.55),
        inset 0 0 2px rgba(255, 220, 160, 0.6);
    animation: lamp-pulse 4.2s cubic-bezier(0.18, 0.9, 0.42, 1.0) infinite;
}

@keyframes lamp-pulse {
    0%   { box-shadow: 0 0 4px rgba(201, 122, 43, 0.35), inset 0 0 2px rgba(255, 220, 160, 0.4); }
    14%  { box-shadow: 0 0 12px rgba(232, 182, 89, 0.85), inset 0 0 3px rgba(255, 230, 180, 0.8); }
    100% { box-shadow: 0 0 4px rgba(201, 122, 43, 0.35), inset 0 0 2px rgba(255, 220, 160, 0.4); }
}

.tile-label {
    font-family: 'Saira Stencil One', cursive;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--cathode);
    text-transform: uppercase;
    flex: 1;
}

.tile-readout {
    font-family: 'Major Mono Display', 'Courier New', monospace;
    font-size: 1rem;
    color: var(--amber);
    letter-spacing: 0.04em;
    text-shadow: 0 0 4px rgba(232, 182, 89, 0.45);
    text-align: right;
    margin-top: 2px;
}

.tile-readout.dim {
    color: var(--cathode);
    text-shadow: none;
}

.tile-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 320ms cubic-bezier(0.18, 0.9, 0.42, 1.0);
    background:
        repeating-linear-gradient(0deg, rgba(240,230,208,0.04) 0, rgba(240,230,208,0.04) 1px, transparent 1px, transparent 8px),
        var(--bg-panel);
    border-left: 1px solid var(--bevel);
    border-right: 1px solid var(--bevel);
}

.annunciator-tile.open .tile-expand {
    max-height: 280px;
    border-bottom: 1px solid var(--bevel);
}

.tile-expand p {
    padding: 10px 12px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--paper);
    color: rgba(240, 230, 208, 0.85);
}

/* ----- Scram dome housing ----- */
.scram-housing {
    margin-top: 14px;
    padding: 14px 12px 18px;
    background: linear-gradient(180deg, #1a1d26, #0c0d12);
    border: 1px solid var(--bevel);
    box-shadow:
        inset 1px 1px 0 var(--bevel),
        inset -1px -1px 0 #06070a;
    text-align: center;
    flex-shrink: 0;
}

.scram-stencil {
    font-family: 'Saira Stencil One', cursive;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--scram-red);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.scram-dome {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 105%, #4a0a14 0%, #2a0608 60%, #0e0204 100%);
    box-shadow:
        0 8px 14px rgba(0, 0, 0, 0.7),
        inset 0 -3px 6px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(160, 39, 50, 0.3);
}

.dome-core {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 35% 30%, #d6394a 0%, #a02732 35%, #6a1822 70%, #3a0a12 100%);
    box-shadow:
        inset 0 -8px 12px rgba(58, 10, 18, 0.7),
        inset 0 4px 8px rgba(214, 57, 74, 0.3);
}

.dome-specular {
    position: absolute;
    top: 8px;
    left: 14px;
    width: 60px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 30%, rgba(255, 220, 200, 0.7), rgba(255, 220, 200, 0) 60%);
    pointer-events: none;
    transform: translateX(0);
    transition: transform 12s linear;
}

.scram-warning {
    margin-top: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    color: var(--scram-red);
    opacity: 0.8;
}

/* ============================================================
   SHIFT COLUMN — main narrative
   ============================================================ */
.shift-column {
    position: relative;
    margin: 0 var(--gutter-r) 0 calc(var(--gutter-l) + 24px);
    padding: 0 24px 80px;
    z-index: 6;
}

.shift-station {
    position: relative;
    padding: 78px 0 52px;
    min-height: 580px;
    border-bottom: 1px dashed rgba(125, 138, 150, 0.12);
}

.shift-station:last-child { border-bottom: none; }

.station-marker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--cathode);
    letter-spacing: 0.1em;
}

.station-num {
    color: var(--amber);
    font-weight: 500;
    text-shadow: 0 0 4px rgba(232, 182, 89, 0.3);
}

.station-divider {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--bevel), transparent 80%);
    max-width: 220px;
}

.station-time {
    color: var(--amber-dim);
    font-variant-numeric: tabular-nums;
}

.station-heading {
    font-family: 'Saira Stencil One', cursive;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper);
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bevel);
    position: relative;
}

.station-heading::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 32px;
    height: 1px;
    background: var(--amber);
}

.station-narration {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.0rem, 1.18vw, 1.18rem);
    line-height: 1.55;
    color: rgba(240, 230, 208, 0.88);
    max-width: 62ch;
    margin-bottom: 18px;
}

.station-narration em {
    font-style: italic;
    font-weight: 400;
}

.station-narration .kanji-emergency {
    color: var(--scram-red);
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(160, 39, 50, 0.4);
    padding: 0 1px;
}

.final-station {
    padding-bottom: 140px;
}

.final-handover {
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid var(--bevel);
    color: var(--amber);
    font-family: 'Shippori Mincho', 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.05rem;
}

/* ----- Inline meter ----- */
.meter-block {
    margin: 32px 0 8px;
    padding: 16px;
    background: linear-gradient(180deg, var(--bg-panel), #0f1118);
    border: 1px solid var(--bevel);
    box-shadow:
        inset 1px 1px 0 var(--bevel),
        inset -1px -1px 0 #06070a;
    display: inline-block;
}

.meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 130px;
}

.meter-bezel {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    /* knurled rim — radial conic combo */
    background:
        repeating-conic-gradient(from 0deg,
            #2b2f3a 0deg, #2b2f3a 4deg,
            #1a1c24 4deg, #1a1c24 8deg),
        radial-gradient(circle, #1a1c24, #0a0b10);
    padding: 6px;
    box-shadow:
        inset 0 0 0 1px var(--bevel),
        inset 0 0 6px rgba(0, 0, 0, 0.7),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.meter-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 30%, #f0e6d0, #e8dfc8 60%, #d8cdb0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    overflow: hidden;
}

.meter-face svg {
    width: 100%;
    height: 100%;
}

.meter-tick {
    stroke: #3a2a14;
    stroke-width: 0.8;
}

.meter-needle {
    stroke: var(--scram-red);
    stroke-width: 1;
    stroke-linecap: round;
    transform-origin: 0 0;
    transform: rotate(-90deg);
    transition: none;
}

.meter-label {
    font-family: 'Saira Stencil One', cursive;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    color: var(--cathode);
    text-transform: uppercase;
    text-align: center;
}

.meter-cal {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    color: var(--amber-dim);
    opacity: 0.7;
}

/* ----- Printout (paper texture, jittered) ----- */
.printout {
    margin: 26px 0 6px;
    padding: 14px 16px;
    background:
        repeating-linear-gradient(0deg,
            rgba(58, 42, 20, 0.04) 0, rgba(58, 42, 20, 0.04) 1px,
            transparent 1px, transparent 8px),
        var(--paper-warm);
    color: #2a1c10;
    border: 1px solid #c4b89a;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    max-width: 480px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    letter-spacing: 0.02em;
    transform: rotate(var(--jitter, 0.3deg));
    --jitter: 0.4deg;
    position: relative;
}

.printout::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 12px;
    right: 12px;
    height: 3px;
    background:
        repeating-linear-gradient(90deg,
            var(--paper-warm) 0, var(--paper-warm) 4px,
            #c4b89a 4px, #c4b89a 5px);
}

.printout-header {
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--scram-red);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(58, 42, 20, 0.3);
    text-transform: uppercase;
}

/* alternate jitter angles per element */
section[data-station="02"] .printout { --jitter: -0.3deg; }
section[data-station="04"] .printout { --jitter: 0.5deg; }
section[data-station="07"] .printout { --jitter: -0.4deg; }

/* ============================================================
   STRIP-CHART RECORDER RIBBON
   ============================================================ */
.strip-chart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--chart-h);
    background: var(--paper-warm);
    border-top: 1px solid var(--bevel);
    box-shadow:
        0 -2px 8px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 40;
    overflow: hidden;
}

#chart-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-frame-label {
    position: absolute;
    top: 4px;
    left: 12px;
    font-family: 'Saira Stencil One', cursive;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: rgba(58, 42, 20, 0.6);
    text-transform: uppercase;
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
    :root { --gutter-l: 56px; --gutter-r: 220px; }
    .placard, .shift-column { margin-right: 16px; margin-left: 70px; }
    .annunciator-panel { width: calc(var(--gutter-r) - 16px); right: 8px; }
    .ladder-tick { font-size: 8px; }
}

@media (max-width: 760px) {
    :root { --gutter-l: 36px; --gutter-r: 0px; }
    .annunciator-panel {
        position: static;
        width: auto;
        margin: 24px 16px;
        padding: 0;
        height: auto;
        max-height: none;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    .annunciator-tile { flex: 1 1 calc(50% - 6px); }
    .scram-housing { flex: 1 1 100%; }
    .substrate { right: 0; opacity: 0.4; }
    .shift-column { margin-right: 16px; margin-left: 50px; }
    .energy-ladder { display: none; }
}
