/* TRIAGE: Flight Edition. Shares the site design system in styles.css. */

:root {
    --surface: #001A33;
    --surface-2: #003A6B;
    --mark-nominal: #3E8FD9;
    --mark-flagged: #B58900;
    --ink: #FFFFFF;
    --ink-muted: rgba(255, 255, 255, 0.72);
    --grid-line: rgba(255, 255, 255, 0.08);
    --ok: #4CAF50;
    --alarm-red: #E4614F;
    --alarm-amber: #E3B341;
}

.demo-page {
    background-color: var(--blue);
}

.demo-main {
    padding: 8rem 0 3rem;
}

.demo-container {
    max-width: 1140px;
}

.demo-header {
    margin-bottom: 2rem;
}

.case-kicker {
    color: var(--maize);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1rem;
}

.case-kicker a {
    color: inherit;
    text-decoration: none;
}

.case-kicker a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.demo-title {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--maize);
    margin-bottom: 0.75rem;
}

.demo-tagline {
    font-size: 1.15rem;
    line-height: 1.7;
    max-width: 780px;
    margin-bottom: 1.25rem;
}

.data-source {
    font-size: 0.9rem;
    color: var(--ink-muted);
    line-height: 1.6;
    margin: 1rem 0;
    max-width: 860px;
}

.data-source a {
    color: var(--maize);
}

.disclaimer {
    background-color: var(--surface);
    border: 1px solid rgba(255, 203, 5, 0.35);
    border-left: 4px solid var(--maize);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 860px;
}

/* ---------------- Flight deck ---------------- */

.deck-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin: 1.75rem 0 1rem;
}

.deck-controls label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.deck-controls select {
    background-color: var(--surface-2);
    color: var(--ink);
    border: 1px solid rgba(255, 203, 5, 0.35);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.45rem 0.6rem;
    max-width: 100%;
}

.deck-meta {
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.deck-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.deck-panel {
    position: relative;
    background-color: var(--surface);
    border: 1px solid rgba(255, 203, 5, 0.18);
    border-radius: 15px;
    padding: 0.9rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.deck-panel.alarm-red {
    border-color: var(--alarm-red);
    box-shadow: 0 0 0 1px var(--alarm-red), 0 0 24px rgba(228, 97, 79, 0.25);
}

.deck-panel.alarm-amber {
    border-color: var(--alarm-amber);
    box-shadow: 0 0 0 1px var(--alarm-amber), 0 0 24px rgba(227, 179, 65, 0.2);
}

.deck-badges {
    position: absolute;
    top: 1.4rem;
    left: 1.4rem;
    right: 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 2;
}

.recon-badge {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.alarm-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    color: #14060A;
}

.alarm-badge.alarm-red {
    background-color: var(--alarm-red);
}

.alarm-badge.alarm-amber {
    background-color: var(--alarm-amber);
    color: #241B00;
}

#deck-canvas {
    display: block;
    width: 100%;
    border-radius: 10px;
    cursor: grab;
    touch-action: pan-y;
}

#deck-canvas:active {
    cursor: grabbing;
}

.deck-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.66);
    text-align: center;
    margin: 0.4rem 0 0.5rem;
}

.playback-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.camera-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background-color: var(--maize);
    color: var(--blue);
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
    flex-shrink: 0;
}

.play-btn:hover {
    background-color: #FFD700;
}

.play-btn:active {
    transform: scale(0.94);
}

#scrubber {
    flex: 1;
    min-width: 120px;
    accent-color: #FFCB05;
}

.time-readout {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--ink-muted);
    min-width: 128px;
}

.speed-group {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    overflow: hidden;
}

