/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

/* Common styles for all templates */
.tag-display-container {
    margin: 20px 0;
    clear: both;
}

.tag-display-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    margin-top: 0;
}

/* Reset link properties that themes may override (T2) */
.tag-display-container a {
    box-shadow: none;
    border-bottom: none;
    background-image: none;
    text-shadow: none;
}

/* Focus styles - visible for keyboard navigation (T2) */
.tag-display-container a:focus {
    outline: none;
}

.tag-display-container a:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Default template styles */
.tag-display-default {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-display-default a {
    display: inline-block;
    background-color: #f1f1f1;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tag-display-default a:hover {
    background-color: #0073aa;
    color: #fff;
}

.tag-display-default a:active {
    transform: translateY(1px);
    opacity: 0.9;
}

.tag-display-default a:visited {
    opacity: 0.85;
}

/* Minimal template styles */
.tag-display-minimal {
    display: inline;
}

.tag-display-minimal a {
    color: #0073aa;
    text-decoration: none;
}

.tag-display-minimal a:hover {
    text-decoration: underline;
}

.tag-display-minimal a:visited {
    opacity: 0.85;
}

.tag-display-minimal .tag-separator {
    display: inline-block;
    margin: 0 5px 0 0;
    color: #666;
}

/* Tag cloud template styles */
.tag-display-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

.tag-display-cloud a {
    display: inline-block;
    padding: 5px 10px;
    background-color: #fff;
    color: #0073aa;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.tag-display-cloud a:hover {
    background-color: #0073aa;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}

.tag-display-cloud a:active {
    transform: translateY(1px);
    opacity: 0.9;
}

/* Outlined template styles */
.tag-display-outlined {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-display-outlined a {
    display: inline-block;
    background-color: transparent;
    color: #0073aa;
    border: 2px solid #0073aa;
    padding: 5px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-display-outlined a:hover {
    background-color: #0073aa;
    color: #fff;
}

.tag-display-outlined a:active {
    transform: translateY(1px);
    opacity: 0.9;
}

.tag-display-outlined a:visited {
    opacity: 0.85;
}

/* Hashtag template styles */
.tag-display-hashtag {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.tag-display-hashtag a {
    display: inline-block;
    color: #0073aa;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.tag-display-hashtag a:hover {
    text-decoration: underline;
}

.tag-display-hashtag a:visited {
    opacity: 0.85;
}

.tag-display-hashtag .tag-hash {
    color: inherit;
    user-select: none;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .tag-display-default,
    .tag-display-cloud {
        gap: 6px;
    }
}

@media screen and (max-width: 600px) {
    .tag-display-default,
    .tag-display-cloud {
        justify-content: flex-start;
    }

    .tag-display-title {
        font-size: 14px;
    }
}

/* Respect user preference for reduced motion (T3) */
@media (prefers-reduced-motion: reduce) {
    .tag-display-default a,
    .tag-display-minimal a,
    .tag-display-cloud a,
    .tag-display-outlined a,
    .tag-display-hashtag a {
        transition: none;
    }

    .tag-display-cloud a:hover {
        transform: none;
    }

    .tag-display-default a:active,
    .tag-display-cloud a:active,
    .tag-display-outlined a:active {
        transform: none;
    }
}

/* ============================================================
   Smart Visibility
   ============================================================ */

/* collapse: tags hidden until the expand button is clicked */
.s7n-tags--collapsed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.s7n-tags--collapsed.s7n-expanded {
    max-height: 600px;
}

/* hidden: display:none, togglable via JS without PHP re-render */
.s7n-tags--hidden {
    display: none;
}

/* seo: visually invisible but present in the DOM for crawlers */
.s7n-tags--seo-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* expand button shown below collapsed tags */
.s7n-tags-expand-btn {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 0.85em;
    padding: 4px 0 0;
    text-decoration: underline;
    display: inline-block;
}

.s7n-tags-expand-btn:hover {
    color: #005177;
}

/* replace: related posts list shown instead of tags */
.s7n-related-posts {
    margin: 0;
}

.s7n-related-posts__title {
    font-weight: bold;
    margin: 0 0 8px;
}

.s7n-related-posts__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.s7n-related-posts__item {
    margin: 0 0 4px;
}

.s7n-related-posts__item a {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .s7n-related-posts__item {
        margin-bottom: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .s7n-related-posts__item a {
        transition: none;
    }
}
