/* PDF container */
.pdf {
    width: 100%;
}

/* Embedded PDF iframe */
.pdf__frame {
    display: block;          /* avoid inline gap */
    width: 100%;             /* responsive width on all screens */
    height: 80vh;            /* default height (desktop-ish) */
    border: none;
}

/* "Open PDF" link – on larger screens */
.pdf__link {
    display: block;
    margin-top: 0.75rem;
}

/* Small screens: adjust height + show link */
@media (max-width: 768px) {
    .pdf__frame {
        height: 60vh;        /* slightly shorter on mobile */
    }

    .pdf__link {
        display: block;      /* show "Open PDF" on mobile */
    }
}

.mermaid {
    margin: 1.5rem 0;
    text-align: center;
}

.python-playground .buttons {
    display: flex;
    gap: 0.25rem;
}

.python-playground .play-button.is-loading {
    opacity: 0.7;
}

.python-playground .result {
    display: block;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
    background: var(--quote-bg);
}

.python-playground .result.result-error {
    border-left: 4px solid #c2410c;
}

.python-playground .result.result-no-output {
    opacity: 0.8;
}

.sql-playground .buttons {
    display: flex;
    gap: 0.25rem;
}

.sql-playground .result {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--quote-bg);
    overflow-x: auto;
}

.sql-playground .result.result-error {
    border-left: 4px solid #c2410c;
    white-space: pre-wrap;
}

.sql-playground .result.result-no-output {
    opacity: 0.8;
}

.sql-playground .result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.sql-playground .result-table:first-child {
    margin-top: 0;
}

.sql-playground .result-table th,
.sql-playground .result-table td {
    border: 1px solid var(--table-border-color);
    padding: 0.4rem 0.55rem;
    text-align: left;
    vertical-align: top;
}

.sql-playground .result-table th {
    background: var(--table-header-bg);
}

.sql-playground .result-label {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

.chapter-item.has-children {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sidebar-collapsible-loading #sidebar .chapter,
.sidebar-collapsible-loading body.sidebar-iframe-inner .chapter {
    visibility: hidden;
}

.chapter-item.has-children > a {
    flex: 1 1 auto;
    min-width: 0;
}

.sidebar-section-toggle {
    flex: 0 0 auto;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: color-mix(in srgb, var(--sidebar-bg) 72%, white 28%);
    color: color-mix(in srgb, var(--fg) 82%, white 18%);
    cursor: pointer;
    opacity: 0.96;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-section-toggle::before {
    content: "";
    display: block;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateX(-1px) rotate(45deg);
    transform-origin: center;
}

.chapter-item.has-children.is-collapsed > .sidebar-section-toggle::before {
    transform: translateX(-1px) rotate(-45deg);
}

.sidebar-section-toggle:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--links) 18%, var(--sidebar-bg) 82%);
    color: var(--links);
    transform: scale(1.04);
}

.sidebar-section-toggle:focus-visible {
    outline: 2px solid var(--links);
    outline-offset: 2px;
}
