body {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    line-height: 1.6;
}

/* Links */
a {
    color: #1976d2;
}

a:hover {
    color: #1565c0;
}

/* Site header */
.site-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.site-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.site-header a {
    display: flex;
    align-items: center;
}

/* Navigation */
.docs-nav {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1.5rem;
}

.docs-nav a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.docs-nav a:hover {
    color: #1976d2;
}

.docs-nav a.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
}

/* Example intro */
.intro {
    margin-bottom: 2rem;
}

.intro p {
    margin-bottom: 0.75rem;
}

/* vgplot chart text styling */
svg text {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
}

/* Backend selector */
.backend-selector {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.backend-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.75rem;
}

.backend-options {
    display: flex;
    gap: 1rem;
}

.backend-option {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 6px;
    border: 2px solid transparent;
    background: white;
    transition: border-color 0.15s, background-color 0.15s;
}

.backend-option:hover {
    background: #f0f4f8;
}

.backend-option:has(input:checked) {
    border-color: #1976d2;
    background: #e3f2fd;
}

.backend-option input[type="radio"] {
    margin-top: 0.2rem;
    accent-color: #1976d2;
}

.backend-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.backend-label strong {
    font-size: 0.95rem;
    color: #333;
}

.backend-desc {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .backend-options {
        flex-direction: column;
    }
}

/* Chart container with connection states */
#chart {
    position: relative;
    border-radius: 8px;
    transition: opacity 0.3s;
}

#chart::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 10;
    transition: background-color 0.3s, box-shadow 0.3s;
}

#chart::after {
    position: absolute;
    top: 0.75rem;
    right: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    z-index: 10;
    transition: color 0.3s;
}

/* Connecting state */
#chart[data-state="connecting"] {
    opacity: 0.9;
}

#chart[data-state="connecting"]::before {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
}

#chart[data-state="connecting"]::after {
    content: 'Connecting';
    color: #b45309;
}

/* Connected state */
#chart[data-state="connected"]::before {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

#chart[data-state="connected"]::after {
    content: 'Connected';
    color: #16a34a;
}

/* Disconnected state */
#chart[data-state="disconnected"] {
    opacity: 0.8;
}

#chart[data-state="disconnected"]::before {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
    animation: pulse 1s ease-in-out infinite;
}

#chart[data-state="disconnected"]::after {
    content: 'Disconnected';
    color: #dc2626;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}
