/**
 * 掲示板 個別投稿 (Issue #153 PR5)
 *
 * - measure幅の一段組: 投稿カード → 返信リスト → 返信フォーム → 前後ナビ
 * - 投稿本文は明朝体（--font-serif、日記と同じ「読む」体験）、返信はゴシックのまま
 * - カード/バッジ/ボタンは kk- コンポーネント
 * - 色はすべてトークン＝ライト/ダーク自動追従（旧ダークブロック約380行を削除）
 */

.bbs-single-container {
    padding-top: var(--space-2);
    padding-bottom: var(--space-4);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================
   パンくず
   ================================ */

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb a {
    color: var(--link);
}

.breadcrumb a:hover {
    color: var(--link-hover);
}

.breadcrumb .separator {
    margin: 0 8px;
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ================================
   ヘッダー（中央寄せ・ミンサー下線）
   ================================ */

.bbs-header {
    margin-bottom: var(--space-4);
}

.bbs-header .bbs-title {
    margin: 0 0 var(--space-2);
    line-height: 1.4;
    font-size: 1.9rem;
}

.bbs-meta {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

.official-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffb347, #ff8c42);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 6px;
}

/* ================================
   本文セクション（measure幅の一段組）
   ================================ */

.main-post,
.replies-section,
.reply-form-section,
.post-navigation {
    max-width: var(--measure);
    margin: 0 auto var(--space-3);
}

.main-post {
    padding: var(--space-3);
}

.featured-image {
    margin-bottom: var(--space-3);
}

.post-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

.post-content {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-primary);
}

.post-content p {
    margin-bottom: 1.6em;
    color: inherit;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 1.5em 0;
}

/* ================================
   返信リスト
   ================================ */

/* カード内小見出し（ミンサー下線・控えめサイズ） */
.kk-section-title--sub {
    font-size: 1.25rem;
    margin-bottom: var(--space-2);
}

.kk-section-title--sub::after {
    width: 84px;
    height: 6px;
    margin-top: 8px;
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.reply-item {
    background: var(--bg-inset);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-card);
    padding: var(--space-2) var(--space-3);
    animation: cardFadeIn 0.5s ease-out both;
    animation-delay: calc(var(--reply-index, 0) * 0.08s);
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.reply-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.reply-author {
    font-weight: 600;
    color: var(--accent-strong);
}

.reply-date {
    color: var(--text-muted);
}

.reply-content {
    color: var(--text-primary);
    line-height: 1.8;
}

/* ================================
   返信フォーム
   ================================ */

.reply-form-section {
    padding: var(--space-3);
}

.message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.success-message {
    background: rgba(46, 158, 91, 0.12);
    color: #2e9e5b;
    border: 1px solid rgba(46, 158, 91, 0.3);
}

.error-message {
    background: rgba(228, 87, 76, 0.12);
    color: #e4574c;
    border: 1px solid rgba(228, 87, 76, 0.3);
}

.reply-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* label/input の基本形は global-design-system §6 を継承 */
.form-group label {
    margin-bottom: 0;
}

.required {
    color: #e4574c;
}

.textarea {
    resize: vertical;
    min-height: 120px;
}

.logged-in-user-info {
    background: var(--bg-inset);
    border: 1px solid var(--border-soft);
    padding: 14px 18px;
    border-radius: 12px;
}

.logged-in-user-info p {
    margin: 0;
    color: var(--text-primary);
}

.logged-in-user-info .logged-in-user-name {
    font-size: 1.1rem;
}

.reply-form .btn-submit {
    align-self: flex-start;
}

/* ================================
   前後ナビゲーション
   ================================ */

.post-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: 0;
}

.nav-previous {
    justify-self: start;
}

.nav-center {
    justify-self: center;
}

.nav-next {
    justify-self: end;
}

/* ================================
   レスポンシブ
   ================================ */

@media (max-width: 768px) {
    .bbs-header .bbs-title {
        font-size: 1.4rem;
    }

    .main-post,
    .reply-form-section {
        padding: var(--space-2);
    }

    .reply-item {
        padding: var(--space-2);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .post-navigation {
        grid-template-columns: 1fr 1fr;
    }

    .nav-center {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .reply-form .btn-submit {
        align-self: stretch;
        justify-content: center;
    }
}

/* ================================
   アクセシビリティ
   ================================ */

@media (prefers-reduced-motion: reduce) {
    .bbs-single-container,
    .reply-item {
        animation: none;
    }
}
