/** * Table of Contents Styles * * Styles for the automatic table of contents component. * Includes responsive design and smooth animations. * * @package Apus_Theme * @since 1.0.0 */ /* ======================================== Table of Contents Container ======================================== */ .apus-toc { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 1.5rem; margin: 2rem 0; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); position: sticky; top: 5.5rem; z-index: 10; } .apus-toc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 2px solid #dee2e6; } .apus-toc-title { font-size: 1.25rem; font-weight: 600; color: #212529; margin: 0; line-height: 1.2; } /* ======================================== Toggle Button ======================================== */ .apus-toc-toggle { background: none; border: none; padding: 0.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #6c757d; transition: color 0.2s ease; width: 32px; height: 32px; border-radius: 4px; } .apus-toc-toggle:hover { color: #212529; background-color: rgba(0, 0, 0, 0.05); } .apus-toc-toggle:focus { outline: 2px solid #0d6efd; outline-offset: 2px; } .toggle-icon { width: 16px; height: 16px; position: relative; display: block; } .toggle-icon::before, .toggle-icon::after { content: ''; position: absolute; background-color: currentColor; transition: transform 0.3s ease; } .toggle-icon::before { width: 16px; height: 2px; top: 7px; left: 0; } .toggle-icon::after { width: 2px; height: 16px; top: 0; left: 7px; } .apus-toc-toggle[aria-expanded="false"] .toggle-icon::after { transform: rotate(90deg); } /* ======================================== Table of Contents List ======================================== */ .apus-toc-list { list-style: none; counter-reset: toc-counter; margin: 0; padding: 0; max-height: 600px; overflow-y: auto; transition: max-height 0.3s ease, opacity 0.3s ease; } .apus-toc-toggle[aria-expanded="false"] + .apus-toc-list, .apus-toc-toggle[aria-expanded="false"] ~ .apus-toc-list { max-height: 0; opacity: 0; overflow: hidden; } .apus-toc-item { position: relative; margin-bottom: 0.5rem; counter-increment: toc-counter; } .apus-toc-item:last-child { margin-bottom: 0; } /* ======================================== Numbering System ======================================== */ /* H2 Level (Primary) */ .apus-toc-item.apus-toc-level-2::before { content: counter(toc-counter) ". "; font-weight: 600; color: #495057; margin-right: 0.5rem; } /* H3 Level (Secondary) - Nested */ .apus-toc-sublist { list-style: none; counter-reset: toc-subcounter; margin: 0.5rem 0 0.5rem 1.5rem; padding: 0; } .apus-toc-sublist .apus-toc-item { counter-increment: toc-subcounter; } .apus-toc-sublist .apus-toc-item.apus-toc-level-3::before { content: counter(toc-counter) "." counter(toc-subcounter) " "; font-weight: 500; color: #6c757d; margin-right: 0.5rem; } /* ======================================== Links ======================================== */ .apus-toc-link { color: #212529; text-decoration: none; display: block; transition: color 0.2s ease, transform 0.2s ease, border-color 0.2s ease; line-height: 1.5; position: relative; padding: 0.25rem 0 0.25rem 1rem; border-left: 3px solid transparent; margin-left: -1rem; } .apus-toc-link:hover { color: #0d6efd; transform: translateX(4px); } .apus-toc-link:focus { outline: 2px solid #0d6efd; outline-offset: 2px; border-radius: 2px; } /* Active link highlighting - Issue #55 */ .apus-toc-link.active { color: #0d6efd; font-weight: 600; border-left-color: #0d6efd; } /* ======================================== Responsive Design ======================================== */ /* Tablets and smaller */ @media (max-width: 768px) { .apus-toc { padding: 1rem; margin: 1.5rem 0; } .apus-toc-title { font-size: 1.1rem; } .apus-toc-list { max-height: 400px; } .apus-toc-sublist { margin-left: 1rem; } } /* Mobile */ @media (max-width: 480px) { .apus-toc { padding: 0.875rem; margin: 1rem 0; } .apus-toc-title { font-size: 1rem; } .apus-toc-link { font-size: 0.9rem; } .apus-toc-list { max-height: 300px; font-size: 0.9rem; } .apus-toc-sublist { margin-left: 0.75rem; } } /* ======================================== Print Styles ======================================== */ @media print { .apus-toc-toggle { display: none; } .apus-toc-list { max-height: none !important; opacity: 1 !important; } .apus-toc-link { color: #000; } .apus-toc { box-shadow: none; border: 1px solid #000; page-break-inside: avoid; } } /* ======================================== Accessibility ======================================== */ .screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important; } .screen-reader-text:focus { background-color: #f1f1f1; border-radius: 3px; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto !important; clip-path: none; color: #21759b; display: block; font-size: 0.875rem; font-weight: 600; height: auto; left: 5px; line-height: normal; padding: 15px 23px 14px; text-decoration: none; top: 5px; width: auto; z-index: 100000; } /* ======================================== Smooth Scroll Offset ======================================== */ /* Add scroll margin to headings to account for fixed headers */ h2[id], h3[id] { scroll-margin-top: 2rem; } @media (max-width: 768px) { h2[id], h3[id] { scroll-margin-top: 1.5rem; } } /* ======================================== Custom Scrollbar for TOC List ======================================== */ .apus-toc-list::-webkit-scrollbar { width: 6px; } .apus-toc-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; } .apus-toc-list::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; } .apus-toc-list::-webkit-scrollbar-thumb:hover { background: #a0aec0; } /* Firefox */ .apus-toc-list { scrollbar-width: thin; scrollbar-color: #cbd5e0 #f1f1f1; }