/* Graph surfaces (Feature 17) — canvas, toolbar, legend, detail panel.
   Colors and radii come from the shared tokens in app.css so the graph
   follows the site theme (including dark mode) without duplication. */

.graph-shell {
    position: relative;
}

.graph-canvas {
    width: 100%;
    height: calc(100vh - 260px);
    min-height: 400px;
    background: var(--graph-canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-graph);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.graph-canvas:fullscreen {
    height: 100vh;
    border-radius: 0;
}

.graph-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 10px 14px;
    margin-bottom: 10px;
}

.graph-toolbar + .graph-toolbar {
    margin-top: -2px;
}

.graph-toolbar .btn,
.graph-toolbar .form-select,
.graph-toolbar .form-control {
    border-radius: 10px;
}

.graph-toolbar__label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.graph-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-primary-50);
    border-radius: var(--radius-chip);
}

.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.graph-legend__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: .8rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-chip);
}

.graph-legend__swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.graph-legend__swatch--character { background: var(--node-character); }
.graph-legend__swatch--location { background: var(--node-location); }
.graph-legend__swatch--timeline { background: var(--node-timeline); }
.graph-legend__swatch--chapter { background: var(--node-chapter); }
.graph-legend__swatch--paragraph { background: var(--node-paragraph); border-radius: 50%; }
.graph-legend__swatch--attribute { background: var(--node-attribute); }

.detail-panel {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 320px;
    max-height: calc(100% - 28px);
    overflow-y: auto;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 16px;
    z-index: 10;
}

.detail-panel .paragraph-text {
    white-space: pre-wrap;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Rounded modal chrome to match the rest of the site. */
.graph-modal .modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.graph-modal .list-group-item,
.graph-modal .btn {
    border-radius: 10px;
}

/* Theme toggle in the top bar. */
.theme-toggle__icon-dark { display: none; }

[data-theme="dark"] .theme-toggle__icon-light { display: none; }
[data-theme="dark"] .theme-toggle__icon-dark { display: inline; }

@media (prefers-reduced-motion: reduce) {
    .graph-canvas * {
        transition: none !important;
    }
}
