Agregar estructura completa del tema APUS con Bootstrap 5 y optimizaciones de rendimiento

Se implementa tema WordPress personalizado para Análisis de Precios Unitarios con funcionalidades avanzadas:
- Sistema de templates (front-page, single, archive, page, 404, search)
- Integración de Bootstrap 5.3.8 con estructura modular de assets
- Panel de opciones del tema con Customizer API
- Optimizaciones de rendimiento (Critical CSS, Image Optimization, Performance)
- Funcionalidades SEO y compatibilidad con Rank Math
- Sistema de posts relacionados y tabla de contenidos
- Badge de categorías y manejo de AdSense diferido
- Tipografías Google Fonts configurables
- Documentación completa del tema y guías de uso

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-04 09:31:47 -06:00
parent 12285bec3c
commit 7ba9080f57
67 changed files with 21825 additions and 0 deletions

View File

@@ -0,0 +1,471 @@
/**
* Theme Options Admin Styles
*
* @package Apus_Theme
* @since 1.0.0
*/
/* Main Container */
.apus-theme-options {
margin: 20px 20px 0 0;
}
/* Header */
.apus-options-header {
background: #fff;
border: 1px solid #c3c4c7;
padding: 20px;
margin: 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.apus-options-logo h2 {
margin: 0;
font-size: 24px;
color: #1d2327;
display: inline-block;
}
.apus-options-logo .version {
background: #2271b1;
color: #fff;
padding: 3px 8px;
border-radius: 3px;
font-size: 12px;
margin-left: 10px;
}
.apus-options-actions {
display: flex;
gap: 10px;
}
.apus-options-actions .button .dashicons {
margin-top: 3px;
margin-right: 3px;
}
/* Form */
.apus-options-form {
background: #fff;
border: 1px solid #c3c4c7;
box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
/* Tabs Container */
.apus-options-container {
display: flex;
min-height: 600px;
}
/* Tabs Navigation */
.apus-tabs-nav {
width: 200px;
background: #f6f7f7;
border-right: 1px solid #c3c4c7;
}
.apus-tabs-nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.apus-tabs-nav li {
margin: 0;
padding: 0;
border-bottom: 1px solid #c3c4c7;
}
.apus-tabs-nav li:first-child {
border-top: 1px solid #c3c4c7;
}
.apus-tabs-nav a {
display: block;
padding: 15px 20px;
color: #50575e;
text-decoration: none;
transition: all 0.2s;
position: relative;
}
.apus-tabs-nav a .dashicons {
margin-right: 8px;
color: #787c82;
}
.apus-tabs-nav a:hover {
background: #fff;
color: #2271b1;
}
.apus-tabs-nav a:hover .dashicons {
color: #2271b1;
}
.apus-tabs-nav li.active a {
background: #fff;
color: #2271b1;
font-weight: 600;
border-left: 3px solid #2271b1;
padding-left: 17px;
}
.apus-tabs-nav li.active a .dashicons {
color: #2271b1;
}
/* Tabs Content */
.apus-tabs-content {
flex: 1;
padding: 30px;
}
.apus-tab-pane {
display: none;
}
.apus-tab-pane.active {
display: block;
}
.apus-tab-pane h2 {
margin: 0 0 10px 0;
font-size: 23px;
font-weight: 400;
line-height: 1.3;
}
.apus-tab-pane > p.description {
margin: 0 0 20px 0;
color: #646970;
}
.apus-tab-pane h3 {
margin: 30px 0 0 0;
padding: 15px 0 10px 0;
border-top: 1px solid #dcdcde;
font-size: 18px;
}
/* Form Table */
.apus-tab-pane .form-table {
margin-top: 20px;
}
.apus-tab-pane .form-table th {
padding: 20px 10px 20px 0;
width: 200px;
}
.apus-tab-pane .form-table td {
padding: 15px 10px;
}
/* Toggle Switch */
.apus-switch {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}
.apus-switch input {
opacity: 0;
width: 0;
height: 0;
}
.apus-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}
.apus-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .apus-slider {
background-color: #2271b1;
}
input:focus + .apus-slider {
box-shadow: 0 0 1px #2271b1;
}
input:checked + .apus-slider:before {
transform: translateX(26px);
}
/* Image Upload */
.apus-image-upload {
max-width: 600px;
}
.apus-image-preview {
margin-bottom: 10px;
border: 1px solid #c3c4c7;
background: #f6f7f7;
padding: 10px;
min-height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.apus-image-preview:empty {
display: none;
}
.apus-preview-image {
max-width: 100%;
height: auto;
display: block;
}
.apus-upload-image,
.apus-remove-image {
margin-right: 10px;
}
/* Submit Button */
.apus-options-form .submit {
margin: 0;
padding: 20px 30px;
border-top: 1px solid #c3c4c7;
background: #f6f7f7;
}
/* Modal */
.apus-modal {
display: none;
position: fixed;
z-index: 100000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.5);
}
.apus-modal-content {
background-color: #fff;
margin: 10% auto;
padding: 30px;
border: 1px solid #c3c4c7;
width: 80%;
max-width: 600px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
border-radius: 4px;
}
.apus-modal-close {
color: #646970;
float: right;
font-size: 28px;
font-weight: bold;
line-height: 20px;
cursor: pointer;
}
.apus-modal-close:hover,
.apus-modal-close:focus {
color: #1d2327;
}
.apus-modal-content h2 {
margin-top: 0;
}
.apus-modal-content textarea {
font-family: 'Courier New', Courier, monospace;
font-size: 12px;
}
/* Notices */
.apus-notice {
padding: 12px;
margin: 20px 0;
border-left: 4px solid;
background: #fff;
box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.apus-notice.success {
border-left-color: #00a32a;
}
.apus-notice.error {
border-left-color: #d63638;
}
.apus-notice.warning {
border-left-color: #dba617;
}
.apus-notice.info {
border-left-color: #2271b1;
}
/* Code Editor */
textarea.code {
font-family: 'Courier New', Courier, monospace;
font-size: 13px;
line-height: 1.5;
}
/* Responsive */
@media screen and (max-width: 782px) {
.apus-options-container {
flex-direction: column;
}
.apus-tabs-nav {
width: 100%;
border-right: none;
border-bottom: 1px solid #c3c4c7;
}
.apus-tabs-nav ul {
display: flex;
flex-wrap: wrap;
}
.apus-tabs-nav li {
flex: 1;
min-width: 50%;
border-right: 1px solid #c3c4c7;
border-bottom: none;
}
.apus-tabs-nav li:first-child {
border-top: none;
}
.apus-tabs-nav a {
text-align: center;
padding: 12px 10px;
font-size: 13px;
}
.apus-tabs-nav a .dashicons {
display: block;
margin: 0 auto 5px;
}
.apus-tabs-nav li.active a {
border-left: none;
border-bottom: 3px solid #2271b1;
padding-left: 10px;
}
.apus-tabs-content {
padding: 20px;
}
.apus-options-header {
flex-direction: column;
gap: 15px;
}
.apus-options-actions {
width: 100%;
flex-direction: column;
}
.apus-options-actions .button {
width: 100%;
text-align: center;
}
.apus-tab-pane .form-table th {
width: auto;
padding: 15px 10px 5px 0;
display: block;
}
.apus-tab-pane .form-table td {
display: block;
padding: 5px 10px 15px 0;
}
}
/* Loading Spinner */
.apus-spinner {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(0,0,0,.1);
border-radius: 50%;
border-top-color: #2271b1;
animation: apus-spin 1s ease-in-out infinite;
}
@keyframes apus-spin {
to { transform: rotate(360deg); }
}
/* Helper Classes */
.apus-hidden {
display: none !important;
}
.apus-text-center {
text-align: center;
}
.apus-mt-20 {
margin-top: 20px;
}
.apus-mb-20 {
margin-bottom: 20px;
}
/* Color Picker */
.wp-picker-container {
display: inline-block;
}
/* Field Dependencies */
.apus-field-dependency {
opacity: 0.5;
pointer-events: none;
}
/* Success Animation */
@keyframes apus-saved {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
.apus-saved {
animation: apus-saved 0.3s ease-in-out;
}

View File

@@ -0,0 +1,440 @@
/**
* Theme Options Admin JavaScript
*
* @package Apus_Theme
* @since 1.0.0
*/
(function($) {
'use strict';
var ApusThemeOptions = {
/**
* Initialize
*/
init: function() {
this.tabs();
this.imageUpload();
this.resetOptions();
this.exportOptions();
this.importOptions();
this.formValidation();
this.conditionalFields();
},
/**
* Tab Navigation
*/
tabs: function() {
// Tab click handler
$('.apus-tabs-nav a').on('click', function(e) {
e.preventDefault();
var tabId = $(this).attr('href');
// Update active states
$('.apus-tabs-nav li').removeClass('active');
$(this).parent().addClass('active');
// Show/hide tab content
$('.apus-tab-pane').removeClass('active');
$(tabId).addClass('active');
// Update URL hash without scrolling
if (history.pushState) {
history.pushState(null, null, tabId);
} else {
window.location.hash = tabId;
}
});
// Load tab from URL hash on page load
if (window.location.hash) {
var hash = window.location.hash;
if ($(hash).length) {
$('.apus-tabs-nav a[href="' + hash + '"]').trigger('click');
}
}
// Handle browser back/forward buttons
$(window).on('hashchange', function() {
if (window.location.hash) {
$('.apus-tabs-nav a[href="' + window.location.hash + '"]').trigger('click');
}
});
},
/**
* Image Upload
*/
imageUpload: function() {
var self = this;
var mediaUploader;
// Upload button click
$(document).on('click', '.apus-upload-image', function(e) {
e.preventDefault();
var button = $(this);
var container = button.closest('.apus-image-upload');
var preview = container.find('.apus-image-preview');
var input = container.find('.apus-image-id');
var removeBtn = container.find('.apus-remove-image');
// If the media uploader already exists, reopen it
if (mediaUploader) {
mediaUploader.open();
return;
}
// Create new media uploader
mediaUploader = wp.media({
title: apusAdminOptions.strings.selectImage,
button: {
text: apusAdminOptions.strings.useImage
},
multiple: false
});
// When an image is selected
mediaUploader.on('select', function() {
var attachment = mediaUploader.state().get('selection').first().toJSON();
// Set image ID
input.val(attachment.id);
// Show preview
var imgUrl = attachment.sizes && attachment.sizes.medium ?
attachment.sizes.medium.url : attachment.url;
preview.html('<img src="' + imgUrl + '" class="apus-preview-image" />');
// Show remove button
removeBtn.show();
});
// Open the uploader
mediaUploader.open();
});
// Remove button click
$(document).on('click', '.apus-remove-image', function(e) {
e.preventDefault();
var button = $(this);
var container = button.closest('.apus-image-upload');
var preview = container.find('.apus-image-preview');
var input = container.find('.apus-image-id');
// Clear values
input.val('');
preview.empty();
button.hide();
});
},
/**
* Reset Options
*/
resetOptions: function() {
$('#apus-reset-options').on('click', function(e) {
e.preventDefault();
if (!confirm(apusAdminOptions.strings.confirmReset)) {
return;
}
var button = $(this);
button.prop('disabled', true).addClass('updating-message');
$.ajax({
url: apusAdminOptions.ajaxUrl,
type: 'POST',
data: {
action: 'apus_reset_options',
nonce: apusAdminOptions.nonce
},
success: function(response) {
if (response.success) {
// Show success message
ApusThemeOptions.showNotice('success', response.data.message);
// Reload page after 1 second
setTimeout(function() {
window.location.reload();
}, 1000);
} else {
ApusThemeOptions.showNotice('error', response.data.message);
button.prop('disabled', false).removeClass('updating-message');
}
},
error: function() {
ApusThemeOptions.showNotice('error', apusAdminOptions.strings.error);
button.prop('disabled', false).removeClass('updating-message');
}
});
});
},
/**
* Export Options
*/
exportOptions: function() {
$('#apus-export-options').on('click', function(e) {
e.preventDefault();
var button = $(this);
button.prop('disabled', true).addClass('updating-message');
$.ajax({
url: apusAdminOptions.ajaxUrl,
type: 'POST',
data: {
action: 'apus_export_options',
nonce: apusAdminOptions.nonce
},
success: function(response) {
if (response.success) {
// Create download link
var blob = new Blob([response.data.data], { type: 'application/json' });
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = response.data.filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
ApusThemeOptions.showNotice('success', 'Options exported successfully!');
} else {
ApusThemeOptions.showNotice('error', response.data.message);
}
button.prop('disabled', false).removeClass('updating-message');
},
error: function() {
ApusThemeOptions.showNotice('error', apusAdminOptions.strings.error);
button.prop('disabled', false).removeClass('updating-message');
}
});
});
},
/**
* Import Options
*/
importOptions: function() {
var modal = $('#apus-import-modal');
var importData = $('#apus-import-data');
// Show modal
$('#apus-import-options').on('click', function(e) {
e.preventDefault();
modal.show();
});
// Close modal
$('.apus-modal-close, #apus-import-cancel').on('click', function() {
modal.hide();
importData.val('');
});
// Close modal on outside click
$(window).on('click', function(e) {
if ($(e.target).is(modal)) {
modal.hide();
importData.val('');
}
});
// Submit import
$('#apus-import-submit').on('click', function(e) {
e.preventDefault();
var data = importData.val().trim();
if (!data) {
alert('Please paste your import data.');
return;
}
var button = $(this);
button.prop('disabled', true).addClass('updating-message');
$.ajax({
url: apusAdminOptions.ajaxUrl,
type: 'POST',
data: {
action: 'apus_import_options',
nonce: apusAdminOptions.nonce,
import_data: data
},
success: function(response) {
if (response.success) {
ApusThemeOptions.showNotice('success', response.data.message);
modal.hide();
importData.val('');
// Reload page after 1 second
setTimeout(function() {
window.location.reload();
}, 1000);
} else {
ApusThemeOptions.showNotice('error', response.data.message);
button.prop('disabled', false).removeClass('updating-message');
}
},
error: function() {
ApusThemeOptions.showNotice('error', apusAdminOptions.strings.error);
button.prop('disabled', false).removeClass('updating-message');
}
});
});
},
/**
* Form Validation
*/
formValidation: function() {
$('.apus-options-form').on('submit', function(e) {
var valid = true;
var firstError = null;
// Validate required fields
$(this).find('[required]').each(function() {
if (!$(this).val()) {
valid = false;
$(this).addClass('error');
if (!firstError) {
firstError = $(this);
}
} else {
$(this).removeClass('error');
}
});
// Validate number fields
$(this).find('input[type="number"]').each(function() {
var val = $(this).val();
var min = $(this).attr('min');
var max = $(this).attr('max');
if (val && min && parseInt(val) < parseInt(min)) {
valid = false;
$(this).addClass('error');
if (!firstError) {
firstError = $(this);
}
}
if (val && max && parseInt(val) > parseInt(max)) {
valid = false;
$(this).addClass('error');
if (!firstError) {
firstError = $(this);
}
}
});
// Validate URL fields
$(this).find('input[type="url"]').each(function() {
var val = $(this).val();
if (val && !ApusThemeOptions.isValidUrl(val)) {
valid = false;
$(this).addClass('error');
if (!firstError) {
firstError = $(this);
}
}
});
if (!valid) {
e.preventDefault();
if (firstError) {
// Scroll to first error
$('html, body').animate({
scrollTop: firstError.offset().top - 100
}, 500);
firstError.focus();
}
ApusThemeOptions.showNotice('error', 'Please fix the errors in the form.');
return false;
}
// Add saving animation
$(this).find('.submit .button-primary').addClass('updating-message');
});
// Remove error class on input
$('.apus-options-form input, .apus-options-form select, .apus-options-form textarea').on('change input', function() {
$(this).removeClass('error');
});
},
/**
* Conditional Fields
*/
conditionalFields: function() {
// Enable/disable related posts options based on checkbox
$('#enable_related_posts').on('change', function() {
var checked = $(this).is(':checked');
var fields = $('#related_posts_count, #related_posts_taxonomy, #related_posts_title, #related_posts_columns');
fields.closest('tr').toggleClass('apus-field-dependency', !checked);
fields.prop('disabled', !checked);
}).trigger('change');
// Enable/disable breadcrumb separator based on breadcrumbs checkbox
$('#enable_breadcrumbs').on('change', function() {
var checked = $(this).is(':checked');
var field = $('#breadcrumb_separator');
field.closest('tr').toggleClass('apus-field-dependency', !checked);
field.prop('disabled', !checked);
}).trigger('change');
},
/**
* Show Notice
*/
showNotice: function(type, message) {
var notice = $('<div class="notice notice-' + type + ' is-dismissible"><p>' + message + '</p></div>');
$('.apus-theme-options h1').after(notice);
// Auto-dismiss after 5 seconds
setTimeout(function() {
notice.fadeOut(function() {
$(this).remove();
});
}, 5000);
// Scroll to top
$('html, body').animate({ scrollTop: 0 }, 300);
},
/**
* Validate URL
*/
isValidUrl: function(url) {
try {
new URL(url);
return true;
} catch (e) {
return false;
}
}
};
// Initialize on document ready
$(document).ready(function() {
ApusThemeOptions.init();
});
// Make it globally accessible
window.ApusThemeOptions = ApusThemeOptions;
})(jQuery);

View File

@@ -0,0 +1,485 @@
/**
* Accessibility Styles
*
* Enhanced accessibility styles including visible focus states,
* screen reader utilities, and minimum touch targets.
*
* @package Apus_Theme
* @since 1.0.0
*/
/* ==========================================================================
Focus Styles - Highly Visible
========================================================================== */
/**
* Enhanced focus styles for better keyboard navigation
* Using double outline for better visibility across different backgrounds
*/
*:focus {
outline: 3px solid #0066cc;
outline-offset: 2px;
}
/* Remove default browser focus outline (we're replacing it with better one) */
*:focus:not(:focus-visible) {
outline: none;
}
/* Modern browsers that support :focus-visible */
*:focus-visible {
outline: 3px solid #0066cc;
outline-offset: 2px;
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}
/* Links */
a:focus,
a:focus-visible {
outline: 3px solid #0066cc;
outline-offset: 2px;
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
text-decoration: underline;
}
/* Buttons */
button:focus,
button:focus-visible,
.button:focus,
.button:focus-visible,
input[type="submit"]:focus,
input[type="submit"]:focus-visible,
input[type="button"]:focus,
input[type="button"]:focus-visible,
input[type="reset"]:focus,
input[type="reset"]:focus-visible {
outline: 3px solid #0066cc;
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
}
/* Form inputs */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="range"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="color"]:focus,
textarea:focus,
select:focus {
outline: 3px solid #0066cc;
outline-offset: 0;
border-color: #0066cc;
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}
/* Checkboxes and radio buttons */
input[type="checkbox"]:focus,
input[type="radio"]:focus {
outline: 3px solid #0066cc;
outline-offset: 2px;
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}
/* Navigation menu items */
.main-navigation a:focus,
.primary-menu a:focus,
nav a:focus {
outline: 3px solid #0066cc;
outline-offset: 2px;
background-color: rgba(0, 102, 204, 0.1);
}
/* Menu toggle button */
.menu-toggle:focus,
.mobile-menu-toggle:focus {
outline: 3px solid #0066cc;
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
}
/* ==========================================================================
Screen Reader Text Utilities
========================================================================== */
/**
* Hide elements visually but keep them accessible to screen readers
*/
.screen-reader-text,
.sr-only,
.visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
clip-path: inset(50%) !important;
}
/**
* Make screen reader text visible on focus
* Important for skip links and keyboard navigation
*/
.screen-reader-text:focus,
.sr-only:focus,
.visually-hidden:focus {
position: fixed !important;
top: 5px !important;
left: 5px !important;
width: auto !important;
height: auto !important;
padding: 15px 23px 14px !important;
margin: 0 !important;
background-color: #000 !important;
color: #fff !important;
font-size: 14px !important;
font-weight: bold !important;
line-height: normal !important;
text-decoration: none !important;
z-index: 100000 !important;
clip: auto !important;
clip-path: none !important;
outline: 3px solid #0066cc !important;
outline-offset: 2px !important;
border-radius: 3px !important;
}
/**
* Skip to content link
*/
.skip-link {
position: absolute;
top: -40px;
left: 0;
background-color: #000;
color: #fff;
padding: 10px 20px;
text-decoration: none;
z-index: 100000;
font-weight: bold;
border-radius: 0 0 3px 0;
transition: top 0.2s ease-in-out;
}
.skip-link:focus {
top: 0;
outline: 3px solid #0066cc;
outline-offset: 2px;
}
/* ==========================================================================
Touch Targets - Minimum 44x44px
========================================================================== */
/**
* Ensure all interactive elements meet WCAG 2.1 Level AAA
* minimum touch target size of 44x44 pixels
*/
/* Buttons */
button,
.button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.wp-block-button__link {
min-height: 44px;
min-width: 44px;
padding: 10px 20px;
display: inline-flex;
align-items: center;
justify-content: center;
}
/* Links in navigation */
.main-navigation a,
.primary-menu a,
.footer-navigation a,
nav a {
min-height: 44px;
display: inline-flex;
align-items: center;
padding: 10px 15px;
}
/* Menu toggle buttons */
.menu-toggle,
.mobile-menu-toggle {
min-width: 44px;
min-height: 44px;
padding: 10px;
}
/* Pagination links */
.page-numbers,
.pagination a,
.posts-navigation a {
min-width: 44px;
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 15px;
}
/* Form inputs */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
min-height: 44px;
padding: 10px 15px;
}
/* Checkboxes and radio buttons */
input[type="checkbox"],
input[type="radio"] {
min-width: 24px;
min-height: 24px;
margin: 10px; /* Add margin to reach 44px effective touch target */
}
/* Links with small text need larger padding */
.tags-list a,
.category-badge {
min-height: 44px;
padding: 12px 16px;
display: inline-flex;
align-items: center;
}
/* ==========================================================================
High Contrast Mode Support
========================================================================== */
/**
* Ensure elements remain visible in Windows High Contrast Mode
*/
@media (prefers-contrast: high) {
button,
a,
.button {
border: 2px solid currentColor;
}
*:focus,
*:focus-visible {
outline: 3px solid;
outline-offset: 3px;
}
}
/* ==========================================================================
Reduced Motion Support
========================================================================== */
/**
* Respect user's preference for reduced motion
* Remove animations for users who prefer reduced motion
*/
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
/* ==========================================================================
Color Contrast Enhancements
========================================================================== */
/**
* Ensure text has sufficient color contrast
* WCAG AA requires 4.5:1 for normal text, 3:1 for large text
*/
/* Enhanced link contrast */
a {
color: #0056b3;
text-decoration: underline;
}
a:hover {
color: #003d82;
text-decoration: underline;
}
/* Error messages - high contrast red */
.error,
.error-message,
.form-error {
color: #c81e1e;
background-color: #fef0f0;
border: 2px solid #c81e1e;
padding: 10px 15px;
border-radius: 4px;
}
/* Success messages - high contrast green */
.success,
.success-message,
.form-success {
color: #1e7e34;
background-color: #e8f5e9;
border: 2px solid #1e7e34;
padding: 10px 15px;
border-radius: 4px;
}
/* Warning messages - high contrast yellow/orange */
.warning,
.warning-message,
.form-warning {
color: #856404;
background-color: #fff3cd;
border: 2px solid #856404;
padding: 10px 15px;
border-radius: 4px;
}
/* ==========================================================================
ARIA Live Regions
========================================================================== */
/**
* Ensure live regions are properly announced
*/
[aria-live] {
position: relative;
}
[aria-live="assertive"] {
font-weight: bold;
}
/* ==========================================================================
Focus Management for Modals and Dialogs
========================================================================== */
/**
* Trap focus within modals
*/
.modal[aria-modal="true"],
.dialog[aria-modal="true"] {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
}
/* Modal backdrop */
.modal-backdrop {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.75);
z-index: 999998;
}
/* ==========================================================================
Text Spacing and Readability
========================================================================== */
/**
* Support for user text spacing preferences
* WCAG 2.1 Level AA Success Criterion 1.4.12
*/
p,
li,
dd,
dt {
line-height: 1.6;
letter-spacing: 0.02em;
}
h1, h2, h3, h4, h5, h6 {
line-height: 1.3;
letter-spacing: 0.01em;
}
/* Allow text to be resized up to 200% without loss of content or functionality */
html {
font-size: 100%;
}
/* ==========================================================================
Table Accessibility
========================================================================== */
/**
* Ensure tables are accessible
*/
table {
border-collapse: collapse;
width: 100%;
}
th {
text-align: left;
font-weight: bold;
background-color: #f8f9fa;
border: 1px solid #dee2e6;
padding: 12px;
}
td {
border: 1px solid #dee2e6;
padding: 12px;
}
/* Add scope visually for screen readers */
caption {
font-weight: bold;
text-align: left;
padding: 10px 0;
caption-side: top;
}
/* ==========================================================================
Print Accessibility
========================================================================== */
@media print {
/* Ensure focus styles don't print */
*:focus {
outline: none !important;
box-shadow: none !important;
}
/* Show link URLs in print */
a[href]:after {
content: " (" attr(href) ")";
}
/* Don't show URLs for fragment links or javascript */
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
}

