* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.wiki-layout {
    display: flex;
    min-height: 100vh;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    gap: 40px;
}

.sidebar {
    width: 220px;
    min-width: 220px;
    padding: 30px 0;
    position: sticky;
    top: 40px;
    align-self: flex-start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
}

.sidebar-header a {
    font-weight: 700;
    font-size: 1.1rem;
    color: #000;
    text-decoration: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 1px;
}

.sidebar-nav > li > a {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
}

.sidebar-nav > li > a:hover,
.sidebar-nav > li > a.active {
    background: #f0f0f0;
    color: #0070f3;
}

.sidebar-nav ul {
    list-style: none;
    padding-left: 16px;
    margin: 1px 0 4px;
}

.sidebar-nav ul li a {
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
    display: block;
    padding: 3px 8px;
    border-radius: 4px;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
    background: #f0f0f0;
    color: #0070f3;
}

.content {
    flex: 1;
    min-width: 0;
}

.content article {
    width: 100%;
    max-width: 800px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 40px;
    border: none;
}

.content h1 {
    font-size: 1.8rem;
    color: #000;
    margin-top: 0;
    margin-bottom: 20px;
}

.content h2 {
    font-size: 1.4rem;
    color: #000;
    margin-top: 30px;
    margin-bottom: 10px;
}

.content h3 {
    font-size: 1.15rem;
    color: #111;
    margin-top: 25px;
    margin-bottom: 8px;
}

.content p {
    margin-bottom: 15px;
}

.content a {
    color: #0070f3;
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

.content code {
    font-family: Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
}

.content pre,
.content pre.hljs {
    background: #f5f5f5 !important;
    border-radius: 4px;
    padding: 12px 15px;
    overflow-x: auto;
    margin: 15px 0;
    border: none !important;
    box-shadow: none !important;
}

.content pre code,
.content pre code.hljs,
.hljs {
    background: #f5f5f5 !important;
    padding: 0 !important;
    font-size: 0.8em;
    line-height: 1.5;
    border: none !important;
    box-shadow: none !important;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9em;
}

.content th, .content td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.content th {
    font-weight: 600;
    color: #000;
}

.content ul, .content ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.content li {
    margin-bottom: 6px;
}

.content blockquote {
    border-left: 3px solid #0070f3;
    margin: 15px 0;
    padding: 10px 20px;
    background: #f8f9ff;
    border-radius: 0 6px 6px 0;
}

.atomics-table {
    margin: 15px 0;
    overflow-x: auto;
}

.content .atomics-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78em;
    margin: 0;
}

.atomics-table th,
.atomics-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.atomics-table code {
    font-size: 0.95em;
    padding: 1px 3px;
}

.cap {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #333;
    vertical-align: -1px;
    box-sizing: border-box;
}

.cap.full { background: #333; }
.cap.half {
    background: linear-gradient(to right, #333 50%, transparent 50%);
}
.cap.none { background: transparent; }

.table-legend {
    font-size: 0.78em;
    color: #555;
    margin: 6px 0 18px;
    line-height: 1.5;
}

.table-legend code {
    font-size: 0.95em;
}

.content table.capability-matrix {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.78em;
}

.content table.capability-matrix th,
.content table.capability-matrix td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: center !important;
    vertical-align: middle;
}

.content table.capability-matrix thead tr:last-child th:nth-child(1),
.content table.capability-matrix thead tr:last-child th:nth-child(2),
.content table.capability-matrix tbody td:nth-child(2),
.content table.capability-matrix tbody td:nth-child(3) {
    width: 16%;
}

.content table.capability-matrix tbody td:nth-child(4),
.content table.capability-matrix tbody td:nth-child(5) {
    width: 12%;
}

.content table.capability-matrix thead th[colspan] {
    text-align: center !important;
    border-bottom: 1px solid #ccc;
}

.content table.capability-matrix th {
    font-weight: 600;
    color: #000;
    background: #fafafa;
}

.capability-matrix tbody td:first-child {
    text-align: left;
    font-family: Menlo, Monaco, Consolas, monospace;
    font-size: 0.92em;
}

figure.diagram {
    margin: 20px auto;
    text-align: center;
}

figure.diagram img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

figure.diagram figcaption {
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
    text-align: center;
}

figure.diagram-pair {
    max-width: 720px;
    margin: 20px auto;
}

figure.diagram-pair .diagram-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

figure.diagram-pair .diagram-row > div {
    flex: 0 0 auto;
    text-align: center;
}

figure.diagram-pair .diagram-row img {
    height: 220px;
    width: auto;
    max-width: 100%;
    display: block;
}

figure.diagram-pair .sub-caption {
    margin-top: 6px;
    font-size: 0.85em;
    color: #444;
    text-align: center;
}

@media (max-width: 768px) {
    figure.diagram-pair .diagram-row {
        grid-template-columns: 1fr;
    }
}

.side-by-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    margin: 16px 0;
    align-items: start;
}

.side-by-side > div {
    min-width: 0;
    overflow: hidden;
}

.side-by-side pre,
.side-by-side .highlight {
    margin: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .content {
        margin-left: 0;
        padding: 20px;
    }
    .side-by-side {
        grid-template-columns: 1fr;
    }
}
