/**
 * Forum Single Topic
 *
 * Styles for the single topic view: topic body with vote column and
 * content column (author info, rich text, actions), replies section
 * header, badges in the h1 title, and reply container.
 *
 * Template: templates/forum-topic.php
 *
 * Topic body structure:
 *   .forum-topic__body (2-col grid: vote-col + content-col)
 *     .forum-topic__vote-col (vote buttons via vote-buttons.php)
 *     .forum-topic__content-col
 *       .forum-topic__author
 *         img.forum-topic__avatar
 *         .forum-topic__author-info
 *           .forum-topic__author-name
 *           .forum-topic__author-label (contains <time>)
 *       .forum-topic__content (rich text / markdown output)
 *       .forum-topic__actions
 *
 * Replies section:
 *   .forum-topic__replies-header
 *     h2.forum-topic__replies-title
 *     .forum-topic__replies-page
 *   .forum-topic__replies (container for reply-card.php)
 *
 * Badges in h1 (via forum-base .forum-header__title):
 *   .forum-topic__badge (--pinned, --solved, --closed)
 *
 * @package PC_Kompas_Forum
 */

/* ============================================================================
   TOPIC BADGES — inline in h1 title
   ============================================================================ */

.forum-topic__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
}

.forum-topic__badge svg {
    width: 14px;
    height: 14px;
}

.forum-topic__badge--pinned {
    background: var(--warning-bg);
    color: var(--warning);
}

.forum-topic__badge--solved {
    background: var(--success-bg);
    color: var(--success);
}

.forum-topic__badge--closed {
    background: var(--error-bg);
    color: var(--error);
}

/* ============================================================================
   TOPIC BODY — 2-column grid layout (vote-col + content-col)
   ============================================================================ */

.forum-topic__body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* ============================================================================
   VOTE COLUMN
   ============================================================================ */

.forum-topic__vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0.25rem;
}

/* ============================================================================
   CONTENT COLUMN
   ============================================================================ */

.forum-topic__content-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-width: 0;
}

/* ============================================================================
   AUTHOR INFO
   ============================================================================ */

.forum-topic__author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.forum-topic__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    box-shadow: 0 0 0 1px var(--bg-secondary);
}

.forum-topic__author-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.forum-topic__author-name {
    font-weight: 600;
    font-size: clamp(0.875rem, 1vw + 0.2rem, 0.9375rem);
    color: var(--text-primary);
}

.forum-topic__author-label {
    font-size: clamp(0.75rem, 0.8vw + 0.2rem, 0.8125rem);
    color: var(--text-muted);
}

.forum-topic__author-label time {
    color: var(--text-muted);
}

/* ============================================================================
   TOPIC CONTENT — Rich text / markdown rendered output
   ============================================================================ */

.forum-topic__content {
    line-height: 1.7;
    color: var(--text-primary);
    font-size: clamp(0.9375rem, 1vw + 0.25rem, 1rem);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.forum-topic__content p {
    margin: 0.75em 0;
}

.forum-topic__content > :first-child {
    margin-top: 0;
}

.forum-topic__content > :last-child {
    margin-bottom: 0;
}

.forum-topic__content h2,
.forum-topic__content h3,
.forum-topic__content h4 {
    margin: 1.5em 0 0.5em;
    color: var(--text-primary);
    line-height: 1.3;
}

.forum-topic__content h2 {
    font-size: 1.25rem;
}

.forum-topic__content h3 {
    font-size: 1.125rem;
}

.forum-topic__content h4 {
    font-size: 1rem;
}

.forum-topic__content ul,
.forum-topic__content ol {
    padding-left: 1.5em;
    margin: 0.75em 0;
}

.forum-topic__content li {
    margin: 0.25em 0;
}

.forum-topic__content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1em 0;
    padding: 0.5em 1em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Inline code */
.forum-topic__content :not(pre) > code {
    padding: 0.15em 0.4em;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--text-primary);
}

/* Code blocks */
.forum-topic__content pre {
    margin: 1em 0;
    padding: clamp(0.75rem, 2vw, 1.25rem);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: clamp(0.8125rem, 0.9vw + 0.2rem, 0.875rem);
    line-height: 1.6;
}

.forum-topic__content pre code {
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: inherit;
}

/* Images inside content */
.forum-topic__content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* Links inside content */
.forum-topic__content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.forum-topic__content a:hover {
    color: var(--accent-hover);
}

/* ============================================================================
   TOPIC ACTIONS
   ============================================================================ */

.forum-topic__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

.forum-topic__actions button,
.forum-topic__actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.35em 0.65em;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
}

.forum-topic__actions button:hover,
.forum-topic__actions a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.forum-topic__actions button:focus-visible,
.forum-topic__actions a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.forum-topic__actions svg {
    width: 14px;
    height: 14px;
}

/* ============================================================================
   REPLIES SECTION HEADER
   ============================================================================ */

.forum-topic__replies-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.forum-topic__replies-title {
    font-size: clamp(1.125rem, 2vw + 0.3rem, 1.375rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.forum-topic__replies-page {
    font-size: clamp(0.8125rem, 1vw + 0.2rem, 0.875rem);
    color: var(--text-muted);
}

/* ============================================================================
   REPLIES CONTAINER
   ============================================================================ */

.forum-topic__replies {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vw, 0.75rem);
}
