/* ========================================
   Attributed Texts Component
   ======================================== */

.attributed-texts-section {
    margin: 40px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
}

.attributed-texts-title {
    font-size: 1.8em;
    margin: 0 0 25px 0;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

.attributed-texts-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Individual Text Item */
.attributed-text-item {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s;
}

.attributed-text-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Category Badge */
.text-category-badge {
    display: inline-block;
    background: #595f65;
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
}

/* Header Section */
.attributed-text-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
    gap: 20px;
}

/* Person Info */
.person-info {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex: 1;
}

.person-avatar {
    flex-shrink: 0;
}

.person-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e5e5;
}

.person-details {
    flex: 1;
}

.person-name {
    margin: 0 0 5px 0;
    font-size: 1.2em;
}

.person-name a,
.person-name a:visited,
.person-name a:focus {
    color: #333333;
    text-decoration: underline;
}

.person-name a:hover {
    color: #666666;
}

.person-professions {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin-bottom: 4px;
}

.text-role {
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

/* Text Meta */
.text-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85em;
    color: #666;
    text-align: right;
    min-width: 200px;
}

.text-date,
.text-source {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.meta-icon {
    font-size: 1em;
}

/* Text Content */
.attributed-text-content-wrap {
    position: relative;
}

.attributed-text-content-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3em;
    background: linear-gradient(to bottom, transparent, white);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.attributed-text-content-wrap.is-expanded::after {
    opacity: 0;
}

.attributed-text-content {
    font-size: 1em;
    line-height: 1.7;
    color: #333;
    max-height: calc(1em * 1.7 * 5);
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.attributed-text-content.is-expanded {
    max-height: 9999px;
}

.attributed-text-toggle {
    display: none;
    margin-top: 8px;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85em;
    color: #2271b1;
    cursor: pointer;
    text-decoration: underline;
}

.attributed-text-toggle.is-visible {
    display: inline-block;
}

.cpt-single .attributed-text-toggle:hover,
.cpt-single .attributed-text-toggle:focus {
    text-decoration: underline;
}

/* Custom tooltip for #cote- links */
a[data-tooltip] {
    position: relative;
}

a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 0.75em;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

a[data-tooltip]:hover::after,
a[data-tooltip]:focus::after {
    opacity: 1;
}

.attributed-text-content p {
    margin: 0 0 15px 0;
}

.attributed-text-content p:last-child {
    margin-bottom: 0;
}

.attributed-text-content blockquote {
    margin: 15px 0;
    padding: 15px 20px;
    background: #f5f5f5;
    border-left: 4px solid #2271b1;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .attributed-texts-section {
        padding: 20px;
    }

    .attributed-text-header {
        flex-direction: column;
        gap: 15px;
    }

    .text-meta {
        align-items: flex-start;
        text-align: left;
        min-width: 0;
        width: 100%;
    }

    .text-date,
    .text-source {
        justify-content: flex-start;
    }

    .person-avatar img {
        width: 50px;
        height: 50px;
    }

    .attributed-text-item {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .person-info {
        flex-direction: column;
        gap: 10px;
    }

    .person-avatar img {
        width: 60px;
        height: 60px;
    }
}