/* /app/static/significantstories_com/css/toc.css */
/* Stories page - Series, Topics, and Articles listing */

/* --- Stories Content Container --- */
.stories-content {
    max-width: 800px;
    margin: 0 auto;
}

/* --- Series Card --- */
.series-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    padding: 1.75rem 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

.series-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

/* --- Series Header --- */
.series-header {
    margin-bottom: 1rem;
}

.series-header h2 {
    font-family: var(--serif-font);
    font-size: 1.5rem;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.series-header p {
    font-size: 0.95rem;
    color: #5a6a7a;
    margin: 0;
    line-height: 1.5;
}

/* --- Topics Container --- */
.topics-container {
    border-top: 1px solid #ecf0f1;
    padding-top: 0.5rem;
}

/* --- Topic Accordion --- */
.topic-accordion {
    border-bottom: 1px solid #f0f3f6;
}

.topic-accordion:last-child {
    border-bottom: none;
}

.topic-accordion-header {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 1rem 0.5rem;
    font-size: 1.05rem;
    font-family: var(--primary-font);
    font-weight: 500;
    color: #34495e;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
    border-radius: 8px;
}

.topic-accordion-header:hover {
    color: #3498db;
}

.topic-accordion-icon {
    font-size: 1.25rem;
    font-weight: 300;
    color: #95a5a6;
    transition: transform 0.3s ease;
    width: 24px;
    text-align: center;
}

.topic-accordion-header.active .topic-accordion-icon {
    transform: rotate(45deg);
    color: #3498db;
}

/* --- Topic Accordion Content --- */
.topic-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding: 0 0.5rem;
}

/* --- Article List --- */
.article-list {
    list-style: none;
    padding: 0.5rem 0 1.25rem 1.25rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 2px solid #e8eef3;
}

.article-list li {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    background-color: #f0f4f8;
    transition: all 0.2s ease;

    /* Animation initial state */
    opacity: 0;
    transform: translateY(8px);
}

.article-list li.visible {
    opacity: 1;
    transform: translateY(0);
}

.article-list li:hover {
    background-color: #e8f4fc;
}

.article-list li a {
    color: #34495e;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
    transition: color 0.2s ease;
}

.article-list li:hover a {
    color: #3498db;
}

/* --- Start Badge --- */
.start-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-left: 0.75rem;
}

.start-badge.start-here {
    background-color: #d4edda;
    color: #155724;
}

.start-badge.or-here {
    background-color: #fff3cd;
    color: #856404;
}

/* --- Behind Stories Link --- */
.series-header .behind-stories-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
    background-color: #fdf6e3;
    border: 1px solid #e6d9b8;
    border-radius: 8px;
    font-size: 0.9rem;
    font-style: italic;
    color: #8b7355;
    text-decoration: none;
    transition: all 0.2s ease;
}

.series-header .behind-stories-link:hover {
    background-color: #f5edd6;
    border-color: #c9b896;
    color: #6b5a45;
    text-decoration: none;
}

/* Cards view header */
.series-card-header .behind-stories-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
    background-color: #fdf6e3;
    border: 1px solid #e6d9b8;
    border-radius: 8px;
    font-size: 0.9rem;
    font-style: italic;
    color: #8b7355;
    text-decoration: none;
    transition: all 0.2s ease;
}

.series-card-header .behind-stories-link:hover {
    background-color: #f5edd6;
    border-color: #c9b896;
    color: #6b5a45;
    text-decoration: none;
}

/* --- Page Header Controls --- */
.page-header-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.page-header-controls .layout-toggle {
    margin-top: 0;
}

/* --- Practices Toggle Button --- */
.practices-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #5a6a7a;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.practices-toggle-btn:hover {
    color: #3498db;
    border-color: #3498db;
    background-color: #f0f7fc;
}

.practices-toggle-btn[aria-expanded="true"] {
    color: #3498db;
    border-color: #3498db;
    background-color: #e8f4fc;
}

.practices-toggle-btn svg {
    opacity: 0.7;
}

.practices-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #e0e0e0;
    color: #5a6a7a;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.practices-toggle-btn[aria-expanded="true"] .practices-badge {
    background-color: #3498db;
    color: #ffffff;
}

/* --- Practices Filter Bar --- */
.practices-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
}

.practices-filter-bar[hidden] {
    display: none;
}

.practices-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

/* --- Practice Filter Item (Container) --- */
.practice-filter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.practice-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #95a5a6;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.practice-filter-btn:hover {
    border-color: #b8d4e8;
    opacity: 1;
}

.practice-filter-btn.selected {
    color: #8b7355;
    background-color: #fdf6e3;
    border-color: #c9b896;
    opacity: 1;
}

.practice-filter-btn.selected:hover {
    background-color: #f5edd6;
    border-color: #a89770;
}

.practice-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.practice-filter-icon svg {
    width: 18px;
    height: 18px;
}

.practice-filter-name {
    font-size: 0.65rem;
    font-weight: 500;
    color: #7f8c8d;
    text-align: center;
    max-width: 60px;
    line-height: 1.2;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.practice-filter-name:hover {
    color: #3498db;
}

.practice-filter-item:has(.practice-filter-btn.selected) .practice-filter-name {
    color: #8b7355;
}

/* --- Practice Description Tooltip --- */
.practice-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 280px;
    padding: 1rem;
    background-color: #f5f2ee;
    border: 1px solid #e8e4df;
    color: #5a6a7a;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    text-align: center;
}

.practice-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Arrow pointing up (tooltip below element) */
.practice-tooltip::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: #f5f2ee;
    border-top: none;
}

.practice-tooltip::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 9px solid transparent;
    border-bottom-color: #e8e4df;
    border-top: none;
}

/* --- Clear Button (Text Style) --- */
.practices-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #95a5a6;
    background-color: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.practices-clear-btn:hover {
    color: #e74c3c;
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

/* --- Practices Empty State --- */
.practices-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #7f8c8d;
    font-size: 0.95rem;
}

.practices-empty-state[hidden] {
    display: none;
}

.practices-reset-link {
    color: #3498db;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.practices-reset-link:hover {
    color: #2980b9;
}

/* --- Topic Practice Icons --- */
.topic-practices {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    margin-right: 0.5rem;
}

.topic-practice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #8b7355;
    opacity: 0.7;
}

.topic-practice-icon svg {
    width: 18px;
    height: 18px;
}

/* --- Article Practice Icons (List View) --- */
.article-practices {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: 0.5rem;
}

.article-practice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #8b7355;
    opacity: 0.6;
}

.article-practice-icon svg {
    width: 16px;
    height: 16px;
}

/* --- Filtered Out State --- */
.topic-accordion.filtered-out,
.article-item.filtered-out {
    opacity: 0.35;
}

.topic-accordion.filtered-out .topic-accordion-header,
.article-item.filtered-out a {
    color: #95a5a6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .series-card {
        padding: 1.25rem 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .series-header h2 {
        font-size: 1.35rem;
    }

    .topic-accordion-header {
        padding: 0.875rem 0.25rem;
        font-size: 1rem;
    }

    .article-list li {
        padding: 0.5rem 0.75rem;
    }

    .article-list li a {
        font-size: 0.9rem;
    }
}
