/* QEC blog post styles */

.surface-figure {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 18px 16px 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(250,250,250,0.9));
}

.surface-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 16px;
    align-items: end;
    margin-bottom: 12px;
    text-align: left;
}

.figure-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.figure-tab {
    font-family: inherit;
    font-size: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-secondary);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.figure-tab.is-active {
    background: var(--hover-bg);
    border-color: #d7d7d7;
    color: var(--text-color);
}

.figure-panel {
    display: none;
}

.figure-panel.is-active {
    display: block;
}

.figure-caption {
    display: none;
}

.figure-caption.is-active {
    display: inline;
}

.surface-controls label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.surface-controls input[type="range"] {
    width: 100%;
}

.surface-buttons {
    display: flex;
    gap: 10px;
}

.surface-buttons button {
    font-family: inherit;
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.surface-buttons button:hover {
    background: var(--hover-bg);
    border-color: #d7d7d7;
}

#surface-code-2d {
    width: 100%;
    height: auto;
}

.surface-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
}

/* Table of Contents */
.table-of-contents {
    position: fixed;
    top: 120px;
    right: max(20px, calc((100vw - 900px) / 2 - 260px));
    width: 220px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 16px 0;
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 1300px) {
    .table-of-contents {
        display: none;
    }
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-link {
    display: block;
    padding: 4px 0 4px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: var(--text-color);
    border-left-color: var(--border-color);
}

.toc-link.active {
    color: #d4a373;
    border-left-color: #d4a373;
    font-weight: 500;
}

.toc-link.toc-h1 {
    font-weight: 600;
    font-size: 12px;
    margin-top: 8px;
}

.toc-link.toc-h1:first-child {
    margin-top: 0;
}

.toc-link.toc-h2 {
    padding-left: 20px;
    font-size: 11px;
}

.toc-link.toc-h3 {
    padding-left: 28px;
    font-size: 10px;
}

/* Bloch sphere controls */
.bloch-preset,
.bloch-error,
.bloch-basis,
.bloch-measure {
    font-family: inherit;
    font-size: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bloch-preset:hover,
.bloch-error:hover,
.bloch-basis:hover,
.bloch-measure:hover {
    background: var(--hover-bg);
    border-color: #d7d7d7;
}

.bloch-preset.active,
.bloch-error.active,
.bloch-basis.active {
    background: rgba(212, 163, 115, 0.15);
    border-color: #d4a373;
    color: #d4a373;
    font-weight: 500;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}
