/* live.css — dark cinematic theme for the Living Machine front page.
 * Deliberately self-contained: does NOT import the light style.css. */

* { box-sizing: border-box; }
html, body {
    margin: 0; height: 100%; overflow: hidden;
    background: #0b0e1a; color: #aab6e8;
    font-family: "Inter", system-ui, sans-serif;
}
a { color: #8fa6e8; text-decoration: none; }
a:hover { color: #c3d1ff; }

#machine { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* --- top chrome --- */
.live-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 5;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 14px 22px; pointer-events: none;
}
.live-top a, .live-top #auth-chip { pointer-events: auto; }
.brand-lockup { display: inline-flex; align-items: center; gap: 8px; justify-self: start; }
.brand-mark { width: 26px; height: 26px; display: inline-block; }
.brand-wordmark { font-weight: 600; font-size: 17px; color: #e8ecff; }
.live-tagline { text-align: center; }
.live-tagline h1 { margin: 0; font-size: 16px; font-weight: 500; color: #cdd6f7; }
.live-tagline p { margin: 2px 0 0; font-size: 11px; color: #56639c; }
.live-nav { justify-self: end; display: flex; align-items: center; gap: 14px; font-size: 13px; }
#auth-chip img { width: 26px; height: 26px; border-radius: 50%; vertical-align: middle; }

/* --- narrative line --- */
.narrative {
    position: fixed; top: 64px; left: 0; right: 0; z-index: 4;
    text-align: center; font-size: 12px; color: #6f7eb8; margin: 0;
    pointer-events: none; min-height: 16px; padding: 0 24px;
}

/* --- bottom bar --- */
.bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px; pointer-events: none;
}
.presets { display: flex; gap: 8px; margin: 0 auto; pointer-events: auto; }
.preset-chip {
    background: #141d36; border: 1px solid #2e3b66; color: #aab6e8;
    border-radius: 14px; padding: 5px 14px; font-size: 12px;
    font-family: inherit; cursor: pointer;
}
.preset-chip:hover { border-color: #5a78d0; color: #dfe6ff; }
/* permanent CTAs, bottom-right (no longer tied to the readout card) */
.corner-links { position: absolute; right: 22px; display: flex; gap: 10px; pointer-events: auto; }
.corner-links a {
    font-size: 12px; padding: 7px 15px; border-radius: 8px;
    border: 1px solid #2e3b66; color: #aab6e8; background: #141d36cc;
}
.corner-links a:hover { border-color: #5a78d0; color: #dfe6ff; }
.corner-links a.cta-primary { background: #2952cc; border-color: #2952cc; color: #fff; }
.corner-links a.cta-primary:hover { background: #3a63dd; border-color: #3a63dd; color: #fff; }

/* --- tooltip --- */
.tooltip {
    position: fixed; z-index: 8; max-width: 260px; pointer-events: none;
    background: #10182e; border: 1px solid #2e3b66; border-radius: 8px;
    padding: 8px 12px; font-size: 12px; line-height: 1.45; color: #cdd6f7;
}
.tooltip .tt-delta-up { color: #f0a8a8; }
.tooltip .tt-delta-down { color: #9fe2a0; }

/* --- first-visit hint --- */
.hint {
    position: fixed; z-index: 4; pointer-events: none;
    font-size: 12px; color: #8fa6e8;
    animation: hint-bob 2.4s ease-in-out infinite;
}
@keyframes hint-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* --- readout card (the "what moved" legend, top-right) --- */
.readout {
    position: fixed; top: 62px; right: 18px; z-index: 7;
    width: 290px; max-height: 64vh; overflow-y: auto;
    background: #10182ef5; border: 1px solid #243152; border-radius: 12px;
    padding: 14px 16px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
    opacity: 0; transform: translateY(-8px) scale(0.98); pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.readout.open { opacity: 1; transform: none; pointer-events: auto; }
.readout-label {
    margin: 0 0 6px; font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
    color: #56639c;
}
#rail-close {
    position: absolute; top: 8px; right: 11px;
    background: none; border: none; color: #56639c; font-size: 17px; line-height: 1; cursor: pointer;
}
#rail-close:hover { color: #aab6e8; }
#rail-headline { font-size: 13px; font-weight: 600; color: #e8ecff; margin: 0 18px 10px 0; line-height: 1.35; }
#rail-rows { list-style: none; margin: 0; padding: 0; }
#rail-rows li { padding: 7px 0; border-bottom: 1px solid #1a2440; }
#rail-rows li:last-child { border-bottom: none; }
#rail-rows .row-main { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #cdd6f7; }
#rail-rows .row-delta-up { color: #f0a8a8; }
#rail-rows .row-delta-down { color: #9fe2a0; }
#rail-rows .row-caption { font-size: 10.5px; color: #56639c; margin-top: 3px; line-height: 1.4; }

/* --- asset popup (click a node) --- */
.asset-popup {
    position: fixed; z-index: 8; width: 262px;
    background: #10182ef7; border: 1px solid #243152; border-radius: 12px;
    padding: 13px 15px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
    opacity: 0; transform: scale(0.98); pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.asset-popup.open { opacity: 1; transform: none; pointer-events: auto; }
.asset-popup[hidden] { display: none; }   /* author rules can defeat [hidden]; pin it */
#asset-popup-close {
    position: absolute; top: 7px; right: 11px;
    background: none; border: none; color: #56639c; font-size: 17px; line-height: 1; cursor: pointer;
}
#asset-popup-close:hover { color: #aab6e8; }
.ap-head { display: flex; align-items: baseline; gap: 8px; margin: 0 18px 2px 0; }
.ap-label { font-size: 14px; font-weight: 600; color: #e8ecff; }
.ap-domain { font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; color: #56639c; }
.ap-value-row { display: flex; align-items: baseline; gap: 8px; }
.ap-value { font-size: 16px; color: #cdd6f7; }
.ap-delta { font-size: 12px; }
.ap-delta.up { color: #f0a8a8; }
.ap-delta.down { color: #9fe2a0; }
.ap-chart { width: 100%; height: 60px; display: block; margin: 9px 0 4px; }
.ap-eq {
    margin: 6px 0 12px; padding: 8px 10px; border-radius: 7px; background: #0b1124;
    color: #aab6e8; font-size: 13px; overflow-x: auto; overflow-y: hidden;
}
.ap-eq .katex { color: #cdd6f7; }
.ap-eq.raw { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; white-space: pre-wrap; }
.ap-details {
    display: block; text-align: center; font-size: 12.5px;
    background: #2952cc; color: #fff; border-radius: 7px; padding: 8px 12px;
}
.ap-details:hover { background: #3a63dd; color: #fff; }

/* --- fallback (stale/unfetchable snapshot) --- */
.fallback {
    position: fixed; inset: 0; z-index: 9;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; background: #0b0e1a; font-size: 15px;
}
.fallback[hidden] { display: none; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .hint { animation: none; }
    .readout { transition: none; }
}

/* --- mobile --- */
@media (max-width: 700px) {
    .live-tagline h1 { font-size: 13px; }
    .live-tagline p { display: none; }
    .bottom-bar { flex-direction: column; gap: 10px; }
    .corner-links { position: static; }
    .preset-chip { padding: 9px 16px; font-size: 13px; }
    .readout {
        top: 56px; left: 8px; right: 8px; width: auto; max-height: 46vh;
    }
}
