/**
 * Links Directory Public CSS
 */

/* Global styling for Links Directory - GeneratePress Compatible */
.link-featured-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.link-featured-image-container {
    margin-bottom: 25px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Rating stars styling */
.rating-stars {
    color: #ffc107;
    margin-right: 8px;
    letter-spacing: 1px;
    font-size: 16px;
    line-height: 1;
}

.star {
    display: inline-block;
}

.star.full, .star.half {
    color: #ffc107;
}

.star.empty {
    color: #e0e0e0;
}

.rating-text {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* Tags Display Styling */
.link-tags {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.link-tags .tags-title {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.link-tags .tags-title:before {
    content: "🏷️";
    margin-right: 8px;
    font-size: 18px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.link-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #fff;
    color: #5D5CDE !important;
    text-decoration: none !important;
    border: 1px solid #5D5CDE;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.link-tag svg {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    flex-shrink: 0;
}

.link-tag:hover {
    background: #5D5CDE;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(93, 92, 222, 0.3);
}

.link-tag:focus {
    outline: 2px solid #5D5CDE;
    outline-offset: 2px;
}

/* Tag Archive Header Styling */
.links-tag-header {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 40px 0;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    overflow: hidden;
}

.links-tag-header:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="tag-pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23dee2e6" opacity="0.3"/></pattern></defs><rect width="100" height="20" fill="url(%23tag-pattern)"/></svg>') repeat;
    opacity: 0.5;
}

.links-tag-header .inside-article {
    position: relative;
    z-index: 1;
}

.tag-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #5D5CDE, #4A49B5);
    border-radius: 50%;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(93, 92, 222, 0.3);
}

.tag-header-icon svg {
    color: white;
    width: 32px;
    height: 32px;
}

.links-tag-header .page-title {
    margin-bottom: 15px;
    font-size: 2.5em;
    font-weight: 700;
    color: #333;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tag-description {
    max-width: 600px;
    margin: 0 auto 15px;
    color: #666;
    font-size: 18px;
    line-height: 1.6;
}

.links-tag-header .archive-description {
    max-width: 800px;
    margin: 20px auto 0;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Tag Badge Styling */
.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: #e9ecef;
    color: #6c757d !important;
    text-decoration: none !important;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tag-badge svg {
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

.tag-badge:hover {
    background: #5D5CDE;
    color: white !important;
    border-color: #5D5CDE;
    transform: translateY(-1px);
}

/* Related Tag Links Styling */
.related-link-tag {
    margin-bottom: 8px;
}

.related-link-tag a {
    display: inline-flex;
    align-items: center;
    background: #f1f3f4;
    color: #5f6368 !important;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border: 1px solid #e8eaed;
}

.related-link-tag a:hover {
    background: #5D5CDE;
    color: white !important;
    border-color: #5D5CDE;
    transform: translateY(-1px);
}

/* Category page header styling */
.links-category-header {
    margin-bottom: 30px;
    background-color: #f8f9fa;
    padding: 40px 0;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.links-category-header .page-title {
    margin-bottom: 15px;
}

.links-category-header .archive-description {
    max-width: 800px;
    margin: 0 auto;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

/* Link cards grid layout */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.link-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0,0,0,0.07);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid rgba(0,0,0,0.05);
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.link-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.link-card-thumbnail {
    position: relative;
    padding-top: 60%;
    overflow: hidden;
}

.link-card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.link-card:hover .link-card-thumbnail img {
    transform: scale(1.05);
}

.placeholder-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6a7dfe, #5D5CDE);
    color: white;
    font-size: 40px;
    font-weight: 700;
}

.link-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.link-card-header {
    margin-bottom: 15px;
}

.link-card-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.link-card-title a {
    color: var(--content-headings-color, #222);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-card-title a:hover {
    color: #5D5CDE;
}

.link-card-rating {
    display: flex;
    align-items: center;
}

.link-card-excerpt {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    flex-grow: 1;
}

.link-card-actions {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    gap: 10px;
}

.link-card-details, 
.link-card-visit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}

.link-card-details svg,
.link-card-visit svg {
    margin-right: 6px;
    width: 16px;
    height: 16px;
}

.link-card-details {
    background: #f1f1f1;
    color: #555 !important;
}

.link-card-visit {
    background: #5D5CDE;
    color: white !important;
}

.link-card-details:hover {
    background: #e5e5e5;
    color: #333 !important;
}

.link-card-visit:hover {
    background: #4A49B5;
    color: white !important;
    transform: translateY(-2px);
}

/* No links found */
.no-links-found {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 40px;
}

.no-links-icon {
    margin-bottom: 20px;
    color: #ccc;
}

.no-links-found h3 {
    font-size: 22px;
    margin: 0 0 10px;
    color: #333;
}

.no-links-found p {
    color: #666;
    margin: 0;
    font-size: 16px;
}

/* Related Links Section */
.related-links-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.related-links-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 10px;
    text-align: center;
}

.related-links-description {
    color: #666;
    font-size: 16px;
    margin: 0 0 25px;
    text-align: center;
}

.related-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.related-link-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.07);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid rgba(0,0,0,0.05);
}

.related-link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.related-link-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.related-link-thumbnail {
    position: relative;
    padding-top: 60%;
    overflow: hidden;
}

.related-link-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-link-card:hover .related-link-thumbnail img {
    transform: scale(1.05);
}

.related-link-thumbnail.no-thumbnail .placeholder-thumbnail {
    background: linear-gradient(135deg, #5D5CDE, #4A49B5);
    font-size: 36px;
}

.related-link-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-link-category {
    margin-bottom: 8px;
}

.related-link-category a {
    display: inline-block;
    background: #f1f1f1;
    color: #666 !important;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 12px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.related-link-category a:hover {
    background: #e5e5e5;
    color: #333 !important;
}

.related-link-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.related-link-title a {
    color: var(--content-headings-color, #222);
    text-decoration: none !important;
}

.related-link-title a:hover {
    color: #5D5CDE;
}

.related-link-rating {
    margin-bottom: 12px;
}

.related-link-rating .rating-stars {
    font-size: 14px;
}

.related-link-actions {
    margin-top: auto;
}

.view-details {
    display: inline-block;
    padding: 6px 14px;
    background: #5D5CDE;
    color: white !important;
    border-radius: 4px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-details:hover {
    background: #4A49B5;
    color: white !important;
    transform: translateY(-2px);
}

/* Single link page specific styles */
.link-entry {
    margin-bottom: 0;
}

.link-entry .entry-header {
    margin-bottom: 25px;
    text-align: center;
}

.link-categories {
    margin-bottom: 15px;
}

.link-category-badge {
    display: inline-block;
    background: #f1f1f1;
    color: #666 !important;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 14px;
    text-decoration: none !important;
    margin: 0 5px 5px 0;
    transition: all 0.2s ease;
}

.link-category-badge:hover {
    background: #e5e5e5;
    color: #333 !important;
}

.link-entry .entry-title {
    margin-bottom: 15px;
}

.link-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
}

.link-rating .rating-stars {
    font-size: 20px;
    margin-right: 10px;
}

.link-rating .rating-text {
    font-size: 16px;
    font-weight: 500;
}

.link-description {
    margin-bottom: 30px;
    color: var(--content-text-color, #222);
}

.link-action {
    text-align: center;
    margin: 30px 0;
}

.link-button {
    display: inline-flex;
    align-items: center;
    padding: 12px 25px;
    background: #5D5CDE;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: none;
}

.link-button svg {
    margin-left: 10px;
    width: 16px;
    height: 16px;
}

.link-button:hover {
    background: #4A49B5;
    color: white !important;
    transform: translateY(-3px);
}

/* Shortcode directory styling */
.links-directory-container {
    margin: 30px 0;
}

.links-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.category-box {
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    background: #fff;
    overflow: hidden;
    height: 100%;
}

.category-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: #ddd;
}

.category-box-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.category-box-header h2 {
    margin: 0;
    padding: 0;
    border: 0;
    line-height: 1.3;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-box-content {
    padding: 20px;
}

.category-box-header h2 .category-title-static {
    color: inherit;
    cursor: default;
    text-decoration: none;
}

.category-badge.category-badge--static,
span.category-badge {
    cursor: default;
}

.category-link-count {
    display: inline-block;
    background: #5D5CDE;
    color: white;
    border-radius: 50px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 500;
}

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

.links-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.links-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.link-item {
    display: flex;
    align-items: center;
}

.link-item-content {
    flex-grow: 1;
}

.link-item-title {
    font-weight: 500;
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
}

.link-item-title a {
    color: var(--content-link-color, #222);
    text-decoration: none;
}

.link-item-title a:hover {
    color: #5D5CDE;
}

.links-directory-container {
    --ld-icon-size: 18px;
}

.link-item-title a {
    display: inline;
}

.links-directory-container .links-list .link-item-title a .link-item-icon {
    display: inline-block !important;
    width: var(--ld-icon-size) !important;
    height: var(--ld-icon-size) !important;
    min-width: var(--ld-icon-size) !important;
    max-width: var(--ld-icon-size) !important;
    max-height: var(--ld-icon-size) !important;
    object-fit: contain;
    /* Center the icon on the text's visual middle; scales with font size */
    vertical-align: calc(0.32em - (var(--ld-icon-size) * 0.25)) !important;
    /* Negative top/bottom margins keep the icon from stretching the line */
    margin: calc(var(--ld-icon-size) * -0.25) 8px calc(var(--ld-icon-size) * -0.25) 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 3px;
    float: none !important;
}

.links-directory-container .links-list .link-item-title a .link-item-icon-default {
    color: #888;
    border-radius: 0;
}

/* View All Button Styling - NEW */
.view-all-container {
    margin-top: 15px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    background: #5D5CDE;
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid #5D5CDE;
    min-width: 90px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(93, 92, 222, 0.2);
}

.view-all-btn:hover {
    background: #4A49B5;
    border-color: #4A49B5;
    color: white !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.4);
}

.view-all-btn:focus {
    outline: 2px solid #5D5CDE;
    outline-offset: 2px;
}

.view-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(93, 92, 222, 0.3);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    }
    
    .related-links-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .links-category-header,
    .links-tag-header {
        padding: 30px 0;
    }
    
    .links-tag-header .page-title {
        font-size: 2em;
    }
    
    .tag-description {
        font-size: 16px;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
        gap: 20px;
    }
    
    .related-links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .link-card-actions {
        flex-direction: column;
    }
    
    .related-links-title {
        font-size: 22px;
    }
    
    .tags-list {
        gap: 6px;
    }
    
    .link-tag {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .view-all-btn {
        font-size: 12px;
        padding: 6px 16px;
        min-width: 80px;
    }
}

@media (max-width: 576px) {
    .links-category-header,
    .links-tag-header {
        padding: 25px 0;
    }
    
    .links-tag-header .page-title {
        font-size: 1.8em;
    }
    
    .tag-header-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 15px;
    }
    
    .tag-header-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    .related-links-grid {
        grid-template-columns: 1fr;
    }
    
    .link-card-actions {
        flex-direction: column;
    }
    
    .related-links-title {
        font-size: 20px;
    }
    
    .related-links-description {
        font-size: 15px;
    }
    
    .link-tags {
        padding: 15px;
        margin: 20px 0;
    }
    
    .tags-list {
        gap: 5px;
    }
    
    .link-tag {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .link-tag svg {
        width: 12px;
        height: 12px;
        margin-right: 4px;
    }
    
    .view-all-btn {
        font-size: 11px;
        padding: 5px 14px;
        min-width: 70px;
    }
    
    .links-categories {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dark .link-card,
    .dark .related-link-card,
    .dark .category-box {
        background: #222;
        border-color: #333;
    }
    
    .dark .category-box-header,
    .dark .links-category-header,
    .dark .links-tag-header,
    .dark .no-links-found {
        background: #222;
        border-color: #333;
    }
    
    .dark .links-tag-header {
        background: linear-gradient(135deg, #222 0%, #2a2a2a 100%);
    }
    
    .dark .links-list li {
        border-color: #333;
    }
    
    .dark .link-card-title a,
    .dark .related-link-title a {
        color: #eee;
    }
    
    .dark .link-card-excerpt,
    .dark .link-description,
    .dark .links-category-header .archive-description,
    .dark .links-tag-header .archive-description,
    .dark .related-links-description,
    .dark .tag-description {
        color: #aaa;
    }
    
    .dark .link-card-details,
    .dark .link-category-badge,
    .dark .related-link-category a {
        background: #333;
        color: #ccc !important;
    }
    
    .dark .link-card-details:hover,
    .dark .link-category-badge:hover,
    .dark .related-link-category a:hover {
        background: #444;
        color: #fff !important;
    }
    
    .dark .no-links-found h3 {
        color: #eee;
    }
    
    .dark .no-links-found p {
        color: #ccc;
    }
    
    .dark .rating-text {
        color: #aaa;
    }
    
    .dark .star.empty {
        color: #555;
    }
    
    /* Dark mode tags styling */
    .dark .link-tags {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .dark .link-tags .tags-title {
        color: #eee;
    }
    
    .dark .link-tag {
        background: #333;
        border-color: #5D5CDE;
        color: #5D5CDE !important;
    }
    
    .dark .link-tag:hover {
        background: #5D5CDE;
        color: white !important;
    }
    
    .dark .tag-badge {
        background: #333;
        color: #aaa !important;
        border-color: #444;
    }
    
    .dark .tag-badge:hover {
        background: #5D5CDE;
        color: white !important;
    }
    
    .dark .related-link-tag a {
        background: #333;
        color: #aaa !important;
        border-color: #444;
    }
    
    .dark .related-link-tag a:hover {
        background: #5D5CDE;
        color: white !important;
    }
    
    .dark .links-tag-header .archive-description {
        background: rgba(42,42,42,0.9);
        border-color: rgba(255,255,255,0.1);
    }
    
    .dark .view-all-container {
        border-color: #333;
    }
}

/* ==========================================================
   Partners box layout
   Desktop: 4-column grid. The Partners box fills the first column
   across the first two rows, so the top two rows show Partners +
   3 category columns, and every row after that shows 4 category boxes.
   ========================================================== */
.links-directory-container .links-categories.has-partners {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.links-directory-container .links-categories.has-partners > .partners-box {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.partners-box .partners-title-text {
    display: inline-block;
}

@media (max-width: 900px) {
    .links-directory-container .links-categories.has-partners {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .links-directory-container .links-categories.has-partners > .partners-box {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}

@media (max-width: 576px) {
    .links-directory-container .links-categories.has-partners {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ==========================================================
   Scrollable links list (replaces the "View all" button)
   JS gives every category list the same height (N links) so all
   scrollbars are equal; the colors/size can be changed in
   Links > Box Design.
   ========================================================== */
.links-directory-container {
    --ld-sb-width: 6px;
    --ld-sb-radius: 3px;
    --ld-sb-track: #f1f1f1;
    --ld-sb-thumb: #c4c4c4;
    --ld-sb-thumb-hover: #9a9a9a;
}

.links-directory-container .links-list.links-list-scroll {
    position: relative;
    height: 240px;
    max-height: 240px;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-right: var(--ld-sb-gap, 10px);
    overscroll-behavior: contain;
}

/* Partners box: natural height up to N links (set by JS), then it scrolls */
.links-directory-container .links-list.links-list-scroll.links-list-partners {
    height: auto;
    max-height: 520px;
    overflow-y: auto;
}

/* Keeps a (nearly) full-size slider visible when the list is short */
.links-directory-container .links-list.links-list-scroll.ld-filled::after {
    content: "";
    display: block;
    height: var(--ld-fill, 0);
}

/* Chrome, Edge, Safari */
.links-directory-container .links-list.links-list-scroll::-webkit-scrollbar {
    width: var(--ld-sb-width);
}

.links-directory-container .links-list.links-list-scroll::-webkit-scrollbar-track {
    background: var(--ld-sb-track);
    border-radius: var(--ld-sb-radius);
}

.links-directory-container .links-list.links-list-scroll::-webkit-scrollbar-thumb {
    background: var(--ld-sb-thumb);
    border-radius: var(--ld-sb-radius);
}

.links-directory-container .links-list.links-list-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--ld-sb-thumb-hover);
}

/* Firefox (does not support ::-webkit-scrollbar) */
@supports not selector(::-webkit-scrollbar) {
    .links-directory-container .links-list.links-list-scroll {
        scrollbar-width: thin;
        scrollbar-color: var(--ld-sb-thumb) var(--ld-sb-track);
    }
}

/* ==========================================================================
   "NEW" badge - shared by directory boxes, cards, mini lists, single page
   (Classic text style shown first; the default IMAGE style is further below.)
   Text-only (no box): small italic serif, multi-colour animated gradient,
   animated star, thin dark outline that hugs the glyph shapes.

   Everything is driven by CSS variables so it can be customised from
   Links > Box Design > "NEW Badge" (those settings are written as
   !important overrides on .ld-new). Fallback values below are the defaults.
   ========================================================================== */
@font-face {
    font-family: "LD New Italic";
    src: url("../fonts/ld-new.woff") format("woff");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

.ld-new {
    /* Outline: four hard zero-blur shadows on each axis = outline around the
       star/letters only (never a box), plus a faint soft shadow. */
    --ld-new-outline:
        drop-shadow(var(--ld-new-ow, .9px) 0 0 var(--ld-new-edge, #1a1209))
        drop-shadow(calc(var(--ld-new-ow, .9px) * -1) 0 0 var(--ld-new-edge, #1a1209))
        drop-shadow(0 var(--ld-new-ow, .9px) 0 var(--ld-new-edge, #1a1209))
        drop-shadow(0 calc(var(--ld-new-ow, .9px) * -1) 0 var(--ld-new-edge, #1a1209))
        drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
    /* Warm gradient; first and last stops identical so the loop is seamless */
    --ld-new-grad: linear-gradient(90deg, #ff3d8b 0%, #ff6b4a 20%, #ff9d1c 40%, #ffd23f 60%, #8fe04a 80%, #ff3d8b 100%);
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .4em !important;
    box-sizing: border-box !important;
    height: 1.7em !important;
    margin: 0 0 0 8px !important;
    padding: 0 .1em 0 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-family: "LD New Italic", "Poppins", "Segoe UI", Roboto, Arial, sans-serif !important;
    font-size: var(--ld-new-fs, 11px) !important;
    font-weight: 700 !important;
    font-style: italic !important;
    line-height: 1 !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    text-shadow: none !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    overflow: visible !important;
    flex: none !important;
    filter: var(--ld-new-outline);
    pointer-events: none;
}

.ld-new__spark {
    flex: none;
    display: block;
    width: .95em;
    height: .95em;
    color: #ffd23f;
    transform-origin: 50% 50%;
    animation: ld-new-twinkle 2s ease-in-out infinite, ld-new-starcolor 5s linear infinite;
}

.ld-new__text {
    position: relative;
    display: block;
    line-height: 1.5;
    padding: 0 .12em 0 .04em; /* room for italic overhang + trailing letter-spacing */
    color: transparent !important;
    background-image: var(--ld-new-grad);
    background-size: 200% 100%;
    background-repeat: repeat-x;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: ld-new-flow 3.2s linear infinite;
}

/* Directory boxes */
.link-item-title .ld-new { margin-left: 8px !important; }

/* Single page title */
.ld-new--title { --ld-new-ow: 1.2px; margin-left: 12px !important; font-size: calc(var(--ld-new-fs, 11px) * 1.7) !important; }

/* Overlay on cards (top-left corner of the image) */
.ld-new--card {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    z-index: 5 !important;
    margin: 0 !important;
    font-size: calc(var(--ld-new-fs, 11px) * 1.3) !important;
}

.ld-card--new { border-color: rgba(255, 179, 0, .6); }

/* Sidebar mini lists */
.ld-new--inline { font-size: calc(var(--ld-new-fs, 11px) * .95) !important; }

@keyframes ld-new-flow {
    from { background-position: 0% 0; }
    to   { background-position: 200% 0; } /* exactly one gradient tile -> seamless loop */
}
@keyframes ld-new-starcolor {
    0%, 100% { color: #ff3d8b; }
    20%      { color: #ff6b4a; }
    40%      { color: #ff9d1c; }
    60%      { color: #ffd23f; }
    80%      { color: #8fe04a; }
}
@keyframes ld-new-twinkle {
    0%, 100% { transform: scale(1) rotate(0); opacity: 1; }
    50%      { transform: scale(.72) rotate(35deg); opacity: .85; }
}

/* ==========================================================================
   "NEW" badge - IMAGE style (default). Uses the built-in NEW image, or the
   image chosen in Links > Box Design > "NEW" Badge: Image. Four CSS stars
   twinkle around it. Size/animation/colors are overridable from that page via
   --ld-new-ih (height), --ld-new-ss (star size), --ld-new-star (star color),
   --ld-new-glow (glow color).
   ========================================================================== */
.ld-new.ld-new--img {
    --ld-new-k: 1;
    filter: none !important;
    height: auto !important;
    padding: 0 !important;
    gap: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    letter-spacing: 0 !important;
    overflow: visible !important;
}

.ld-new--img .ld-new__img {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    height: calc(var(--ld-new-ih, 20px) * var(--ld-new-k, 1)) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    transform-origin: 50% 60%;
    animation-name: ld-new-pulse;
    animation-duration: 2.4s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

/* Context scaling (the image height setting is the base value) */
.ld-new--img.ld-new--title  { --ld-new-k: 1.5; }
.ld-new--img.ld-new--card   { --ld-new-k: 1.3; }
.ld-new--img.ld-new--inline { --ld-new-k: .95; }

/* Twinkling stars */
.ld-new--img .ld-new__star {
    --ld-new-ssz: calc(var(--ld-new-ss, calc(var(--ld-new-ih, 20px) * .5)) * var(--ld-new-k, 1));
    position: absolute;
    display: block;
    width: var(--ld-new-ssz);
    height: var(--ld-new-ssz);
    background: var(--ld-new-star, #ffd93b);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    pointer-events: none;
    opacity: 0;
    transform: scale(0);
    animation-name: ld-new-star;
    animation-duration: 1.8s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
.ld-new--img .ld-new__star--1 { top: -22%;  left: -8%;  animation-delay: 0s; }
.ld-new--img .ld-new__star--2 { top: -26%;  right: -6%; animation-delay: -.55s; width: calc(var(--ld-new-ssz) * .75); height: calc(var(--ld-new-ssz) * .75); }
.ld-new--img .ld-new__star--3 { bottom: -22%; right: 12%; animation-delay: -1.1s; }
.ld-new--img .ld-new__star--4 { bottom: -12%; left: -12%; animation-delay: -1.45s; width: calc(var(--ld-new-ssz) * .6); height: calc(var(--ld-new-ssz) * .6); }

/* Directory boxes: keep the badge vertically centred on the link text */
.link-item-title .ld-new--img { vertical-align: middle !important; }

@keyframes ld-new-star {
    0%, 100% { transform: scale(0) rotate(0deg);   opacity: 0; }
    50%      { transform: scale(1) rotate(90deg);  opacity: 1; }
}
@keyframes ld-new-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
@keyframes ld-new-bounce {
    0%, 100% { transform: translateY(0); }
    30%      { transform: translateY(-28%); }
    55%      { transform: translateY(0); }
    75%      { transform: translateY(-10%); }
}
@keyframes ld-new-wiggle {
    0%, 100% { transform: rotate(0); }
    20%      { transform: rotate(-7deg); }
    40%      { transform: rotate(6deg); }
    60%      { transform: rotate(-4deg); }
    80%      { transform: rotate(2deg); }
}
@keyframes ld-new-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-14%); }
}
@keyframes ld-new-glow {
    0%, 100% { filter: drop-shadow(0 0 0 transparent); }
    50%      { filter: drop-shadow(0 0 6px var(--ld-new-glow, #ffb300)) drop-shadow(0 0 2px var(--ld-new-glow, #ffb300)); }
}

@media (prefers-reduced-motion: reduce) {
    .ld-new__text, .ld-new__spark, .ld-new__img, .ld-new__star { animation: none !important; }
    .ld-new--img .ld-new__star { opacity: 0; }
}

/* Mobile safety net: nothing in the shortcode boxes / tag page may force sideways scrolling. */
.links-directory-container,
.links-grid,
.related-links-grid { max-width: 100%; }
.links-directory-container img,
.links-grid img { max-width: 100%; }
@media (pointer: coarse) {
    .links-directory-container .links-list a,
    .link-tag { min-height: 36px; }
}


/* ==========================================================================
   Link alignment: remove every stray left/right space so left, center and
   right alignment sit flush (theme list styles are overridden here).
   ========================================================================== */
.links-directory-container .links-list,
.links-directory-container .links-list > li,
.links-directory-container .links-list .link-item,
.links-directory-container .links-list .link-item-content,
.links-directory-container .links-list .link-item-title {
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
}

.links-directory-container .links-list > li::before,
.links-directory-container .links-list > li::after {
    content: none !important;
    display: none !important;
}

.links-directory-container .links-list .link-item,
.links-directory-container .links-list .link-item-content {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.links-directory-container .links-list .link-item-title a {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Center: balance the right-hand scrollbar gap so links are truly centered */
.links-directory-container.ld-links-align-center .category-box:not(.partners-box) .links-list.links-list-scroll {
    padding-left: calc(var(--ld-sb-gap, 10px) + var(--ld-sb-width, 6px)) !important;
}

.links-directory-container.ld-partners-align-center .partners-box .links-list.links-list-scroll {
    padding-left: var(--ld-sb-gap, 10px) !important;
}

/* No gap on the right edge when right-aligned and the list does not scroll */
.links-directory-container.ld-partners-align-right .partners-box .links-list.links-list-partners {
    padding-right: var(--ld-sb-gap, 10px);
}
