/* Native <details> accordions — Page Contents + FAQs. Cream tokens, no extra JS. */

.toc-sidebar {
    position: static;
    background: rgba(17, 17, 17, 0.06);
    padding: 20px 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color, #e5e0d8);
    margin: 8px 0 36px;
}

.toc-sidebar > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(17, 17, 17, 0.18);
}

.toc-sidebar > summary::-webkit-details-marker,
.kp-accordion-item > summary::-webkit-details-marker {
    display: none;
}

.toc-sidebar > summary::marker,
.kp-accordion-item > summary::marker {
    content: "";
}

.toc-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-main, #111);
}

.toc-toggle {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color, #e5e0d8);
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--surface-color, #fff);
    color: var(--text-main, #111);
    transition: border-color 0.22s ease;
}

.toc-sidebar[open] .toc-toggle {
    border-color: var(--text-main, #111);
}

.article-content .toc-list,
.toc-list {
    list-style: none;
    margin: 16px 0 0;
    /* padding, not last-li margin: interpolate-size misses last-child margin, so the host jerks ~12px at the end of open */
    padding: 0 0 12px;
}

.toc-list li {
    margin-bottom: 12px;
}

.toc-list li:last-child {
    margin-bottom: 0;
}

.toc-list a {
    text-decoration: none;
    color: var(--text-main, #111);
    font-size: 0.92rem;
    display: block;
    transition: color 0.2s, padding-left 0.2s;
}

.toc-list a:hover {
    color: var(--accent-color, #1a1a1a);
    padding-left: 4px;
    font-weight: 600;
}

.kp-accordion {
    margin: 48px 0 0;
}

.kp-accordion-item {
    background: var(--highlight-bg, #efebe4);
    border: 1px solid var(--border-color, #e5e0d8);
    border-radius: 16px;
    padding: 0 20px;
    margin: 10px 0;
}

.kp-accordion-item summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    padding: 16px 0;
}

.kp-accordion-item summary::after {
    content: "+";
    float: right;
    font-weight: 400;
    transition: transform 0.22s ease;
}

.kp-accordion-item[open] summary::after {
    transform: rotate(45deg);
}

.kp-accordion-item p {
    margin: 0;
    padding: 0 0 16px;
    color: var(--text-muted, #555);
}

/* Open/close: browsers that lack ::details-content still snap (native). */
.toc-sidebar,
.kp-accordion-item {
    interpolate-size: allow-keywords;
}

.toc-sidebar::details-content,
.kp-accordion-item::details-content {
    opacity: 0;
    block-size: 0;
    overflow: clip;
    transition:
        opacity 0.22s ease,
        block-size 0.28s ease,
        content-visibility 0.28s allow-discrete;
}

.toc-sidebar[open]::details-content,
.kp-accordion-item[open]::details-content {
    opacity: 1;
    block-size: auto;
}

@media (prefers-reduced-motion: reduce) {
    .kp-accordion-item summary::after,
    .toc-sidebar::details-content,
    .kp-accordion-item::details-content {
        transition: none;
        transform: none;
    }
}
