* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --border-color: #e0e0e0;
    --text-color: #333;
    --link-color: #0066cc;
    --code-bg: #ffffff;
    --nav-bg: #ffffff;
    --bg-color: #ffffff;
    --sidebar-width: 250px;
    --right-sidebar-width: 200px;
    --submenu-bg: rgba(0, 0, 0, 0.02);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --link-hover-bg: rgba(0, 102, 204, 0.05);
    --link-active-bg: rgba(0, 102, 204, 0.08);
    --code-border: #e0e0e0;
    --badge-bg: #f6f8fa;
    --badge-border: #e0e0e0;
    --badge-hover-bg: #eaeef2;
    --badge-hover-border: #d0d7de;
    --subtitle-color: #666;
    --scrollbar-thumb: rgba(176, 176, 176, 0.5);
    --tooltip-bg: #333;
    --copy-button-bg: #f6f8fa;
    --copy-button-border: #e0e0e0;
    --copy-button-hover-bg: #eaeef2;
    --copy-button-hover-border: #d0d7de;
    --code-overlay: rgba(255, 255, 255, 0.25);
    --preview-bg: #ffffff;
    --link-hover-color: #0052a3;
    --tooltip-icon-bg: #0066cc;
    --success-color: #28a745;
}

@media (prefers-color-scheme: dark) {
    :root {
        --border-color: #3a3a3a;
        --text-color: #e0e0e0;
        --link-color: #4a9eff;
        /* Dark code blocks for dark mode */
        --code-bg: #1a1a1a;
        --nav-bg: #1a1a1a;
        --bg-color: #121212;
        --submenu-bg: rgba(255, 255, 255, 0.05);
        --hover-bg: rgba(255, 255, 255, 0.1);
        --link-hover-bg: rgba(74, 158, 255, 0.15);
        --link-active-bg: rgba(74, 158, 255, 0.2);
        /* Dark borders for code blocks in dark mode */
        --code-border: #4a4a4a;
        --badge-bg: #2a2a2a;
        --badge-border: #3a3a3a;
        --badge-hover-bg: #333;
        --badge-hover-border: #4a4a4a;
        --subtitle-color: #a0a0a0;
        --scrollbar-thumb: rgba(150, 150, 150, 0.5);
        --tooltip-bg: #2a2a2a;
        --copy-button-bg: #2a2a2a;
        --copy-button-border: #3a3a3a;
        --copy-button-hover-bg: #333;
        --copy-button-hover-border: #4a4a4a;
        --code-overlay: rgba(0, 0, 0, 0.3);
        --preview-bg: #1a1a1a;
        --link-hover-color: #6bb3ff;
        --tooltip-icon-bg: #4a9eff;
        --success-color: #2dce5d;
    }
}

/* Global scrollbar styling - always visible */
::-webkit-scrollbar {
    width: 8px;
    height: 6px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 30px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 30px;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background: var(--bg-color);
    /* Firefox scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    border-bottom: 2px solid var(--border-color);
    height: 64px;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.top-bar-content {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 100%;
    box-sizing: border-box;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.top-bar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.top-bar-logo:hover {
    color: var(--link-color);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.top-bar-link:hover {
    color: var(--link-color);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.top-bar-icon:hover {
    background: var(--hover-bg);
    color: var(--link-color);
}

.top-bar-icon svg {
    width: 16px;
    height: 16px;
}

.container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-color);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    width: var(--sidebar-width);
    height: calc(100vh - 64px);
    background: var(--nav-bg);
    border-right: 2px solid var(--border-color);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.nav-header {
    padding: 0 2rem 2rem;
    border-bottom: 2px solid var(--border-color);
}

.nav-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.source-code-link {
    font-size: 0.875rem;
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.source-code-link:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.nav-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.nav-subtitle {
    font-size: 0.875rem;
    color: var(--subtitle-color);
}

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

.nav-menu li {
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.nav-item-with-submenu {
    position: relative;
}

.nav-parent {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submenu-arrow {
    font-size: 0.7em;
    transition: transform 0.2s;
    margin-left: auto;
}

.nav-item-with-submenu:hover .submenu-arrow,
.nav-item-with-submenu:focus-within .submenu-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: var(--submenu-bg);
}

.nav-item-with-submenu:hover .nav-submenu,
.nav-item-with-submenu:focus-within .nav-submenu {
    max-height: 200px;
    transition: max-height 0.3s ease-in;
}

.nav-submenu li {
    border-bottom: none;
    border-top: 1px solid var(--border-color);
}

.nav-submenu a {
    padding-left: 3rem;
    font-size: 0.9em;
    color: var(--subtitle-color);
}

.nav-submenu a:hover {
    background: var(--link-hover-bg);
    border-left-color: var(--link-color);
}

.nav-menu a {
    display: block;
    padding: 1rem 2rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.nav-menu a:hover {
    background: var(--hover-bg);
    border-left-color: var(--link-color);
}


/* Main Content */
.content {
    margin-left: var(--sidebar-width);
    padding: 3rem 4rem;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Content with right sidebar */
.container:has(.right-sidebar) .content {
    margin-right: var(--right-sidebar-width);
}

/* Right Sidebar (ON THIS PAGE) */
.right-sidebar {
    position: fixed;
    right: 0;
    top: 64px;
    width: var(--right-sidebar-width);
    height: calc(100vh - 64px);
    background: var(--nav-bg);
    border-left: 2px solid var(--border-color);
    overflow-y: hidden;
    padding: 2rem 1.5rem;
    scrollbar-gutter: stable;
}

.right-sidebar-content {
    position: sticky;
    top: 2rem;
}

.right-sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--subtitle-color);
    margin: 0 0 1.25rem 0;
    padding: 0;
}