.speed-btn {
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.speed-btn:hover {
    color: var(--ink);
}

.speed-btn.active {
    background-color: var(--maize);
    color: var(--blue);
}

/* ---------------- Strip charts ---------------- */

.charts-col {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.strip-chart {
    position: relative;
    background-color: var(--surface);
    border: 1px solid rgba(255, 203, 5, 0.18);
    border-radius: 12px;
    padding: 0.6rem 0.6rem 0.35rem;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

.strip-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.chart-title {
    fill: var(--ink-muted);
    font-family: Inter, sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.chart-tick {
    fill: rgba(255, 255, 255, 0.55);
    font-family: Inter, sans-serif;
    font-size: 8.5px;
}

.chart-env {
    stroke: var(--alarm-amber);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.chart-env-label {
    fill: var(--alarm-amber);
    font-family: Inter, sans-serif;
    font-size: 8px;
}

.playhead {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 1;
}

.chart-event {
    stroke: rgba(228, 97, 79, 0.55);
    stroke-width: 1;
    stroke-dasharray: 2 3;
}

.chart-now {
    position: absolute;
    top: 0.55rem;
    right: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    color: var(--ink);
}

/* ---------------- Cards, narrative, review ---------------- */

.card {
    background-color: var(--surface);
    border: 1px solid rgba(255, 203, 5, 0.18);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--maize);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.card p {
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.muted {
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.record-block {
    background-color: rgba(0, 0, 0, 0.25);
    border-left: 3px solid rgba(255, 203, 5, 0.5);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.record-block strong {
    color: var(--maize);
    font-weight: 600;
}

.flag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.flag-chip {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 50px;
    border: 1px solid rgba(227, 179, 65, 0.6);
    color: var(--alarm-amber);
    background-color: rgba(181, 137, 0, 0.12);
}

.flag-chip.neutral {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--ink-muted);
    background-color: rgba(255, 255, 255, 0.05);
}

.narrative-box {
    background-color: rgba(62, 143, 217, 0.08);
    border: 1px solid rgba(62, 143, 217, 0.4);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.narrative-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--ink-muted);
}

.badge.live {
    background-color: rgba(76, 175, 80, 0.18);
    color: #7BD97F;
}

.category-pill {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background-color: var(--maize);
    color: var(--blue);
}

.confidence {
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.narrative-text {
    line-height: 1.7;
    font-size: 0.95rem;
}

.disposition-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dispo-btn {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.1s ease, background-color 0.2s ease;
}

.dispo-btn:active {
    transform: scale(0.97);
}

.dispo-accept {
    background-color: var(--maize);
    color: var(--blue);
}

.dispo-edit {
    background-color: transparent;
    color: var(--ink);
    border-color: rgba(255, 255, 255, 0.4);
}

.dispo-reject {
    background-color: transparent;
    color: var(--alarm-amber);
    border-color: rgba(227, 179, 65, 0.55);
}

.ghost-btn {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    background: transparent;
    color: var(--ink-muted);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ghost-btn:hover {
    color: var(--ink);
    border-color: rgba(255, 255, 255, 0.5);
}

.edit-area {
    width: 100%;
    min-height: 110px;
    background-color: var(--surface-2);
    color: var(--ink);
    border: 1px solid rgba(255, 203, 5, 0.35);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.dispo-status {
    font-size: 0.88rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background-color: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.4);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.dispo-status.rejected {
    background-color: rgba(227, 179, 65, 0.1);
    border-color: rgba(227, 179, 65, 0.45);
}

.live-note {
    font-size: 0.82rem;
    color: var(--ink-muted);
    line-height: 1.55;
    margin-top: 0.5rem;
}

.notice {
    font-size: 0.88rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background-color: rgba(227, 179, 65, 0.1);
    border: 1px solid rgba(227, 179, 65, 0.4);
    margin: 0.5rem 0;
    line-height: 1.5;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--maize);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: -2px;
    margin-right: 0.4rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------------- Evals (collapsed) ---------------- */

.evals-details {
    background-color: var(--surface);
    border: 1px solid rgba(255, 203, 5, 0.18);
    border-radius: 15px;
    margin-bottom: 1.5rem;
}

.evals-details > summary {
    cursor: pointer;
    padding: 1.1rem 1.5rem;
    font-weight: 600;
    color: var(--maize);
    list-style-position: inside;
}

.evals-details > summary:hover {
    color: #FFD700;
}

.evals-body {
    padding: 0.25rem 1.5rem 1.5rem;
}

.eval-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tile {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--grid-line);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

.tile-value {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--maize);
    line-height: 1.1;
}

.tile-label {
    font-size: 0.8rem;
    color: var(--ink-muted);
    margin-top: 0.3rem;
    line-height: 1.4;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 0.75rem;
}

.table-scroll table,
.eval-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-scroll th,
.table-scroll td,
.eval-table th,
.eval-table td {
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--grid-line);
    white-space: nowrap;
}

.table-scroll th,
.eval-table th {
    color: var(--maize);
    font-weight: 600;
}

.eval-table tbody tr {
    cursor: pointer;
}

.eval-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.eval-table tbody tr.selected {
    background-color: rgba(255, 203, 5, 0.08);
}

.match-yes::before {
    content: "\2713 ";
    color: var(--ok);
}

.status-flag::before {
    content: "\26A0 ";
}

.status-flag {
    font-weight: 600;
    color: var(--alarm-amber);
}

.trace-card {
    margin-top: 1.25rem;
    border-top: 1px solid var(--grid-line);
    padding-top: 1.25rem;
}

.trace-card h2 {
    font-size: 1.1rem;
    color: var(--maize);
    margin-bottom: 0.75rem;
}

.trace-section {
    margin-bottom: 1.1rem;
}

.trace-section h3 {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.4rem;
}

.trace-pre {
    background-color: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--grid-line);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink);
    max-height: 340px;
    overflow: auto;
}

.table-view {
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

.table-view summary {
    cursor: pointer;
    color: var(--maize);
    font-weight: 600;
}

.demo-about {
    padding: 1rem 0 0;
}

.demo-about h2 {
    font-size: 1.3rem;
    color: var(--maize);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.demo-about p {
    line-height: 1.8;
    max-width: 880px;
}

/* Focus visibility */
.play-btn:focus-visible,
.speed-btn:focus-visible,
.dispo-btn:focus-visible,
.ghost-btn:focus-visible,
#scrubber:focus-visible,
select:focus-visible,
.evals-details > summary:focus-visible {
    outline: 3px solid var(--maize);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; }
    .dispo-btn:active, .play-btn:active { transform: none; }
}

@media (max-width: 900px) {
    .deck-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .demo-title {
        font-size: 1.9rem;
    }
    .demo-main {
        padding-top: 6.5rem;
    }
    .card {
        padding: 1.1rem;
    }
    .time-readout {
        min-width: 0;
    }
}
