/* demo.css — demo-specific layout, animation, beacon canvas */
/* Does NOT redeclare :root vars, .badge, .btn, or anything in style.css */

/* Path color variables */
:root {
    --color-dns: #b87333;
    --color-v4: #1f6feb;
    --color-relay: #d29922;
    --color-fastly: #e5534b;
    --color-v6: #8957e5;
}

/* ── Three-column stage ────────────────────────────── */
.demo-stage {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 180px 1fr;
    gap: 0;
    align-items: stretch;
    min-height: 620px;
}

/* ── Mock window panels ────────────────────────────── */
.mock-window {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    min-height: 580px;
}

.window-chrome {
    background: #21262d;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #30363d;
}

.window-chrome .dots {
    display: flex;
    gap: 6px;
}

.window-chrome .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.window-chrome .dot.red { background: #ff5f56; }
.window-chrome .dot.yellow { background: #ffbd2e; }
.window-chrome .dot.green { background: #27c93f; }

.window-chrome .address-bar {
    background: #0d1117;
    border-radius: 4px;
    flex: 1;
    padding: 4px 12px;
    font-size: 12px;
    color: #8b949e;
    font-family: ui-monospace, monospace;
}

.window-body {
    flex: 1;
    position: relative;
    overflow: auto;
}

/* ── Browser states ────────────────────────────────── */
.browser-state {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.browser-state.active {
    display: flex;
}

/* Healthy site */
.browser-state.state-healthy {
    background: #fff;
    color: #333;
}

/* Chrome error page */
.browser-state.state-error {
    background: #fff;
    color: #333;
    text-align: left;
    justify-content: flex-start;
    padding: 40px 30px;
}

.browser-state.state-error .error-face {
    font-size: 48px;
    color: #999;
    margin-bottom: 16px;
}

.browser-state.state-error h2 {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: 400;
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 8px;
}

.browser-state.state-error p {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.browser-state.state-error .error-code {
    font-size: 12px;
    color: #999;
    margin-top: 12px;
}

.browser-state.state-error .reload-btn {
    margin-top: 20px;
    padding: 8px 16px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: default;
}

/* Resilient mode overlay */
.browser-state.state-resilient {
    background: #0d1117;
    color: #c9d1d9;
    text-align: center;
}

.resilient-card {
    border: 1px solid #30363d;
    padding: 24px;
    border-radius: 12px;
    background: rgba(22, 27, 34, 0.8);
    max-width: 380px;
    width: 100%;
}

.resilient-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: bold;
    font-family: ui-monospace, monospace;
    background: rgba(255,255,255,0.05);
    border: 1px solid #30363d;
    margin-bottom: 16px;
    color: #2ea44f;
}

.resilient-card h3 {
    color: #58a6ff;
    margin: 0 0 16px 0;
    font-size: 1.1rem;
}

.resilient-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    text-align: left;
    font-family: ui-monospace, monospace;
    font-size: 0.65rem;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #30363d;
}

.resilient-grid .label { color: #8b949e; }
.resilient-grid .value { color: #c9d1d9; }
.resilient-grid .value.down { color: #f85149; }

.resilient-notify {
    margin-top: 16px;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.03);
    color: #8b949e;
    transition: color 0.3s, background 0.3s;
}

.resilient-notify.sent {
    color: #2ea44f;
    background: rgba(46,164,79,0.08);
}

/* ── Beacon canvas (center SVG column) ─────────────── */
.beacon-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.beacon-canvas svg {
    width: 100%;
    height: 100%;
}

.path-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0;
}

.path-line.visible {
    opacity: 1;
}

.path-line.draw {
    animation: drawLine 0.6s ease-out forwards;
}

.path-line.red-crossed {
    stroke: #f85149 !important;
    stroke-dasharray: 6, 4 !important;
    stroke-dashoffset: 0 !important;
    opacity: 0.6;
}

.beacon-dot {
    r: 4;
    opacity: 0;
}

.beacon-dot.traveling {
    opacity: 1;
}

.path-label {
    font-family: ui-monospace, monospace;
    font-size: 9px;
    fill: #8b949e;
    opacity: 0;
    transition: opacity 0.3s;
}

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

/* Worker nodes (CF, Fastly) shown as intermediary boxes on SVG canvas */
.worker-node-bg {
    fill: #161b22;
    stroke: #30363d;
    stroke-width: 1;
    transition: stroke 0.4s, fill 0.4s;
}

.worker-node-bg.active {
    stroke: #58a6ff;
    fill: #1c2333;
}

.worker-node-label {
    font-family: ui-monospace, monospace;
    font-size: 8px;
    fill: #6e7681;
    text-anchor: middle;
    dominant-baseline: central;
    transition: fill 0.4s;
}

.worker-node-label.active {
    fill: #c9d1d9;
}

/* v4/v6 fork labels near worker nodes */
.fork-label {
    font-family: ui-monospace, monospace;
    font-size: 7px;
    fill: #484f58;
    opacity: 0;
    transition: opacity 0.3s, fill 0.3s;
}

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

.fork-label.v4 { fill: #58a6ff; }
.fork-label.v6 { fill: #bc8cff; }

@keyframes drawLine {
    from { stroke-dashoffset: 300; }
    to { stroke-dashoffset: 0; }
}

/* ── Dashboard incident card ───────────────────────── */
.demo-incident-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-left: 4px solid #f85149;
    border-radius: 6px;
    padding: 16px;
    margin: 12px;
    animation: slideInCard 0.4s ease-out;
}

.demo-incident-card .card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.demo-incident-card .card-domain {
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.demo-incident-card .card-type {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 2px;
}

.demo-incident-card .card-time {
    font-size: 0.7rem;
    color: #8b949e;
    font-family: ui-monospace, monospace;
}

/* Stats row */
.stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 10px 0;
    padding: 8px 0;
    border-top: 1px solid #21262d;
    border-bottom: 1px solid #21262d;
}

.stat-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-item .stat-label {
    font-size: 0.6rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item .stat-value {
    font-size: 0.8rem;
    color: #c9d1d9;
    font-family: ui-monospace, monospace;
}

/* Delivery paths section */
#delivery-paths-section {
    margin: 8px 0;
}

/* Network grid */
.network-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 6px;
}

.network-item {
    padding: 6px 8px;
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
    border: 1px solid #21262d;
}

.network-item .isp {
    font-size: 0.8rem;
    color: #c9d1d9;
    font-weight: 600;
}

.network-item .asn {
    font-size: 0.65rem;
    color: #8b949e;
    font-family: ui-monospace, monospace;
}

/* Forensics panel (collapsible) */
.forensics-panel {
    margin-top: 10px;
    border-top: 1px solid #21262d;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-out;
}

.forensics-panel.expanded {
    max-height: 400px;
}

.forensics-toggle {
    background: none;
    border: 1px solid #30363d;
    color: #58a6ff;
    font-family: ui-monospace, monospace;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.forensics-toggle:hover {
    background: rgba(88,166,255,0.08);
}

/* ── Scenario overlay ──────────────────────────────── */
.scenario-overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    overflow-y: auto;
    z-index: 10;
}

.scenario-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.scenario-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-family: ui-monospace, monospace;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(210, 153, 34, 0.15);
    border: 1px solid #d29922;
    color: #d29922;
    margin-bottom: 12px;
}

.scenario-overlay h3 {
    color: #f0f6fc;
    font-size: 1rem;
    margin-bottom: 16px;
    text-align: center;
}

.scenario-warning {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid rgba(210, 153, 34, 0.3);
    background: rgba(210, 153, 34, 0.08);
    color: #d29922;
    font-size: 0.8rem;
    font-family: ui-monospace, monospace;
    margin: 12px 0;
    animation: warnPulse 2s ease-in-out infinite;
    text-align: center;
}

.scenario-explainer {
    color: #8b949e;
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 340px;
    text-align: center;
    margin: 12px 0;
}

.scenario-dismiss {
    background: #30363d;
    color: #c9d1d9;
    border: 1px solid #484f58;
    padding: 8px 18px;
    border-radius: 6px;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}

.scenario-dismiss:hover {
    background: #3c444d;
}

@keyframes slideInCard {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes warnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Controls ──────────────────────────────────────── */
.demo-controls {
    margin-bottom: 24px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ── Mobile path legend (replaces SVG canvas) ──────── */
.mobile-path-legend {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 12px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.legend-item.active {
    opacity: 1;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-label {
    font-family: ui-monospace, monospace;
    font-size: 0.7rem;
    color: #c9d1d9;
}

/* ── Dashboard empty state ─────────────────────────── */
.dash-empty {
    text-align: center;
    color: #8b949e;
    margin-top: 100px;
    font-style: italic;
    font-size: 0.85rem;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 12px;
}

.dash-header h3 {
    margin: 0;
    color: #58a6ff;
    font-size: 0.95rem;
}

/* ── Mobile breakpoint ─────────────────────────────── */
@media (max-width: 900px) {
    .demo-stage {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 12px;
    }

    .beacon-canvas {
        display: none;
    }

    .mobile-path-legend {
        display: flex;
    }

    .mock-window {
        min-height: 420px;
    }

    .demo-incident-card {
        margin: 8px;
        padding: 12px;
    }

    .stats-row {
        gap: 10px;
    }
}