.right-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.right-sidebar-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--subtitle-color);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.5;
    border-radius: 6px;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
    margin-left: -0.75rem;
    padding-left: 0.75rem;
}

.right-sidebar-link:hover {
    background: var(--link-hover-bg);
    color: var(--link-color);
    border-left-color: var(--link-color);
}

.right-sidebar-link:active {
    background: var(--link-active-bg);
}

.right-sidebar-link-nested {
    font-size: 0.75rem;
    color: var(--subtitle-color);
    padding-left: 1.25rem;
    margin-left: -0.75rem;
}

.right-sidebar-link-nested:hover {
    color: var(--link-color);
}

/* Active link styling */
.right-sidebar-link.active {
    background: var(--link-active-bg);
    color: var(--link-color);
    border-left-color: var(--link-color);
    font-weight: 500;
}

.examples-content,
.cli-content {
    margin-left: 0;
    max-width: 1200px;
    margin: 0 auto;
}

/* CLI Command Cards */
.cli-command {
    background: var(--nav-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
    scroll-margin-top: 2rem;
}

.cli-command:hover {
    border-color: var(--link-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .cli-command:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

.cli-command-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cli-command-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--link-color);
    margin: 0;
}

.cli-command-syntax {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--subtitle-color);
    background: var(--code-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--code-border);
    margin: 0;
}

.cli-command-description {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1rem;
}

.cli-command-section {
    margin-top: 1.5rem;
}

.cli-command-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--subtitle-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cli-command-section-title::before {
    content: '';
    width: 3px;
    height: 1rem;
    background: var(--link-color);
    border-radius: 2px;
}

.cli-flag-list,
.cli-arg-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cli-flag-item,
.cli-arg-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    border-left: 3px solid var(--link-color);
}

.cli-flag-name,
.cli-arg-name {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--link-color);
    margin-bottom: 0.25rem;
    display: block;
}

.cli-flag-desc,
.cli-arg-desc {
    color: var(--text-color);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0;
}

.cli-flag-options {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
    list-style: none;
}

.cli-flag-options li {
    margin-bottom: 0.25rem;
    color: var(--subtitle-color);
    font-size: 0.875rem;
}

.cli-flag-options code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--link-color);
    font-weight: 500;
}

.cli-example-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--subtitle-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cli-note {
    padding: 1rem 1.25rem;
    background: var(--code-bg);
    border-left: 3px solid var(--link-color);
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.cli-note strong {
    color: var(--link-color);
    font-weight: 600;
}

.cli-install-section {
    margin-bottom: 1.5rem;
}

.cli-install-section h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.cli-install-section pre {
    margin: 0;
}

/* Improve main content spacing for CLI */
.cli-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.cli-content > p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--subtitle-color);
    margin-bottom: 3rem;
}

