/* Reference Digital Resources pager and posts display */
#alphaPager {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    margin: 1rem 0;
}

nav.alphabetical-pager ul {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    list-style-type: none !important;
    width: 100%;
    padding: 0;
    gap: 0.5rem;
}

nav.alphabetical-pager ul li {
    margin: 0.25rem;
    font-size: 1.2rem;
}

nav.alphabetical-pager ul li a {
    display: inline-block;
    padding: 0.4rem 0.6rem;
    text-align: center;
    min-width: 1.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

nav.alphabetical-pager ul li a:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Active letter styling */
nav.alphabetical-pager ul li a.active {
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.1);
}

.letter-posts::before { 
    display: block; 
    content: " "; 
    margin-top: -140px; 
    height: 140px; 
    visibility: hidden; 
    pointer-events: none;
}

div.back-to-top {
    margin-bottom: 1.4em !important;
}

div.back-to-top a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

div.back-to-top a:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.lead {
    font-size: calc(1.75em + 1vw);
    font-weight: 600 !important;
    margin: 1.5em 0 0.5em 0 !important;
}

.lead-letter {
    display: inline-block;
}

h3.elementor-post__title a {
    text-decoration: underline !important;
}

/* Limit line length for better readability (WCAG 2.1 AA) */
.elementor-post__text {
    max-width: 70ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.elementor-post__text p {
    margin-bottom: 1em;
}

/* Add scroll margin to the navigation target for better positioning */
#alphabetical-pager-nav {
    scroll-margin-top: 200px;
}

/* Media query for mobile devices */
@media (max-width: 768px) {
    #alphaPager {
        width: 100%;
        padding: 0;
        box-sizing: border-box;
        display: flex;
        justify-content: center;
    }
    
    nav.alphabetical-pager {
        width: 100%;
        display: flex;
        justify-content: center;
        box-sizing: border-box;
        padding: 0;
    }
    
    nav.alphabetical-pager ul {
        gap: 0.3rem;
        padding: 0;
        margin: 0 auto;
        width: 90%;
        max-width: 90%;
        justify-content: center;
        box-sizing: border-box;
    }
    
    nav.alphabetical-pager ul li {
        margin: 0.15rem;
        font-size: 1.1rem; /* Increased from 0.9rem */
    }
    
    nav.alphabetical-pager ul li a {
        padding: 0.5rem 0.6rem; /* Increased from 0.3rem 0.4rem */
        min-width: 1.5rem; /* Increased from 1.2rem */
    }
    
    .lead {
        font-size: calc(1.3em + 1vw);
        line-height: 1.2;
    }
    
    .lead-letter {
        font-size: 1.2em;
    }
}

/* Media query for very small screens */
@media (max-width: 480px) {
    #alphaPager {
        padding: 0;
    }
    
    nav.alphabetical-pager ul {
        width: 90%;
        max-width: 90%;
        box-sizing: border-box;
        margin: 0 auto;
        padding: 0;
    }
    
    nav.alphabetical-pager ul li {
        font-size: 1rem; /* Increased from 0.8rem */
        margin: 0.1rem;
    }
    
    nav.alphabetical-pager ul li a {
        padding: 0.45rem 0.5rem; /* Increased from 0.25rem 0.35rem */
        min-width: 1.3rem; /* Increased from 1rem */
        min-height: 1.3rem; /* Added to ensure good tap target size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .lead {
        font-size: calc(1.2em + 0.8vw);
        line-height: 1.2;
        margin: 1.2em 0 0.4em 0 !important;
    }
    
    .lead-letter {
        font-size: 1.35em;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}