/* Shared base styles for TOC + QuickAccess widgets.
   Ported from partials/navigation_widgets_assets.html's old inline <style> block.
   Themes override specifics via .theme-<name> selectors in their SCSS;
   these rules are the cross-theme baseline. */

.widget-scroll-anchor {
    display: block;
    position: relative;
    top: -88px;
    height: 0;
    visibility: hidden;
}

.toc-block {
    --widget-surface: #f8fafc;
    --widget-surface-strong: #0d1b2a;
    --widget-surface-soft: #f1f5f9;
    --widget-text: #0e1b29;
    --widget-text-strong: #ffffff;
    --widget-link: #0e1b29;
    --widget-border: #e2e8f0;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--widget-surface);
    border: 1px solid var(--widget-border);
    box-shadow: 0 4px 16px rgba(13, 27, 42, 0.06);
}

.quickaccess-block {
    --widget-surface: #f3f4f6;
    --widget-surface-strong: #111827;
    --widget-surface-soft: #ffffff;
    --widget-text: #0f172a;
    --widget-text-strong: #ffffff;
    --widget-link: #1a56db;
    --widget-border: rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 1.5rem 0;
    background: var(--widget-surface);
    border: 1px solid transparent;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.toc-theme-blue,
.quickaccess-blue {
    --widget-surface: #f8fafc;
    --widget-surface-strong: #0d1b2a;
    --widget-surface-soft: #f1f5f9;
    --widget-text: #0e1b29;
    --widget-text-strong: #ffffff;
    --widget-link: #0e1b29;
    --widget-border: #e2e8f0;
}

.toc-theme-gray,
.quickaccess-gray {
    --widget-surface: #f3f4f6;
    --widget-surface-strong: #374151;
    --widget-surface-soft: #ffffff;
    --widget-text: #111827;
    --widget-text-strong: #ffffff;
    --widget-link: #1f2937;
    --widget-border: rgba(17, 24, 39, 0.08);
}

.toc-theme-white,
.quickaccess-white {
    --widget-surface: #ffffff;
    --widget-surface-strong: #e2e8f0;
    --widget-surface-soft: #f8fafc;
    --widget-text: #111827;
    --widget-text-strong: #111827;
    --widget-link: #1d4ed8;
    --widget-border: rgba(15, 23, 42, 0.08);
}

.toc-theme-white-border,
.quickaccess-white-border {
    --widget-surface: #ffffff;
    --widget-surface-strong: #f8fafc;
    --widget-surface-soft: #f8fafc;
    --widget-text: #111827;
    --widget-text-strong: #111827;
    --widget-link: #1d4ed8;
    --widget-border: rgba(15, 23, 42, 0.12);
}

.quickaccess-white,
.quickaccess-white-border,
.toc-theme-white,
.toc-theme-white-border {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.toc-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border: 0;
    background: var(--widget-surface-strong);
    color: var(--widget-text-strong);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: left;
    border-radius: 11px 11px 0 0;
}

.toc-theme-white .toc-header,
.toc-theme-white-border .toc-header,
.toc-theme-gray .toc-header {
    background: var(--widget-surface-soft);
    color: var(--widget-text);
}

.toc-title {
    font-size: 1rem;
    line-height: 1.35;
}

.toc-arrow {
    flex: 0 0 auto;
    transition: transform 0.2s ease;
}

.toc-open .toc-arrow,
.toc-header[aria-expanded="true"] .toc-arrow {
    transform: rotate(180deg);
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--widget-surface);
    transition: max-height 0.25s ease;
}

.toc-open .toc-list {
    max-height: 80vh;
}

.toc-item {
    margin: 0;
    border-top: 1px solid var(--widget-border);
}

.toc-link {
    display: block;
    padding: 0.8rem 1.1rem;
    color: var(--widget-link);
    text-decoration: none;
    line-height: 1.45;
    font-weight: 500;
}

.toc-link:hover,
.toc-link:focus-visible {
    background: color-mix(in srgb, var(--widget-surface-soft) 72%, transparent);
    text-decoration: underline;
}

.toc-empty {
    padding: 0.8rem 1.1rem;
    color: #64748b;
}

.quickaccess-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 16px;
    line-height: 1.3;
    color: var(--widget-text);
}

.quickaccess-body {
    display: flex;
    gap: 28px;
}

.quickaccess-body--2col .quickaccess-links {
    columns: 2;
    column-gap: 24px;
}

.quickaccess-left {
    flex: 1 1 45%;
    min-width: 0;
    color: var(--widget-text);
}

.quickaccess-left img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 12px;
}

.quickaccess-left p {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.quickaccess-right {
    flex: 1 1 55%;
    min-width: 0;
}

.quickaccess-links-title {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--widget-text);
}

.quickaccess-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quickaccess-link-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--widget-border);
    font-size: 0.95rem;
}

.quickaccess-link-item a {
    color: var(--widget-link);
    text-decoration: none;
    font-weight: 500;
}

.quickaccess-link-item a:hover,
.quickaccess-link-item a:focus-visible {
    text-decoration: underline;
}

.quickaccess-link-hidden {
    display: none;
}

.quickaccess-link-hidden.quickaccess-link-visible {
    display: list-item;
}

.quickaccess-show-more {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--widget-link);
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.quickaccess-show-more:hover,
.quickaccess-show-more:focus-visible {
    background: var(--widget-link);
    color: #fff;
    border-color: var(--widget-link);
}

@media (max-width: 768px) {
    .quickaccess-body {
        flex-direction: column;
        gap: 16px;
    }

    .quickaccess-body--2col .quickaccess-links {
        columns: 1;
    }

    .quickaccess-block {
        padding: 16px 20px;
    }
}