.cli-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.cli-content h2:first-of-type {
    margin-top: 0;
}

.section {
    margin-bottom: 4rem;
    scroll-margin-top: 2rem;
    color: var(--text-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    color: var(--text-color);
}

.section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.section p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Source Code Badge */
.source-code-badge {
    display: inline-block;
    margin-left: 1rem;
}

.source-code-badge-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.source-code-badge-link:hover {
    background: var(--badge-hover-bg);
    border-color: var(--badge-hover-border);
    color: var(--link-color);
    text-decoration: none;
}

.source-code-badge-link svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.source-code-badge-link span {
    white-space: nowrap;
}

.section ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.section li {
    margin-bottom: 0.5rem;
}

code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--code-border);
    color: var(--text-color);
}

/* Code blocks in dark mode - let Prism theme handle colors */
@media (prefers-color-scheme: dark) {
    code,
    pre code {
        color: #e0e0e0;
    }
}

pre {
    background: var(--code-bg);
    padding: 1.5rem;
    border-radius: 0;
    overflow-x: auto;
    overflow-y: auto;
    margin: 1.5rem 0;
    border: 2px solid var(--code-border);
    white-space: pre;
    max-width: 100%;
    box-sizing: border-box;
    /* scrollbar-gutter: stable; */
    position: relative;
}

pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre;
    display: block;
    overflow: visible;
}

.pane-header {
    padding: 0.75rem 1rem;
    background: var(--nav-bg);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 2.75rem;
    min-height: 2.75rem;
    box-sizing: border-box;
}

/* Tabs */
.tab-buttons {
    display: flex;
    gap: 0;
}

.tab-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--subtitle-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.tab-btn:hover {
    color: var(--text-color);
    background: var(--hover-bg);
}

/* Default active state for preview tab button (since it's checked by default) */
.example-code .tab-btn[for$="-preview"] {
    color: var(--link-color);
    border-bottom-color: var(--link-color);
}

.tab-btn {
    color: var(--subtitle-color);
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
}


/* Show preview tab by default - higher specificity to override the hide rule above */
.example-code > .tab-content[id^="tab-preview-"] {
    display: flex !important;
    flex-direction: column;
}

/* Show html tab when html radio is checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-content[id^="tab-html-"] {
    display: flex;
    flex-direction: column;
}

/* Show zig tab when zig radio is checked */
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-content[id^="tab-zig-"] {
    display: flex;
    flex-direction: column;
}

/* Hide preview when html or zig tabs are checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-content[id^="tab-preview-"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-content[id^="tab-preview-"] {
    display: none !important;
}

/* Reset preview button when other tabs are checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-btn[for$="-preview"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-btn[for$="-preview"] {
    color: var(--subtitle-color) !important;
    border-bottom-color: transparent !important;
}

/* Style active tab button based on checked radio */
.example-code .tab-radio[id$="-preview"]:checked ~ .pane-header .tab-btn[for$="-preview"],
.example-code .tab-radio[id$="-html"]:checked ~ .pane-header .tab-btn[for$="-html"],
.example-code .tab-radio[id$="-zig"]:checked ~ .pane-header .tab-btn[for$="-zig"],
.example-code:has(.tab-radio[id$="-preview"]:checked) .tab-btn[for$="-preview"],
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-btn[for$="-html"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-btn[for$="-zig"] {
    color: var(--link-color) !important;
    border-bottom-color: var(--link-color) !important;
}

/* Code Wrapper */
.code-wrapper {
    flex: 1;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.code-wrapper pre {
    margin: 0;
    border: none;
    padding: 0;
    background: var(--code-bg);
    overflow: visible;
    white-space: pre;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}

.code-wrapper code {
    background: none;
    border: none;
    padding: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    display: block;
    scrollbar-gutter: stable;
    box-sizing: border-box;
}

/* Code elements with data-full-content */
.code-wrapper code[data-full-content] {
    max-height: 60vh;
}

.code-wrapper code[data-full-content]:hover {
    overflow-x: auto;
    overflow-y: auto;
}

code[contenteditable="true"] {
    outline: none;
    display: block;
    white-space: pre;
    cursor: pointer;
    overflow: visible;
}

code[contenteditable="true"]:focus {
    background: transparent;
    outline: none;
    cursor: text;
}

/* Overlay on codeblock when tooltip is shown */
.example-code pre:has(code[contenteditable="true"][data-full-content]:not(:focus))::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--code-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 999;
}

.example-code pre:hover:has(code[contenteditable="true"][data-full-content]:not(:focus))::before {
    opacity: 1;
}

/* Fallback for browsers without :has() support */
.example-code pre code[contenteditable="true"][data-full-content]:not(:focus) {
    position: relative;
}

.example-code pre code[contenteditable="true"][data-full-content]:not(:focus)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--code-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 998;
}