View File

@@ -0,0 +1,677 @@
/**
* Animation Styles
*
* CSS animations and keyframes for the theme
* @package Apus_Theme
* @since 1.0.0
*/
/* Fade animations */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes fadeInLeft {
from {
opacity: 0;
transform: translate3d(-100%, 0, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes fadeInRight {
from {
opacity: 0;
transform: translate3d(100%, 0, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
/* Slide animations */
@keyframes slideDown {
from {
transform: translateY(-100%);
}
to {
transform: translateY(0);
}
}
@keyframes slideUp {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
}
}
@keyframes slideLeft {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
@keyframes slideRight {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}
/* Zoom animations */
@keyframes zoomIn {
from {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
50% {
opacity: 1;
}
}
@keyframes zoomOut {
from {
opacity: 1;
}
50% {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
to {
opacity: 0;
}
}
@keyframes zoomInDown {
from {
opacity: 0;
transform: translate3d(0, -100%, 0) scale3d(0.5, 0.5, 0.5);
}
50% {
opacity: 1;
}
}
@keyframes zoomInUp {
from {
opacity: 0;
transform: translate3d(0, 100%, 0) scale3d(0.5, 0.5, 0.5);
}
50% {
opacity: 1;
}
}
/* Bounce animations */
@keyframes bounce {
0%,
100% {
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
transform: translate3d(0, 0, 0);
}
45% {
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
transform: translate3d(0, -30px, 0);
}
}
@keyframes bounceIn {
from {
opacity: 0;
transform: scale3d(0.3, 0.3, 0.3);
}
20% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
transform: scale3d(0.9, 0.9, 0.9);
}
60% {
opacity: 1;
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
transform: scale3d(0.97, 0.97, 0.97);
}
to {
opacity: 1;
transform: scale3d(1, 1, 1);
}
}
@keyframes bounceInDown {
from {
opacity: 0;
transform: translate3d(0, -100%, 0);
}
60% {
opacity: 1;
transform: translate3d(0, 25px, 0);
}
75% {
transform: translate3d(0, -10px, 0);
}
90% {
transform: translate3d(0, 5px, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes bounceInUp {
from {
opacity: 0;
transform: translate3d(0, 100%, 0);
}
60% {
opacity: 1;
transform: translate3d(0, -25px, 0);
}
75% {
transform: translate3d(0, 10px, 0);
}
90% {
transform: translate3d(0, -5px, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
/* Rotate animations */
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes rotateIn {
from {
opacity: 0;
transform: rotate3d(0, 0, 1, -200deg);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes rotateOut {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
transform: rotate3d(0, 0, 1, 200deg);
}
}
/* Flip animations */
@keyframes flip {
from {
transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
animation-timing-function: ease-out;
}
40% {
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
animation-timing-function: ease-in;
}
70% {
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
animation-timing-function: ease-in;
}
100% {
transform: perspective(400px);
}
}
@keyframes flipInX {
from {
opacity: 0;
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
}
40% {
transform: perspective(400px) rotate3d(1, 0, 0, -10deg);
}
70% {
transform: perspective(400px) rotate3d(1, 0, 0, 5deg);
}
100% {
opacity: 1;
transform: perspective(400px);
}
}
@keyframes flipInY {
from {
opacity: 0;
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
}
40% {
transform: perspective(400px) rotate3d(0, 1, 0, -10deg);
}
70% {
transform: perspective(400px) rotate3d(0, 1, 0, 5deg);
}
100% {
opacity: 1;
transform: perspective(400px);
}
}
/* Pulse animation */
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
/* Heartbeat animation */
@keyframes heartbeat {
0%,
100% {
transform: scale(1);
}
14% {
transform: scale(1.15);
}
28% {
transform: scale(1);
}
42% {
transform: scale(1.15);
}
70% {
transform: scale(1);
}
}
/* Shake animation */
@keyframes shake {
0%,
100% {
transform: translate3d(0, 0, 0);
}
10%,
20% {
transform: translate3d(-10px, 0, 0);
}
30%,
50%,
70%,
90% {
transform: translate3d(10px, 0, 0);
}
40%,
60%,
80% {
transform: translate3d(-10px, 0, 0);
}
}
/* Swing animation */
@keyframes swing {
20% {
transform: rotate(15deg);
}
40% {
transform: rotate(-10deg);
}
60% {
transform: rotate(5deg);
}
80% {
transform: rotate(-5deg);
}
100% {
transform: rotate(0deg);
}
}
/* Wobble animation */
@keyframes wobble {
0% {
transform: translateX(0);
}
15% {
transform: translateX(-25px) rotate(-5deg);
}
30% {
transform: translateX(20px) rotate(3deg);
}
45% {
transform: translateX(-15px) rotate(-3deg);
}
60% {
transform: translateX(10px) rotate(2deg);
}
75% {
transform: translateX(-5px) rotate(-1deg);
}
100% {
transform: translateX(0);
}
}
/* Jello animation */
@keyframes jello {
0%,
11.1%,
100% {
transform: translate3d(0, 0, 0);
}
22.2% {
transform: skewX(-12.5deg) skewY(-12.5deg);
}
33.3% {
transform: skewX(6.25deg) skewY(6.25deg);
}
44.4% {
transform: skewX(-3.125deg) skewY(-3.125deg);
}
55.5% {
transform: skewX(1.5625deg) skewY(1.5625deg);
}
66.6% {
transform: skewX(-0.78125deg) skewY(-0.78125deg);
}
77.7% {
transform: skewX(0.390625deg) skewY(0.390625deg);
}
88.8% {
transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
}
}
/* Loading spinner */
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Utility animation classes */
.animate-fade-in {
animation: fadeIn 0.5s ease-in-out;
}
.animate-fade-out {
animation: fadeOut 0.5s ease-in-out;
}
.animate-fade-in-down {
animation: fadeInDown 0.6s ease-out;
}
.animate-fade-in-up {
animation: fadeInUp 0.6s ease-out;
}
.animate-fade-in-left {
animation: fadeInLeft 0.6s ease-out;
}
.animate-fade-in-right {
animation: fadeInRight 0.6s ease-out;
}
.animate-slide-down {
animation: slideDown 0.4s ease-out;
}
.animate-slide-up {
animation: slideUp 0.4s ease-out;
}
.animate-slide-left {
animation: slideLeft 0.4s ease-out;
}
.animate-slide-right {
animation: slideRight 0.4s ease-out;
}
.animate-zoom-in {
animation: zoomIn 0.5s ease-out;
}
.animate-zoom-out {
animation: zoomOut 0.5s ease-out;
}
.animate-bounce {
animation: bounce 1s infinite;
}
.animate-bounce-in {
animation: bounceIn 0.6s;
}
.animate-bounce-in-down {
animation: bounceInDown 0.6s;
}
.animate-bounce-in-up {
animation: bounceInUp 0.6s;
}
.animate-rotate {
animation: rotate 2s linear infinite;
}
.animate-rotate-in {
animation: rotateIn 0.6s ease-out;
}
.animate-rotate-out {
animation: rotateOut 0.6s ease-out;
}
.animate-flip {
animation: flip 0.6s;
}
.animate-flip-in-x {
animation: flipInX 0.6s;
}
.animate-flip-in-y {
animation: flipInY 0.6s;
}
.animate-pulse {
animation: pulse 1.5s ease-in-out infinite;
}
.animate-heartbeat {
animation: heartbeat 1.3s ease-in-out infinite;
}
.animate-shake {
animation: shake 0.5s;
}
.animate-swing {
animation: swing 0.6s;
}
.animate-wobble {
animation: wobble 0.8s;
}
.animate-jello {
animation: jello 0.9s;
}
.animate-spinner {
animation: spinner 1s linear infinite;
}
/* Animation delay classes */
.animate-delay-1 {
animation-delay: 0.1s;
}
.animate-delay-2 {
animation-delay: 0.2s;
}
.animate-delay-3 {
animation-delay: 0.3s;
}
.animate-delay-4 {
animation-delay: 0.4s;
}
.animate-delay-5 {
animation-delay: 0.5s;
}
/* Animation duration classes */
.animate-duration-fast {
animation-duration: 0.3s;
}
.animate-duration-normal {
animation-duration: 0.6s;
}
.animate-duration-slow {
animation-duration: 1s;
}
.animate-duration-slower {
animation-duration: 1.5s;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,184 @@
/**
* Typography System - Self-hosted Fonts
*
* This file defines custom font faces and system font stacks.
* Can be toggled via theme customizer to switch between custom and system fonts.
*
* @package Apus_Theme
* @since 1.0.0
*/
/* ==========================================================================
System Font Stacks
========================================================================== */
/**
* System Font Stacks for maximum performance and native rendering
* These provide excellent typography without any network requests
*/
:root {
/* System UI Font Stack - Best for general content */
--font-system-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
/* Sans-serif Stack - Clean and modern */
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
/* Serif Stack - For elegant, traditional content */
--font-serif: Georgia, "Times New Roman", Times, serif;
/* Monospace Stack - For code blocks and technical content */
--font-mono: "Consolas", "Monaco", "Courier New", Courier, monospace;
/* Humanist Stack - Friendly and approachable */
--font-humanist: "Seravek", "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif;
/* Geometric Stack - Modern and geometric */
--font-geometric: Avenir, "Avenir Next LT Pro", Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif;
/* Default Font Stack */
--font-primary: var(--font-system-ui);
--font-secondary: var(--font-sans);
--font-headings: var(--font-geometric);
--font-code: var(--font-mono);
}
/* ==========================================================================
Custom Font Faces (Example - Replace with actual custom fonts)
========================================================================== */
/**
* To use custom fonts:
* 1. Add font files to assets/fonts/
* 2. Uncomment and configure @font-face declarations below
* 3. Update CSS custom properties to use custom font families
*/
/*
@font-face {
font-family: 'Custom Sans';
src: url('../fonts/CustomSans-Regular.woff2') format('woff2'),
url('../fonts/CustomSans-Regular.woff') format('woff');
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Custom Sans';
src: url('../fonts/CustomSans-Bold.woff2') format('woff2'),
url('../fonts/CustomSans-Bold.woff') format('woff');
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Custom Serif';
src: url('../fonts/CustomSerif-Regular.woff2') format('woff2'),
url('../fonts/CustomSerif-Regular.woff') format('woff');
font-weight: 400;
font-style: normal;
font-display: swap;
}
*/
/* ==========================================================================
Font Loading Strategy
========================================================================== */
/**
* font-display: swap ensures text remains visible during font load
* This prevents FOIT (Flash of Invisible Text) and improves LCP
*/
/* ==========================================================================
Optional: Custom Font Configuration
========================================================================== */
/**
* Uncomment to use custom fonts instead of system fonts
* Make sure to define @font-face declarations above first
*/
/*
body.use-custom-fonts {
--font-primary: 'Custom Sans', var(--font-system-ui);
--font-headings: 'Custom Sans', var(--font-geometric);
--font-secondary: 'Custom Serif', var(--font-serif);
}
*/
/* ==========================================================================
Typography Utilities
========================================================================== */
/**
* Font weight utilities
*/
.font-light { font-weight: 300; }
.font-regular { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
/**
* Font family utilities
*/
.font-primary { font-family: var(--font-primary); }
.font-secondary { font-family: var(--font-secondary); }
.font-headings { font-family: var(--font-headings); }
.font-mono { font-family: var(--font-code); }
.font-serif { font-family: var(--font-serif); }
/**
* Font size utilities based on spacing scale
*/
.text-xs { font-size: 0.75rem; } /* 12px */
.text-sm { font-size: 0.875rem; } /* 14px */
.text-base { font-size: 1rem; } /* 16px */
.text-lg { font-size: 1.125rem; } /* 18px */
.text-xl { font-size: 1.25rem; } /* 20px */
.text-2xl { font-size: 1.5rem; } /* 24px */
.text-3xl { font-size: 1.875rem; } /* 30px */
.text-4xl { font-size: 2.25rem; } /* 36px */
/**
* Line height utilities
*/
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }
/**
* Text transformation
*/
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
/**
* Font smoothing for better rendering
*/
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.subpixel-antialiased {
-webkit-font-smoothing: auto;
-moz-osx-font-smoothing: auto;
}
/* ==========================================================================
Performance Optimizations
========================================================================== */
/**
* Preload hints for custom fonts (add to <head> if using custom fonts)
* <link rel="preload" href="/assets/fonts/CustomSans-Regular.woff2" as="font" type="font/woff2" crossorigin>
* <link rel="preload" href="/assets/fonts/CustomSans-Bold.woff2" as="font" type="font/woff2" crossorigin>
*/

View File

@@ -0,0 +1,504 @@
/**
* Footer Styles
*
* Styles for the site footer including widget areas, footer bottom,
* and responsive design.
*
* @package Apus_Theme
* @since 1.0.0
*/
/* ==========================================================================
Footer Main Container
========================================================================== */
.site-footer {
background-color: #1a1a1a;
color: #e0e0e0;
margin-top: auto;
}
/* ==========================================================================
Footer Widgets Section
========================================================================== */
.footer-widgets {
padding: 4rem 0 3rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-widget-area {
margin-bottom: 1rem;
}
/* Widget Titles */
.footer-widget-area .widget-title {
font-size: 1.125rem;
font-weight: 600;
color: #ffffff;
margin-bottom: 1.5rem;
padding-bottom: 0.75rem;
border-bottom: 2px solid rgba(255, 255, 255, 0.15);
text-transform: uppercase;
letter-spacing: 0.5px;
}
/* Widget Content */
.footer-widget-area .widget {
margin-bottom: 2rem;
}
.footer-widget-area .widget:last-child {
margin-bottom: 0;
}
/* Widget Links */
.footer-widget-area a {
color: #b0b0b0;
text-decoration: none;
transition: color 0.3s ease;
}
.footer-widget-area a:hover,
.footer-widget-area a:focus {
color: #ffffff;
text-decoration: none;
}
/* Widget Lists */
.footer-widget-area ul {
list-style: none;
padding: 0;
margin: 0;
}
.footer-widget-area ul li {
margin-bottom: 0.75rem;
position: relative;
padding-left: 1.25rem;
}
.footer-widget-area ul li:last-child {
margin-bottom: 0;
}
.footer-widget-area ul li::before {
content: "\203A";
position: absolute;
left: 0;
color: #b0b0b0;
font-size: 1.25rem;
line-height: 1;
}
/* Widget Text */
.footer-widget-area p {
margin-bottom: 1rem;
line-height: 1.6;
color: #b0b0b0;
}
.footer-widget-area p:last-child {
margin-bottom: 0;
}
/* Widget Forms */
.footer-widget-area input[type="text"],
.footer-widget-area input[type="email"],
.footer-widget-area input[type="search"],
.footer-widget-area textarea {
background-color: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
color: #ffffff;
padding: 0.5rem 0.75rem;
border-radius: 4px;
}
.footer-widget-area input[type="text"]:focus,
.footer-widget-area input[type="email"]:focus,
.footer-widget-area input[type="search"]:focus,
.footer-widget-area textarea:focus {
background-color: rgba(255, 255, 255, 0.15);
border-color: rgba(255, 255, 255, 0.3);
outline: none;
box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}
.footer-widget-area input::placeholder,
.footer-widget-area textarea::placeholder {
color: #888888;
}
/* Widget Buttons */
.footer-widget-area button,
.footer-widget-area input[type="submit"],
.footer-widget-area .btn {
background-color: #ffffff;
color: #1a1a1a;
border: none;
padding: 0.5rem 1.5rem;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
transition: all 0.3s ease;
}
.footer-widget-area button:hover,
.footer-widget-area input[type="submit"]:hover,
.footer-widget-area .btn:hover {
background-color: #f0f0f0;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
/* ==========================================================================
Footer Bottom Section
========================================================================== */
.footer-bottom {
padding: 2rem 0;
background-color: #0d0d0d;
border-top: 1px solid rgba(255, 255, 255, 0.05);
}
/* Copyright Text */
.copyright-text {
font-size: 0.875rem;
color: #888888;
margin: 0;
}
.copyright-text .site-name {
color: #ffffff;
font-weight: 500;
}
/* Footer Navigation Menu */
.footer-navigation {
display: flex;
justify-content: flex-end;
}
.footer-menu {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
justify-content: center;
}
.footer-menu li {
margin: 0;
}
.footer-menu a {
color: #888888;
text-decoration: none;
font-size: 0.875rem;
transition: color 0.3s ease;
font-weight: 400;
}
.footer-menu a:hover,
.footer-menu a:focus {
color: #ffffff;
text-decoration: none;
}
.footer-menu .current-menu-item a,
.footer-menu .current_page_item a {
color: #ffffff;
}
/* ==========================================================================
Widget Specific Styles
========================================================================== */
/* Recent Posts Widget */
.footer-widget-area .widget_recent_entries ul li {
padding-left: 0;
}
.footer-widget-area .widget_recent_entries ul li::before {
display: none;
}
.footer-widget-area .widget_recent_entries .post-date {
display: block;
font-size: 0.75rem;
color: #888888;
margin-top: 0.25rem;
}
/* Categories Widget */
.footer-widget-area .widget_categories ul li,
.footer-widget-area .widget_archive ul li {
display: flex;
justify-content: space-between;
align-items: center;
}
.footer-widget-area .widget_categories ul li::before,
.footer-widget-area .widget_archive ul li::before {
position: static;
margin-right: 0.5rem;
}
/* Tag Cloud Widget */
.footer-widget-area .tagcloud,
.footer-widget-area .wp-block-tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.footer-widget-area .tagcloud a,
.footer-widget-area .wp-block-tag-cloud a {
display: inline-block;
padding: 0.25rem 0.75rem;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 4px;
font-size: 0.875rem !important;
transition: all 0.3s ease;
}
.footer-widget-area .tagcloud a:hover,
.footer-widget-area .wp-block-tag-cloud a:hover {
background-color: rgba(255, 255, 255, 0.2);
color: #ffffff;
}
/* Search Widget */
.footer-widget-area .widget_search form {
display: flex;
gap: 0.5rem;
}
.footer-widget-area .widget_search input[type="search"] {
flex: 1;
}
/* Calendar Widget */
.footer-widget-area .widget_calendar table {
width: 100%;
border-collapse: collapse;
}
.footer-widget-area .widget_calendar th,
.footer-widget-area .widget_calendar td {
padding: 0.5rem;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-widget-area .widget_calendar th {
background-color: rgba(255, 255, 255, 0.1);
font-weight: 600;
}
.footer-widget-area .widget_calendar td a {
font-weight: 600;
color: #ffffff;
}
/* Social Media Links */
.footer-widget-area .social-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.footer-widget-area .social-links a {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 50%;
transition: all 0.3s ease;
}
.footer-widget-area .social-links a:hover {
background-color: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
}
/* ==========================================================================
Responsive Design
========================================================================== */
/* Tablet Breakpoint (768px and below) */
@media (max-width: 767.98px) {
.footer-widgets {
padding: 3rem 0 2rem;
}
.footer-widget-area {
margin-bottom: 2rem;
}
.footer-widget-area .widget-title {
font-size: 1rem;
margin-bottom: 1.25rem;
padding-bottom: 0.5rem;
}
.footer-bottom {
padding: 1.5rem 0;
}
.footer-navigation {
justify-content: center;
}
.footer-menu {
justify-content: center;
gap: 1rem;
}
.copyright-text {
margin-bottom: 1rem;
}
}
/* Mobile Breakpoint (576px and below) */
@media (max-width: 575.98px) {
.footer-widgets {
padding: 2rem 0 1.5rem;
}
.footer-widget-area {
margin-bottom: 2.5rem;
}
.footer-widget-area .widget-title {
font-size: 0.9375rem;
}
.footer-bottom {
padding: 1.25rem 0;
}
.footer-menu {
flex-direction: column;
gap: 0.75rem;
align-items: center;
}
.footer-menu li {
width: 100%;
text-align: center;
}
.copyright-text,
.footer-menu {
font-size: 0.8125rem;
}
.footer-widget-area .social-links {
justify-content: center;
}
}
/* Large Desktop Breakpoint (1200px and above) */
@media (min-width: 1200px) {
.footer-widgets {
padding: 5rem 0 4rem;
}
.footer-widget-area .widget-title {
font-size: 1.25rem;
}
}
/* ==========================================================================
Print Styles
========================================================================== */
@media print {
.footer-widgets {
display: none;
}
.footer-bottom {
background: transparent;
border: none;
padding: 1rem 0;
}
.footer-navigation,
.theme-credits {
display: none;
}
.copyright-text {
color: #000000;
}
}
/* ==========================================================================
Accessibility Improvements
========================================================================== */
/* Focus Styles */
.footer-widget-area a:focus,
.footer-menu a:focus,
.footer-widget-area button:focus,
.footer-widget-area input:focus,
.footer-widget-area textarea:focus {
outline: 2px solid #ffffff;
outline-offset: 2px;
}
/* Screen Reader Text */
.footer-widget-area .screen-reader-text {
position: absolute;
left: -9999px;
top: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
}
/* Skip Link Focus */
.skip-to-footer:focus {
position: fixed;
top: 0;
left: 0;
background: #ffffff;
color: #1a1a1a;
padding: 1rem;
z-index: 100000;
text-decoration: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
/* High Contrast Mode Support */
@media (prefers-contrast: high) {
.site-footer {
border-top: 3px solid #ffffff;
}
.footer-widgets {
border-bottom-width: 2px;
}
.footer-widget-area a,
.footer-menu a {
text-decoration: underline;
}
}
/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
.footer-widget-area a,
.footer-widget-area button,
.footer-widget-area .btn,
.footer-menu a,
.footer-widget-area .social-links a {
transition: none;
}
}

View File

@@ -0,0 +1,499 @@
/**
* Header Styles - Sticky Navigation with Hamburger Menu
*
* This file contains all styles for the site header including:
* - Sticky header behavior
* - Desktop horizontal navigation
* - Mobile hamburger menu
* - Responsive breakpoints
* - Accessibility features
*
* @package Apus_Theme
* @since 1.0.0
*/
/* ==========================================================================
Header Base Styles
========================================================================== */
.site-header {
position: sticky;
top: 0;
left: 0;
right: 0;
width: 100%;
background-color: var(--header-bg, #ffffff);
box-shadow: var(--header-shadow, 0 2px 4px rgba(0, 0, 0, 0.1));
z-index: var(--z-header, 1000);
transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
/* Enhanced shadow when scrolled */
.site-header.scrolled {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
max-width: 1200px;
margin: 0 auto;
min-height: var(--header-height, 70px);
}
/* ==========================================================================
Site Branding / Logo
========================================================================== */
.site-branding {
flex-shrink: 0;
z-index: 2;
}
.site-identity {
display: flex;
flex-direction: column;
}
.site-title {
margin: 0;
font-size: 1.5rem;
font-weight: var(--font-weight-bold, 700);
line-height: 1.2;
}
.site-title a {
color: var(--color-dark, #212529);
text-decoration: none;
transition: color 0.3s ease;
}
.site-title a:hover {
color: var(--color-primary, #007bff);
text-decoration: none;
}
.site-title a:focus {
outline: 2px solid var(--color-primary, #007bff);
outline-offset: 2px;
border-radius: 2px;
}
.site-description {
margin: 0.25rem 0 0 0;
font-size: 0.875rem;
color: var(--color-secondary, #6c757d);
line-height: 1.3;
}
/* Custom Logo */
.custom-logo-link {
display: inline-block;
line-height: 0;
}
.custom-logo {
max-height: 50px;
width: auto;
height: auto;
transition: opacity 0.3s ease;
}
.custom-logo:hover {
opacity: 0.8;
}
/* ==========================================================================
Desktop Navigation
========================================================================== */
.desktop-nav {
display: none;
}
.primary-menu {
display: flex;
list-style: none;
margin: 0;
padding: 0;
gap: 0.5rem;
}
.primary-menu li {
position: relative;
margin: 0;
}
.primary-menu a {
display: block;
padding: 0.75rem 1rem;
color: var(--color-dark, #212529);
text-decoration: none;
font-weight: var(--font-weight-medium, 500);
font-size: 1rem;
border-radius: 4px;
transition: background-color 0.3s ease, color 0.3s ease;
}
.primary-menu a:hover,
.primary-menu a:focus {
background-color: var(--color-light, #f8f9fa);
color: var(--color-primary, #007bff);
text-decoration: none;
}
.primary-menu a:focus {
outline: 2px solid var(--color-primary, #007bff);
outline-offset: 2px;
}
/* Current menu item */
.primary-menu .current-menu-item > a,
.primary-menu .current_page_item > a {
color: var(--color-primary, #007bff);
background-color: rgba(0, 123, 255, 0.1);
}
/* Submenu styles (if needed) */
.primary-menu .sub-menu {
position: absolute;
top: 100%;
left: 0;
min-width: 200px;
background-color: #ffffff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
border-radius: 4px;
padding: 0.5rem 0;
margin: 0;
list-style: none;
opacity: 0;
visibility: hidden;
transform: translateY(-10px);
transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}
.primary-menu li:hover > .sub-menu,
.primary-menu li:focus-within > .sub-menu {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.primary-menu .sub-menu a {
padding: 0.5rem 1rem;
}
/* ==========================================================================
Mobile Menu Toggle (Hamburger)
========================================================================== */
.mobile-menu-toggle {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
padding: 0;
background: transparent;
border: none;
cursor: pointer;
position: relative;
z-index: var(--z-header, 1000);
transition: transform 0.3s ease;
}
.mobile-menu-toggle:hover {
background-color: var(--color-light, #f8f9fa);
border-radius: 4px;
}
.mobile-menu-toggle:focus {
outline: 2px solid var(--color-primary, #007bff);
outline-offset: 2px;
border-radius: 4px;
}
/* Hamburger Icon */
.hamburger-icon {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 24px;
height: 18px;
position: relative;
}
.hamburger-icon .line {
display: block;
width: 100%;
height: 2px;
background-color: var(--color-dark, #212529);
border-radius: 2px;
transition: transform 0.3s ease, opacity 0.3s ease;
transform-origin: center;
}
/* Hamburger animation when menu is open */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon .line:nth-child(1) {
transform: translateY(8px) rotate(45deg);
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon .line:nth-child(2) {
opacity: 0;
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon .line:nth-child(3) {
transform: translateY(-8px) rotate(-45deg);
}
/* ==========================================================================
Mobile Menu Overlay
========================================================================== */
.mobile-menu-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: var(--z-overlay, 998);
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-menu-overlay.active {
opacity: 1;
visibility: visible;
}
/* ==========================================================================
Mobile Navigation
========================================================================== */
.mobile-menu {
position: fixed;
top: 0;
right: 0;
width: 280px;
max-width: 85%;
height: 100%;
background-color: #ffffff;
box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
z-index: var(--z-mobile-menu, 999);
transform: translateX(100%);
transition: transform 0.3s ease;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.mobile-menu.active {
transform: translateX(0);
}
/* Mobile Menu Header */
.mobile-menu-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
border-bottom: 1px solid #e9ecef;
position: sticky;
top: 0;
background-color: #ffffff;
z-index: 10;
}
.mobile-menu-title {
font-size: 1.25rem;
font-weight: var(--font-weight-semibold, 600);
color: var(--color-dark, #212529);
}
.mobile-menu-close {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
font-size: 2rem;
line-height: 1;
cursor: pointer;
color: var(--color-dark, #212529);
transition: background-color 0.3s ease, color 0.3s ease;
border-radius: 4px;
}
.mobile-menu-close:hover {
background-color: var(--color-light, #f8f9fa);
color: var(--color-primary, #007bff);
}
.mobile-menu-close:focus {
outline: 2px solid var(--color-primary, #007bff);
outline-offset: 2px;
}
/* Mobile Menu Items */
.mobile-primary-menu {
list-style: none;
margin: 0;
padding: 1rem 0;
}
.mobile-primary-menu li {
margin: 0;
}
.mobile-primary-menu a {
display: block;
padding: 0.875rem 1.5rem;
color: var(--color-dark, #212529);
text-decoration: none;
font-size: 1.125rem;
font-weight: var(--font-weight-medium, 500);
border-left: 3px solid transparent;
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.mobile-primary-menu a:hover,
.mobile-primary-menu a:focus {
background-color: var(--color-light, #f8f9fa);
color: var(--color-primary, #007bff);
border-left-color: var(--color-primary, #007bff);
text-decoration: none;
}
.mobile-primary-menu a:focus {
outline: 2px solid var(--color-primary, #007bff);
outline-offset: -2px;
}
/* Current menu item in mobile */
.mobile-primary-menu .current-menu-item > a,
.mobile-primary-menu .current_page_item > a {
color: var(--color-primary, #007bff);
background-color: rgba(0, 123, 255, 0.05);
border-left-color: var(--color-primary, #007bff);
}
/* Mobile submenu */
.mobile-primary-menu .sub-menu {
list-style: none;
margin: 0;
padding: 0;
background-color: #f8f9fa;
}
.mobile-primary-menu .sub-menu a {
padding-left: 2.5rem;
font-size: 1rem;
}
/* ==========================================================================
Prevent body scroll when mobile menu is open
========================================================================== */
body.mobile-menu-open {
overflow: hidden;
}
/* ==========================================================================
Responsive Breakpoints
========================================================================== */
/* Tablet and up - 768px */
@media (min-width: 768px) {
.header-inner {
padding: 1rem 2rem;
}
.site-title {
font-size: 1.75rem;
}
.desktop-nav {
display: block;
}
.mobile-menu-toggle {
display: none;
}
.custom-logo {
max-height: 60px;
}
}
/* Desktop - 1024px */
@media (min-width: 1024px) {
.primary-menu {
gap: 1rem;
}
.primary-menu a {
padding: 0.75rem 1.25rem;
}
}
/* Large desktop - 1200px */
@media (min-width: 1200px) {
.header-inner {
padding: 1rem 0;
}
}
/* ==========================================================================
High Contrast Mode Support
========================================================================== */
@media (prefers-contrast: high) {
.site-header {
border-bottom: 2px solid currentColor;
}
.primary-menu a:focus,
.mobile-menu-toggle:focus,
.mobile-menu-close:focus {
outline-width: 3px;
}
}
/* ==========================================================================
Reduced Motion Support
========================================================================== */
@media (prefers-reduced-motion: reduce) {
.site-header,
.primary-menu a,
.mobile-menu,
.mobile-menu-overlay,
.hamburger-icon .line,
.mobile-menu-toggle {
transition: none;
}
}
/* ==========================================================================
Print Styles
========================================================================== */
@media print {
.site-header {
position: static;
box-shadow: none;
border-bottom: 1px solid #000;
}
.mobile-menu-toggle,
.desktop-nav,
.mobile-menu,
.mobile-menu-overlay {
display: none !important;
}
}

View File

@@ -0,0 +1,213 @@
/**
* Print Styles
*
* Optimized styling for printing
* @package Apus_Theme
* @since 1.0.0
*/
/* Hide elements that shouldn't print */
@media print {
/* Hide navigation, sidebars, and non-essential elements */
header,
nav,
.navbar,
.sidebar,
.widget-area,
.comments,
.comment-form,
.footer-widget,
.pagination,
.breadcrumb,
.back-to-top,
.share-buttons,
.related-posts,
button,
input[type="button"],
input[type="submit"],
.btn,
.modal,
.overlay,
.skip-link {
display: none !important;
}
/* Hide footer links and widgets */
footer {
display: none !important;
}
/* Body styles */
body {
margin: 0;
padding: 0;
background: white;
color: #000;
font-size: 12pt;
line-height: 1.5;
font-family: Georgia, serif;
}
/* Container and content */
.container,
.content,
main,
article {
width: 100%;
margin: 0;
padding: 0;
box-shadow: none;
}
/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
page-break-after: avoid;
color: #000;
margin: 0.5em 0;
}
h1 {
font-size: 24pt;
}
h2 {
font-size: 18pt;
}
h3 {
font-size: 16pt;
}
/* Paragraphs */
p {
orphans: 3;
widows: 3;
page-break-inside: avoid;
}
/* Links */
a,
a:visited {
text-decoration: underline;
color: #000;
}
a[href]:after {
content: " (" attr(href) ")";
font-size: 0.8em;
}
/* Exclude certain links from showing URL */
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
/* Images */
img {
max-width: 100%;
page-break-inside: avoid;
}
/* Tables */
table {
border-collapse: collapse;
width: 100%;
page-break-inside: avoid;
}
table,
th,
td {
border: 1px solid #000;
}
th,
td {
padding: 8px;
text-align: left;
}
thead {
display: table-header-group;
page-break-after: avoid;
}
tfoot {
display: table-footer-group;
page-break-before: avoid;
}
tr {
page-break-inside: avoid;
}
/* Lists */
ul,
ol {
margin: 0.5em 0;
padding-left: 2em;
}
li {
page-break-inside: avoid;
}
/* Code blocks */
pre,
code {
border: 1px solid #999;
background-color: #f5f5f5;
padding: 1em;
white-space: pre-wrap;
word-wrap: break-word;
}
/* Blockquotes */
blockquote {
border-left: 5px solid #ccc;
margin: 0;
padding-left: 1em;
page-break-inside: avoid;
}
/* Forms */
form {
display: none;
}
/* Page breaks */
.page-break,
.page-break-before {
page-break-before: always;
}
.page-break-after {
page-break-after: always;
}
/* Margins */
@page {
margin: 2cm;
orphans: 3;
widows: 3;
}
/* Print title and date */
.print-header {
page-break-after: avoid;
margin-bottom: 1em;
border-bottom: 2px solid #000;
padding-bottom: 0.5em;
}
.print-date {
font-size: 10pt;
color: #666;
}
}

View File

@@ -0,0 +1,460 @@
/**
* Related Posts Styles
*
* Responsive grid layout with Bootstrap 5 integration
* Supports cards with and without images
*
* @package Apus_Theme
* @since 1.0.0
*/
/* ========================================
Related Posts Section
======================================== */
.related-posts-section {
margin-top: 4rem;
margin-bottom: 3rem;
padding-top: 3rem;
border-top: 2px solid #e9ecef;
}
.related-posts-container {
width: 100%;
}
.related-posts-title {
font-size: 1.75rem;
font-weight: 700;
color: #212529;
margin-bottom: 2rem;
text-align: left;
position: relative;
padding-bottom: 0.75rem;
}
.related-posts-title::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 60px;
height: 3px;
background: linear-gradient(90deg, #1a73e8 0%, #4285f4 100%);
border-radius: 2px;
}
/* ========================================
Related Post Card
======================================== */
.related-post-card {
display: flex;
flex-direction: column;
height: 100%;
background: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
}
.related-post-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.related-post-link {
display: flex;
flex-direction: column;
height: 100%;
text-decoration: none;
color: inherit;
}
.related-post-link:hover {
text-decoration: none;
}
/* ========================================
Card with Thumbnail
======================================== */
.related-post-thumbnail {
position: relative;
width: 100%;
padding-bottom: 75%; /* 4:3 aspect ratio */
overflow: hidden;
background: #f8f9fa;
}
.related-post-thumbnail img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.related-post-card:hover .related-post-thumbnail img {
transform: scale(1.05);
}
/* ========================================
Card without Image (Color Background)
======================================== */
.related-post-no-image {
position: relative;
width: 100%;
padding-bottom: 75%; /* 4:3 aspect ratio */
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.related-post-no-image-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.5rem;
text-align: center;
}
.related-post-no-image-title {
font-size: 1.25rem;
font-weight: 700;
color: #ffffff;
margin: 0;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* ========================================
Category Badge
======================================== */
.related-post-category {
position: absolute;
top: 12px;
left: 12px;
display: inline-block;
padding: 0.375rem 0.875rem;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
background: rgba(255, 255, 255, 0.95);
color: #212529;
border-radius: 6px;
z-index: 10;
transition: all 0.2s ease;
backdrop-filter: blur(4px);
}
.related-post-category.no-image {
background: rgba(255, 255, 255, 0.2);
color: #ffffff;
border: 1px solid rgba(255, 255, 255, 0.3);
backdrop-filter: blur(8px);
}
.related-post-card:hover .related-post-category {
background: rgba(26, 115, 232, 0.95);
color: #ffffff;
}
.related-post-card:hover .related-post-category.no-image {
background: rgba(255, 255, 255, 0.95);
color: #212529;
border-color: transparent;
}
/* ========================================
Card Content
======================================== */
.related-post-content {
padding: 1.25rem;
flex: 1;
display: flex;
flex-direction: column;
}
.related-post-title {
font-size: 1.125rem;
font-weight: 600;
color: #212529;
margin: 0 0 0.75rem 0;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
transition: color 0.2s ease;
}
.related-post-card:hover .related-post-title {
color: #1a73e8;
}
.related-post-excerpt {
font-size: 0.9375rem;
color: #6c757d;
line-height: 1.6;
margin-bottom: 0.75rem;
flex: 1;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.related-post-meta {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: auto;
padding-top: 0.75rem;
border-top: 1px solid #e9ecef;
}
.related-post-date {
font-size: 0.8125rem;
color: #6c757d;
font-weight: 500;
}
/* ========================================
Cards without Thumbnail - Simplified Layout
======================================== */
.related-post-card.no-thumbnail .related-post-content {
padding: 1.5rem 1.25rem 1.25rem;
}
/* ========================================
Responsive Adjustments
======================================== */
/* Tablets */
@media (max-width: 991.98px) {
.related-posts-section {
margin-top: 3rem;
padding-top: 2.5rem;
}
.related-posts-title {
font-size: 1.5rem;
margin-bottom: 1.5rem;
}
.related-post-no-image-title {
font-size: 1.125rem;
-webkit-line-clamp: 4;
}
}
/* Mobile */
@media (max-width: 767.98px) {
.related-posts-section {
margin-top: 2.5rem;
padding-top: 2rem;
}
.related-posts-title {
font-size: 1.375rem;
margin-bottom: 1.25rem;
}
.related-post-card {
margin-bottom: 0; /* Bootstrap's g-4 handles gaps */
}
.related-post-thumbnail {
padding-bottom: 60%; /* Shorter aspect ratio on mobile */
}
.related-post-no-image {
padding-bottom: 60%;
}
.related-post-no-image-title {
font-size: 1rem;
}
.related-post-title {
font-size: 1rem;
}
.related-post-excerpt {
font-size: 0.875rem;
}
.related-post-content {
padding: 1rem;
}
.related-post-card.no-thumbnail .related-post-content {
padding: 1.25rem 1rem 1rem;
}
}
/* Small mobile */
@media (max-width: 575.98px) {
.related-posts-title {
font-size: 1.25rem;
}
.related-post-category {
font-size: 0.6875rem;
padding: 0.25rem 0.625rem;
}
.related-post-no-image-content {
padding: 1rem;
}
}
/* ========================================
Print Styles
======================================== */
@media print {
.related-posts-section {
page-break-inside: avoid;
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid #000;
}
.related-post-card {
page-break-inside: avoid;
box-shadow: none;
border: 1px solid #ddd;
}
.related-post-card:hover {
transform: none;
}
.related-post-thumbnail img,
.related-post-no-image {
display: none;
}
.related-post-category {
background: transparent;
border: 1px solid #000;
color: #000;
position: static;
display: inline-block;
margin-bottom: 0.5rem;
}
.related-post-content {
padding: 1rem;
}
.related-post-title {
color: #000;
}
.related-post-excerpt {
color: #333;
}
}
/* ========================================
Dark Mode Support (Optional)
======================================== */
@media (prefers-color-scheme: dark) {
.related-posts-section {
border-top-color: #343a40;
}
.related-posts-title {
color: #f8f9fa;
}
.related-post-card {
background: #212529;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.related-post-card:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.related-post-title {
color: #f8f9fa;
}
.related-post-card:hover .related-post-title {
color: #4285f4;
}
.related-post-excerpt {
color: #adb5bd;
}
.related-post-meta {
border-top-color: #343a40;
}
.related-post-date {
color: #adb5bd;
}
.related-post-category {
background: rgba(33, 37, 41, 0.95);
color: #f8f9fa;
}
}
/* ========================================
Accessibility
======================================== */
.related-post-link:focus {
outline: 2px solid #1a73e8;
outline-offset: 2px;
}
.related-post-link:focus-visible {
outline: 2px solid #1a73e8;
outline-offset: 2px;
}
/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
.related-post-card,
.related-post-thumbnail img,
.related-post-category,
.related-post-title {
transition: none;
}
.related-post-card:hover {
transform: none;
}
.related-post-card:hover .related-post-thumbnail img {
transform: none;
}
}

View File

@@ -0,0 +1,353 @@
/**
* Responsive Design Styles
*
* Media queries and responsive adjustments
* @package Apus_Theme
* @since 1.0.0
*/
/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
:root {
--bs-gutter-x: 1rem;
}
body {
font-size: 14px;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 20px;
}
h3 {
font-size: 18px;
}
.container-fluid {
padding: 0 10px;
}
/* Navigation adjustments */
.navbar {
padding: 0.5rem 0;
}
.navbar-brand {
font-size: 18px;
}
/* Content area */
main {
padding: 0.5rem;
}
/* Sidebar */
.sidebar {
margin-top: 2rem;
}
/* Tables become scrollable */
table {
font-size: 12px;
margin-bottom: 1rem;
overflow-x: auto;
}
.table-responsive {
margin-bottom: 1rem;
}
/* Buttons */
.btn {
padding: 0.375rem 0.75rem;
font-size: 14px;
}
.btn-lg {
padding: 0.5rem 1rem;
font-size: 16px;
}
/* Cards */
.card {
margin-bottom: 1rem;
}
/* Forms */
.form-group {
margin-bottom: 1rem;
}
.form-control {
padding: 0.375rem 0.75rem;
font-size: 16px;
}
/* Modals */
.modal-dialog {
margin: 0.5rem;
}
.modal-content {
border-radius: 4px;
}
/* Images */
img {
max-width: 100%;
height: auto;
}
/* Lists */
ul,
ol {
padding-left: 1.5rem;
}
/* Spacing utilities */
.mt-1,
.my-1 {
margin-top: 0.25rem !important;
}
.mb-1,
.my-1 {
margin-bottom: 0.25rem !important;
}
.p-1 {
padding: 0.25rem !important;
}
}
/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
body {
font-size: 14px;
}
h1 {
font-size: 28px;
}
h2 {
font-size: 22px;
}
h3 {
font-size: 18px;
}
}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
body {
font-size: 15px;
}
h1 {
font-size: 32px;
}
h2 {
font-size: 26px;
}
h3 {
font-size: 20px;
}
/* Two column layout for medium screens */
.row-md-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
}
/* Navigation */
.navbar {
padding: 1rem 0;
}
/* Sidebar */
.main-content {
display: grid;
grid-template-columns: 1fr 300px;
gap: 2rem;
}
.main-content.no-sidebar {
grid-template-columns: 1fr;
}
}
/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
body {
font-size: 16px;
}
h1 {
font-size: 36px;
}
h2 {
font-size: 28px;
}
h3 {
font-size: 22px;
}
/* Three column layout for large screens */
.row-lg-3 {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
}
/* Main content with sidebars */
.main-content {
display: grid;
grid-template-columns: 1fr 300px;
gap: 2rem;
}
.main-content.with-left-sidebar {
grid-template-columns: 250px 1fr 300px;
}
.content-wrapper {
max-width: 1200px;
margin: 0 auto;
}
}
/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
body {
font-size: 16px;
}
h1 {
font-size: 40px;
}
h2 {
font-size: 32px;
}
h3 {
font-size: 24px;
}
.container {
max-width: 1140px;
}
.container-lg {
max-width: 1280px;
}
.container-xl {
max-width: 1400px;
}
}
/* XXL devices (1400px and up) */
@media (min-width: 1400px) {
.container {
max-width: 1320px;
}
.container-xl {
max-width: 1500px;
}
.container-xxl {
max-width: 1700px;
}
}
/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
header {
padding: 0.5rem 0;
}
main {
padding: 0.5rem 0;
}
.btn {
padding: 0.25rem 0.5rem;
font-size: 12px;
}
}
/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
/* Touch devices */
@media (hover: none) and (pointer: coarse) {
button,
.btn,
a {
min-height: 44px;
min-width: 44px;
}
input[type="checkbox"],
input[type="radio"] {
width: 20px;
height: 20px;
}
}
/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
/* Dark mode support */
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
}
body {
background-color: #1a1a1a;
color: #e0e0e0;
}
a {
color: #64b5f6;
}
a:visited {
color: #ba68c8;
}
code,
pre {
background-color: #2d2d2d;
color: #e0e0e0;
}
}

View File

@@ -0,0 +1,709 @@
/**
* Theme Styles
*
* Main theme styles, colors, and custom components
* @package Apus_Theme
* @since 1.0.0
*/
:root {
/* Primary Colors */
--primary-color: #0d6efd;
--secondary-color: #6c757d;
--success-color: #198754;
--danger-color: #dc3545;
--warning-color: #ffc107;
--info-color: #0dcaf0;
--light-color: #f8f9fa;
--dark-color: #212529;
/* Brand Colors */
--brand-primary: #0d6efd;
--brand-secondary: #6c757d;
/* Neutral Colors */
--white: #ffffff;
--black: #000000;
--gray-100: #f8f9fa;
--gray-200: #e9ecef;
--gray-300: #dee2e6;
--gray-400: #ced4da;
--gray-500: #adb5bd;
--gray-600: #6c757d;
--gray-700: #495057;
--gray-800: #343a40;
--gray-900: #212529;
/* Spacing */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 3rem;
--spacing-3xl: 4rem;
/* Font family */
--font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-family-serif: Georgia, "Times New Roman", serif;
/* Font sizes */
--font-size-base: 16px;
--font-size-sm: 14px;
--font-size-lg: 18px;
--font-size-xl: 20px;
--font-size-2xl: 24px;
--font-size-3xl: 32px;
/* Line height */
--line-height-base: 1.5;
--line-height-sm: 1.25;
--line-height-lg: 1.75;
/* Border radius */
--border-radius: 0.25rem;
--border-radius-sm: 0.125rem;
--border-radius-lg: 0.5rem;
/* Box shadow */
--box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
--box-shadow-sm: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.075);
--box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
/* Transition */
--transition-base: all 0.3s ease-in-out;
--transition-fade: opacity 0.15s linear;
--transition-collapse: height 0.35s ease;
/* Z-index */
--z-dropdown: 1000;
--z-sticky: 1020;
--z-fixed: 1030;
--z-modal-backdrop: 1040;
--z-modal: 1050;
--z-popover: 1060;
--z-tooltip: 1070;
}
/* Global styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
*::before,
*::after {
box-sizing: border-box;
}
html {
font-size: 16px;
scroll-behavior: smooth;
}
body {
font-family: var(--font-family-base);
font-size: var(--font-size-base);
line-height: var(--line-height-base);
color: var(--gray-900);
background-color: var(--white);
transition: var(--transition-base);
}
/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
margin-bottom: var(--spacing-md);
font-weight: 700;
line-height: 1.2;
color: var(--gray-900);
}
h1 {
font-size: var(--font-size-3xl);
}
h2 {
font-size: var(--font-size-2xl);
}
h3 {
font-size: var(--font-size-xl);
}
h4 {
font-size: var(--font-size-lg);
}
h5 {
font-size: var(--font-size-base);
}
h6 {
font-size: var(--font-size-sm);
}
p {
margin-bottom: var(--spacing-md);
}
a {
color: var(--primary-color);
text-decoration: none;
transition: var(--transition-base);
}
a:hover {
color: #0b5ed7;
text-decoration: underline;
}
a:focus {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
/* Lists */
ul,
ol {
margin-bottom: var(--spacing-md);
padding-left: 2rem;
}
ul ul,
ul ol,
ol ul,
ol ol {
margin-bottom: 0;
}
li {
margin-bottom: 0.25rem;
}
/* Code */
code,
pre {
font-family: var(--font-family-monospace);
color: var(--gray-900);
background-color: var(--gray-100);
border-radius: var(--border-radius-lg);
}
code {
padding: 0.25rem 0.5rem;
font-size: 0.875em;
}
pre {
padding: var(--spacing-md);
margin-bottom: var(--spacing-md);
overflow-x: auto;
}
pre code {
padding: 0;
font-size: inherit;
background-color: transparent;
}
/* Blockquote */
blockquote {
margin-bottom: var(--spacing-md);
padding-left: var(--spacing-md);
border-left: 4px solid var(--gray-300);
color: var(--gray-700);
}
blockquote p:last-child {
margin-bottom: 0;
}
/* Images */
img {
max-width: 100%;
height: auto;
display: block;
}
figure {
margin-bottom: var(--spacing-md);
}
figcaption {
font-size: var(--font-size-sm);
color: var(--gray-600);
margin-top: 0.5rem;
}
/* Tables */
table {
width: 100%;
margin-bottom: var(--spacing-md);
border-collapse: collapse;
background-color: transparent;
}
table th,
table td {
padding: 0.75rem;
border-bottom: 1px solid var(--gray-300);
text-align: left;
vertical-align: top;
}
table thead th {
background-color: var(--gray-100);
font-weight: 700;
border-bottom: 2px solid var(--gray-300);
}
table tbody tr:hover {
background-color: var(--gray-50);
}
table tbody tr:nth-child(even) {
background-color: var(--gray-50);
}
/* Forms */
.form-group {
margin-bottom: var(--spacing-md);
}
label {
display: inline-block;
margin-bottom: 0.5rem;
font-weight: 500;
}
input,
textarea,
select,
.form-control {
width: 100%;
padding: 0.5rem 0.75rem;
font-family: inherit;
font-size: inherit;
line-height: var(--line-height-base);
color: var(--gray-900);
background-color: var(--white);
border: 1px solid var(--gray-300);
border-radius: var(--border-radius-lg);
transition: var(--transition-base);
}
input:focus,
textarea:focus,
select:focus,
.form-control:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
textarea {
min-height: 120px;
resize: vertical;
}
/* Buttons */
button,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
display: inline-block;
padding: 0.5rem 1rem;
font-family: inherit;
font-size: var(--font-size-base);
font-weight: 500;
line-height: var(--line-height-base);
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
user-select: none;
border: 1px solid transparent;
border-radius: var(--border-radius-lg);
background-color: var(--primary-color);
color: var(--white);
text-decoration: none;
transition: var(--transition-base);
}
button:hover,
.btn:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
background-color: #0b5ed7;
text-decoration: none;
}
button:focus,
.btn:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
outline: none;
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.5);
}
button:disabled,
.btn:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
opacity: 0.65;
cursor: not-allowed;
}
/* Button variants */
.btn-secondary {
background-color: var(--secondary-color);
color: var(--white);
}
.btn-secondary:hover {
background-color: #5a6268;
}
.btn-success {
background-color: var(--success-color);
color: var(--white);
}
.btn-success:hover {
background-color: #157347;
}
.btn-danger {
background-color: var(--danger-color);
color: var(--white);
}
.btn-danger:hover {
background-color: #bb2d3b;
}
.btn-warning {
background-color: var(--warning-color);
color: var(--gray-900);
}
.btn-warning:hover {
background-color: #ffbb33;
}
.btn-info {
background-color: var(--info-color);
color: var(--white);
}
.btn-info:hover {
background-color: #0aa8cc;
}
.btn-light {
background-color: var(--light-color);
color: var(--gray-900);
border-color: var(--gray-300);
}
.btn-light:hover {
background-color: #e2e6ea;
}
.btn-dark {
background-color: var(--dark-color);
color: var(--white);
}
.btn-dark:hover {
background-color: #1a1e21;
}
/* Button sizes */
.btn-sm {
padding: 0.25rem 0.5rem;
font-size: var(--font-size-sm);
}
.btn-lg {
padding: 0.75rem 1.5rem;
font-size: var(--font-size-lg);
}
/* Alerts */
.alert {
padding: var(--spacing-md);
margin-bottom: var(--spacing-md);
border: 1px solid transparent;
border-radius: var(--border-radius-lg);
}
.alert-primary {
background-color: #cfe2ff;
border-color: #b6d4fe;
color: #084298;
}
.alert-secondary {
background-color: #e2e3e5;
border-color: #d3d6d8;
color: #41464b;
}
.alert-success {
background-color: #d1e7dd;
border-color: #badbcc;
color: #0f5132;
}
.alert-danger {
background-color: #f8d7da;
border-color: #f5c2c7;
color: #842029;
}
.alert-warning {
background-color: #fff3cd;
border-color: #ffecb5;
color: #664d03;
}
.alert-info {
background-color: #d1ecf1;
border-color: #bee5eb;
color: #0c5460;
}
/* Cards */
.card {
display: flex;
flex-direction: column;
background-color: var(--white);
border: 1px solid var(--gray-300);
border-radius: var(--border-radius-lg);
overflow: hidden;
box-shadow: var(--box-shadow);
transition: var(--transition-base);
}
.card:hover {
box-shadow: var(--box-shadow-lg);
}
.card-header {
padding: var(--spacing-md);
background-color: var(--gray-100);
border-bottom: 1px solid var(--gray-300);
font-weight: 600;
}
.card-body {
padding: var(--spacing-md);
flex: 1;
}
.card-footer {
padding: var(--spacing-md);
background-color: var(--gray-100);
border-top: 1px solid var(--gray-300);
}
.card-title {
margin-bottom: 0.5rem;
font-size: var(--font-size-lg);
font-weight: 600;
}
.card-text {
margin-bottom: 0;
color: var(--gray-700);
}
/* Badges */
.badge {
display: inline-block;
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
font-weight: 600;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: var(--border-radius);
background-color: var(--primary-color);
color: var(--white);
}
.badge-secondary {
background-color: var(--secondary-color);
}
.badge-success {
background-color: var(--success-color);
}
.badge-danger {
background-color: var(--danger-color);
}
.badge-warning {
background-color: var(--warning-color);
color: var(--gray-900);
}
.badge-info {
background-color: var(--info-color);
}
.badge-light {
background-color: var(--light-color);
color: var(--gray-900);
}
.badge-dark {
background-color: var(--dark-color);
}
/* Helpers */
.text-primary {
color: var(--primary-color) !important;
}
.text-secondary {
color: var(--secondary-color) !important;
}
.text-success {
color: var(--success-color) !important;
}
.text-danger {
color: var(--danger-color) !important;
}
.text-warning {
color: var(--warning-color) !important;
}
.text-info {
color: var(--info-color) !important;
}
.text-light {
color: var(--light-color) !important;
}
.text-dark {
color: var(--dark-color) !important;
}
.text-muted {
color: var(--gray-600) !important;
}
.bg-primary {
background-color: var(--primary-color) !important;
}
.bg-secondary {
background-color: var(--secondary-color) !important;
}
.bg-success {
background-color: var(--success-color) !important;
}
.bg-danger {
background-color: var(--danger-color) !important;
}
.bg-warning {
background-color: var(--warning-color) !important;
}
.bg-info {
background-color: var(--info-color) !important;
}
.bg-light {
background-color: var(--light-color) !important;
}
.bg-dark {
background-color: var(--dark-color) !important;
}
.bg-white {
background-color: var(--white) !important;
}
/* Margin and Padding */
.m-0 {
margin: 0 !important;
}
.mt-0 {
margin-top: 0 !important;
}
.mb-0 {
margin-bottom: 0 !important;
}
.ml-0 {
margin-left: 0 !important;
}
.mr-0 {
margin-right: 0 !important;
}
.p-0 {
padding: 0 !important;
}
.pt-0 {
padding-top: 0 !important;
}
.pb-0 {
padding-bottom: 0 !important;
}
.pl-0 {
padding-left: 0 !important;
}
.pr-0 {
padding-right: 0 !important;
}
/* Dividers */
hr {
border: 0;
border-top: 1px solid var(--gray-300);
margin: var(--spacing-lg) 0;
}
/* Focus visible */
:focus-visible {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
/* Selection */
::selection {
background-color: var(--primary-color);
color: var(--white);
}

View File

@@ -0,0 +1,363 @@
/**
* 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: relative;
}
.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: inline-block;
transition: color 0.2s ease, transform 0.2s ease;
line-height: 1.5;
position: relative;
padding: 0.25rem 0;
}
.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 */
.apus-toc-link.active {
color: #0d6efd;
font-weight: 600;
}
.apus-toc-link.active::after {
content: '';
position: absolute;
left: -1rem;
top: 50%;
transform: translateY(-50%);
width: 4px;
height: 100%;
background-color: #0d6efd;
border-radius: 2px;
}
/* ========================================
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: #888;
border-radius: 3px;
}
.apus-toc-list::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Firefox */
.apus-toc-list {
scrollbar-width: thin;
scrollbar-color: #888 #f1f1f1;
}

View File

@@ -0,0 +1,527 @@
/**
* Utility Classes
*
* Common utility classes for spacing, sizing, and layout
* @package Apus_Theme
* @since 1.0.0
*/
/* Display utilities */
.d-none {
display: none !important;
}
.d-inline {
display: inline !important;
}
.d-inline-block {
display: inline-block !important;
}
.d-block {
display: block !important;
}
.d-flex {
display: flex !important;
}
.d-grid {
display: grid !important;
}
.d-table {
display: table !important;
}
.d-table-row {
display: table-row !important;
}
.d-table-cell {
display: table-cell !important;
}
.d-contents {
display: contents !important;
}
/* Visibility utilities */
.visibility-hidden {
visibility: hidden !important;
}
.visibility-visible {
visibility: visible !important;
}
/* Overflow utilities */
.overflow-auto {
overflow: auto !important;
}
.overflow-hidden {
overflow: hidden !important;
}
.overflow-visible {
overflow: visible !important;
}
.overflow-scroll {
overflow: scroll !important;
}
.overflow-x-auto {
overflow-x: auto !important;
}
.overflow-y-auto {
overflow-y: auto !important;
}
/* Position utilities */
.position-static {
position: static !important;
}
.position-relative {
position: relative !important;
}
.position-absolute {
position: absolute !important;
}
.position-fixed {
position: fixed !important;
}
.position-sticky {
position: sticky !important;
}
/* Floating utilities */
.float-start {
float: left !important;
}
.float-end {
float: right !important;
}
.float-none {
float: none !important;
}
/* Flex utilities */
.flex-row {
flex-direction: row !important;
}
.flex-column {
flex-direction: column !important;
}
.flex-wrap {
flex-wrap: wrap !important;
}
.flex-nowrap {
flex-wrap: nowrap !important;
}
.flex-grow-1 {
flex-grow: 1 !important;
}
.flex-shrink-1 {
flex-shrink: 1 !important;
}
.justify-content-start {
justify-content: flex-start !important;
}
.justify-content-end {
justify-content: flex-end !important;
}
.justify-content-center {
justify-content: center !important;
}
.justify-content-between {
justify-content: space-between !important;
}
.justify-content-around {
justify-content: space-around !important;
}
.align-items-start {
align-items: flex-start !important;
}
.align-items-end {
align-items: flex-end !important;
}
.align-items-center {
align-items: center !important;
}
.align-items-baseline {
align-items: baseline !important;
}
.align-items-stretch {
align-items: stretch !important;
}
.align-content-start {
align-content: flex-start !important;
}
.align-content-end {
align-content: flex-end !important;
}
.align-content-center {
align-content: center !important;
}
.align-content-between {
align-content: space-between !important;
}
/* Gap utilities */
.gap-0 {
gap: 0 !important;
}
.gap-1 {
gap: 0.25rem !important;
}
.gap-2 {
gap: 0.5rem !important;
}
.gap-3 {
gap: 1rem !important;
}
.gap-4 {
gap: 1.5rem !important;
}
.gap-5 {
gap: 3rem !important;
}
/* Text alignment */
.text-start {
text-align: left !important;
}
.text-end {
text-align: right !important;
}
.text-center {
text-align: center !important;
}
.text-justify {
text-align: justify !important;
}
/* Text transform */
.text-lowercase {
text-transform: lowercase !important;
}
.text-uppercase {
text-transform: uppercase !important;
}
.text-capitalize {
text-transform: capitalize !important;
}
/* Text wrapping */
.text-wrap {
word-wrap: break-word !important;
}
.text-nowrap {
white-space: nowrap !important;
}
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Font weight */
.fw-light {
font-weight: 300 !important;
}
.fw-normal {
font-weight: 400 !important;
}
.fw-bold {
font-weight: 700 !important;
}
.fw-bolder {
font-weight: 900 !important;
}
/* Font style */
.fst-italic {
font-style: italic !important;
}
.fst-normal {
font-style: normal !important;
}
/* Line height */
.lh-1 {
line-height: 1 !important;
}
.lh-sm {
line-height: 1.25 !important;
}
.lh-base {
line-height: 1.5 !important;
}
.lh-lg {
line-height: 2 !important;
}
/* Border utilities */
.border {
border: 1px solid #dee2e6 !important;
}
.border-0 {
border: 0 !important;
}
.border-top {
border-top: 1px solid #dee2e6 !important;
}
.border-end {
border-right: 1px solid #dee2e6 !important;
}
.border-bottom {
border-bottom: 1px solid #dee2e6 !important;
}
.border-start {
border-left: 1px solid #dee2e6 !important;
}
.border-rounded {
border-radius: 0.25rem !important;
}
.border-rounded-1 {
border-radius: 0.25rem !important;
}
.border-rounded-2 {
border-radius: 0.5rem !important;
}
.border-rounded-3 {
border-radius: 1rem !important;
}
.border-rounded-circle {
border-radius: 50% !important;
}
/* Width and Height */
.w-auto {
width: auto !important;
}
.w-25 {
width: 25% !important;
}
.w-50 {
width: 50% !important;
}
.w-75 {
width: 75% !important;
}
.w-100 {
width: 100% !important;
}
.h-auto {
height: auto !important;
}
.h-25 {
height: 25% !important;
}
.h-50 {
height: 50% !important;
}
.h-75 {
height: 75% !important;
}
.h-100 {
height: 100% !important;
}
.min-vh-100 {
min-height: 100vh !important;
}
/* Opacity */
.opacity-0 {
opacity: 0 !important;
}
.opacity-25 {
opacity: 0.25 !important;
}
.opacity-50 {
opacity: 0.5 !important;
}
.opacity-75 {
opacity: 0.75 !important;
}
.opacity-100 {
opacity: 1 !important;
}
/* Shadow */
.shadow-none {
box-shadow: none !important;
}
.shadow {
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}
.shadow-sm {
box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.075) !important;
}
.shadow-lg {
box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}
/* Clearfix */
.clearfix::after {
content: "";
display: table;
clear: both;
}
/* Cursor utilities */
.cursor-pointer {
cursor: pointer !important;
}
.cursor-default {
cursor: default !important;
}
.cursor-not-allowed {
cursor: not-allowed !important;
}
.cursor-auto {
cursor: auto !important;
}
/* User select */
.user-select-auto {
user-select: auto !important;
}
.user-select-none {
user-select: none !important;
}
.user-select-all {
user-select: all !important;
}
/* Pointer events */
.pointer-events-none {
pointer-events: none !important;
}
.pointer-events-auto {
pointer-events: auto !important;
}
/* Object fit */
.object-fit-contain {
object-fit: contain !important;
}
.object-fit-cover {
object-fit: cover !important;
}
.object-fit-fill {
object-fit: fill !important;
}
.object-fit-scale {
object-fit: scale-down !important;
}
/* Z-index */
.z-1 {
z-index: 1 !important;
}
.z-2 {
z-index: 2 !important;
}
.z-3 {
z-index: 3 !important;
}
.z-auto {
z-index: auto !important;
}
/* Transition */
.transition-all {
transition: all 0.3s ease !important;
}
.transition-none {
transition: none !important;
}

View File

@@ -0,0 +1,216 @@
/**
* AdSense Delayed Loader
*
* This script delays the loading of Google AdSense until user interaction
* or a timeout occurs, improving initial page load performance.
*
* @package Apus_Theme
* @since 1.0.0
*/
(function() {
'use strict';
// Configuration
const CONFIG = {
timeout: 5000, // Fallback timeout in milliseconds
loadedClass: 'adsense-loaded',
debug: false // Set to true for console logging
};
// State
let adsenseLoaded = false;
let loadTimeout = null;
/**
* Log debug messages if debug mode is enabled
* @param {string} message - The message to log
*/
function debugLog(message) {
if (CONFIG.debug && typeof console !== 'undefined') {
console.log('[AdSense Loader] ' + message);
}
}
/**
* Load AdSense scripts and initialize ads
*/
function loadAdSense() {
// Prevent multiple loads
if (adsenseLoaded) {
debugLog('AdSense already loaded, skipping...');
return;
}
adsenseLoaded = true;
debugLog('Loading AdSense scripts...');
// Clear the timeout if it exists
if (loadTimeout) {
clearTimeout(loadTimeout);
loadTimeout = null;
}
// Remove event listeners to prevent multiple triggers
removeEventListeners();
// Load AdSense script tags
loadAdSenseScripts();
// Execute AdSense push scripts
executeAdSensePushScripts();
// Add loaded class to body
document.body.classList.add(CONFIG.loadedClass);
debugLog('AdSense loading complete');
}
/**
* Find and load all delayed AdSense script tags
*/
function loadAdSenseScripts() {
const delayedScripts = document.querySelectorAll('script[data-adsense-script]');
if (delayedScripts.length === 0) {
debugLog('No delayed AdSense scripts found');
return;
}
debugLog('Found ' + delayedScripts.length + ' delayed AdSense script(s)');
delayedScripts.forEach(function(oldScript) {
const newScript = document.createElement('script');
// Copy attributes
if (oldScript.src) {
newScript.src = oldScript.src;
}
// Set async attribute
newScript.async = true;
// Copy crossorigin if present
if (oldScript.getAttribute('crossorigin')) {
newScript.crossorigin = oldScript.getAttribute('crossorigin');
}
// Replace old script with new one
oldScript.parentNode.replaceChild(newScript, oldScript);
});
}
/**
* Execute delayed AdSense push scripts
*/
function executeAdSensePushScripts() {
const delayedPushScripts = document.querySelectorAll('script[data-adsense-push]');
if (delayedPushScripts.length === 0) {
debugLog('No delayed AdSense push scripts found');
return;
}
debugLog('Found ' + delayedPushScripts.length + ' delayed push script(s)');
// Initialize adsbygoogle array if it doesn't exist
window.adsbygoogle = window.adsbygoogle || [];
delayedPushScripts.forEach(function(oldScript) {
const scriptContent = oldScript.innerHTML;
// Create and execute new script
const newScript = document.createElement('script');
newScript.innerHTML = scriptContent;
newScript.type = 'text/javascript';
// Replace old script with new one
oldScript.parentNode.replaceChild(newScript, oldScript);
});
}
/**
* Event handler for user interactions
*/
function handleUserInteraction() {
debugLog('User interaction detected');
loadAdSense();
}
/**
* Remove all event listeners
*/
function removeEventListeners() {
window.removeEventListener('scroll', handleUserInteraction, { passive: true });
window.removeEventListener('mousemove', handleUserInteraction, { passive: true });
window.removeEventListener('touchstart', handleUserInteraction, { passive: true });
window.removeEventListener('click', handleUserInteraction, { passive: true });
window.removeEventListener('keydown', handleUserInteraction, { passive: true });
}
/**
* Add event listeners for user interactions
*/
function addEventListeners() {
debugLog('Adding event listeners for user interaction');
// Scroll event - load on first scroll
window.addEventListener('scroll', handleUserInteraction, { passive: true, once: true });
// Mouse movement - load when user moves mouse
window.addEventListener('mousemove', handleUserInteraction, { passive: true, once: true });
// Touch events - load on first touch (mobile)
window.addEventListener('touchstart', handleUserInteraction, { passive: true, once: true });
// Click events - load on first click
window.addEventListener('click', handleUserInteraction, { passive: true, once: true });
// Keyboard events - load on first key press
window.addEventListener('keydown', handleUserInteraction, { passive: true, once: true });
}
/**
* Set timeout fallback to load AdSense after specified time
*/
function setTimeoutFallback() {
debugLog('Setting timeout fallback (' + CONFIG.timeout + 'ms)');
loadTimeout = setTimeout(function() {
debugLog('Timeout reached, loading AdSense');
loadAdSense();
}, CONFIG.timeout);
}
/**
* Initialize the AdSense delayed loader
*/
function init() {
// Check if AdSense delay is enabled
if (!window.apusAdsenseDelayed) {
debugLog('AdSense delay not enabled');
return;
}
debugLog('Initializing AdSense delayed loader');
// Check if page is already interactive or complete
if (document.readyState === 'interactive' || document.readyState === 'complete') {
debugLog('Page already loaded, starting listeners');
addEventListeners();
setTimeoutFallback();
} else {
// Wait for DOM to be ready
debugLog('Waiting for DOMContentLoaded');
document.addEventListener('DOMContentLoaded', function() {
debugLog('DOMContentLoaded fired');
addEventListeners();
setTimeoutFallback();
});
}
}
// Start initialization
init();
})();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,342 @@
/**
* Header Navigation JavaScript
*
* This file handles:
* - Mobile hamburger menu toggle
* - Sticky header behavior
* - Smooth scroll to anchors (optional)
* - Accessibility features (keyboard navigation, ARIA attributes)
* - Body scroll locking when mobile menu is open
*
* @package Apus_Theme
* @since 1.0.0
*/
(function() {
'use strict';
/**
* Initialize on DOM ready
*/
function init() {
setupMobileMenu();
setupStickyHeader();
setupSmoothScroll();
setupKeyboardNavigation();
}
/**
* Mobile Menu Functionality
*/
function setupMobileMenu() {
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
const mobileMenu = document.getElementById('mobile-menu');
const mobileMenuOverlay = document.getElementById('mobile-menu-overlay');
const mobileMenuClose = document.getElementById('mobile-menu-close');
if (!mobileMenuToggle || !mobileMenu || !mobileMenuOverlay) {
return;
}
// Open mobile menu
mobileMenuToggle.addEventListener('click', function() {
openMobileMenu();
});
// Close mobile menu via close button
if (mobileMenuClose) {
mobileMenuClose.addEventListener('click', function() {
closeMobileMenu();
});
}
// Close mobile menu via overlay click
mobileMenuOverlay.addEventListener('click', function() {
closeMobileMenu();
});
// Close mobile menu on Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && mobileMenu.classList.contains('active')) {
closeMobileMenu();
mobileMenuToggle.focus();
}
});
// Close mobile menu when clicking a menu link
const mobileMenuLinks = mobileMenu.querySelectorAll('a');
mobileMenuLinks.forEach(function(link) {
link.addEventListener('click', function() {
closeMobileMenu();
});
});
// Handle window resize - close mobile menu if switching to desktop
let resizeTimer;
window.addEventListener('resize', function() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
if (window.innerWidth >= 768 && mobileMenu.classList.contains('active')) {
closeMobileMenu();
}
}, 250);
});
}
/**
* Open mobile menu
*/
function openMobileMenu() {
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
const mobileMenu = document.getElementById('mobile-menu');
const mobileMenuOverlay = document.getElementById('mobile-menu-overlay');
// Add active classes
mobileMenu.classList.add('active');
mobileMenuOverlay.classList.add('active');
document.body.classList.add('mobile-menu-open');
// Update ARIA attributes
mobileMenuToggle.setAttribute('aria-expanded', 'true');
mobileMenu.setAttribute('aria-hidden', 'false');
mobileMenuOverlay.setAttribute('aria-hidden', 'false');
// Focus trap - focus first menu item
const firstMenuItem = mobileMenu.querySelector('a');
if (firstMenuItem) {
setTimeout(function() {
firstMenuItem.focus();
}, 300);
}
}
/**
* Close mobile menu
*/
function closeMobileMenu() {
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
const mobileMenu = document.getElementById('mobile-menu');
const mobileMenuOverlay = document.getElementById('mobile-menu-overlay');
// Remove active classes
mobileMenu.classList.remove('active');
mobileMenuOverlay.classList.remove('active');
document.body.classList.remove('mobile-menu-open');
// Update ARIA attributes
mobileMenuToggle.setAttribute('aria-expanded', 'false');
mobileMenu.setAttribute('aria-hidden', 'true');
mobileMenuOverlay.setAttribute('aria-hidden', 'true');
}
/**
* Sticky Header Behavior
*/
function setupStickyHeader() {
const header = document.getElementById('masthead');
if (!header) {
return;
}
let lastScrollTop = 0;
let scrollThreshold = 100;
window.addEventListener('scroll', function() {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
// Add/remove scrolled class based on scroll position
if (scrollTop > scrollThreshold) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
lastScrollTop = scrollTop;
}, { passive: true });
}
/**
* Smooth Scroll to Anchors (Optional)
*/
function setupSmoothScroll() {
// Check if user prefers reduced motion
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (prefersReducedMotion) {
return;
}
// Get all anchor links
const anchorLinks = document.querySelectorAll('a[href^="#"]');
anchorLinks.forEach(function(link) {
link.addEventListener('click', function(e) {
const href = this.getAttribute('href');
// Skip if href is just "#"
if (href === '#') {
return;
}
const target = document.querySelector(href);
if (target) {
e.preventDefault();
// Get header height for offset
const header = document.getElementById('masthead');
const headerHeight = header ? header.offsetHeight : 0;
const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - headerHeight - 20;
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
// Update URL hash
if (history.pushState) {
history.pushState(null, null, href);
}
// Focus target element for accessibility
target.setAttribute('tabindex', '-1');
target.focus();
}
});
});
}
/**
* Keyboard Navigation for Menus
*/
function setupKeyboardNavigation() {
const menuItems = document.querySelectorAll('.primary-menu > li, .mobile-primary-menu > li');
menuItems.forEach(function(item) {
const link = item.querySelector('a');
const submenu = item.querySelector('.sub-menu');
if (!link || !submenu) {
return;
}
// Open submenu on Enter/Space
link.addEventListener('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
if (submenu) {
e.preventDefault();
toggleSubmenu(item, submenu);
}
}
// Close submenu on Escape
if (e.key === 'Escape') {
closeSubmenu(item, submenu);
link.focus();
}
});
// Close submenu when focus leaves
const submenuLinks = submenu.querySelectorAll('a');
if (submenuLinks.length > 0) {
const lastSubmenuLink = submenuLinks[submenuLinks.length - 1];
lastSubmenuLink.addEventListener('keydown', function(e) {
if (e.key === 'Tab' && !e.shiftKey) {
closeSubmenu(item, submenu);
}
});
}
});
}
/**
* Toggle submenu visibility
*/
function toggleSubmenu(item, submenu) {
const isExpanded = item.classList.contains('submenu-open');
if (isExpanded) {
closeSubmenu(item, submenu);
} else {
openSubmenu(item, submenu);
}
}
/**
* Open submenu
*/
function openSubmenu(item, submenu) {
item.classList.add('submenu-open');
submenu.setAttribute('aria-hidden', 'false');
const firstLink = submenu.querySelector('a');
if (firstLink) {
firstLink.focus();
}
}
/**
* Close submenu
*/
function closeSubmenu(item, submenu) {
item.classList.remove('submenu-open');
submenu.setAttribute('aria-hidden', 'true');
}
/**
* Trap focus within mobile menu when open
*/
function setupFocusTrap() {
const mobileMenu = document.getElementById('mobile-menu');
if (!mobileMenu) {
return;
}
document.addEventListener('keydown', function(e) {
if (!mobileMenu.classList.contains('active')) {
return;
}
if (e.key === 'Tab') {
const focusableElements = mobileMenu.querySelectorAll(
'a, button, [tabindex]:not([tabindex="-1"])'
);
const firstElement = focusableElements[0];
const lastElement = focusableElements[focusableElements.length - 1];
if (e.shiftKey) {
// Shift + Tab
if (document.activeElement === firstElement) {
e.preventDefault();
lastElement.focus();
}
} else {
// Tab
if (document.activeElement === lastElement) {
e.preventDefault();
firstElement.focus();
}
}
}
});
}
/**
* Initialize focus trap
*/
setupFocusTrap();
/**
* Initialize when DOM is ready
*/
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();

View File

@@ -0,0 +1,216 @@
/**
* Table of Contents JavaScript
*
* Provides smooth scrolling and active link highlighting for the TOC.
* Pure vanilla JavaScript - no jQuery dependency.
*
* @package Apus_Theme
* @since 1.0.0
*/
(function() {
'use strict';
/**
* Initialize TOC functionality when DOM is ready
*/
function initTOC() {
const toc = document.querySelector('.apus-toc');
if (!toc) {
return; // No TOC on this page
}
initToggleButton();
initSmoothScroll();
initActiveHighlight();
}
/**
* Initialize toggle button functionality
*/
function initToggleButton() {
const toggleButton = document.querySelector('.apus-toc-toggle');
const tocList = document.querySelector('.apus-toc-list');
if (!toggleButton || !tocList) {
return;
}
toggleButton.addEventListener('click', function() {
const isExpanded = this.getAttribute('aria-expanded') === 'true';
this.setAttribute('aria-expanded', !isExpanded);
// Save state to localStorage
try {
localStorage.setItem('apus-toc-collapsed', isExpanded ? 'true' : 'false');
} catch (e) {
// localStorage might not be available
}
});
// Restore saved state
try {
const isCollapsed = localStorage.getItem('apus-toc-collapsed') === 'true';
if (isCollapsed) {
toggleButton.setAttribute('aria-expanded', 'false');
}
} catch (e) {
// localStorage might not be available
}
}
/**
* Initialize smooth scrolling for TOC links
*/
function initSmoothScroll() {
const tocLinks = document.querySelectorAll('.apus-toc-link');
tocLinks.forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href').substring(1);
const targetElement = document.getElementById(targetId);
if (!targetElement) {
return;
}
// Smooth scroll to target
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
// Update URL without jumping
if (history.pushState) {
history.pushState(null, null, '#' + targetId);
} else {
window.location.hash = targetId;
}
// Update active state
updateActiveLink(this);
// Focus the target heading for accessibility
targetElement.setAttribute('tabindex', '-1');
targetElement.focus();
});
});
}
/**
* Initialize active link highlighting based on scroll position
*/
function initActiveHighlight() {
const tocLinks = document.querySelectorAll('.apus-toc-link');
const headings = Array.from(document.querySelectorAll('h2[id], h3[id]'));
if (headings.length === 0) {
return;
}
let ticking = false;
// Debounced scroll handler
function onScroll() {
if (!ticking) {
window.requestAnimationFrame(function() {
updateActiveOnScroll(headings, tocLinks);
ticking = false;
});
ticking = true;
}
}
window.addEventListener('scroll', onScroll, { passive: true });
// Initial update
updateActiveOnScroll(headings, tocLinks);
}
/**
* Update active link based on scroll position
*
* @param {Array} headings Array of heading elements
* @param {NodeList} tocLinks TOC link elements
*/
function updateActiveOnScroll(headings, tocLinks) {
const scrollPosition = window.scrollY + 100; // Offset for better UX
// Find the current heading
let currentHeading = null;
for (let i = headings.length - 1; i >= 0; i--) {
if (headings[i].offsetTop <= scrollPosition) {
currentHeading = headings[i];
break;
}
}
// If we're at the top, use the first heading
if (!currentHeading && scrollPosition < headings[0].offsetTop) {
currentHeading = headings[0];
}
// Update active class
tocLinks.forEach(function(link) {
if (currentHeading && link.getAttribute('href') === '#' + currentHeading.id) {
link.classList.add('active');
} else {
link.classList.remove('active');
}
});
}
/**
* Update active link when clicked
*
* @param {Element} clickedLink The clicked TOC link
*/
function updateActiveLink(clickedLink) {
const tocLinks = document.querySelectorAll('.apus-toc-link');
tocLinks.forEach(function(link) {
link.classList.remove('active');
});
clickedLink.classList.add('active');
}
/**
* Handle hash navigation on page load
*/
function handleHashOnLoad() {
if (!window.location.hash) {
return;
}
const targetId = window.location.hash.substring(1);
const targetElement = document.getElementById(targetId);
const tocLink = document.querySelector('.apus-toc-link[href="#' + targetId + '"]');
if (targetElement && tocLink) {
// Small delay to ensure page is fully loaded
setTimeout(function() {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
updateActiveLink(tocLink);
}, 100);
}
}
/**
* Initialize when DOM is ready
*/
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function() {
initTOC();
handleHashOnLoad();
});
} else {
// DOM is already ready
initTOC();
handleHashOnLoad();
}
})();