/* OOI Causal Ledger Dashboard — the OX shell
   Earthen Clarity (light) / the instrument dark (Void · Umbra · Penumbra)
   Retokened under docs/site-redesign-plan.md Phase 2 (the one visual system):
   the same palette as /shared/ooi-tokens.css, the faces self-hosted at
   /shared/fonts/, and THE COLOUR LAW — #CC5500 is a fill; orange TEXT is
   #A34400 on light / #F0873A on dark (--accent-color is the text-safe tone).
   ─────────────────────────────────────────────── */

@font-face {
    font-family: "Mona Sans";
    src: url("/shared/fonts/MonaSansVF.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Mona Sans";
    src: url("/shared/fonts/MonaSansVF-Italic.woff2") format("woff2");
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("/shared/fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("/shared/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("/shared/fonts/JetBrainsMono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ── CSS Custom Properties ──────────────────────────────────────── */

#app-root {
    /* Light Theme: Earthen Clarity (default) */
    --bg-primary:     #FAF8F5;
    --bg-secondary:   #F2EFEA;
    --bg-tertiary:    #EAE0D5;
    --text-primary:   #3E2723;
    --text-secondary: #5E503F;
    --text-muted:     #8D6E63;
    --border-color:   #D5C9BC;
    --border-light:   #C4B5A6;
    --accent-color:   #A34400;   /* Solar Flare — orange TEXT (AA)     */
    --accent-fill:    #CC5500;   /* Solar Orange — fills/graphics ONLY */
    --accent-hover:   #8A3800;   /* Ember                              */
    --on-accent:      #FFF8F2;
    --glow:           #DAA520;
    --header-bg:      #F2EFEA;
    --header-border:  rgba(94, 80, 63, 0.20);
    --font-sans: "Mona Sans", "Segoe UI", -apple-system, "Helvetica Neue",
                 Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas,
                 "Courier New", monospace;

    background-color: var(--bg-primary);
    min-height:       100vh;
    font-family:      var(--font-sans);
    transition:       background-color 0.3s ease;
}

#app-root[data-theme="dark"] {
    /* Dark Theme: the instrument ground (Void · Umbra · Penumbra) */
    --bg-primary:     #17100D;
    --bg-secondary:   #241713;
    --bg-tertiary:    #2E1E18;
    --text-primary:   #F5EDE6;
    --text-secondary: #C3AFA3;
    --text-muted:     #9A8478;
    --border-color:   #3A2822;
    --border-light:   #2E1E18;
    --accent-color:   #F0873A;   /* Solar Orange 400 — orange TEXT     */
    --accent-hover:   #FFA35C;   /* Solar Orange 300                   */
    --on-accent:      #1A0E06;
    --header-bg:      #1D1310;
    --header-border:  rgba(240, 135, 58, 0.22);

    background-color: var(--bg-primary);
}

/* ── Header ─────────────────────────────────────────────────────── */

.dash-header {
    padding:          10px 20px;
    border-bottom:    1px solid var(--header-border);
    display:          flex;
    justify-content:  space-between;
    align-items:      center;
    background-color: var(--header-bg);
    transition:       background-color 0.3s ease, border-color 0.3s ease;
}

.dash-brand { display: flex; align-items: center; gap: 10px; }
.dash-mark  { width: 26px; height: 26px; display: block; }

.dash-title-primary {
    color:          var(--text-primary);
    font-family:    var(--font-sans);
    font-size:      16px;
    letter-spacing: 0.01em;
    font-weight:    700;
    transition:     color 0.3s ease;
}

.dash-title-secondary {
    color:          var(--text-muted);
    font-family:    var(--font-mono);
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition:     color 0.3s ease;
}

.dash-header-right {
    display:     flex;
    align-items: center;
    gap:         12px;
}

/* ── Status Bar ─────────────────────────────────────────────────── */

.dash-status-bar {
    color:          var(--text-muted);
    font-family:    var(--font-mono);
    font-size:      10px;
    letter-spacing: 0.06em;
    transition:     color 0.3s ease;
}

/* ── Theme Toggle Button ────────────────────────────────────────── */

.theme-toggle-btn {
    background:       var(--bg-tertiary);
    border:           1px solid var(--border-color);
    border-radius:    50%;
    width:            32px;
    height:           32px;
    cursor:           pointer;
    display:          inline-flex;
    align-items:      center;
    justify-content:  center;
    font-size:        15px;
    line-height:      1;
    padding:          0;
    outline:          none;
    flex-shrink:      0;
    color:            var(--text-primary);
    transition:       background-color 0.2s ease, border-color 0.2s ease,
                      transform 0.2s ease;
}

.theme-toggle-btn:hover {
    background:  var(--border-color);
    transform:   scale(1.12);
}

/* ── THE INGRESS SHELL (Phase 2 — the Site Shell treatment) ─────── */

.shell-hero {
    margin:  14px 16px 0;
    padding: 34px 30px 30px;
    border:  1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    background-image: radial-gradient(ellipse 85% 140% at 80% -30%,
        rgba(204, 85, 0, 0.26), rgba(204, 85, 0, 0.06) 55%, transparent 75%);
}
.shell-eyebrow {
    font-family:    var(--font-mono);
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color:          var(--glow, #DAA520);
    margin-bottom:  12px;
}
#app-root[data-theme="dark"] .shell-eyebrow { color: #DAA520; }
.shell-h1 {
    font-family:    var(--font-sans);
    font-size:      40px;
    line-height:    1.08;
    font-weight:    700;
    letter-spacing: -0.015em;
    color:          var(--text-primary);
    margin:         0;
    max-width:      680px;
}
.shell-h1 .shell-glow { color: var(--accent-color); }
.shell-tag {
    color:      var(--text-secondary);
    font-size:  16px;
    line-height: 1.6;
    max-width:  640px;
    margin:     14px 0 0;
}
.shell-cta { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.shell-btn {
    display:        inline-block;
    font-family:    var(--font-sans);
    font-size:      14px;
    font-weight:    600;
    color:          var(--on-accent);
    background:     var(--accent-fill);
    padding:        9px 16px;
    border-radius:  6px;
    text-decoration: none;
}
.shell-btn:hover { background: #A34400; }
.shell-btn.ghost {
    background: transparent;
    color:      var(--text-primary);
    border:     1px solid var(--border-color);
}
.shell-btn.ghost:hover { border-color: var(--accent-color); color: var(--accent-color); }

/* the stat band — laws and counts; numerals are measurements (mono) */
.shell-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 16px 0;
}
.shell-stat { background: var(--bg-secondary); padding: 12px 14px; }
.shell-stat .k {
    font-family: var(--font-mono); font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 4px;
}
.shell-stat .v {
    font-family: var(--font-mono); font-size: 19px; font-weight: 700;
    color: var(--text-primary);
}
.shell-stat .v.hot { color: var(--accent-color); }

/* the doors — the series of ten, the campaigns, the kin */
.shell-doors { margin: 16px 16px 0; }
.shell-doors h2 {
    font-family: var(--font-sans); font-size: 21px; font-weight: 700;
    color: var(--text-primary); margin: 18px 0 3px;
}
.shell-doors .sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 10px; }
.door-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 10px;
}
.door {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 11px 13px;
    text-decoration: none;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.door:hover { border-color: var(--accent-color); }
.door .n {
    font-family: var(--font-mono); font-size: 10px; font-weight: 600;
    letter-spacing: 0.12em; color: var(--text-muted);
}
.door .t {
    font-family: var(--font-sans); font-size: 14.5px; font-weight: 600;
    color: var(--text-primary); margin: 2px 0;
}
.door .d { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

/* the pillars strip */
.shell-pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 18px 16px 6px;
}
.pillar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 13px 15px;
}
.pillar .k {
    font-family: var(--font-mono); font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent-color); margin-bottom: 4px;
}
.pillar .t { font-weight: 600; font-size: 14.5px; color: var(--text-primary); }
.pillar .d { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }

/* ── Perimeter panels — ingress + Observatory (CR LDD-Alpha8-001) ─────────── */
/* Styling lives here (not inline) so media queries can reflow the layout. */
#charts { display: flex; flex-direction: column; gap: 4px; padding: 6px; }

.perimeter-panel {
    background:    var(--bg-secondary);
    border:        1px solid var(--border-color);
    border-radius: 8px;
    padding:       12px;
    box-shadow:    0 6px 24px rgba(0, 0, 0, 0.28);
    font-family:   var(--font-mono);
    z-index:       1000;
}
#ingress-panel { text-align: center; }
.panel-title {
    font-size:      10px;
    font-weight:    600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color:          var(--text-secondary);
    margin-bottom:  8px;
    text-align:     center;
}
.ingress-qr-img {
    width: 178px; height: 178px; max-width: 100%;
    border-radius: 6px; image-rendering: pixelated;
}
.ingress-caption {
    font-size: 9.5px; margin-top: 8px; white-space: pre-line; color: var(--text-muted);
}

/* Observatory tappable launcher cards (CR LDD-Alpha8-002) */
.observatory-card {
    display:        block;
    text-decoration: none;
    cursor:         pointer;
    border-top:     1px solid var(--border-light);
    padding:        8px 4px;
    border-radius:  4px;
    transition:     background-color 0.12s ease;
}
.observatory-card:hover,
.observatory-card:active { background: rgba(204, 85, 0, 0.12); }
.observatory-enter {
    font-size: 9px; color: var(--accent-color); white-space: nowrap;
}

/* ── Desktop (≥769px): panels as the fixed right-rail overlay (legacy) ────── */
@media (min-width: 769px) {
    #ingress-panel {
        position: fixed; top: 70px; right: 18px; width: 204px;
    }
    #observatory-panel {
        position: fixed; top: 372px; right: 18px; width: 204px;
        max-height: 40vh; overflow-y: auto;
    }
}

/* ── Mobile (≤768px): Observatory-first launcher; telemetry compact below ─── */
@media (max-width: 768px) {
    #surface { display: flex; flex-direction: column; }
    #observatory-panel { order: -2; }   /* tappable experiment launcher leads */
    #ingress-panel     { order: -1; }   /* then the holographic QR */
    #charts            { order: 1; }     /* telemetry charts last */
    .perimeter-panel {
        position: static; width: auto; margin: 8px 8px 0; max-height: none;
    }
    #network-graph { height: 46vh !important; }
    #metrics-graph { height: 24vh !important; }
    .dash-header { padding: 8px 12px; }
    .dash-title-secondary { display: none; }   /* drop the long subtitle on phones */
    .dash-status-bar {
        font-size: 8px; max-width: 46vw;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .shell-hero { padding: 24px 18px; margin: 10px 8px 0; }
    .shell-h1 { font-size: 29px; }
    .shell-stats, .shell-doors, .shell-pillars { margin-left: 8px; margin-right: 8px; }
}