.example-code pre:hover code[contenteditable="true"][data-full-content]:not(:focus)::after {
    opacity: 1;
}

/* CSS-only content toggle - works without JavaScript */
code[contenteditable="true"][data-full-content] {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    white-space: pre;
    max-height: 60vh;
}

/* Show truncated content when not focused */
code[contenteditable="true"][data-full-content]:not(:focus) {
    overflow: hidden;
}

/* Ensure code element has scrollbars when focused */
code[contenteditable="true"][data-full-content]:focus {
    overflow-x: auto;
    overflow-y: auto;
}

code[contenteditable="true"][data-full-content]:not(:focus)::before {
    content: attr(title);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 10px;
    background: rgba(51, 51, 51, 0.5);
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: normal;
    letter-spacing: normal;
    text-transform: none;
}

.example-code pre:hover code[contenteditable="true"][data-full-content]:not(:focus)::before {
    opacity: 1;
}

/* Show full content when focused using CSS content property - works without JS */
code[contenteditable="true"][data-full-content]:focus {
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
}

/* CSS fallback for when JS is disabled - show full content via ::before */
code[contenteditable="true"][data-full-content]:focus::before {
    content: attr(data-full-content);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--code-bg);
    color: var(--text-color) !important;
    padding: inherit;
    white-space: pre;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    border-radius: 0;
    transform: none;
    text-align: left;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: none;
}

/* Hide CSS fallback when JS has updated content */
code[contenteditable="true"][data-full-content][data-expanded]::before {
    display: none;
}

/* Ensure textContent is visible and on top when JS has updated it */
code[contenteditable="true"][data-full-content][data-expanded] {
    color: inherit;
    position: relative;
    z-index: 2;
}


/* For non-editable code blocks (Zig code) - toggle on hover */
code[data-full-content]:not([contenteditable]) {
    position: relative;
    max-height: 60vh;
}

code[data-full-content]:not([contenteditable]):not(:hover) {
    overflow: hidden;
}

code[data-full-content]:not([contenteditable]):hover {
    overflow-x: auto;
    overflow-y: auto;
}

/* CSS fallback for when JS is disabled - show full content via ::before */
code[data-full-content]:not([contenteditable]):hover::before {
    content: attr(data-full-content);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--code-bg);
    color: var(--text-color) !important;
    padding: inherit;
    white-space: pre;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    border-radius: 0;
    transform: none;
    text-align: left;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: none;
    transition: opacity 0.2s ease-out 0s;
}

code[data-full-content]:not([contenteditable]):not(:hover)::before {
    opacity: 0;
    transition: opacity 0.2s ease-out 0.3s;
}

/* Hide CSS fallback when JS has updated content */
code[data-full-content]:not([contenteditable])[data-expanded]::before {
    display: none;
}

/* Ensure textContent is visible and on top when JS has updated it */
code[data-full-content]:not([contenteditable])[data-expanded] {
    color: inherit;
    position: relative;
    z-index: 2;
}

/* Preview */
.preview-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--preview-bg);
    padding: 10px;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--preview-bg);
    overflow: hidden;
}

