/* retoor <retoor@molodetz.nl> */

.rendered-content {
    line-height: 1.65;
    word-break: break-word;
}

.rendered-content p {
    margin-bottom: 0.5rem;
}

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

.rendered-content ul,
.rendered-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.rendered-content li {
    margin-bottom: 0.25rem;
}

.rendered-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.25rem 0.75rem;
    margin: 0.5rem 0;
    color: var(--text-secondary);
    background: var(--accent-light);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.rendered-content h1,
.rendered-content h2,
.rendered-content h3,
.rendered-content h4 {
    margin: 1rem 0 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rendered-content h1 { font-size: 1.25rem; }
.rendered-content h2 { font-size: 1.125rem; }
.rendered-content h3 { font-size: 1rem; }
.rendered-content h4 { font-size: 0.9375rem; }

.rendered-content a {
    color: var(--accent);
    text-decoration: underline;
}

.rendered-content a:hover {
    color: var(--accent-hover);
}

.rendered-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.rendered-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
    -webkit-overflow-scrolling: touch;
}

.rendered-content th,
.rendered-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.rendered-content th {
    background: var(--bg-card-hover);
    font-weight: 700;
    color: var(--text-primary);
}

.rendered-content td {
    color: var(--text-secondary);
}

.rendered-content tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.rendered-content code {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.8125em;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--bg-card-hover);
    color: var(--accent);
}

.rendered-content pre {
    margin: 0.75rem 0;
    border-radius: var(--radius);
    overflow-x: auto;
    position: relative;
}

.rendered-content pre code {
    display: block;
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
}

dp-content.rendered-content {
    position: relative;
}

.content-copy-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    z-index: 2;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

dp-content:hover .content-copy-btn,
.content-copy-btn:focus {
    opacity: 1;
}

.content-copy-btn:hover {
    color: var(--white);
    border-color: var(--accent);
}

pre.code-has-copy {
    position: relative;
}

pre.code-has-copy > .code-copy-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 1;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(40, 44, 52, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
    cursor: pointer;
    opacity: 1;
}

pre.code-has-copy > .code-copy-btn:hover {
    color: var(--white);
    border-color: var(--accent);
}

.embed-youtube {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin: 0.75rem 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.embed-youtube iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.rendered-content img:not(.avatar-img) {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 0.5rem 0;
    border: 1px solid var(--border);
}

.rendered-content video {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 0.5rem 0;
    border: 1px solid var(--border);
    background: var(--bg-primary);
}

.rendered-content a[href^="http"]::after {
    content: "\u2197";
    display: inline-block;
    margin-left: 0.125rem;
    font-size: 0.75em;
}

@media (max-width: 480px) {
    .rendered-content ul,
    .rendered-content ol {
        padding-left: 1.125rem;
    }

    .rendered-content h1 { font-size: 1.125rem; }
    .rendered-content h2 { font-size: 1.0625rem; }
    .rendered-content h3 { font-size: 0.9375rem; }
    .rendered-content h4 { font-size: 0.875rem; }

    .rendered-content blockquote {
        padding: 0.25rem 0.5rem;
    }

    .rendered-content pre code {
        padding: 0.75rem;
        font-size: 0.75rem;
    }
}

