/* AnchorKit Frontend Styles */
/* Table of Contents Styling */

/* Gutenberg block wrapper */
.wp-block-anchorkit-table-of-contents {
    display: block;
    box-sizing: border-box;
}

.anchorkit-toc-container {
    background-color: var(--anchorkit-toc-bg, #ffffff);
    color: var(--anchorkit-toc-text-color, #333333);
    border: var(--anchorkit-toc-border-width, 1px) solid var(--anchorkit-toc-border-color, #dddddd);
    border-radius: var(--anchorkit-toc-border-radius, 4px);
    padding: var(--anchorkit-toc-padding, 15px);
    margin: 20px auto;
    font-family: var(--anchorkit-toc-font-family, inherit);
    font-size: var(--anchorkit-toc-font-size, 14px);
    line-height: var(--anchorkit-toc-line-height, 1.5);

    position: relative;
    max-width: 600px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Smooth transition when collapsing/expanding */
    transition: max-height 0.3s ease;
}

/* Only apply max-height for sticky TOCs to prevent them from exceeding viewport */
.anchorkit-toc-sticky {
    max-height: 50vh;
}

/* TOC Title */
.anchorkit-toc-title {
    font-weight: 600;
    margin: 0 0 12px 0;
    padding: 0;
    color: var(--anchorkit-toc-text-color, #333333);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--anchorkit-toc-title-font-size, inherit);
}

/* TOC Toggle Button */
.anchorkit-toc-toggle-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    color: var(--anchorkit-toc-link-color, #0073aa);
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.anchorkit-toc-toggle-button:hover {
    color: var(--anchorkit-toc-link-hover-color, #005177);
}

.anchorkit-toc-toggle-button:focus {
    outline: 2px solid var(--anchorkit-toc-link-color, #0073aa);
    outline-offset: 2px;
}

/* TOC Toggle Icon - Arrow created with CSS borders */
.anchorkit-toc-toggle-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.anchorkit-toc-collapsed .anchorkit-toc-toggle-icon {
    -webkit-transform: rotate(-45deg);
    transform: rotate(-45deg);
}

/* TOC List */
.anchorkit-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    /* Scroll inside the container when content is tall */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: height 0.3s ease, opacity 0.3s ease;
    /* Smooth scrolling on touch devices */
    -webkit-overflow-scrolling: touch;
}

/* Padding rule removed - view more button is now outside the scrollable list */

/* Desktop scrollbar styling */
.anchorkit-toc-list::-webkit-scrollbar {
    width: 8px;
}

.anchorkit-toc-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin: 4px 0;
}

.anchorkit-toc-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.anchorkit-toc-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar */
.anchorkit-toc-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

.anchorkit-toc-item {
    margin: 0;
    padding: 0;
    line-height: var(--anchorkit-toc-line-height, 1.6);
}

/* TOC Links */
.anchorkit-toc-container .anchorkit-toc-link {
    display: block;
    color: var(--anchorkit-toc-link-color, #0073aa);
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
    padding: 6px 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease, text-decoration 0.2s ease;
    position: relative;
    line-height: var(--anchorkit-toc-line-height, 1.4) !important;
    letter-spacing: var(--anchorkit-toc-letter-spacing, 0px) !important;
    text-transform: var(--anchorkit-toc-text-transform, none) !important;
    max-width: 90%;
    margin: 4px;
}

/* Ensure visited links do not switch to the browser's default visited color */
.anchorkit-toc-container .anchorkit-toc-link:visited {
    color: var(--anchorkit-toc-link-color, #0073aa);
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-container .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #005177);
    background-color: var(--anchorkit-toc-hover-bg, rgba(0, 0, 0, 0.04));
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

.anchorkit-toc-container .anchorkit-toc-link:focus {
    color: var(--anchorkit-toc-link-hover-color, #005177);
    background-color: var(--anchorkit-toc-focus-bg, rgba(0, 0, 0, 0.08));
    outline: 2px solid var(--anchorkit-toc-link-color, #0073aa);
    outline-offset: 2px;
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

/* Reading Time & Metadata (Pro Feature) */
.anchorkit-toc-metadata {
    display: inline-block;
    font-size: 0.85em;
    opacity: 0.7;
    margin-left: 0.5em;
    font-weight: normal;
}

.anchorkit-toc-link:hover .anchorkit-toc-metadata {
    opacity: 0.85;
}

/* Active Link (Scroll Spy) */
.anchorkit-toc-link.anchorkit-toc-active {
    color: var(--anchorkit-toc-active-link-color, #00a0d2);
    font-weight: 600;
    background-color: var(--anchorkit-toc-focus-bg, rgba(0, 0, 0, 0.08));
}

/* Hierarchical View (using depth-based level classes) */
/* Level 1 = top level (base heading), no indentation */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-1 {
    margin-left: 0 !important;
}

/* Level 2 = first sub-level (e.g. H3 under H2) */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-2 {
    margin-left: 20px !important;
}

/* Level 3 = second sub-level (e.g. H4 under H3 under H2) */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-3 {
    margin-left: 40px !important;
}

/* Level 4 = third sub-level */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-4 {
    margin-left: 60px !important;
}

/* Level 5 = fourth sub-level */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-5 {
    margin-left: 80px !important;
}

/* Level 6 = fifth sub-level */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-6 {
    margin-left: 100px !important;
}

/* Legacy: anchorkit-toc-list-sub for nested list structures (deprecated) */
.anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-list-sub {
    margin-left: 0;
    padding-left: 0;
    background-color: var(--anchorkit-toc-sublevel-bg, transparent);
}

/* Non-hierarchical override: ensure no indentation when hierarchy is disabled */
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-list-sub {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-1,
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-2,
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-3,
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-4,
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-5,
.anchorkit-toc-container:not(.anchorkit-toc-hierarchical) .anchorkit-toc-level-6 {
    margin-left: 0 !important;
}

/* Collapsible TOC */
.anchorkit-toc-container.anchorkit-toc-collapsible .anchorkit-toc-list {
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Allow scrolling when expanded; collapsed state below will hide overflow */
    overflow-y: auto;
    overflow-x: hidden;
}

.anchorkit-toc-container.anchorkit-toc-collapsible.anchorkit-toc-collapsed .anchorkit-toc-list {
    max-height: 0 !important;
    height: 0;
    opacity: 0;
    overflow: hidden !important;
}

.anchorkit-toc-container.anchorkit-toc-collapsible.anchorkit-toc-expanded .anchorkit-toc-list {
    opacity: 1;
}

/* Make collapsed TOC more compact */
.anchorkit-toc-container.anchorkit-toc-collapsible.anchorkit-toc-collapsed {
    padding-bottom: var(--anchorkit-toc-padding, 15px) !important;
    /* Ensure container shrinks to fit only title when collapsed - prevent empty block appearance */
    max-height: none;
    /* Allow container to shrink naturally to fit content */
    height: auto;
    min-height: 0;
}

.anchorkit-toc-container.anchorkit-toc-collapsible.anchorkit-toc-collapsed .anchorkit-toc-title {
    margin-bottom: 12px !important;
}

/* Make title clearly interactive when collapsible is enabled */
.anchorkit-toc-collapsible .anchorkit-toc-title {
    cursor: pointer;
    user-select: none;
}

/* Elementor: add comfortable left padding when hierarchy is off */
.anchorkit-toc-elementor:not(.anchorkit-toc-hierarchical) .anchorkit-toc-list {
    padding-left: 16px;
}

/* Toggle Icon Animation - Icon rotation is handled by .anchorkit-toc-toggle-icon styles above */

/* Bullet Styles - Higher specificity to override presets */
/* Hide preset numbering on links when bullets are enabled OR when style is set to none */
.anchorkit-toc-container[class*="anchorkit-toc-bullet-"] .anchorkit-toc-link::before,
.anchorkit-toc-container[class*="anchorkit-toc-bullet-"] a::before {
    content: none !important;
    display: none !important;
}

/* Flexbox layout for items with bullets to prevent bullets from wrapping to separate line */
/* CRITICAL: Exclude hidden items so View More functionality works correctly */
.anchorkit-toc-container[class*="anchorkit-toc-bullet-"]:not(.anchorkit-toc-bullet-none) .anchorkit-toc-item:not(.anchorkit-toc-hidden-item) {
    display: flex !important;
    align-items: center !important;
}

.anchorkit-toc-container[class*="anchorkit-toc-bullet-"]:not(.anchorkit-toc-bullet-none) .anchorkit-toc-item:not(.anchorkit-toc-hidden-item) .anchorkit-toc-link {
    flex: 1 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-disc .anchorkit-toc-item::before {
    content: "•" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 10px;
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-container.anchorkit-toc-bullet-circle .anchorkit-toc-item::before {
    content: "○" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 10px;
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-container.anchorkit-toc-bullet-square .anchorkit-toc-item::before {
    content: "▪" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 10px;
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-container.anchorkit-toc-bullet-custom .anchorkit-toc-item::before {
    content: "•" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before {
    content: "→" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before {
    content: "›" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    font-size: 1.2em;
    font-weight: bold;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-check .anchorkit-toc-item::before {
    content: "✓" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    font-weight: bold;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-star .anchorkit-toc-item::before {
    content: "★" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before {
    content: var(--anchorkit-toc-custom-bullet, "•") !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa));
    margin-right: 8px;
    flex-shrink: 0 !important;
}

.anchorkit-toc-container.anchorkit-toc-bullet-none .anchorkit-toc-item::before {
    display: none !important;
}

/* Numerals - PHP generates the numbers in <span class="anchorkit-toc-item-number">, no CSS counters needed */
/* When numerals are enabled, hide the preset's built-in numbering on links */
.anchorkit-toc-container.anchorkit-toc-numerals .anchorkit-toc-link::before,
.anchorkit-toc-container.anchorkit-toc-numerals a::before {
    content: none !important;
    display: none !important;
}

/* Style for the PHP-generated number span */
.anchorkit-toc-container.anchorkit-toc-numerals .anchorkit-toc-item-number {
    display: inline-block;
    font-weight: 600;
    margin-right: 0.5em;
    color: inherit;
}

/* Light Theme Specific Styles - Use CSS variables for customization */
.anchorkit-toc-container.anchorkit-toc-theme-light {
    background-color: var(--anchorkit-toc-bg) !important;
    color: var(--anchorkit-toc-text-color) !important;
    border-color: var(--anchorkit-toc-border-color) !important;

}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-link:visited {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-hover-bg) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-link:focus {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
    outline-color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-link.anchorkit-toc-active {
    color: var(--anchorkit-toc-active-link-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-toggle-button {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-toggle-button:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-text-color) !important;
    opacity: 1;
}

/* Dark Theme Specific Styles - Use CSS variables for customization */
.anchorkit-toc-container.anchorkit-toc-theme-dark {
    background-color: var(--anchorkit-toc-bg) !important;
    color: var(--anchorkit-toc-text-color) !important;
    border-color: var(--anchorkit-toc-border-color) !important;

}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:visited {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-hover-bg) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:focus {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
    outline-color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link.anchorkit-toc-active {
    color: var(--anchorkit-toc-active-link-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-toggle-button {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-toggle-button:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-text-color) !important;
    opacity: 1;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling {
    background: var(--anchorkit-toc-bg, #ffffff) !important;
    color: var(--anchorkit-toc-text-color, inherit) !important;
    border: var(--anchorkit-toc-border-width, 1px) solid var(--anchorkit-toc-border-color, rgba(0, 0, 0, 0.1)) !important;
    border-radius: var(--anchorkit-toc-border-radius, 8px) !important;
    padding: var(--anchorkit-toc-padding, 20px) !important;
    font-size: var(--anchorkit-toc-font-size, 14px) !important;
    font-family: var(--anchorkit-toc-font-family, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, inherit) !important;
    font-size: var(--anchorkit-toc-title-font-size, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, inherit) !important;
    background: var(--anchorkit-toc-hover-bg, transparent) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-link.anchorkit-toc-active,
.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-active-link-color, inherit) !important;
    background: var(--anchorkit-toc-focus-bg, transparent) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-heading-level-2>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h2-font-size, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-heading-level-3>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h3-font-size, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-heading-level-4>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h4-font-size, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-heading-level-5>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h5-font-size, inherit) !important;
}

.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-heading-level-6>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h6-font-size, inherit) !important;
}

/* System Theme (follows user's OS preference) - Use CSS variables for customization */
/* ================================================
   DARK MODE STYLES - CONSOLIDATED
   Applies to BOTH explicit dark AND system+dark
   ================================================ */

/* Container base styles - shared between explicit dark and system+dark */
.anchorkit-toc-container.anchorkit-toc-theme-dark,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system {
    background-color: var(--anchorkit-toc-bg) !important;
    color: var(--anchorkit-toc-text-color) !important;
    border-color: var(--anchorkit-toc-link-color) !important;
}

/* Title colors */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-title,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color) !important;
}

/* Link colors */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:visited,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link:visited {
    color: var(--anchorkit-toc-link-color) !important;
}

/* Link hover states */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:hover,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-hover-bg) !important;
}

/* Link focus states */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link:focus,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link:focus {
    color: var(--anchorkit-toc-link-hover-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
    outline-color: var(--anchorkit-toc-link-color) !important;
}

/* Active link states */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link.active,
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-link.anchorkit-toc-active,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link.active,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link.anchorkit-toc-active {
    color: var(--anchorkit-toc-active-link-color) !important;
    background-color: var(--anchorkit-toc-focus-bg) !important;
}

/* Toggle button */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-toggle-button,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-toggle-button {
    color: var(--anchorkit-toc-link-color) !important;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-toggle-button:hover,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-toggle-button:hover {
    color: var(--anchorkit-toc-link-hover-color) !important;
}

/* Back to top */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-back-to-top,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color) !important;
}

/* View More button */
.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-view-more-btn,
html.anchorkit-prefers-dark .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-view-more-btn {
    border-color: var(--anchorkit-toc-border-color);
    color: var(--anchorkit-toc-link-color);
}

/* Fallback: Media query for browsers without JavaScript (e.g., if script fails to load) */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-container.anchorkit-toc-theme-system {
        background-color: var(--anchorkit-toc-bg);
        color: var(--anchorkit-toc-text-color);
        border-color: var(--anchorkit-toc-border-color);

    }

    .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-title {
        color: var(--anchorkit-toc-text-color);
    }

    .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link {
        color: var(--anchorkit-toc-link-color);
    }

    .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link:hover {
        color: var(--anchorkit-toc-link-hover-color);
        background-color: var(--anchorkit-toc-hover-bg);
    }

    .anchorkit-toc-container.anchorkit-toc-theme-system .anchorkit-toc-link.anchorkit-toc-active {
        color: var(--anchorkit-toc-active-link-color);
        background-color: var(--anchorkit-toc-focus-bg);
    }
}

/* Mobile Responsive */
/* Hide on Mobile - Hidden via media query below breakpoint */

@media (max-width: 782px) {

    .anchorkit-toc-hide-mobile[data-mobile-breakpoint="782"],
    .anchorkit-toc-hide-mobile:not([data-mobile-breakpoint]) {
        display: none !important;
    }

    .anchorkit-toc-container {
        font-size: 13px;
        padding: 12px;
        /* Prevent TOC from taking up too much screen space on mobile */
        max-height: 70vh;
        display: flex;
        flex-direction: column;
    }

    /* Make TOC list scrollable on mobile */
    .anchorkit-toc-container .anchorkit-toc-list {
        max-height: 60vh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
        padding-right: 8px;
        /* Space for scrollbar */
    }

    /* Style scrollbar for better UX on mobile (Webkit browsers) */
    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar {
        width: 6px;
    }

    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 3px;
    }

    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    /* Keep title fixed when list scrolls */
    .anchorkit-toc-container .anchorkit-toc-title {
        flex-shrink: 0;
        margin-bottom: 12px;
    }

    /* Reduce indentation on mobile for more space */
    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-1 {
        margin-left: 0;
    }

    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-2 {
        margin-left: 12px;
    }

    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-3 {
        margin-left: 24px;
    }

    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-4 {
        margin-left: 36px;
    }

    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-5 {
        margin-left: 48px;
    }

    .anchorkit-toc-container.anchorkit-toc-hierarchical .anchorkit-toc-level-6 {
        margin-left: 60px;
    }

    /* Reduce line height on mobile for more compact display */
    .anchorkit-toc-container .anchorkit-toc-link {
        padding: 8px 4px;
        line-height: 1.5;
        display: inline;
        white-space: normal;
    }

    /* Ensure collapsed state is compact on mobile */
    .anchorkit-toc-container.anchorkit-toc-collapsed {
        padding-bottom: var(--anchorkit-toc-padding, 12px) !important;
    }

    .anchorkit-toc-container.anchorkit-toc-collapsed .anchorkit-toc-list {
        max-height: 0;
        overflow: hidden;
    }

    .anchorkit-toc-container.anchorkit-toc-collapsed .anchorkit-toc-title {
        margin-bottom: 12px !important;
    }
}

/* Tablet responsive styles (783px - 1024px) */
@media (min-width: 783px) and (max-width: 1024px) {
    .anchorkit-toc-container {
        font-size: 14px;
    }

    /* Constrain height on tablets too */
    .anchorkit-toc-container .anchorkit-toc-list {
        max-height: 65vh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Scrollbar for tablets */
    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar {
        width: 8px;
    }

    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 4px;
    }

    .anchorkit-toc-container .anchorkit-toc-list::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }
}

/* Hide on mobile if setting is enabled */
/* Note: The actual mobile breakpoint is now dynamically set via inline styles in PHP */
/* This ensures the user's custom breakpoint value is respected */

/* Accessibility */
.anchorkit-toc-container:focus-within {
    outline: 2px solid var(--anchorkit-toc-link-color, #0073aa);
    outline-offset: 2px;
}

/* Screen reader text */
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
}

/* Target heading highlight effect */
.anchorkit-toc-target-highlight {
    background-color: var(--anchorkit-toc-focus-bg, rgba(0, 115, 170, 0.1));
    transition: background-color 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
    margin: -4px -8px;
}

/* Back to top link */
.anchorkit-toc-back-to-top {
    margin-top: 0px;
    padding-top: 12px;
    border-top: 1px solid var(--anchorkit-toc-border-color, #dddddd);
}

.anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color, #333333);
    text-decoration: none;
    font-size: var(--anchorkit-toc-back-to-top-font-size, 14px);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.anchorkit-toc-back-to-top a:hover {
    opacity: 1;
    color: var(--anchorkit-toc-text-color, #333333);
    text-decoration: none;
}

/* ===============================================
   View More Button (Pro Feature)
   =============================================== */

.anchorkit-toc-view-more-item {
    /* Positioned outside scrollable list - at bottom of TOC container */
    padding: 16px var(--anchorkit-toc-padding, 15px) 8px var(--anchorkit-toc-padding, 15px);
    border-top: 1px solid var(--anchorkit-toc-link-color, #dddddd);
    /* No longer sticky - positioned at bottom of container */
    position: relative;
    /* Background transparent to show gradient */
    background: transparent;
    /* Ensure proper stacking */
    z-index: 1;
}

/* Hide view more button when TOC is collapsed - it's inside the collapsible content */
.anchorkit-toc-container.anchorkit-toc-collapsible.anchorkit-toc-collapsed .anchorkit-toc-view-more-item {
    display: none !important;
}

/* Padding adjustment removed - view more button is now outside the scrollable list */

.anchorkit-toc-view-more-btn {
    display: flex;
    align-items: center;
    /* vertically center chevron + text */
    justify-content: center;
    /* horizontally center content */
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--anchorkit-toc-link-color, #0073aa);
    border-radius: 4px;
    color: var(--anchorkit-toc-link-color, #0073aa);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.anchorkit-toc-view-more-btn:hover {
    background-color: var(--anchorkit-toc-link-color, #0073aa);
    color: #ffffff;
}

.anchorkit-toc-view-more-btn:focus {
    outline: 2px solid var(--anchorkit-toc-link-color, #0073aa);
    outline-offset: 2px;
}

.anchorkit-toc-view-more-icon {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-style: solid;
    border-width: 0 2px 2px 0;
    border-color: currentColor;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    margin-right: 8px;
    /* maintain spacing from text */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.anchorkit-toc-view-more-btn[aria-expanded="true"] .anchorkit-toc-view-more-icon {
    -webkit-transform: rotate(-135deg);
    transform: rotate(-135deg);
}

/* Hidden items - completely remove from layout (must override all other display rules including bullets) */
.anchorkit-toc-hidden-item,
.anchorkit-toc-container .anchorkit-toc-hidden-item,
.anchorkit-toc-container.anchorkit-toc-bullet-disc .anchorkit-toc-hidden-item,
.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-disc .anchorkit-toc-item.anchorkit-toc-hidden-item,
.anchorkit-toc-preset-classic.anchorkit-toc-bullet-disc .anchorkit-toc-item.anchorkit-toc-hidden-item,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-item.anchorkit-toc-hidden-item {
    display: none !important;
}

/* Allow TOC container to expand beyond 50vh when view more is expanded */
.anchorkit-toc-container:has(.anchorkit-toc-view-more-btn[aria-expanded="true"]),
.anchorkit-toc-container.anchorkit-toc-view-more-expanded {
    max-height: calc(100vh - 40px);
}

/* Theme-specific View More button styles */
.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-view-more-btn {
    border-color: #0073aa;
    color: #0073aa;
}

.anchorkit-toc-container.anchorkit-toc-theme-light .anchorkit-toc-view-more-btn:hover {
    background-color: #0073aa;
    color: #ffffff;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-view-more-btn {
    border-color: #59a9ff;
    color: #59a9ff;
}

.anchorkit-toc-container.anchorkit-toc-theme-dark .anchorkit-toc-view-more-btn:hover {
    background-color: #59a9ff;
    color: #1e1e1e;
}

/* ===============================================
   Style Presets
   =============================================== */

/* Minimal Preset - Ultra-clean, borderless, subtle */
.anchorkit-toc-preset-minimal.anchorkit-toc-container {
    background: var(--anchorkit-toc-bg, #f8f9fa);
    border: none;
    border-left: 3px solid var(--anchorkit-toc-border-color, #e0e0e0);
    border-radius: 8px;
    padding: 12px 16px;
}

/* Professional hierarchical numbering removed; rely on PHP-generated spans */
.anchorkit-toc-preset-minimal .anchorkit-toc-list,
.anchorkit-toc-preset-minimal .anchorkit-toc-list-sub {
    list-style: none !important;
    padding-left: 0;
}

.anchorkit-toc-preset-minimal .anchorkit-toc-item {
    list-style: none !important;
    position: relative;
}

/* Disc bullets for minimal preset */
.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-disc .anchorkit-toc-list {
    padding-left: 0;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-disc .anchorkit-toc-item {
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
    /* margin-left is handled by hierarchical styles - don't override */
}

.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-disc .anchorkit-toc-item::before {
    content: "•" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, #0073aa);
    margin-right: var(--anchorkit-toc-bullet-gap, 12px);
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-disc .anchorkit-toc-item::marker {
    display: none !important;
}

/* Ensure preset ignores global bullet styles */
.anchorkit-toc-preset-minimal:not([class*="anchorkit-toc-bullet-"]) .anchorkit-toc-item::before,
.anchorkit-toc-preset-minimal.anchorkit-toc-bullet-none .anchorkit-toc-item::before {
    content: none !important;
    display: none !important;
}

/* Hide old preset numbering when numerals are enabled (redundant safeguard) */
.anchorkit-toc-preset-minimal.anchorkit-toc-numerals a::before {
    content: none !important;
    display: none !important;
}

.anchorkit-toc-preset-minimal .anchorkit-toc-title {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
    margin-bottom: 12px;
    opacity: 0.7;
}

.anchorkit-toc-preset-minimal .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #4a4a4a);
    font-size: 14px;
    padding: 4px 0;
    transition: all 0.2s ease;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-minimal .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #0073aa);
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
    background: transparent;
    padding-left: 8px;
}

.anchorkit-toc-preset-minimal .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #0073aa));
    font-weight: 500;
    background: transparent;
    padding-left: 8px;
}

/* Back to top link styles for minimal preset - higher specificity */
.anchorkit-toc-preset-minimal.anchorkit-toc-container .anchorkit-toc-back-to-top {
    border-top-color: #e0e0e0 !important;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-container .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color, #333333) !important;
    opacity: 0.7;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-container .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-text-color, #333333) !important;
    opacity: 1;
}

/* Dark mode support for minimal (system theme only) */
/* ================================================
   MINIMAL PRESET - DARK MODE (CONSOLIDATED)
   Shared by: explicit dark AND system+dark
   ================================================ */

/* Container */
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling),
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) {
    background: var(--anchorkit-toc-bg, #1a1a1a) !important;
    border-left-color: var(--anchorkit-toc-border-color, #444) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #7ec4ee);
}

/* Title */
/* Title - Dark theme only */
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, #e0e0e0) !important;
    opacity: 0.7;
}

/* Links - Dark theme (explicit dark AND system+dark) */
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link,
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #b8b8b8) !important;
}

/* Link hover & active states - Dark theme (explicit dark AND system+dark) */
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-link-hover-color, #7ec4ee) !important;
    background: transparent;
    padding-left: 8px;
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

/* Back to top - Dark theme only */
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: #444 !important;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color, #b8b8b8) !important;
    opacity: 0.7;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-link-hover-color, #7ec4ee) !important;
    opacity: 1;
}

/* Fallback: Media query for no-JS browsers - container styles only, no link color overrides */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) {
        background: #1a1a1a;
        border-left-color: #444;
    }
}

/* Minimal preset theme overrides for explicit light/dark theme selection */
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling),
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) {
    background: var(--anchorkit-toc-bg, #f8f9fa) !important;
    border-left-color: var(--anchorkit-toc-border-color, #e0e0e0) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #0073aa);
}

.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, #333) !important;
    opacity: 0.7;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #4a4a4a) !important;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-link-hover-color, #0073aa) !important;
}

/* Minimal preset back to top - Light theme */
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: #e0e0e0 !important;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color, #4a4a4a) !important;
}

.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-link-hover-color, #0073aa) !important;
}

/* Minimal View More button - subtle hover (border only, no background fill) */
/* Light theme and system theme (light mode default) */
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #0073aa !important;
    color: #0073aa !important;
}

/* Dark theme */
.anchorkit-toc-preset-minimal.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #7ec4ee !important;
    color: #7ec4ee !important;
}

/* System theme dark mode (JS-detected) */
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
html.anchorkit-prefers-dark .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #7ec4ee !important;
    color: #7ec4ee !important;
}

/* Fallback: Media query for browsers without JavaScript */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) {
        background: #1a1a1a;
        border-left-color: #444;
    }

    .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
    .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active {
        color: #7ec4ee;
    }

    .anchorkit-toc-preset-minimal.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
        background-color: transparent !important;
        border-color: #7ec4ee !important;
        color: #7ec4ee !important;
    }
}

/* Classic Preset - Traditional with serif-inspired elegance */
.anchorkit-toc-preset-classic.anchorkit-toc-container {
    background: var(--anchorkit-toc-bg, #ffffff);
    border: 1px solid var(--anchorkit-toc-border-color, #d4d4d4);
    border-top: 4px solid var(--anchorkit-toc-link-color, #0073aa);
    border-radius: 0;

    padding: 20px;
}

/* Professional hierarchical numbering (1, 1.1, 1.2, etc.) */
.anchorkit-toc-preset-classic .anchorkit-toc-list,
.anchorkit-toc-preset-classic .anchorkit-toc-list-sub {
    list-style: none !important;
    padding-left: 0;
}

.anchorkit-toc-preset-classic .anchorkit-toc-item {
    list-style: none !important;
    position: relative;
}

/* Disc bullets for classic preset */
.anchorkit-toc-preset-classic.anchorkit-toc-bullet-disc .anchorkit-toc-list {
    padding-left: 0;
}

.anchorkit-toc-preset-classic.anchorkit-toc-bullet-disc .anchorkit-toc-item {
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
    /* margin-left is handled by hierarchical styles - don't override */
}

.anchorkit-toc-preset-classic.anchorkit-toc-bullet-disc .anchorkit-toc-item::before {
    content: "•" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, #0073aa);
    margin-right: 10px;
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-preset-classic.anchorkit-toc-bullet-disc .anchorkit-toc-item::marker {
    display: none !important;
}

.anchorkit-toc-preset-classic:not([class*="anchorkit-toc-bullet-"]) .anchorkit-toc-item::before,
.anchorkit-toc-preset-classic.anchorkit-toc-bullet-none .anchorkit-toc-item::before {
    content: none !important;
    display: none !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-numerals a::before {
    content: none !important;
    display: none !important;
}

/* Level 1: 1. 2. 3. */
.anchorkit-toc-preset-classic .anchorkit-toc-level-1 {
    counter-increment: c1;
    counter-reset: c2;
}

.anchorkit-toc-preset-classic .anchorkit-toc-level-1>a::before {
    content: counter(c1) ". ";
    color: #0073aa;
    font-weight: 600;
    margin-right: 8px;
}

/* Level 2: 1.1, 1.2, 2.1, 2.2 */
.anchorkit-toc-preset-classic .anchorkit-toc-level-2 {
    counter-increment: c2;
}

.anchorkit-toc-preset-classic.anchorkit-toc-hierarchical .anchorkit-toc-level-2 {
    padding-left: 16px;
}

.anchorkit-toc-preset-classic .anchorkit-toc-level-2>a::before {
    content: counter(c1) "." counter(c2) " ";
    color: #0073aa;
    font-weight: 500;
    margin-right: 8px;
}

/* Level 3: • bullet */
.anchorkit-toc-preset-classic.anchorkit-toc-hierarchical .anchorkit-toc-level-3 {
    padding-left: 50px;
}

.anchorkit-toc-preset-classic .anchorkit-toc-level-3>a::before {
    content: "•  ";
    color: #999;
    font-weight: normal;
}

/* Level 4: ◦ hollow bullet */
.anchorkit-toc-preset-classic.anchorkit-toc-hierarchical .anchorkit-toc-level-4 {
    padding-left: 70px;
}

.anchorkit-toc-preset-classic .anchorkit-toc-level-4>a::before {
    content: "◦  ";
    color: #999;
    font-weight: normal;
}

.anchorkit-toc-preset-classic .anchorkit-toc-title {
    color: #1a1a1a;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.anchorkit-toc-preset-classic .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #2c3e50);
    font-size: 15px;
    line-height: 1.8;
    padding: 6px 8px;
    display: block;
    border-radius: 4px;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-classic .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #0073aa);
    background: var(--anchorkit-toc-hover-bg, #f8f9fa);
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

.anchorkit-toc-preset-classic .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #0073aa));
    font-weight: 600;
    background: var(--anchorkit-toc-focus-bg, #e8f4f8);
    border-left: 3px solid var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #0073aa));
    padding-left: 13px;
}

/* Back to top link styles for classic preset - higher specificity */
.anchorkit-toc-preset-classic.anchorkit-toc-container .anchorkit-toc-back-to-top {
    border-top-color: #ddd !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-text-color, #333333) !important;
    opacity: 0.7;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-text-color, #333333) !important;
    opacity: 1;
}

/* ================================================
   CLASSIC PRESET - DARK MODE (EXPLICIT DARK THEME ONLY)
   System theme uses base preset colors for consistency
   ================================================ */

/* Container - Dark theme only */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) {
    background: var(--anchorkit-toc-bg, #1e1e1e) !important;
    border-color: var(--anchorkit-toc-border-color, var(--anchorkit-toc-link-color, #404040)) !important;
    border-top-color: var(--anchorkit-toc-link-color, #5ba3d0) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #7ec4ee);
}

/* Title - Dark theme only */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, #e8e8e8) !important;
    border-bottom-color: var(--anchorkit-toc-border-color, #333) !important;
}

/* Numbering colors - H1/H2 - Dark theme only */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-1>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-2>a::before {
    color: #7ec4ee !important;
}

/* Numbering colors - H3/H4 - Dark theme only */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-3>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-4>a::before {
    color: #888 !important;
}

/* Links - Dark theme (explicit dark AND system+dark) */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link,
html.anchorkit-prefers-dark .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #b8b8b8) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
html.anchorkit-prefers-dark .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #7ec4ee) !important;
    background: #2a2a2a !important;
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
html.anchorkit-prefers-dark .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #7ec4ee)) !important;
    background: #2a3a45 !important;
    border-left-color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #7ec4ee)) !important;
}

/* Back to top - Dark theme only */
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color, #404040) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: #e8e8e8 !important;
    opacity: 0.7;
}

.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover {
    color: #7ec4ee !important;
    opacity: 1;
}

/* Fallback: Media query for browsers without JavaScript - container styles only */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) {
        background: #1e1e1e;
        border-color: var(--anchorkit-toc-link-color, #404040) !important;
        border-top-color: #5ba3d0 !important;
    }
}

/* Classic preset theme overrides for explicit light/dark theme selection */
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling),
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) {
    background: var(--anchorkit-toc-bg, #ffffff) !important;
    border-color: var(--anchorkit-toc-border-color, #d4d4d4) !important;
    border-top-color: var(--anchorkit-toc-link-color, #0073aa) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #0073aa);
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, #1a1a1a) !important;
    border-bottom-color: var(--anchorkit-toc-border-color, #f0f0f0) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #2c3e50) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #0073aa) !important;
    background: #f8f9fa !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active {
    color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #0073aa)) !important;
    background: #f0f8ff !important;
    border-left-color: var(--anchorkit-toc-active-link-color, var(--anchorkit-toc-link-hover-color, #0073aa)) !important;
}

/* Classic preset numbering colors for light theme */
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-1>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-2>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-1>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-2>a::before {
    color: #0073aa !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-3>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-4>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-3>a::before,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-level-4>a::before {
    color: #666 !important;
}

/* Classic preset dark theme overrides */
/* Classic preset back to top theme overrides */
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: #d4d4d4 !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: #2c3e50 !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover {
    color: #0073aa !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color, #404040) !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: #b8b8b8 !important;
}

.anchorkit-toc-preset-classic.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a:hover {
    color: #7ec4ee !important;
}

/* Classic View More button - subtle hover (border only, no background fill) */
/* Light theme and system theme (light mode default) */
.anchorkit-toc-preset-classic.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #1a5490 !important;
    color: #1a5490 !important;
}

/* Dark theme */
.anchorkit-toc-preset-classic.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #7ec4ee !important;
    color: #7ec4ee !important;
}

/* System theme dark mode (JS-detected) */
html.anchorkit-prefers-dark .anchorkit-toc-preset-classic.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
html.anchorkit-prefers-dark .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: transparent !important;
    border-color: #7ec4ee !important;
    color: #7ec4ee !important;
}

/* System theme dark mode (CSS media query fallback) */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-preset-classic.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
        background-color: transparent !important;
        border-color: #7ec4ee !important;
        color: #7ec4ee !important;
    }
}

/* Modern Preset - Material Design 3 Inspired */
/* Light Mode - Very light gradient with dark text */
/* Base selector for modern preset without dark theme */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-custom-styling):not(.anchorkit-toc-theme-dark),
/* Explicit light theme */
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling),
/* System theme in light mode */
html.anchorkit-prefers-light .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling),
/* Fallback: any modern preset without explicit dark theme class */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-custom-styling) {
    /* Solid fallback background for Safari compatibility */
    background: var(--anchorkit-toc-bg, #f8f9fc) !important;
    border: 1px solid var(--anchorkit-toc-border-color, rgba(0, 0, 0, 0.1)) !important;
    border-radius: 16px !important;
    padding: 24px !important;
    position: relative;
    overflow: hidden;
    /* Safari gradient rendering fix - must be on container */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* box-shadow: removed - use custom box shadow setting instead */
    /* Material Design 3 color tokens - Light mode */
    --anchorkit-toc-link-color: var(--anchorkit-toc-link-color, #1a73e8);
    --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color, #1557b0);
    --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg, rgba(26, 115, 232, 0.08));
    --anchorkit-toc-text-color: var(--anchorkit-toc-text-color, #1f1f1f);
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #1a73e8);
    --anchorkit-toc-border-color: var(--anchorkit-toc-border-color, rgba(0, 0, 0, 0.1));
    --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg, rgba(26, 115, 232, 0.12));
    --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color, #1557b0);
    color: var(--anchorkit-toc-text-color, #1f1f1f) !important;
}

/* Gradient via pseudo-element for Safari compatibility */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-custom-styling):not(.anchorkit-toc-theme-dark)::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling)::before,
html.anchorkit-prefers-light .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling)::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-custom-styling)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    border-radius: 16px;
    background: -webkit-linear-gradient(135deg, var(--anchorkit-toc-bg, #ffffff) 0%, var(--anchorkit-toc-bg, #f8f9fc) 50%, var(--anchorkit-toc-bg, #f0f4ff) 100%);
    background: linear-gradient(135deg, var(--anchorkit-toc-bg, #ffffff) 0%, var(--anchorkit-toc-bg, #f8f9fc) 50%, var(--anchorkit-toc-bg, #f0f4ff) 100%);
    /* Safari rendering optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Ensure title uses dark text in light mode */
/* Note: Removed generic fallback (.anchorkit-toc-preset-modern .anchorkit-toc-title) as it was overriding dark mode styles */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-custom-styling):not(.anchorkit-toc-theme-dark) .anchorkit-toc-title,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title,
html.anchorkit-prefers-light .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: #1f1f1f !important;
}

/* Professional hierarchical numbering (1, 1.1, 1.2, etc.) */
.anchorkit-toc-preset-modern .anchorkit-toc-list,
.anchorkit-toc-preset-modern .anchorkit-toc-list-sub {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.anchorkit-toc-preset-modern .anchorkit-toc-item {
    list-style: none !important;
    position: relative;
}

/* Disc bullets for modern preset */
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-list {
    padding-left: 0;
}

.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-item {
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
    /* margin-left is handled by hierarchical styles - don't override */
}

.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-item::before {
    content: "•" !important;
    display: inline-block !important;
    color: var(--anchorkit-toc-bullet-color, #ffffff);
    margin-right: var(--anchorkit-toc-bullet-gap, 12px);
    flex-shrink: 0 !important;
    vertical-align: middle;
    line-height: 1;
}

.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-item::marker {
    display: none !important;
}

.anchorkit-toc-preset-modern:not([class*="anchorkit-toc-bullet-"]) .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-none .anchorkit-toc-item::before {
    content: none !important;
    display: none !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-numerals a::before {
    content: none !important;
    display: none !important;
}

/* Level 1: 1. 2. 3. */
.anchorkit-toc-preset-modern .anchorkit-toc-level-1 {
    counter-increment: c1;
    counter-reset: c2;
}

.anchorkit-toc-preset-modern .anchorkit-toc-level-1>a::before {
    content: counter(c1) ". ";
    color: var(--anchorkit-toc-link-color, #1a73e8);
    font-weight: 600;
    margin-right: 8px;
}

/* Level 2: 1.1, 1.2, 2.1, 2.2 */
.anchorkit-toc-preset-modern .anchorkit-toc-level-2 {
    counter-increment: c2;
}

.anchorkit-toc-preset-modern.anchorkit-toc-hierarchical .anchorkit-toc-level-2 {
    padding-left: 24px;
}

.anchorkit-toc-preset-modern .anchorkit-toc-level-2>a::before {
    content: counter(c1) "." counter(c2) " ";
    color: var(--anchorkit-toc-link-color, #1a73e8);
    font-weight: 500;
    margin-right: 8px;
    opacity: 0.8;
}

/* Level 3: • bullet */
.anchorkit-toc-preset-modern.anchorkit-toc-hierarchical .anchorkit-toc-level-3 {
    padding-left: 48px;
}

.anchorkit-toc-preset-modern .anchorkit-toc-level-3>a::before {
    content: "• ";
    color: var(--anchorkit-toc-link-color, #1a73e8);
    font-weight: normal;
    margin-right: 8px;
    opacity: 0.6;
}

/* Level 4: ◦ hollow bullet */
.anchorkit-toc-preset-modern.anchorkit-toc-hierarchical .anchorkit-toc-level-4 {
    padding-left: 72px;
}

.anchorkit-toc-preset-modern .anchorkit-toc-level-4>a::before {
    content: "◦ ";
    color: var(--anchorkit-toc-link-color, #1a73e8);
    font-weight: normal;
    margin-right: 8px;
    opacity: 0.5;
}

.anchorkit-toc-preset-modern .anchorkit-toc-title {
    color: var(--anchorkit-toc-text-color, #1f1f1f) !important;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

.anchorkit-toc-preset-modern .anchorkit-toc-link {
    color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    padding: 8px 12px;
    max-width: 90%;
    margin: 4px;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-modern .anchorkit-toc-link:hover {
    color: var(--anchorkit-toc-link-hover-color, #1557b0) !important;
    background: var(--anchorkit-toc-hover-bg, rgba(26, 115, 232, 0.08));
    -webkit-transform: translateX(2px);
    transform: translateX(2px);
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

.anchorkit-toc-preset-modern .anchorkit-toc-link:visited {
    color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-modern .anchorkit-toc-link.active,
.anchorkit-toc-preset-modern .anchorkit-toc-link.anchorkit-toc-active {
    color: var(--anchorkit-toc-link-hover-color, #1557b0) !important;
    font-weight: 600;
    background: rgba(26, 115, 232, 0.12);
    border-left: 3px solid var(--anchorkit-toc-link-color, #1a73e8);
    padding-left: 9px;
}

.anchorkit-toc-preset-modern .anchorkit-toc-toggle-button {
    color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    transition: all 0.2s ease;
}

.anchorkit-toc-preset-modern .anchorkit-toc-toggle-button:hover {
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

.anchorkit-toc-preset-modern .anchorkit-toc-toggle-icon {
    border-color: var(--anchorkit-toc-link-color, #1a73e8);
}

/* View More button styles for modern preset - higher specificity to override theme defaults */
.anchorkit-toc-preset-modern.anchorkit-toc-container .anchorkit-toc-view-more-btn {
    border-color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    background: transparent !important;
    border-radius: 8px !important;
    font-weight: 500;
}

/* Modern View More Item adjustment for consistent padding */
.anchorkit-toc-preset-modern .anchorkit-toc-view-more-item {
    padding: 12px var(--anchorkit-toc-padding, 15px) 16px var(--anchorkit-toc-padding, 15px) !important;
    border-top-color: var(--anchorkit-toc-link-color, rgba(0, 0, 0, 0.1)) !important;
    background: transparent !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: var(--anchorkit-toc-hover-bg, rgba(26, 115, 232, 0.08)) !important;
    border-color: var(--anchorkit-toc-link-hover-color, #1557b0) !important;
    color: var(--anchorkit-toc-link-hover-color, #1557b0) !important;
}

/* Custom styling hover: inverted colors for contrast (filled button effect) */
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-custom-styling .anchorkit-toc-view-more-btn:hover {
    background-color: var(--anchorkit-toc-link-color) !important;
    border-color: var(--anchorkit-toc-link-color) !important;
    color: var(--anchorkit-toc-bg) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container .anchorkit-toc-view-more-btn:focus {
    outline-color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    background-color: var(--anchorkit-toc-hover-bg, rgba(26, 115, 232, 0.08)) !important;
}

/* Back to top link styles for modern preset - higher specificity to override theme defaults */
.anchorkit-toc-preset-modern.anchorkit-toc-container .anchorkit-toc-back-to-top {
    border-top-color: var(--anchorkit-toc-link-color, #e0e3eb) !important;
    margin-top: 8px !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-link-color, #1a73e8) !important;
    font-weight: 500;
    opacity: 0.7;
    transition: all 0.2s ease;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-link-hover-color, #1557b0) !important;
    opacity: 1;
    -webkit-transform: translateX(-2px);
    transform: translateX(-2px);
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

/* ================================================
   MODERN PRESET - DARK MODE
   Dark gradient with white text
   Applies when prefers-color-scheme: dark AND no theme class (system theme)
   ================================================ */
/* ================================================
   MODERN PRESET - DARK MODE (CONSOLIDATED)
   Shared by: explicit dark AND system+dark
   ================================================ */

/* Container - gradient, border, colors */
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling),
html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) {
    /* Solid fallback background for Safari compatibility */
    background: var(--anchorkit-toc-bg, #161b22) !important;
    border: 1px solid var(--anchorkit-toc-border-color, rgba(88, 166, 255, 0.2)) !important;
    /* box-shadow: removed - use custom box shadow setting instead */
    color: var(--anchorkit-toc-text-color, #f0f6fc) !important;
    /* Safari rendering optimization - required for ::before pseudo-element */
    position: relative !important;
    overflow: hidden !important;
    /* Safari gradient rendering fix - must be on container */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    /* GitHub-inspired dark mode with high contrast */
    --anchorkit-toc-link-color: var(--anchorkit-toc-link-color, #58a6ff);
    --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color, #79c0ff);
    --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg, rgba(88, 166, 255, 0.15));
    --anchorkit-toc-text-color: var(--anchorkit-toc-text-color, #f0f6fc);
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color, #58a6ff);
    --anchorkit-toc-border-color: var(--anchorkit-toc-border-color, rgba(88, 166, 255, 0.2));
    --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg, rgba(88, 166, 255, 0.2));
    --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color, #79c0ff);
}

/* Dark mode gradient via pseudo-element for Safari compatibility */
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling)::before,
html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling)::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: -1 !important;
    border-radius: inherit !important;
    background: -webkit-linear-gradient(135deg, var(--anchorkit-toc-bg, #0d1117) 0%, var(--anchorkit-toc-bg, #161b22) 50%, var(--anchorkit-toc-bg, #1c2128) 100%) !important;
    background: linear-gradient(135deg, var(--anchorkit-toc-bg, #0d1117) 0%, var(--anchorkit-toc-bg, #161b22) 50%, var(--anchorkit-toc-bg, #1c2128) 100%) !important;
    /* Safari rendering optimization */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
}

/* Dark mode system theme - title, links, and other elements */
html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: #f0f6fc !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: #58a6ff !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.15) !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.anchorkit-toc-active {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.18) !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-toggle-button {
    color: #58a6ff !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn {
    border-color: rgba(88, 166, 255, 0.4) !important;
    color: #58a6ff !important;
    background: transparent !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: rgba(88, 166, 255, 0.15) !important;
    border-color: #79c0ff !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: rgba(88, 166, 255, 0.2) !important;
}

html.anchorkit-prefers-dark .anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-system:not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top a {
    color: #58a6ff !important;
}

/* Dark mode title - white text (only when no theme class at all AND no custom styling) */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: #f0f6fc !important;
}

/* Dark mode links - bright blue (only when no theme class at all AND no custom styling) */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: #58a6ff !important;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.15) !important;
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.anchorkit-toc-active {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.18) !important;
    border-left-color: #58a6ff !important;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

/* Dark mode View More button (only when no theme class at all AND no custom styling) */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn {
    border-color: rgba(88, 166, 255, 0.4) !important;
    color: #58a6ff !important;
    background: transparent !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background-color: rgba(88, 166, 255, 0.15) !important;
    border-color: #79c0ff !important;
}

/* Custom styling override for system theme modern preset */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system).anchorkit-toc-custom-styling .anchorkit-toc-view-more-btn:hover {
    background-color: var(--anchorkit-toc-link-color) !important;
    border-color: var(--anchorkit-toc-link-color) !important;
    color: var(--anchorkit-toc-bg) !important;
}

/* Dark mode Back to Top (only when no theme class at all) */
.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system):not(.anchorkit-toc-custom-styling) .anchorkit-toc-back-to-top {
    border-top-color: rgba(88, 166, 255, 0.2) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system) .anchorkit-toc-back-to-top a {
    color: var(--anchorkit-toc-link-color, #58a6ff) !important;
    opacity: 0.7;
    text-decoration: var(--anchorkit-toc-link-decoration, none) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-container:not(.anchorkit-toc-theme-light):not(.anchorkit-toc-theme-dark):not(.anchorkit-toc-theme-system) .anchorkit-toc-back-to-top a:hover {
    color: var(--anchorkit-toc-link-hover-color, #79c0ff) !important;
    opacity: 1;
    text-decoration: var(--anchorkit-toc-link-decoration-hover, none) !important;
}

/* ===============================================
   MODERN PRESET - THEME CLASS OVERRIDES
   Ensure Modern preset design applies regardless of theme class
   =============================================== */

/* Override light theme class for Modern preset - Apply new clean design */
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling),
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling) {
    /* Solid fallback background for Safari compatibility */
    background: #f8f9fc !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #1f1f1f !important;
    /* Safari gradient rendering fix - must be on container */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    --anchorkit-toc-text-color: #1f1f1f;
    --anchorkit-toc-link-color: #1a73e8;
    --anchorkit-toc-link-hover-color: #1557b0;
    --anchorkit-toc-bullet-color: #1a73e8;
}

/* Light theme gradient via pseudo-element for Safari compatibility */
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling)::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light:not(.anchorkit-toc-custom-styling)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    border-radius: inherit;
    background: -webkit-linear-gradient(135deg, #ffffff 0%, #f8f9fc 50%, #f0f4ff 100%);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 50%, #f0f4ff 100%);
    /* Safari rendering optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Override dark theme class for Modern preset - Apply new gradient design */
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling),
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) {
    /* Solid fallback background for Safari compatibility */
    background: #161b22 !important;
    border: 1px solid rgba(88, 166, 255, 0.2) !important;
    border-radius: 16px;
    padding: 24px;
    color: #f0f6fc !important;
    /* Safari rendering optimization - required for ::before pseudo-element */
    position: relative !important;
    overflow: hidden !important;
    /* Safari gradient rendering fix - must be on container */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    --anchorkit-toc-text-color: #f0f6fc;
    --anchorkit-toc-link-color: #58a6ff;
    --anchorkit-toc-link-hover-color: #79c0ff;
    --anchorkit-toc-bullet-color: #58a6ff;
    --anchorkit-toc-hover-bg: rgba(88, 166, 255, 0.15);
    --anchorkit-toc-border-color: rgba(88, 166, 255, 0.2);
    --anchorkit-toc-focus-bg: rgba(88, 166, 255, 0.2);
    --anchorkit-toc-active-link-color: #79c0ff;
}

/* Dark theme gradient via pseudo-element for Safari compatibility */
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling)::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling)::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: -1 !important;
    border-radius: inherit !important;
    background: -webkit-linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1c2128 100%) !important;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1c2128 100%) !important;
    /* Safari rendering optimization */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-title {
    color: #f0f6fc !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link {
    color: #58a6ff !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link:hover {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.15) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.anchorkit-toc-active,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.active,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-link.anchorkit-toc-active {
    color: #79c0ff !important;
    background: rgba(88, 166, 255, 0.18) !important;
    border-left-color: #58a6ff !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-toggle-button,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-toggle-button {
    color: #58a6ff !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn {
    border-color: rgba(88, 166, 255, 0.4) !important;
    color: #58a6ff !important;
    background: rgba(88, 166, 255, 0.08) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark:not(.anchorkit-toc-custom-styling) .anchorkit-toc-view-more-btn:hover {
    background: rgba(88, 166, 255, 0.15) !important;
}

/* System theme (no class) - Responds to OS preference via media queries */
/* The base Modern preset styles above handle light mode by default */
/* The media query below handles dark mode automatically */

/* Modern preset should respect custom bullet color via CSS variable */
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-disc .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-circle .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-square .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-custom .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-check .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-star .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before {
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa)) !important;
}

/* Override bullet colors for Modern preset with theme classes */
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-disc .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-circle .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-square .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-custom .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-check .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-star .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-light.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-disc .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-circle .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-square .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-custom .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-check .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-star .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-light.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before {
    color: var(--anchorkit-toc-bullet-color, var(--anchorkit-toc-link-color, #0073aa)) !important;
}

.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-disc .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-circle .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-square .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-custom .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-check .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-star .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-theme-dark.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-disc .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-circle .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-square .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-custom .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-arrow .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-chevron .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-check .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-star .anchorkit-toc-item::before,
.anchorkit-toc-preset-modern.anchorkit-toc-container.anchorkit-toc-theme-dark.anchorkit-toc-bullet-custom_character .anchorkit-toc-item::before {
    color: var(--anchorkit-toc-bullet-color, #ffffff) !important;
}

/* ==========================================================================
   PRO FEATURE: Sticky/Fixed Positioning
   ========================================================================== */

/* Fix Elementor widget container interference with sticky positioning */
/* Elementor wraps widgets in containers that may have overflow properties */
/* that prevent position:sticky from working correctly */
.elementor-widget-container:has(> .anchorkit-toc-sticky) {
    overflow: visible !important;
}

/* Fallback for browsers that don't support :has() */
.elementor-widget-anchorkit-toc .elementor-widget-container {
    overflow: visible !important;
}

/* Fix modern preset overflow conflict with sticky positioning */
/* Modern preset applies overflow: hidden which breaks position: sticky */
.anchorkit-toc-sticky.anchorkit-toc-preset-modern {
    overflow: visible !important;
    position: sticky !important;
    /* Ensure sticky takes precedence over preset's relative */
}

/* COMPREHENSIVE ELEMENTOR STICKY FIX */
/* For sticky to work in Elementor, ALL parent containers must have overflow: visible */
/* and the sticky element must have enough scroll space */

/* Fix inner container */
.elementor-widget-anchorkit-toc .e-con-inner {
    overflow: visible !important;
}

/* Fix Elementor containers */
.elementor-widget-anchorkit-toc.elementor-widget {
    overflow: visible !important;
}

/* The TOC widget section itself should be sticky when enabled */
.anchorkit-toc-elementor.anchorkit-toc-sticky.anchorkit-toc-sticky-content {
    position: sticky !important;
    align-self: flex-start;
    /* Prevent stretching in flex containers */
}

/* Ensure the TOC has a solid background when sticky (prevents see-through) */
.anchorkit-toc-elementor.anchorkit-toc-sticky {
    background: inherit;
    /* Inherit from TOC container styles */
}

/* If background is transparent, provide fallback */
.anchorkit-toc-elementor.anchorkit-toc-sticky:not([style*="background"]) {
    background: #ffffff;
}

.anchorkit-toc-elementor.anchorkit-toc-sticky-left,
.anchorkit-toc-elementor.anchorkit-toc-sticky-right {
    align-self: auto;
}

/* Add visual separation when sticky (box-shadow removed per user request) */

/* Base sticky styles */

/* In-content sticky (default - stays where TOC naturally appears) */
.anchorkit-toc-sticky-content {
    /* Sticky in natural position within content flow */
    position: sticky;
    top: 20px;
    /* Removed will-change - Safari handles sticky better without it */
    /* Width is controlled by inline styles when wrapper is removed */
}

/* Sidebar positions (left/right) - floating sidebars */
.anchorkit-toc-sticky-left,
.anchorkit-toc-sticky-right {
    position: fixed !important;
    z-index: 999;
    /* max-width and min-width are set via inline styles from settings */
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 8px;
    animation: anchorkit-toc-fade-in 0.3s ease-out;
}

/* Sticky sidebars use narrower width */
.anchorkit-toc-sticky-left,
.anchorkit-toc-sticky-right {
    max-width: 360px;
}

.anchorkit-toc-sticky-left {
    left: 20px;
    right: auto !important;
    top: 20px;
}

.anchorkit-toc-sticky-right {
    right: 20px;
    left: auto !important;
    top: 20px;
}

/* Fix bullet points and text alignment for sticky sidebars */
.anchorkit-toc-sticky-left .anchorkit-toc-item,
.anchorkit-toc-sticky-right .anchorkit-toc-item {
    display: flex !important;
    align-items: baseline !important;
    margin: 0 !important;
}

.anchorkit-toc-sticky-left .anchorkit-toc-link,
.anchorkit-toc-sticky-right .anchorkit-toc-link {
    display: inline-flex !important;
    align-items: baseline !important;
    flex: 1;
}

/* Ensure hidden items stay hidden even with sticky sidebar overrides */
.anchorkit-toc-sticky-left .anchorkit-toc-item.anchorkit-toc-hidden-item,
.anchorkit-toc-sticky-right .anchorkit-toc-item.anchorkit-toc-hidden-item {
    display: none !important;
}

/* Ensure proper list styling */
.anchorkit-toc-sticky-left .anchorkit-toc-list,
.anchorkit-toc-sticky-right .anchorkit-toc-list {
    margin: 0;
    padding: 0;
    width: auto;
}

/* Remove extra indentation for sticky sidebars */
.anchorkit-toc-sticky-left:not(.anchorkit-toc-hierarchical) .anchorkit-toc-list,
.anchorkit-toc-sticky-right:not(.anchorkit-toc-hierarchical) .anchorkit-toc-list {
    padding-left: 16px !important;
}

/* Smooth fade-in animation for sticky TOC */
@keyframes anchorkit-toc-fade-in {
    from {
        opacity: 0;
        -webkit-transform: translateY(-10px);
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/* Custom scrollbar for sticky sidebar TOC */
.anchorkit-toc-sticky-left .anchorkit-toc-list,
.anchorkit-toc-sticky-right .anchorkit-toc-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.anchorkit-toc-sticky-left .anchorkit-toc-list::-webkit-scrollbar,
.anchorkit-toc-sticky-right .anchorkit-toc-list::-webkit-scrollbar {
    width: 6px;
}

.anchorkit-toc-sticky-left .anchorkit-toc-list::-webkit-scrollbar-track,
.anchorkit-toc-sticky-right .anchorkit-toc-list::-webkit-scrollbar-track {
    background: transparent;
}

.anchorkit-toc-sticky-left .anchorkit-toc-list::-webkit-scrollbar-thumb,
.anchorkit-toc-sticky-right .anchorkit-toc-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.anchorkit-toc-sticky-left .anchorkit-toc-list::-webkit-scrollbar-thumb:hover,
.anchorkit-toc-sticky-right .anchorkit-toc-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Responsive behavior for sticky sidebar */
@media screen and (max-width: 1023px) {

    .anchorkit-toc-sticky-left,
    .anchorkit-toc-sticky-right {
        display: none !important;
    }
}

/* ========================================
   PRO FEATURE: Entrance Animations
   ======================================== */

/* Base animation state - hidden before animation triggers */
.anchorkit-toc-entrance-animation {
    opacity: 0;
}

/* Fade Animation - Smooth and elegant */
@keyframes anchorkit-fade-in {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.anchorkit-toc-entrance-animation.anchorkit-toc-animate-fade {
    animation: anchorkit-fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide Up Animation - Smooth rise with subtle bounce */
@keyframes anchorkit-slide-up {
    0% {
        opacity: 0;
        -webkit-transform: translateY(40px);
        transform: translateY(40px);
    }

    60% {
        opacity: 1;
        -webkit-transform: translateY(-4px);
        transform: translateY(-4px);
    }

    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide-up {
    animation: anchorkit-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide In Animation - Horizontal slide from left */
@keyframes anchorkit-slide-in {
    0% {
        opacity: 0;
        -webkit-transform: translateX(-40px);
        transform: translateX(-40px);
    }

    60% {
        opacity: 1;
        -webkit-transform: translateX(4px);
        transform: translateX(4px);
    }

    100% {
        opacity: 1;
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}

.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide-in {
    animation: anchorkit-slide-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Legacy support for 'slide' value */
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide {
    animation: anchorkit-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Zoom Animation - Premium scale effect with slight rotation */
@keyframes anchorkit-zoom-in {
    0% {
        opacity: 0;
        -webkit-transform: scale(0.85) rotate(-2deg);
        transform: scale(0.85) rotate(-2deg);
    }

    60% {
        opacity: 1;
        -webkit-transform: scale(1.02) rotate(0deg);
        transform: scale(1.02) rotate(0deg);
    }

    100% {
        opacity: 1;
        -webkit-transform: scale(1) rotate(0deg);
        transform: scale(1) rotate(0deg);
    }
}

.anchorkit-toc-entrance-animation.anchorkit-toc-animate-zoom {
    animation: anchorkit-zoom-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Ensure transforms don't affect layout (will-change removed) */

/* Apply will-change only during active animations for better Safari performance */
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-fade,
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide,
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide-up,
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-slide-in,
.anchorkit-toc-entrance-animation.anchorkit-toc-animate-zoom {
    will-change: transform, opacity;
    animation-fill-mode: forwards;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .anchorkit-toc-entrance-animation {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ========================================
   WIDGET-SPECIFIC STYLES
   ======================================== */

/* Widget container adjustments */
.widget.anchorkit-toc-widget {
    margin-bottom: 20px;
}

.widget.anchorkit-toc-widget .widget-title {
    margin-bottom: 15px;
}

/* Widget TOC Container - Adjust for sidebar context */
.anchorkit-toc-widget-container {
    margin: 0 0 15px 0;
    /* Make widget TOC more compact for sidebars */
    font-size: 13px;
}

.anchorkit-toc-widget-container .anchorkit-toc-title {
    font-size: 15px;
    margin-bottom: 10px;
}

/* Adjust spacing for widget context */
.anchorkit-toc-widget-container .anchorkit-toc-item {
    line-height: 1.5;
}

.anchorkit-toc-widget-container .anchorkit-toc-link {
    padding: 6px 0;
    font-size: 13px;
}

/* Widget TOC scrolling - reduced max height for sidebars */
.anchorkit-toc-widget-container .anchorkit-toc-list {
    max-height: 60vh;
}

/* Ensure widget TOC is responsive on mobile */
@media (max-width: 782px) {
    .anchorkit-toc-widget-container {
        font-size: 12px;
    }

    .anchorkit-toc-widget-container .anchorkit-toc-title {
        font-size: 14px;
    }

    .anchorkit-toc-widget-container .anchorkit-toc-link {
        font-size: 12px;
        padding: 5px 0;
    }
}

.anchorkit-toc-container .anchorkit-toc-heading-level-2>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h2-font-size, inherit);
}

.anchorkit-toc-container .anchorkit-toc-heading-level-3>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h3-font-size, inherit);
}

.anchorkit-toc-container .anchorkit-toc-heading-level-4>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h4-font-size, inherit);
}

.anchorkit-toc-container .anchorkit-toc-heading-level-5>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h5-font-size, inherit);
}

.anchorkit-toc-container .anchorkit-toc-heading-level-6>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h6-font-size, inherit);
}

/* ================================================
   INSTANCE-SPECIFIC THEME SWITCHING (CUSTOM STYLING ONLY)
   Uses inline CSS variables (-light/-dark) set on element
   to enable per-instance color customization without <style> tags.

   IMPORTANT: Only applies to .anchorkit-toc-custom-styling elements!
   Presets have their own hardcoded colors and should NOT be affected
   by these CSS variable overrides.
   ================================================ */

/* Light theme: Use -light variants when available if instance styling is applied */
.anchorkit-toc-container.anchorkit-toc-theme-light[data-anchorkit-instance] {
    --anchorkit-toc-bg: var(--anchorkit-toc-bg-light, #ffffff) !important;
    --anchorkit-toc-text-color: var(--anchorkit-toc-text-color-light, #333333) !important;
    --anchorkit-toc-link-color: var(--anchorkit-toc-link-color-light, #0073AA) !important;
    --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color-light, #005177) !important;
    --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color-light, #00A0D2) !important;
    --anchorkit-toc-border-color: var(--anchorkit-toc-border-color-light, #DDDDDD) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color-light, #0073AA) !important;
    --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg-light, rgba(0, 0, 0, 0.04)) !important;
    --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg-light, rgba(0, 0, 0, 0.08)) !important;
}

/* Dark theme: Use -dark variants when available if instance styling is applied */
.anchorkit-toc-container.anchorkit-toc-theme-dark[data-anchorkit-instance] {
    --anchorkit-toc-bg: var(--anchorkit-toc-bg-dark, var(--anchorkit-toc-bg, #1e1e1e)) !important;
    --anchorkit-toc-text-color: var(--anchorkit-toc-text-color-dark, var(--anchorkit-toc-text-color, #e5e5e5)) !important;
    --anchorkit-toc-link-color: var(--anchorkit-toc-link-color-dark, var(--anchorkit-toc-link-color, #59a9ff)) !important;
    --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color-dark, var(--anchorkit-toc-link-hover-color, #a3c8ff)) !important;
    --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color-dark, var(--anchorkit-toc-active-link-color, #ffffff)) !important;
    --anchorkit-toc-border-color: var(--anchorkit-toc-border-color-dark, var(--anchorkit-toc-border-color, #444444)) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color-dark, var(--anchorkit-toc-bullet-color, #59a9ff)) !important;
    --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg-dark, var(--anchorkit-toc-hover-bg, rgba(255, 255, 255, 0.08))) !important;
    --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg-dark, var(--anchorkit-toc-focus-bg, rgba(255, 255, 255, 0.12))) !important;
}

/* System theme: Light by default, picks up suffixed variables */
.anchorkit-toc-container.anchorkit-toc-theme-system[data-anchorkit-instance] {
    --anchorkit-toc-bg: var(--anchorkit-toc-bg-light, #ffffff) !important;
    --anchorkit-toc-text-color: var(--anchorkit-toc-text-color-light, #333333) !important;
    --anchorkit-toc-link-color: var(--anchorkit-toc-link-color-light, #0073AA) !important;
    --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color-light, #005177) !important;
    --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color-light, #00A0D2) !important;
    --anchorkit-toc-border-color: var(--anchorkit-toc-border-color-light, #DDDDDD) !important;
    --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color-light, #0073AA) !important;
    --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg-light, rgba(0, 0, 0, 0.04)) !important;
    --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg-light, rgba(0, 0, 0, 0.08)) !important;
}

/* System theme: Dark when user prefers dark mode, switches to -dark variants */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-container.anchorkit-toc-theme-system[data-anchorkit-instance] {
        --anchorkit-toc-bg: var(--anchorkit-toc-bg-dark, #1e1e1e) !important;
        --anchorkit-toc-text-color: var(--anchorkit-toc-text-color-dark, #e5e5e5) !important;
        --anchorkit-toc-link-color: var(--anchorkit-toc-link-color-dark, #59a9ff) !important;
        --anchorkit-toc-link-hover-color: var(--anchorkit-toc-link-hover-color-dark, #a3c8ff) !important;
        --anchorkit-toc-active-link-color: var(--anchorkit-toc-active-link-color-dark, #ffffff) !important;
        --anchorkit-toc-border-color: var(--anchorkit-toc-border-color-dark, #444444) !important;
        --anchorkit-toc-bullet-color: var(--anchorkit-toc-bullet-color-dark, #59a9ff) !important;
        --anchorkit-toc-hover-bg: var(--anchorkit-toc-hover-bg-dark, rgba(255, 255, 255, 0.08)) !important;
        --anchorkit-toc-focus-bg: var(--anchorkit-toc-focus-bg-dark, rgba(255, 255, 255, 0.12)) !important;
    }
}

/* 
 * Custom Styling Overrides & variable mappings
 * These rules enable the PHP integration to pass custom values via CSS variables
 * cleanly, supporting media queries and high-specificity overrides without inline CSS blocks.
 */

/* Theme-aware Box Shadow Logic */
.anchorkit-toc-container {
    /* Default to light shadow or fallback to none */
    --anchorkit-toc-active-shadow: var(--anchorkit-toc-shadow-light, none);
    box-shadow: var(--anchorkit-toc-active-shadow) !important;
}

/* Apply Dark Shadow in Dark Mode (System) */
@media (prefers-color-scheme: dark) {
    .anchorkit-toc-container:not(.anchorkit-toc-theme-light) {
        --anchorkit-toc-active-shadow: var(--anchorkit-toc-shadow-dark, var(--anchorkit-toc-shadow-light, none));
    }
}

/* Apply Dark Shadow in Explicit Dark Mode */
.anchorkit-toc-container.anchorkit-toc-theme-dark {
    --anchorkit-toc-active-shadow: var(--anchorkit-toc-shadow-dark, var(--anchorkit-toc-shadow-light, none));
}

/* Apply Light Shadow in Explicit Light Mode (overrides system dark preference) */
.anchorkit-toc-container.anchorkit-toc-theme-light {
    --anchorkit-toc-active-shadow: var(--anchorkit-toc-shadow-light, none);
}

/* Typography Overrides */
.anchorkit-toc-container .anchorkit-toc-title {
    font-size: var(--anchorkit-toc-title-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-heading-level-2>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h2-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-heading-level-3>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h3-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-heading-level-4>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h4-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-heading-level-5>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h5-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-heading-level-6>.anchorkit-toc-link {
    font-size: var(--anchorkit-toc-h6-font-size) !important;
}

.anchorkit-toc-container .anchorkit-toc-back-to-top a {
    font-size: var(--anchorkit-toc-back-to-top-font-size) !important;
}