/* Code Examples */
.code-example {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.example-code {
    border: 2px solid var(--code-border);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 60px;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

/* Single block - all corners rounded */
.example-code:only-child {
    border-radius: 8px;
}

.example-code:only-child h4,
.example-code:only-child span[data-no-nav] {
    border-radius: 8px 8px 0 0;
}

.example-code:only-child pre {
    border-radius: 0 0 8px 8px;
}

/* First block (left side) - left corners rounded */
.example-code:first-child:not(:only-child) {
    border-right: 1px solid var(--code-border);
    border-radius: 8px 0 0 8px;
}

/* Last block (right side) - right corners rounded */
.example-code:last-child:not(:only-child) {
    border-left: 1px solid var(--code-border);
    border-radius: 0 8px 8px 0;
}

.example-code h4,
.example-code span[data-no-nav] {
    padding: 0.75rem 1rem;
    background: var(--nav-bg);
    border-bottom: 2px solid var(--code-border);
    margin: 0;
    font-size: 0.875rem;
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--subtitle-color);
    height: 2.75rem;
    min-height: 2.75rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.example-code:first-child:not(:only-child) h4,
.example-code:first-child:not(:only-child) span[data-no-nav] {
    border-radius: 8px 0 0 0;
}

.example-code:last-child:not(:only-child) h4,
.example-code:last-child:not(:only-child) span[data-no-nav] {
    border-radius: 0 8px 0 0;
}

.code-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--tooltip-icon-bg);
    color: var(--bg-color);
    font-size: 0.7rem;
    font-weight: normal;
    font-style: normal;
    cursor: help;
    margin-left: auto;
    margin-right: 0;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.code-tooltip::after {
    content: attr(aria-label);
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--tooltip-bg);
    color: var(--text-color);
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
    font-weight: normal;
    letter-spacing: normal;
    text-transform: none;
}

.code-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px;
    margin-bottom: 4px;
    border: 4px solid transparent;
    border-top-color: var(--tooltip-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.code-tooltip:hover::after,
.code-tooltip:hover::before {
    opacity: 1;
}

.example-code pre {
    position: relative;
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow: hidden;
    white-space: pre;
    background: var(--code-bg);
    flex: 1;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.example-code:first-child:not(:only-child) pre {
    border-radius: 0 0 0 8px;
}

.example-code:last-child:not(:only-child) pre {
    border-radius: 0 0 8px 0;
}

/* Copy button styles */
.copy-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem;
    background: var(--copy-button-bg);
    border: 1px solid var(--copy-button-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    width: 32px;
    height: 32px;
}

pre:hover .copy-button,
.code-wrapper:hover .copy-button {
    opacity: 1;
    pointer-events: all;
}

.copy-button:hover {
    background: var(--copy-button-hover-bg);
    border-color: var(--copy-button-hover-border);
    color: var(--link-color);
}

.copy-button:active {
    background: var(--copy-button-hover-border);
}

.copy-button.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--bg-color);
}

.copy-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.example-code pre code {
    white-space: pre;
    display: block;
    padding: 1.5rem;
    scrollbar-gutter: stable;
    min-height: 100%;
    box-sizing: border-box;
}

/* Code elements with data-full-content */
.example-code pre code[data-full-content] {
    max-height: 60vh;
}

.example-code pre code[data-full-content]:focus {
    overflow-x: auto;
    overflow-y: auto;
}


/* Prism.js overrides */
pre[class*="language-"] {
    background: var(--code-bg) !important;
    border-radius: 8px;
}

/* pre[class*="language-bash"], pre[class*="language-powershell"] {
    width: min-content !important;
} */


code[class*="language-"] {
    background: var(--code-bg) !important;
    /* Don't override text color - let tokens handle it */
}

/* Hide right sidebar on smaller screens */
@media (max-width: 1400px) {
    .right-sidebar {
        display: none !important;
    }
    
    /* Override the :has() selector to remove margin when sidebar is hidden */
    .container:has(.right-sidebar) .content,
    .container .content {
        margin-right: 0 !important;
    }
}

/* Responsive - Medium screens */
@media (max-width: 1024px) and (min-width: 769px) {
    .code-example {
        grid-template-columns: 1fr;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    .example-code:first-child:not(:only-child) {
        border-right: 2px solid var(--code-border);
        border-bottom: 1px solid var(--code-border);
        border-radius: 8px 8px 0 0;
    }
    
    .example-code:last-child:not(:only-child) {
        border-left: 2px solid var(--code-border);
        border-top: 1px solid var(--code-border);
        border-radius: 0 0 8px 8px;
    }
    
    .example-code:first-child:not(:only-child) h4,
    .example-code:first-child:not(:only-child) span[data-no-nav] {
        border-radius: 8px 8px 0 0;
    }
    
    .example-code:last-child:not(:only-child) h4,
    .example-code:last-child:not(:only-child) span[data-no-nav] {
        border-radius: 0;
    }
    
    .example-code:first-child:not(:only-child) pre {
        border-radius: 0;
    }
    
    .example-code:last-child:not(:only-child) pre {
        border-radius: 0 0 8px 8px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        top: 64px;
        height: calc(100vh - 64px);
    }
    
    .content {
        margin-left: 0;
        margin-right: 0 !important;
        padding: 2rem;
    }
    
    .example-code {
        min-height: 40px;
    }
    
    /* Smaller fonts on medium screens */
    pre {
        font-size: 0.8rem;
        padding: 1rem;
    }
    
    pre code {
        font-size: 0.8rem;
    }
    
    .code-wrapper pre {
        font-size: 0.8rem;
    }
    
    .code-wrapper code {
        font-size: 0.8rem;
        padding: 1rem;
    }
    
    .example-code pre {
        font-size: 0.8rem;
    }
    
    .example-code pre code {
        font-size: 0.8rem;
        padding: 1rem;
    }
    
    code {
        font-size: 0.85em;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .source-code-badge {
        margin-left: 0;
    }
    
    .section h2 {
        font-size: 1.5rem;
    }
    
    .section h3 {
        font-size: 1.25rem;
    }
    
    .section h4 {
        font-size: 1rem;
    }
}

/* Responsive - Mobile screens */
@media (max-width: 768px) {
    .code-example {
        grid-template-columns: 1fr;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    .example-code:first-child:not(:only-child) {
        border-right: 2px solid var(--code-border);
        border-bottom: 1px solid var(--code-border);
        border-radius: 8px 8px 0 0;
    }
    
    .example-code:last-child:not(:only-child) {
        border-left: 2px solid var(--code-border);
        border-top: 1px solid var(--code-border);
        border-radius: 0 0 8px 8px;
    }
    
    .example-code:first-child:not(:only-child) h4,
    .example-code:first-child:not(:only-child) span[data-no-nav] {
        border-radius: 8px 8px 0 0;
    }
    
    .example-code:last-child:not(:only-child) h4,
    .example-code:last-child:not(:only-child) span[data-no-nav] {
        border-radius: 0;
    }
    
    .example-code:first-child:not(:only-child) pre {
        border-radius: 0;
    }
    
    .example-code:last-child:not(:only-child) pre {
        border-radius: 0 0 8px 8px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        top: 64px;
        height: calc(100vh - 64px);
    }
    
    .content {
        margin-left: 0;
        margin-right: 0 !important;
        padding: 2rem;
    }
    
    .example-code {
        min-height: 40px;
    }
    
    /* Smaller fonts on mobile */
    pre {
        font-size: 0.75rem;
        padding: 1rem;
    }
    
    pre code {
        font-size: 0.75rem;
    }
    
    .code-wrapper pre {
        font-size: 0.75rem;
    }
    
    .code-wrapper code {
        font-size: 0.75rem;
        padding: 1rem;
    }
    
    .example-code pre {
        font-size: 0.75rem;
    }
    
    .example-code pre code {
        font-size: 0.75rem;
        padding: 1rem;
    }
    
    code {
        font-size: 0.8em;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .source-code-badge {
        margin-left: 0;
    }
    
    .section h2 {
        font-size: 1.5rem;
    }
    
    .section h3 {
        font-size: 1.25rem;
    }
    
    .section h4 {
        font-size: 1rem;
    }
    
    /* CLI responsive styles */
    .cli-content {
        padding: 2rem 1.5rem;
    }
    
    .cli-command {
        padding: 1.75rem;
    }
    
    .cli-content h1 {
        font-size: 2rem;
    }
    
    .cli-content h2 {
        font-size: 1.5rem;
    }
    
    .cli-command {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .cli-command-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .cli-command-name {
        font-size: 1.25rem;
    }
    
    .cli-command-syntax {
        font-size: 0.8125rem;
        width: 100%;
        overflow-x: auto;
    }
    
    
    .cli-flag-item,
    .cli-arg-item {
        padding: 0.625rem 0.75rem;
    }
    
    .cli-flag-name,
    .cli-arg-name {
        font-size: 0.8125rem;
        word-break: break-all;
    }
}
